diff --git a/.obsidian/plugins/copilot/data.json b/.obsidian/plugins/copilot/data.json index e4027704..471c3d0c 100644 --- a/.obsidian/plugins/copilot/data.json +++ b/.obsidian/plugins/copilot/data.json @@ -338,7 +338,7 @@ "autocompleteAcceptKey": "Tab", "allowAdditionalContext": true, "enableWordCompletion": false, - "lastDismissedVersion": null, + "lastDismissedVersion": "2.9.4", "passMarkdownImages": true, "enableCustomPromptTemplating": true, "suggestedDefaultCommands": true diff --git a/.obsidian/plugins/copilot/main.js b/.obsidian/plugins/copilot/main.js index e0726d9c..5ffec626 100644 --- a/.obsidian/plugins/copilot/main.js +++ b/.obsidian/plugins/copilot/main.js @@ -3,10 +3,10 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ -var Oer=Object.create;var u2=Object.defineProperty;var Per=Object.getOwnPropertyDescriptor;var Eer=Object.getOwnPropertyNames;var Ter=Object.getPrototypeOf,Aer=Object.prototype.hasOwnProperty;var dUe=t=>{throw TypeError(t)};var Ier=(t,e,r)=>e in t?u2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var w=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cf=(t,e)=>{for(var r in e)u2(t,r,{get:e[r],enumerable:!0})},fUe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Eer(e))!Aer.call(t,o)&&o!==r&&u2(t,o,{get:()=>e[o],enumerable:!(n=Per(e,o))||n.enumerable});return t};var F=(t,e,r)=>(r=t!=null?Oer(Ter(t)):{},fUe(e||!t||!t.__esModule?u2(r,"default",{value:t,enumerable:!0}):r,t)),zl=t=>fUe(u2({},"__esModule",{value:!0}),t);var Cc=(t,e,r)=>Ier(t,typeof e!="symbol"?e+"":e,r),Mer=(t,e,r)=>e.has(t)||dUe("Cannot "+r);var pUe=(t,e,r)=>e.has(t)?dUe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var mUe=(t,e,r)=>(Mer(t,e,"access private method"),r);function epe(){if(!yK&&(yK=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!yK))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yK(Rer)}var yK,Rer,hUe=w(()=>{Rer=new Uint8Array(16)});function gUe(t,e=0){return Oc[t[e+0]]+Oc[t[e+1]]+Oc[t[e+2]]+Oc[t[e+3]]+"-"+Oc[t[e+4]]+Oc[t[e+5]]+"-"+Oc[t[e+6]]+Oc[t[e+7]]+"-"+Oc[t[e+8]]+Oc[t[e+9]]+"-"+Oc[t[e+10]]+Oc[t[e+11]]+Oc[t[e+12]]+Oc[t[e+13]]+Oc[t[e+14]]+Oc[t[e+15]]}var Oc,yUe=w(()=>{Oc=[];for(let t=0;t<256;++t)Oc.push((t+256).toString(16).slice(1))});var jer,tpe,bUe=w(()=>{jer=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tpe={randomUUID:jer}});function Ner(t,e,r){if(tpe.randomUUID&&!e&&!t)return tpe.randomUUID();t=t||{};let n=t.random||(t.rng||epe)();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 gUe(n)}var yC,_Ue=w(()=>{bUe();hUe();yUe();yC=Ner});var l2=w(()=>{_Ue()});function Ler(t){xUe=t}function bK(){return xUe}function ut(t,e){let r=bK(),n=_K({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===DL?void 0:DL].filter(o=>!!o)});t.common.issues.push(n)}function vK(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 CUe(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 Hr(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{var u,l;let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(u=c??n)!==null&&u!==void 0?u:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(l=c??r)!==null&&l!==void 0?l:s.defaultError}},description:o}}function PUe(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function etr(t){return new RegExp(`^${PUe(t)}$`)}function EUe(t){let e=`${OUe}T${PUe(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 ttr(t,e){return!!((e==="v4"||!e)&&Ker.test(t)||(e==="v6"||!e)&&Jer.test(t))}function rtr(t,e){if(!zer.test(t))return!1;try{let[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||!o.typ||!o.alg||e&&o.alg!==e)}catch{return!1}}function ntr(t,e){return!!((e==="v4"||!e)&&Ger.test(t)||(e==="v6"||!e)&&Yer.test(t))}function otr(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=parseInt(t.toFixed(o).replace(".","")),a=parseInt(e.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}function jL(t){if(t instanceof fp){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=dp.create(jL(n))}return new fp({...t._def,shape:()=>e})}else return t instanceof wC?new wC({...t._def,type:jL(t.element)}):t instanceof dp?dp.create(jL(t.unwrap())):t instanceof qb?qb.create(jL(t.unwrap())):t instanceof Bb?Bb.create(t.items.map(e=>jL(e))):t}function ape(t,e){let r=_C(t),n=_C(e);if(t===e)return{valid:!0,data:t};if(r===bt.object&&n===bt.object){let o=Qn.objectKeys(e),i=Qn.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=ape(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===bt.array&&n===bt.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{var i,a;let s=t(n);if(s instanceof Promise)return s.then(u=>{var l,c;if(!u){let d=wUe(e,n),f=(c=(l=d.fatal)!==null&&l!==void 0?l:r)!==null&&c!==void 0?c:!0;o.addIssue({code:"custom",...d,fatal:f})}});if(!s){let u=wUe(e,n),l=(a=(i=u.fatal)!==null&&i!==void 0?i:r)!==null&&a!==void 0?a:!0;o.addIssue({code:"custom",...u,fatal:l})}}):OE.create()}var Qn,npe,bt,_C,Fe,Der,hm,DL,xUe,_K,Fer,Ed,hr,NL,Of,ope,ipe,YM,f2,kt,c2,d2,_h,vUe,Vr,ker,$er,Ber,qer,Uer,zer,Her,Ver,Wer,rpe,Ker,Ger,Jer,Yer,Zer,Xer,OUe,Qer,CE,ZM,XM,QM,eR,LL,tR,rR,OE,vC,dy,FL,wC,fp,nR,bC,wK,oR,Bb,SK,kL,$L,xK,iR,aR,sR,uR,PE,gm,dp,qb,lR,cR,BL,itr,p2,m2,dR,atr,de,str,IUe,MUe,utr,ltr,RUe,ctr,dtr,ftr,ptr,mtr,htr,gtr,ytr,btr,_tr,vtr,wtr,Str,xtr,Ctr,Otr,Ptr,Etr,Ttr,Atr,Itr,Mtr,Rtr,jtr,SUe,Ntr,Dtr,Ltr,Ftr,ktr,$tr,Btr,qtr,Utr,Wr,Td=w(()=>{(function(t){t.assertEqual=o=>o;function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Qn||(Qn={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(npe||(npe={}));bt=Qn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_C=t=>{switch(typeof t){case"undefined":return bt.undefined;case"string":return bt.string;case"number":return isNaN(t)?bt.nan:bt.number;case"boolean":return bt.boolean;case"function":return bt.function;case"bigint":return bt.bigint;case"symbol":return bt.symbol;case"object":return Array.isArray(t)?bt.array:t===null?bt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?bt.promise:typeof Map<"u"&&t instanceof Map?bt.map:typeof Set<"u"&&t instanceof Set?bt.set:typeof Date<"u"&&t instanceof Date?bt.date:bt.object;default:return bt.unknown}},Fe=Qn.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"]),Der=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),hm=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(;ur.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};hm.create=t=>new hm(t);DL=(t,e)=>{let r;switch(t.code){case Fe.invalid_type:t.received===bt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Fe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Qn.jsonStringifyReplacer)}`;break;case Fe.unrecognized_keys:r=`Unrecognized key(s) in object: ${Qn.joinValues(t.keys,", ")}`;break;case Fe.invalid_union:r="Invalid input";break;case Fe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Qn.joinValues(t.options)}`;break;case Fe.invalid_enum_value:r=`Invalid enum value. Expected ${Qn.joinValues(t.options)}, received '${t.received}'`;break;case Fe.invalid_arguments:r="Invalid function arguments";break;case Fe.invalid_return_type:r="Invalid function return type";break;case Fe.invalid_date:r="Invalid date";break;case Fe.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}"`:Qn.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Fe.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Fe.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 Fe.custom:r="Invalid input";break;case Fe.invalid_intersection_types:r="Intersection results could not be merged";break;case Fe.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Fe.not_finite:r="Number must be finite";break;default:r=e.defaultError,Qn.assertNever(t)}return{message:r}},xUe=DL;_K=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}},Fer=[];Ed=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 hr;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 hr;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}}},hr=Object.freeze({status:"aborted"}),NL=t=>({status:"dirty",value:t}),Of=t=>({status:"valid",value:t}),ope=t=>t.status==="aborted",ipe=t=>t.status==="dirty",YM=t=>t.status==="valid",f2=t=>typeof Promise<"u"&&t instanceof Promise;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(kt||(kt={}));_h=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},vUe=(t,e)=>{if(YM(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 hm(t.common.issues);return this._error=r,this._error}}};Vr=class{get description(){return this._def.description}_getType(e){return _C(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:_C(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ed,ctx:{common:e.parent.common,data:e.data,parsedType:_C(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(f2(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let o={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_C(e)},i=this._parseSync({data:e,path:o.path,parent:o});return vUe(o,i)}"~validate"(e){var r,n;let o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_C(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:o});return YM(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((n=(r=i?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then(i=>YM(i)?{value:i.value}:{issues:o.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_C(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(f2(o)?o:Promise.resolve(o));return vUe(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:Fe.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 gm({schema:this,typeName:de.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 dp.create(this,this._def)}nullable(){return qb.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wC.create(this)}promise(){return PE.create(this,this._def)}or(e){return nR.create([this,e],this._def)}and(e){return oR.create(this,e,this._def)}transform(e){return new gm({...Hr(this._def),schema:this,typeName:de.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new lR({...Hr(this._def),innerType:this,defaultValue:r,typeName:de.ZodDefault})}brand(){return new p2({typeName:de.ZodBranded,type:this,...Hr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new cR({...Hr(this._def),innerType:this,catchValue:r,typeName:de.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return m2.create(this,e)}readonly(){return dR.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ker=/^c[^\s-]{8,}$/i,$er=/^[0-9a-z]+$/,Ber=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qer=/^[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,Uer=/^[a-z0-9_-]{21}$/i,zer=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Her=/^[-+]?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)?)??$/,Ver=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wer="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ker=/^(?:(?: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])$/,Ger=/^(?:(?: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])$/,Jer=/^(([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]))$/,Yer=/^(([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])$/,Zer=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xer=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OUe="((\\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])))",Qer=new RegExp(`^${OUe}$`);CE=class t extends Vr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==bt.string){let i=this._getOrReturnCtx(e);return ut(i,{code:Fe.invalid_type,expected:bt.string,received:i.parsedType}),hr}let n=new Ed,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.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.lengthe.test(o),{validation:r,code:Fe.invalid_string,...kt.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...kt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...kt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...kt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...kt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...kt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...kt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...kt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...kt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...kt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...kt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...kt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...kt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...kt.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...kt.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,...kt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...kt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...kt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...kt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...kt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...kt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...kt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...kt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...kt.errToObj(r)})}nonempty(e){return this.min(1,kt.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{var e;return new CE({checks:[],typeName:de.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Hr(t)})};ZM=class t extends Vr{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)!==bt.number){let i=this._getOrReturnCtx(e);return ut(i,{code:Fe.invalid_type,expected:bt.number,received:i.parsedType}),hr}let n,o=new Ed;for(let i of this._def.checks)i.kind==="int"?Qn.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?otr(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.not_finite,message:i.message}),o.dirty()):Qn.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,kt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,kt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,kt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,kt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:kt.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:kt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:kt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:kt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:kt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:kt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:kt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:kt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:kt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:kt.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.valuee.kind==="int"||e.kind==="multipleOf"&&Qn.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.valuenew ZM({checks:[],typeName:de.ZodNumber,coerce:t?.coerce||!1,...Hr(t)});XM=class t extends Vr{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)!==bt.bigint)return this._getInvalidInput(e);let n,o=new Ed;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.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),ut(n,{code:Fe.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Qn.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ut(r,{code:Fe.invalid_type,expected:bt.bigint,received:r.parsedType}),hr}gte(e,r){return this.setLimit("min",e,!0,kt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,kt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,kt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,kt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:kt.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:kt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:kt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:kt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:kt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:kt.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{var e;return new XM({checks:[],typeName:de.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Hr(t)})};QM=class extends Vr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==bt.boolean){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.boolean,received:n.parsedType}),hr}return Of(e.data)}};QM.create=t=>new QM({typeName:de.ZodBoolean,coerce:t?.coerce||!1,...Hr(t)});eR=class t extends Vr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==bt.date){let i=this._getOrReturnCtx(e);return ut(i,{code:Fe.invalid_type,expected:bt.date,received:i.parsedType}),hr}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ut(i,{code:Fe.invalid_date}),hr}let n=new Ed,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Qn.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:kt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:kt.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.valuenew eR({checks:[],coerce:t?.coerce||!1,typeName:de.ZodDate,...Hr(t)});LL=class extends Vr{_parse(e){if(this._getType(e)!==bt.symbol){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.symbol,received:n.parsedType}),hr}return Of(e.data)}};LL.create=t=>new LL({typeName:de.ZodSymbol,...Hr(t)});tR=class extends Vr{_parse(e){if(this._getType(e)!==bt.undefined){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.undefined,received:n.parsedType}),hr}return Of(e.data)}};tR.create=t=>new tR({typeName:de.ZodUndefined,...Hr(t)});rR=class extends Vr{_parse(e){if(this._getType(e)!==bt.null){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.null,received:n.parsedType}),hr}return Of(e.data)}};rR.create=t=>new rR({typeName:de.ZodNull,...Hr(t)});OE=class extends Vr{constructor(){super(...arguments),this._any=!0}_parse(e){return Of(e.data)}};OE.create=t=>new OE({typeName:de.ZodAny,...Hr(t)});vC=class extends Vr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Of(e.data)}};vC.create=t=>new vC({typeName:de.ZodUnknown,...Hr(t)});dy=class extends Vr{_parse(e){let r=this._getOrReturnCtx(e);return ut(r,{code:Fe.invalid_type,expected:bt.never,received:r.parsedType}),hr}};dy.create=t=>new dy({typeName:de.ZodNever,...Hr(t)});FL=class extends Vr{_parse(e){if(this._getType(e)!==bt.undefined){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.void,received:n.parsedType}),hr}return Of(e.data)}};FL.create=t=>new FL({typeName:de.ZodVoid,...Hr(t)});wC=class t extends Vr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==bt.array)return ut(r,{code:Fe.invalid_type,expected:bt.array,received:r.parsedType}),hr;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.lengtho.maxLength.value&&(ut(r,{code:Fe.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 _h(r,a,r.path,s)))).then(a=>Ed.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new _h(r,a,r.path,s)));return Ed.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:kt.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:kt.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:kt.toString(r)}})}nonempty(e){return this.min(1,e)}};wC.create=(t,e)=>new wC({type:t,minLength:null,maxLength:null,exactLength:null,typeName:de.ZodArray,...Hr(e)});fp=class t extends Vr{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=Qn.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==bt.object){let l=this._getOrReturnCtx(e);return ut(l,{code:Fe.invalid_type,expected:bt.object,received:l.parsedType}),hr}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof dy&&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 _h(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof dy){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&&(ut(o,{code:Fe.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 _h(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=>Ed.mergeObjectSync(n,l)):Ed.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return kt.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i,a,s;let u=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=kt.errToObj(e).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:de.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Qn.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return Qn.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return jL(this)}partial(e){let r={};return Qn.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return Qn.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof dp;)i=i._def.innerType;r[n]=i}}),new t({...this._def,shape:()=>r})}keyof(){return TUe(Qn.objectKeys(this.shape))}};fp.create=(t,e)=>new fp({shape:()=>t,unknownKeys:"strip",catchall:dy.create(),typeName:de.ZodObject,...Hr(e)});fp.strictCreate=(t,e)=>new fp({shape:()=>t,unknownKeys:"strict",catchall:dy.create(),typeName:de.ZodObject,...Hr(e)});fp.lazycreate=(t,e)=>new fp({shape:t,unknownKeys:"strip",catchall:dy.create(),typeName:de.ZodObject,...Hr(e)});nR=class extends Vr{_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 hm(s.ctx.common.issues));return ut(r,{code:Fe.invalid_union,unionErrors:a}),hr}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 hm(u));return ut(r,{code:Fe.invalid_union,unionErrors:s}),hr}}get options(){return this._def.options}};nR.create=(t,e)=>new nR({options:t,typeName:de.ZodUnion,...Hr(e)});bC=t=>t instanceof iR?bC(t.schema):t instanceof gm?bC(t.innerType()):t instanceof aR?[t.value]:t instanceof sR?t.options:t instanceof uR?Qn.objectValues(t.enum):t instanceof lR?bC(t._def.innerType):t instanceof tR?[void 0]:t instanceof rR?[null]:t instanceof dp?[void 0,...bC(t.unwrap())]:t instanceof qb?[null,...bC(t.unwrap())]:t instanceof p2||t instanceof dR?bC(t.unwrap()):t instanceof cR?bC(t._def.innerType):[],wK=class t extends Vr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==bt.object)return ut(r,{code:Fe.invalid_type,expected:bt.object,received:r.parsedType}),hr;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}):(ut(r,{code:Fe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),hr)}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=bC(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:de.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Hr(n)})}};oR=class extends Vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(ope(i)||ope(a))return hr;let s=ape(i.value,a.value);return s.valid?((ipe(i)||ipe(a))&&r.dirty(),{status:r.value,value:s.data}):(ut(n,{code:Fe.invalid_intersection_types}),hr)};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}))}};oR.create=(t,e,r)=>new oR({left:t,right:e,typeName:de.ZodIntersection,...Hr(r)});Bb=class t extends Vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==bt.array)return ut(n,{code:Fe.invalid_type,expected:bt.array,received:n.parsedType}),hr;if(n.data.lengththis._def.items.length&&(ut(n,{code:Fe.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 _h(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Ed.mergeArray(r,a)):Ed.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Bb.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bb({items:t,typeName:de.ZodTuple,rest:null,...Hr(e)})};SK=class t extends Vr{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!==bt.object)return ut(n,{code:Fe.invalid_type,expected:bt.object,received:n.parsedType}),hr;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new _h(n,s,n.path,s)),value:a._parse(new _h(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ed.mergeObjectAsync(r,o):Ed.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Vr?new t({keyType:e,valueType:r,typeName:de.ZodRecord,...Hr(n)}):new t({keyType:CE.create(),valueType:e,typeName:de.ZodRecord,...Hr(r)})}},kL=class extends Vr{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!==bt.map)return ut(n,{code:Fe.invalid_type,expected:bt.map,received:n.parsedType}),hr;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new _h(n,s,n.path,[l,"key"])),value:i._parse(new _h(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 hr;(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 hr;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};kL.create=(t,e,r)=>new kL({valueType:e,keyType:t,typeName:de.ZodMap,...Hr(r)});$L=class t extends Vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==bt.set)return ut(n,{code:Fe.invalid_type,expected:bt.set,received:n.parsedType}),hr;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&(ut(n,{code:Fe.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 hr;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 _h(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:kt.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:kt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};$L.create=(t,e)=>new $L({valueType:t,minSize:null,maxSize:null,typeName:de.ZodSet,...Hr(e)});xK=class t extends Vr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==bt.function)return ut(r,{code:Fe.invalid_type,expected:bt.function,received:r.parsedType}),hr;function n(s,u){return _K({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bK(),DL].filter(l=>!!l),issueData:{code:Fe.invalid_arguments,argumentsError:u}})}function o(s,u){return _K({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bK(),DL].filter(l=>!!l),issueData:{code:Fe.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof PE){let s=this;return Of(async function(...u){let l=new hm([]),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 Of(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new hm([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new hm([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:Bb.create(e).rest(vC.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||Bb.create([]).rest(vC.create()),returns:r||vC.create(),typeName:de.ZodFunction,...Hr(n)})}},iR=class extends Vr{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})}};iR.create=(t,e)=>new iR({getter:t,typeName:de.ZodLazy,...Hr(e)});aR=class extends Vr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ut(r,{received:r.data,code:Fe.invalid_literal,expected:this._def.value}),hr}return{status:"valid",value:e.data}}get value(){return this._def.value}};aR.create=(t,e)=>new aR({value:t,typeName:de.ZodLiteral,...Hr(e)});sR=class t extends Vr{constructor(){super(...arguments),c2.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return ut(r,{expected:Qn.joinValues(n),received:r.parsedType,code:Fe.invalid_type}),hr}if(vK(this,c2,"f")||CUe(this,c2,new Set(this._def.values),"f"),!vK(this,c2,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return ut(r,{received:r.data,code:Fe.invalid_enum_value,options:n}),hr}return Of(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})}};c2=new WeakMap;sR.create=TUe;uR=class extends Vr{constructor(){super(...arguments),d2.set(this,void 0)}_parse(e){let r=Qn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==bt.string&&n.parsedType!==bt.number){let o=Qn.objectValues(r);return ut(n,{expected:Qn.joinValues(o),received:n.parsedType,code:Fe.invalid_type}),hr}if(vK(this,d2,"f")||CUe(this,d2,new Set(Qn.getValidEnumValues(this._def.values)),"f"),!vK(this,d2,"f").has(e.data)){let o=Qn.objectValues(r);return ut(n,{received:n.data,code:Fe.invalid_enum_value,options:o}),hr}return Of(e.data)}get enum(){return this._def.values}};d2=new WeakMap;uR.create=(t,e)=>new uR({values:t,typeName:de.ZodNativeEnum,...Hr(e)});PE=class extends Vr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==bt.promise&&r.common.async===!1)return ut(r,{code:Fe.invalid_type,expected:bt.promise,received:r.parsedType}),hr;let n=r.parsedType===bt.promise?r.data:Promise.resolve(r.data);return Of(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};PE.create=(t,e)=>new PE({type:t,typeName:de.ZodPromise,...Hr(e)});gm=class extends Vr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===de.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=>{ut(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 hr;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?hr:u.status==="dirty"||r.value==="dirty"?NL(u.value):u});{if(r.value==="aborted")return hr;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?hr:s.status==="dirty"||r.value==="dirty"?NL(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"?hr:(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"?hr:(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(!YM(a))return a;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>YM(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);Qn.assertNever(o)}};gm.create=(t,e,r)=>new gm({schema:t,typeName:de.ZodEffects,effect:e,...Hr(r)});gm.createWithPreprocess=(t,e,r)=>new gm({schema:e,effect:{type:"preprocess",transform:t},typeName:de.ZodEffects,...Hr(r)});dp=class extends Vr{_parse(e){return this._getType(e)===bt.undefined?Of(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dp.create=(t,e)=>new dp({innerType:t,typeName:de.ZodOptional,...Hr(e)});qb=class extends Vr{_parse(e){return this._getType(e)===bt.null?Of(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};qb.create=(t,e)=>new qb({innerType:t,typeName:de.ZodNullable,...Hr(e)});lR=class extends Vr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===bt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};lR.create=(t,e)=>new lR({innerType:t,typeName:de.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Hr(e)});cR=class extends Vr{_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 f2(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new hm(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new hm(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};cR.create=(t,e)=>new cR({innerType:t,typeName:de.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Hr(e)});BL=class extends Vr{_parse(e){if(this._getType(e)!==bt.nan){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.nan,received:n.parsedType}),hr}return{status:"valid",value:e.data}}};BL.create=t=>new BL({typeName:de.ZodNaN,...Hr(t)});itr=Symbol("zod_brand"),p2=class extends Vr{_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}},m2=class t extends Vr{_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"?hr:i.status==="dirty"?(r.dirty(),NL(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"?hr: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:de.ZodPipeline})}},dR=class extends Vr{_parse(e){let r=this._def.innerType._parse(e),n=o=>(YM(o)&&(o.value=Object.freeze(o.value)),o);return f2(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};dR.create=(t,e)=>new dR({innerType:t,typeName:de.ZodReadonly,...Hr(e)});atr={object:fp.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"})(de||(de={}));str=(t,e={message:`Input not instance of ${t.name}`})=>AUe(r=>r instanceof t,e),IUe=CE.create,MUe=ZM.create,utr=BL.create,ltr=XM.create,RUe=QM.create,ctr=eR.create,dtr=LL.create,ftr=tR.create,ptr=rR.create,mtr=OE.create,htr=vC.create,gtr=dy.create,ytr=FL.create,btr=wC.create,_tr=fp.create,vtr=fp.strictCreate,wtr=nR.create,Str=wK.create,xtr=oR.create,Ctr=Bb.create,Otr=SK.create,Ptr=kL.create,Etr=$L.create,Ttr=xK.create,Atr=iR.create,Itr=aR.create,Mtr=sR.create,Rtr=uR.create,jtr=PE.create,SUe=gm.create,Ntr=dp.create,Dtr=qb.create,Ltr=gm.createWithPreprocess,Ftr=m2.create,ktr=()=>IUe().optional(),$tr=()=>MUe().optional(),Btr=()=>RUe().optional(),qtr={string:t=>CE.create({...t,coerce:!0}),number:t=>ZM.create({...t,coerce:!0}),boolean:t=>QM.create({...t,coerce:!0}),bigint:t=>XM.create({...t,coerce:!0}),date:t=>eR.create({...t,coerce:!0})},Utr=hr,Wr=Object.freeze({__proto__:null,defaultErrorMap:DL,setErrorMap:Ler,getErrorMap:bK,makeIssue:_K,EMPTY_PATH:Fer,addIssueToContext:ut,ParseStatus:Ed,INVALID:hr,DIRTY:NL,OK:Of,isAborted:ope,isDirty:ipe,isValid:YM,isAsync:f2,get util(){return Qn},get objectUtil(){return npe},ZodParsedType:bt,getParsedType:_C,ZodType:Vr,datetimeRegex:EUe,ZodString:CE,ZodNumber:ZM,ZodBigInt:XM,ZodBoolean:QM,ZodDate:eR,ZodSymbol:LL,ZodUndefined:tR,ZodNull:rR,ZodAny:OE,ZodUnknown:vC,ZodNever:dy,ZodVoid:FL,ZodArray:wC,ZodObject:fp,ZodUnion:nR,ZodDiscriminatedUnion:wK,ZodIntersection:oR,ZodTuple:Bb,ZodRecord:SK,ZodMap:kL,ZodSet:$L,ZodFunction:xK,ZodLazy:iR,ZodLiteral:aR,ZodEnum:sR,ZodNativeEnum:uR,ZodPromise:PE,ZodEffects:gm,ZodTransformer:gm,ZodOptional:dp,ZodNullable:qb,ZodDefault:lR,ZodCatch:cR,ZodNaN:BL,BRAND:itr,ZodBranded:p2,ZodPipeline:m2,ZodReadonly:dR,custom:AUe,Schema:Vr,ZodSchema:Vr,late:atr,get ZodFirstPartyTypeKind(){return de},coerce:qtr,any:mtr,array:btr,bigint:ltr,boolean:RUe,date:ctr,discriminatedUnion:Str,effect:SUe,enum:Mtr,function:Ttr,instanceof:str,intersection:xtr,lazy:Atr,literal:Itr,map:Ptr,nan:utr,nativeEnum:Rtr,never:gtr,null:ptr,nullable:Dtr,number:MUe,object:_tr,oboolean:Btr,onumber:$tr,optional:Ntr,ostring:ktr,pipeline:Ftr,preprocess:Ltr,promise:jtr,record:Otr,set:Etr,strictObject:vtr,string:IUe,symbol:dtr,transformer:SUe,tuple:Ctr,undefined:ftr,union:wtr,unknown:htr,void:ytr,NEVER:Utr,ZodIssueCode:Fe,quotelessJson:Der,ZodError:hm})});var NUe=v((f1n,jUe)=>{function vh(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))}jUe.exports=vh;vh.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};vh.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};vh.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};vh.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)};vh.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};vh.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};vh.prototype.start=vh.prototype.try;vh.prototype.errors=function(){return this._errors};vh.prototype.attempts=function(){return this._attempts};vh.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n=r&&(e=o,r=a)}return e}});var DUe=v(fR=>{var ztr=NUe();fR.operation=function(t){var e=fR.timeouts(t);return new ztr(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};fR.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{LUe.exports=DUe()});var PK=v((h1n,OK)=>{"use strict";var Htr=FUe(),Vtr=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],CK=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}},Wtr=(t,e,r)=>{let n=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=n,t},Ktr=t=>Vtr.includes(t),kUe=(t,e)=>new Promise((r,n)=>{e={onFailedAttempt:()=>{},retries:10,...e};let o=Htr.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 CK)o.stop(),n(a.originalError);else if(a instanceof TypeError&&!Ktr(a.message))o.stop(),n(a);else{Wtr(a,i,e);try{await e.onFailedAttempt(a)}catch(s){n(s);return}o.retry(a)||n(o.mainError())}}})});OK.exports=kUe;OK.exports.default=kUe;OK.exports.AbortError=CK});var $Ue,BUe=w(()=>{$Ue=/^(?:[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 Gtr(t){return typeof t=="string"&&$Ue.test(t)}var EE,qUe=w(()=>{BUe();EE=Gtr});function UUe(t,e=0){return(Pc[t[e+0]]+Pc[t[e+1]]+Pc[t[e+2]]+Pc[t[e+3]]+"-"+Pc[t[e+4]]+Pc[t[e+5]]+"-"+Pc[t[e+6]]+Pc[t[e+7]]+"-"+Pc[t[e+8]]+Pc[t[e+9]]+"-"+Pc[t[e+10]]+Pc[t[e+11]]+Pc[t[e+12]]+Pc[t[e+13]]+Pc[t[e+14]]+Pc[t[e+15]]).toLowerCase()}var Pc,EK,zUe=w(()=>{Pc=[];for(EK=0;EK<256;++EK)Pc.push((EK+256).toString(16).slice(1))});function spe(){if(!TK&&(TK=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!TK))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return TK(Jtr)}var TK,Jtr,HUe=w(()=>{Jtr=new Uint8Array(16)});var Ytr,upe,VUe=w(()=>{Ytr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),upe={randomUUID:Ytr}});function Ztr(t,e,r){if(upe.randomUUID&&!e&&!t)return upe.randomUUID();t=t||{};var n=t.random||(t.rng||spe)();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 UUe(n)}var as,WUe=w(()=>{VUe();HUe();zUe();as=Ztr});var TE=w(()=>{WUe();qUe()});var GUe=v((T1n,lpe)=>{"use strict";var Xtr=Object.prototype.hasOwnProperty,Pf="~";function h2(){}Object.create&&(h2.prototype=Object.create(null),new h2().__proto__||(Pf=!1));function Qtr(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function KUe(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new Qtr(r,n||t,o),a=Pf?Pf+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 IK(t,e){--t._eventsCount===0?t._events=new h2:delete t._events[e]}function Ad(){this._events=new h2,this._eventsCount=0}Ad.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)Xtr.call(r,n)&&e.push(Pf?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Ad.prototype.listeners=function(e){var r=Pf?Pf+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{"use strict";JUe.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 XUe=v((I1n,RK)=>{"use strict";var err=YUe(),MK=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},ZUe=(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 MK(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);err(t.then(n,o),()=>{clearTimeout(i)})});RK.exports=ZUe;RK.exports.default=ZUe;RK.exports.TimeoutError=MK});var QUe=v(cpe=>{"use strict";Object.defineProperty(cpe,"__esModule",{value:!0});function trr(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}cpe.default=trr});var eze=v(fpe=>{"use strict";Object.defineProperty(fpe,"__esModule",{value:!0});var rrr=QUe(),dpe=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=rrr.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}};fpe.default=dpe});var NK=v(mpe=>{"use strict";Object.defineProperty(mpe,"__esModule",{value:!0});var nrr=GUe(),tze=XUe(),orr=eze(),jK=()=>{},irr=new tze.TimeoutError,ppe=class extends nrr{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=jK,this._resolveIdle=jK,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:orr.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._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():tze.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(irr)});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}};mpe.default=ppe});var arr,srr,Vt,DK=w(()=>{g2();arr=(...t)=>fetch(...t),srr=Symbol.for("ls:fetch_implementation"),Vt=t=>async(...e)=>{if(t||pp("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[srr]??arr)(...e);return(t||pp("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var rze,LK,urr,lrr,y2,nze=w(()=>{rze=F(PK(),1),LK=F(NK(),1);DK();urr=[400,401,403,404,405,406,407,408],lrr=[409],y2=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 LK.default?this.queue=new LK.default.default({concurrency:this.maxConcurrency}):this.queue=new LK.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){let n=this.onFailedResponseHook;return this.queue.add(()=>(0,rze.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(urr.includes(+a))throw o;if(lrr.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(()=>Vt(this.debug)(...e).then(r=>r.ok?r:Promise.reject(r)))}}});function hpe(t){return typeof t?._getType=="function"}function gpe(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 oze=w(()=>{});function Kr(t,e){if(!EE(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}var ize=w(()=>{TE()});function FK(t){aze[t]||(console.warn(t),aze[t]=!0)}var aze,ype=w(()=>{aze={}});var b2=v((q1n,sze)=>{var crr="2.0.0",drr=Number.MAX_SAFE_INTEGER||9007199254740991,frr=16,prr=250,mrr=["major","premajor","minor","preminor","patch","prepatch","prerelease"];sze.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:frr,MAX_SAFE_BUILD_LENGTH:prr,MAX_SAFE_INTEGER:drr,RELEASE_TYPES:mrr,SEMVER_SPEC_VERSION:crr,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var _2=v((U1n,uze)=>{var hrr=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};uze.exports=hrr});var qL=v((SC,lze)=>{var{MAX_SAFE_COMPONENT_LENGTH:bpe,MAX_SAFE_BUILD_LENGTH:grr,MAX_LENGTH:yrr}=b2(),brr=_2();SC=lze.exports={};var _rr=SC.re=[],vrr=SC.safeRe=[],wt=SC.src=[],St=SC.t={},wrr=0,_pe="[a-zA-Z0-9-]",Srr=[["\\s",1],["\\d",yrr],[_pe,grr]],xrr=t=>{for(let[e,r]of Srr)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Fr=(t,e,r)=>{let n=xrr(e),o=wrr++;brr(t,o,e),St[t]=o,wt[o]=e,_rr[o]=new RegExp(e,r?"g":void 0),vrr[o]=new RegExp(n,r?"g":void 0)};Fr("NUMERICIDENTIFIER","0|[1-9]\\d*");Fr("NUMERICIDENTIFIERLOOSE","\\d+");Fr("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${_pe}*`);Fr("MAINVERSION",`(${wt[St.NUMERICIDENTIFIER]})\\.(${wt[St.NUMERICIDENTIFIER]})\\.(${wt[St.NUMERICIDENTIFIER]})`);Fr("MAINVERSIONLOOSE",`(${wt[St.NUMERICIDENTIFIERLOOSE]})\\.(${wt[St.NUMERICIDENTIFIERLOOSE]})\\.(${wt[St.NUMERICIDENTIFIERLOOSE]})`);Fr("PRERELEASEIDENTIFIER",`(?:${wt[St.NUMERICIDENTIFIER]}|${wt[St.NONNUMERICIDENTIFIER]})`);Fr("PRERELEASEIDENTIFIERLOOSE",`(?:${wt[St.NUMERICIDENTIFIERLOOSE]}|${wt[St.NONNUMERICIDENTIFIER]})`);Fr("PRERELEASE",`(?:-(${wt[St.PRERELEASEIDENTIFIER]}(?:\\.${wt[St.PRERELEASEIDENTIFIER]})*))`);Fr("PRERELEASELOOSE",`(?:-?(${wt[St.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${wt[St.PRERELEASEIDENTIFIERLOOSE]})*))`);Fr("BUILDIDENTIFIER",`${_pe}+`);Fr("BUILD",`(?:\\+(${wt[St.BUILDIDENTIFIER]}(?:\\.${wt[St.BUILDIDENTIFIER]})*))`);Fr("FULLPLAIN",`v?${wt[St.MAINVERSION]}${wt[St.PRERELEASE]}?${wt[St.BUILD]}?`);Fr("FULL",`^${wt[St.FULLPLAIN]}$`);Fr("LOOSEPLAIN",`[v=\\s]*${wt[St.MAINVERSIONLOOSE]}${wt[St.PRERELEASELOOSE]}?${wt[St.BUILD]}?`);Fr("LOOSE",`^${wt[St.LOOSEPLAIN]}$`);Fr("GTLT","((?:<|>)?=?)");Fr("XRANGEIDENTIFIERLOOSE",`${wt[St.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Fr("XRANGEIDENTIFIER",`${wt[St.NUMERICIDENTIFIER]}|x|X|\\*`);Fr("XRANGEPLAIN",`[v=\\s]*(${wt[St.XRANGEIDENTIFIER]})(?:\\.(${wt[St.XRANGEIDENTIFIER]})(?:\\.(${wt[St.XRANGEIDENTIFIER]})(?:${wt[St.PRERELEASE]})?${wt[St.BUILD]}?)?)?`);Fr("XRANGEPLAINLOOSE",`[v=\\s]*(${wt[St.XRANGEIDENTIFIERLOOSE]})(?:\\.(${wt[St.XRANGEIDENTIFIERLOOSE]})(?:\\.(${wt[St.XRANGEIDENTIFIERLOOSE]})(?:${wt[St.PRERELEASELOOSE]})?${wt[St.BUILD]}?)?)?`);Fr("XRANGE",`^${wt[St.GTLT]}\\s*${wt[St.XRANGEPLAIN]}$`);Fr("XRANGELOOSE",`^${wt[St.GTLT]}\\s*${wt[St.XRANGEPLAINLOOSE]}$`);Fr("COERCEPLAIN",`(^|[^\\d])(\\d{1,${bpe}})(?:\\.(\\d{1,${bpe}}))?(?:\\.(\\d{1,${bpe}}))?`);Fr("COERCE",`${wt[St.COERCEPLAIN]}(?:$|[^\\d])`);Fr("COERCEFULL",wt[St.COERCEPLAIN]+`(?:${wt[St.PRERELEASE]})?(?:${wt[St.BUILD]})?(?:$|[^\\d])`);Fr("COERCERTL",wt[St.COERCE],!0);Fr("COERCERTLFULL",wt[St.COERCEFULL],!0);Fr("LONETILDE","(?:~>?)");Fr("TILDETRIM",`(\\s*)${wt[St.LONETILDE]}\\s+`,!0);SC.tildeTrimReplace="$1~";Fr("TILDE",`^${wt[St.LONETILDE]}${wt[St.XRANGEPLAIN]}$`);Fr("TILDELOOSE",`^${wt[St.LONETILDE]}${wt[St.XRANGEPLAINLOOSE]}$`);Fr("LONECARET","(?:\\^)");Fr("CARETTRIM",`(\\s*)${wt[St.LONECARET]}\\s+`,!0);SC.caretTrimReplace="$1^";Fr("CARET",`^${wt[St.LONECARET]}${wt[St.XRANGEPLAIN]}$`);Fr("CARETLOOSE",`^${wt[St.LONECARET]}${wt[St.XRANGEPLAINLOOSE]}$`);Fr("COMPARATORLOOSE",`^${wt[St.GTLT]}\\s*(${wt[St.LOOSEPLAIN]})$|^$`);Fr("COMPARATOR",`^${wt[St.GTLT]}\\s*(${wt[St.FULLPLAIN]})$|^$`);Fr("COMPARATORTRIM",`(\\s*)${wt[St.GTLT]}\\s*(${wt[St.LOOSEPLAIN]}|${wt[St.XRANGEPLAIN]})`,!0);SC.comparatorTrimReplace="$1$2$3";Fr("HYPHENRANGE",`^\\s*(${wt[St.XRANGEPLAIN]})\\s+-\\s+(${wt[St.XRANGEPLAIN]})\\s*$`);Fr("HYPHENRANGELOOSE",`^\\s*(${wt[St.XRANGEPLAINLOOSE]})\\s+-\\s+(${wt[St.XRANGEPLAINLOOSE]})\\s*$`);Fr("STAR","(<|>)?=?\\s*\\*");Fr("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Fr("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var kK=v((z1n,cze)=>{var Crr=Object.freeze({loose:!0}),Orr=Object.freeze({}),Prr=t=>t?typeof t!="object"?Crr:t:Orr;cze.exports=Prr});var vpe=v((H1n,pze)=>{var dze=/^[0-9]+$/,fze=(t,e)=>{let r=dze.test(t),n=dze.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:tfze(e,t);pze.exports={compareIdentifiers:fze,rcompareIdentifiers:Err}});var Id=v((V1n,yze)=>{var $K=_2(),{MAX_LENGTH:mze,MAX_SAFE_INTEGER:BK}=b2(),{safeRe:hze,t:gze}=qL(),Trr=kK(),{compareIdentifiers:UL}=vpe(),wpe=class t{constructor(e,r){if(r=Trr(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>mze)throw new TypeError(`version is longer than ${mze} characters`);$K("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?hze[gze.LOOSE]:hze[gze.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>BK||this.major<0)throw new TypeError("Invalid major version");if(this.minor>BK||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>BK||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=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]),UL(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}};yze.exports=wpe});var pR=v((W1n,_ze)=>{var bze=Id(),Arr=(t,e,r=!1)=>{if(t instanceof bze)return t;try{return new bze(t,e)}catch(n){if(!r)return null;throw n}};_ze.exports=Arr});var wze=v((K1n,vze)=>{var Irr=pR(),Mrr=(t,e)=>{let r=Irr(t,e);return r?r.version:null};vze.exports=Mrr});var xze=v((G1n,Sze)=>{var Rrr=pR(),jrr=(t,e)=>{let r=Rrr(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};Sze.exports=jrr});var Pze=v((J1n,Oze)=>{var Cze=Id(),Nrr=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new Cze(t instanceof Cze?t.version:t,r).inc(e,n,o).version}catch{return null}};Oze.exports=Nrr});var Aze=v((Y1n,Tze)=>{var Eze=pR(),Drr=(t,e)=>{let r=Eze(t,null,!0),n=Eze(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"};Tze.exports=Drr});var Mze=v((Z1n,Ize)=>{var Lrr=Id(),Frr=(t,e)=>new Lrr(t,e).major;Ize.exports=Frr});var jze=v((X1n,Rze)=>{var krr=Id(),$rr=(t,e)=>new krr(t,e).minor;Rze.exports=$rr});var Dze=v((Q1n,Nze)=>{var Brr=Id(),qrr=(t,e)=>new Brr(t,e).patch;Nze.exports=qrr});var Fze=v((ejn,Lze)=>{var Urr=pR(),zrr=(t,e)=>{let r=Urr(t,e);return r&&r.prerelease.length?r.prerelease:null};Lze.exports=zrr});var wh=v((tjn,$ze)=>{var kze=Id(),Hrr=(t,e,r)=>new kze(t,r).compare(new kze(e,r));$ze.exports=Hrr});var qze=v((rjn,Bze)=>{var Vrr=wh(),Wrr=(t,e,r)=>Vrr(e,t,r);Bze.exports=Wrr});var zze=v((njn,Uze)=>{var Krr=wh(),Grr=(t,e)=>Krr(t,e,!0);Uze.exports=Grr});var qK=v((ojn,Vze)=>{var Hze=Id(),Jrr=(t,e,r)=>{let n=new Hze(t,r),o=new Hze(e,r);return n.compare(o)||n.compareBuild(o)};Vze.exports=Jrr});var Kze=v((ijn,Wze)=>{var Yrr=qK(),Zrr=(t,e)=>t.sort((r,n)=>Yrr(r,n,e));Wze.exports=Zrr});var Jze=v((ajn,Gze)=>{var Xrr=qK(),Qrr=(t,e)=>t.sort((r,n)=>Xrr(n,r,e));Gze.exports=Qrr});var v2=v((sjn,Yze)=>{var enr=wh(),tnr=(t,e,r)=>enr(t,e,r)>0;Yze.exports=tnr});var UK=v((ujn,Zze)=>{var rnr=wh(),nnr=(t,e,r)=>rnr(t,e,r)<0;Zze.exports=nnr});var Spe=v((ljn,Xze)=>{var onr=wh(),inr=(t,e,r)=>onr(t,e,r)===0;Xze.exports=inr});var xpe=v((cjn,Qze)=>{var anr=wh(),snr=(t,e,r)=>anr(t,e,r)!==0;Qze.exports=snr});var zK=v((djn,e2e)=>{var unr=wh(),lnr=(t,e,r)=>unr(t,e,r)>=0;e2e.exports=lnr});var HK=v((fjn,t2e)=>{var cnr=wh(),dnr=(t,e,r)=>cnr(t,e,r)<=0;t2e.exports=dnr});var Cpe=v((pjn,r2e)=>{var fnr=Spe(),pnr=xpe(),mnr=v2(),hnr=zK(),gnr=UK(),ynr=HK(),bnr=(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 fnr(t,r,n);case"!=":return pnr(t,r,n);case">":return mnr(t,r,n);case">=":return hnr(t,r,n);case"<":return gnr(t,r,n);case"<=":return ynr(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};r2e.exports=bnr});var o2e=v((mjn,n2e)=>{var _nr=Id(),vnr=pR(),{safeRe:VK,t:WK}=qL(),wnr=(t,e)=>{if(t instanceof _nr)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?VK[WK.COERCEFULL]:VK[WK.COERCE]);else{let u=e.includePrerelease?VK[WK.COERCERTLFULL]:VK[WK.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 vnr(`${n}.${o}.${i}${a}${s}`,e)};n2e.exports=wnr});var a2e=v((hjn,i2e)=>{var Ope=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}};i2e.exports=Ope});var Sh=v((gjn,c2e)=>{var Snr=/\s+/g,Ppe=class t{constructor(e,r){if(r=Cnr(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Epe)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(Snr," "),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=>!u2e(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&&Mnr(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n0&&(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&&Anr)|(this.options.loose&&Inr))+":"+e,o=s2e.get(n);if(o)return o;let i=this.options.loose,a=i?mp[Ef.HYPHENRANGELOOSE]:mp[Ef.HYPHENRANGE];e=e.replace(a,qnr(this.options.includePrerelease)),na("hyphen replace",e),e=e.replace(mp[Ef.COMPARATORTRIM],Pnr),na("comparator trim",e),e=e.replace(mp[Ef.TILDETRIM],Enr),na("tilde trim",e),e=e.replace(mp[Ef.CARETTRIM],Tnr),na("caret trim",e);let s=e.split(" ").map(d=>Rnr(d,this.options)).join(" ").split(/\s+/).map(d=>Bnr(d,this.options));i&&(s=s.filter(d=>(na("loose invalid filter",d,this.options),!!d.match(mp[Ef.COMPARATORLOOSE])))),na("range list",s);let u=new Map,l=s.map(d=>new Epe(d,this.options));for(let d of l){if(u2e(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return s2e.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>l2e(n,r)&&e.set.some(o=>l2e(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 Onr(e,this.options)}catch{return!1}for(let r=0;rt.value==="<0.0.0-0",Mnr=t=>t.value==="",l2e=(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},Rnr=(t,e)=>(na("comp",t,e),t=Dnr(t,e),na("caret",t),t=jnr(t,e),na("tildes",t),t=Fnr(t,e),na("xrange",t),t=$nr(t,e),na("stars",t),t),Tf=t=>!t||t.toLowerCase()==="x"||t==="*",jnr=(t,e)=>t.trim().split(/\s+/).map(r=>Nnr(r,e)).join(" "),Nnr=(t,e)=>{let r=e.loose?mp[Ef.TILDELOOSE]:mp[Ef.TILDE];return t.replace(r,(n,o,i,a,s)=>{na("tilde",t,n,o,i,a,s);let u;return Tf(o)?u="":Tf(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:Tf(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(na("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,na("tilde return",u),u})},Dnr=(t,e)=>t.trim().split(/\s+/).map(r=>Lnr(r,e)).join(" "),Lnr=(t,e)=>{na("caret",t,e);let r=e.loose?mp[Ef.CARETLOOSE]:mp[Ef.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{na("caret",t,o,i,a,s,u);let l;return Tf(i)?l="":Tf(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Tf(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(na("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`):(na("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`),na("caret return",l),l})},Fnr=(t,e)=>(na("replaceXRanges",t,e),t.split(/\s+/).map(r=>knr(r,e)).join(" ")),knr=(t,e)=>{t=t.trim();let r=e.loose?mp[Ef.XRANGELOOSE]:mp[Ef.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{na("xRange",t,n,o,i,a,s,u);let l=Tf(i),c=l||Tf(a),d=c||Tf(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`),na("xRange return",n),n})},$nr=(t,e)=>(na("replaceStars",t,e),t.trim().replace(mp[Ef.STAR],"")),Bnr=(t,e)=>(na("replaceGTE0",t,e),t.trim().replace(mp[e.includePrerelease?Ef.GTE0PRE:Ef.GTE0],"")),qnr=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(Tf(n)?r="":Tf(o)?r=`>=${n}.0.0${t?"-0":""}`:Tf(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Tf(l)?u="":Tf(c)?u=`<${+l+1}.0.0-0`:Tf(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()),Unr=(t,e,r)=>{for(let n=0;n0){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 w2=v((yjn,g2e)=>{var S2=Symbol("SemVer ANY"),Ipe=class t{static get ANY(){return S2}constructor(e,r){if(r=d2e(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Ape("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===S2?this.value="":this.value=this.operator+this.semver.version,Ape("comp",this)}parse(e){let r=this.options.loose?f2e[p2e.COMPARATORLOOSE]:f2e[p2e.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 m2e(n[2],this.options.loose):this.semver=S2}toString(){return this.value}test(e){if(Ape("Comparator.test",e,this.options.loose),this.semver===S2||e===S2)return!0;if(typeof e=="string")try{e=new m2e(e,this.options)}catch{return!1}return Tpe(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 h2e(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new h2e(this.value,r).test(e.semver):(r=d2e(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("=")||Tpe(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Tpe(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};g2e.exports=Ipe;var d2e=kK(),{safeRe:f2e,t:p2e}=qL(),Tpe=Cpe(),Ape=_2(),m2e=Id(),h2e=Sh()});var x2=v((bjn,y2e)=>{var znr=Sh(),Hnr=(t,e,r)=>{try{e=new znr(e,r)}catch{return!1}return e.test(t)};y2e.exports=Hnr});var _2e=v((_jn,b2e)=>{var Vnr=Sh(),Wnr=(t,e)=>new Vnr(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));b2e.exports=Wnr});var w2e=v((vjn,v2e)=>{var Knr=Id(),Gnr=Sh(),Jnr=(t,e,r)=>{let n=null,o=null,i=null;try{i=new Gnr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new Knr(n,r))}),n};v2e.exports=Jnr});var x2e=v((wjn,S2e)=>{var Ynr=Id(),Znr=Sh(),Xnr=(t,e,r)=>{let n=null,o=null,i=null;try{i=new Znr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new Ynr(n,r))}),n};S2e.exports=Xnr});var P2e=v((Sjn,O2e)=>{var Mpe=Id(),Qnr=Sh(),C2e=v2(),eor=(t,e)=>{t=new Qnr(t,e);let r=new Mpe("0.0.0");if(t.test(r)||(r=new Mpe("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{let s=new Mpe(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||C2e(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||C2e(r,i))&&(r=i)}return r&&t.test(r)?r:null};O2e.exports=eor});var T2e=v((xjn,E2e)=>{var tor=Sh(),ror=(t,e)=>{try{return new tor(t,e).range||"*"}catch{return null}};E2e.exports=ror});var KK=v((Cjn,R2e)=>{var nor=Id(),M2e=w2(),{ANY:oor}=M2e,ior=Sh(),aor=x2(),A2e=v2(),I2e=UK(),sor=HK(),uor=zK(),lor=(t,e,r,n)=>{t=new nor(t,n),e=new ior(e,n);let o,i,a,s,u;switch(r){case">":o=A2e,i=sor,a=I2e,s=">",u=">=";break;case"<":o=I2e,i=uor,a=A2e,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(aor(t,e,n))return!1;for(let l=0;l{p.semver===oor&&(p=new M2e(">=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};R2e.exports=lor});var N2e=v((Ojn,j2e)=>{var cor=KK(),dor=(t,e,r)=>cor(t,e,">",r);j2e.exports=dor});var L2e=v((Pjn,D2e)=>{var por=KK(),mor=(t,e,r)=>por(t,e,"<",r);D2e.exports=mor});var $2e=v((Ejn,k2e)=>{var F2e=Sh(),hor=(t,e,r)=>(t=new F2e(t,r),e=new F2e(e,r),t.intersects(e,r));k2e.exports=hor});var q2e=v((Tjn,B2e)=>{var gor=x2(),yor=wh();B2e.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>yor(c,d,r));for(let c of a)gor(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{var U2e=Sh(),jpe=w2(),{ANY:Rpe}=jpe,C2=x2(),Npe=wh(),bor=(t,e,r={})=>{if(t===e)return!0;t=new U2e(t,r),e=new U2e(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=vor(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},_or=[new jpe(">=0.0.0-0")],z2e=[new jpe(">=0.0.0")],vor=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Rpe){if(e.length===1&&e[0].semver===Rpe)return!0;r.includePrerelease?t=_or:t=z2e}if(e.length===1&&e[0].semver===Rpe){if(r.includePrerelease)return!0;e=z2e}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=H2e(o,p,r):p.operator==="<"||p.operator==="<="?i=V2e(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=Npe(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&&!C2(p,String(o),r)||i&&!C2(p,String(i),r))return null;for(let m of e)if(!C2(p,String(m),r))return!1;return!0}let s,u,l,c,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(c=c||p.operator===">"||p.operator===">=",l=l||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(s=H2e(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!C2(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=V2e(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!C2(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)},H2e=(t,e,r)=>{if(!t)return e;let n=Npe(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},V2e=(t,e,r)=>{if(!t)return e;let n=Npe(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};W2e.exports=bor});var Z2e=v((Ijn,Y2e)=>{var Dpe=qL(),G2e=b2(),wor=Id(),J2e=vpe(),Sor=pR(),xor=wze(),Cor=xze(),Oor=Pze(),Por=Aze(),Eor=Mze(),Tor=jze(),Aor=Dze(),Ior=Fze(),Mor=wh(),Ror=qze(),jor=zze(),Nor=qK(),Dor=Kze(),Lor=Jze(),For=v2(),kor=UK(),$or=Spe(),Bor=xpe(),qor=zK(),Uor=HK(),zor=Cpe(),Hor=o2e(),Vor=w2(),Wor=Sh(),Kor=x2(),Gor=_2e(),Jor=w2e(),Yor=x2e(),Zor=P2e(),Xor=T2e(),Qor=KK(),eir=N2e(),tir=L2e(),rir=$2e(),nir=q2e(),oir=K2e();Y2e.exports={parse:Sor,valid:xor,clean:Cor,inc:Oor,diff:Por,major:Eor,minor:Tor,patch:Aor,prerelease:Ior,compare:Mor,rcompare:Ror,compareLoose:jor,compareBuild:Nor,sort:Dor,rsort:Lor,gt:For,lt:kor,eq:$or,neq:Bor,gte:qor,lte:Uor,cmp:zor,coerce:Hor,Comparator:Vor,Range:Wor,satisfies:Kor,toComparators:Gor,maxSatisfying:Jor,minSatisfying:Yor,minVersion:Zor,validRange:Xor,outside:Qor,gtr:eir,ltr:tir,intersects:rir,simplifyRange:nir,subset:oir,SemVer:wor,re:Dpe.re,src:Dpe.src,tokens:Dpe.t,SEMVER_SPEC_VERSION:G2e.SEMVER_SPEC_VERSION,RELEASE_TYPES:G2e.RELEASE_TYPES,compareIdentifiers:J2e.compareIdentifiers,rcompareIdentifiers:J2e.rcompareIdentifiers}});function xC(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 iir,X2e=w(()=>{iir=F(Z2e(),1)});async function sn(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}n=await t.text();let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Server response: ${n}`;throw t.status===409?new Lpe(o):new Error(o)}var Lpe,Q2e=w(()=>{Lpe=class extends Error{constructor(e){super(e),this.name="LangSmithConflictError"}}});function uir(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function GK(t){return sir.encode(t)}function hp(t,e,r,n){try{let o=JSON.stringify(t,e,r);return GK(o)}catch(o){if(!o.message?.includes("Converting circular structure to JSON"))return console.warn("[WARNING]: LangSmith received unserializable value."),GK("[Unserializable]");console.warn("[WARNING]: LangSmith received circular JSON. This will decrease tracer performance."),typeof n>"u"&&(n=uir()),kpe(t,"",0,[],void 0,0,n);let i;try{zL.length===0?i=JSON.stringify(t,e,r):i=JSON.stringify(t,lir(e),r)}catch{return GK("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;JK.length!==0;){let a=JK.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return GK(i)}}function Fpe(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),JK.push([n,r,e,o])):zL.push([e,r,t]):(n[r]=t,JK.push([n,r,e]))}function kpe(t,e,r,n,o,i,a){i+=1;var s;if(typeof t=="object"&&t!==null){for(s=0;sa.depthLimit){Fpe(e4e,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Fpe(e4e,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s0)for(var n=0;n{e4e="[...]",air={result:"[Circular]"},JK=[],zL=[],sir=new TextEncoder});function r4e(t){let e=XK(),r=i4e(),n=t.extra??{},o=n.metadata;return t.extra={...n,runtime:{...e,...n?.runtime},metadata:{...r,...r.revision_id||t.revision_id?{revision_id:t.revision_id??r.revision_id}:{},...o}},t}async function fir(t){let e=[];for await(let r of t)e.push(r);return e}function $pe(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function n4e(t){return typeof t=="number"?Number(t.toFixed(4)):t}function o4e(t){return"dataset_id"in t||"dataset_name"in t}var cir,dir,pir,Bpe,mir,hir,mR,qpe=w(()=>{TE();nze();oze();g2();ZK();ize();ype();X2e();Q2e();DK();t4e();cir=t=>{let e=t?.toString()??pp("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},dir=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};pir=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};Bpe=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=hp(e.item).length;return this.items.push({action:e.action,payload:e.item,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n}pop(e){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let r=[],n=0;for(;n+(this.peek()?.size??0)0;){let o=this.items.shift();o&&(r.push(o),n+=o.size,this.sizeBytes-=o.size)}if(r.length===0&&this.items.length>0){let o=this.items.shift();r.push(o),n+=o.size,this.sizeBytes-=o.size}return[r.map(o=>({action:o.action,item:o.payload})),()=>r.forEach(o=>o.itemPromiseResolve())]}},mir=20971520,hir=2500,mR=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 Bpe}),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:Ub("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Ub("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=cir(e.tracingSamplingRate),this.apiUrl=$pe(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=$pe(e.apiKey??r.apiKey),this.webUrl=$pe(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.timeout_ms=e.timeout_ms??9e4,this.caller=new y2({...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 y2({maxRetries:2,maxConcurrency:this.traceBatchConcurrency,...e.callerOptions??{},onFailedResponseHook:pir,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode}static getDefaultClientConfig(){let e=pp("API_KEY"),r=pp("ENDPOINT")??"https://api.smith.langchain.com",n=pp("HIDE_INPUTS")==="true",o=pp("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:dir(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/${YK}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),e}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`,i=await this.caller.call(Vt(this.debug),o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(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(Vt(this.debug),a,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(s,`Failed to fetch ${e}`);let u=n?n(await s.json()):await s.json();if(u.length===0||(yield u,u.length0;){let[n,o]=this.autoBatchQueue.pop(e);if(!n.length){o();break}let i=this._processBatch(n,o).catch(console.error);r.push(i)}return Promise.all(r)}async _processBatch(e,r){if(!e.length){r();return}try{let n={runCreates:e.filter(i=>i.action==="create").map(i=>i.item),runUpdates:e.filter(i=>i.action==="update").map(i=>i.item)};(await this._ensureServerInfo())?.batch_ingest_config?.use_multipart_endpoint?await this.multipartIngestRuns(n):await this.batchIngestRuns(n)}finally{r()}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.action==="create"&&(e.item=r4e(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 Vt(this.debug)(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(hir),...this.fetchOptions});await sn(e,"get server info");let r=await e.json();return this.debug&&console.log(` +var Ier=Object.create;var l2=Object.defineProperty;var Mer=Object.getOwnPropertyDescriptor;var Rer=Object.getOwnPropertyNames;var jer=Object.getPrototypeOf,Ner=Object.prototype.hasOwnProperty;var pUe=t=>{throw TypeError(t)};var Der=(t,e,r)=>e in t?l2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var w=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cf=(t,e)=>{for(var r in e)l2(t,r,{get:e[r],enumerable:!0})},mUe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Rer(e))!Ner.call(t,o)&&o!==r&&l2(t,o,{get:()=>e[o],enumerable:!(n=Mer(e,o))||n.enumerable});return t};var F=(t,e,r)=>(r=t!=null?Ier(jer(t)):{},mUe(e||!t||!t.__esModule?l2(r,"default",{value:t,enumerable:!0}):r,t)),zl=t=>mUe(l2({},"__esModule",{value:!0}),t);var Cc=(t,e,r)=>Der(t,typeof e!="symbol"?e+"":e,r),Ler=(t,e,r)=>e.has(t)||pUe("Cannot "+r);var hUe=(t,e,r)=>e.has(t)?pUe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var gUe=(t,e,r)=>(Ler(t,e,"access private method"),r);function npe(){if(!bK&&(bK=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!bK))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return bK(Fer)}var bK,Fer,yUe=w(()=>{Fer=new Uint8Array(16)});function bUe(t,e=0){return Oc[t[e+0]]+Oc[t[e+1]]+Oc[t[e+2]]+Oc[t[e+3]]+"-"+Oc[t[e+4]]+Oc[t[e+5]]+"-"+Oc[t[e+6]]+Oc[t[e+7]]+"-"+Oc[t[e+8]]+Oc[t[e+9]]+"-"+Oc[t[e+10]]+Oc[t[e+11]]+Oc[t[e+12]]+Oc[t[e+13]]+Oc[t[e+14]]+Oc[t[e+15]]}var Oc,_Ue=w(()=>{Oc=[];for(let t=0;t<256;++t)Oc.push((t+256).toString(16).slice(1))});var ker,ope,vUe=w(()=>{ker=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ope={randomUUID:ker}});function $er(t,e,r){if(ope.randomUUID&&!e&&!t)return ope.randomUUID();t=t||{};let n=t.random||(t.rng||npe)();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 bUe(n)}var bC,wUe=w(()=>{vUe();yUe();_Ue();bC=$er});var c2=w(()=>{wUe()});function qer(t){OUe=t}function _K(){return OUe}function ut(t,e){let r=_K(),n=vK({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===LL?void 0:LL].filter(o=>!!o)});t.common.issues.push(n)}function wK(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 PUe(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 Hr(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{var u,l;let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(u=c??n)!==null&&u!==void 0?u:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(l=c??r)!==null&&l!==void 0?l:s.defaultError}},description:o}}function TUe(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function itr(t){return new RegExp(`^${TUe(t)}$`)}function AUe(t){let e=`${EUe}T${TUe(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 atr(t,e){return!!((e==="v4"||!e)&&Xer.test(t)||(e==="v6"||!e)&&etr.test(t))}function str(t,e){if(!Ger.test(t))return!1;try{let[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||!o.typ||!o.alg||e&&o.alg!==e)}catch{return!1}}function utr(t,e){return!!((e==="v4"||!e)&&Qer.test(t)||(e==="v6"||!e)&&ttr.test(t))}function ltr(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=parseInt(t.toFixed(o).replace(".","")),a=parseInt(e.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}function NL(t){if(t instanceof fp){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=dp.create(NL(n))}return new fp({...t._def,shape:()=>e})}else return t instanceof SC?new SC({...t._def,type:NL(t.element)}):t instanceof dp?dp.create(NL(t.unwrap())):t instanceof qb?qb.create(NL(t.unwrap())):t instanceof Bb?Bb.create(t.items.map(e=>NL(e))):t}function lpe(t,e){let r=vC(t),n=vC(e);if(t===e)return{valid:!0,data:t};if(r===bt.object&&n===bt.object){let o=Qn.objectKeys(e),i=Qn.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=lpe(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===bt.array&&n===bt.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{var i,a;let s=t(n);if(s instanceof Promise)return s.then(u=>{var l,c;if(!u){let d=xUe(e,n),f=(c=(l=d.fatal)!==null&&l!==void 0?l:r)!==null&&c!==void 0?c:!0;o.addIssue({code:"custom",...d,fatal:f})}});if(!s){let u=xUe(e,n),l=(a=(i=u.fatal)!==null&&i!==void 0?i:r)!==null&&a!==void 0?a:!0;o.addIssue({code:"custom",...u,fatal:l})}}):OE.create()}var Qn,ape,bt,vC,Fe,Ber,hm,LL,OUe,vK,Uer,Ed,hr,DL,Of,spe,upe,YM,p2,kt,d2,f2,_h,SUe,Vr,zer,Her,Ver,Wer,Ker,Ger,Jer,Yer,Zer,ipe,Xer,Qer,etr,ttr,rtr,ntr,EUe,otr,CE,ZM,XM,QM,eR,FL,tR,rR,OE,wC,dy,kL,SC,fp,nR,_C,SK,oR,Bb,xK,$L,BL,CK,iR,aR,sR,uR,PE,gm,dp,qb,lR,cR,qL,ctr,m2,h2,dR,dtr,de,ftr,RUe,jUe,ptr,mtr,NUe,htr,gtr,ytr,btr,_tr,vtr,wtr,Str,xtr,Ctr,Otr,Ptr,Etr,Ttr,Atr,Itr,Mtr,Rtr,jtr,Ntr,Dtr,Ltr,Ftr,ktr,CUe,$tr,Btr,qtr,Utr,ztr,Htr,Vtr,Wtr,Ktr,Wr,Td=w(()=>{(function(t){t.assertEqual=o=>o;function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Qn||(Qn={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ape||(ape={}));bt=Qn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),vC=t=>{switch(typeof t){case"undefined":return bt.undefined;case"string":return bt.string;case"number":return isNaN(t)?bt.nan:bt.number;case"boolean":return bt.boolean;case"function":return bt.function;case"bigint":return bt.bigint;case"symbol":return bt.symbol;case"object":return Array.isArray(t)?bt.array:t===null?bt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?bt.promise:typeof Map<"u"&&t instanceof Map?bt.map:typeof Set<"u"&&t instanceof Set?bt.set:typeof Date<"u"&&t instanceof Date?bt.date:bt.object;default:return bt.unknown}},Fe=Qn.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"]),Ber=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),hm=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(;ur.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};hm.create=t=>new hm(t);LL=(t,e)=>{let r;switch(t.code){case Fe.invalid_type:t.received===bt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Fe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Qn.jsonStringifyReplacer)}`;break;case Fe.unrecognized_keys:r=`Unrecognized key(s) in object: ${Qn.joinValues(t.keys,", ")}`;break;case Fe.invalid_union:r="Invalid input";break;case Fe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Qn.joinValues(t.options)}`;break;case Fe.invalid_enum_value:r=`Invalid enum value. Expected ${Qn.joinValues(t.options)}, received '${t.received}'`;break;case Fe.invalid_arguments:r="Invalid function arguments";break;case Fe.invalid_return_type:r="Invalid function return type";break;case Fe.invalid_date:r="Invalid date";break;case Fe.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}"`:Qn.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Fe.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Fe.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 Fe.custom:r="Invalid input";break;case Fe.invalid_intersection_types:r="Intersection results could not be merged";break;case Fe.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Fe.not_finite:r="Number must be finite";break;default:r=e.defaultError,Qn.assertNever(t)}return{message:r}},OUe=LL;vK=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}},Uer=[];Ed=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 hr;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 hr;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}}},hr=Object.freeze({status:"aborted"}),DL=t=>({status:"dirty",value:t}),Of=t=>({status:"valid",value:t}),spe=t=>t.status==="aborted",upe=t=>t.status==="dirty",YM=t=>t.status==="valid",p2=t=>typeof Promise<"u"&&t instanceof Promise;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(kt||(kt={}));_h=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},SUe=(t,e)=>{if(YM(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 hm(t.common.issues);return this._error=r,this._error}}};Vr=class{get description(){return this._def.description}_getType(e){return vC(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:vC(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ed,ctx:{common:e.parent.common,data:e.data,parsedType:vC(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(p2(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let o={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vC(e)},i=this._parseSync({data:e,path:o.path,parent:o});return SUe(o,i)}"~validate"(e){var r,n;let o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vC(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:o});return YM(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((n=(r=i?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then(i=>YM(i)?{value:i.value}:{issues:o.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vC(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(p2(o)?o:Promise.resolve(o));return SUe(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:Fe.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 gm({schema:this,typeName:de.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 dp.create(this,this._def)}nullable(){return qb.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return SC.create(this)}promise(){return PE.create(this,this._def)}or(e){return nR.create([this,e],this._def)}and(e){return oR.create(this,e,this._def)}transform(e){return new gm({...Hr(this._def),schema:this,typeName:de.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new lR({...Hr(this._def),innerType:this,defaultValue:r,typeName:de.ZodDefault})}brand(){return new m2({typeName:de.ZodBranded,type:this,...Hr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new cR({...Hr(this._def),innerType:this,catchValue:r,typeName:de.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return h2.create(this,e)}readonly(){return dR.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},zer=/^c[^\s-]{8,}$/i,Her=/^[0-9a-z]+$/,Ver=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Wer=/^[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,Ker=/^[a-z0-9_-]{21}$/i,Ger=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Jer=/^[-+]?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)?)??$/,Yer=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zer="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Xer=/^(?:(?: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])$/,Qer=/^(?:(?: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])$/,etr=/^(([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]))$/,ttr=/^(([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])$/,rtr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ntr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,EUe="((\\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])))",otr=new RegExp(`^${EUe}$`);CE=class t extends Vr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==bt.string){let i=this._getOrReturnCtx(e);return ut(i,{code:Fe.invalid_type,expected:bt.string,received:i.parsedType}),hr}let n=new Ed,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.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.lengthe.test(o),{validation:r,code:Fe.invalid_string,...kt.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...kt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...kt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...kt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...kt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...kt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...kt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...kt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...kt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...kt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...kt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...kt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...kt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...kt.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...kt.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,...kt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...kt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...kt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...kt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...kt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...kt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...kt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...kt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...kt.errToObj(r)})}nonempty(e){return this.min(1,kt.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{var e;return new CE({checks:[],typeName:de.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Hr(t)})};ZM=class t extends Vr{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)!==bt.number){let i=this._getOrReturnCtx(e);return ut(i,{code:Fe.invalid_type,expected:bt.number,received:i.parsedType}),hr}let n,o=new Ed;for(let i of this._def.checks)i.kind==="int"?Qn.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?ltr(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.not_finite,message:i.message}),o.dirty()):Qn.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,kt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,kt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,kt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,kt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:kt.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:kt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:kt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:kt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:kt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:kt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:kt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:kt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:kt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:kt.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.valuee.kind==="int"||e.kind==="multipleOf"&&Qn.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.valuenew ZM({checks:[],typeName:de.ZodNumber,coerce:t?.coerce||!1,...Hr(t)});XM=class t extends Vr{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)!==bt.bigint)return this._getInvalidInput(e);let n,o=new Ed;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.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),ut(n,{code:Fe.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Qn.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ut(r,{code:Fe.invalid_type,expected:bt.bigint,received:r.parsedType}),hr}gte(e,r){return this.setLimit("min",e,!0,kt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,kt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,kt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,kt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:kt.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:kt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:kt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:kt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:kt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:kt.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{var e;return new XM({checks:[],typeName:de.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Hr(t)})};QM=class extends Vr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==bt.boolean){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.boolean,received:n.parsedType}),hr}return Of(e.data)}};QM.create=t=>new QM({typeName:de.ZodBoolean,coerce:t?.coerce||!1,...Hr(t)});eR=class t extends Vr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==bt.date){let i=this._getOrReturnCtx(e);return ut(i,{code:Fe.invalid_type,expected:bt.date,received:i.parsedType}),hr}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ut(i,{code:Fe.invalid_date}),hr}let n=new Ed,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Qn.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:kt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:kt.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.valuenew eR({checks:[],coerce:t?.coerce||!1,typeName:de.ZodDate,...Hr(t)});FL=class extends Vr{_parse(e){if(this._getType(e)!==bt.symbol){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.symbol,received:n.parsedType}),hr}return Of(e.data)}};FL.create=t=>new FL({typeName:de.ZodSymbol,...Hr(t)});tR=class extends Vr{_parse(e){if(this._getType(e)!==bt.undefined){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.undefined,received:n.parsedType}),hr}return Of(e.data)}};tR.create=t=>new tR({typeName:de.ZodUndefined,...Hr(t)});rR=class extends Vr{_parse(e){if(this._getType(e)!==bt.null){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.null,received:n.parsedType}),hr}return Of(e.data)}};rR.create=t=>new rR({typeName:de.ZodNull,...Hr(t)});OE=class extends Vr{constructor(){super(...arguments),this._any=!0}_parse(e){return Of(e.data)}};OE.create=t=>new OE({typeName:de.ZodAny,...Hr(t)});wC=class extends Vr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Of(e.data)}};wC.create=t=>new wC({typeName:de.ZodUnknown,...Hr(t)});dy=class extends Vr{_parse(e){let r=this._getOrReturnCtx(e);return ut(r,{code:Fe.invalid_type,expected:bt.never,received:r.parsedType}),hr}};dy.create=t=>new dy({typeName:de.ZodNever,...Hr(t)});kL=class extends Vr{_parse(e){if(this._getType(e)!==bt.undefined){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.void,received:n.parsedType}),hr}return Of(e.data)}};kL.create=t=>new kL({typeName:de.ZodVoid,...Hr(t)});SC=class t extends Vr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==bt.array)return ut(r,{code:Fe.invalid_type,expected:bt.array,received:r.parsedType}),hr;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.lengtho.maxLength.value&&(ut(r,{code:Fe.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 _h(r,a,r.path,s)))).then(a=>Ed.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new _h(r,a,r.path,s)));return Ed.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:kt.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:kt.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:kt.toString(r)}})}nonempty(e){return this.min(1,e)}};SC.create=(t,e)=>new SC({type:t,minLength:null,maxLength:null,exactLength:null,typeName:de.ZodArray,...Hr(e)});fp=class t extends Vr{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=Qn.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==bt.object){let l=this._getOrReturnCtx(e);return ut(l,{code:Fe.invalid_type,expected:bt.object,received:l.parsedType}),hr}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof dy&&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 _h(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof dy){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&&(ut(o,{code:Fe.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 _h(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=>Ed.mergeObjectSync(n,l)):Ed.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return kt.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i,a,s;let u=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=kt.errToObj(e).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:de.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Qn.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return Qn.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return NL(this)}partial(e){let r={};return Qn.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return Qn.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof dp;)i=i._def.innerType;r[n]=i}}),new t({...this._def,shape:()=>r})}keyof(){return IUe(Qn.objectKeys(this.shape))}};fp.create=(t,e)=>new fp({shape:()=>t,unknownKeys:"strip",catchall:dy.create(),typeName:de.ZodObject,...Hr(e)});fp.strictCreate=(t,e)=>new fp({shape:()=>t,unknownKeys:"strict",catchall:dy.create(),typeName:de.ZodObject,...Hr(e)});fp.lazycreate=(t,e)=>new fp({shape:t,unknownKeys:"strip",catchall:dy.create(),typeName:de.ZodObject,...Hr(e)});nR=class extends Vr{_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 hm(s.ctx.common.issues));return ut(r,{code:Fe.invalid_union,unionErrors:a}),hr}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 hm(u));return ut(r,{code:Fe.invalid_union,unionErrors:s}),hr}}get options(){return this._def.options}};nR.create=(t,e)=>new nR({options:t,typeName:de.ZodUnion,...Hr(e)});_C=t=>t instanceof iR?_C(t.schema):t instanceof gm?_C(t.innerType()):t instanceof aR?[t.value]:t instanceof sR?t.options:t instanceof uR?Qn.objectValues(t.enum):t instanceof lR?_C(t._def.innerType):t instanceof tR?[void 0]:t instanceof rR?[null]:t instanceof dp?[void 0,..._C(t.unwrap())]:t instanceof qb?[null,..._C(t.unwrap())]:t instanceof m2||t instanceof dR?_C(t.unwrap()):t instanceof cR?_C(t._def.innerType):[],SK=class t extends Vr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==bt.object)return ut(r,{code:Fe.invalid_type,expected:bt.object,received:r.parsedType}),hr;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}):(ut(r,{code:Fe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),hr)}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=_C(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:de.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Hr(n)})}};oR=class extends Vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(spe(i)||spe(a))return hr;let s=lpe(i.value,a.value);return s.valid?((upe(i)||upe(a))&&r.dirty(),{status:r.value,value:s.data}):(ut(n,{code:Fe.invalid_intersection_types}),hr)};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}))}};oR.create=(t,e,r)=>new oR({left:t,right:e,typeName:de.ZodIntersection,...Hr(r)});Bb=class t extends Vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==bt.array)return ut(n,{code:Fe.invalid_type,expected:bt.array,received:n.parsedType}),hr;if(n.data.lengththis._def.items.length&&(ut(n,{code:Fe.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 _h(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Ed.mergeArray(r,a)):Ed.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Bb.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bb({items:t,typeName:de.ZodTuple,rest:null,...Hr(e)})};xK=class t extends Vr{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!==bt.object)return ut(n,{code:Fe.invalid_type,expected:bt.object,received:n.parsedType}),hr;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new _h(n,s,n.path,s)),value:a._parse(new _h(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ed.mergeObjectAsync(r,o):Ed.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Vr?new t({keyType:e,valueType:r,typeName:de.ZodRecord,...Hr(n)}):new t({keyType:CE.create(),valueType:e,typeName:de.ZodRecord,...Hr(r)})}},$L=class extends Vr{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!==bt.map)return ut(n,{code:Fe.invalid_type,expected:bt.map,received:n.parsedType}),hr;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new _h(n,s,n.path,[l,"key"])),value:i._parse(new _h(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 hr;(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 hr;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};$L.create=(t,e,r)=>new $L({valueType:e,keyType:t,typeName:de.ZodMap,...Hr(r)});BL=class t extends Vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==bt.set)return ut(n,{code:Fe.invalid_type,expected:bt.set,received:n.parsedType}),hr;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&(ut(n,{code:Fe.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 hr;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 _h(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:kt.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:kt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};BL.create=(t,e)=>new BL({valueType:t,minSize:null,maxSize:null,typeName:de.ZodSet,...Hr(e)});CK=class t extends Vr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==bt.function)return ut(r,{code:Fe.invalid_type,expected:bt.function,received:r.parsedType}),hr;function n(s,u){return vK({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_K(),LL].filter(l=>!!l),issueData:{code:Fe.invalid_arguments,argumentsError:u}})}function o(s,u){return vK({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_K(),LL].filter(l=>!!l),issueData:{code:Fe.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof PE){let s=this;return Of(async function(...u){let l=new hm([]),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 Of(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new hm([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new hm([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:Bb.create(e).rest(wC.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||Bb.create([]).rest(wC.create()),returns:r||wC.create(),typeName:de.ZodFunction,...Hr(n)})}},iR=class extends Vr{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})}};iR.create=(t,e)=>new iR({getter:t,typeName:de.ZodLazy,...Hr(e)});aR=class extends Vr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ut(r,{received:r.data,code:Fe.invalid_literal,expected:this._def.value}),hr}return{status:"valid",value:e.data}}get value(){return this._def.value}};aR.create=(t,e)=>new aR({value:t,typeName:de.ZodLiteral,...Hr(e)});sR=class t extends Vr{constructor(){super(...arguments),d2.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return ut(r,{expected:Qn.joinValues(n),received:r.parsedType,code:Fe.invalid_type}),hr}if(wK(this,d2,"f")||PUe(this,d2,new Set(this._def.values),"f"),!wK(this,d2,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return ut(r,{received:r.data,code:Fe.invalid_enum_value,options:n}),hr}return Of(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})}};d2=new WeakMap;sR.create=IUe;uR=class extends Vr{constructor(){super(...arguments),f2.set(this,void 0)}_parse(e){let r=Qn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==bt.string&&n.parsedType!==bt.number){let o=Qn.objectValues(r);return ut(n,{expected:Qn.joinValues(o),received:n.parsedType,code:Fe.invalid_type}),hr}if(wK(this,f2,"f")||PUe(this,f2,new Set(Qn.getValidEnumValues(this._def.values)),"f"),!wK(this,f2,"f").has(e.data)){let o=Qn.objectValues(r);return ut(n,{received:n.data,code:Fe.invalid_enum_value,options:o}),hr}return Of(e.data)}get enum(){return this._def.values}};f2=new WeakMap;uR.create=(t,e)=>new uR({values:t,typeName:de.ZodNativeEnum,...Hr(e)});PE=class extends Vr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==bt.promise&&r.common.async===!1)return ut(r,{code:Fe.invalid_type,expected:bt.promise,received:r.parsedType}),hr;let n=r.parsedType===bt.promise?r.data:Promise.resolve(r.data);return Of(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};PE.create=(t,e)=>new PE({type:t,typeName:de.ZodPromise,...Hr(e)});gm=class extends Vr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===de.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=>{ut(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 hr;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?hr:u.status==="dirty"||r.value==="dirty"?DL(u.value):u});{if(r.value==="aborted")return hr;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?hr:s.status==="dirty"||r.value==="dirty"?DL(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"?hr:(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"?hr:(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(!YM(a))return a;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>YM(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);Qn.assertNever(o)}};gm.create=(t,e,r)=>new gm({schema:t,typeName:de.ZodEffects,effect:e,...Hr(r)});gm.createWithPreprocess=(t,e,r)=>new gm({schema:e,effect:{type:"preprocess",transform:t},typeName:de.ZodEffects,...Hr(r)});dp=class extends Vr{_parse(e){return this._getType(e)===bt.undefined?Of(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dp.create=(t,e)=>new dp({innerType:t,typeName:de.ZodOptional,...Hr(e)});qb=class extends Vr{_parse(e){return this._getType(e)===bt.null?Of(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};qb.create=(t,e)=>new qb({innerType:t,typeName:de.ZodNullable,...Hr(e)});lR=class extends Vr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===bt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};lR.create=(t,e)=>new lR({innerType:t,typeName:de.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Hr(e)});cR=class extends Vr{_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 p2(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new hm(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new hm(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};cR.create=(t,e)=>new cR({innerType:t,typeName:de.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Hr(e)});qL=class extends Vr{_parse(e){if(this._getType(e)!==bt.nan){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.nan,received:n.parsedType}),hr}return{status:"valid",value:e.data}}};qL.create=t=>new qL({typeName:de.ZodNaN,...Hr(t)});ctr=Symbol("zod_brand"),m2=class extends Vr{_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}},h2=class t extends Vr{_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"?hr:i.status==="dirty"?(r.dirty(),DL(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"?hr: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:de.ZodPipeline})}},dR=class extends Vr{_parse(e){let r=this._def.innerType._parse(e),n=o=>(YM(o)&&(o.value=Object.freeze(o.value)),o);return p2(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};dR.create=(t,e)=>new dR({innerType:t,typeName:de.ZodReadonly,...Hr(e)});dtr={object:fp.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"})(de||(de={}));ftr=(t,e={message:`Input not instance of ${t.name}`})=>MUe(r=>r instanceof t,e),RUe=CE.create,jUe=ZM.create,ptr=qL.create,mtr=XM.create,NUe=QM.create,htr=eR.create,gtr=FL.create,ytr=tR.create,btr=rR.create,_tr=OE.create,vtr=wC.create,wtr=dy.create,Str=kL.create,xtr=SC.create,Ctr=fp.create,Otr=fp.strictCreate,Ptr=nR.create,Etr=SK.create,Ttr=oR.create,Atr=Bb.create,Itr=xK.create,Mtr=$L.create,Rtr=BL.create,jtr=CK.create,Ntr=iR.create,Dtr=aR.create,Ltr=sR.create,Ftr=uR.create,ktr=PE.create,CUe=gm.create,$tr=dp.create,Btr=qb.create,qtr=gm.createWithPreprocess,Utr=h2.create,ztr=()=>RUe().optional(),Htr=()=>jUe().optional(),Vtr=()=>NUe().optional(),Wtr={string:t=>CE.create({...t,coerce:!0}),number:t=>ZM.create({...t,coerce:!0}),boolean:t=>QM.create({...t,coerce:!0}),bigint:t=>XM.create({...t,coerce:!0}),date:t=>eR.create({...t,coerce:!0})},Ktr=hr,Wr=Object.freeze({__proto__:null,defaultErrorMap:LL,setErrorMap:qer,getErrorMap:_K,makeIssue:vK,EMPTY_PATH:Uer,addIssueToContext:ut,ParseStatus:Ed,INVALID:hr,DIRTY:DL,OK:Of,isAborted:spe,isDirty:upe,isValid:YM,isAsync:p2,get util(){return Qn},get objectUtil(){return ape},ZodParsedType:bt,getParsedType:vC,ZodType:Vr,datetimeRegex:AUe,ZodString:CE,ZodNumber:ZM,ZodBigInt:XM,ZodBoolean:QM,ZodDate:eR,ZodSymbol:FL,ZodUndefined:tR,ZodNull:rR,ZodAny:OE,ZodUnknown:wC,ZodNever:dy,ZodVoid:kL,ZodArray:SC,ZodObject:fp,ZodUnion:nR,ZodDiscriminatedUnion:SK,ZodIntersection:oR,ZodTuple:Bb,ZodRecord:xK,ZodMap:$L,ZodSet:BL,ZodFunction:CK,ZodLazy:iR,ZodLiteral:aR,ZodEnum:sR,ZodNativeEnum:uR,ZodPromise:PE,ZodEffects:gm,ZodTransformer:gm,ZodOptional:dp,ZodNullable:qb,ZodDefault:lR,ZodCatch:cR,ZodNaN:qL,BRAND:ctr,ZodBranded:m2,ZodPipeline:h2,ZodReadonly:dR,custom:MUe,Schema:Vr,ZodSchema:Vr,late:dtr,get ZodFirstPartyTypeKind(){return de},coerce:Wtr,any:_tr,array:xtr,bigint:mtr,boolean:NUe,date:htr,discriminatedUnion:Etr,effect:CUe,enum:Ltr,function:jtr,instanceof:ftr,intersection:Ttr,lazy:Ntr,literal:Dtr,map:Mtr,nan:ptr,nativeEnum:Ftr,never:wtr,null:btr,nullable:Btr,number:jUe,object:Ctr,oboolean:Vtr,onumber:Htr,optional:$tr,ostring:ztr,pipeline:Utr,preprocess:qtr,promise:ktr,record:Itr,set:Rtr,strictObject:Otr,string:RUe,symbol:gtr,transformer:CUe,tuple:Atr,undefined:ytr,union:Ptr,unknown:vtr,void:Str,NEVER:Ktr,ZodIssueCode:Fe,quotelessJson:Ber,ZodError:hm})});var LUe=v((y1n,DUe)=>{function vh(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))}DUe.exports=vh;vh.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};vh.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};vh.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};vh.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)};vh.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};vh.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};vh.prototype.start=vh.prototype.try;vh.prototype.errors=function(){return this._errors};vh.prototype.attempts=function(){return this._attempts};vh.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n=r&&(e=o,r=a)}return e}});var FUe=v(fR=>{var Gtr=LUe();fR.operation=function(t){var e=fR.timeouts(t);return new Gtr(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};fR.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{kUe.exports=FUe()});var EK=v((v1n,PK)=>{"use strict";var Jtr=$Ue(),Ytr=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],OK=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}},Ztr=(t,e,r)=>{let n=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=n,t},Xtr=t=>Ytr.includes(t),BUe=(t,e)=>new Promise((r,n)=>{e={onFailedAttempt:()=>{},retries:10,...e};let o=Jtr.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 OK)o.stop(),n(a.originalError);else if(a instanceof TypeError&&!Xtr(a.message))o.stop(),n(a);else{Ztr(a,i,e);try{await e.onFailedAttempt(a)}catch(s){n(s);return}o.retry(a)||n(o.mainError())}}})});PK.exports=BUe;PK.exports.default=BUe;PK.exports.AbortError=OK});var qUe,UUe=w(()=>{qUe=/^(?:[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 Qtr(t){return typeof t=="string"&&qUe.test(t)}var EE,zUe=w(()=>{UUe();EE=Qtr});function HUe(t,e=0){return(Pc[t[e+0]]+Pc[t[e+1]]+Pc[t[e+2]]+Pc[t[e+3]]+"-"+Pc[t[e+4]]+Pc[t[e+5]]+"-"+Pc[t[e+6]]+Pc[t[e+7]]+"-"+Pc[t[e+8]]+Pc[t[e+9]]+"-"+Pc[t[e+10]]+Pc[t[e+11]]+Pc[t[e+12]]+Pc[t[e+13]]+Pc[t[e+14]]+Pc[t[e+15]]).toLowerCase()}var Pc,TK,VUe=w(()=>{Pc=[];for(TK=0;TK<256;++TK)Pc.push((TK+256).toString(16).slice(1))});function cpe(){if(!AK&&(AK=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!AK))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return AK(err)}var AK,err,WUe=w(()=>{err=new Uint8Array(16)});var trr,dpe,KUe=w(()=>{trr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),dpe={randomUUID:trr}});function rrr(t,e,r){if(dpe.randomUUID&&!e&&!t)return dpe.randomUUID();t=t||{};var n=t.random||(t.rng||cpe)();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 HUe(n)}var as,GUe=w(()=>{KUe();WUe();VUe();as=rrr});var TE=w(()=>{GUe();zUe()});var YUe=v((j1n,fpe)=>{"use strict";var nrr=Object.prototype.hasOwnProperty,Pf="~";function g2(){}Object.create&&(g2.prototype=Object.create(null),new g2().__proto__||(Pf=!1));function orr(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function JUe(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new orr(r,n||t,o),a=Pf?Pf+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 MK(t,e){--t._eventsCount===0?t._events=new g2:delete t._events[e]}function Ad(){this._events=new g2,this._eventsCount=0}Ad.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)nrr.call(r,n)&&e.push(Pf?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Ad.prototype.listeners=function(e){var r=Pf?Pf+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{"use strict";ZUe.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 eze=v((D1n,jK)=>{"use strict";var irr=XUe(),RK=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},QUe=(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 RK(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);irr(t.then(n,o),()=>{clearTimeout(i)})});jK.exports=QUe;jK.exports.default=QUe;jK.exports.TimeoutError=RK});var tze=v(ppe=>{"use strict";Object.defineProperty(ppe,"__esModule",{value:!0});function arr(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}ppe.default=arr});var rze=v(hpe=>{"use strict";Object.defineProperty(hpe,"__esModule",{value:!0});var srr=tze(),mpe=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=srr.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}};hpe.default=mpe});var DK=v(ype=>{"use strict";Object.defineProperty(ype,"__esModule",{value:!0});var urr=YUe(),nze=eze(),lrr=rze(),NK=()=>{},crr=new nze.TimeoutError,gpe=class extends urr{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=NK,this._resolveIdle=NK,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:lrr.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._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():nze.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(crr)});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}};ype.default=gpe});var drr,frr,Vt,LK=w(()=>{y2();drr=(...t)=>fetch(...t),frr=Symbol.for("ls:fetch_implementation"),Vt=t=>async(...e)=>{if(t||pp("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[frr]??drr)(...e);return(t||pp("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var oze,FK,prr,mrr,b2,ize=w(()=>{oze=F(EK(),1),FK=F(DK(),1);LK();prr=[400,401,403,404,405,406,407,408],mrr=[409],b2=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 FK.default?this.queue=new FK.default.default({concurrency:this.maxConcurrency}):this.queue=new FK.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){let n=this.onFailedResponseHook;return this.queue.add(()=>(0,oze.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(prr.includes(+a))throw o;if(mrr.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(()=>Vt(this.debug)(...e).then(r=>r.ok?r:Promise.reject(r)))}}});function bpe(t){return typeof t?._getType=="function"}function _pe(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 aze=w(()=>{});function Kr(t,e){if(!EE(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}var sze=w(()=>{TE()});function kK(t){uze[t]||(console.warn(t),uze[t]=!0)}var uze,vpe=w(()=>{uze={}});var _2=v((W1n,lze)=>{var hrr="2.0.0",grr=Number.MAX_SAFE_INTEGER||9007199254740991,yrr=16,brr=250,_rr=["major","premajor","minor","preminor","patch","prepatch","prerelease"];lze.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:yrr,MAX_SAFE_BUILD_LENGTH:brr,MAX_SAFE_INTEGER:grr,RELEASE_TYPES:_rr,SEMVER_SPEC_VERSION:hrr,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var v2=v((K1n,cze)=>{var vrr=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};cze.exports=vrr});var UL=v((xC,dze)=>{var{MAX_SAFE_COMPONENT_LENGTH:wpe,MAX_SAFE_BUILD_LENGTH:wrr,MAX_LENGTH:Srr}=_2(),xrr=v2();xC=dze.exports={};var Crr=xC.re=[],Orr=xC.safeRe=[],wt=xC.src=[],St=xC.t={},Prr=0,Spe="[a-zA-Z0-9-]",Err=[["\\s",1],["\\d",Srr],[Spe,wrr]],Trr=t=>{for(let[e,r]of Err)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Fr=(t,e,r)=>{let n=Trr(e),o=Prr++;xrr(t,o,e),St[t]=o,wt[o]=e,Crr[o]=new RegExp(e,r?"g":void 0),Orr[o]=new RegExp(n,r?"g":void 0)};Fr("NUMERICIDENTIFIER","0|[1-9]\\d*");Fr("NUMERICIDENTIFIERLOOSE","\\d+");Fr("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Spe}*`);Fr("MAINVERSION",`(${wt[St.NUMERICIDENTIFIER]})\\.(${wt[St.NUMERICIDENTIFIER]})\\.(${wt[St.NUMERICIDENTIFIER]})`);Fr("MAINVERSIONLOOSE",`(${wt[St.NUMERICIDENTIFIERLOOSE]})\\.(${wt[St.NUMERICIDENTIFIERLOOSE]})\\.(${wt[St.NUMERICIDENTIFIERLOOSE]})`);Fr("PRERELEASEIDENTIFIER",`(?:${wt[St.NUMERICIDENTIFIER]}|${wt[St.NONNUMERICIDENTIFIER]})`);Fr("PRERELEASEIDENTIFIERLOOSE",`(?:${wt[St.NUMERICIDENTIFIERLOOSE]}|${wt[St.NONNUMERICIDENTIFIER]})`);Fr("PRERELEASE",`(?:-(${wt[St.PRERELEASEIDENTIFIER]}(?:\\.${wt[St.PRERELEASEIDENTIFIER]})*))`);Fr("PRERELEASELOOSE",`(?:-?(${wt[St.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${wt[St.PRERELEASEIDENTIFIERLOOSE]})*))`);Fr("BUILDIDENTIFIER",`${Spe}+`);Fr("BUILD",`(?:\\+(${wt[St.BUILDIDENTIFIER]}(?:\\.${wt[St.BUILDIDENTIFIER]})*))`);Fr("FULLPLAIN",`v?${wt[St.MAINVERSION]}${wt[St.PRERELEASE]}?${wt[St.BUILD]}?`);Fr("FULL",`^${wt[St.FULLPLAIN]}$`);Fr("LOOSEPLAIN",`[v=\\s]*${wt[St.MAINVERSIONLOOSE]}${wt[St.PRERELEASELOOSE]}?${wt[St.BUILD]}?`);Fr("LOOSE",`^${wt[St.LOOSEPLAIN]}$`);Fr("GTLT","((?:<|>)?=?)");Fr("XRANGEIDENTIFIERLOOSE",`${wt[St.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Fr("XRANGEIDENTIFIER",`${wt[St.NUMERICIDENTIFIER]}|x|X|\\*`);Fr("XRANGEPLAIN",`[v=\\s]*(${wt[St.XRANGEIDENTIFIER]})(?:\\.(${wt[St.XRANGEIDENTIFIER]})(?:\\.(${wt[St.XRANGEIDENTIFIER]})(?:${wt[St.PRERELEASE]})?${wt[St.BUILD]}?)?)?`);Fr("XRANGEPLAINLOOSE",`[v=\\s]*(${wt[St.XRANGEIDENTIFIERLOOSE]})(?:\\.(${wt[St.XRANGEIDENTIFIERLOOSE]})(?:\\.(${wt[St.XRANGEIDENTIFIERLOOSE]})(?:${wt[St.PRERELEASELOOSE]})?${wt[St.BUILD]}?)?)?`);Fr("XRANGE",`^${wt[St.GTLT]}\\s*${wt[St.XRANGEPLAIN]}$`);Fr("XRANGELOOSE",`^${wt[St.GTLT]}\\s*${wt[St.XRANGEPLAINLOOSE]}$`);Fr("COERCEPLAIN",`(^|[^\\d])(\\d{1,${wpe}})(?:\\.(\\d{1,${wpe}}))?(?:\\.(\\d{1,${wpe}}))?`);Fr("COERCE",`${wt[St.COERCEPLAIN]}(?:$|[^\\d])`);Fr("COERCEFULL",wt[St.COERCEPLAIN]+`(?:${wt[St.PRERELEASE]})?(?:${wt[St.BUILD]})?(?:$|[^\\d])`);Fr("COERCERTL",wt[St.COERCE],!0);Fr("COERCERTLFULL",wt[St.COERCEFULL],!0);Fr("LONETILDE","(?:~>?)");Fr("TILDETRIM",`(\\s*)${wt[St.LONETILDE]}\\s+`,!0);xC.tildeTrimReplace="$1~";Fr("TILDE",`^${wt[St.LONETILDE]}${wt[St.XRANGEPLAIN]}$`);Fr("TILDELOOSE",`^${wt[St.LONETILDE]}${wt[St.XRANGEPLAINLOOSE]}$`);Fr("LONECARET","(?:\\^)");Fr("CARETTRIM",`(\\s*)${wt[St.LONECARET]}\\s+`,!0);xC.caretTrimReplace="$1^";Fr("CARET",`^${wt[St.LONECARET]}${wt[St.XRANGEPLAIN]}$`);Fr("CARETLOOSE",`^${wt[St.LONECARET]}${wt[St.XRANGEPLAINLOOSE]}$`);Fr("COMPARATORLOOSE",`^${wt[St.GTLT]}\\s*(${wt[St.LOOSEPLAIN]})$|^$`);Fr("COMPARATOR",`^${wt[St.GTLT]}\\s*(${wt[St.FULLPLAIN]})$|^$`);Fr("COMPARATORTRIM",`(\\s*)${wt[St.GTLT]}\\s*(${wt[St.LOOSEPLAIN]}|${wt[St.XRANGEPLAIN]})`,!0);xC.comparatorTrimReplace="$1$2$3";Fr("HYPHENRANGE",`^\\s*(${wt[St.XRANGEPLAIN]})\\s+-\\s+(${wt[St.XRANGEPLAIN]})\\s*$`);Fr("HYPHENRANGELOOSE",`^\\s*(${wt[St.XRANGEPLAINLOOSE]})\\s+-\\s+(${wt[St.XRANGEPLAINLOOSE]})\\s*$`);Fr("STAR","(<|>)?=?\\s*\\*");Fr("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Fr("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var $K=v((G1n,fze)=>{var Arr=Object.freeze({loose:!0}),Irr=Object.freeze({}),Mrr=t=>t?typeof t!="object"?Arr:t:Irr;fze.exports=Mrr});var xpe=v((J1n,hze)=>{var pze=/^[0-9]+$/,mze=(t,e)=>{let r=pze.test(t),n=pze.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:tmze(e,t);hze.exports={compareIdentifiers:mze,rcompareIdentifiers:Rrr}});var Id=v((Y1n,_ze)=>{var BK=v2(),{MAX_LENGTH:gze,MAX_SAFE_INTEGER:qK}=_2(),{safeRe:yze,t:bze}=UL(),jrr=$K(),{compareIdentifiers:zL}=xpe(),Cpe=class t{constructor(e,r){if(r=jrr(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>gze)throw new TypeError(`version is longer than ${gze} characters`);BK("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?yze[bze.LOOSE]:yze[bze.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>qK||this.major<0)throw new TypeError("Invalid major version");if(this.minor>qK||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>qK||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=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]),zL(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}};_ze.exports=Cpe});var pR=v((Z1n,wze)=>{var vze=Id(),Nrr=(t,e,r=!1)=>{if(t instanceof vze)return t;try{return new vze(t,e)}catch(n){if(!r)return null;throw n}};wze.exports=Nrr});var xze=v((X1n,Sze)=>{var Drr=pR(),Lrr=(t,e)=>{let r=Drr(t,e);return r?r.version:null};Sze.exports=Lrr});var Oze=v((Q1n,Cze)=>{var Frr=pR(),krr=(t,e)=>{let r=Frr(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};Cze.exports=krr});var Tze=v((ejn,Eze)=>{var Pze=Id(),$rr=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new Pze(t instanceof Pze?t.version:t,r).inc(e,n,o).version}catch{return null}};Eze.exports=$rr});var Mze=v((tjn,Ize)=>{var Aze=pR(),Brr=(t,e)=>{let r=Aze(t,null,!0),n=Aze(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"};Ize.exports=Brr});var jze=v((rjn,Rze)=>{var qrr=Id(),Urr=(t,e)=>new qrr(t,e).major;Rze.exports=Urr});var Dze=v((njn,Nze)=>{var zrr=Id(),Hrr=(t,e)=>new zrr(t,e).minor;Nze.exports=Hrr});var Fze=v((ojn,Lze)=>{var Vrr=Id(),Wrr=(t,e)=>new Vrr(t,e).patch;Lze.exports=Wrr});var $ze=v((ijn,kze)=>{var Krr=pR(),Grr=(t,e)=>{let r=Krr(t,e);return r&&r.prerelease.length?r.prerelease:null};kze.exports=Grr});var wh=v((ajn,qze)=>{var Bze=Id(),Jrr=(t,e,r)=>new Bze(t,r).compare(new Bze(e,r));qze.exports=Jrr});var zze=v((sjn,Uze)=>{var Yrr=wh(),Zrr=(t,e,r)=>Yrr(e,t,r);Uze.exports=Zrr});var Vze=v((ujn,Hze)=>{var Xrr=wh(),Qrr=(t,e)=>Xrr(t,e,!0);Hze.exports=Qrr});var UK=v((ljn,Kze)=>{var Wze=Id(),enr=(t,e,r)=>{let n=new Wze(t,r),o=new Wze(e,r);return n.compare(o)||n.compareBuild(o)};Kze.exports=enr});var Jze=v((cjn,Gze)=>{var tnr=UK(),rnr=(t,e)=>t.sort((r,n)=>tnr(r,n,e));Gze.exports=rnr});var Zze=v((djn,Yze)=>{var nnr=UK(),onr=(t,e)=>t.sort((r,n)=>nnr(n,r,e));Yze.exports=onr});var w2=v((fjn,Xze)=>{var inr=wh(),anr=(t,e,r)=>inr(t,e,r)>0;Xze.exports=anr});var zK=v((pjn,Qze)=>{var snr=wh(),unr=(t,e,r)=>snr(t,e,r)<0;Qze.exports=unr});var Ope=v((mjn,e2e)=>{var lnr=wh(),cnr=(t,e,r)=>lnr(t,e,r)===0;e2e.exports=cnr});var Ppe=v((hjn,t2e)=>{var dnr=wh(),fnr=(t,e,r)=>dnr(t,e,r)!==0;t2e.exports=fnr});var HK=v((gjn,r2e)=>{var pnr=wh(),mnr=(t,e,r)=>pnr(t,e,r)>=0;r2e.exports=mnr});var VK=v((yjn,n2e)=>{var hnr=wh(),gnr=(t,e,r)=>hnr(t,e,r)<=0;n2e.exports=gnr});var Epe=v((bjn,o2e)=>{var ynr=Ope(),bnr=Ppe(),_nr=w2(),vnr=HK(),wnr=zK(),Snr=VK(),xnr=(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 ynr(t,r,n);case"!=":return bnr(t,r,n);case">":return _nr(t,r,n);case">=":return vnr(t,r,n);case"<":return wnr(t,r,n);case"<=":return Snr(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};o2e.exports=xnr});var a2e=v((_jn,i2e)=>{var Cnr=Id(),Onr=pR(),{safeRe:WK,t:KK}=UL(),Pnr=(t,e)=>{if(t instanceof Cnr)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?WK[KK.COERCEFULL]:WK[KK.COERCE]);else{let u=e.includePrerelease?WK[KK.COERCERTLFULL]:WK[KK.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 Onr(`${n}.${o}.${i}${a}${s}`,e)};i2e.exports=Pnr});var u2e=v((vjn,s2e)=>{var Tpe=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}};s2e.exports=Tpe});var Sh=v((wjn,f2e)=>{var Enr=/\s+/g,Ape=class t{constructor(e,r){if(r=Anr(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Ipe)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(Enr," "),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=>!c2e(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&&Lnr(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n0&&(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&&Nnr)|(this.options.loose&&Dnr))+":"+e,o=l2e.get(n);if(o)return o;let i=this.options.loose,a=i?mp[Ef.HYPHENRANGELOOSE]:mp[Ef.HYPHENRANGE];e=e.replace(a,Wnr(this.options.includePrerelease)),na("hyphen replace",e),e=e.replace(mp[Ef.COMPARATORTRIM],Mnr),na("comparator trim",e),e=e.replace(mp[Ef.TILDETRIM],Rnr),na("tilde trim",e),e=e.replace(mp[Ef.CARETTRIM],jnr),na("caret trim",e);let s=e.split(" ").map(d=>Fnr(d,this.options)).join(" ").split(/\s+/).map(d=>Vnr(d,this.options));i&&(s=s.filter(d=>(na("loose invalid filter",d,this.options),!!d.match(mp[Ef.COMPARATORLOOSE])))),na("range list",s);let u=new Map,l=s.map(d=>new Ipe(d,this.options));for(let d of l){if(c2e(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return l2e.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>d2e(n,r)&&e.set.some(o=>d2e(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 Inr(e,this.options)}catch{return!1}for(let r=0;rt.value==="<0.0.0-0",Lnr=t=>t.value==="",d2e=(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},Fnr=(t,e)=>(na("comp",t,e),t=Bnr(t,e),na("caret",t),t=knr(t,e),na("tildes",t),t=Unr(t,e),na("xrange",t),t=Hnr(t,e),na("stars",t),t),Tf=t=>!t||t.toLowerCase()==="x"||t==="*",knr=(t,e)=>t.trim().split(/\s+/).map(r=>$nr(r,e)).join(" "),$nr=(t,e)=>{let r=e.loose?mp[Ef.TILDELOOSE]:mp[Ef.TILDE];return t.replace(r,(n,o,i,a,s)=>{na("tilde",t,n,o,i,a,s);let u;return Tf(o)?u="":Tf(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:Tf(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(na("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,na("tilde return",u),u})},Bnr=(t,e)=>t.trim().split(/\s+/).map(r=>qnr(r,e)).join(" "),qnr=(t,e)=>{na("caret",t,e);let r=e.loose?mp[Ef.CARETLOOSE]:mp[Ef.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{na("caret",t,o,i,a,s,u);let l;return Tf(i)?l="":Tf(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Tf(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(na("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`):(na("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`),na("caret return",l),l})},Unr=(t,e)=>(na("replaceXRanges",t,e),t.split(/\s+/).map(r=>znr(r,e)).join(" ")),znr=(t,e)=>{t=t.trim();let r=e.loose?mp[Ef.XRANGELOOSE]:mp[Ef.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{na("xRange",t,n,o,i,a,s,u);let l=Tf(i),c=l||Tf(a),d=c||Tf(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`),na("xRange return",n),n})},Hnr=(t,e)=>(na("replaceStars",t,e),t.trim().replace(mp[Ef.STAR],"")),Vnr=(t,e)=>(na("replaceGTE0",t,e),t.trim().replace(mp[e.includePrerelease?Ef.GTE0PRE:Ef.GTE0],"")),Wnr=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(Tf(n)?r="":Tf(o)?r=`>=${n}.0.0${t?"-0":""}`:Tf(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Tf(l)?u="":Tf(c)?u=`<${+l+1}.0.0-0`:Tf(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()),Knr=(t,e,r)=>{for(let n=0;n0){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 S2=v((Sjn,b2e)=>{var x2=Symbol("SemVer ANY"),jpe=class t{static get ANY(){return x2}constructor(e,r){if(r=p2e(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Rpe("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===x2?this.value="":this.value=this.operator+this.semver.version,Rpe("comp",this)}parse(e){let r=this.options.loose?m2e[h2e.COMPARATORLOOSE]:m2e[h2e.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 g2e(n[2],this.options.loose):this.semver=x2}toString(){return this.value}test(e){if(Rpe("Comparator.test",e,this.options.loose),this.semver===x2||e===x2)return!0;if(typeof e=="string")try{e=new g2e(e,this.options)}catch{return!1}return Mpe(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 y2e(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new y2e(this.value,r).test(e.semver):(r=p2e(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("=")||Mpe(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Mpe(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};b2e.exports=jpe;var p2e=$K(),{safeRe:m2e,t:h2e}=UL(),Mpe=Epe(),Rpe=v2(),g2e=Id(),y2e=Sh()});var C2=v((xjn,_2e)=>{var Gnr=Sh(),Jnr=(t,e,r)=>{try{e=new Gnr(e,r)}catch{return!1}return e.test(t)};_2e.exports=Jnr});var w2e=v((Cjn,v2e)=>{var Ynr=Sh(),Znr=(t,e)=>new Ynr(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));v2e.exports=Znr});var x2e=v((Ojn,S2e)=>{var Xnr=Id(),Qnr=Sh(),eor=(t,e,r)=>{let n=null,o=null,i=null;try{i=new Qnr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new Xnr(n,r))}),n};S2e.exports=eor});var O2e=v((Pjn,C2e)=>{var tor=Id(),ror=Sh(),nor=(t,e,r)=>{let n=null,o=null,i=null;try{i=new ror(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new tor(n,r))}),n};C2e.exports=nor});var T2e=v((Ejn,E2e)=>{var Npe=Id(),oor=Sh(),P2e=w2(),ior=(t,e)=>{t=new oor(t,e);let r=new Npe("0.0.0");if(t.test(r)||(r=new Npe("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{let s=new Npe(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||P2e(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||P2e(r,i))&&(r=i)}return r&&t.test(r)?r:null};E2e.exports=ior});var I2e=v((Tjn,A2e)=>{var aor=Sh(),sor=(t,e)=>{try{return new aor(t,e).range||"*"}catch{return null}};A2e.exports=sor});var GK=v((Ajn,N2e)=>{var uor=Id(),j2e=S2(),{ANY:lor}=j2e,cor=Sh(),dor=C2(),M2e=w2(),R2e=zK(),por=VK(),mor=HK(),hor=(t,e,r,n)=>{t=new uor(t,n),e=new cor(e,n);let o,i,a,s,u;switch(r){case">":o=M2e,i=por,a=R2e,s=">",u=">=";break;case"<":o=R2e,i=mor,a=M2e,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(dor(t,e,n))return!1;for(let l=0;l{p.semver===lor&&(p=new j2e(">=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};N2e.exports=hor});var L2e=v((Ijn,D2e)=>{var gor=GK(),yor=(t,e,r)=>gor(t,e,">",r);D2e.exports=yor});var k2e=v((Mjn,F2e)=>{var bor=GK(),_or=(t,e,r)=>bor(t,e,"<",r);F2e.exports=_or});var q2e=v((Rjn,B2e)=>{var $2e=Sh(),vor=(t,e,r)=>(t=new $2e(t,r),e=new $2e(e,r),t.intersects(e,r));B2e.exports=vor});var z2e=v((jjn,U2e)=>{var wor=C2(),Sor=wh();U2e.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>Sor(c,d,r));for(let c of a)wor(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{var H2e=Sh(),Lpe=S2(),{ANY:Dpe}=Lpe,O2=C2(),Fpe=wh(),xor=(t,e,r={})=>{if(t===e)return!0;t=new H2e(t,r),e=new H2e(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=Oor(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},Cor=[new Lpe(">=0.0.0-0")],V2e=[new Lpe(">=0.0.0")],Oor=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Dpe){if(e.length===1&&e[0].semver===Dpe)return!0;r.includePrerelease?t=Cor:t=V2e}if(e.length===1&&e[0].semver===Dpe){if(r.includePrerelease)return!0;e=V2e}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=W2e(o,p,r):p.operator==="<"||p.operator==="<="?i=K2e(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=Fpe(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&&!O2(p,String(o),r)||i&&!O2(p,String(i),r))return null;for(let m of e)if(!O2(p,String(m),r))return!1;return!0}let s,u,l,c,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(c=c||p.operator===">"||p.operator===">=",l=l||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(s=W2e(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!O2(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=K2e(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!O2(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)},W2e=(t,e,r)=>{if(!t)return e;let n=Fpe(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},K2e=(t,e,r)=>{if(!t)return e;let n=Fpe(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};G2e.exports=xor});var Q2e=v((Djn,X2e)=>{var kpe=UL(),Y2e=_2(),Por=Id(),Z2e=xpe(),Eor=pR(),Tor=xze(),Aor=Oze(),Ior=Tze(),Mor=Mze(),Ror=jze(),jor=Dze(),Nor=Fze(),Dor=$ze(),Lor=wh(),For=zze(),kor=Vze(),$or=UK(),Bor=Jze(),qor=Zze(),Uor=w2(),zor=zK(),Hor=Ope(),Vor=Ppe(),Wor=HK(),Kor=VK(),Gor=Epe(),Jor=a2e(),Yor=S2(),Zor=Sh(),Xor=C2(),Qor=w2e(),eir=x2e(),tir=O2e(),rir=T2e(),nir=I2e(),oir=GK(),iir=L2e(),air=k2e(),sir=q2e(),uir=z2e(),lir=J2e();X2e.exports={parse:Eor,valid:Tor,clean:Aor,inc:Ior,diff:Mor,major:Ror,minor:jor,patch:Nor,prerelease:Dor,compare:Lor,rcompare:For,compareLoose:kor,compareBuild:$or,sort:Bor,rsort:qor,gt:Uor,lt:zor,eq:Hor,neq:Vor,gte:Wor,lte:Kor,cmp:Gor,coerce:Jor,Comparator:Yor,Range:Zor,satisfies:Xor,toComparators:Qor,maxSatisfying:eir,minSatisfying:tir,minVersion:rir,validRange:nir,outside:oir,gtr:iir,ltr:air,intersects:sir,simplifyRange:uir,subset:lir,SemVer:Por,re:kpe.re,src:kpe.src,tokens:kpe.t,SEMVER_SPEC_VERSION:Y2e.SEMVER_SPEC_VERSION,RELEASE_TYPES:Y2e.RELEASE_TYPES,compareIdentifiers:Z2e.compareIdentifiers,rcompareIdentifiers:Z2e.rcompareIdentifiers}});function CC(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 cir,e4e=w(()=>{cir=F(Q2e(),1)});async function sn(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}n=await t.text();let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Server response: ${n}`;throw t.status===409?new $pe(o):new Error(o)}var $pe,t4e=w(()=>{$pe=class extends Error{constructor(e){super(e),this.name="LangSmithConflictError"}}});function pir(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function JK(t){return fir.encode(t)}function hp(t,e,r,n){try{let o=JSON.stringify(t,e,r);return JK(o)}catch(o){if(!o.message?.includes("Converting circular structure to JSON"))return console.warn("[WARNING]: LangSmith received unserializable value."),JK("[Unserializable]");console.warn("[WARNING]: LangSmith received circular JSON. This will decrease tracer performance."),typeof n>"u"&&(n=pir()),qpe(t,"",0,[],void 0,0,n);let i;try{HL.length===0?i=JSON.stringify(t,e,r):i=JSON.stringify(t,mir(e),r)}catch{return JK("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;YK.length!==0;){let a=YK.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return JK(i)}}function Bpe(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),YK.push([n,r,e,o])):HL.push([e,r,t]):(n[r]=t,YK.push([n,r,e]))}function qpe(t,e,r,n,o,i,a){i+=1;var s;if(typeof t=="object"&&t!==null){for(s=0;sa.depthLimit){Bpe(r4e,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Bpe(r4e,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s0)for(var n=0;n{r4e="[...]",dir={result:"[Circular]"},YK=[],HL=[],fir=new TextEncoder});function o4e(t){let e=QK(),r=s4e(),n=t.extra??{},o=n.metadata;return t.extra={...n,runtime:{...e,...n?.runtime},metadata:{...r,...r.revision_id||t.revision_id?{revision_id:t.revision_id??r.revision_id}:{},...o}},t}async function yir(t){let e=[];for await(let r of t)e.push(r);return e}function Upe(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function i4e(t){return typeof t=="number"?Number(t.toFixed(4)):t}function a4e(t){return"dataset_id"in t||"dataset_name"in t}var hir,gir,bir,zpe,_ir,vir,mR,Hpe=w(()=>{TE();ize();aze();y2();XK();sze();vpe();e4e();t4e();LK();n4e();hir=t=>{let e=t?.toString()??pp("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},gir=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};bir=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};zpe=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=hp(e.item).length;return this.items.push({action:e.action,payload:e.item,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n}pop(e){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let r=[],n=0;for(;n+(this.peek()?.size??0)0;){let o=this.items.shift();o&&(r.push(o),n+=o.size,this.sizeBytes-=o.size)}if(r.length===0&&this.items.length>0){let o=this.items.shift();r.push(o),n+=o.size,this.sizeBytes-=o.size}return[r.map(o=>({action:o.action,item:o.payload})),()=>r.forEach(o=>o.itemPromiseResolve())]}},_ir=20971520,vir=2500,mR=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 zpe}),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:Ub("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Ub("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=hir(e.tracingSamplingRate),this.apiUrl=Upe(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=Upe(e.apiKey??r.apiKey),this.webUrl=Upe(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.timeout_ms=e.timeout_ms??9e4,this.caller=new b2({...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 b2({maxRetries:2,maxConcurrency:this.traceBatchConcurrency,...e.callerOptions??{},onFailedResponseHook:bir,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode}static getDefaultClientConfig(){let e=pp("API_KEY"),r=pp("ENDPOINT")??"https://api.smith.langchain.com",n=pp("HIDE_INPUTS")==="true",o=pp("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:gir(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/${ZK}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),e}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`,i=await this.caller.call(Vt(this.debug),o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(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(Vt(this.debug),a,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(s,`Failed to fetch ${e}`);let u=n?n(await s.json()):await s.json();if(u.length===0||(yield u,u.length0;){let[n,o]=this.autoBatchQueue.pop(e);if(!n.length){o();break}let i=this._processBatch(n,o).catch(console.error);r.push(i)}return Promise.all(r)}async _processBatch(e,r){if(!e.length){r();return}try{let n={runCreates:e.filter(i=>i.action==="create").map(i=>i.item),runUpdates:e.filter(i=>i.action==="update").map(i=>i.item)};(await this._ensureServerInfo())?.batch_ingest_config?.use_multipart_endpoint?await this.multipartIngestRuns(n):await this.batchIngestRuns(n)}finally{r()}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.action==="create"&&(e.item=o4e(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 Vt(this.debug)(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(vir),...this.fetchOptions});await sn(e,"get server info");let r=await e.json();return this.debug&&console.log(` === LangSmith Server Configuration === `+JSON.stringify(r,null,2)+` -`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch{console.warn("[WARNING]: LangSmith failed to fetch info on supported operations. Falling back to batch operations and default limits.")}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),e))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let e=await this._getBatchSizeLimitBytes();await this.drainAutoBatchQueue(e)}async createRun(e){if(!this._filterForSampling([e]).length)return;let r={...this.headers,"Content-Type":"application/json"},n=e.project_name;delete e.project_name;let o=await this.prepareRunCreateOrUpdateInputs({session_name:n,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){this.processRunOperation({action:"create",item:o}).catch(console.error);return}let i=r4e(o),a=await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs`,{method:"POST",headers:r,body:hp(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(a,"create run",!0)}async batchIngestRuns({runCreates:e,runUpdates:r}){if(e===void 0&&r===void 0)return;let n=await Promise.all(e?.map(s=>this.prepareRunCreateOrUpdateInputs(s))??[]),o=await Promise.all(r?.map(s=>this.prepareRunCreateOrUpdateInputs(s))??[]);if(n.length>0&&o.length>0){let s=n.reduce((l,c)=>(c.id&&(l[c.id]=c),l),{}),u=[];for(let l of o)l.id!==void 0&&s[l.id]?s[l.id]={...s[l.id],...l}:u.push(l);n=Object.values(s),o=u}let i={post:n,patch:o};if(!i.post.length&&!i.patch.length)return;let a={post:[],patch:[]};for(let s of["post","patch"]){let u=s,l=i[u].reverse(),c=l.pop();for(;c!==void 0;)a[u].push(c),c=l.pop()}(a.post.length>0||a.patch.length>0)&&await this._postBatchIngestRuns(hp(a))}async _postBatchIngestRuns(e){let r={...this.headers,"Content-Type":"application/json",Accept:"application/json"},n=await this.batchIngestCaller.call(Vt(this.debug),`${this.apiUrl}/runs/batch`,{method:"POST",headers:r,body:e,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(n,"batch create run",!0)}async multipartIngestRuns({runCreates:e,runUpdates:r}){if(e===void 0&&r===void 0)return;let n={},o=[];for(let c of e??[]){let d=await this.prepareRunCreateOrUpdateInputs(c);d.id!==void 0&&d.attachments!==void 0&&(n[d.id]=d.attachments),delete d.attachments,o.push(d)}let i=[];for(let c of r??[])i.push(await this.prepareRunCreateOrUpdateInputs(c));if(o.find(c=>c.trace_id===void 0||c.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(i.find(c=>c.trace_id===void 0||c.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(o.length>0&&i.length>0){let c=o.reduce((f,p)=>(p.id&&(f[p.id]=p),f),{}),d=[];for(let f of i)f.id!==void 0&&c[f.id]?c[f.id]={...c[f.id],...f}:d.push(f);o=Object.values(c),i=d}if(o.length===0&&i.length===0)return;let u=[],l=[];for(let[c,d]of[["post",o],["patch",i]])for(let f of d){let{inputs:p,outputs:m,events:h,attachments:b,...g}=f,y={inputs:p,outputs:m,events:h},S=hp(g);l.push({name:`${c}.${g.id}`,payload:new Blob([S],{type:`application/json; length=${S.length}`})});for(let[x,O]of Object.entries(y)){if(O===void 0)continue;let P=hp(O);l.push({name:`${c}.${g.id}.${x}`,payload:new Blob([P],{type:`application/json; length=${P.length}`})})}if(g.id!==void 0){let x=n[g.id];if(x){delete n[g.id];for(let[O,P]of Object.entries(x)){let E,A;if(Array.isArray(P)?[E,A]=P:(E=P.mimeType,A=P.data),O.includes(".")){console.warn(`Skipping attachment '${O}' for run ${g.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}l.push({name:`attachment.${g.id}.${O}`,payload:new Blob([A],{type:`${E}; length=${A.byteLength}`})})}}}u.push(`trace=${g.trace_id},id=${g.id}`)}await this._sendMultipartRequest(l,u.join("; "))}async _sendMultipartRequest(e,r){try{let n="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),o=[];for(let u of e)o.push(new Blob([`--${n}\r +`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch{console.warn("[WARNING]: LangSmith failed to fetch info on supported operations. Falling back to batch operations and default limits.")}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),e))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let e=await this._getBatchSizeLimitBytes();await this.drainAutoBatchQueue(e)}async createRun(e){if(!this._filterForSampling([e]).length)return;let r={...this.headers,"Content-Type":"application/json"},n=e.project_name;delete e.project_name;let o=await this.prepareRunCreateOrUpdateInputs({session_name:n,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){this.processRunOperation({action:"create",item:o}).catch(console.error);return}let i=o4e(o),a=await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs`,{method:"POST",headers:r,body:hp(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(a,"create run",!0)}async batchIngestRuns({runCreates:e,runUpdates:r}){if(e===void 0&&r===void 0)return;let n=await Promise.all(e?.map(s=>this.prepareRunCreateOrUpdateInputs(s))??[]),o=await Promise.all(r?.map(s=>this.prepareRunCreateOrUpdateInputs(s))??[]);if(n.length>0&&o.length>0){let s=n.reduce((l,c)=>(c.id&&(l[c.id]=c),l),{}),u=[];for(let l of o)l.id!==void 0&&s[l.id]?s[l.id]={...s[l.id],...l}:u.push(l);n=Object.values(s),o=u}let i={post:n,patch:o};if(!i.post.length&&!i.patch.length)return;let a={post:[],patch:[]};for(let s of["post","patch"]){let u=s,l=i[u].reverse(),c=l.pop();for(;c!==void 0;)a[u].push(c),c=l.pop()}(a.post.length>0||a.patch.length>0)&&await this._postBatchIngestRuns(hp(a))}async _postBatchIngestRuns(e){let r={...this.headers,"Content-Type":"application/json",Accept:"application/json"},n=await this.batchIngestCaller.call(Vt(this.debug),`${this.apiUrl}/runs/batch`,{method:"POST",headers:r,body:e,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(n,"batch create run",!0)}async multipartIngestRuns({runCreates:e,runUpdates:r}){if(e===void 0&&r===void 0)return;let n={},o=[];for(let c of e??[]){let d=await this.prepareRunCreateOrUpdateInputs(c);d.id!==void 0&&d.attachments!==void 0&&(n[d.id]=d.attachments),delete d.attachments,o.push(d)}let i=[];for(let c of r??[])i.push(await this.prepareRunCreateOrUpdateInputs(c));if(o.find(c=>c.trace_id===void 0||c.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(i.find(c=>c.trace_id===void 0||c.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(o.length>0&&i.length>0){let c=o.reduce((f,p)=>(p.id&&(f[p.id]=p),f),{}),d=[];for(let f of i)f.id!==void 0&&c[f.id]?c[f.id]={...c[f.id],...f}:d.push(f);o=Object.values(c),i=d}if(o.length===0&&i.length===0)return;let u=[],l=[];for(let[c,d]of[["post",o],["patch",i]])for(let f of d){let{inputs:p,outputs:m,events:h,attachments:b,...g}=f,y={inputs:p,outputs:m,events:h},S=hp(g);l.push({name:`${c}.${g.id}`,payload:new Blob([S],{type:`application/json; length=${S.length}`})});for(let[x,O]of Object.entries(y)){if(O===void 0)continue;let P=hp(O);l.push({name:`${c}.${g.id}.${x}`,payload:new Blob([P],{type:`application/json; length=${P.length}`})})}if(g.id!==void 0){let x=n[g.id];if(x){delete n[g.id];for(let[O,P]of Object.entries(x)){let E,A;if(Array.isArray(P)?[E,A]=P:(E=P.mimeType,A=P.data),O.includes(".")){console.warn(`Skipping attachment '${O}' for run ${g.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}l.push({name:`attachment.${g.id}.${O}`,payload:new Blob([A],{type:`${E}; length=${A.byteLength}`})})}}}u.push(`trace=${g.trace_id},id=${g.id}`)}await this._sendMultipartRequest(l,u.join("; "))}async _sendMultipartRequest(e,r){try{let n="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),o=[];for(let u of e)o.push(new Blob([`--${n}\r `])),o.push(new Blob([`Content-Disposition: form-data; name="${u.name}"\r `,`Content-Type: ${u.payload.type}\r \r @@ -14,63 +14,63 @@ var Oer=Object.create;var u2=Object.defineProperty;var Per=Object.getOwnProperty `]));o.push(new Blob([`--${n}--\r `]));let a=await new Blob(o).arrayBuffer(),s=await this.batchIngestCaller.call(Vt(this.debug),`${this.apiUrl}/runs/multipart`,{method:"POST",headers:{...this.headers,"Content-Type":`multipart/form-data; boundary=${n}`},body:a,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(s,"ingest multipart runs",!0)}catch(n){console.warn(`${n.message.trim()} -Context: ${r}`)}}async updateRun(e,r){Kr(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let n={...r,id:e};if(!this._filterForSampling([n],!0).length)return;if(this.autoBatchTracing&&n.trace_id!==void 0&&n.dotted_order!==void 0){if(r.end_time!==void 0&&n.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:n}).catch(console.error);return}else this.processRunOperation({action:"update",item:n}).catch(console.error);return}let o={...this.headers,"Content-Type":"application/json"},i=await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs/${e}`,{method:"PATCH",headers:o,body:hp(r),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(i,"update run",!0)}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){Kr(e);let n=await this._get(`/runs/${e}`);return r&&n.child_run_ids&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:pp("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 fir(this.listRuns({id:e.child_run_ids})),n={},o={};r.sort((i,a)=>(i?.dotted_order??"").localeCompare(a?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:a,startTime:s,executionOrder:u,isRoot:l,runType:c,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:b,limit:g,select:y}=e,S=[];if(r&&(S=Array.isArray(r)?r:[r]),n){let E=Array.isArray(n)?n:[n],A=await Promise.all(E.map(I=>this.readProject({projectName:I}).then(R=>R.id)));S.push(...A)}let x=["app_path","child_run_ids","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],O={session:S.length?S:null,run_type:c,reference_example:a,query:p,filter:m,trace_filter:h,tree_filter:b,execution_order:u,parent_run:o,start_time:s?s.toISOString():null,error:d,id:f,limit:g,trace:i,select:y||x,is_root:l},P=0;for await(let E of this._getCursorPaginatedList("/runs/query",O))if(g){if(P>=g)break;if(E.length+P>g){yield*E.slice(0,g-P);break}P+=E.length,yield*E}else yield*E}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:a,referenceExampleIds:s,startTime:u,endTime:l,error:c,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:b}){let g=a||[];i&&(g=[...a||[],...await Promise.all(i.map(P=>this.readProject({projectName:P}).then(E=>E.id)))]);let S=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:g,reference_example:s,start_time:u,end_time:l,error:c,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:b}).filter(([P,E])=>E!==void 0));return await(await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs/stats`,{method:"POST",headers:this.headers,body:JSON.stringify(S),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||as()};Kr(e);let i=await(await this.caller.call(Vt(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){Kr(e);let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(r,"unshare run",!0)}async readRunSharedLink(e){Kr(e);let n=await(await this.caller.call(Vt(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 Kr(e),await(await this.caller.call(Vt(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),Kr(e);let o=await(await this.caller.call(Vt(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};Kr(e);let i=await(await this.caller.call(Vt(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){Kr(e);let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(r,"unshare dataset",!0)}async readSharedDataset(e){return Kr(e),await(await this.caller.call(Vt(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(Vt(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. +Context: ${r}`)}}async updateRun(e,r){Kr(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let n={...r,id:e};if(!this._filterForSampling([n],!0).length)return;if(this.autoBatchTracing&&n.trace_id!==void 0&&n.dotted_order!==void 0){if(r.end_time!==void 0&&n.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:n}).catch(console.error);return}else this.processRunOperation({action:"update",item:n}).catch(console.error);return}let o={...this.headers,"Content-Type":"application/json"},i=await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs/${e}`,{method:"PATCH",headers:o,body:hp(r),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(i,"update run",!0)}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){Kr(e);let n=await this._get(`/runs/${e}`);return r&&n.child_run_ids&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:pp("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 yir(this.listRuns({id:e.child_run_ids})),n={},o={};r.sort((i,a)=>(i?.dotted_order??"").localeCompare(a?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:a,startTime:s,executionOrder:u,isRoot:l,runType:c,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:b,limit:g,select:y}=e,S=[];if(r&&(S=Array.isArray(r)?r:[r]),n){let E=Array.isArray(n)?n:[n],A=await Promise.all(E.map(I=>this.readProject({projectName:I}).then(R=>R.id)));S.push(...A)}let x=["app_path","child_run_ids","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],O={session:S.length?S:null,run_type:c,reference_example:a,query:p,filter:m,trace_filter:h,tree_filter:b,execution_order:u,parent_run:o,start_time:s?s.toISOString():null,error:d,id:f,limit:g,trace:i,select:y||x,is_root:l},P=0;for await(let E of this._getCursorPaginatedList("/runs/query",O))if(g){if(P>=g)break;if(E.length+P>g){yield*E.slice(0,g-P);break}P+=E.length,yield*E}else yield*E}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:a,referenceExampleIds:s,startTime:u,endTime:l,error:c,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:b}){let g=a||[];i&&(g=[...a||[],...await Promise.all(i.map(P=>this.readProject({projectName:P}).then(E=>E.id)))]);let S=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:g,reference_example:s,start_time:u,end_time:l,error:c,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:b}).filter(([P,E])=>E!==void 0));return await(await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs/stats`,{method:"POST",headers:this.headers,body:JSON.stringify(S),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||as()};Kr(e);let i=await(await this.caller.call(Vt(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){Kr(e);let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(r,"unshare run",!0)}async readRunSharedLink(e){Kr(e);let n=await(await this.caller.call(Vt(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 Kr(e),await(await this.caller.call(Vt(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),Kr(e);let o=await(await this.caller.call(Vt(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};Kr(e);let i=await(await this.caller.call(Vt(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){Kr(e);let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(r,"unshare dataset",!0)}async readSharedDataset(e){return Kr(e),await(await this.caller.call(Vt(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(Vt(this.debug),`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions}),a=await i.json();if(!i.ok)throw"detail"in a?new Error(`Failed to list shared examples. Status: ${i.status} Message: ${a.detail.join(` `)}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return a.map(s=>({...s,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:a=null}){let s=o?"?upsert=true":"",u=`${this.apiUrl}/sessions${s}`,l=i||{};n&&(l.metadata=n);let c={name:e,extra:l,description:r};a!==null&&(c.reference_dataset_id=a);let d=await this.caller.call(Vt(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 sn(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(Vt(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 sn(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)Kr(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(Vt(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)Kr(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,Kr(n);let o=await this.caller.call(Vt(this.debug),`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(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(Vt(this.debug),u,{method:"POST",headers:this.headers,body:l,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(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(Vt(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 sn(u,"create dataset"),await u.json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)Kr(e),n+=`/${e}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(n,o),a;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${r}] not found`);a=i[0]}else a=i;return a}async hasDataset({datasetId:e,datasetName:r}){try{return await this.readDataset({datasetId:e,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:r,fromVersion:n,toVersion:o}){let i=e;if(i===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:r})).id);let a=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,a)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:r}){let n="/datasets";if(e===void 0)if(r!==void 0)e=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(` -`).map(s=>JSON.parse(s))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:a}={}){let s="/datasets",u=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let l of n)u.append("id",l);o!==void 0&&u.append("name",o),i!==void 0&&u.append("name_contains",i),a!==void 0&&u.append("metadata",JSON.stringify(a));for await(let l of this._getPaginated(s,u))yield*l}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;Kr(i);let a=await this.caller.call(Vt(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 sn(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;Kr(a);let s=await this.caller.call(Vt(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 sn(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)Kr(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");let i=await this.caller.call(Vt(this.debug),this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(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),Kr(o);let i={tag:n},a=await this.caller.call(Vt(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 sn(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),Kr(r);let a=await this.caller.call(Vt(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 sn(a,"fetch similar examples"),(await a.json()).examples}async createExample(e,r,n){if(o4e(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;o4e(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 y=e,S=y[0].dataset_id,x=y[0].dataset_name;if(S===void 0&&x===void 0)throw new Error("Must provide either datasetName or datasetId");if(S!==void 0&&x!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");S===void 0&&(S=(await this.readDataset({datasetName:x})).id);let O=await this._uploadExamplesMultipart(S,y);return await Promise.all(O.example_ids.map(E=>this.readExample(E)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:a,useSourceRunIOs:s,useSourceRunAttachments:u,attachments:l,exampleIds:c,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((y,S)=>({dataset_id:p,inputs:y,outputs:n?.[S],metadata:o?.[S],split:i?.[S],id:c?.[S],attachments:l?.[S],source_run_id:a?.[S],use_source_run_io:s?.[S],use_source_run_attachments:u?.[S]})),b=await this._uploadExamplesMultipart(p,h);return await Promise.all(b.example_ids.map(y=>this.readExample(y)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(a=>hpe(a)?gpe(a):a),i=hpe(r)?gpe(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){Kr(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,a=i;return o&&(a.attachments=Object.entries(o).reduce((s,[u,l])=>(s[u.slice(11)]={presigned_url:l.presigned_url,mime_type:l.mime_type},s),{})),a}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:a,metadata:s,limit:u,offset:l,filter:c,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=a??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let g of n)p.append("id",g);if(i!==void 0)for(let g of i)p.append("splits",g);if(s!==void 0){let g=JSON.stringify(s);p.append("metadata",g)}u!==void 0&&p.append("limit",u.toString()),l!==void 0&&p.append("offset",l.toString()),c!==void 0&&p.append("filter",c),d===!0&&["attachment_urls","outputs","metadata"].forEach(g=>p.append("select",g));let b=0;for await(let g of this._getPaginated("/examples",p)){for(let y of g){let{attachment_urls:S,...x}=y,O=x;S&&(O.attachments=Object.entries(S).reduce((P,[E,A])=>(P[E.slice(11)]={presigned_url:A.presigned_url,mime_type:A.mime_type||void 0},P),{})),yield O,b++}if(u!==void 0&&b>=u)break}}async deleteExample(e){Kr(e);let r=`/examples/${e}`,n=await this.caller.call(Vt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(n,`delete ${r}`),await n.json()}async updateExample(e,r){let n;r?n=e:n=e.id,Kr(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,Kr(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(Vt(this.debug),`${this.apiUrl}/datasets/${i}/version?${a.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(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,Kr(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,Kr(a);let s={split_name:n,examples:o.map(l=>(Kr(l),l)),remove:i},u=await this.caller.call(Vt(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 sn(u,"update dataset splits",!0)}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){FK("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let a;if(typeof e=="string")a=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)a=e;else throw new Error(`Invalid run type: ${typeof e}`);a.reference_example_id!==null&&a.reference_example_id!==void 0&&(i=await this.readExample(a.reference_example_id));let s=await r.evaluateRun(a,i),[u,l]=await this._logEvaluationFeedback(s,a,n);return l[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:a,sourceInfo:s,feedbackSourceType:u="api",sourceRunId:l,feedbackId:c,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:u??"api",metadata:s??{}};l!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:l}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&Kr(m.metadata.__run.run_id);let h={id:c??as(),run_id:e,key:r,score:n4e(n),value:o,correction:i,comment:a,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},b=`${this.apiUrl}/feedback`,g=await this.caller.call(Vt(this.debug),b,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(h),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(g,"create feedback",!0),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=n4e(r)),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),Kr(e);let s=await this.caller.call(Vt(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 sn(s,"update feedback",!0)}async readFeedback(e){Kr(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){Kr(e);let r=`/feedback/${e}`,n=await this.caller.call(Vt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(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(Vt(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(Vt(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){Kr(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)=>{Kr(u,`queueIds[${l}]`),a.append("ids",u)}),n&&a.append("name",n),o&&a.append("name_contains",o),a.append("limit",(i!==void 0?Math.min(i,100):100).toString());let s=0;for await(let u of this._getPaginated("/annotation-queues",a))if(yield*u,s++,i!==void 0&&s>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o}=e,i={name:r,description:n,id:o||as()},a=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(Object.fromEntries(Object.entries(i).filter(([u,l])=>l!==void 0))),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(a,"create annotation queue"),await a.json()}async readAnnotationQueue(e){let r=await this.listAnnotationQueues({queueIds:[e]}).next();if(r.done)throw new Error(`Annotation queue with ID ${e} not found`);return r.value}async updateAnnotationQueue(e,r){let{name:n,description:o}=r,i=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify({name:n,description:o}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(i,"update annotation queue")}async deleteAnnotationQueue(e){let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(r,"delete annotation queue")}async addRunsToAnnotationQueue(e,r){let n=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(r.map((o,i)=>Kr(o,`runIds[${i}]`).toString())),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(n,"add runs to annotation queue")}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${Kr(e,"queueId")}/run`,o=await this.caller.call(Vt(this.debug),`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(o,"get run from annotation queue"),await o.json()}async deleteRunFromAnnotationQueue(e,r){let n=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}/runs/${Kr(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(n,"delete run from annotation queue")}async getSizeFromAnnotationQueue(e){let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(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. +`).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;Kr(i);let a=await this.caller.call(Vt(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 sn(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;Kr(a);let s=await this.caller.call(Vt(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 sn(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)Kr(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");let i=await this.caller.call(Vt(this.debug),this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(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),Kr(o);let i={tag:n},a=await this.caller.call(Vt(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 sn(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),Kr(r);let a=await this.caller.call(Vt(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 sn(a,"fetch similar examples"),(await a.json()).examples}async createExample(e,r,n){if(a4e(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;a4e(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 y=e,S=y[0].dataset_id,x=y[0].dataset_name;if(S===void 0&&x===void 0)throw new Error("Must provide either datasetName or datasetId");if(S!==void 0&&x!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");S===void 0&&(S=(await this.readDataset({datasetName:x})).id);let O=await this._uploadExamplesMultipart(S,y);return await Promise.all(O.example_ids.map(E=>this.readExample(E)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:a,useSourceRunIOs:s,useSourceRunAttachments:u,attachments:l,exampleIds:c,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((y,S)=>({dataset_id:p,inputs:y,outputs:n?.[S],metadata:o?.[S],split:i?.[S],id:c?.[S],attachments:l?.[S],source_run_id:a?.[S],use_source_run_io:s?.[S],use_source_run_attachments:u?.[S]})),b=await this._uploadExamplesMultipart(p,h);return await Promise.all(b.example_ids.map(y=>this.readExample(y)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(a=>bpe(a)?_pe(a):a),i=bpe(r)?_pe(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){Kr(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,a=i;return o&&(a.attachments=Object.entries(o).reduce((s,[u,l])=>(s[u.slice(11)]={presigned_url:l.presigned_url,mime_type:l.mime_type},s),{})),a}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:a,metadata:s,limit:u,offset:l,filter:c,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=a??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let g of n)p.append("id",g);if(i!==void 0)for(let g of i)p.append("splits",g);if(s!==void 0){let g=JSON.stringify(s);p.append("metadata",g)}u!==void 0&&p.append("limit",u.toString()),l!==void 0&&p.append("offset",l.toString()),c!==void 0&&p.append("filter",c),d===!0&&["attachment_urls","outputs","metadata"].forEach(g=>p.append("select",g));let b=0;for await(let g of this._getPaginated("/examples",p)){for(let y of g){let{attachment_urls:S,...x}=y,O=x;S&&(O.attachments=Object.entries(S).reduce((P,[E,A])=>(P[E.slice(11)]={presigned_url:A.presigned_url,mime_type:A.mime_type||void 0},P),{})),yield O,b++}if(u!==void 0&&b>=u)break}}async deleteExample(e){Kr(e);let r=`/examples/${e}`,n=await this.caller.call(Vt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(n,`delete ${r}`),await n.json()}async updateExample(e,r){let n;r?n=e:n=e.id,Kr(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,Kr(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(Vt(this.debug),`${this.apiUrl}/datasets/${i}/version?${a.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(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,Kr(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,Kr(a);let s={split_name:n,examples:o.map(l=>(Kr(l),l)),remove:i},u=await this.caller.call(Vt(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 sn(u,"update dataset splits",!0)}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){kK("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let a;if(typeof e=="string")a=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)a=e;else throw new Error(`Invalid run type: ${typeof e}`);a.reference_example_id!==null&&a.reference_example_id!==void 0&&(i=await this.readExample(a.reference_example_id));let s=await r.evaluateRun(a,i),[u,l]=await this._logEvaluationFeedback(s,a,n);return l[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:a,sourceInfo:s,feedbackSourceType:u="api",sourceRunId:l,feedbackId:c,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:u??"api",metadata:s??{}};l!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:l}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&Kr(m.metadata.__run.run_id);let h={id:c??as(),run_id:e,key:r,score:i4e(n),value:o,correction:i,comment:a,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},b=`${this.apiUrl}/feedback`,g=await this.caller.call(Vt(this.debug),b,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(h),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(g,"create feedback",!0),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=i4e(r)),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),Kr(e);let s=await this.caller.call(Vt(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 sn(s,"update feedback",!0)}async readFeedback(e){Kr(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){Kr(e);let r=`/feedback/${e}`,n=await this.caller.call(Vt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(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(Vt(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(Vt(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){Kr(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)=>{Kr(u,`queueIds[${l}]`),a.append("ids",u)}),n&&a.append("name",n),o&&a.append("name_contains",o),a.append("limit",(i!==void 0?Math.min(i,100):100).toString());let s=0;for await(let u of this._getPaginated("/annotation-queues",a))if(yield*u,s++,i!==void 0&&s>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o}=e,i={name:r,description:n,id:o||as()},a=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(Object.fromEntries(Object.entries(i).filter(([u,l])=>l!==void 0))),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(a,"create annotation queue"),await a.json()}async readAnnotationQueue(e){let r=await this.listAnnotationQueues({queueIds:[e]}).next();if(r.done)throw new Error(`Annotation queue with ID ${e} not found`);return r.value}async updateAnnotationQueue(e,r){let{name:n,description:o}=r,i=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify({name:n,description:o}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(i,"update annotation queue")}async deleteAnnotationQueue(e){let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(r,"delete annotation queue")}async addRunsToAnnotationQueue(e,r){let n=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(r.map((o,i)=>Kr(o,`runIds[${i}]`).toString())),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(n,"add runs to annotation queue")}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${Kr(e,"queueId")}/run`,o=await this.caller.call(Vt(this.debug),`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(o,"get run from annotation queue"),await o.json()}async deleteRunFromAnnotationQueue(e,r){let n=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}/runs/${Kr(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(n,"delete run from annotation queue")}async getSizeFromAnnotationQueue(e){let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(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(Vt(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]=xC(e),a=await this.caller.call(Vt(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 sn(a,`${r?"like":"unlike"} prompt`),await a.json()}async _getPromptUrl(e){let[r,n,o]=xC(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]=xC(e),i=await this.caller.call(Vt(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 sn(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 +${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]=CC(e),a=await this.caller.call(Vt(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 sn(a,`${r?"like":"unlike"} prompt`),await a.json()}async _getPromptUrl(e){let[r,n,o]=CC(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]=CC(e),i=await this.caller.call(Vt(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 sn(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]=xC(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(Vt(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 sn(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]=xC(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(Vt(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 sn(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=hp(l),d=new Blob([c],{type:"application/json"});if(n.append(u,d),s.inputs){let f=hp(s.inputs),p=new Blob([f],{type:"application/json"});n.append(`${u}.inputs`,p)}if(s.outputs){let f=hp(s.outputs),p=new Blob([f],{type:"application/json"});n.append(`${u}.outputs`,p)}if(s.attachments)for(let[f,p]of Object.entries(s.attachments)){let m,h;Array.isArray(p)?[m,h]=p:(m=p.mimeType,h=p.data);let b=new Blob([h],{type:`${m}; length=${h.byteLength}`});n.append(`${u}.attachment.${f}`,b)}if(s.attachments_operations){let f=hp(s.attachments_operations),p=new Blob([f],{type:"application/json"});n.append(`${u}.attachments_operations`,p)}}let o=e??r[0]?.dataset_id;return await(await this.caller.call(Vt(this.debug),`${this.apiUrl}/v1/platform/datasets/${o}/examples`,{method:"PATCH",headers:this.headers,body:n})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let a of r){let s=(a.id??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=hp(u),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=hp(a.inputs),f=new Blob([d],{type:"application/json"});n.append(`${s}.inputs`,f)}if(a.outputs){let d=hp(a.outputs),f=new Blob([d],{type:"application/json"});n.append(`${s}.outputs`,f)}if(a.attachments)for(let[d,f]of Object.entries(a.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${s}.attachment.${d}`,h)}}let o=await this.caller.call(Vt(this.debug),`${this.apiUrl}/v1/platform/datasets/${e}/examples`,{method:"POST",headers:this.headers,body:n});return await sn(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]=xC(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(Vt(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 sn(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]=xC(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return await(await this.caller.call(Vt(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]=xC(e),a=await this.caller.call(Vt(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 sn(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 Kr(e),[r,e]}catch{}try{let a=new URL(e).pathname.split("/").filter(s=>s!=="");if(a.length>=n){let s=a[a.length-n];return[r,s]}else throw new Error(`Invalid public ${o} URL: ${e}`)}catch{throw new Error(`Invalid public ${o} URL or token: ${e}`)}}awaitPendingTraceBatches(){return this.manualFlushMode?(console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve()):Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()])}}});var YK,ZK=w(()=>{qpe();QK();DK();YK="0.3.20"});function XK(){if(Upe===void 0){let t=vir(),e=Sir();Upe={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:YK,...e}}return Upe}function i4e(){let t=wir()||{},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 wir(){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 Ub(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function pp(t){return Ub(`LANGSMITH_${t}`)||Ub(`LANGCHAIN_${t}`)}function Sir(){if(zpe!==void 0)return zpe;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=Ub(r);n!==void 0&&(e[r]=n)}return zpe=e,e}var OC,gir,yir,bir,a4e,_ir,vir,Upe,zpe,g2=w(()=>{ZK();gir=()=>typeof window<"u"&&typeof window.document<"u",yir=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",bir=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),a4e=()=>typeof Deno<"u",_ir=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!a4e(),vir=()=>OC||(gir()?OC="browser":_ir()?OC="node":yir()?OC="webworker":bir()?OC="jsdom":a4e()?OC="deno":OC="other",OC)});var s4e,u4e=w(()=>{g2();s4e=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>pp(r)==="true")});var eG,l4e=w(()=>{eG=Symbol.for("lc:context_variables")});function xir(t){return t.replace(/[-:.]/g,"")}function Cir(t,e,r=1){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return xir(`${new Date(t).toISOString().slice(0,-1)}${n}Z`)+e}function rG(t){return t!==void 0&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function d4e(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function c4e(t){return Array.isArray(t)&&t.some(e=>d4e(e))}function Oir(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function Pir(t){return t!==void 0&&typeof t.callbacks=="object"&&(c4e(t.callbacks?.handlers)||c4e(t.callbacks))}var tG,CC,QK=w(()=>{TE();g2();qpe();u4e();ype();l4e();tG=class t{constructor(e,r,n){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n}static fromHeader(e){let r=e.split(","),n={},o=[],i;for(let a of r){let[s,u]=a.split("="),l=decodeURIComponent(u);s==="langsmith-metadata"?n=JSON.parse(l):s==="langsmith-tags"?o=l.split(","):s==="langsmith-project"&&(i=l)}return new t(n,o,i)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},CC=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),rG(e)){Object.assign(this,{...e});return}let r=t.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??t.getSharedClient(),a={...n,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:a},Object.assign(this,{...r,...o,client:i}),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.execution_order??(this.execution_order=1),this.child_execution_order??(this.child_execution_order=1),!this.dotted_order){let s=Cir(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+s:this.dotted_order=s}}static getDefaultConfig(){return{id:as(),run_type:"chain",project_name:pp("PROJECT")??Ub("LANGCHAIN_SESSION")??"default",child_runs:[],api_url:Ub("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Ub("LANGCHAIN_API_KEY"),caller_options:{},start_time:Date.now(),serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new mR),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=new t({...e,parent_run:this,project_name:this.project_name,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});eG in this&&(n[eG]=this[eG]);let o=Symbol.for("lc:child_config"),i=e.extra?.[o]??this.extra[o];if(Pir(i)){let u={...i},l=Oir(u.callbacks)?u.callbacks.copy?.():void 0;l&&(Object.assign(l,{_parentRunId:n.id}),l.handlers?.find(d4e)?.updateFromRunTree?.(n),u.callbacks=l),n.extra[o]=u}let a=new Set,s=this;for(;s!=null&&!a.has(s.id);)a.add(s.id),s.child_execution_order=Math.max(s.child_execution_order,r),s=s.parent_run;return this.child_runs.push(n),n}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o.runtime||(o.runtime={}),r)for(let[u,l]of Object.entries(r))o.runtime[u]||(o.runtime[u]=l);let i,a;return n?(a=e.parent_run?.id,i=[]):(i=e.child_runs.map(u=>this._convertToCreate(u,r,n)),a=void 0),{id:e.id,name:e.name,start_time:e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:a,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments}}async postRun(e=!0){try{let r=XK(),n=await this._convertToCreate(this,r,!0);if(await this.client.createRun(n),!e){FK("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let o of this.child_runs)await o.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(){try{let e={end_time:this.end_time,error:this.error,inputs:this.inputs,outputs:this.outputs,parent_run_id:this.parent_run?.id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};await this.client.updateRun(this.id,e)}catch(e){console.error(`Error in patchRun for run ${this.id}`,e)}}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),typeof e=="string"?this.events.push({name:"event",time:new Date().toISOString(),message:e}):this.events.push({...e,time:e.time??new Date().toISOString()})}static fromRunnableConfig(e,r){let n=e?.callbacks,o,i,a,s=s4e();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=tG.fromHeader(n.baggage);u.metadata=l.metadata,u.tags=l.tags,u.project_name=l.project_name}return new t(u)}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new tG(this.extra?.metadata,this.tags,this.project_name).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(CC,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});function nG(t){return typeof t=="function"&&"langsmith:traceable"in t}var Vpe,Hpe,Eir,Wpe,Tir,f4e,uNn,p4e=w(()=>{QK();Vpe=class{getStore(){}run(e,r){return r()}},Hpe=Symbol.for("ls:tracing_async_local_storage"),Eir=new Vpe,Wpe=class{getInstance(){return globalThis[Hpe]??Eir}initializeGlobalInstance(e){globalThis[Hpe]===void 0&&(globalThis[Hpe]=e)}},Tir=new Wpe,f4e=()=>{let t=Tir.getInstance().getStore();if(!rG(t))throw new Error(["Could not get the current run tree.","","Please make sure you are calling this method within a traceable function and that tracing is enabled."].join(` -`));return t},uNn=Symbol.for("langsmith:traceable:root")});var Kpe=w(()=>{p4e()});function iG(t,e){return Air.call(t,e)}function aG(t){if(Array.isArray(t)){let r=new Array(t.length);for(let n=0;n=48&&n<=57){e++;continue}return!1}return!0}function zb(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function O2(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function oG(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r{Air=Object.prototype.hasOwnProperty;hR=class extends Error{constructor(e,r,n,o,i){super(m4e(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=m4e(e,{name:r,index:n,operation:o,tree:i})}}});var Gpe={};Cf(Gpe,{JsonPatchError:()=>ss,_areEquals:()=>E2,applyOperation:()=>gR,applyPatch:()=>AE,applyReducer:()=>Rir,deepClone:()=>Iir,getValueByPointer:()=>uG,validate:()=>h4e,validator:()=>lG});function uG(t,e){if(e=="")return t;var r={op:"_get",path:e};return gR(t,r),r.value}function gR(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):lG(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=uG(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=E2(t,e.value),a.test===!1)throw new ss("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 ss("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=Md(t));let s=(e.path||"").split("/"),u=t,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=lG;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=O2(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&&!sG(f))throw new ss("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);sG(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new ss("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=Mir[e.op].call(e,u,f,t);if(m.test===!1)throw new ss("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(l>=c){let m=HL[e.op].call(e,u,f,t);if(m.test===!1)throw new ss("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(u=u[f],r&&l0)throw new ss('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 ss("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 ss("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")&&oG(t.value))throw new ss("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 ss("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 ss("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=h4e([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new ss("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new ss("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function h4e(t,e,r){try{if(!Array.isArray(t))throw new ss("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)AE(Md(e),Md(t),r||!0);else{r=r||lG;for(var n=0;n{P2();ss=hR,Iir=Md,HL={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=uG(r,this.path);n&&(n=Md(n));let o=gR(r,{op:"remove",path:this.from}).removed;return gR(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=uG(r,this.from);return gR(r,{op:"add",path:this.path,value:Md(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:E2(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},Mir={add:function(t,e,r){return sG(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:HL.move,copy:HL.copy,test:HL.test,_get:HL._get}});function g4e(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=aG(e),a=aG(t),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=t[c];if(iG(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)?g4e(d,f,r,n+"/"+zb(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+zb(c),value:Md(d)}),r.push({op:"replace",path:n+"/"+zb(c),value:Md(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+zb(c),value:Md(d)}),r.push({op:"remove",path:n+"/"+zb(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{P2();cG();});var bNn,Jpe=w(()=>{cG();y4e();P2();cG();P2();bNn={...Gpe,JsonPatchError:hR,deepClone:Md,escapePathComponent:zb,unescapePathComponent:O2}});var _4e=v((xNn,b4e)=>{"use strict";b4e.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 P4e=v((CNn,Ype)=>{"use strict";var jir=/[\p{Lu}]/u,Nir=/[\p{Ll}]/u,v4e=/^[\p{Lu}](?![\p{Lu}])/gu,x4e=/([\p{Alpha}\p{N}_]|$)/u,C4e=/[_.\- ]+/,Dir=new RegExp("^"+C4e.source),w4e=new RegExp(C4e.source+x4e.source,"gu"),S4e=new RegExp("\\d+"+x4e.source,"gu"),Lir=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a(v4e.lastIndex=0,t.replace(v4e,r=>e(r))),kir=(t,e)=>(w4e.lastIndex=0,S4e.lastIndex=0,t.replace(w4e,(r,n)=>e(n)).replace(S4e,r=>e(r))),O4e=(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=Lir(t,r,n)),t=t.replace(Dir,""),e.preserveConsecutiveUppercase?t=Fir(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),kir(t,n))};Ype.exports=O4e;Ype.exports.default=O4e});function T4e(t,e){return e?.[t]||(0,E4e.default)(t)}function A4e(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var E4e,$ir,I4e=w(()=>{E4e=F(_4e(),1),$ir=F(P4e(),1)});function M4e(t){return Array.isArray(t)?[...t]:{...t}}function Bir(t,e){let r=M4e(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]=M4e(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function Zpe(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 gp,yR=w(()=>{I4e();gp=class t{static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Zpe(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:A4e(Object.keys(r).length?Bir(n,r):n,T4e,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});async function R4e(){return Xpe===void 0&&(Xpe={library:"langchain-js",runtime:fG()}),Xpe}function ot(t){try{return typeof process<"u"?process.env?.[t]:Qpe()?Deno?.env.get(t):void 0}catch{return}}var qir,Uir,zir,Qpe,Hir,fG,Xpe,bR=w(()=>{qir=()=>typeof window<"u"&&typeof window.document<"u",Uir=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",zir=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),Qpe=()=>typeof Deno<"u",Hir=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!Qpe(),fG=()=>{let t;return qir()?t="browser":Hir()?t="node":Uir()?t="webworker":zir()?t="jsdom":Qpe()?t="deno":t="other",t}});function tme(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var eme,_R,j4e,T2=w(()=>{TE();yR();bR();eme=class{};_R=class t extends eme{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,Zpe(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:ot("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 gp.prototype.toJSON.call(this)}toJSONNotImplemented(){return gp.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}},j4e=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});function rme(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function Vir(t){return t.replace(/[-:.]/g,"")}function Wir(t,e,r){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return Vir(`${new Date(t).toISOString().slice(0,-1)}${n}Z`)+e}function VL(t){return typeof t._addRunToRunMap=="function"}var xh,vR=w(()=>{T2();xh=class extends _R{constructor(e){super(...arguments),Object.defineProperty(this,"runMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}copy(){return this}stringifyError(e){return e instanceof Error?e.message+(e?.stack?` + https://smith.langchain.com/prompts`);let[o,i,a]=CC(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(Vt(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 sn(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]=CC(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(Vt(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 sn(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=hp(l),d=new Blob([c],{type:"application/json"});if(n.append(u,d),s.inputs){let f=hp(s.inputs),p=new Blob([f],{type:"application/json"});n.append(`${u}.inputs`,p)}if(s.outputs){let f=hp(s.outputs),p=new Blob([f],{type:"application/json"});n.append(`${u}.outputs`,p)}if(s.attachments)for(let[f,p]of Object.entries(s.attachments)){let m,h;Array.isArray(p)?[m,h]=p:(m=p.mimeType,h=p.data);let b=new Blob([h],{type:`${m}; length=${h.byteLength}`});n.append(`${u}.attachment.${f}`,b)}if(s.attachments_operations){let f=hp(s.attachments_operations),p=new Blob([f],{type:"application/json"});n.append(`${u}.attachments_operations`,p)}}let o=e??r[0]?.dataset_id;return await(await this.caller.call(Vt(this.debug),`${this.apiUrl}/v1/platform/datasets/${o}/examples`,{method:"PATCH",headers:this.headers,body:n})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let a of r){let s=(a.id??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=hp(u),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=hp(a.inputs),f=new Blob([d],{type:"application/json"});n.append(`${s}.inputs`,f)}if(a.outputs){let d=hp(a.outputs),f=new Blob([d],{type:"application/json"});n.append(`${s}.outputs`,f)}if(a.attachments)for(let[d,f]of Object.entries(a.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${s}.attachment.${d}`,h)}}let o=await this.caller.call(Vt(this.debug),`${this.apiUrl}/v1/platform/datasets/${e}/examples`,{method:"POST",headers:this.headers,body:n});return await sn(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]=CC(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(Vt(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 sn(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]=CC(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return await(await this.caller.call(Vt(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]=CC(e),a=await this.caller.call(Vt(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 sn(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 Kr(e),[r,e]}catch{}try{let a=new URL(e).pathname.split("/").filter(s=>s!=="");if(a.length>=n){let s=a[a.length-n];return[r,s]}else throw new Error(`Invalid public ${o} URL: ${e}`)}catch{throw new Error(`Invalid public ${o} URL or token: ${e}`)}}awaitPendingTraceBatches(){return this.manualFlushMode?(console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve()):Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()])}}});var ZK,XK=w(()=>{Hpe();eG();LK();ZK="0.3.20"});function QK(){if(Vpe===void 0){let t=Oir(),e=Eir();Vpe={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:ZK,...e}}return Vpe}function s4e(){let t=Pir()||{},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 Pir(){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 Ub(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function pp(t){return Ub(`LANGSMITH_${t}`)||Ub(`LANGCHAIN_${t}`)}function Eir(){if(Wpe!==void 0)return Wpe;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=Ub(r);n!==void 0&&(e[r]=n)}return Wpe=e,e}var PC,wir,Sir,xir,u4e,Cir,Oir,Vpe,Wpe,y2=w(()=>{XK();wir=()=>typeof window<"u"&&typeof window.document<"u",Sir=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",xir=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),u4e=()=>typeof Deno<"u",Cir=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!u4e(),Oir=()=>PC||(wir()?PC="browser":Cir()?PC="node":Sir()?PC="webworker":xir()?PC="jsdom":u4e()?PC="deno":PC="other",PC)});var l4e,c4e=w(()=>{y2();l4e=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>pp(r)==="true")});var tG,d4e=w(()=>{tG=Symbol.for("lc:context_variables")});function Tir(t){return t.replace(/[-:.]/g,"")}function Air(t,e,r=1){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return Tir(`${new Date(t).toISOString().slice(0,-1)}${n}Z`)+e}function nG(t){return t!==void 0&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function p4e(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function f4e(t){return Array.isArray(t)&&t.some(e=>p4e(e))}function Iir(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function Mir(t){return t!==void 0&&typeof t.callbacks=="object"&&(f4e(t.callbacks?.handlers)||f4e(t.callbacks))}var rG,OC,eG=w(()=>{TE();y2();Hpe();c4e();vpe();d4e();rG=class t{constructor(e,r,n){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n}static fromHeader(e){let r=e.split(","),n={},o=[],i;for(let a of r){let[s,u]=a.split("="),l=decodeURIComponent(u);s==="langsmith-metadata"?n=JSON.parse(l):s==="langsmith-tags"?o=l.split(","):s==="langsmith-project"&&(i=l)}return new t(n,o,i)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},OC=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),nG(e)){Object.assign(this,{...e});return}let r=t.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??t.getSharedClient(),a={...n,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:a},Object.assign(this,{...r,...o,client:i}),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.execution_order??(this.execution_order=1),this.child_execution_order??(this.child_execution_order=1),!this.dotted_order){let s=Air(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+s:this.dotted_order=s}}static getDefaultConfig(){return{id:as(),run_type:"chain",project_name:pp("PROJECT")??Ub("LANGCHAIN_SESSION")??"default",child_runs:[],api_url:Ub("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Ub("LANGCHAIN_API_KEY"),caller_options:{},start_time:Date.now(),serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new mR),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=new t({...e,parent_run:this,project_name:this.project_name,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});tG in this&&(n[tG]=this[tG]);let o=Symbol.for("lc:child_config"),i=e.extra?.[o]??this.extra[o];if(Mir(i)){let u={...i},l=Iir(u.callbacks)?u.callbacks.copy?.():void 0;l&&(Object.assign(l,{_parentRunId:n.id}),l.handlers?.find(p4e)?.updateFromRunTree?.(n),u.callbacks=l),n.extra[o]=u}let a=new Set,s=this;for(;s!=null&&!a.has(s.id);)a.add(s.id),s.child_execution_order=Math.max(s.child_execution_order,r),s=s.parent_run;return this.child_runs.push(n),n}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o.runtime||(o.runtime={}),r)for(let[u,l]of Object.entries(r))o.runtime[u]||(o.runtime[u]=l);let i,a;return n?(a=e.parent_run?.id,i=[]):(i=e.child_runs.map(u=>this._convertToCreate(u,r,n)),a=void 0),{id:e.id,name:e.name,start_time:e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:a,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments}}async postRun(e=!0){try{let r=QK(),n=await this._convertToCreate(this,r,!0);if(await this.client.createRun(n),!e){kK("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let o of this.child_runs)await o.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(){try{let e={end_time:this.end_time,error:this.error,inputs:this.inputs,outputs:this.outputs,parent_run_id:this.parent_run?.id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};await this.client.updateRun(this.id,e)}catch(e){console.error(`Error in patchRun for run ${this.id}`,e)}}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),typeof e=="string"?this.events.push({name:"event",time:new Date().toISOString(),message:e}):this.events.push({...e,time:e.time??new Date().toISOString()})}static fromRunnableConfig(e,r){let n=e?.callbacks,o,i,a,s=l4e();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=rG.fromHeader(n.baggage);u.metadata=l.metadata,u.tags=l.tags,u.project_name=l.project_name}return new t(u)}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new rG(this.extra?.metadata,this.tags,this.project_name).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(OC,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});function oG(t){return typeof t=="function"&&"langsmith:traceable"in t}var Gpe,Kpe,Rir,Jpe,jir,m4e,pNn,h4e=w(()=>{eG();Gpe=class{getStore(){}run(e,r){return r()}},Kpe=Symbol.for("ls:tracing_async_local_storage"),Rir=new Gpe,Jpe=class{getInstance(){return globalThis[Kpe]??Rir}initializeGlobalInstance(e){globalThis[Kpe]===void 0&&(globalThis[Kpe]=e)}},jir=new Jpe,m4e=()=>{let t=jir.getInstance().getStore();if(!nG(t))throw new Error(["Could not get the current run tree.","","Please make sure you are calling this method within a traceable function and that tracing is enabled."].join(` +`));return t},pNn=Symbol.for("langsmith:traceable:root")});var Ype=w(()=>{h4e()});function aG(t,e){return Nir.call(t,e)}function sG(t){if(Array.isArray(t)){let r=new Array(t.length);for(let n=0;n=48&&n<=57){e++;continue}return!1}return!0}function zb(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function P2(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function iG(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r{Nir=Object.prototype.hasOwnProperty;hR=class extends Error{constructor(e,r,n,o,i){super(g4e(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=g4e(e,{name:r,index:n,operation:o,tree:i})}}});var Zpe={};Cf(Zpe,{JsonPatchError:()=>ss,_areEquals:()=>T2,applyOperation:()=>gR,applyPatch:()=>AE,applyReducer:()=>Fir,deepClone:()=>Dir,getValueByPointer:()=>lG,validate:()=>y4e,validator:()=>cG});function lG(t,e){if(e=="")return t;var r={op:"_get",path:e};return gR(t,r),r.value}function gR(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):cG(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=lG(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=T2(t,e.value),a.test===!1)throw new ss("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 ss("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=Md(t));let s=(e.path||"").split("/"),u=t,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=cG;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=P2(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&&!uG(f))throw new ss("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);uG(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new ss("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=Lir[e.op].call(e,u,f,t);if(m.test===!1)throw new ss("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(l>=c){let m=VL[e.op].call(e,u,f,t);if(m.test===!1)throw new ss("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(u=u[f],r&&l0)throw new ss('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 ss("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 ss("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")&&iG(t.value))throw new ss("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 ss("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 ss("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=y4e([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new ss("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new ss("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function y4e(t,e,r){try{if(!Array.isArray(t))throw new ss("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)AE(Md(e),Md(t),r||!0);else{r=r||cG;for(var n=0;n{E2();ss=hR,Dir=Md,VL={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=lG(r,this.path);n&&(n=Md(n));let o=gR(r,{op:"remove",path:this.from}).removed;return gR(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=lG(r,this.from);return gR(r,{op:"add",path:this.path,value:Md(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:T2(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},Lir={add:function(t,e,r){return uG(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:VL.move,copy:VL.copy,test:VL.test,_get:VL._get}});function b4e(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=sG(e),a=sG(t),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=t[c];if(aG(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)?b4e(d,f,r,n+"/"+zb(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+zb(c),value:Md(d)}),r.push({op:"replace",path:n+"/"+zb(c),value:Md(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+zb(c),value:Md(d)}),r.push({op:"remove",path:n+"/"+zb(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{E2();dG();});var xNn,Xpe=w(()=>{dG();_4e();E2();dG();E2();xNn={...Zpe,JsonPatchError:hR,deepClone:Md,escapePathComponent:zb,unescapePathComponent:P2}});var w4e=v((TNn,v4e)=>{"use strict";v4e.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 T4e=v((ANn,Qpe)=>{"use strict";var kir=/[\p{Lu}]/u,$ir=/[\p{Ll}]/u,S4e=/^[\p{Lu}](?![\p{Lu}])/gu,O4e=/([\p{Alpha}\p{N}_]|$)/u,P4e=/[_.\- ]+/,Bir=new RegExp("^"+P4e.source),x4e=new RegExp(P4e.source+O4e.source,"gu"),C4e=new RegExp("\\d+"+O4e.source,"gu"),qir=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a(S4e.lastIndex=0,t.replace(S4e,r=>e(r))),zir=(t,e)=>(x4e.lastIndex=0,C4e.lastIndex=0,t.replace(x4e,(r,n)=>e(n)).replace(C4e,r=>e(r))),E4e=(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=qir(t,r,n)),t=t.replace(Bir,""),e.preserveConsecutiveUppercase?t=Uir(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),zir(t,n))};Qpe.exports=E4e;Qpe.exports.default=E4e});function I4e(t,e){return e?.[t]||(0,A4e.default)(t)}function M4e(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var A4e,Hir,R4e=w(()=>{A4e=F(w4e(),1),Hir=F(T4e(),1)});function j4e(t){return Array.isArray(t)?[...t]:{...t}}function Vir(t,e){let r=j4e(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]=j4e(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function eme(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 gp,yR=w(()=>{R4e();gp=class t{static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eme(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:M4e(Object.keys(r).length?Vir(n,r):n,I4e,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});async function N4e(){return tme===void 0&&(tme={library:"langchain-js",runtime:pG()}),tme}function ot(t){try{return typeof process<"u"?process.env?.[t]:rme()?Deno?.env.get(t):void 0}catch{return}}var Wir,Kir,Gir,rme,Jir,pG,tme,bR=w(()=>{Wir=()=>typeof window<"u"&&typeof window.document<"u",Kir=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",Gir=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),rme=()=>typeof Deno<"u",Jir=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!rme(),pG=()=>{let t;return Wir()?t="browser":Jir()?t="node":Kir()?t="webworker":Gir()?t="jsdom":rme()?t="deno":t="other",t}});function ome(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var nme,_R,D4e,A2=w(()=>{TE();yR();bR();nme=class{};_R=class t extends nme{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,eme(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:ot("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 gp.prototype.toJSON.call(this)}toJSONNotImplemented(){return gp.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}},D4e=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});function ime(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function Yir(t){return t.replace(/[-:.]/g,"")}function Zir(t,e,r){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return Yir(`${new Date(t).toISOString().slice(0,-1)}${n}Z`)+e}function WL(t){return typeof t._addRunToRunMap=="function"}var xh,vR=w(()=>{A2();xh=class extends _R{constructor(e){super(...arguments),Object.defineProperty(this,"runMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}copy(){return this}stringifyError(e){return e instanceof Error?e.message+(e?.stack?` -${e.stack}`:""):typeof e=="string"?e:`${e}`}_addChildRun(e,r){e.child_runs.push(r)}_addRunToRunMap(e){let r=Wir(e.start_time,e.id,e.execution_order),n={...e};if(n.parent_run_id!==void 0){let o=this.runMap.get(n.parent_run_id);o&&(this._addChildRun(o,n),o.child_execution_order=Math.max(o.child_execution_order,n.child_execution_order),n.trace_id=o.trace_id,o.dotted_order!==void 0&&(n.dotted_order=[o.dotted_order,r].join(".")))}else n.trace_id=n.id,n.dotted_order=r;return this.runMap.set(n.id,n),n}async _endTrace(e){let r=e.parent_run_id!==void 0&&this.runMap.get(e.parent_run_id);r?r.child_execution_order=Math.max(r.child_execution_order,e.child_execution_order):await this.persistRun(e),this.runMap.delete(e.id),await this.onRunUpdate?.(e)}_getExecutionOrder(e){let r=e!==void 0&&this.runMap.get(e);return r?r.child_execution_order+1:1}_createRunForLLMStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{prompts:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleLLMStart(e,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForLLMStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}_createRunForChatModelStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{messages:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleChatModelStart(e,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForChatModelStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}async handleLLMEnd(e,r,n,o,i){let a=this.runMap.get(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.outputs=e,a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMEnd?.(a),await this._endTrace(a),a}async handleLLMError(e,r,n,o,i){let a=this.runMap.get(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMError?.(a),await this._endTrace(a),a}_createRunForChainStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:r,execution_order:l,child_execution_order:l,run_type:s??"chain",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(d)}async handleChainStart(e,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForChainStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onChainStart?.(l),l}async handleChainEnd(e,r,n,o,i){let a=this.runMap.get(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.outputs=rme(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=rme(i.inputs,"input")),await this.onChainEnd?.(a),await this._endTrace(a),a}async handleChainError(e,r,n,o,i){let a=this.runMap.get(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=rme(i.inputs,"input")),await this.onChainError?.(a),await this._endTrace(a),a}_createRunForToolStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{input:r},execution_order:u,child_execution_order:u,run_type:"tool",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleToolStart(e,r,n,o,i,a,s){let u=this.runMap.get(n)??this._createRunForToolStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onToolStart?.(u),u}async handleToolEnd(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.outputs={output:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onToolEnd?.(n),await this._endTrace(n),n}async handleToolError(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onToolError?.(n),await this._endTrace(n),n}async handleAgentAction(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="chain")return;let o=n;o.actions=o.actions||[],o.actions.push(e),o.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentAction?.(n)}async handleAgentEnd(e,r){let n=this.runMap.get(r);!n||n?.run_type!=="chain"||(n.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentEnd?.(n))}_createRunForRetrieverStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{query:r},execution_order:u,child_execution_order:u,run_type:"retriever",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleRetrieverStart(e,r,n,o,i,a,s){let u=this.runMap.get(n)??this._createRunForRetrieverStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onRetrieverStart?.(u),u}async handleRetrieverEnd(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.outputs={documents:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onRetrieverEnd?.(n),await this._endTrace(n),n}async handleRetrieverError(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onRetrieverError?.(n),await this._endTrace(n),n}async handleText(e,r){let n=this.runMap.get(r);!n||n?.run_type!=="chain"||(n.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:e}}),await this.onText?.(n))}async handleLLMNewToken(e,r,n,o,i,a){let s=this.runMap.get(n);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:e,idx:r,chunk:a?.chunk}}),await this.onLLMNewToken?.(s,e,{chunk:a?.chunk}),s}}});var F4e=v((NNn,L4e)=>{"use strict";var N4e=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,D4e=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function Kir(){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=N4e(),e.color.ansi16m=D4e(),e.bgColor.ansi256=N4e(10),e.bgColor.ansi16m=D4e(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=/(?[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(L4e,"exports",{enumerable:!0,get:Kir})});function Af(t,e){return`${t.open}${e}${t.close}`}function Ch(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function k4e(t){return typeof t=="string"?t.trim():t==null?t:Ch(t,t.toString())}function IE(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 nme,yp,A2,$4e=w(()=>{nme=F(F4e(),1);vR();({color:yp}=nme.default),A2=class extends xh{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?Af(nme.default.bold,s):s}).join(" > ");return Af(yp.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.green,"[chain/start]")} [${r}] Entering Chain run with input: ${Ch(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.cyan,"[chain/end]")} [${r}] [${IE(e)}] Exiting Chain run with output: ${Ch(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.red,"[chain/error]")} [${r}] [${IE(e)}] Chain run errored with error: ${Ch(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(`${Af(yp.green,"[llm/start]")} [${r}] Entering LLM run with input: ${Ch(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.cyan,"[llm/end]")} [${r}] [${IE(e)}] Exiting LLM run with output: ${Ch(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.red,"[llm/error]")} [${r}] [${IE(e)}] LLM run errored with error: ${Ch(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.green,"[tool/start]")} [${r}] Entering Tool run with input: "${k4e(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.cyan,"[tool/end]")} [${r}] [${IE(e)}] Exiting Tool run with output: "${k4e(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.red,"[tool/error]")} [${r}] [${IE(e)}] Tool run errored with error: ${Ch(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${Ch(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.cyan,"[retriever/end]")} [${r}] [${IE(e)}] Exiting Retriever run with output: ${Ch(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.red,"[retriever/error]")} [${r}] [${IE(e)}] Retriever run errored with error: ${Ch(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${Af(yp.blue,"[agent/action]")} [${n}] Agent selected action: ${Ch(r.actions[r.actions.length-1],"[action]")}`)}}});function ME(t,e){return t.lc_error_code=e,t.message=`${t.message} +${e.stack}`:""):typeof e=="string"?e:`${e}`}_addChildRun(e,r){e.child_runs.push(r)}_addRunToRunMap(e){let r=Zir(e.start_time,e.id,e.execution_order),n={...e};if(n.parent_run_id!==void 0){let o=this.runMap.get(n.parent_run_id);o&&(this._addChildRun(o,n),o.child_execution_order=Math.max(o.child_execution_order,n.child_execution_order),n.trace_id=o.trace_id,o.dotted_order!==void 0&&(n.dotted_order=[o.dotted_order,r].join(".")))}else n.trace_id=n.id,n.dotted_order=r;return this.runMap.set(n.id,n),n}async _endTrace(e){let r=e.parent_run_id!==void 0&&this.runMap.get(e.parent_run_id);r?r.child_execution_order=Math.max(r.child_execution_order,e.child_execution_order):await this.persistRun(e),this.runMap.delete(e.id),await this.onRunUpdate?.(e)}_getExecutionOrder(e){let r=e!==void 0&&this.runMap.get(e);return r?r.child_execution_order+1:1}_createRunForLLMStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{prompts:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleLLMStart(e,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForLLMStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}_createRunForChatModelStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{messages:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleChatModelStart(e,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForChatModelStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}async handleLLMEnd(e,r,n,o,i){let a=this.runMap.get(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.outputs=e,a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMEnd?.(a),await this._endTrace(a),a}async handleLLMError(e,r,n,o,i){let a=this.runMap.get(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMError?.(a),await this._endTrace(a),a}_createRunForChainStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:r,execution_order:l,child_execution_order:l,run_type:s??"chain",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(d)}async handleChainStart(e,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForChainStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onChainStart?.(l),l}async handleChainEnd(e,r,n,o,i){let a=this.runMap.get(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.outputs=ime(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=ime(i.inputs,"input")),await this.onChainEnd?.(a),await this._endTrace(a),a}async handleChainError(e,r,n,o,i){let a=this.runMap.get(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=ime(i.inputs,"input")),await this.onChainError?.(a),await this._endTrace(a),a}_createRunForToolStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{input:r},execution_order:u,child_execution_order:u,run_type:"tool",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleToolStart(e,r,n,o,i,a,s){let u=this.runMap.get(n)??this._createRunForToolStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onToolStart?.(u),u}async handleToolEnd(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.outputs={output:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onToolEnd?.(n),await this._endTrace(n),n}async handleToolError(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onToolError?.(n),await this._endTrace(n),n}async handleAgentAction(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="chain")return;let o=n;o.actions=o.actions||[],o.actions.push(e),o.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentAction?.(n)}async handleAgentEnd(e,r){let n=this.runMap.get(r);!n||n?.run_type!=="chain"||(n.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentEnd?.(n))}_createRunForRetrieverStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{query:r},execution_order:u,child_execution_order:u,run_type:"retriever",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleRetrieverStart(e,r,n,o,i,a,s){let u=this.runMap.get(n)??this._createRunForRetrieverStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onRetrieverStart?.(u),u}async handleRetrieverEnd(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.outputs={documents:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onRetrieverEnd?.(n),await this._endTrace(n),n}async handleRetrieverError(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onRetrieverError?.(n),await this._endTrace(n),n}async handleText(e,r){let n=this.runMap.get(r);!n||n?.run_type!=="chain"||(n.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:e}}),await this.onText?.(n))}async handleLLMNewToken(e,r,n,o,i,a){let s=this.runMap.get(n);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:e,idx:r,chunk:a?.chunk}}),await this.onLLMNewToken?.(s,e,{chunk:a?.chunk}),s}}});var $4e=v(($Nn,k4e)=>{"use strict";var L4e=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,F4e=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function Xir(){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=L4e(),e.color.ansi16m=F4e(),e.bgColor.ansi256=L4e(10),e.bgColor.ansi16m=F4e(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=/(?[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(k4e,"exports",{enumerable:!0,get:Xir})});function Af(t,e){return`${t.open}${e}${t.close}`}function Ch(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function B4e(t){return typeof t=="string"?t.trim():t==null?t:Ch(t,t.toString())}function IE(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 ame,yp,I2,q4e=w(()=>{ame=F($4e(),1);vR();({color:yp}=ame.default),I2=class extends xh{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?Af(ame.default.bold,s):s}).join(" > ");return Af(yp.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.green,"[chain/start]")} [${r}] Entering Chain run with input: ${Ch(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.cyan,"[chain/end]")} [${r}] [${IE(e)}] Exiting Chain run with output: ${Ch(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.red,"[chain/error]")} [${r}] [${IE(e)}] Chain run errored with error: ${Ch(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(`${Af(yp.green,"[llm/start]")} [${r}] Entering LLM run with input: ${Ch(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.cyan,"[llm/end]")} [${r}] [${IE(e)}] Exiting LLM run with output: ${Ch(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.red,"[llm/error]")} [${r}] [${IE(e)}] LLM run errored with error: ${Ch(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.green,"[tool/start]")} [${r}] Entering Tool run with input: "${B4e(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.cyan,"[tool/end]")} [${r}] [${IE(e)}] Exiting Tool run with output: "${B4e(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.red,"[tool/error]")} [${r}] [${IE(e)}] Tool run errored with error: ${Ch(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${Ch(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.cyan,"[retriever/end]")} [${r}] [${IE(e)}] Exiting Retriever run with output: ${Ch(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.red,"[retriever/error]")} [${r}] [${IE(e)}] Retriever run errored with error: ${Ch(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${Af(yp.blue,"[agent/action]")} [${n}] Agent selected action: ${Ch(r.actions[r.actions.length-1],"[action]")}`)}}});function ME(t,e){return t.lc_error_code=e,t.message=`${t.message} Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/ -`,t}var I2=w(()=>{});function RE(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function B4e(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 wR,pG=w(()=>{wR=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 ome(t,e=WL){t=t.trim();let r=t.indexOf("```");if(r===-1)return e(t);let n=t.substring(r+3);n.startsWith(`json +`,t}var M2=w(()=>{});function RE(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function U4e(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 wR,mG=w(()=>{wR=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 sme(t,e=KL){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 WL(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 ime=w(()=>{});function jE(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 q4e(t){return jE(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function U4e(t){return jE(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function z4e(t){if(jE(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 ame({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 H4e(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 sme=w(()=>{});function Oh(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.some(r=>jE(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?M2(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>jE(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function V4e(t,e){return t==="error"||e==="error"?"error":"success"}function Gir(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 xs(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]=xs(r[n],o);else if(Array.isArray(r[n]))r[n]=M2(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 M2(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]=xs(r[o],n):r.push(n)}else{if(typeof n=="object"&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function W4e(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. +`)&&(n=n.substring(1));let o=n.indexOf("```"),i=n;return o!==-1&&(i=n.substring(0,o)),e(i.trim())}function KL(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 ume=w(()=>{});function jE(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 z4e(t){return jE(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function H4e(t){return jE(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function V4e(t){if(jE(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 lme({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 W4e(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 cme=w(()=>{});function Oh(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.some(r=>jE(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?R2(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>jE(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function K4e(t,e){return t==="error"||e==="error"?"error":"success"}function Qir(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 xs(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]=xs(r[n],o);else if(Array.isArray(r[n]))r[n]=R2(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 R2(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]=xs(r[o],n):r.push(n)}else{if(typeof n=="object"&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function G4e(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 M2(t,e);if(typeof t=="object"&&typeof e=="object")return xs(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types. +Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return R2(t,e);if(typeof t=="object"&&typeof e=="object")return xs(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types. Left ${t} -Right ${e}`)}function K4e(t){return typeof t.role=="string"}function Ph(t){return typeof t?._getType=="function"}function ume(t){return Ph(t)&&typeof t.concat=="function"}var Sl,bp,Eh=w(()=>{yR();sme();Sl=class extends gp{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=Gir(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}};bp=class extends Sl{}});function G4e(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function J4e(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 PC,Th,KL=w(()=>{Eh();PC=class extends Sl{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}constructor(e,r,n){typeof e=="string"&&(e={content:e,name:n,tool_call_id:r}),super(e),Object.defineProperty(this,"lc_direct_tool_output",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tool_call_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"artifact",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}_getType(){return"tool"}static isInstance(e){return e._getType()==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},Th=class t extends bp{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:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),artifact:W4e(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:V4e(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function Oi(t){return t._getType()==="ai"}function lme(t){return t._getType()==="ai"}var gn,dr,SR=w(()=>{ime();Eh();KL();gn=class extends Sl{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. +Right ${e}`)}function J4e(t){return typeof t.role=="string"}function Ph(t){return typeof t?._getType=="function"}function dme(t){return Ph(t)&&typeof t.concat=="function"}var Sl,bp,Eh=w(()=>{yR();cme();Sl=class extends gp{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=Qir(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}};bp=class extends Sl{}});function Y4e(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function Z4e(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 EC,Th,GL=w(()=>{Eh();EC=class extends Sl{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}constructor(e,r,n){typeof e=="string"&&(e={content:e,name:n,tool_call_id:r}),super(e),Object.defineProperty(this,"lc_direct_tool_output",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tool_call_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"artifact",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}_getType(){return"tool"}static isInstance(e){return e._getType()==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},Th=class t extends bp{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:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),artifact:G4e(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:K4e(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function Oi(t){return t._getType()==="ai"}function fme(t){return t._getType()==="ai"}var gn,dr,SR=w(()=>{ume();Eh();GL();gn=class extends Sl{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]=J4e(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}}};dr=class t extends bp{constructor(e){let r;if(typeof e=="string")r={content:e,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]};else if(e.tool_call_chunks===void 0)r={...e,tool_calls:e.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0};else{let n=[],o=[];for(let i of e.tool_call_chunks){let a={};try{if(a=WL(i.args||"{}"),a===null||typeof a!="object"||Array.isArray(a))throw new Error("Malformed tool call chunk args.");n.push({name:i.name??"",args:a,id:i.id,type:"tool_call"})}catch{o.push({name:i.name,args:i.args,id:i.id,error:"Malformed args.",type:"invalid_tool_call"})}}r={...e,tool_calls:n,invalid_tool_calls:o,usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0}}super(r),Object.defineProperty(this,"tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"invalid_tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"tool_call_chunks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"usage_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_chunks=r.tool_call_chunks??this.tool_call_chunks,this.tool_calls=r.tool_calls??this.tool_calls,this.invalid_tool_calls=r.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=r.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks"}}static lc_name(){return"AIMessageChunk"}_getType(){return"ai"}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(e){let r={content:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(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=M2(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 Cs,If,mG=w(()=>{Eh();Cs=class t extends Sl{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}}},If=class t extends bp{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:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}get _printableFields(){return{...super._printableFields,role:this.role}}}});var ym,hG=w(()=>{Eh();ym=class t extends bp{static lc_name(){return"FunctionMessageChunk"}_getType(){return"function"}concat(e){return new t({content:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});var Os,Mf,R2=w(()=>{Eh();Os=class extends Sl{static lc_name(){return"HumanMessage"}_getType(){return"human"}constructor(e,r){super(e,r)}},Mf=class t extends bp{static lc_name(){return"HumanMessageChunk"}_getType(){return"human"}constructor(e,r){super(e,r)}concat(e){return new t({content:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});var EC,Rd,gG=w(()=>{Eh();EC=class extends Sl{static lc_name(){return"SystemMessage"}_getType(){return"system"}constructor(e,r){super(e,r)}},Rd=class t extends bp{static lc_name(){return"SystemMessageChunk"}_getType(){return"system"}constructor(e,r){super(e,r)}concat(e){return new t({content:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});function Yir(t){return RE(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 Zir(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function cme(t){let e,r;if(Zir(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 Os(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new gn(r);let i=n.map(Yir);return new gn({...o,tool_calls:i})}else{if(e==="system")return new EC(r);if(e==="developer")return new EC({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new PC({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});throw ME(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported. +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]=Z4e(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}}};dr=class t extends bp{constructor(e){let r;if(typeof e=="string")r={content:e,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]};else if(e.tool_call_chunks===void 0)r={...e,tool_calls:e.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0};else{let n=[],o=[];for(let i of e.tool_call_chunks){let a={};try{if(a=KL(i.args||"{}"),a===null||typeof a!="object"||Array.isArray(a))throw new Error("Malformed tool call chunk args.");n.push({name:i.name??"",args:a,id:i.id,type:"tool_call"})}catch{o.push({name:i.name,args:i.args,id:i.id,error:"Malformed args.",type:"invalid_tool_call"})}}r={...e,tool_calls:n,invalid_tool_calls:o,usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0}}super(r),Object.defineProperty(this,"tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"invalid_tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"tool_call_chunks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"usage_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_chunks=r.tool_call_chunks??this.tool_call_chunks,this.tool_calls=r.tool_calls??this.tool_calls,this.invalid_tool_calls=r.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=r.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks"}}static lc_name(){return"AIMessageChunk"}_getType(){return"ai"}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(e){let r={content:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(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=R2(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 Cs,If,hG=w(()=>{Eh();Cs=class t extends Sl{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}}},If=class t extends bp{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:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}get _printableFields(){return{...super._printableFields,role:this.role}}}});var ym,gG=w(()=>{Eh();ym=class t extends bp{static lc_name(){return"FunctionMessageChunk"}_getType(){return"function"}concat(e){return new t({content:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});var Os,Mf,j2=w(()=>{Eh();Os=class extends Sl{static lc_name(){return"HumanMessage"}_getType(){return"human"}constructor(e,r){super(e,r)}},Mf=class t extends bp{static lc_name(){return"HumanMessageChunk"}_getType(){return"human"}constructor(e,r){super(e,r)}concat(e){return new t({content:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});var TC,Rd,yG=w(()=>{Eh();TC=class extends Sl{static lc_name(){return"SystemMessage"}_getType(){return"system"}constructor(e,r){super(e,r)}},Rd=class t extends bp{static lc_name(){return"SystemMessageChunk"}_getType(){return"system"}constructor(e,r){super(e,r)}concat(e){return new t({content:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});function tar(t){return RE(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 rar(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function pme(t){let e,r;if(rar(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 Os(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new gn(r);let i=n.map(tar);return new gn({...o,tool_calls:i})}else{if(e==="system")return new TC(r);if(e==="developer")return new TC({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new EC({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});throw ME(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 fy(t){if(typeof t=="string")return new Os(t);if(Ph(t))return t;if(Array.isArray(t)){let[e,r]=t;return cme({type:e,content:r})}else if(K4e(t)){let{role:e,...r}=t;return cme({...r,type:e})}else return cme(t)}function Rf(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 dme(t){let e=t._getType();if(e==="human")return new Mf({...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 dr({...r})}else{if(e==="system")return new Rd({...t});if(e==="function")return new ym({...t});if(Cs.isInstance(t))return new If({...t});throw new Error("Unknown message type.")}}var NE=w(()=>{I2();pG();SR();Eh();mG();hG();R2();gG();KL()});var fme=w(()=>{QK()});var pme=w(()=>{ZK()});var mme,Y4e,Z4e=w(()=>{pme();bR();Y4e=()=>{if(mme===void 0){let t=ot("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};mme=new mR(t)}return mme}});var GL,X4e=w(()=>{fme();Kpe();bR();vR();Z4e();GL=class t extends xh{constructor(e={}){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"langchain_tracer"}),Object.defineProperty(this,"projectName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let{exampleId:r,projectName:n,client:o}=e;this.projectName=n??ot("LANGCHAIN_PROJECT")??ot("LANGCHAIN_SESSION"),this.exampleId=r,this.client=o??Y4e();let i=t.getTraceableRunTree();i&&this.updateFromRunTree(i)}async _convertToCreate(e,r=void 0){return{...e,extra:{...e.extra,runtime:await R4e()},child_runs:void 0,session_name:this.projectName,reference_example_id:e.parent_run_id?void 0:r}}async persistRun(e){}async onRunCreate(e){let r=await this._convertToCreate(e,this.exampleId);await this.client.createRun(r)}async onRunUpdate(e){let r={end_time:e.end_time,error:e.error,outputs:e.outputs,events:e.events,inputs:e.inputs,trace_id:e.trace_id,dotted_order:e.dotted_order,parent_run_id:e.parent_run_id,extra:e.extra,session_name:this.projectName};await this.client.updateRun(e.id,r)}getRun(e){return this.runMap.get(e)}updateFromRunTree(e){let r=e,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let o=[r];for(;o.length>0;){let i=o.shift();!i||n.has(i.id)||(n.add(i.id),this.runMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}convertToRunTree(e){let r={},n=[];for(let[o,i]of this.runMap){let a=new CC({...i,child_runs:[],parent_run:void 0,client:this.client,project_name:this.projectName,reference_example_id:this.exampleId,tracingEnabled:!0});r[o]=a,n.push([o,i.dotted_order])}n.sort((o,i)=>!o[1]||!i[1]?0:o[1].localeCompare(i[1]));for(let[o]of n){let i=this.runMap.get(o),a=r[o];if(!(!i||!a)&&i.parent_run_id){let s=r[i.parent_run_id];s&&(s.child_runs.push(a),a.parent_run=s)}}return r[e]}static getTraceableRunTree(){try{return f4e()}catch{return}}}});var Q4e,xR,e3e,DE,j2=w(()=>{Q4e=Symbol.for("ls:tracing_async_local_storage"),xR=Symbol.for("lc:context_variables"),e3e=t=>{globalThis[Q4e]=t},DE=()=>globalThis[Q4e]});function Xir(){let t="default"in yG.default?yG.default.default:yG.default;return new t({autoStart:!0,concurrency:1})}function Qir(){return typeof N2>"u"&&(N2=Xir()),N2}async function Ps(t,e){if(e===!0){let r=DE();r!==void 0?await r.run(void 0,async()=>t()):await t()}else N2=Qir(),N2.add(async()=>{let r=DE();r!==void 0?await r.run(void 0,async()=>t()):await t()})}var yG,N2,t3e=w(()=>{yG=F(NK(),1);j2()});var r3e=w(()=>{t3e()});var n3e,o3e=w(()=>{bR();n3e=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>ot(r)==="true")});function hme(t){let e=DE();return e===void 0?void 0:e.getStore()?.[xR]?.[t]}var ear,i3e,a3e=w(()=>{fme();j2();ear=Symbol("lc:configure_hooks"),i3e=()=>hme(ear)||[]});function CR(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function D2(t){return"name"in t?t:_R.fromMethods(t)}var gme,JL,yme,bG,bme,_me,Bs,LE=w(()=>{TE();T2();$4e();NE();bR();X4e();r3e();o3e();vR();a3e();gme=class{setHandler(e){return this.setHandlers([e])}},JL=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=>Ps(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=>Ps(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)))}},yme=class extends JL{getChild(e){let r=new Bs(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=>Ps(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=>Ps(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)))}},bG=class extends JL{async handleLLMNewToken(e,r,n,o,i,a){await Promise.all(this.handlers.map(s=>Ps(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=>Ps(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=>Ps(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)))}},bme=class extends JL{getChild(e){let r=new Bs(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=>Ps(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=>Ps(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=>Ps(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=>Ps(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)))}},_me=class extends JL{getChild(e){let r=new Bs(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=>Ps(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=>Ps(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)))}},Bs=class t extends gme{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 VL(f)&&f._createRunForLLMStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),Ps(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 bG(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 VL(f)&&f._createRunForChatModelStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),Ps(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=Rf(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 bG(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 VL(u)&&u._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,s),Ps(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 bme(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 VL(u)&&u._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),Ps(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 _me(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 VL(u)&&u._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),Ps(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 yme(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=>Ps(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 _R{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(D2)??[],!0)):u=e,u=u.copy(Array.isArray(r)?r.map(D2):r?.handlers,!1));let l=ot("LANGCHAIN_VERBOSE")==="true"||s?.verbose,c=GL.getTraceableRunTree()?.tracingEnabled||n3e(),d=c||(ot("LANGCHAIN_TRACING")??!1);if(l||d){if(u||(u=new t),l&&!u.handlers.some(f=>f.name===A2.prototype.name)){let f=new A2;u.addHandler(f,!0)}if(d&&!u.handlers.some(f=>f.name==="langchain_tracer")&&c){let f=new GL;u.addHandler(f,!0),u._parentRunId=GL.getTraceableRunTree()?.id??u._parentRunId}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of i3e()){let b=h&&ot(h)==="true"&&m,g,y=f!==void 0?hme(f):void 0;y&&j4e(y)?g=y:b&&(g=new m({})),g!==void 0&&(u||(u=new t),u.handlers.some(S=>S.name===g.name)||u.addHandler(g,p))}return(n||o)&&u&&(u.addTags(n??[]),u.addTags(o??[],!1)),(i||a)&&u&&(u.addMetadata(i??{}),u.addMetadata(a??{},!1)),u}}});var _G,tar,s3e,vme,jd,u3e=w(()=>{pme();j2();LE();_G=class{getStore(){}run(e,r){return r()}enterWith(e){}},tar=new _G,s3e=Symbol.for("lc:child_config"),vme=class{getInstance(){return DE()??tar}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[s3e]}runWithConfig(e,r,n){let o=Bs._configureSync(e?.callbacks,void 0,e?.tags,void 0,e?.metadata),i=this.getInstance(),a=i.getStore(),s=o?.getParentRunId(),u=o?.handlers?.find(c=>c?.name==="langchain_tracer"),l;return u&&s?l=u.convertToRunTree(s):n||(l=new CC({name:"",tracingEnabled:!1})),l&&(l.extra={...l.extra,[s3e]:e}),a!==void 0&&a[xR]!==void 0&&(l===void 0&&(l={}),l[xR]=a[xR]),i.run(l,r)}initializeGlobalInstance(e){DE()===void 0&&e3e(e)}},jd=new vme});var YL=w(()=>{u3e();j2()});async function _p(t){return Bs._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function wG(...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(D2(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(D2(s),!0);e.callbacks=a}else e.callbacks=new Bs(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 un(t){let e=jd.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))rar.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 us(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=un(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 bm(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 vG,rar,Hb=w(()=>{LE();YL();vG=25;rar=new Set(["string","number","boolean"])});async function Vb(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 wme=w(()=>{});function Sme(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 Hl(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]=Hl(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function l3e(t,e,r,n,...o){let i=new TC({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var Nd,TC,Wb=w(()=>{Hb();YL();wme();Nd=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)}})}};TC=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)=>{jd.runWithConfig(bm(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?jd.runWithConfig(bm(this.config),this.signal?async()=>Vb(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 c3e(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 d3e(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 nar(t){return t!==void 0&&t.message!==void 0}var py,L2,f3e,F2,p3e=w(()=>{Jpe();vR();Wb();SR();py=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=AE({},r);return new L2({ops:r,state:n[n.length-1].newDocument})}},L2=class t extends py{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=AE(this.state,e.ops);return new t({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=AE({},e.ops);return new t({ops:e.ops,state:r[r.length-1].newDocument})}},f3e=t=>t.name==="log_stream_tracer";F2=class extends xh{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=Nd.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 py({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 py({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 c3e(e,this._schemaFormat)),await this.writer.write(new py({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 c3e(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await d3e(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 py({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new py({ops:[{op:"replace",path:"/final_output",value:await d3e(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?nar(n?.chunk)?a=n?.chunk:a=new dr({id:`run-${e.id}`,content:r}):a=r;let s=new py({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 k2,vp,qn,ZL=w(()=>{k2="__run",vp=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}})}},qn=class t extends vp{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 SG({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 m3e,xG,h3e=w(()=>{vR();Wb();SR();ZL();m3e=t=>t.name==="event_stream_tracer",xG=class extends xh{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=Nd.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 vp({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=SG(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 dr({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 vp({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=SG(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=SG(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=SG(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 g3e,CG,oar,iar,_m,XL=w(()=>{g3e=F(PK(),1),CG=F(NK(),1),oar=[400,401,402,403,404,405,406,407,409],iar=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&&oar.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},_m=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??iar;let r="default"in CG.default?CG.default.default:CG.default;this.queue=new r({concurrency:this.maxConcurrency})}call(e,...r){return this.queue.add(()=>(0,g3e.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 $2,y3e=w(()=>{vR();$2=class extends xh{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 B2(t){return t?t.lc_runnable:!1}var OG,xme=w(()=>{OG=class{constructor(e){Object.defineProperty(this,"includeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.includeNames=e.includeNames,this.includeTypes=e.includeTypes,this.includeTags=e.includeTags,this.excludeNames=e.excludeNames,this.excludeTypes=e.excludeTypes,this.excludeTags=e.excludeTags}includeEvent(e,r){let n=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,o=e.tags??[];return this.includeNames!==void 0&&(n=n||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(r)),this.includeTags!==void 0&&(n=n||o.some(i=>this.includeTags?.includes(i))),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(r)),this.excludeTags!==void 0&&(n=n&&o.every(i=>!this.excludeTags?.includes(i))),n}}});var _3e,b3e,v3e,PG=w(()=>{_3e=Symbol("Let zodToJsonSchema decide on which parser to use"),b3e={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"},v3e=t=>typeof t=="string"?{...b3e,name:t}:{...b3e,...t}});var w3e,Cme=w(()=>{PG();w3e=t=>{let e=v3e(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 Ome(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Un(t,e,r,n,o){t[e]=r,Ome(t,e,n,o)}var FE=w(()=>{});function S3e(){return{}}var Pme=w(()=>{});function x3e(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==de.ZodAny&&(r.items=fr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Un(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Un(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Un(r,"minItems",t.exactLength.value,t.exactLength.message,e),Un(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var Eme=w(()=>{Td();FE();qs()});function C3e(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?Un(r,"minimum",n.value,n.message,e):Un(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Un(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Un(r,"maximum",n.value,n.message,e):Un(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Un(r,"maximum",n.value,n.message,e));break;case"multipleOf":Un(r,"multipleOf",n.value,n.message,e);break}return r}var Tme=w(()=>{FE()});function O3e(){return{type:"boolean"}}var Ame=w(()=>{});function EG(t,e){return fr(t.type._def,e)}var TG=w(()=>{qs()});var P3e,Ime=w(()=>{qs();P3e=(t,e)=>fr(t.innerType._def,e)});function Mme(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>Mme(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 aar(t,e)}}var aar,Rme=w(()=>{FE();aar=(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":Un(r,"minimum",n.value,n.message,e);break;case"max":Un(r,"maximum",n.value,n.message,e);break}return r}});function E3e(t,e){return{...fr(t.innerType._def,e),default:t.defaultValue()}}var jme=w(()=>{qs()});function T3e(t,e){return e.effectStrategy==="input"?fr(t.schema._def,e):{}}var Nme=w(()=>{qs()});function A3e(t){return{type:"string",enum:Array.from(t.values)}}var Dme=w(()=>{});function I3e(t,e){let r=[fr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),fr(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(sar(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 sar,Lme=w(()=>{qs();sar=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function M3e(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 Fme=w(()=>{});function AG(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":Un(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":Un(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":hy(r,"email",n.message,e);break;case"format:idn-email":hy(r,"idn-email",n.message,e);break;case"pattern:zod":jf(r,my.email,n.message,e);break}break;case"url":hy(r,"uri",n.message,e);break;case"uuid":hy(r,"uuid",n.message,e);break;case"regex":jf(r,n.regex,n.message,e);break;case"cuid":jf(r,my.cuid,n.message,e);break;case"cuid2":jf(r,my.cuid2,n.message,e);break;case"startsWith":jf(r,RegExp(`^${$me(n.value,e)}`),n.message,e);break;case"endsWith":jf(r,RegExp(`${$me(n.value,e)}$`),n.message,e);break;case"datetime":hy(r,"date-time",n.message,e);break;case"date":hy(r,"date",n.message,e);break;case"time":hy(r,"time",n.message,e);break;case"duration":hy(r,"duration",n.message,e);break;case"length":Un(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),Un(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{jf(r,RegExp($me(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&hy(r,"ipv4",n.message,e),n.version!=="v4"&&hy(r,"ipv6",n.message,e);break}case"base64url":jf(r,my.base64url,n.message,e);break;case"jwt":jf(r,my.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&jf(r,my.ipv4Cidr,n.message,e),n.version!=="v4"&&jf(r,my.ipv6Cidr,n.message,e);break}case"emoji":jf(r,my.emoji(),n.message,e);break;case"ulid":{jf(r,my.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{hy(r,"binary",n.message,e);break}case"contentEncoding:base64":{Un(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{jf(r,my.base64,n.message,e);break}}break}case"nanoid":jf(r,my.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function $me(t,e){return e.patternStrategy==="escape"?lar(t):t}function lar(t){let e="";for(let r=0;ro.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}}})):Un(t,"format",e,r,n)}function jf(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:R3e(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Un(t,"pattern",R3e(e,n),r,n)}function R3e(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,type:"tool_call_chunk",index:void 0,args:JSON.stringify(n.args)}))}),new dr({...r})}else{if(e==="system")return new Rd({...t});if(e==="function")return new ym({...t});if(Cs.isInstance(t))return new If({...t});throw new Error("Unknown message type.")}}var NE=w(()=>{M2();mG();SR();Eh();hG();gG();j2();yG();GL()});var hme=w(()=>{eG()});var gme=w(()=>{XK()});var yme,X4e,Q4e=w(()=>{gme();bR();X4e=()=>{if(yme===void 0){let t=ot("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};yme=new mR(t)}return yme}});var JL,e3e=w(()=>{hme();Ype();bR();vR();Q4e();JL=class t extends xh{constructor(e={}){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"langchain_tracer"}),Object.defineProperty(this,"projectName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let{exampleId:r,projectName:n,client:o}=e;this.projectName=n??ot("LANGCHAIN_PROJECT")??ot("LANGCHAIN_SESSION"),this.exampleId=r,this.client=o??X4e();let i=t.getTraceableRunTree();i&&this.updateFromRunTree(i)}async _convertToCreate(e,r=void 0){return{...e,extra:{...e.extra,runtime:await N4e()},child_runs:void 0,session_name:this.projectName,reference_example_id:e.parent_run_id?void 0:r}}async persistRun(e){}async onRunCreate(e){let r=await this._convertToCreate(e,this.exampleId);await this.client.createRun(r)}async onRunUpdate(e){let r={end_time:e.end_time,error:e.error,outputs:e.outputs,events:e.events,inputs:e.inputs,trace_id:e.trace_id,dotted_order:e.dotted_order,parent_run_id:e.parent_run_id,extra:e.extra,session_name:this.projectName};await this.client.updateRun(e.id,r)}getRun(e){return this.runMap.get(e)}updateFromRunTree(e){let r=e,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let o=[r];for(;o.length>0;){let i=o.shift();!i||n.has(i.id)||(n.add(i.id),this.runMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}convertToRunTree(e){let r={},n=[];for(let[o,i]of this.runMap){let a=new OC({...i,child_runs:[],parent_run:void 0,client:this.client,project_name:this.projectName,reference_example_id:this.exampleId,tracingEnabled:!0});r[o]=a,n.push([o,i.dotted_order])}n.sort((o,i)=>!o[1]||!i[1]?0:o[1].localeCompare(i[1]));for(let[o]of n){let i=this.runMap.get(o),a=r[o];if(!(!i||!a)&&i.parent_run_id){let s=r[i.parent_run_id];s&&(s.child_runs.push(a),a.parent_run=s)}}return r[e]}static getTraceableRunTree(){try{return m4e()}catch{return}}}});var t3e,xR,r3e,DE,N2=w(()=>{t3e=Symbol.for("ls:tracing_async_local_storage"),xR=Symbol.for("lc:context_variables"),r3e=t=>{globalThis[t3e]=t},DE=()=>globalThis[t3e]});function nar(){let t="default"in bG.default?bG.default.default:bG.default;return new t({autoStart:!0,concurrency:1})}function oar(){return typeof D2>"u"&&(D2=nar()),D2}async function Ps(t,e){if(e===!0){let r=DE();r!==void 0?await r.run(void 0,async()=>t()):await t()}else D2=oar(),D2.add(async()=>{let r=DE();r!==void 0?await r.run(void 0,async()=>t()):await t()})}var bG,D2,n3e=w(()=>{bG=F(DK(),1);N2()});var o3e=w(()=>{n3e()});var i3e,a3e=w(()=>{bR();i3e=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>ot(r)==="true")});function bme(t){let e=DE();return e===void 0?void 0:e.getStore()?.[xR]?.[t]}var iar,s3e,u3e=w(()=>{hme();N2();iar=Symbol("lc:configure_hooks"),s3e=()=>bme(iar)||[]});function CR(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function L2(t){return"name"in t?t:_R.fromMethods(t)}var _me,YL,vme,_G,wme,Sme,Bs,LE=w(()=>{TE();A2();q4e();NE();bR();e3e();o3e();a3e();vR();u3e();_me=class{setHandler(e){return this.setHandlers([e])}},YL=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=>Ps(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=>Ps(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)))}},vme=class extends YL{getChild(e){let r=new Bs(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=>Ps(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=>Ps(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)))}},_G=class extends YL{async handleLLMNewToken(e,r,n,o,i,a){await Promise.all(this.handlers.map(s=>Ps(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=>Ps(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=>Ps(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)))}},wme=class extends YL{getChild(e){let r=new Bs(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=>Ps(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=>Ps(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=>Ps(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=>Ps(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)))}},Sme=class extends YL{getChild(e){let r=new Bs(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=>Ps(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=>Ps(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)))}},Bs=class t extends _me{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 WL(f)&&f._createRunForLLMStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),Ps(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 _G(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 WL(f)&&f._createRunForChatModelStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),Ps(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=Rf(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 _G(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 WL(u)&&u._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,s),Ps(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 wme(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 WL(u)&&u._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),Ps(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 Sme(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 WL(u)&&u._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),Ps(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 vme(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=>Ps(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 _R{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(L2)??[],!0)):u=e,u=u.copy(Array.isArray(r)?r.map(L2):r?.handlers,!1));let l=ot("LANGCHAIN_VERBOSE")==="true"||s?.verbose,c=JL.getTraceableRunTree()?.tracingEnabled||i3e(),d=c||(ot("LANGCHAIN_TRACING")??!1);if(l||d){if(u||(u=new t),l&&!u.handlers.some(f=>f.name===I2.prototype.name)){let f=new I2;u.addHandler(f,!0)}if(d&&!u.handlers.some(f=>f.name==="langchain_tracer")&&c){let f=new JL;u.addHandler(f,!0),u._parentRunId=JL.getTraceableRunTree()?.id??u._parentRunId}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of s3e()){let b=h&&ot(h)==="true"&&m,g,y=f!==void 0?bme(f):void 0;y&&D4e(y)?g=y:b&&(g=new m({})),g!==void 0&&(u||(u=new t),u.handlers.some(S=>S.name===g.name)||u.addHandler(g,p))}return(n||o)&&u&&(u.addTags(n??[]),u.addTags(o??[],!1)),(i||a)&&u&&(u.addMetadata(i??{}),u.addMetadata(a??{},!1)),u}}});var vG,aar,l3e,xme,jd,c3e=w(()=>{gme();N2();LE();vG=class{getStore(){}run(e,r){return r()}enterWith(e){}},aar=new vG,l3e=Symbol.for("lc:child_config"),xme=class{getInstance(){return DE()??aar}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[l3e]}runWithConfig(e,r,n){let o=Bs._configureSync(e?.callbacks,void 0,e?.tags,void 0,e?.metadata),i=this.getInstance(),a=i.getStore(),s=o?.getParentRunId(),u=o?.handlers?.find(c=>c?.name==="langchain_tracer"),l;return u&&s?l=u.convertToRunTree(s):n||(l=new OC({name:"",tracingEnabled:!1})),l&&(l.extra={...l.extra,[l3e]:e}),a!==void 0&&a[xR]!==void 0&&(l===void 0&&(l={}),l[xR]=a[xR]),i.run(l,r)}initializeGlobalInstance(e){DE()===void 0&&r3e(e)}},jd=new xme});var ZL=w(()=>{c3e();N2()});async function _p(t){return Bs._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function SG(...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(L2(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(L2(s),!0);e.callbacks=a}else e.callbacks=new Bs(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 un(t){let e=jd.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))sar.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 us(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=un(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 bm(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 wG,sar,Hb=w(()=>{LE();ZL();wG=25;sar=new Set(["string","number","boolean"])});async function Vb(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 Cme=w(()=>{});function Ome(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 Hl(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]=Hl(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function d3e(t,e,r,n,...o){let i=new AC({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var Nd,AC,Wb=w(()=>{Hb();ZL();Cme();Nd=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)}})}};AC=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)=>{jd.runWithConfig(bm(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?jd.runWithConfig(bm(this.config),this.signal?async()=>Vb(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 f3e(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 p3e(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 uar(t){return t!==void 0&&t.message!==void 0}var py,F2,m3e,k2,h3e=w(()=>{Xpe();vR();Wb();SR();py=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=AE({},r);return new F2({ops:r,state:n[n.length-1].newDocument})}},F2=class t extends py{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=AE(this.state,e.ops);return new t({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=AE({},e.ops);return new t({ops:e.ops,state:r[r.length-1].newDocument})}},m3e=t=>t.name==="log_stream_tracer";k2=class extends xh{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=Nd.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 py({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 py({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 f3e(e,this._schemaFormat)),await this.writer.write(new py({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 f3e(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await p3e(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 py({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new py({ops:[{op:"replace",path:"/final_output",value:await p3e(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?uar(n?.chunk)?a=n?.chunk:a=new dr({id:`run-${e.id}`,content:r}):a=r;let s=new py({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 $2,vp,qn,XL=w(()=>{$2="__run",vp=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}})}},qn=class t extends vp{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 xG({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 g3e,CG,y3e=w(()=>{vR();Wb();SR();XL();g3e=t=>t.name==="event_stream_tracer",CG=class extends xh{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=Nd.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 vp({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=xG(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 dr({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 vp({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=xG(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=xG(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=xG(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 b3e,OG,lar,car,_m,QL=w(()=>{b3e=F(EK(),1),OG=F(DK(),1),lar=[400,401,402,403,404,405,406,407,409],car=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&&lar.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},_m=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??car;let r="default"in OG.default?OG.default.default:OG.default;this.queue=new r({concurrency:this.maxConcurrency})}call(e,...r){return this.queue.add(()=>(0,b3e.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 B2,_3e=w(()=>{vR();B2=class extends xh{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 q2(t){return t?t.lc_runnable:!1}var PG,Pme=w(()=>{PG=class{constructor(e){Object.defineProperty(this,"includeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.includeNames=e.includeNames,this.includeTypes=e.includeTypes,this.includeTags=e.includeTags,this.excludeNames=e.excludeNames,this.excludeTypes=e.excludeTypes,this.excludeTags=e.excludeTags}includeEvent(e,r){let n=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,o=e.tags??[];return this.includeNames!==void 0&&(n=n||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(r)),this.includeTags!==void 0&&(n=n||o.some(i=>this.includeTags?.includes(i))),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(r)),this.excludeTags!==void 0&&(n=n&&o.every(i=>!this.excludeTags?.includes(i))),n}}});var w3e,v3e,S3e,EG=w(()=>{w3e=Symbol("Let zodToJsonSchema decide on which parser to use"),v3e={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"},S3e=t=>typeof t=="string"?{...v3e,name:t}:{...v3e,...t}});var x3e,Eme=w(()=>{EG();x3e=t=>{let e=S3e(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 Tme(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Un(t,e,r,n,o){t[e]=r,Tme(t,e,n,o)}var FE=w(()=>{});function C3e(){return{}}var Ame=w(()=>{});function O3e(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==de.ZodAny&&(r.items=fr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Un(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Un(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Un(r,"minItems",t.exactLength.value,t.exactLength.message,e),Un(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var Ime=w(()=>{Td();FE();qs()});function P3e(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?Un(r,"minimum",n.value,n.message,e):Un(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Un(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Un(r,"maximum",n.value,n.message,e):Un(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Un(r,"maximum",n.value,n.message,e));break;case"multipleOf":Un(r,"multipleOf",n.value,n.message,e);break}return r}var Mme=w(()=>{FE()});function E3e(){return{type:"boolean"}}var Rme=w(()=>{});function TG(t,e){return fr(t.type._def,e)}var AG=w(()=>{qs()});var T3e,jme=w(()=>{qs();T3e=(t,e)=>fr(t.innerType._def,e)});function Nme(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>Nme(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 dar(t,e)}}var dar,Dme=w(()=>{FE();dar=(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":Un(r,"minimum",n.value,n.message,e);break;case"max":Un(r,"maximum",n.value,n.message,e);break}return r}});function A3e(t,e){return{...fr(t.innerType._def,e),default:t.defaultValue()}}var Lme=w(()=>{qs()});function I3e(t,e){return e.effectStrategy==="input"?fr(t.schema._def,e):{}}var Fme=w(()=>{qs()});function M3e(t){return{type:"string",enum:Array.from(t.values)}}var kme=w(()=>{});function R3e(t,e){let r=[fr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),fr(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(far(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 far,$me=w(()=>{qs();far=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function j3e(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 Bme=w(()=>{});function IG(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":Un(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":Un(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":hy(r,"email",n.message,e);break;case"format:idn-email":hy(r,"idn-email",n.message,e);break;case"pattern:zod":jf(r,my.email,n.message,e);break}break;case"url":hy(r,"uri",n.message,e);break;case"uuid":hy(r,"uuid",n.message,e);break;case"regex":jf(r,n.regex,n.message,e);break;case"cuid":jf(r,my.cuid,n.message,e);break;case"cuid2":jf(r,my.cuid2,n.message,e);break;case"startsWith":jf(r,RegExp(`^${Ume(n.value,e)}`),n.message,e);break;case"endsWith":jf(r,RegExp(`${Ume(n.value,e)}$`),n.message,e);break;case"datetime":hy(r,"date-time",n.message,e);break;case"date":hy(r,"date",n.message,e);break;case"time":hy(r,"time",n.message,e);break;case"duration":hy(r,"duration",n.message,e);break;case"length":Un(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),Un(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{jf(r,RegExp(Ume(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&hy(r,"ipv4",n.message,e),n.version!=="v4"&&hy(r,"ipv6",n.message,e);break}case"base64url":jf(r,my.base64url,n.message,e);break;case"jwt":jf(r,my.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&jf(r,my.ipv4Cidr,n.message,e),n.version!=="v4"&&jf(r,my.ipv6Cidr,n.message,e);break}case"emoji":jf(r,my.emoji(),n.message,e);break;case"ulid":{jf(r,my.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{hy(r,"binary",n.message,e);break}case"contentEncoding:base64":{Un(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{jf(r,my.base64,n.message,e);break}}break}case"nanoid":jf(r,my.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Ume(t,e){return e.patternStrategy==="escape"?mar(t):t}function mar(t){let e="";for(let r=0;ro.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}}})):Un(t,"format",e,r,n)}function jf(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:N3e(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Un(t,"pattern",N3e(e,n),r,n)}function N3e(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{FE();my={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:()=>(kme===void 0&&(kme=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),kme),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-_]*$/};uar=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function MG(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===de.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:fr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:fr(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===de.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=AG(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===de.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===de.ZodBranded&&t.keyType._def.type._def.typeName===de.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=EG(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var RG=w(()=>{Td();qs();IG();TG()});function j3e(t,e){if(e.mapStrategy==="record")return MG(t,e);let r=fr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=fr(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 Bme=w(()=>{qs();RG()});function N3e(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 qme=w(()=>{});function D3e(){return{not:{}}}var Ume=w(()=>{});function L3e(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var zme=w(()=>{});function k3e(t,e){if(e.target==="openApi3")return F3e(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in q2&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=q2[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 F3e(t,e)}var q2,F3e,jG=w(()=>{qs();q2={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};F3e=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>fr(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 $3e(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:q2[t.innerType._def.typeName],nullable:!0}:{type:[q2[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=fr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=fr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var Hme=w(()=>{qs();jG()});function B3e(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",Ome(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Un(r,"minimum",n.value,n.message,e):Un(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Un(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Un(r,"maximum",n.value,n.message,e):Un(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Un(r,"maximum",n.value,n.message,e));break;case"multipleOf":Un(r,"multipleOf",n.value,n.message,e);break}return r}var Vme=w(()=>{FE()});function car(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":fr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":fr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function q3e(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 dp&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=fr(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:car(t,e)};return n.required.length||delete n.required,n}var Wme=w(()=>{Td();qs()});var U3e,Kme=w(()=>{qs();U3e=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return fr(t.innerType._def,e);let r=fr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var z3e,Gme=w(()=>{qs();z3e=(t,e)=>{if(e.pipeStrategy==="input")return fr(t.in._def,e);if(e.pipeStrategy==="output")return fr(t.out._def,e);let r=fr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=fr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function H3e(t,e){return fr(t.type._def,e)}var Jme=w(()=>{qs()});function V3e(t,e){let n={type:"array",uniqueItems:!0,items:fr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Un(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Un(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var Yme=w(()=>{FE();qs()});function W3e(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>fr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:fr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>fr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var Zme=w(()=>{qs()});function K3e(){return{not:{}}}var Xme=w(()=>{});function G3e(){return{}}var Qme=w(()=>{});var J3e,ehe=w(()=>{qs();J3e=(t,e)=>fr(t.innerType._def,e)});function fr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==_3e)return a}if(n&&!r){let a=dar(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=par(t,t.typeName,e);return i&&mar(t,e,i),o.jsonSchema=i,i}var dar,far,par,mar,qs=w(()=>{Td();Pme();Eme();Tme();Ame();TG();Ime();Rme();jme();Nme();Dme();Lme();Fme();Bme();qme();Ume();zme();Hme();Vme();Wme();Kme();Gme();Jme();RG();Yme();IG();Zme();Xme();jG();Qme();ehe();PG();dar=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:far(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},far=(t,e)=>{let r=0;for(;r{switch(e){case de.ZodString:return AG(t,r);case de.ZodNumber:return B3e(t,r);case de.ZodObject:return q3e(t,r);case de.ZodBigInt:return C3e(t,r);case de.ZodBoolean:return O3e();case de.ZodDate:return Mme(t,r);case de.ZodUndefined:return K3e();case de.ZodNull:return L3e(r);case de.ZodArray:return x3e(t,r);case de.ZodUnion:case de.ZodDiscriminatedUnion:return k3e(t,r);case de.ZodIntersection:return I3e(t,r);case de.ZodTuple:return W3e(t,r);case de.ZodRecord:return MG(t,r);case de.ZodLiteral:return M3e(t,r);case de.ZodEnum:return A3e(t);case de.ZodNativeEnum:return N3e(t);case de.ZodNullable:return $3e(t,r);case de.ZodOptional:return U3e(t,r);case de.ZodMap:return j3e(t,r);case de.ZodSet:return V3e(t,r);case de.ZodLazy:return fr(t.getter()._def,r);case de.ZodPromise:return H3e(t,r);case de.ZodNaN:case de.ZodNever:return D3e();case de.ZodEffects:return T3e(t,r);case de.ZodAny:return S3e();case de.ZodUnknown:return G3e();case de.ZodDefault:return E3e(t,r);case de.ZodBranded:return EG(t,r);case de.ZodReadonly:return J3e(t,r);case de.ZodCatch:return P3e(t,r);case de.ZodPipeline:return z3e(t,r);case de.ZodFunction:case de.ZodVoid:case de.ZodSymbol:return;default:return(n=>{})(e)}},mar=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var So,the=w(()=>{qs();Cme();So=(t,e)=>{let r=w3e(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:fr(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=fr(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 Ec=w(()=>{PG();Cme();FE();qs();Pme();Eme();Tme();Ame();TG();Ime();Rme();jme();Nme();Dme();Lme();Fme();Bme();qme();Ume();zme();Hme();Vme();Wme();Kme();Gme();Jme();ehe();RG();Yme();IG();Zme();Xme();jG();Qme();the();the()});function rhe(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function gar(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n}; -`;return e}function Y3e(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}'}}}%% +]`;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 qme,my,par,MG=w(()=>{FE();my={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:()=>(qme===void 0&&(qme=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),qme),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-_]*$/};par=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function RG(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===de.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:fr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:fr(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===de.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=IG(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===de.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===de.ZodBranded&&t.keyType._def.type._def.typeName===de.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=TG(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var jG=w(()=>{Td();qs();MG();AG()});function D3e(t,e){if(e.mapStrategy==="record")return RG(t,e);let r=fr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=fr(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 zme=w(()=>{qs();jG()});function L3e(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 Hme=w(()=>{});function F3e(){return{not:{}}}var Vme=w(()=>{});function k3e(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Wme=w(()=>{});function B3e(t,e){if(e.target==="openApi3")return $3e(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in U2&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=U2[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 $3e(t,e)}var U2,$3e,NG=w(()=>{qs();U2={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};$3e=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>fr(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 q3e(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:U2[t.innerType._def.typeName],nullable:!0}:{type:[U2[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=fr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=fr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var Kme=w(()=>{qs();NG()});function U3e(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",Tme(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Un(r,"minimum",n.value,n.message,e):Un(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Un(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Un(r,"maximum",n.value,n.message,e):Un(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Un(r,"maximum",n.value,n.message,e));break;case"multipleOf":Un(r,"multipleOf",n.value,n.message,e);break}return r}var Gme=w(()=>{FE()});function har(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":fr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":fr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function z3e(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 dp&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=fr(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:har(t,e)};return n.required.length||delete n.required,n}var Jme=w(()=>{Td();qs()});var H3e,Yme=w(()=>{qs();H3e=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return fr(t.innerType._def,e);let r=fr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var V3e,Zme=w(()=>{qs();V3e=(t,e)=>{if(e.pipeStrategy==="input")return fr(t.in._def,e);if(e.pipeStrategy==="output")return fr(t.out._def,e);let r=fr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=fr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function W3e(t,e){return fr(t.type._def,e)}var Xme=w(()=>{qs()});function K3e(t,e){let n={type:"array",uniqueItems:!0,items:fr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Un(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Un(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var Qme=w(()=>{FE();qs()});function G3e(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>fr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:fr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>fr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var ehe=w(()=>{qs()});function J3e(){return{not:{}}}var the=w(()=>{});function Y3e(){return{}}var rhe=w(()=>{});var Z3e,nhe=w(()=>{qs();Z3e=(t,e)=>fr(t.innerType._def,e)});function fr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==w3e)return a}if(n&&!r){let a=gar(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=bar(t,t.typeName,e);return i&&_ar(t,e,i),o.jsonSchema=i,i}var gar,yar,bar,_ar,qs=w(()=>{Td();Ame();Ime();Mme();Rme();AG();jme();Dme();Lme();Fme();kme();$me();Bme();zme();Hme();Vme();Wme();Kme();Gme();Jme();Yme();Zme();Xme();jG();Qme();MG();ehe();the();NG();rhe();nhe();EG();gar=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:yar(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},yar=(t,e)=>{let r=0;for(;r{switch(e){case de.ZodString:return IG(t,r);case de.ZodNumber:return U3e(t,r);case de.ZodObject:return z3e(t,r);case de.ZodBigInt:return P3e(t,r);case de.ZodBoolean:return E3e();case de.ZodDate:return Nme(t,r);case de.ZodUndefined:return J3e();case de.ZodNull:return k3e(r);case de.ZodArray:return O3e(t,r);case de.ZodUnion:case de.ZodDiscriminatedUnion:return B3e(t,r);case de.ZodIntersection:return R3e(t,r);case de.ZodTuple:return G3e(t,r);case de.ZodRecord:return RG(t,r);case de.ZodLiteral:return j3e(t,r);case de.ZodEnum:return M3e(t);case de.ZodNativeEnum:return L3e(t);case de.ZodNullable:return q3e(t,r);case de.ZodOptional:return H3e(t,r);case de.ZodMap:return D3e(t,r);case de.ZodSet:return K3e(t,r);case de.ZodLazy:return fr(t.getter()._def,r);case de.ZodPromise:return W3e(t,r);case de.ZodNaN:case de.ZodNever:return F3e();case de.ZodEffects:return I3e(t,r);case de.ZodAny:return C3e();case de.ZodUnknown:return Y3e();case de.ZodDefault:return A3e(t,r);case de.ZodBranded:return TG(t,r);case de.ZodReadonly:return Z3e(t,r);case de.ZodCatch:return T3e(t,r);case de.ZodPipeline:return V3e(t,r);case de.ZodFunction:case de.ZodVoid:case de.ZodSymbol:return;default:return(n=>{})(e)}},_ar=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var So,ohe=w(()=>{qs();Eme();So=(t,e)=>{let r=x3e(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:fr(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=fr(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 Ec=w(()=>{EG();Eme();FE();qs();Ame();Ime();Mme();Rme();AG();jme();Dme();Lme();Fme();kme();$me();Bme();zme();Hme();Vme();Wme();Kme();Gme();Jme();Yme();Zme();Xme();nhe();jG();Qme();MG();ehe();the();NG();rhe();ohe();ohe()});function ihe(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function Sar(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n}; +`;return e}function X3e(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:a=!0,curveStyle:s="linear",wrapLabelNWords:u=9}=r??{},l=a?`%%{init: {'flowchart': {'curve': '${s}'}}}%% graph TD; `:`graph TD; -`;if(a){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,b]of Object.entries(t)){let g=b.name.split(":").pop()??"",S=har.some(O=>g.startsWith(O)&&g.endsWith(O))?`

${g}

`:g;Object.keys(b.metadata??{}).length&&(S+=`
${Object.entries(b.metadata??{}).map(([O,P])=>`${O} = ${P}`).join(` -`)}`);let x=(m[h]??m[p]).replace("{0}",rhe(h)).replace("{1}",S);l+=` ${x} +`;if(a){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,b]of Object.entries(t)){let g=b.name.split(":").pop()??"",S=war.some(O=>g.startsWith(O)&&g.endsWith(O))?`

${g}

`:g;Object.keys(b.metadata??{}).length&&(S+=`
${Object.entries(b.metadata??{}).map(([O,P])=>`${O} = ${P}`).join(` +`)}`);let x=(m[h]??m[p]).replace("{0}",ihe(h)).replace("{1}",S);l+=` ${x} `}}let c={};for(let p of e){let m=p.source.split(":"),h=p.target.split(":"),b=m.filter((g,y)=>g===h[y]).join(":");c[b]||(c[b]=[]),c[b].push(p)}let d=new Set;function f(p,m){let h=p.length===1&&p[0].source===p[0].target;if(m&&!h){let b=m.split(":").pop();if(d.has(b))throw new Error(`Found duplicate subgraph '${b}' -- 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(b),l+=` subgraph ${b} -`}for(let b of p){let{source:g,target:y,data:S,conditional:x}=b,O="";if(S!==void 0){let P=S,E=P.split(" ");E.length>u&&(P=Array.from({length:Math.ceil(E.length/u)},(A,I)=>E.slice(I*u,(I+1)*u).join(" ")).join(" 
 ")),O=x?` -.  ${P}  .-> `:` --  ${P}  --> `}else O=x?" -.-> ":" --> ";l+=` ${rhe(g)}${O}${rhe(y)}; +`}for(let b of p){let{source:g,target:y,data:S,conditional:x}=b,O="";if(S!==void 0){let P=S,E=P.split(" ");E.length>u&&(P=Array.from({length:Math.ceil(E.length/u)},(A,I)=>E.slice(I*u,(I+1)*u).join(" ")).join(" 
 ")),O=x?` -.  ${P}  .-> `:` --  ${P}  --> `}else O=x?" -.-> ":" --> ";l+=` ${ihe(g)}${O}${ihe(y)}; `}for(let b in c)b.startsWith(`${m}:`)&&b!==m&&f(c[b],b);m&&!h&&(l+=` end -`)}f(c[""]??[],"");for(let p in c)!p.includes(":")&&p!==""&&f(c[p],p);return a&&(l+=gar(i??{})),l}async function Z3e(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 har,X3e=w(()=>{har=["*","_","`"]});function yar(t,e){if(t!==void 0&&!EE(t))return t;if(B2(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 bar(t){return B2(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...So(t.data.schema),title:t.data.name}}}function Q3e(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 eHe(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 U2,tHe=w(()=>{Ec();TE();xme();X3e();U2=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]=EE(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...bar(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:yar(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 Q3e(this)}lastNode(){return eHe(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(EE)&&(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&&Q3e(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&eHe(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 EE(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 Y3e(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 Z3e(r,{backgroundColor:e?.backgroundColor})}}});function rHe(t){let e=new TextEncoder,r=new ReadableStream({async start(n){for await(let o of t)n.enqueue(e.encode(`event: data +`)}f(c[""]??[],"");for(let p in c)!p.includes(":")&&p!==""&&f(c[p],p);return a&&(l+=Sar(i??{})),l}async function Q3e(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 war,eHe=w(()=>{war=["*","_","`"]});function xar(t,e){if(t!==void 0&&!EE(t))return t;if(q2(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 Car(t){return q2(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...So(t.data.schema),title:t.data.name}}}function tHe(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 rHe(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 z2,nHe=w(()=>{Ec();TE();Pme();eHe();z2=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]=EE(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...Car(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:xar(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 tHe(this)}lastNode(){return rHe(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(EE)&&(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&&tHe(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&rHe(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 EE(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 X3e(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 Q3e(r,{backgroundColor:e?.backgroundColor})}}});function oHe(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 Nd.fromReadableStream(r)}var nHe=w(()=>{Wb()});function nhe(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function NG(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*ohe(t,e){for(;;){let{value:r,done:n}=jd.runWithConfig(bm(t),e.next.bind(e),!0);if(n)break;yield r}}async function*DG(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await jd.runWithConfig(bm(t),r.next.bind(e),!0);if(o)break;yield n}}var oHe,iHe=w(()=>{YL();Hb();oHe=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function xl(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function _ar(t){if(nG(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function AC(t){if(typeof t=="function")return new Nf({func:t});if(xn.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=AC(n);return new kE({steps:e})}else throw new Error(`Expected a Runnable, function or object. -Instead got an unsupported type.`)}function war(t,e){let r=e.name??t.getName(),n=e.description??e.schema?.description;return e.schema.constructor===Wr.ZodString?new z2({name:r,description:n,schema:Wr.object({input:Wr.string()}).transform(o=>o.input),bound:t}):new z2({name:r,description:n,schema:e.schema,bound:t})}var ihe,xn,IC,LG,FG,bi,kE,ahe,Nf,kG,QL,$G,z2,Df=w(()=>{Td();ihe=F(PK(),1);TE();Kpe();p3e();h3e();yR();Wb();wme();Hb();XL();y3e();xme();YL();tHe();nHe();iHe();pG();xn=class extends gp{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 IC({bound:this,kwargs:e,config:{}})}map(){return new LG({bound:this})}withRetry(e){return new FG({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new IC({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new kG({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(un);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)=>un(i===0?e:n))}return Array.from({length:r},()=>un(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new _m({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=un(r),o=new TC({generator:this._streamIterator(e,n),config:n});return await o.setup,Nd.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=un(e):r=un({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=un(n),a=await(await _p(o))?.handleChainStart(this.toJSON(),xl(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 Vb(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(xl(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(_p)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),xl(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 Vb(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(xl(u,"output")))),u}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=un(n),l=await _p(u);async function*c(){for await(let f of e){if(i)if(o===void 0)o=f;else try{o=Hl(o,f)}catch{o=void 0,i=!1}yield f}}let d;try{let f=await l3e(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(m3e),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(f3e);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let b of m)if(yield b,s)if(a===void 0)a=b;else try{a=Hl(a,b)}catch{a=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:xl(o,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:xl(o,"input")})}getGraph(e){let r=new U2,n=r.addNode({name:`${this.getName()}Input`,schema:Wr.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:Wr.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(e){return new bi({first:this,last:AC(e)})}pick(e){return this.pipe(new $G(e))}assign(e){return this.pipe(new QL(new kE({steps:e})))}async*transform(e,r){let n;for await(let o of e)n===void 0?n=o:n=Hl(n,o);yield*this._streamIterator(n,un(r))}async*streamLog(e,r,n){let o=new F2({...n,autoClose:!1,_schemaFormat:"original"}),i=un(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 py({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"?rHe(o):Nd.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new xG({...n,autoClose:!1}),i=un(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 m=s.copy();m.addHandler(o,!0),i.callbacks=m}let u=new AbortController,l=this;async function c(){try{let m;r?.signal?"any"in AbortSignal?m=AbortSignal.any([u.signal,r.signal]):(m=r.signal,r.signal.addEventListener("abort",()=>{u.abort()},{once:!0})):m=u.signal;let h=await l.stream(e,{...i,signal:m}),b=o.tapOutputIterable(a,h);for await(let g of b)if(u.signal.aborted)break}finally{await o.finish()}}let d=c(),f=!1,p;try{for await(let m of o){if(!f){m.data.input=e,f=!0,p=m.run_id,yield m;continue}m.run_id===p&&m.event.endsWith("_end")&&m.data?.input&&delete m.data.input,yield m}}finally{u.abort(),await d}}async*_streamEventsV1(e,r,n){let o,i=!1,a=un(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new F2({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new OG({...n}),f=this._streamLog(e,c,a);for await(let m of f){if(o?o=o.concat(m):o=L2.fromRunLogPatch(m),o.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!i){i=!0;let y={...o.state},S={run_id:y.id,event:`on_${y.type}_start`,name:l,tags:s,metadata:u,data:{input:e}};d.includeEvent(S,y.type)&&(yield S)}let h=m.ops.filter(y=>y.path.startsWith("/logs/")).map(y=>y.path.split("/")[2]),b=[...new Set(h)];for(let y of b){let S,x={},O=o.state.logs[y];if(O.end_time===void 0?O.streamed_output.length>0?S="stream":S="start":S="end",S==="start")O.inputs!==void 0&&(x.input=O.inputs);else if(S==="end")O.inputs!==void 0&&(x.input=O.inputs),x.output=O.final_output;else if(S==="stream"){let P=O.streamed_output.length;if(P!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${P} instead. Encountered in: "${O.name}"`);x={chunk:O.streamed_output[0]},O.streamed_output=[]}yield{event:`on_${O.type}_${S}`,name:O.name,run_id:O.id,tags:O.tags,metadata:O.metadata,data:x}}let{state:g}=o;if(g.streamed_output.length>0){let y=g.streamed_output.length;if(y!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${y} instead. Encountered in: "${g.name}"`);let S={chunk:g.streamed_output[0]};g.streamed_output=[];let x={event:`on_${g.type}_stream`,run_id:g.id,tags:s,metadata:u,name:l,data:S};d.includeEvent(x,g.type)&&(yield x)}}let p=o?.state;if(p!==void 0){let m={event:`on_${p.type}_end`,name:l,run_id:p.id,tags:s,metadata:u,data:{output:p.final_output}};d.includeEvent(m,p.type)&&(yield m)}}static isRunnable(e){return B2(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new IC({bound:this,config:{},configFactories:[o=>({callbacks:[new $2({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return war(this,e)}},IC=class t extends xn{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=wG(this.config,...e);return wG(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}bind(e){return new this.constructor({bound:this.bound,kwargs:{...this.kwargs,...e},config:this.config})}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new this.constructor({bound:this.bound.withRetry(e),kwargs:this.kwargs,config:this.config})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(un(r),this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(un(i),this.kwargs))):await this._mergeConfig(un(r),this.kwargs);return this.bound.batch(e,o,n)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(un(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(un(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(un(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(un(r),o.kwargs),version:r.version},n)};return Nd.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&xn.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 $2({config:o,onStart:e,onEnd:r,onError:n})]})]})}},LG=class t extends xn{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,us(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new t({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},FG=class extends IC{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 us(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return(0,ihe.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,ihe.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;fthis.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)}},bi=class t extends xn{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=un(r),i=await(await _p(n))?.handleChainStart(this.toJSON(),xl(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{let c=await u?.handleChainStart(this.toJSON(),xl(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{let p=d?.getChild(this.omitSequenceTags?void 0:`seq:step:${u+1}`);return us(o[f],{callbacks:p})}),n);s=await Vb(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(xl(s,"output")))),s}async*_streamIterator(e,r){let n=await _p(r),{runId:o,...i}=r??{},a=await n?.handleChainStart(this.toJSON(),xl(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(),us(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f{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:AC(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&xn.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:AC(e),middle:r.slice(0,-1).map(AC),last:AC(r[r.length-1])})}},kE=class t extends xn{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]=AC(n)}static from(e){return new t({steps:e})}async invoke(e,r){let n=un(r),i=await(await _p(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,us(n,{callbacks:i?.getChild(`map:key:${u}`)}))});await Vb(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=Sme(e,Object.keys(o).length),a=new Map(Object.entries(o).map(([s,u],l)=>{let c=u.transform(i[l],us(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 Vb(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=un(r),i=new TC({generator:this.transform(n(),o),config:o});return await i.setup,Nd.fromAsyncGenerator(i)}},ahe=class t extends xn{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}),!nG(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 _p(n),i=this.func(us(n,{callbacks:o}),e);return Vb(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(NG(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(oHe(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})}};Nf=class t extends xn{static lc_name(){return"RunnableLambda"}constructor(e){if(nG(e.func))return ahe.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}),_ar(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=us(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??vG)-1});jd.runWithConfig(bm(a),async()=>{try{let s=await this.func(e,{...a});if(s&&xn.isRunnable(s)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");s=await s.invoke(e,{...a,recursionLimit:(a.recursionLimit??vG)-1})}else if(NG(s)){let u;for await(let l of DG(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=Hl(u,l)}catch{u=l}s=u}else if(nhe(s)){let u;for(let l of ohe(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=Hl(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=Hl(o,s)}catch{o=s}let i=us(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??vG)-1}),a=await new Promise((s,u)=>{jd.runWithConfig(bm(i),async()=>{try{let l=await this.func(o,{...i,config:i});s(l)}catch(l){u(l)}})});if(a&&xn.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(NG(a))for await(let s of DG(i,a))n?.signal?.throwIfAborted(),yield s;else if(nhe(a))for(let s of ohe(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=un(r),i=new TC({generator:this.transform(n(),o),config:o});return await i.setup,Nd.fromAsyncGenerator(i)}},kG=class extends xn{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=un(r),o=await _p(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),xl(e,"input"),i,void 0,void 0,void 0,a?.runName),u=us(a,{callbacks:s?.getChild()});return await jd.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(xl(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=un(r),o=await _p(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),xl(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=us(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=DG(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:Hl(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(xl(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=>_p(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),xl(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)=>us(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(xl(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.")}};QL=class extends xn{static lc_name(){return"RunnableAssign"}constructor(e){e instanceof kE&&(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]=Sme(e),s=this.mapper.transform(a,us(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=un(r),i=new TC({generator:this.transform(n(),o),config:o});return await i.setup,Nd.fromAsyncGenerator(i)}},$G=class extends xn{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=un(r),i=new TC({generator:this.transform(n(),o),config:o});return await i.setup,Nd.fromAsyncGenerator(i)}},z2=class extends IC{constructor(e){let r=bi.from([Nf.from(async n=>{let o;if(RE(n))try{o=await this.schema.parseAsync(n.args)}catch{throw new wR("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 go,BG=w(()=>{Wb();Df();Hb();go=class extends xn{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=un(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=un(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=Hl(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new QL(new kE({steps:e}))}}});var aHe=w(()=>{Df();Hb()});var sHe=w(()=>{Df();Hb();Wb()});var she=w(()=>{Eh()});var uHe=w(()=>{Df();SR();Eh();mG();hG();R2();she();gG();KL();NE()});var OR=w(()=>{SR();Eh();mG();hG();R2();gG();NE();uHe();she();sme();KL()});var lHe=w(()=>{OR();Df();BG()});var uhe=w(()=>{Df();Hb();BG();aHe();sHe();lHe()});var PR,ER,vm,eF=w(()=>{uhe();I2();PR=class extends xn{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"})}},ER=class extends PR{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")}},vm=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");ME(this,"OUTPUT_PARSING_FAILURE")}}});function MC(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{});function wm(t){return encodeURI(Sar(t))}function Sar(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var qG=w(()=>{});function RC(t,e=Object.create(null),r=Par,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:RC(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(Oar[i])continue;let a=`${n}/${wm(i)}`,s=t[i];if(Array.isArray(s)){if(xar[i]){let u=s.length;for(let l=0;l{qG();xar={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Car={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Oar={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},Par=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 wp(t){return t.test.bind(t)}function Kar(t){return t%4===0&&(t%100!==0||t%400===0)}function cHe(t){let e=t.match(Ear);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&Kar(r)?29:Tar[n])}function dHe(t,e){let r=e.match(Aar);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 Jar(t){let e=t.split(Gar);return e.length==2&&cHe(e[0])&&dHe(!0,e[1])}function Xar(t){return Yar.test(t)&&Zar.test(t)}function esr(t){if(Qar.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var Ear,Tar,Aar,Iar,Mar,Rar,jar,Nar,Dar,Lar,Far,kar,$ar,Bar,qar,Uar,zar,Har,Var,War,che,Gar,Yar,Zar,Qar,dhe=w(()=>{Ear=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Tar=[0,31,28,31,30,31,30,31,31,30,31,30,31],Aar=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Iar=/^(?=.{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,Mar=/^(?:[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,Rar=/^(?:(?:[^\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,jar=/^(?:(?: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,Nar=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Dar=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Lar=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Far=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,kar=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,$ar=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Bar=/^\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,qar=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,Uar=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))},zar=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Har=/^((([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,Var=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));War={date:cHe,time:dHe.bind(void 0,!1),"date-time":Jar,duration:Var,uri:Xar,"uri-reference":wp(Mar),"uri-template":wp(Rar),url:wp(jar),email:Uar,hostname:wp(Iar),ipv4:wp(zar),ipv6:wp(Har),regex:esr,uuid:wp(Nar),"json-pointer":wp(Dar),"json-pointer-uri-fragment":wp(Lar),"relative-json-pointer":wp(Far)},che={...War,date:wp(kar),time:wp($ar),"date-time":wp(Bar),"uri-reference":wp(qar)};Gar=/t|\s/i;Yar=/\/|:/,Zar=/^(?:[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;Qar=/[^\\]\\Z/});var fHe,pHe=w(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(fHe||(fHe={}))});function mHe(t){let e=0,r=t.length,n=0,o;for(;n=55296&&o<=56319&&n{});function oa(t,e,r="2019-09",n=RC(e),o=!0,i=null,a="#",s="#",u=Object.create(null)){if(e===!0)return{valid:!0,errors:[]};if(e===!1)return{valid:!1,errors:[{instanceLocation:a,keyword:"false",keywordLocation:a,error:"False boolean schema."}]};let l=typeof t,c;switch(l){case"boolean":case"number":case"string":c=l;break;case"object":t===null?c="null":Array.isArray(t)?c="array":c="object";break;default:throw new Error(`Instances of "${l}" type are not supported.`)}let{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:b,required:g,not:y,anyOf:S,allOf:x,oneOf:O,if:P,then:E,else:A,format:I,properties:R,patternProperties:N,additionalProperties:j,unevaluatedProperties:$,minProperties:k,maxProperties:z,propertyNames:V,dependentRequired:Q,dependentSchemas:J,dependencies:D,prefixItems:B,items:q,additionalItems:K,unevaluatedItems:H,contains:ee,minContains:U,maxContains:W,minItems:Y,maxItems:ae,uniqueItems:Oe,minimum:le,maximum:Be,exclusiveMinimum:ze,exclusiveMaximum:rt,multipleOf:cr,minLength:wn,maxLength:Le,pattern:pt,__absolute_ref__:mt,__absolute_recursive_ref__:ht}=e,te=[];if(p===!0&&i===null&&(i=e),f==="#"){let Re=i===null?n[ht]:i,Pe=`${s}/$recursiveRef`,oe=oa(t,i===null?e:i,r,n,o,Re,a,Pe,u);oe.valid||te.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:Pe,error:"A subschema had errors."},...oe.errors)}if(d!==void 0){let Pe=n[mt||d];if(Pe===void 0){let ce=`Unresolved $ref "${d}".`;throw mt&&mt!==d&&(ce+=` Absolute URI "${mt}".`),ce+=` +`)),n.close()}});return Nd.fromReadableStream(r)}var iHe=w(()=>{Wb()});function ahe(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function DG(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*she(t,e){for(;;){let{value:r,done:n}=jd.runWithConfig(bm(t),e.next.bind(e),!0);if(n)break;yield r}}async function*LG(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await jd.runWithConfig(bm(t),r.next.bind(e),!0);if(o)break;yield n}}var aHe,sHe=w(()=>{ZL();Hb();aHe=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function xl(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function Oar(t){if(oG(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function IC(t){if(typeof t=="function")return new Nf({func:t});if(Cn.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=IC(n);return new kE({steps:e})}else throw new Error(`Expected a Runnable, function or object. +Instead got an unsupported type.`)}function Par(t,e){let r=e.name??t.getName(),n=e.description??e.schema?.description;return e.schema.constructor===Wr.ZodString?new H2({name:r,description:n,schema:Wr.object({input:Wr.string()}).transform(o=>o.input),bound:t}):new H2({name:r,description:n,schema:e.schema,bound:t})}var uhe,Cn,MC,FG,kG,bi,kE,lhe,Nf,$G,eF,BG,H2,Df=w(()=>{Td();uhe=F(EK(),1);TE();Ype();h3e();y3e();yR();Wb();Cme();Hb();QL();_3e();Pme();ZL();nHe();iHe();sHe();mG();Cn=class extends gp{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 MC({bound:this,kwargs:e,config:{}})}map(){return new FG({bound:this})}withRetry(e){return new kG({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new MC({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new $G({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(un);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)=>un(i===0?e:n))}return Array.from({length:r},()=>un(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new _m({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=un(r),o=new AC({generator:this._streamIterator(e,n),config:n});return await o.setup,Nd.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=un(e):r=un({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=un(n),a=await(await _p(o))?.handleChainStart(this.toJSON(),xl(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 Vb(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(xl(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(_p)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),xl(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 Vb(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(xl(u,"output")))),u}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=un(n),l=await _p(u);async function*c(){for await(let f of e){if(i)if(o===void 0)o=f;else try{o=Hl(o,f)}catch{o=void 0,i=!1}yield f}}let d;try{let f=await d3e(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(g3e),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(m3e);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let b of m)if(yield b,s)if(a===void 0)a=b;else try{a=Hl(a,b)}catch{a=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:xl(o,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:xl(o,"input")})}getGraph(e){let r=new z2,n=r.addNode({name:`${this.getName()}Input`,schema:Wr.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:Wr.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(e){return new bi({first:this,last:IC(e)})}pick(e){return this.pipe(new BG(e))}assign(e){return this.pipe(new eF(new kE({steps:e})))}async*transform(e,r){let n;for await(let o of e)n===void 0?n=o:n=Hl(n,o);yield*this._streamIterator(n,un(r))}async*streamLog(e,r,n){let o=new k2({...n,autoClose:!1,_schemaFormat:"original"}),i=un(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 py({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"?oHe(o):Nd.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new CG({...n,autoClose:!1}),i=un(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 m=s.copy();m.addHandler(o,!0),i.callbacks=m}let u=new AbortController,l=this;async function c(){try{let m;r?.signal?"any"in AbortSignal?m=AbortSignal.any([u.signal,r.signal]):(m=r.signal,r.signal.addEventListener("abort",()=>{u.abort()},{once:!0})):m=u.signal;let h=await l.stream(e,{...i,signal:m}),b=o.tapOutputIterable(a,h);for await(let g of b)if(u.signal.aborted)break}finally{await o.finish()}}let d=c(),f=!1,p;try{for await(let m of o){if(!f){m.data.input=e,f=!0,p=m.run_id,yield m;continue}m.run_id===p&&m.event.endsWith("_end")&&m.data?.input&&delete m.data.input,yield m}}finally{u.abort(),await d}}async*_streamEventsV1(e,r,n){let o,i=!1,a=un(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new k2({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new PG({...n}),f=this._streamLog(e,c,a);for await(let m of f){if(o?o=o.concat(m):o=F2.fromRunLogPatch(m),o.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!i){i=!0;let y={...o.state},S={run_id:y.id,event:`on_${y.type}_start`,name:l,tags:s,metadata:u,data:{input:e}};d.includeEvent(S,y.type)&&(yield S)}let h=m.ops.filter(y=>y.path.startsWith("/logs/")).map(y=>y.path.split("/")[2]),b=[...new Set(h)];for(let y of b){let S,x={},O=o.state.logs[y];if(O.end_time===void 0?O.streamed_output.length>0?S="stream":S="start":S="end",S==="start")O.inputs!==void 0&&(x.input=O.inputs);else if(S==="end")O.inputs!==void 0&&(x.input=O.inputs),x.output=O.final_output;else if(S==="stream"){let P=O.streamed_output.length;if(P!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${P} instead. Encountered in: "${O.name}"`);x={chunk:O.streamed_output[0]},O.streamed_output=[]}yield{event:`on_${O.type}_${S}`,name:O.name,run_id:O.id,tags:O.tags,metadata:O.metadata,data:x}}let{state:g}=o;if(g.streamed_output.length>0){let y=g.streamed_output.length;if(y!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${y} instead. Encountered in: "${g.name}"`);let S={chunk:g.streamed_output[0]};g.streamed_output=[];let x={event:`on_${g.type}_stream`,run_id:g.id,tags:s,metadata:u,name:l,data:S};d.includeEvent(x,g.type)&&(yield x)}}let p=o?.state;if(p!==void 0){let m={event:`on_${p.type}_end`,name:l,run_id:p.id,tags:s,metadata:u,data:{output:p.final_output}};d.includeEvent(m,p.type)&&(yield m)}}static isRunnable(e){return q2(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new MC({bound:this,config:{},configFactories:[o=>({callbacks:[new B2({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return Par(this,e)}},MC=class t extends Cn{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=SG(this.config,...e);return SG(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}bind(e){return new this.constructor({bound:this.bound,kwargs:{...this.kwargs,...e},config:this.config})}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new this.constructor({bound:this.bound.withRetry(e),kwargs:this.kwargs,config:this.config})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(un(r),this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(un(i),this.kwargs))):await this._mergeConfig(un(r),this.kwargs);return this.bound.batch(e,o,n)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(un(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(un(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(un(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(un(r),o.kwargs),version:r.version},n)};return Nd.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&Cn.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 B2({config:o,onStart:e,onEnd:r,onError:n})]})]})}},FG=class t extends Cn{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,us(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new t({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},kG=class extends MC{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 us(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return(0,uhe.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,uhe.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;fthis.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)}},bi=class t extends Cn{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=un(r),i=await(await _p(n))?.handleChainStart(this.toJSON(),xl(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{let c=await u?.handleChainStart(this.toJSON(),xl(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{let p=d?.getChild(this.omitSequenceTags?void 0:`seq:step:${u+1}`);return us(o[f],{callbacks:p})}),n);s=await Vb(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(xl(s,"output")))),s}async*_streamIterator(e,r){let n=await _p(r),{runId:o,...i}=r??{},a=await n?.handleChainStart(this.toJSON(),xl(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(),us(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f{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:IC(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&Cn.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:IC(e),middle:r.slice(0,-1).map(IC),last:IC(r[r.length-1])})}},kE=class t extends Cn{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]=IC(n)}static from(e){return new t({steps:e})}async invoke(e,r){let n=un(r),i=await(await _p(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,us(n,{callbacks:i?.getChild(`map:key:${u}`)}))});await Vb(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=Ome(e,Object.keys(o).length),a=new Map(Object.entries(o).map(([s,u],l)=>{let c=u.transform(i[l],us(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 Vb(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=un(r),i=new AC({generator:this.transform(n(),o),config:o});return await i.setup,Nd.fromAsyncGenerator(i)}},lhe=class t extends Cn{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}),!oG(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 _p(n),i=this.func(us(n,{callbacks:o}),e);return Vb(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(DG(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(aHe(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})}};Nf=class t extends Cn{static lc_name(){return"RunnableLambda"}constructor(e){if(oG(e.func))return lhe.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}),Oar(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=us(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??wG)-1});jd.runWithConfig(bm(a),async()=>{try{let s=await this.func(e,{...a});if(s&&Cn.isRunnable(s)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");s=await s.invoke(e,{...a,recursionLimit:(a.recursionLimit??wG)-1})}else if(DG(s)){let u;for await(let l of LG(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=Hl(u,l)}catch{u=l}s=u}else if(ahe(s)){let u;for(let l of she(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=Hl(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=Hl(o,s)}catch{o=s}let i=us(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??wG)-1}),a=await new Promise((s,u)=>{jd.runWithConfig(bm(i),async()=>{try{let l=await this.func(o,{...i,config:i});s(l)}catch(l){u(l)}})});if(a&&Cn.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(DG(a))for await(let s of LG(i,a))n?.signal?.throwIfAborted(),yield s;else if(ahe(a))for(let s of she(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=un(r),i=new AC({generator:this.transform(n(),o),config:o});return await i.setup,Nd.fromAsyncGenerator(i)}},$G=class extends Cn{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=un(r),o=await _p(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),xl(e,"input"),i,void 0,void 0,void 0,a?.runName),u=us(a,{callbacks:s?.getChild()});return await jd.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(xl(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=un(r),o=await _p(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),xl(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=us(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=LG(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:Hl(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(xl(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=>_p(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),xl(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)=>us(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(xl(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.")}};eF=class extends Cn{static lc_name(){return"RunnableAssign"}constructor(e){e instanceof kE&&(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]=Ome(e),s=this.mapper.transform(a,us(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=un(r),i=new AC({generator:this.transform(n(),o),config:o});return await i.setup,Nd.fromAsyncGenerator(i)}},BG=class extends Cn{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=un(r),i=new AC({generator:this.transform(n(),o),config:o});return await i.setup,Nd.fromAsyncGenerator(i)}},H2=class extends MC{constructor(e){let r=bi.from([Nf.from(async n=>{let o;if(RE(n))try{o=await this.schema.parseAsync(n.args)}catch{throw new wR("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 go,qG=w(()=>{Wb();Df();Hb();go=class extends Cn{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=un(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=un(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=Hl(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new eF(new kE({steps:e}))}}});var uHe=w(()=>{Df();Hb()});var lHe=w(()=>{Df();Hb();Wb()});var che=w(()=>{Eh()});var cHe=w(()=>{Df();SR();Eh();hG();gG();j2();che();yG();GL();NE()});var OR=w(()=>{SR();Eh();hG();gG();j2();yG();NE();cHe();che();cme();GL()});var dHe=w(()=>{OR();Df();qG()});var dhe=w(()=>{Df();Hb();qG();uHe();lHe();dHe()});var PR,ER,vm,tF=w(()=>{dhe();M2();PR=class extends Cn{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"})}},ER=class extends PR{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")}},vm=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");ME(this,"OUTPUT_PARSING_FAILURE")}}});function RC(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{});function wm(t){return encodeURI(Ear(t))}function Ear(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var UG=w(()=>{});function jC(t,e=Object.create(null),r=Mar,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:jC(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(Iar[i])continue;let a=`${n}/${wm(i)}`,s=t[i];if(Array.isArray(s)){if(Tar[i]){let u=s.length;for(let l=0;l{UG();Tar={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Aar={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Iar={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},Mar=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 wp(t){return t.test.bind(t)}function Xar(t){return t%4===0&&(t%100!==0||t%400===0)}function fHe(t){let e=t.match(Rar);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&Xar(r)?29:jar[n])}function pHe(t,e){let r=e.match(Nar);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 esr(t){let e=t.split(Qar);return e.length==2&&fHe(e[0])&&pHe(!0,e[1])}function nsr(t){return tsr.test(t)&&rsr.test(t)}function isr(t){if(osr.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var Rar,jar,Nar,Dar,Lar,Far,kar,$ar,Bar,qar,Uar,zar,Har,Var,War,Kar,Gar,Jar,Yar,Zar,phe,Qar,tsr,rsr,osr,mhe=w(()=>{Rar=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,jar=[0,31,28,31,30,31,30,31,31,30,31,30,31],Nar=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Dar=/^(?=.{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,Lar=/^(?:[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,Far=/^(?:(?:[^\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,kar=/^(?:(?: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,$ar=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Bar=/^(?:\/(?:[^~/]|~0|~1)*)*$/,qar=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Uar=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,zar=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Har=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Var=/^\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,War=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,Kar=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))},Gar=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Jar=/^((([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,Yar=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));Zar={date:fHe,time:pHe.bind(void 0,!1),"date-time":esr,duration:Yar,uri:nsr,"uri-reference":wp(Lar),"uri-template":wp(Far),url:wp(kar),email:Kar,hostname:wp(Dar),ipv4:wp(Gar),ipv6:wp(Jar),regex:isr,uuid:wp($ar),"json-pointer":wp(Bar),"json-pointer-uri-fragment":wp(qar),"relative-json-pointer":wp(Uar)},phe={...Zar,date:wp(zar),time:wp(Har),"date-time":wp(Var),"uri-reference":wp(War)};Qar=/t|\s/i;tsr=/\/|:/,rsr=/^(?:[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;osr=/[^\\]\\Z/});var mHe,hHe=w(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(mHe||(mHe={}))});function gHe(t){let e=0,r=t.length,n=0,o;for(;n=55296&&o<=56319&&n{});function oa(t,e,r="2019-09",n=jC(e),o=!0,i=null,a="#",s="#",u=Object.create(null)){if(e===!0)return{valid:!0,errors:[]};if(e===!1)return{valid:!1,errors:[{instanceLocation:a,keyword:"false",keywordLocation:a,error:"False boolean schema."}]};let l=typeof t,c;switch(l){case"boolean":case"number":case"string":c=l;break;case"object":t===null?c="null":Array.isArray(t)?c="array":c="object";break;default:throw new Error(`Instances of "${l}" type are not supported.`)}let{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:b,required:g,not:y,anyOf:S,allOf:x,oneOf:O,if:P,then:E,else:A,format:I,properties:R,patternProperties:N,additionalProperties:j,unevaluatedProperties:$,minProperties:k,maxProperties:z,propertyNames:V,dependentRequired:Q,dependentSchemas:J,dependencies:D,prefixItems:B,items:q,additionalItems:K,unevaluatedItems:H,contains:ee,minContains:U,maxContains:W,minItems:Y,maxItems:ae,uniqueItems:Oe,minimum:le,maximum:Be,exclusiveMinimum:ze,exclusiveMaximum:rt,multipleOf:cr,minLength:Sn,maxLength:je,pattern:mt,__absolute_ref__:ht,__absolute_recursive_ref__:ft}=e,te=[];if(p===!0&&i===null&&(i=e),f==="#"){let Re=i===null?n[ft]:i,Pe=`${s}/$recursiveRef`,oe=oa(t,i===null?e:i,r,n,o,Re,a,Pe,u);oe.valid||te.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:Pe,error:"A subschema had errors."},...oe.errors)}if(d!==void 0){let Pe=n[ht||d];if(Pe===void 0){let ce=`Unresolved $ref "${d}".`;throw ht&&ht!==d&&(ce+=` Absolute URI "${ht}".`),ce+=` Known schemas: - ${Object.keys(n).join(` -- `)}`,new Error(ce)}let oe=`${s}/$ref`,se=oa(t,Pe,r,n,o,i,a,oe,u);if(se.valid||te.push({instanceLocation:a,keyword:"$ref",keywordLocation:oe,error:"A subschema had errors."},...se.errors),r==="4"||r==="7")return{valid:te.length===0,errors:te}}if(Array.isArray(m)){let Re=m.length,Pe=!1;for(let oe=0;oeMC(t,Re))||te.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(b)}.`}):b.some(Re=>t===Re)||te.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(b)}.`})),y!==void 0){let Re=`${s}/not`;oa(t,y,r,n,o,i,a,Re).valid&&te.push({instanceLocation:a,keyword:"not",keywordLocation:Re,error:'Instance matched "not" schema.'})}let et=[];if(S!==void 0){let Re=`${s}/anyOf`,Pe=te.length,oe=!1;for(let se=0;se{let Ce=Object.create(u),Je=oa(t,se,r,n,o,p===!0?i:null,a,`${Re}/${ce}`,Ce);return te.push(...Je.errors),Je.valid&&et.push(Ce),Je.valid}).length;oe===1?te.length=Pe:te.splice(Pe,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:Re,error:`Instance does not match exactly one subschema (${oe} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...et),P!==void 0){let Re=`${s}/if`;if(oa(t,P,r,n,o,i,a,Re,u).valid){if(E!==void 0){let oe=oa(t,E,r,n,o,i,a,`${s}/then`,u);oe.valid||te.push({instanceLocation:a,keyword:"if",keywordLocation:Re,error:'Instance does not match "then" schema.'},...oe.errors)}}else if(A!==void 0){let oe=oa(t,A,r,n,o,i,a,`${s}/else`,u);oe.valid||te.push({instanceLocation:a,keyword:"if",keywordLocation:Re,error:'Instance does not match "else" schema.'},...oe.errors)}}if(c==="object"){if(g!==void 0)for(let se of g)se in t||te.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${se}".`});let Re=Object.keys(t);if(k!==void 0&&Re.lengthz&&te.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${z} properties.`}),V!==void 0){let se=`${s}/propertyNames`;for(let ce in t){let Ce=`${a}/${wm(ce)}`,Je=oa(ce,V,r,n,o,i,Ce,se);Je.valid||te.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:se,error:`Property name "${ce}" does not match schema.`},...Je.errors)}}if(Q!==void 0){let se=`${s}/dependantRequired`;for(let ce in Q)if(ce in t){let Ce=Q[ce];for(let Je of Ce)Je in t||te.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:se,error:`Instance has "${ce}" but does not have "${Je}".`})}}if(J!==void 0)for(let se in J){let ce=`${s}/dependentSchemas`;if(se in t){let Ce=oa(t,J[se],r,n,o,i,a,`${ce}/${wm(se)}`,u);Ce.valid||te.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:ce,error:`Instance has "${se}" but does not match dependant schema.`},...Ce.errors)}}if(D!==void 0){let se=`${s}/dependencies`;for(let ce in D)if(ce in t){let Ce=D[ce];if(Array.isArray(Ce))for(let Je of Ce)Je in t||te.push({instanceLocation:a,keyword:"dependencies",keywordLocation:se,error:`Instance has "${ce}" but does not have "${Je}".`});else{let Je=oa(t,Ce,r,n,o,i,a,`${se}/${wm(ce)}`);Je.valid||te.push({instanceLocation:a,keyword:"dependencies",keywordLocation:se,error:`Instance has "${ce}" but does not match dependant schema.`},...Je.errors)}}}let Pe=Object.create(null),oe=!1;if(R!==void 0){let se=`${s}/properties`;for(let ce in R){if(!(ce in t))continue;let Ce=`${a}/${wm(ce)}`,Je=oa(t[ce],R[ce],r,n,o,i,Ce,`${se}/${wm(ce)}`);if(Je.valid)u[ce]=Pe[ce]=!0;else if(oe=o,te.push({instanceLocation:a,keyword:"properties",keywordLocation:se,error:`Property "${ce}" does not match schema.`},...Je.errors),oe)break}}if(!oe&&N!==void 0){let se=`${s}/patternProperties`;for(let ce in N){let Ce=new RegExp(ce,"u"),Je=N[ce];for(let ir in t){if(!Ce.test(ir))continue;let ea=`${a}/${wm(ir)}`,ta=oa(t[ir],Je,r,n,o,i,ea,`${se}/${wm(ce)}`);ta.valid?u[ir]=Pe[ir]=!0:(oe=o,te.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:se,error:`Property "${ir}" matches pattern "${ce}" but does not match associated schema.`},...ta.errors))}}}if(!oe&&j!==void 0){let se=`${s}/additionalProperties`;for(let ce in t){if(Pe[ce])continue;let Ce=`${a}/${wm(ce)}`,Je=oa(t[ce],j,r,n,o,i,Ce,se);Je.valid?u[ce]=!0:(oe=o,te.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:se,error:`Property "${ce}" does not match additional properties schema.`},...Je.errors))}}else if(!oe&&$!==void 0){let se=`${s}/unevaluatedProperties`;for(let ce in t)if(!u[ce]){let Ce=`${a}/${wm(ce)}`,Je=oa(t[ce],$,r,n,o,i,Ce,se);Je.valid?u[ce]=!0:te.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:se,error:`Property "${ce}" does not match unevaluated properties schema.`},...Je.errors)}}}else if(c==="array"){ae!==void 0&&t.length>ae&&te.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${ae}).`}),Y!==void 0&&t.length=(U||0)&&(te.length=ce),U===void 0&&W===void 0&&Ce===0?te.splice(ce,0,{instanceLocation:a,keyword:"contains",keywordLocation:se,error:"Array does not contain item matching schema."}):U!==void 0&&CeW&&te.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${W} items matching schema. ${Ce} items were found.`})}if(!oe&&H!==void 0){let se=`${s}/unevaluatedItems`;for(Pe;Pe=Be||t>Be)&&te.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${rt?"or equal to ":""} ${Be}.`})):(le!==void 0&&tBe&&te.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Be}.`}),ze!==void 0&&t<=ze&&te.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${ze}.`}),rt!==void 0&&t>=rt&&te.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${rt}.`})),cr!==void 0){let Re=t%cr;Math.abs(0-Re)>=11920929e-14&&Math.abs(cr-Re)>=11920929e-14&&te.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${cr}.`})}}else if(c==="string"){let Re=wn===void 0&&Le===void 0?0:mHe(t);wn!==void 0&&ReLe&&te.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${Re} > ${Le}).`}),pt!==void 0&&!new RegExp(pt,"u").test(t)&&te.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),I!==void 0&&che[I]&&!che[I](t)&&te.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${I}".`})}return{valid:te.length===0,errors:te}}var phe=w(()=>{lhe();UG();dhe();qG();fhe()});var hHe=w(()=>{UG();phe()});var H2=w(()=>{lhe();UG();dhe();qG();pHe();fhe();phe();hHe()});var TR,AR,$E=w(()=>{H2();eF();Eh();NE();ZL();TR=class extends ER{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"})}},AR=class extends TR{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(ume(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new qn({message:o,text:o.content})}else if(Ph(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new qn({message:dme(o),text:o.content})}else i=new vp({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!MC(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var gHe=w(()=>{$E()});var yHe=w(()=>{eF();$E()});var zG,bHe=w(()=>{$E();zG=class extends TR{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 Tc,_He=w(()=>{Td();Ec();eF();Tc=class extends ER{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=Wr.object(Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Wr.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. +- `)}`,new Error(ce)}let oe=`${s}/$ref`,se=oa(t,Pe,r,n,o,i,a,oe,u);if(se.valid||te.push({instanceLocation:a,keyword:"$ref",keywordLocation:oe,error:"A subschema had errors."},...se.errors),r==="4"||r==="7")return{valid:te.length===0,errors:te}}if(Array.isArray(m)){let Re=m.length,Pe=!1;for(let oe=0;oeRC(t,Re))||te.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(b)}.`}):b.some(Re=>t===Re)||te.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(b)}.`})),y!==void 0){let Re=`${s}/not`;oa(t,y,r,n,o,i,a,Re).valid&&te.push({instanceLocation:a,keyword:"not",keywordLocation:Re,error:'Instance matched "not" schema.'})}let et=[];if(S!==void 0){let Re=`${s}/anyOf`,Pe=te.length,oe=!1;for(let se=0;se{let Ce=Object.create(u),Je=oa(t,se,r,n,o,p===!0?i:null,a,`${Re}/${ce}`,Ce);return te.push(...Je.errors),Je.valid&&et.push(Ce),Je.valid}).length;oe===1?te.length=Pe:te.splice(Pe,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:Re,error:`Instance does not match exactly one subschema (${oe} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...et),P!==void 0){let Re=`${s}/if`;if(oa(t,P,r,n,o,i,a,Re,u).valid){if(E!==void 0){let oe=oa(t,E,r,n,o,i,a,`${s}/then`,u);oe.valid||te.push({instanceLocation:a,keyword:"if",keywordLocation:Re,error:'Instance does not match "then" schema.'},...oe.errors)}}else if(A!==void 0){let oe=oa(t,A,r,n,o,i,a,`${s}/else`,u);oe.valid||te.push({instanceLocation:a,keyword:"if",keywordLocation:Re,error:'Instance does not match "else" schema.'},...oe.errors)}}if(c==="object"){if(g!==void 0)for(let se of g)se in t||te.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${se}".`});let Re=Object.keys(t);if(k!==void 0&&Re.lengthz&&te.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${z} properties.`}),V!==void 0){let se=`${s}/propertyNames`;for(let ce in t){let Ce=`${a}/${wm(ce)}`,Je=oa(ce,V,r,n,o,i,Ce,se);Je.valid||te.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:se,error:`Property name "${ce}" does not match schema.`},...Je.errors)}}if(Q!==void 0){let se=`${s}/dependantRequired`;for(let ce in Q)if(ce in t){let Ce=Q[ce];for(let Je of Ce)Je in t||te.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:se,error:`Instance has "${ce}" but does not have "${Je}".`})}}if(J!==void 0)for(let se in J){let ce=`${s}/dependentSchemas`;if(se in t){let Ce=oa(t,J[se],r,n,o,i,a,`${ce}/${wm(se)}`,u);Ce.valid||te.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:ce,error:`Instance has "${se}" but does not match dependant schema.`},...Ce.errors)}}if(D!==void 0){let se=`${s}/dependencies`;for(let ce in D)if(ce in t){let Ce=D[ce];if(Array.isArray(Ce))for(let Je of Ce)Je in t||te.push({instanceLocation:a,keyword:"dependencies",keywordLocation:se,error:`Instance has "${ce}" but does not have "${Je}".`});else{let Je=oa(t,Ce,r,n,o,i,a,`${se}/${wm(ce)}`);Je.valid||te.push({instanceLocation:a,keyword:"dependencies",keywordLocation:se,error:`Instance has "${ce}" but does not match dependant schema.`},...Je.errors)}}}let Pe=Object.create(null),oe=!1;if(R!==void 0){let se=`${s}/properties`;for(let ce in R){if(!(ce in t))continue;let Ce=`${a}/${wm(ce)}`,Je=oa(t[ce],R[ce],r,n,o,i,Ce,`${se}/${wm(ce)}`);if(Je.valid)u[ce]=Pe[ce]=!0;else if(oe=o,te.push({instanceLocation:a,keyword:"properties",keywordLocation:se,error:`Property "${ce}" does not match schema.`},...Je.errors),oe)break}}if(!oe&&N!==void 0){let se=`${s}/patternProperties`;for(let ce in N){let Ce=new RegExp(ce,"u"),Je=N[ce];for(let ir in t){if(!Ce.test(ir))continue;let ea=`${a}/${wm(ir)}`,ta=oa(t[ir],Je,r,n,o,i,ea,`${se}/${wm(ce)}`);ta.valid?u[ir]=Pe[ir]=!0:(oe=o,te.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:se,error:`Property "${ir}" matches pattern "${ce}" but does not match associated schema.`},...ta.errors))}}}if(!oe&&j!==void 0){let se=`${s}/additionalProperties`;for(let ce in t){if(Pe[ce])continue;let Ce=`${a}/${wm(ce)}`,Je=oa(t[ce],j,r,n,o,i,Ce,se);Je.valid?u[ce]=!0:(oe=o,te.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:se,error:`Property "${ce}" does not match additional properties schema.`},...Je.errors))}}else if(!oe&&$!==void 0){let se=`${s}/unevaluatedProperties`;for(let ce in t)if(!u[ce]){let Ce=`${a}/${wm(ce)}`,Je=oa(t[ce],$,r,n,o,i,Ce,se);Je.valid?u[ce]=!0:te.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:se,error:`Property "${ce}" does not match unevaluated properties schema.`},...Je.errors)}}}else if(c==="array"){ae!==void 0&&t.length>ae&&te.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${ae}).`}),Y!==void 0&&t.length=(U||0)&&(te.length=ce),U===void 0&&W===void 0&&Ce===0?te.splice(ce,0,{instanceLocation:a,keyword:"contains",keywordLocation:se,error:"Array does not contain item matching schema."}):U!==void 0&&CeW&&te.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${W} items matching schema. ${Ce} items were found.`})}if(!oe&&H!==void 0){let se=`${s}/unevaluatedItems`;for(Pe;Pe=Be||t>Be)&&te.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${rt?"or equal to ":""} ${Be}.`})):(le!==void 0&&tBe&&te.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Be}.`}),ze!==void 0&&t<=ze&&te.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${ze}.`}),rt!==void 0&&t>=rt&&te.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${rt}.`})),cr!==void 0){let Re=t%cr;Math.abs(0-Re)>=11920929e-14&&Math.abs(cr-Re)>=11920929e-14&&te.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${cr}.`})}}else if(c==="string"){let Re=Sn===void 0&&je===void 0?0:gHe(t);Sn!==void 0&&Reje&&te.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${Re} > ${je}).`}),mt!==void 0&&!new RegExp(mt,"u").test(t)&&te.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),I!==void 0&&phe[I]&&!phe[I](t)&&te.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${I}".`})}return{valid:te.length===0,errors:te}}var ghe=w(()=>{fhe();zG();mhe();UG();hhe()});var yHe=w(()=>{zG();ghe()});var V2=w(()=>{fhe();zG();mhe();UG();hHe();hhe();ghe();yHe()});var TR,AR,$E=w(()=>{V2();tF();Eh();NE();XL();TR=class extends ER{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"})}},AR=class extends TR{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(dme(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new qn({message:o,text:o.content})}else if(Ph(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new qn({message:mme(o),text:o.content})}else i=new vp({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!RC(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var bHe=w(()=>{$E()});var _He=w(()=>{tF();$E()});var HG,vHe=w(()=>{$E();HG=class extends TR{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 Tc,wHe=w(()=>{Td();Ec();tF();Tc=class extends ER{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=Wr.object(Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Wr.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. @@ -84,34 +84,34 @@ Here is the JSON Schema instance your output must adhere to. Include the enclosi \`\`\`json ${JSON.stringify(So(this.schema))} \`\`\` -`}async parse(e){try{let n=(e.includes("```")?e.trim().split(/```(?:json)?/)[1]:e.trim()).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(o,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await this.schema.parseAsync(JSON.parse(n))}catch(r){throw new vm(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}}});var mhe=w(()=>{Jpe()});var Ac,hhe=w(()=>{$E();mhe();ime();Ac=class extends AR{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?dG(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return ome(e[0].text)}async parse(e){return ome(e,JSON.parse)}getFormatInstructions(){return""}}});var vHe=w(()=>{});var wHe=w(()=>{$E();mhe();vHe()});var SHe=w(()=>{eF();gHe();yHe();bHe();_He();$E();hhe();wHe()});var gy=w(()=>{SHe()});var V2,tF,rF,HG,W2=w(()=>{yR();R2();NE();V2=class extends gp{},tF=class extends V2{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 Os(this.value)]}},rF=class extends V2{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 Rf(this.messages)}toChatMessages(){return this.messages}},HG=class extends V2{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 Os({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var jC,K2=w(()=>{W2();nF();jC=class extends Kb{async formatPromptValue(e){let r=await this.format(e);return new tF(r)}}});function yhe(t){return typeof t=="function"}function rsr(t){return iF(t)?"array":typeof t}function ghe(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function xHe(t,e){return t!=null&&typeof t=="object"&&e in t}function nsr(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function isr(t,e){return osr.call(t,e)}function ssr(t){return!isr(asr,t)}function lsr(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return usr[r]})}function msr(t,e){if(!t)return[];var r=!1,n=[],o=[],i=[],a=!1,s=!1,u="",l=0;function c(){if(a&&!s)for(;i.length;)delete o[i.pop()];else i=[];a=!1,s=!1}var d,f,p;function m(A){if(typeof A=="string"&&(A=A.split(dsr,2)),!iF(A)||A.length!==2)throw new Error("Invalid tags: "+A);d=new RegExp(ghe(A[0])+"\\s*"),f=new RegExp("\\s*"+ghe(A[1])),p=new RegExp("\\s*"+ghe("}"+A[1]))}m(e||Ah.tags);for(var h=new J2(t),b,g,y,S,x,O;!h.eos();){if(b=h.pos,y=h.scanUntil(d),y)for(var P=0,E=y.length;P"?x=[g,y,b,h.pos,u,l,r]:x=[g,y,b,h.pos],l++,o.push(x),g==="#"||g==="^")n.push(x);else if(g==="/"){if(O=n.pop(),!O)throw new Error('Unopened section "'+y+'" at '+b);if(O[1]!==y)throw new Error('Unclosed section "'+O[1]+'" at '+b)}else g==="name"||g==="{"||g==="&"?s=!0:g==="="&&m(y)}if(c(),O=n.pop(),O)throw new Error('Unclosed section "'+O[1]+'" at '+h.pos);return gsr(hsr(o))}function hsr(t){for(var e=[],r,n,o=0,i=t.length;o0?n[n.length-1][4]:e;break;default:r.push(o)}return e}function J2(t){this.string=t,this.tail=t,this.pos=0}function oF(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Lf(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var tsr,iF,osr,asr,usr,csr,dsr,CHe,fsr,psr,Ah,G2,VG,OHe=w(()=>{tsr=Object.prototype.toString,iF=Array.isArray||function(e){return tsr.call(e)==="[object Array]"};osr=RegExp.prototype.test;asr=/\S/;usr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};csr=/\s*/,dsr=/\s+/,CHe=/\s*=/,fsr=/\s*\}/,psr=/#|\^|\/|>|\{|&|=|!/;J2.prototype.eos=function(){return this.tail===""};J2.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};J2.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};oF.prototype.push=function(e){return new oF(e,this)};oF.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"?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};Lf.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(iF(u))for(var c=0,d=u.length;c`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await this.schema.parseAsync(JSON.parse(n))}catch(r){throw new vm(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}}});var yhe=w(()=>{Xpe()});var Ac,bhe=w(()=>{$E();yhe();ume();Ac=class extends AR{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?fG(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return sme(e[0].text)}async parse(e){return sme(e,JSON.parse)}getFormatInstructions(){return""}}});var SHe=w(()=>{});var xHe=w(()=>{$E();yhe();SHe()});var CHe=w(()=>{tF();bHe();_He();vHe();wHe();$E();bhe();xHe()});var gy=w(()=>{CHe()});var W2,rF,nF,VG,K2=w(()=>{yR();j2();NE();W2=class extends gp{},rF=class extends W2{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 Os(this.value)]}},nF=class extends W2{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 Rf(this.messages)}toChatMessages(){return this.messages}},VG=class extends W2{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 Os({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var NC,G2=w(()=>{K2();oF();NC=class extends Kb{async formatPromptValue(e){let r=await this.format(e);return new rF(r)}}});function vhe(t){return typeof t=="function"}function ssr(t){return aF(t)?"array":typeof t}function _he(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function OHe(t,e){return t!=null&&typeof t=="object"&&e in t}function usr(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function csr(t,e){return lsr.call(t,e)}function fsr(t){return!csr(dsr,t)}function msr(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return psr[r]})}function _sr(t,e){if(!t)return[];var r=!1,n=[],o=[],i=[],a=!1,s=!1,u="",l=0;function c(){if(a&&!s)for(;i.length;)delete o[i.pop()];else i=[];a=!1,s=!1}var d,f,p;function m(A){if(typeof A=="string"&&(A=A.split(gsr,2)),!aF(A)||A.length!==2)throw new Error("Invalid tags: "+A);d=new RegExp(_he(A[0])+"\\s*"),f=new RegExp("\\s*"+_he(A[1])),p=new RegExp("\\s*"+_he("}"+A[1]))}m(e||Ah.tags);for(var h=new Y2(t),b,g,y,S,x,O;!h.eos();){if(b=h.pos,y=h.scanUntil(d),y)for(var P=0,E=y.length;P"?x=[g,y,b,h.pos,u,l,r]:x=[g,y,b,h.pos],l++,o.push(x),g==="#"||g==="^")n.push(x);else if(g==="/"){if(O=n.pop(),!O)throw new Error('Unopened section "'+y+'" at '+b);if(O[1]!==y)throw new Error('Unclosed section "'+O[1]+'" at '+b)}else g==="name"||g==="{"||g==="&"?s=!0:g==="="&&m(y)}if(c(),O=n.pop(),O)throw new Error('Unclosed section "'+O[1]+'" at '+h.pos);return wsr(vsr(o))}function vsr(t){for(var e=[],r,n,o=0,i=t.length;o0?n[n.length-1][4]:e;break;default:r.push(o)}return e}function Y2(t){this.string=t,this.tail=t,this.pos=0}function iF(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Lf(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var asr,aF,lsr,dsr,psr,hsr,gsr,PHe,ysr,bsr,Ah,J2,WG,EHe=w(()=>{asr=Object.prototype.toString,aF=Array.isArray||function(e){return asr.call(e)==="[object Array]"};lsr=RegExp.prototype.test;dsr=/\S/;psr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};hsr=/\s*/,gsr=/\s+/,PHe=/\s*=/,ysr=/\s*\}/,bsr=/#|\^|\/|>|\{|&|=|!/;Y2.prototype.eos=function(){return this.tail===""};Y2.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};Y2.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};iF.prototype.push=function(e){return new iF(e,this)};iF.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"?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};Lf.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(aF(u))for(var c=0,d=u.length;c0||!n)&&(i[a]=o+i[a]);return i.join(` -`)};Lf.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=yhe(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)}}};Lf.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};Lf.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||Ah.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===Ah.escape?String(i):o(i)};Lf.prototype.rawValue=function(e){return e[1]};Lf.prototype.getConfigTags=function(e){return iF(e)?e:e&&typeof e=="object"?e.tags:void 0};Lf.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!iF(e))return e.escape};Ah={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){G2.templateCache=t},get templateCache(){return G2.templateCache}},G2=new Lf;Ah.clearCache=function(){return G2.clearCache()};Ah.parse=function(e,r){return G2.parse(e,r)};Ah.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+rsr(e)+'" was given as the first argument for mustache#render(template, view, partials)');return G2.render(e,r,n,o)};Ah.escape=lsr;Ah.Scanner=J2;Ah.Context=oF;Ah.Writer=Lf;VG=Ah});function PHe(){VG.escape=t=>t}var Y2,ysr,WG,bsr,_sr,bhe,vsr,Sp,Z2,IR,MR=w(()=>{OHe();I2();Y2=t=>{let e=t.split(""),r=[],n=(i,a)=>{for(let s=a;st.map(e=>e[0]==="name"?{type:"variable",name:e[1].includes(".")?e[1].split(".")[0]:e[1]}:["#","&","^",">"].includes(e[0])?{type:"variable",name:e[1]}:{type:"literal",text:e[1]}),WG=t=>{PHe();let e=VG.parse(t);return ysr(e)},bsr=(t,e)=>Y2(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},""),_sr=(t,e)=>(PHe(),VG.render(t,e)),bhe={"f-string":bsr,mustache:_sr},vsr={"f-string":Y2,mustache:WG},Sp=(t,e,r)=>{try{return bhe[e](t,r)}catch(n){throw ME(n,"INVALID_PROMPT_INPUT")}},Z2=(t,e)=>vsr[e](t),IR=(t,e,r)=>{if(!(e in bhe)){let n=Object.keys(bhe);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")Sp(o.text,e,n);else if(o.type==="image_url")if(typeof o.image_url=="string")Sp(o.image_url,e,n);else{let i=o.image_url.url;Sp(i,e,n)}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):Sp(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var _he={};Cf(_he,{PromptTemplate:()=>Dd});var Dd,aF=w(()=>{K2();MR();Dd=class t extends jC{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))),IR(this.template,this.templateFormat,r)}}_getPromptType(){return"prompt"}async format(e){let r=await this.mergePartialAndUserVariables(e);return Sp(this.template,this.templateFormat,r)}static fromExamples(e,r,n,o=` +`)};Lf.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=vhe(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)}}};Lf.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};Lf.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||Ah.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===Ah.escape?String(i):o(i)};Lf.prototype.rawValue=function(e){return e[1]};Lf.prototype.getConfigTags=function(e){return aF(e)?e:e&&typeof e=="object"?e.tags:void 0};Lf.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!aF(e))return e.escape};Ah={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){J2.templateCache=t},get templateCache(){return J2.templateCache}},J2=new Lf;Ah.clearCache=function(){return J2.clearCache()};Ah.parse=function(e,r){return J2.parse(e,r)};Ah.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+ssr(e)+'" was given as the first argument for mustache#render(template, view, partials)');return J2.render(e,r,n,o)};Ah.escape=msr;Ah.Scanner=Y2;Ah.Context=iF;Ah.Writer=Lf;WG=Ah});function THe(){WG.escape=t=>t}var Z2,Ssr,KG,xsr,Csr,whe,Osr,Sp,X2,IR,MR=w(()=>{EHe();M2();Z2=t=>{let e=t.split(""),r=[],n=(i,a)=>{for(let s=a;st.map(e=>e[0]==="name"?{type:"variable",name:e[1].includes(".")?e[1].split(".")[0]:e[1]}:["#","&","^",">"].includes(e[0])?{type:"variable",name:e[1]}:{type:"literal",text:e[1]}),KG=t=>{THe();let e=WG.parse(t);return Ssr(e)},xsr=(t,e)=>Z2(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},""),Csr=(t,e)=>(THe(),WG.render(t,e)),whe={"f-string":xsr,mustache:Csr},Osr={"f-string":Z2,mustache:KG},Sp=(t,e,r)=>{try{return whe[e](t,r)}catch(n){throw ME(n,"INVALID_PROMPT_INPUT")}},X2=(t,e)=>Osr[e](t),IR=(t,e,r)=>{if(!(e in whe)){let n=Object.keys(whe);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")Sp(o.text,e,n);else if(o.type==="image_url")if(typeof o.image_url=="string")Sp(o.image_url,e,n);else{let i=o.image_url.url;Sp(i,e,n)}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):Sp(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var She={};Cf(She,{PromptTemplate:()=>Dd});var Dd,sF=w(()=>{G2();MR();Dd=class t extends NC{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))),IR(this.template,this.templateFormat,r)}}_getPromptType(){return"prompt"}async format(e){let r=await this.mergePartialAndUserVariables(e);return Sp(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 Z2(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 sF,vhe=w(()=>{W2();nF();MR();sF=class t extends Kb{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))),IR([{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]=Sp(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 HG(r)}}});function whe(t,e){let r=[];for(let n of Object.values(t))if(typeof n=="string")Z2(n,e).forEach(o=>{o.type==="variable"&&r.push(o.name)});else if(Array.isArray(n))for(let o of n)typeof o=="string"?Z2(o,e).forEach(i=>{i.type==="variable"&&r.push(i.name)}):typeof o=="object"&&r.push(...whe(o,e));else typeof n=="object"&&n!==null&&r.push(...whe(n,e));return Array.from(new Set(r))}function She(t,e,r){let n={};for(let[o,i]of Object.entries(t))if(typeof i=="string")n[o]=Sp(i,r,e);else if(Array.isArray(i)){let a=[];for(let s of i)typeof s=="string"?a.push(Sp(s,r,e)):typeof s=="object"&&a.push(She(s,e,r));n[o]=a}else typeof i=="object"&&i!==null?n[o]=She(i,e,r):n[o]=i;return n}var X2,xhe=w(()=>{Df();MR();X2=class extends xn{static lc_name(){return"DictPromptTemplate"}constructor(e){let r=e.templateFormat??"f-string",n=whe(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 She(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}}});function wsr(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).length===1&&"text"in t&&typeof t.text=="string"}function Ssr(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 xsr(t){return typeof t.formatMessages=="function"}function Csr(t,e){if(xsr(t)||Ph(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 Gb({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new Gb({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=fy(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 Jb.fromTemplate(n,e);if(r._getType()==="ai")return Phe.fromTemplate(n,e);if(r._getType()==="system")return BE.fromTemplate(n,e);if(Cs.isInstance(r))return Ohe.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function Osr(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var Q2,Gb,Che,e4,Ohe,t4,Jb,Phe,BE,xp,r4=w(()=>{OR();W2();Df();K2();nF();aF();vhe();MR();I2();xhe();Q2=class extends xn{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"})}},Gb=class extends Q2{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(fy):n=[fy(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(` +`,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 X2(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 uF,xhe=w(()=>{K2();oF();MR();uF=class t extends Kb{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))),IR([{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]=Sp(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 VG(r)}}});function Che(t,e){let r=[];for(let n of Object.values(t))if(typeof n=="string")X2(n,e).forEach(o=>{o.type==="variable"&&r.push(o.name)});else if(Array.isArray(n))for(let o of n)typeof o=="string"?X2(o,e).forEach(i=>{i.type==="variable"&&r.push(i.name)}):typeof o=="object"&&r.push(...Che(o,e));else typeof n=="object"&&n!==null&&r.push(...Che(n,e));return Array.from(new Set(r))}function Ohe(t,e,r){let n={};for(let[o,i]of Object.entries(t))if(typeof i=="string")n[o]=Sp(i,r,e);else if(Array.isArray(i)){let a=[];for(let s of i)typeof s=="string"?a.push(Sp(s,r,e)):typeof s=="object"&&a.push(Ohe(s,e,r));n[o]=a}else typeof i=="object"&&i!==null?n[o]=Ohe(i,e,r):n[o]=i;return n}var Q2,Phe=w(()=>{Df();MR();Q2=class extends Cn{static lc_name(){return"DictPromptTemplate"}constructor(e){let r=e.templateFormat??"f-string",n=Che(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 Ohe(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}}});function Psr(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).length===1&&"text"in t&&typeof t.text=="string"}function Esr(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 Tsr(t){return typeof t.formatMessages=="function"}function Asr(t,e){if(Tsr(t)||Ph(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 Gb({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new Gb({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=fy(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 Jb.fromTemplate(n,e);if(r._getType()==="ai")return Ahe.fromTemplate(n,e);if(r._getType()==="system")return BE.fromTemplate(n,e);if(Cs.isInstance(r))return The.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function Isr(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var e4,Gb,Ehe,t4,The,r4,Jb,Ahe,BE,xp,n4=w(()=>{OR();K2();Df();G2();oF();sF();xhe();MR();M2();Phe();e4=class extends Cn{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"})}},Gb=class extends e4{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(fy):n=[fy(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}},Che=class extends Q2{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)]}},e4=class extends Kb{constructor(e){super(e)}async format(e){return(await this.formatPromptValue(e)).toString()}async formatPromptValue(e){let r=await this.formatMessages(e);return new rF(r)}},Ohe=class extends Che{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 Cs(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(Dd.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}};t4=class extends Q2{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(Dd.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string")n.push(Dd.fromTemplate(o,r));else if(o!==null)if(wsr(o)){let i="";typeof o.text=="string"&&(i=o.text??"");let a={...r,additionalContentFields:o};n.push(Dd.fromTemplate(i,a))}else if(Ssr(o)){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=WG(i):u=Y2(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. +`));throw a.name="InputFormatError",a.lc_error_code=o.lc_error_code,a}return n}},Ehe=class extends e4{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)]}},t4=class extends Kb{constructor(e){super(e)}async format(e){return(await this.formatPromptValue(e)).toString()}async formatPromptValue(e){let r=await this.formatMessages(e);return new nF(r)}},The=class extends Ehe{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 Cs(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(Dd.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}};r4=class extends e4{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(Dd.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string")n.push(Dd.fromTemplate(o,r));else if(o!==null)if(Psr(o)){let i="";typeof o.text=="string"&&(i=o.text??"");let a={...r,additionalContentFields:o};n.push(Dd.fromTemplate(i,a))}else if(Esr(o)){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=KG(i):u=Z2(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 sF({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=WG(i.url):u=Y2(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new sF({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 X2({template:o,templateFormat:r?.templateFormat}));return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof jC){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 jC){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"text",text:i})}else if(n instanceof sF){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 X2){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)]}},Jb=class extends t4{static _messageClass(){return Os}static lc_name(){return"HumanMessagePromptTemplate"}},Phe=class extends t4{static _messageClass(){return gn}static lc_name(){return"AIMessagePromptTemplate"}},BE=class extends t4{static _messageClass(){return EC}static lc_name(){return"SystemMessagePromptTemplate"}};xp=class t extends e4{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 Sl))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 Dd.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 Sl)n.push(await this._parseImagePrompts(o,r));else{let i=o.inputVariables.reduce((s,u)=>{if(!(u in r)&&!(Osr(o)&&o.optional))throw ME(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=Dd.fromTemplate(e,r),o=new Jb({prompt:n});return this.fromMessages([o])}static fromMessages(e,r){let n=e.reduce((a,s)=>a.concat(s instanceof t?s.promptMessages:[Csr(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 Sl))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 EHe={};Cf(EHe,{FewShotChatMessagePromptTemplate:()=>The,FewShotPromptTemplate:()=>Ehe});var Ehe,The,Ahe=w(()=>{K2();MR();aF();r4();Ehe=class t extends jC{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:` +From: ${i}`);s=[l[0]]}else s=[];i={url:i},a=new uF({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=KG(i.url):u=Z2(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new uF({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 Q2({template:o,templateFormat:r?.templateFormat}));return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof NC){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 NC){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"text",text:i})}else if(n instanceof uF){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 Q2){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)]}},Jb=class extends r4{static _messageClass(){return Os}static lc_name(){return"HumanMessagePromptTemplate"}},Ahe=class extends r4{static _messageClass(){return gn}static lc_name(){return"AIMessagePromptTemplate"}},BE=class extends r4{static _messageClass(){return TC}static lc_name(){return"SystemMessagePromptTemplate"}};xp=class t extends t4{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 Sl))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 Dd.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 Sl)n.push(await this._parseImagePrompts(o,r));else{let i=o.inputVariables.reduce((s,u)=>{if(!(u in r)&&!(Isr(o)&&o.optional))throw ME(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=Dd.fromTemplate(e,r),o=new Jb({prompt:n});return this.fromMessages([o])}static fromMessages(e,r){let n=e.reduce((a,s)=>a.concat(s instanceof t?s.promptMessages:[Asr(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 Sl))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 AHe={};Cf(AHe,{FewShotChatMessagePromptTemplate:()=>Mhe,FewShotPromptTemplate:()=>Ihe});var Ihe,Mhe,Rhe=w(()=>{G2();MR();sF();n4();Ihe=class t extends NC{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))),IR(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 Sp(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 Dd.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})}},The=class t extends e4{_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}),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))),IR(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 Sp(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 Dd.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})}},Mhe=class t extends t4{_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))),IR(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 Sp(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 Kb,nF=w(()=>{Df();Kb=class extends xn{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(()=>(aF(),_he));return r.deserialize(e)}case void 0:{let{PromptTemplate:r}=await Promise.resolve().then(()=>(aF(),_he));return r.deserialize({...e,_type:"prompt"})}case"few_shot":{let{FewShotPromptTemplate:r}=await Promise.resolve().then(()=>(Ahe(),EHe));return r.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}});var THe=w(()=>{nF();r4()});var AHe=w(()=>{});var IHe=w(()=>{r4()});var MHe=w(()=>{nF();r4();Ahe();THe();aF();AHe();K2();MR();vhe();IHe();xhe()});var qE=w(()=>{MHe()});var Sm=w(()=>{uhe()});var Ihe,Mhe=w(()=>{Ihe=t=>t.map(e=>e.pageContent).join(` +`,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))),IR(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 Sp(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 Kb,oF=w(()=>{Df();Kb=class extends Cn{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(()=>(sF(),She));return r.deserialize(e)}case void 0:{let{PromptTemplate:r}=await Promise.resolve().then(()=>(sF(),She));return r.deserialize({...e,_type:"prompt"})}case"few_shot":{let{FewShotPromptTemplate:r}=await Promise.resolve().then(()=>(Rhe(),AHe));return r.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}});var IHe=w(()=>{oF();n4()});var MHe=w(()=>{});var RHe=w(()=>{n4()});var jHe=w(()=>{oF();n4();Rhe();IHe();sF();MHe();G2();MR();xhe();RHe();Phe()});var qE=w(()=>{jHe()});var Sm=w(()=>{dhe()});var jhe,Nhe=w(()=>{jhe=t=>t.map(e=>e.pageContent).join(` -`)});var RHe=w(()=>{Mhe()});function Ih(t,e){let r=`atom${++Psr}`,n={toString(){return(Sa.env?Sa.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=Esr,n.write=Tsr),e&&(n.write=e),n}function Esr(t){return t(this)}function Tsr(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var Sa,Psr,jHe,Rhe,jhe,GG,Dhe,Asr,Isr,Lhe,NHe,KG,FHe,DHe,uF,Nhe,Msr,Rsr,LHe,UE,kHe,lF,n4,$He,Fhe=w(()=>{Sa={},Psr=0;jHe=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,Rhe=t=>"init"in t,jhe=t=>!!t.write,GG=new WeakMap,Dhe=t=>{var e;return Lhe(t)&&!((e=GG.get(t))!=null&&e[1])},Asr=(t,e)=>{let r=GG.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((Sa.env?Sa.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},Isr=t=>{if(GG.has(t))return;let e=[new Set,!1];GG.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},Lhe=t=>typeof t?.then=="function",NHe=t=>"v"in t||"e"in t,KG=t=>{if("e"in t)throw t.e;if((Sa.env?Sa.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},FHe=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},DHe=(t,e,r,n,o)=>{var i;if((Sa.env?Sa.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),Dhe(r.v)&&FHe(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&Msr(t,n,e)},uF=()=>[new Map,new Map,new Set],Nhe=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},Msr=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},Rsr=(t,e)=>t[0].get(e),LHe=(t,e)=>{t[2].add(e)},UE=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},kHe=(...[t,e,r,n])=>{let o;(Sa.env?Sa.env.MODE:void 0)!=="production"&&(o=new Set);let i=(S,x,O)=>{let P="v"in x,E=x.v,A=Dhe(x.v)?x.v:null;if(Lhe(O)){Isr(O);for(let I of x.d.keys())FHe(S,O,t(I));x.v=O,delete x.e}else x.v=O,delete x.e;(!P||!Object.is(E,x.v))&&(++x.n,A&&Asr(A,O))},a=(S,x,O)=>{var P;let E=t(x);if(NHe(E)&&(E.m&&!O?.has(x)||Array.from(E.d).every(([$,k])=>a(S,$,O).n===k)))return E;E.d.clear();let A=!0,I=$=>{if(jHe(x,$)){let z=t($);if(!NHe(z))if(Rhe($))i($,z,$.init);else throw new Error("no atom init");return KG(z)}let k=a(S,$,O);try{return KG(k)}finally{if(A)DHe(S,x,E,$,k);else{let z=uF();DHe(z,x,E,$,k),p(z,x,E),UE(z)}}},R,N,j={get signal(){return R||(R=new AbortController),R.signal},get setSelf(){return(Sa.env?Sa.env.MODE:void 0)!=="production"&&!jhe(x)&&console.warn("setSelf function cannot be used with read-only atom"),!N&&jhe(x)&&(N=(...$)=>{if((Sa.env?Sa.env.MODE:void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)return f(x,...$)}),N}};try{let $=e(x,I,j);if(i(x,E,$),Lhe($)){(P=$.onCancel)==null||P.call($,()=>R?.abort());let k=()=>{if(E.m){let z=uF();p(z,x,E),UE(z)}};$.then(k,k)}return E}catch($){return delete E.v,E.e=$,++E.n,E}finally{A=!1}},s=S=>KG(a(void 0,S)),u=(S,x,O)=>{var P,E;let A=new Map;for(let I of((P=O.m)==null?void 0:P.t)||[])A.set(I,t(I));for(let I of O.p)A.set(I,t(I));return(E=Rsr(S,x))==null||E.forEach(I=>{A.set(I,t(I))}),A};function l(S,x,O){let P=[],E=new Set,A=new Set,I=[[x,O]];for(;I.length>0;){let[R,N]=I[I.length-1];if(A.has(R)){I.pop();continue}if(E.has(R)){P.push([R,N,N.n]),A.add(R),I.pop();continue}E.add(R);for(let[j,$]of u(S,R,N))R!==j&&!E.has(j)&&I.push([j,$])}return[P,A]}let c=(S,x,O)=>{let[P,E]=l(S,x,O),A=new Set([x]);for(let I=P.length-1;I>=0;--I){let[R,N,j]=P[I],$=!1;for(let k of N.d.keys())if(k!==R&&A.has(k)){$=!0;break}$&&(a(S,R,E),p(S,R,N),j!==N.n&&(Nhe(S,R,N),A.add(R))),E.delete(R)}},d=(S,x,...O)=>{let P=!0,E=I=>KG(a(S,I)),A=(I,...R)=>{let N=t(I);try{if(jHe(x,I)){if(!Rhe(I))throw new Error("atom not writable");let j=N.n,$=R[0];i(I,N,$),p(S,I,N),j!==N.n&&(Nhe(S,I,N),c(S,I,N));return}else return d(S,I,...R)}finally{P||UE(S)}};try{return r(x,E,A,...O)}finally{P=!1}},f=(S,...x)=>{let O=uF();try{return d(O,S,...x)}finally{UE(O)}},p=(S,x,O)=>{if(O.m&&!Dhe(O.v)){for(let P of O.d.keys())O.m.d.has(P)||(m(S,P,t(P)).t.add(x),O.m.d.add(P));for(let P of O.m.d||[])if(!O.d.has(P)){O.m.d.delete(P);let E=h(S,P,t(P));E?.t.delete(x)}}},m=(S,x,O)=>{if(!O.m){a(S,x);for(let P of O.d.keys())m(S,P,t(P)).t.add(x);if(O.m={l:new Set,d:new Set(O.d.keys()),t:new Set},(Sa.env?Sa.env.MODE:void 0)!=="production"&&o.add(x),jhe(x)){let P=O.m,E,A=(I,R)=>{let N=!0;E=(...j)=>{try{return d(I,x,...j)}finally{N||UE(I)}};try{return R()}finally{N=!1}};LHe(S,()=>{let I=A(S,()=>n(x,(...R)=>E(...R)));I&&(P.u=R=>A(R,I))})}}return O.m},h=(S,x,O)=>{if(O.m&&!O.m.l.size&&!Array.from(O.m.t).some(P=>{var E;return(E=t(P).m)==null?void 0:E.d.has(x)})){let P=O.m.u;P&&LHe(S,()=>P(S)),delete O.m,(Sa.env?Sa.env.MODE:void 0)!=="production"&&o.delete(x);for(let E of O.d.keys()){let A=h(S,E,t(E));A?.t.delete(x)}return}return O.m},y={get:s,set:f,sub:(S,x)=>{let O=uF(),P=t(S),A=m(O,S,P).l;return A.add(x),UE(O),()=>{A.delete(x);let I=uF();h(I,S,P),UE(I)}},unstable_derive:S=>kHe(...S(t,e,r,n))};return(Sa.env?Sa.env.MODE:void 0)!=="production"&&Object.assign(y,{dev4_get_internal_weak_map:()=>({get:x=>{let O=t(x);if(O.n!==0)return O}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:x=>{let O=uF();for(let[P,E]of x)if(Rhe(P)){let A=t(P),I=A.n;i(P,A,E),p(O,P,A),I!==A.n&&(Nhe(O,P,A),c(O,P,A))}UE(O)}}),y},lF=()=>{let t=new WeakMap;return kHe(r=>{if((Sa.env?Sa.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)})},$He=()=>(n4||(n4=lF(),(Sa.env?Sa.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=n4),globalThis.__JOTAI_DEFAULT_STORE__!==n4&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),n4)});var YHe=v(Mn=>{"use strict";var o4=Symbol.for("react.element"),jsr=Symbol.for("react.portal"),Nsr=Symbol.for("react.fragment"),Dsr=Symbol.for("react.strict_mode"),Lsr=Symbol.for("react.profiler"),Fsr=Symbol.for("react.provider"),ksr=Symbol.for("react.context"),$sr=Symbol.for("react.forward_ref"),Bsr=Symbol.for("react.suspense"),qsr=Symbol.for("react.memo"),Usr=Symbol.for("react.lazy"),BHe=Symbol.iterator;function zsr(t){return t===null||typeof t!="object"?null:(t=BHe&&t[BHe]||t["@@iterator"],typeof t=="function"?t:null)}var zHe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},HHe=Object.assign,VHe={};function cF(t,e,r){this.props=t,this.context=e,this.refs=VHe,this.updater=r||zHe}cF.prototype.isReactComponent={};cF.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")};cF.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function WHe(){}WHe.prototype=cF.prototype;function $he(t,e,r){this.props=t,this.context=e,this.refs=VHe,this.updater=r||zHe}var Bhe=$he.prototype=new WHe;Bhe.constructor=$he;HHe(Bhe,cF.prototype);Bhe.isPureReactComponent=!0;var qHe=Array.isArray,KHe=Object.prototype.hasOwnProperty,qhe={current:null},GHe={key:!0,ref:!0,__self:!0,__source:!0};function JHe(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)KHe.call(e,n)&&!GHe.hasOwnProperty(n)&&(o[n]=e[n]);var s=arguments.length-2;if(s===1)o.children=r;else if(1{"use strict";ZHe.exports=YHe()});function i4(t,e){let r=QHe(e),[[n,o,i],a]=(0,Ld.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,Ld.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);Hhe(c)&&eVe(XHe(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,Ld.useDebugValue)(s),Hhe(s)){let l=XHe(s);return Jsr(l)}return s}function Ysr(t,e){let r=QHe(e);return(0,Ld.useCallback)((...o)=>{if((XG.env?XG.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function a4(t,e){return[i4(t,e),Ysr(t,e)]}var Ld,XG,Gsr,QHe,Hhe,eVe,Jsr,zhe,XHe,tVe=w(()=>{"use client";Ld=F(X(),1);Fhe();XG={},Gsr=(0,Ld.createContext)(void 0),QHe=t=>{let e=(0,Ld.useContext)(Gsr);return t?.store||e||$He()},Hhe=t=>typeof t?.then=="function",eVe=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},Jsr=Ld.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(eVe(t),t)}),zhe=new WeakMap,XHe=t=>{let e=zhe.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((XG.env?XG.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");Hhe(l)?(zhe.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),zhe.set(t,e)),e}});var s4=w(()=>{Fhe();tVe()});function zE(t){let e=Zsr({...ue(),...t});ls.set(RR,e)}function dt(t,e){let r=ue();zE({...r,[t]:e})}function ue(){return ls.get(RR)}function nVe(){let t={...Ic,activeModels:Zb.map(e=>({...e,enabled:!0})),activeEmbeddingModels:jR.map(e=>({...e,enabled:!0}))};zE(t)}function xa(t){let e=ue();return ls.sub(RR,()=>{let r=ue();t(e,r),e=r})}function Rn(){return i4(RR,{store:ls})}function oVe(t){let e=t||Ic;e.userId||(e.userId=yC()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(u=>({...u,provider:u.provider==="azure_openai"?"azure openai":u.provider})):e.activeEmbeddingModels=jR.map(u=>({...u,enabled:!0}));let r={...e},n=Number(e.temperature);r.temperature=isNaN(n)?Ic.temperature:n;let o=Number(e.maxTokens);r.maxTokens=isNaN(o)?Ic.maxTokens:o;let i=Number(e.contextTurns);r.contextTurns=isNaN(i)?Ic.contextTurns:i;let a=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?Ic.embeddingRequestsPerMin:a;let s=Number(e.embeddingBatchSize);return r.embeddingBatchSize=isNaN(s)?Ic.embeddingBatchSize:s,typeof r.includeActiveNoteAsContext!="boolean"&&(r.includeActiveNoteAsContext=Ic.includeActiveNoteAsContext),typeof r.passMarkdownImages!="boolean"&&(r.passMarkdownImages=Ic.passMarkdownImages),typeof r.enableCustomPromptTemplating!="boolean"&&(r.enableCustomPromptTemplating=Ic.enableCustomPromptTemplating),typeof r.allowAdditionalContext!="boolean"&&(r.allowAdditionalContext=Ic.allowAdditionalContext),typeof r.enableWordCompletion!="boolean"&&(r.enableWordCompletion=Ic.enableWordCompletion),r}function iVe(){return ue().isPlusUser?sVe:""}function Yb(){let t=ue().userSystemPrompt,e=aVe;return t?`${e} +`)});var NHe=w(()=>{Nhe()});function Ih(t,e){let r=`atom${++Msr}`,n={toString(){return(Sa.env?Sa.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=Rsr,n.write=jsr),e&&(n.write=e),n}function Rsr(t){return t(this)}function jsr(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var Sa,Msr,DHe,Dhe,Lhe,JG,khe,Nsr,Dsr,$he,LHe,GG,$He,FHe,lF,Fhe,Lsr,Fsr,kHe,UE,BHe,cF,o4,qHe,Bhe=w(()=>{Sa={},Msr=0;DHe=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,Dhe=t=>"init"in t,Lhe=t=>!!t.write,JG=new WeakMap,khe=t=>{var e;return $he(t)&&!((e=JG.get(t))!=null&&e[1])},Nsr=(t,e)=>{let r=JG.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((Sa.env?Sa.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},Dsr=t=>{if(JG.has(t))return;let e=[new Set,!1];JG.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},$he=t=>typeof t?.then=="function",LHe=t=>"v"in t||"e"in t,GG=t=>{if("e"in t)throw t.e;if((Sa.env?Sa.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},$He=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},FHe=(t,e,r,n,o)=>{var i;if((Sa.env?Sa.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),khe(r.v)&&$He(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&Lsr(t,n,e)},lF=()=>[new Map,new Map,new Set],Fhe=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},Lsr=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},Fsr=(t,e)=>t[0].get(e),kHe=(t,e)=>{t[2].add(e)},UE=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},BHe=(...[t,e,r,n])=>{let o;(Sa.env?Sa.env.MODE:void 0)!=="production"&&(o=new Set);let i=(S,x,O)=>{let P="v"in x,E=x.v,A=khe(x.v)?x.v:null;if($he(O)){Dsr(O);for(let I of x.d.keys())$He(S,O,t(I));x.v=O,delete x.e}else x.v=O,delete x.e;(!P||!Object.is(E,x.v))&&(++x.n,A&&Nsr(A,O))},a=(S,x,O)=>{var P;let E=t(x);if(LHe(E)&&(E.m&&!O?.has(x)||Array.from(E.d).every(([$,k])=>a(S,$,O).n===k)))return E;E.d.clear();let A=!0,I=$=>{if(DHe(x,$)){let z=t($);if(!LHe(z))if(Dhe($))i($,z,$.init);else throw new Error("no atom init");return GG(z)}let k=a(S,$,O);try{return GG(k)}finally{if(A)FHe(S,x,E,$,k);else{let z=lF();FHe(z,x,E,$,k),p(z,x,E),UE(z)}}},R,N,j={get signal(){return R||(R=new AbortController),R.signal},get setSelf(){return(Sa.env?Sa.env.MODE:void 0)!=="production"&&!Lhe(x)&&console.warn("setSelf function cannot be used with read-only atom"),!N&&Lhe(x)&&(N=(...$)=>{if((Sa.env?Sa.env.MODE:void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)return f(x,...$)}),N}};try{let $=e(x,I,j);if(i(x,E,$),$he($)){(P=$.onCancel)==null||P.call($,()=>R?.abort());let k=()=>{if(E.m){let z=lF();p(z,x,E),UE(z)}};$.then(k,k)}return E}catch($){return delete E.v,E.e=$,++E.n,E}finally{A=!1}},s=S=>GG(a(void 0,S)),u=(S,x,O)=>{var P,E;let A=new Map;for(let I of((P=O.m)==null?void 0:P.t)||[])A.set(I,t(I));for(let I of O.p)A.set(I,t(I));return(E=Fsr(S,x))==null||E.forEach(I=>{A.set(I,t(I))}),A};function l(S,x,O){let P=[],E=new Set,A=new Set,I=[[x,O]];for(;I.length>0;){let[R,N]=I[I.length-1];if(A.has(R)){I.pop();continue}if(E.has(R)){P.push([R,N,N.n]),A.add(R),I.pop();continue}E.add(R);for(let[j,$]of u(S,R,N))R!==j&&!E.has(j)&&I.push([j,$])}return[P,A]}let c=(S,x,O)=>{let[P,E]=l(S,x,O),A=new Set([x]);for(let I=P.length-1;I>=0;--I){let[R,N,j]=P[I],$=!1;for(let k of N.d.keys())if(k!==R&&A.has(k)){$=!0;break}$&&(a(S,R,E),p(S,R,N),j!==N.n&&(Fhe(S,R,N),A.add(R))),E.delete(R)}},d=(S,x,...O)=>{let P=!0,E=I=>GG(a(S,I)),A=(I,...R)=>{let N=t(I);try{if(DHe(x,I)){if(!Dhe(I))throw new Error("atom not writable");let j=N.n,$=R[0];i(I,N,$),p(S,I,N),j!==N.n&&(Fhe(S,I,N),c(S,I,N));return}else return d(S,I,...R)}finally{P||UE(S)}};try{return r(x,E,A,...O)}finally{P=!1}},f=(S,...x)=>{let O=lF();try{return d(O,S,...x)}finally{UE(O)}},p=(S,x,O)=>{if(O.m&&!khe(O.v)){for(let P of O.d.keys())O.m.d.has(P)||(m(S,P,t(P)).t.add(x),O.m.d.add(P));for(let P of O.m.d||[])if(!O.d.has(P)){O.m.d.delete(P);let E=h(S,P,t(P));E?.t.delete(x)}}},m=(S,x,O)=>{if(!O.m){a(S,x);for(let P of O.d.keys())m(S,P,t(P)).t.add(x);if(O.m={l:new Set,d:new Set(O.d.keys()),t:new Set},(Sa.env?Sa.env.MODE:void 0)!=="production"&&o.add(x),Lhe(x)){let P=O.m,E,A=(I,R)=>{let N=!0;E=(...j)=>{try{return d(I,x,...j)}finally{N||UE(I)}};try{return R()}finally{N=!1}};kHe(S,()=>{let I=A(S,()=>n(x,(...R)=>E(...R)));I&&(P.u=R=>A(R,I))})}}return O.m},h=(S,x,O)=>{if(O.m&&!O.m.l.size&&!Array.from(O.m.t).some(P=>{var E;return(E=t(P).m)==null?void 0:E.d.has(x)})){let P=O.m.u;P&&kHe(S,()=>P(S)),delete O.m,(Sa.env?Sa.env.MODE:void 0)!=="production"&&o.delete(x);for(let E of O.d.keys()){let A=h(S,E,t(E));A?.t.delete(x)}return}return O.m},y={get:s,set:f,sub:(S,x)=>{let O=lF(),P=t(S),A=m(O,S,P).l;return A.add(x),UE(O),()=>{A.delete(x);let I=lF();h(I,S,P),UE(I)}},unstable_derive:S=>BHe(...S(t,e,r,n))};return(Sa.env?Sa.env.MODE:void 0)!=="production"&&Object.assign(y,{dev4_get_internal_weak_map:()=>({get:x=>{let O=t(x);if(O.n!==0)return O}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:x=>{let O=lF();for(let[P,E]of x)if(Dhe(P)){let A=t(P),I=A.n;i(P,A,E),p(O,P,A),I!==A.n&&(Fhe(O,P,A),c(O,P,A))}UE(O)}}),y},cF=()=>{let t=new WeakMap;return BHe(r=>{if((Sa.env?Sa.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)})},qHe=()=>(o4||(o4=cF(),(Sa.env?Sa.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=o4),globalThis.__JOTAI_DEFAULT_STORE__!==o4&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),o4)});var XHe=v(Mn=>{"use strict";var i4=Symbol.for("react.element"),ksr=Symbol.for("react.portal"),$sr=Symbol.for("react.fragment"),Bsr=Symbol.for("react.strict_mode"),qsr=Symbol.for("react.profiler"),Usr=Symbol.for("react.provider"),zsr=Symbol.for("react.context"),Hsr=Symbol.for("react.forward_ref"),Vsr=Symbol.for("react.suspense"),Wsr=Symbol.for("react.memo"),Ksr=Symbol.for("react.lazy"),UHe=Symbol.iterator;function Gsr(t){return t===null||typeof t!="object"?null:(t=UHe&&t[UHe]||t["@@iterator"],typeof t=="function"?t:null)}var VHe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},WHe=Object.assign,KHe={};function dF(t,e,r){this.props=t,this.context=e,this.refs=KHe,this.updater=r||VHe}dF.prototype.isReactComponent={};dF.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")};dF.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function GHe(){}GHe.prototype=dF.prototype;function Uhe(t,e,r){this.props=t,this.context=e,this.refs=KHe,this.updater=r||VHe}var zhe=Uhe.prototype=new GHe;zhe.constructor=Uhe;WHe(zhe,dF.prototype);zhe.isPureReactComponent=!0;var zHe=Array.isArray,JHe=Object.prototype.hasOwnProperty,Hhe={current:null},YHe={key:!0,ref:!0,__self:!0,__source:!0};function ZHe(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)JHe.call(e,n)&&!YHe.hasOwnProperty(n)&&(o[n]=e[n]);var s=arguments.length-2;if(s===1)o.children=r;else if(1{"use strict";QHe.exports=XHe()});function a4(t,e){let r=tVe(e),[[n,o,i],a]=(0,Ld.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,Ld.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);Khe(c)&&rVe(eVe(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,Ld.useDebugValue)(s),Khe(s)){let l=eVe(s);return eur(l)}return s}function tur(t,e){let r=tVe(e);return(0,Ld.useCallback)((...o)=>{if((QG.env?QG.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function s4(t,e){return[a4(t,e),tur(t,e)]}var Ld,QG,Qsr,tVe,Khe,rVe,eur,Whe,eVe,nVe=w(()=>{"use client";Ld=F(X(),1);Bhe();QG={},Qsr=(0,Ld.createContext)(void 0),tVe=t=>{let e=(0,Ld.useContext)(Qsr);return t?.store||e||qHe()},Khe=t=>typeof t?.then=="function",rVe=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},eur=Ld.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(rVe(t),t)}),Whe=new WeakMap,eVe=t=>{let e=Whe.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((QG.env?QG.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");Khe(l)?(Whe.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),Whe.set(t,e)),e}});var u4=w(()=>{Bhe();nVe()});function zE(t){let e=rur({...ue(),...t});ls.set(RR,e)}function dt(t,e){let r=ue();zE({...r,[t]:e})}function ue(){return ls.get(RR)}function iVe(){let t={...Ic,activeModels:Zb.map(e=>({...e,enabled:!0})),activeEmbeddingModels:jR.map(e=>({...e,enabled:!0}))};zE(t)}function xa(t){let e=ue();return ls.sub(RR,()=>{let r=ue();t(e,r),e=r})}function Rn(){return a4(RR,{store:ls})}function aVe(t){let e=t||Ic;e.userId||(e.userId=bC()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(u=>({...u,provider:u.provider==="azure_openai"?"azure openai":u.provider})):e.activeEmbeddingModels=jR.map(u=>({...u,enabled:!0}));let r={...e},n=Number(e.temperature);r.temperature=isNaN(n)?Ic.temperature:n;let o=Number(e.maxTokens);r.maxTokens=isNaN(o)?Ic.maxTokens:o;let i=Number(e.contextTurns);r.contextTurns=isNaN(i)?Ic.contextTurns:i;let a=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?Ic.embeddingRequestsPerMin:a;let s=Number(e.embeddingBatchSize);return r.embeddingBatchSize=isNaN(s)?Ic.embeddingBatchSize:s,typeof r.includeActiveNoteAsContext!="boolean"&&(r.includeActiveNoteAsContext=Ic.includeActiveNoteAsContext),typeof r.passMarkdownImages!="boolean"&&(r.passMarkdownImages=Ic.passMarkdownImages),typeof r.enableCustomPromptTemplating!="boolean"&&(r.enableCustomPromptTemplating=Ic.enableCustomPromptTemplating),typeof r.allowAdditionalContext!="boolean"&&(r.allowAdditionalContext=Ic.allowAdditionalContext),typeof r.enableWordCompletion!="boolean"&&(r.enableWordCompletion=Ic.enableWordCompletion),r}function sVe(){return ue().isPlusUser?lVe:""}function Yb(){let t=ue().userSystemPrompt,e=uVe;return t?`${e} ${t} -`:e}function Zsr(t){return t.activeModels=rVe(t.activeModels,Zb),t.activeEmbeddingModels=rVe(t.activeEmbeddingModels,jR),t}function kr(t){return`${t.name}|${t.provider}`}function rVe(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(kr(n),{...n})}),t.forEach(n=>{let o=kr(n),i=r.get(o);if(i){let a=e.find(s=>s.name===n.name&&s.provider===n.provider);a?r.set(o,{...a,...n,isBuiltIn:!0,believerExclusive:a.believerExclusive}):r.set(o,{...n,isBuiltIn:i.isBuiltIn})}else r.set(o,n)}),Array.from(r.values())}var ls,RR,nr=w(()=>{s4();l2();$r();ls=lF(),RR=Ih(Ic)});function ie(...t){ue().debug&&console.log(...t)}function fe(...t){ue().debug&&console.error(...t)}function Mh(...t){ue().debug&&console.warn(...t)}var yo=w(()=>{nr()});var uVe=v((Vhe,dF)=>{(function(t,e){typeof Vhe=="object"&&typeof dF<"u"?dF.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(Vhe,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(_){t=_}function n(_){return _ instanceof Array||Object.prototype.toString.call(_)==="[object Array]"}function o(_){return _!=null&&Object.prototype.toString.call(_)==="[object Object]"}function i(_,C){return Object.prototype.hasOwnProperty.call(_,C)}function a(_){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(_).length===0;var C;for(C in _)if(i(_,C))return!1;return!0}function s(_){return _===void 0}function u(_){return typeof _=="number"||Object.prototype.toString.call(_)==="[object Number]"}function l(_){return _ instanceof Date||Object.prototype.toString.call(_)==="[object Date]"}function c(_,C){var T=[],M,L=_.length;for(M=0;M>>0,M;for(M=0;M0)for(T=0;T`:e}function rur(t){return t.activeModels=oVe(t.activeModels,Zb),t.activeEmbeddingModels=oVe(t.activeEmbeddingModels,jR),t}function kr(t){return`${t.name}|${t.provider}`}function oVe(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(kr(n),{...n})}),t.forEach(n=>{let o=kr(n),i=r.get(o);if(i){let a=e.find(s=>s.name===n.name&&s.provider===n.provider);a?r.set(o,{...a,...n,isBuiltIn:!0,believerExclusive:a.believerExclusive}):r.set(o,{...n,isBuiltIn:i.isBuiltIn})}else r.set(o,n)}),Array.from(r.values())}var ls,RR,nr=w(()=>{u4();c2();$r();ls=cF(),RR=Ih(Ic)});function ie(...t){ue().debug&&console.log(...t)}function fe(...t){ue().debug&&console.error(...t)}function Mh(...t){ue().debug&&console.warn(...t)}var yo=w(()=>{nr()});var cVe=v((Ghe,fF)=>{(function(t,e){typeof Ghe=="object"&&typeof fF<"u"?fF.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(Ghe,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(_){t=_}function n(_){return _ instanceof Array||Object.prototype.toString.call(_)==="[object Array]"}function o(_){return _!=null&&Object.prototype.toString.call(_)==="[object Object]"}function i(_,C){return Object.prototype.hasOwnProperty.call(_,C)}function a(_){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(_).length===0;var C;for(C in _)if(i(_,C))return!1;return!0}function s(_){return _===void 0}function u(_){return typeof _=="number"||Object.prototype.toString.call(_)==="[object Number]"}function l(_){return _ instanceof Date||Object.prototype.toString.call(_)==="[object Date]"}function c(_,C){var T=[],M,L=_.length;for(M=0;M>>0,M;for(M=0;M0)for(T=0;T=0;return(Z?T?"+":"":"-")+Math.pow(10,Math.max(0,L)).toString().substr(1)+M}var D=/(\[[^\[]*\])|(\\)?([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,B=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,q={},K={};function H(_,C,T,M){var L=M;typeof M=="string"&&(L=function(){return this[M]()}),_&&(K[_]=L),C&&(K[C[0]]=function(){return J(L.apply(this,arguments),C[1],C[2])}),T&&(K[T]=function(){return this.localeData().ordinal(L.apply(this,arguments),_)})}function ee(_){return _.match(/\[[\s\S]/)?_.replace(/^\[|\]$/g,""):_.replace(/\\/g,"")}function U(_){var C=_.match(D),T,M;for(T=0,M=C.length;T=0&&B.test(_);)_=_.replace(B,M),B.lastIndex=0,T-=1;return _}var ae={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 Oe(_){var C=this._longDateFormat[_],T=this._longDateFormat[_.toUpperCase()];return C||!T?C:(this._longDateFormat[_]=T.match(D).map(function(M){return M==="MMMM"||M==="MM"||M==="DD"||M==="dddd"?M.slice(1):M}).join(""),this._longDateFormat[_])}var le="Invalid date";function Be(){return this._invalidDate}var ze="%d",rt=/\d{1,2}/;function cr(_){return this._ordinal.replace("%d",_)}var wn={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 Le(_,C,T,M){var L=this._relativeTime[T];return N(L)?L(_,C,T,M):L.replace(/%d/i,_)}function pt(_,C){var T=this._relativeTime[_>0?"future":"past"];return N(T)?T(C):T.replace(/%s/i,C)}var mt={};function ht(_,C){var T=_.toLowerCase();mt[T]=mt[T+"s"]=mt[C]=_}function te(_){return typeof _=="string"?mt[_]||mt[_.toLowerCase()]:void 0}function et(_){var C={},T,M;for(M in _)i(_,M)&&(T=te(M),T&&(C[T]=_[M]));return C}var Re={};function Pe(_,C){Re[_]=C}function oe(_){var C=[],T;for(T in _)i(_,T)&&C.push({unit:T,priority:Re[T]});return C.sort(function(M,L){return M.priority-L.priority}),C}function se(_){return _%4===0&&_%100!==0||_%400===0}function ce(_){return _<0?Math.ceil(_)||0:Math.floor(_)}function Ce(_){var C=+_,T=0;return C!==0&&isFinite(C)&&(T=ce(C)),T}function Je(_,C){return function(T){return T!=null?(ea(this,_,T),e.updateOffset(this,C),this):ir(this,_)}}function ir(_,C){return _.isValid()?_._d["get"+(_._isUTC?"UTC":"")+C]():NaN}function ea(_,C,T){_.isValid()&&!isNaN(T)&&(C==="FullYear"&&se(_.year())&&_.month()===1&&_.date()===29?(T=Ce(T),_._d["set"+(_._isUTC?"UTC":"")+C](T,_.month(),iK(T,_.month()))):_._d["set"+(_._isUTC?"UTC":"")+C](T))}function ta(_){return _=te(_),N(this[_])?this[_]():this}function xc(_,C){if(typeof _=="object"){_=et(_);var T=oe(_),M,L=T.length;for(M=0;M68?1900:2e3)};var jqe=Je("FullYear",!0);function lZt(){return se(this.year())}function cZt(_,C,T,M,L,Z,he){var tr;return _<100&&_>=0?(tr=new Date(_+400,C,T,M,L,Z,he),isFinite(tr.getFullYear())&&tr.setFullYear(_)):tr=new Date(_,C,T,M,L,Z,he),tr}function n2(_){var C,T;return _<100&&_>=0?(T=Array.prototype.slice.call(arguments),T[0]=_+400,C=new Date(Date.UTC.apply(null,T)),isFinite(C.getUTCFullYear())&&C.setUTCFullYear(_)):C=new Date(Date.UTC.apply(null,arguments)),C}function aK(_,C,T){var M=7+C-T,L=(7+n2(_,0,M).getUTCDay()-C)%7;return-L+M-1}function Nqe(_,C,T,M,L){var Z=(7+T-M)%7,he=aK(_,M,L),tr=1+7*(C-1)+Z+he,an,Ci;return tr<=0?(an=_-1,Ci=r2(an)+tr):tr>r2(_)?(an=_+1,Ci=tr-r2(_)):(an=_,Ci=tr),{year:an,dayOfYear:Ci}}function o2(_,C,T){var M=aK(_.year(),C,T),L=Math.floor((_.dayOfYear()-M-1)/7)+1,Z,he;return L<1?(he=_.year()-1,Z=L+dC(he,C,T)):L>dC(_.year(),C,T)?(Z=L-dC(_.year(),C,T),he=_.year()+1):(he=_.year(),Z=L),{week:Z,year:he}}function dC(_,C,T){var M=aK(_,C,T),L=aK(_+1,C,T);return(r2(_)-M+L)/7}H("w",["ww",2],"wo","week"),H("W",["WW",2],"Wo","isoWeek"),ht("week","w"),ht("isoWeek","W"),Pe("week",5),Pe("isoWeek",5),Ye("w",Sn),Ye("ww",Sn,qi),Ye("W",Sn),Ye("WW",Sn,qi),uy(["w","ww","W","WW"],function(_,C,T,M){C[M.substr(0,1)]=Ce(_)});function dZt(_){return o2(_,this._week.dow,this._week.doy).week}var fZt={dow:0,doy:6};function pZt(){return this._week.dow}function mZt(){return this._week.doy}function hZt(_){var C=this.localeData().week(this);return _==null?C:this.add((_-C)*7,"d")}function gZt(_){var C=o2(this,1,4).week;return _==null?C:this.add((_-C)*7,"d")}H("d",0,"do","day"),H("dd",0,0,function(_){return this.localeData().weekdaysMin(this,_)}),H("ddd",0,0,function(_){return this.localeData().weekdaysShort(this,_)}),H("dddd",0,0,function(_){return this.localeData().weekdays(this,_)}),H("e",0,0,"weekday"),H("E",0,0,"isoWeekday"),ht("day","d"),ht("weekday","e"),ht("isoWeekday","E"),Pe("day",11),Pe("weekday",11),Pe("isoWeekday",11),Ye("d",Sn),Ye("e",Sn),Ye("E",Sn),Ye("dd",function(_,C){return C.weekdaysMinRegex(_)}),Ye("ddd",function(_,C){return C.weekdaysShortRegex(_)}),Ye("dddd",function(_,C){return C.weekdaysRegex(_)}),uy(["dd","ddd","dddd"],function(_,C,T,M){var L=T._locale.weekdaysParse(_,M,T._strict);L!=null?C.d=L:m(T).invalidWeekday=_}),uy(["d","e","E"],function(_,C,T,M){C[M]=Ce(_)});function yZt(_,C){return typeof _!="string"?_:isNaN(_)?(_=C.weekdaysParse(_),typeof _=="number"?_:null):parseInt(_,10)}function bZt(_,C){return typeof _=="string"?C.weekdaysParse(_)%7||7:isNaN(_)?null:_}function Ffe(_,C){return _.slice(C,7).concat(_.slice(0,C))}var _Zt="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Dqe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),vZt="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),wZt=wf,SZt=wf,xZt=wf;function CZt(_,C){var T=n(this._weekdays)?this._weekdays:this._weekdays[_&&_!==!0&&this._weekdays.isFormat.test(C)?"format":"standalone"];return _===!0?Ffe(T,this._week.dow):_?T[_.day()]:T}function OZt(_){return _===!0?Ffe(this._weekdaysShort,this._week.dow):_?this._weekdaysShort[_.day()]:this._weekdaysShort}function PZt(_){return _===!0?Ffe(this._weekdaysMin,this._week.dow):_?this._weekdaysMin[_.day()]:this._weekdaysMin}function EZt(_,C,T){var M,L,Z,he=_.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],M=0;M<7;++M)Z=f([2e3,1]).day(M),this._minWeekdaysParse[M]=this.weekdaysMin(Z,"").toLocaleLowerCase(),this._shortWeekdaysParse[M]=this.weekdaysShort(Z,"").toLocaleLowerCase(),this._weekdaysParse[M]=this.weekdays(Z,"").toLocaleLowerCase();return T?C==="dddd"?(L=Ss.call(this._weekdaysParse,he),L!==-1?L:null):C==="ddd"?(L=Ss.call(this._shortWeekdaysParse,he),L!==-1?L:null):(L=Ss.call(this._minWeekdaysParse,he),L!==-1?L:null):C==="dddd"?(L=Ss.call(this._weekdaysParse,he),L!==-1||(L=Ss.call(this._shortWeekdaysParse,he),L!==-1)?L:(L=Ss.call(this._minWeekdaysParse,he),L!==-1?L:null)):C==="ddd"?(L=Ss.call(this._shortWeekdaysParse,he),L!==-1||(L=Ss.call(this._weekdaysParse,he),L!==-1)?L:(L=Ss.call(this._minWeekdaysParse,he),L!==-1?L:null)):(L=Ss.call(this._minWeekdaysParse,he),L!==-1||(L=Ss.call(this._weekdaysParse,he),L!==-1)?L:(L=Ss.call(this._shortWeekdaysParse,he),L!==-1?L:null))}function TZt(_,C,T){var M,L,Z;if(this._weekdaysParseExact)return EZt.call(this,_,C,T);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),M=0;M<7;M++){if(L=f([2e3,1]).day(M),T&&!this._fullWeekdaysParse[M]&&(this._fullWeekdaysParse[M]=new RegExp("^"+this.weekdays(L,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[M]=new RegExp("^"+this.weekdaysShort(L,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[M]=new RegExp("^"+this.weekdaysMin(L,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[M]||(Z="^"+this.weekdays(L,"")+"|^"+this.weekdaysShort(L,"")+"|^"+this.weekdaysMin(L,""),this._weekdaysParse[M]=new RegExp(Z.replace(".",""),"i")),T&&C==="dddd"&&this._fullWeekdaysParse[M].test(_))return M;if(T&&C==="ddd"&&this._shortWeekdaysParse[M].test(_))return M;if(T&&C==="dd"&&this._minWeekdaysParse[M].test(_))return M;if(!T&&this._weekdaysParse[M].test(_))return M}}function AZt(_){if(!this.isValid())return _!=null?this:NaN;var C=this._isUTC?this._d.getUTCDay():this._d.getDay();return _!=null?(_=yZt(_,this.localeData()),this.add(_-C,"d")):C}function IZt(_){if(!this.isValid())return _!=null?this:NaN;var C=(this.day()+7-this.localeData()._week.dow)%7;return _==null?C:this.add(_-C,"d")}function MZt(_){if(!this.isValid())return _!=null?this:NaN;if(_!=null){var C=bZt(_,this.localeData());return this.day(this.day()%7?C:C-7)}else return this.day()||7}function RZt(_){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||kfe.call(this),_?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=wZt),this._weekdaysStrictRegex&&_?this._weekdaysStrictRegex:this._weekdaysRegex)}function jZt(_){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||kfe.call(this),_?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=SZt),this._weekdaysShortStrictRegex&&_?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function NZt(_){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||kfe.call(this),_?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=xZt),this._weekdaysMinStrictRegex&&_?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function kfe(){function _(xf,gC){return gC.length-xf.length}var C=[],T=[],M=[],L=[],Z,he,tr,an,Ci;for(Z=0;Z<7;Z++)he=f([2e3,1]).day(Z),tr=vl(this.weekdaysMin(he,"")),an=vl(this.weekdaysShort(he,"")),Ci=vl(this.weekdays(he,"")),C.push(tr),T.push(an),M.push(Ci),L.push(tr),L.push(an),L.push(Ci);C.sort(_),T.sort(_),M.sort(_),L.sort(_),this._weekdaysRegex=new RegExp("^("+L.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+M.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+T.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+C.join("|")+")","i")}function $fe(){return this.hours()%12||12}function DZt(){return this.hours()||24}H("H",["HH",2],0,"hour"),H("h",["hh",2],0,$fe),H("k",["kk",2],0,DZt),H("hmm",0,0,function(){return""+$fe.apply(this)+J(this.minutes(),2)}),H("hmmss",0,0,function(){return""+$fe.apply(this)+J(this.minutes(),2)+J(this.seconds(),2)}),H("Hmm",0,0,function(){return""+this.hours()+J(this.minutes(),2)}),H("Hmmss",0,0,function(){return""+this.hours()+J(this.minutes(),2)+J(this.seconds(),2)});function Lqe(_,C){H(_,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),C)})}Lqe("a",!0),Lqe("A",!1),ht("hour","h"),Pe("hour",13);function Fqe(_,C){return C._meridiemParse}Ye("a",Fqe),Ye("A",Fqe),Ye("H",Sn),Ye("h",Sn),Ye("k",Sn),Ye("HH",Sn,qi),Ye("hh",Sn,qi),Ye("kk",Sn,qi),Ye("hmm",_f),Ye("hmmss",sC),Ye("Hmm",_f),Ye("Hmmss",sC),En(["H","HH"],wl),En(["k","kk"],function(_,C,T){var M=Ce(_);C[wl]=M===24?0:M}),En(["a","A"],function(_,C,T){T._isPm=T._locale.isPM(_),T._meridiem=_}),En(["h","hh"],function(_,C,T){C[wl]=Ce(_),m(T).bigHour=!0}),En("hmm",function(_,C,T){var M=_.length-2;C[wl]=Ce(_.substr(0,M)),C[ly]=Ce(_.substr(M)),m(T).bigHour=!0}),En("hmmss",function(_,C,T){var M=_.length-4,L=_.length-2;C[wl]=Ce(_.substr(0,M)),C[ly]=Ce(_.substr(M,2)),C[cC]=Ce(_.substr(L)),m(T).bigHour=!0}),En("Hmm",function(_,C,T){var M=_.length-2;C[wl]=Ce(_.substr(0,M)),C[ly]=Ce(_.substr(M))}),En("Hmmss",function(_,C,T){var M=_.length-4,L=_.length-2;C[wl]=Ce(_.substr(0,M)),C[ly]=Ce(_.substr(M,2)),C[cC]=Ce(_.substr(L))});function LZt(_){return(_+"").toLowerCase().charAt(0)==="p"}var FZt=/[ap]\.?m?\.?/i,kZt=Je("Hours",!0);function $Zt(_,C,T){return _>11?T?"pm":"PM":T?"am":"AM"}var kqe={calendar:V,longDateFormat:ae,invalidDate:le,ordinal:ze,dayOfMonthOrdinalParse:rt,relativeTime:wn,months:QYt,monthsShort:Tqe,week:fZt,weekdays:_Zt,weekdaysMin:vZt,weekdaysShort:Dqe,meridiemParse:FZt},wa={},i2={},a2;function BZt(_,C){var T,M=Math.min(_.length,C.length);for(T=0;T0;){if(L=sK(Z.slice(0,T).join("-")),L)return L;if(M&&M.length>=T&&BZt(Z,M)>=T-1)break;T--}C++}return a2}function UZt(_){return _.match("^[^/\\\\]*$")!=null}function sK(_){var C=null,T;if(wa[_]===void 0&&typeof dF<"u"&&dF&&dF.exports&&UZt(_))try{C=a2._abbr,T=require,T("./locale/"+_),wE(C)}catch{wa[_]=null}return wa[_]}function wE(_,C){var T;return _&&(s(C)?T=fC(_):T=Bfe(_,C),T?a2=T:typeof console<"u"&&console.warn&&console.warn("Locale "+_+" not found. Did you forget to load it?")),a2._abbr}function Bfe(_,C){if(C!==null){var T,M=kqe;if(C.abbr=_,wa[_]!=null)R("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),M=wa[_]._config;else if(C.parentLocale!=null)if(wa[C.parentLocale]!=null)M=wa[C.parentLocale]._config;else if(T=sK(C.parentLocale),T!=null)M=T._config;else return i2[C.parentLocale]||(i2[C.parentLocale]=[]),i2[C.parentLocale].push({name:_,config:C}),null;return wa[_]=new k($(M,C)),i2[_]&&i2[_].forEach(function(L){Bfe(L.name,L.config)}),wE(_),wa[_]}else return delete wa[_],null}function zZt(_,C){if(C!=null){var T,M,L=kqe;wa[_]!=null&&wa[_].parentLocale!=null?wa[_].set($(wa[_]._config,C)):(M=sK(_),M!=null&&(L=M._config),C=$(L,C),M==null&&(C.abbr=_),T=new k(C),T.parentLocale=wa[_],wa[_]=T),wE(_)}else wa[_]!=null&&(wa[_].parentLocale!=null?(wa[_]=wa[_].parentLocale,_===wE()&&wE(_)):wa[_]!=null&&delete wa[_]);return wa[_]}function fC(_){var C;if(_&&_._locale&&_._locale._abbr&&(_=_._locale._abbr),!_)return a2;if(!n(_)){if(C=sK(_),C)return C;_=[_]}return qZt(_)}function HZt(){return z(wa)}function qfe(_){var C,T=_._a;return T&&m(_).overflow===-2&&(C=T[lC]<0||T[lC]>11?lC:T[$b]<1||T[$b]>iK(T[Pd],T[lC])?$b:T[wl]<0||T[wl]>24||T[wl]===24&&(T[ly]!==0||T[cC]!==0||T[KM]!==0)?wl:T[ly]<0||T[ly]>59?ly:T[cC]<0||T[cC]>59?cC:T[KM]<0||T[KM]>999?KM:-1,m(_)._overflowDayOfYear&&(C$b)&&(C=$b),m(_)._overflowWeeks&&C===-1&&(C=YYt),m(_)._overflowWeekday&&C===-1&&(C=ZYt),m(_).overflow=C),_}var VZt=/^\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)?)?$/,WZt=/^\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)?)?$/,KZt=/Z|[+-]\d\d(?::?\d\d)?/,uK=[["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]],Ufe=[["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/]],GZt=/^\/?Date\((-?\d+)/i,JZt=/^(?:(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}))$/,YZt={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 Bqe(_){var C,T,M=_._i,L=VZt.exec(M)||WZt.exec(M),Z,he,tr,an,Ci=uK.length,xf=Ufe.length;if(L){for(m(_).iso=!0,C=0,T=Ci;Cr2(he)||_._dayOfYear===0)&&(m(_)._overflowDayOfYear=!0),T=n2(he,0,_._dayOfYear),_._a[lC]=T.getUTCMonth(),_._a[$b]=T.getUTCDate()),C=0;C<3&&_._a[C]==null;++C)_._a[C]=M[C]=L[C];for(;C<7;C++)_._a[C]=M[C]=_._a[C]==null?C===2?1:0:_._a[C];_._a[wl]===24&&_._a[ly]===0&&_._a[cC]===0&&_._a[KM]===0&&(_._nextDay=!0,_._a[wl]=0),_._d=(_._useUTC?n2:cZt).apply(null,M),Z=_._useUTC?_._d.getUTCDay():_._d.getDay(),_._tzm!=null&&_._d.setUTCMinutes(_._d.getUTCMinutes()-_._tzm),_._nextDay&&(_._a[wl]=24),_._w&&typeof _._w.d<"u"&&_._w.d!==Z&&(m(_).weekdayMismatch=!0)}}function oXt(_){var C,T,M,L,Z,he,tr,an,Ci;C=_._w,C.GG!=null||C.W!=null||C.E!=null?(Z=1,he=4,T=TL(C.GG,_._a[Pd],o2(ra(),1,4).year),M=TL(C.W,1),L=TL(C.E,1),(L<1||L>7)&&(an=!0)):(Z=_._locale._week.dow,he=_._locale._week.doy,Ci=o2(ra(),Z,he),T=TL(C.gg,_._a[Pd],Ci.year),M=TL(C.w,Ci.week),C.d!=null?(L=C.d,(L<0||L>6)&&(an=!0)):C.e!=null?(L=C.e+Z,(C.e<0||C.e>6)&&(an=!0)):L=Z),M<1||M>dC(T,Z,he)?m(_)._overflowWeeks=!0:an!=null?m(_)._overflowWeekday=!0:(tr=Nqe(T,M,L,Z,he),_._a[Pd]=tr.year,_._dayOfYear=tr.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function Hfe(_){if(_._f===e.ISO_8601){Bqe(_);return}if(_._f===e.RFC_2822){qqe(_);return}_._a=[],m(_).empty=!0;var C=""+_._i,T,M,L,Z,he,tr=C.length,an=0,Ci,xf;for(L=Y(_._f,_._locale).match(D)||[],xf=L.length,T=0;T0&&m(_).unusedInput.push(he),C=C.slice(C.indexOf(M)+M.length),an+=M.length),K[Z]?(M?m(_).empty=!1:m(_).unusedTokens.push(Z),t2(Z,M,_)):_._strict&&!M&&m(_).unusedTokens.push(Z);m(_).charsLeftOver=tr-an,C.length>0&&m(_).unusedInput.push(C),_._a[wl]<=12&&m(_).bigHour===!0&&_._a[wl]>0&&(m(_).bigHour=void 0),m(_).parsedDateParts=_._a.slice(0),m(_).meridiem=_._meridiem,_._a[wl]=iXt(_._locale,_._a[wl],_._meridiem),Ci=m(_).era,Ci!==null&&(_._a[Pd]=_._locale.erasConvertYear(Ci,_._a[Pd])),zfe(_),qfe(_)}function iXt(_,C,T){var M;return T==null?C:_.meridiemHour!=null?_.meridiemHour(C,T):(_.isPM!=null&&(M=_.isPM(T),M&&C<12&&(C+=12),!M&&C===12&&(C=0)),C)}function aXt(_){var C,T,M,L,Z,he,tr=!1,an=_._f.length;if(an===0){m(_).invalidFormat=!0,_._d=new Date(NaN);return}for(L=0;Lthis?this:_:g()});function Hqe(_,C){var T,M;if(C.length===1&&n(C[0])&&(C=C[0]),!C.length)return ra();for(T=C[0],M=1;Mthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function EXt(){if(!s(this._isDSTShifted))return this._isDSTShifted;var _={},C;return x(_,this),_=Uqe(_),_._a?(C=_._isUTC?f(_._a):ra(_._a),this._isDSTShifted=this.isValid()&&bXt(_._a,C.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function TXt(){return this.isValid()?!this._isUTC:!1}function AXt(){return this.isValid()?this._isUTC:!1}function Wqe(){return this.isValid()?this._isUTC&&this._offset===0:!1}var IXt=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,MXt=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function cy(_,C){var T=_,M=null,L,Z,he;return cK(_)?T={ms:_._milliseconds,d:_._days,M:_._months}:u(_)||!isNaN(+_)?(T={},C?T[C]=+_:T.milliseconds=+_):(M=IXt.exec(_))?(L=M[1]==="-"?-1:1,T={y:0,d:Ce(M[$b])*L,h:Ce(M[wl])*L,m:Ce(M[ly])*L,s:Ce(M[cC])*L,ms:Ce(Vfe(M[KM]*1e3))*L}):(M=MXt.exec(_))?(L=M[1]==="-"?-1:1,T={y:GM(M[2],L),M:GM(M[3],L),w:GM(M[4],L),d:GM(M[5],L),h:GM(M[6],L),m:GM(M[7],L),s:GM(M[8],L)}):T==null?T={}:typeof T=="object"&&("from"in T||"to"in T)&&(he=RXt(ra(T.from),ra(T.to)),T={},T.ms=he.milliseconds,T.M=he.months),Z=new lK(T),cK(_)&&i(_,"_locale")&&(Z._locale=_._locale),cK(_)&&i(_,"_isValid")&&(Z._isValid=_._isValid),Z}cy.fn=lK.prototype,cy.invalid=yXt;function GM(_,C){var T=_&&parseFloat(_.replace(",","."));return(isNaN(T)?0:T)*C}function Kqe(_,C){var T={};return T.months=C.month()-_.month()+(C.year()-_.year())*12,_.clone().add(T.months,"M").isAfter(C)&&--T.months,T.milliseconds=+C-+_.clone().add(T.months,"M"),T}function RXt(_,C){var T;return _.isValid()&&C.isValid()?(C=Kfe(C,_),_.isBefore(C)?T=Kqe(_,C):(T=Kqe(C,_),T.milliseconds=-T.milliseconds,T.months=-T.months),T):{milliseconds:0,months:0}}function Gqe(_,C){return function(T,M){var L,Z;return M!==null&&!isNaN(+M)&&(R(C,"moment()."+C+"(period, number) is deprecated. Please use moment()."+C+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),Z=T,T=M,M=Z),L=cy(T,M),Jqe(this,L,_),this}}function Jqe(_,C,T,M){var L=C._milliseconds,Z=Vfe(C._days),he=Vfe(C._months);_.isValid()&&(M=M??!0,he&&Iqe(_,ir(_,"Month")+he*T),Z&&ea(_,"Date",ir(_,"Date")+Z*T),L&&_._d.setTime(_._d.valueOf()+L*T),M&&e.updateOffset(_,Z||he))}var jXt=Gqe(1,"add"),NXt=Gqe(-1,"subtract");function Yqe(_){return typeof _=="string"||_ instanceof String}function DXt(_){return P(_)||l(_)||Yqe(_)||u(_)||FXt(_)||LXt(_)||_===null||_===void 0}function LXt(_){var C=o(_)&&!a(_),T=!1,M=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],L,Z,he=M.length;for(L=0;LT.valueOf():T.valueOf()9999?W(T,C?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):N(Date.prototype.toISOString)?C?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",W(T,"Z")):W(T,C?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function ZXt(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var _="moment",C="",T,M,L,Z;return this.isLocal()||(_=this.utcOffset()===0?"moment.utc":"moment.parseZone",C="Z"),T="["+_+'("]',M=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",L="-MM-DD[T]HH:mm:ss.SSS",Z=C+'[")]',this.format(T+M+L+Z)}function XXt(_){_||(_=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var C=W(this,_);return this.localeData().postformat(C)}function QXt(_,C){return this.isValid()&&(P(_)&&_.isValid()||ra(_).isValid())?cy({to:this,from:_}).locale(this.locale()).humanize(!C):this.localeData().invalidDate()}function eQt(_){return this.from(ra(),_)}function tQt(_,C){return this.isValid()&&(P(_)&&_.isValid()||ra(_).isValid())?cy({from:this,to:_}).locale(this.locale()).humanize(!C):this.localeData().invalidDate()}function rQt(_){return this.to(ra(),_)}function Zqe(_){var C;return _===void 0?this._locale._abbr:(C=fC(_),C!=null&&(this._locale=C),this)}var Xqe=A("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(_){return _===void 0?this.localeData():this.locale(_)});function Qqe(){return this._locale}var fK=1e3,AL=60*fK,pK=60*AL,eUe=(365*400+97)*24*pK;function IL(_,C){return(_%C+C)%C}function tUe(_,C,T){return _<100&&_>=0?new Date(_+400,C,T)-eUe:new Date(_,C,T).valueOf()}function rUe(_,C,T){return _<100&&_>=0?Date.UTC(_+400,C,T)-eUe:Date.UTC(_,C,T)}function nQt(_){var C,T;if(_=te(_),_===void 0||_==="millisecond"||!this.isValid())return this;switch(T=this._isUTC?rUe:tUe,_){case"year":C=T(this.year(),0,1);break;case"quarter":C=T(this.year(),this.month()-this.month()%3,1);break;case"month":C=T(this.year(),this.month(),1);break;case"week":C=T(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":C=T(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":C=T(this.year(),this.month(),this.date());break;case"hour":C=this._d.valueOf(),C-=IL(C+(this._isUTC?0:this.utcOffset()*AL),pK);break;case"minute":C=this._d.valueOf(),C-=IL(C,AL);break;case"second":C=this._d.valueOf(),C-=IL(C,fK);break}return this._d.setTime(C),e.updateOffset(this,!0),this}function oQt(_){var C,T;if(_=te(_),_===void 0||_==="millisecond"||!this.isValid())return this;switch(T=this._isUTC?rUe:tUe,_){case"year":C=T(this.year()+1,0,1)-1;break;case"quarter":C=T(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":C=T(this.year(),this.month()+1,1)-1;break;case"week":C=T(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":C=T(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":C=T(this.year(),this.month(),this.date()+1)-1;break;case"hour":C=this._d.valueOf(),C+=pK-IL(C+(this._isUTC?0:this.utcOffset()*AL),pK)-1;break;case"minute":C=this._d.valueOf(),C+=AL-IL(C,AL)-1;break;case"second":C=this._d.valueOf(),C+=fK-IL(C,fK)-1;break}return this._d.setTime(C),e.updateOffset(this,!0),this}function iQt(){return this._d.valueOf()-(this._offset||0)*6e4}function aQt(){return Math.floor(this.valueOf()/1e3)}function sQt(){return new Date(this.valueOf())}function uQt(){var _=this;return[_.year(),_.month(),_.date(),_.hour(),_.minute(),_.second(),_.millisecond()]}function lQt(){var _=this;return{years:_.year(),months:_.month(),date:_.date(),hours:_.hours(),minutes:_.minutes(),seconds:_.seconds(),milliseconds:_.milliseconds()}}function cQt(){return this.isValid()?this.toISOString():null}function dQt(){return b(this)}function fQt(){return d({},m(this))}function pQt(){return m(this).overflow}function mQt(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}H("N",0,0,"eraAbbr"),H("NN",0,0,"eraAbbr"),H("NNN",0,0,"eraAbbr"),H("NNNN",0,0,"eraName"),H("NNNNN",0,0,"eraNarrow"),H("y",["y",1],"yo","eraYear"),H("y",["yy",2],0,"eraYear"),H("y",["yyy",3],0,"eraYear"),H("y",["yyyy",4],0,"eraYear"),Ye("N",Jfe),Ye("NN",Jfe),Ye("NNN",Jfe),Ye("NNNN",OQt),Ye("NNNNN",PQt),En(["N","NN","NNN","NNNN","NNNNN"],function(_,C,T,M){var L=T._locale.erasParse(_,M,T._strict);L?m(T).era=L:m(T).invalidEra=_}),Ye("y",La),Ye("yy",La),Ye("yyy",La),Ye("yyyy",La),Ye("yo",EQt),En(["y","yy","yyy","yyyy"],Pd),En(["yo"],function(_,C,T,M){var L;T._locale._eraYearOrdinalRegex&&(L=_.match(T._locale._eraYearOrdinalRegex)),T._locale.eraYearOrdinalParse?C[Pd]=T._locale.eraYearOrdinalParse(_,L):C[Pd]=parseInt(_,10)});function hQt(_,C){var T,M,L,Z=this._eras||fC("en")._eras;for(T=0,M=Z.length;T=0)return Z[M]}function yQt(_,C){var T=_.since<=_.until?1:-1;return C===void 0?e(_.since).year():e(_.since).year()+(C-_.offset)*T}function bQt(){var _,C,T,M=this.localeData().eras();for(_=0,C=M.length;_Z&&(C=Z),NQt.call(this,_,C,T,M,L))}function NQt(_,C,T,M,L){var Z=Nqe(_,C,T,M,L),he=n2(Z.year,0,Z.dayOfYear);return this.year(he.getUTCFullYear()),this.month(he.getUTCMonth()),this.date(he.getUTCDate()),this}H("Q",0,"Qo","quarter"),ht("quarter","Q"),Pe("quarter",7),Ye("Q",Cd),En("Q",function(_,C){C[lC]=(Ce(_)-1)*3});function DQt(_){return _==null?Math.ceil((this.month()+1)/3):this.month((_-1)*3+this.month()%3)}H("D",["DD",2],"Do","date"),ht("date","D"),Pe("date",9),Ye("D",Sn),Ye("DD",Sn,qi),Ye("Do",function(_,C){return _?C._dayOfMonthOrdinalParse||C._ordinalParse:C._dayOfMonthOrdinalParseLenient}),En(["D","DD"],$b),En("Do",function(_,C){C[$b]=Ce(_.match(Sn)[0])});var oUe=Je("Date",!0);H("DDD",["DDDD",3],"DDDo","dayOfYear"),ht("dayOfYear","DDD"),Pe("dayOfYear",4),Ye("DDD",kb),Ye("DDDD",lp),En(["DDD","DDDD"],function(_,C,T){T._dayOfYear=Ce(_)});function LQt(_){var C=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return _==null?C:this.add(_-C,"d")}H("m",["mm",2],0,"minute"),ht("minute","m"),Pe("minute",14),Ye("m",Sn),Ye("mm",Sn,qi),En(["m","mm"],ly);var FQt=Je("Minutes",!1);H("s",["ss",2],0,"second"),ht("second","s"),Pe("second",15),Ye("s",Sn),Ye("ss",Sn,qi),En(["s","ss"],cC);var kQt=Je("Seconds",!1);H("S",0,0,function(){return~~(this.millisecond()/100)}),H(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),H(0,["SSS",3],0,"millisecond"),H(0,["SSSS",4],0,function(){return this.millisecond()*10}),H(0,["SSSSS",5],0,function(){return this.millisecond()*100}),H(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),H(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),H(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),H(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),ht("millisecond","ms"),Pe("millisecond",16),Ye("S",kb,Cd),Ye("SS",kb,qi),Ye("SSS",kb,lp);var SE,iUe;for(SE="SSSS";SE.length<=9;SE+="S")Ye(SE,La);function $Qt(_,C){C[KM]=Ce(("0."+_)*1e3)}for(SE="S";SE.length<=9;SE+="S")En(SE,$Qt);iUe=Je("Milliseconds",!1),H("z",0,0,"zoneAbbr"),H("zz",0,0,"zoneName");function BQt(){return this._isUTC?"UTC":""}function qQt(){return this._isUTC?"Coordinated Universal Time":""}var He=O.prototype;He.add=jXt,He.calendar=BXt,He.clone=qXt,He.diff=GXt,He.endOf=oQt,He.format=XXt,He.from=QXt,He.fromNow=eQt,He.to=tQt,He.toNow=rQt,He.get=ta,He.invalidAt=pQt,He.isAfter=UXt,He.isBefore=zXt,He.isBetween=HXt,He.isSame=VXt,He.isSameOrAfter=WXt,He.isSameOrBefore=KXt,He.isValid=dQt,He.lang=Xqe,He.locale=Zqe,He.localeData=Qqe,He.max=dXt,He.min=cXt,He.parsingFlags=fQt,He.set=xc,He.startOf=nQt,He.subtract=NXt,He.toArray=uQt,He.toObject=lQt,He.toDate=sQt,He.toISOString=YXt,He.inspect=ZXt,typeof Symbol<"u"&&Symbol.for!=null&&(He[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),He.toJSON=cQt,He.toString=JXt,He.unix=aQt,He.valueOf=iQt,He.creationData=mQt,He.eraName=bQt,He.eraNarrow=_Qt,He.eraAbbr=vQt,He.eraYear=wQt,He.year=jqe,He.isLeapYear=lZt,He.weekYear=TQt,He.isoWeekYear=AQt,He.quarter=He.quarters=DQt,He.month=Mqe,He.daysInMonth=aZt,He.week=He.weeks=hZt,He.isoWeek=He.isoWeeks=gZt,He.weeksInYear=RQt,He.weeksInWeekYear=jQt,He.isoWeeksInYear=IQt,He.isoWeeksInISOWeekYear=MQt,He.date=oUe,He.day=He.days=AZt,He.weekday=IZt,He.isoWeekday=MZt,He.dayOfYear=LQt,He.hour=He.hours=kZt,He.minute=He.minutes=FQt,He.second=He.seconds=kQt,He.millisecond=He.milliseconds=iUe,He.utcOffset=vXt,He.utc=SXt,He.local=xXt,He.parseZone=CXt,He.hasAlignedHourOffset=OXt,He.isDST=PXt,He.isLocal=TXt,He.isUtcOffset=AXt,He.isUtc=Wqe,He.isUTC=Wqe,He.zoneAbbr=BQt,He.zoneName=qQt,He.dates=A("dates accessor is deprecated. Use date instead.",oUe),He.months=A("months accessor is deprecated. Use month instead",Mqe),He.years=A("years accessor is deprecated. Use year instead",jqe),He.zone=A("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",wXt),He.isDSTShifted=A("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",EXt);function UQt(_){return ra(_*1e3)}function zQt(){return ra.apply(null,arguments).parseZone()}function aUe(_){return _}var wo=k.prototype;wo.calendar=Q,wo.longDateFormat=Oe,wo.invalidDate=Be,wo.ordinal=cr,wo.preparse=aUe,wo.postformat=aUe,wo.relativeTime=Le,wo.pastFuture=pt,wo.set=j,wo.eras=hQt,wo.erasParse=gQt,wo.erasConvertYear=yQt,wo.erasAbbrRegex=xQt,wo.erasNameRegex=SQt,wo.erasNarrowRegex=CQt,wo.months=rZt,wo.monthsShort=nZt,wo.monthsParse=iZt,wo.monthsRegex=uZt,wo.monthsShortRegex=sZt,wo.week=dZt,wo.firstDayOfYear=mZt,wo.firstDayOfWeek=pZt,wo.weekdays=CZt,wo.weekdaysMin=PZt,wo.weekdaysShort=OZt,wo.weekdaysParse=TZt,wo.weekdaysRegex=RZt,wo.weekdaysShortRegex=jZt,wo.weekdaysMinRegex=NZt,wo.isPM=LZt,wo.meridiem=$Zt;function hK(_,C,T,M){var L=fC(),Z=f().set(M,C);return L[T](Z,_)}function sUe(_,C,T){if(u(_)&&(C=_,_=void 0),_=_||"",C!=null)return hK(_,C,T,"month");var M,L=[];for(M=0;M<12;M++)L[M]=hK(_,M,T,"month");return L}function Zfe(_,C,T,M){typeof _=="boolean"?(u(C)&&(T=C,C=void 0),C=C||""):(C=_,T=C,_=!1,u(C)&&(T=C,C=void 0),C=C||"");var L=fC(),Z=_?L._week.dow:0,he,tr=[];if(T!=null)return hK(C,(T+Z)%7,M,"day");for(he=0;he<7;he++)tr[he]=hK(C,(he+Z)%7,M,"day");return tr}function HQt(_,C){return sUe(_,C,"months")}function VQt(_,C){return sUe(_,C,"monthsShort")}function WQt(_,C,T){return Zfe(_,C,T,"weekdays")}function KQt(_,C,T){return Zfe(_,C,T,"weekdaysShort")}function GQt(_,C,T){return Zfe(_,C,T,"weekdaysMin")}wE("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(_){var C=_%10,T=Ce(_%100/10)===1?"th":C===1?"st":C===2?"nd":C===3?"rd":"th";return _+T}}),e.lang=A("moment.lang is deprecated. Use moment.locale instead.",wE),e.langData=A("moment.langData is deprecated. Use moment.localeData instead.",fC);var pC=Math.abs;function JQt(){var _=this._data;return this._milliseconds=pC(this._milliseconds),this._days=pC(this._days),this._months=pC(this._months),_.milliseconds=pC(_.milliseconds),_.seconds=pC(_.seconds),_.minutes=pC(_.minutes),_.hours=pC(_.hours),_.months=pC(_.months),_.years=pC(_.years),this}function uUe(_,C,T,M){var L=cy(C,T);return _._milliseconds+=M*L._milliseconds,_._days+=M*L._days,_._months+=M*L._months,_._bubble()}function YQt(_,C){return uUe(this,_,C,1)}function ZQt(_,C){return uUe(this,_,C,-1)}function lUe(_){return _<0?Math.floor(_):Math.ceil(_)}function XQt(){var _=this._milliseconds,C=this._days,T=this._months,M=this._data,L,Z,he,tr,an;return _>=0&&C>=0&&T>=0||_<=0&&C<=0&&T<=0||(_+=lUe(Xfe(T)+C)*864e5,C=0,T=0),M.milliseconds=_%1e3,L=ce(_/1e3),M.seconds=L%60,Z=ce(L/60),M.minutes=Z%60,he=ce(Z/60),M.hours=he%24,C+=ce(he/24),an=ce(cUe(C)),T+=an,C-=lUe(Xfe(an)),tr=ce(T/12),T%=12,M.days=C,M.months=T,M.years=tr,this}function cUe(_){return _*4800/146097}function Xfe(_){return _*146097/4800}function QQt(_){if(!this.isValid())return NaN;var C,T,M=this._milliseconds;if(_=te(_),_==="month"||_==="quarter"||_==="year")switch(C=this._days+M/864e5,T=this._months+cUe(C),_){case"month":return T;case"quarter":return T/3;case"year":return T/12}else switch(C=this._days+Math.round(Xfe(this._months)),_){case"week":return C/7+M/6048e5;case"day":return C+M/864e5;case"hour":return C*24+M/36e5;case"minute":return C*1440+M/6e4;case"second":return C*86400+M/1e3;case"millisecond":return Math.floor(C*864e5)+M;default:throw new Error("Unknown unit "+_)}}function eer(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Ce(this._months/12)*31536e6:NaN}function mC(_){return function(){return this.as(_)}}var ter=mC("ms"),rer=mC("s"),ner=mC("m"),oer=mC("h"),ier=mC("d"),aer=mC("w"),ser=mC("M"),uer=mC("Q"),ler=mC("y");function cer(){return cy(this)}function der(_){return _=te(_),this.isValid()?this[_+"s"]():NaN}function JM(_){return function(){return this.isValid()?this._data[_]:NaN}}var fer=JM("milliseconds"),per=JM("seconds"),mer=JM("minutes"),her=JM("hours"),ger=JM("days"),yer=JM("months"),ber=JM("years");function _er(){return ce(this.days()/7)}var hC=Math.round,ML={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function ver(_,C,T,M,L){return L.relativeTime(C||1,!!T,_,M)}function wer(_,C,T,M){var L=cy(_).abs(),Z=hC(L.as("s")),he=hC(L.as("m")),tr=hC(L.as("h")),an=hC(L.as("d")),Ci=hC(L.as("M")),xf=hC(L.as("w")),gC=hC(L.as("y")),xE=Z<=T.ss&&["s",Z]||Z0,xE[4]=M,ver.apply(null,xE)}function Ser(_){return _===void 0?hC:typeof _=="function"?(hC=_,!0):!1}function xer(_,C){return ML[_]===void 0?!1:C===void 0?ML[_]:(ML[_]=C,_==="s"&&(ML.ss=C-1),!0)}function Cer(_,C){if(!this.isValid())return this.localeData().invalidDate();var T=!1,M=ML,L,Z;return typeof _=="object"&&(C=_,_=!1),typeof _=="boolean"&&(T=_),typeof C=="object"&&(M=Object.assign({},ML,C),C.s!=null&&C.ss==null&&(M.ss=C.s-1)),L=this.localeData(),Z=wer(this,!T,M,L),T&&(Z=L.pastFuture(+this,Z)),L.postformat(Z)}var Qfe=Math.abs;function RL(_){return(_>0)-(_<0)||+_}function gK(){if(!this.isValid())return this.localeData().invalidDate();var _=Qfe(this._milliseconds)/1e3,C=Qfe(this._days),T=Qfe(this._months),M,L,Z,he,tr=this.asSeconds(),an,Ci,xf,gC;return tr?(M=ce(_/60),L=ce(M/60),_%=60,M%=60,Z=ce(T/12),T%=12,he=_?_.toFixed(3).replace(/\.?0+$/,""):"",an=tr<0?"-":"",Ci=RL(this._months)!==RL(tr)?"-":"",xf=RL(this._days)!==RL(tr)?"-":"",gC=RL(this._milliseconds)!==RL(tr)?"-":"",an+"P"+(Z?Ci+Z+"Y":"")+(T?Ci+T+"M":"")+(C?xf+C+"D":"")+(L||M||_?"T":"")+(L?gC+L+"H":"")+(M?gC+M+"M":"")+(_?gC+he+"S":"")):"P0D"}var Xn=lK.prototype;Xn.isValid=gXt,Xn.abs=JQt,Xn.add=YQt,Xn.subtract=ZQt,Xn.as=QQt,Xn.asMilliseconds=ter,Xn.asSeconds=rer,Xn.asMinutes=ner,Xn.asHours=oer,Xn.asDays=ier,Xn.asWeeks=aer,Xn.asMonths=ser,Xn.asQuarters=uer,Xn.asYears=ler,Xn.valueOf=eer,Xn._bubble=XQt,Xn.clone=cer,Xn.get=der,Xn.milliseconds=fer,Xn.seconds=per,Xn.minutes=mer,Xn.hours=her,Xn.days=ger,Xn.weeks=_er,Xn.months=yer,Xn.years=ber,Xn.humanize=Cer,Xn.toISOString=gK,Xn.toString=gK,Xn.toJSON=gK,Xn.locale=Zqe,Xn.localeData=Qqe,Xn.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",gK),Xn.lang=Xqe,H("X",0,0,"unix"),H("x",0,0,"valueOf"),Ye("x",vf),Ye("X",cp),En("X",function(_,C,T){T._d=new Date(parseFloat(_)*1e3)}),En("x",function(_,C,T){T._d=new Date(Ce(_))});return e.version="2.29.4",r(ra),e.fn=He,e.min=fXt,e.max=pXt,e.now=mXt,e.utc=f,e.unix=UQt,e.months=HQt,e.isDate=l,e.locale=wE,e.invalid=g,e.duration=cy,e.isMoment=P,e.weekdays=WQt,e.parseZone=zQt,e.localeData=fC,e.isDuration=cK,e.monthsShort=VQt,e.weekdaysMin=GQt,e.defineLocale=Bfe,e.updateLocale=zZt,e.locales=HZt,e.weekdaysShort=KQt,e.normalizeUnits=te,e.relativeTimeRounding=Ser,e.relativeTimeThreshold=xer,e.calendarFormat=$Xt,e.prototype=He,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})});function lVe(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function Xsr(t){let e=lVe(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function cVe(t){let e=lVe(t);return Xsr(t)?Whe.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:Whe.UNKNOWN_ERROR)}function fF(t){return t.replace(/^#/,"").trim().toLowerCase()}function NR(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(fF(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(fF(i))}):typeof n=="string"&&o.add(fF(n))),Array.from(o)}function dVe(t,e,r){if(e.length===0)return[];e=e.map(i=>fF(i));let n=r&&r.length>0?r:Jhe(t,"/"),o=[];for(let i of n){let a=NR(i);e.some(s=>a.includes(s))&&o.push(i)}return o}function Yhe(t){let e=(0,Ghe.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()}:Vl(new Date)}async function pF(t,e){return t.extension!="md"&&t.extension!="canvas"?null:await e.cachedRead(t)}function QG(t){return t.basename}function pVe(t,e){return!t||!e?!1:t.includes(Khe)&&e.includes(Khe)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function DR(t){let e=[],{history:r}=t;for(let n=0;n{let a=i.slice(2,-2),s=e.getAbstractFileByPath(a);if(s instanceof Rh.TFile)o.set(s.path,s);else{let l=e.getMarkdownFiles().filter(c=>c.basename===a);l.length>0&&(Zhe(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 Zhe(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function mVe(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function hVe(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}function gVe(t){return Xhe.test(t)}function Qhe(t){let e=t.match(Xhe);return e?e[0]:null}function yVe(t){let e=t.matchAll(new RegExp(Xhe,"g"));return Array.from(e,r=>r[0])}async function Us(t,e={}){let r=e.headers?{...e.headers}:{};delete r["content-length"],ie("==== safeFetch method request ====");let n=e.method?.toUpperCase()||"POST",i=await(0,Rh.requestUrl)({url:t,contentType:"application/json",headers:r,method:n,...["POST","PUT","PATCH"].includes(n)&&{body:e.body?.toString()},throw:!1});if(i.status>=400){let a;try{a=typeof i.json=="string"?JSON.parse(i.json):i.json}catch{try{a=typeof i.text=="string"?JSON.parse(i.text):i.text}catch{a=null}}let s=new Error(Whe.REQUEST_FAILED(i.status));if(s.json=a,a?.detail?.reason==="Invalid license key"||a?.reason==="Invalid license key")s.message="Invalid license key";else if(a?.detail?.message||a?.message){let u=a?.detail?.message||a?.message,l=a?.detail?.reason||a?.reason;s.message=l?`${u}: ${l}`:u}else a?.detail&&(s.message=JSON.stringify(a.detail));throw s}return{ok:i.status>=200&&i.status<300,status:i.status,statusText:i.status.toString(),headers:new Headers(i.headers),url:t,type:"basic",redirected:!1,bytes:()=>Promise.resolve(new Uint8Array(0)),body:tur(i.text),bodyUsed:!0,json:()=>i.json,text:async()=>i.text,arrayBuffer:async()=>{if(i.arrayBuffer)return i.arrayBuffer;let a=i.text.replace(/^data:.*;base64,/,""),s=atob(a),u=new Uint8Array(s.length);for(let l=0;l{throw new Error("not implemented")},formData:()=>{throw new Error("not implemented")},clone:()=>{throw new Error("not implemented")}}}function tur(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function ei(t,e=!1){return t instanceof Error?t.message+` +`+new Error().stack),T=!1}return C.apply(this,arguments)},C)}var I={};function R(_,C){e.deprecationHandler!=null&&e.deprecationHandler(_,C),I[_]||(E(C),I[_]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function N(_){return typeof Function<"u"&&_ instanceof Function||Object.prototype.toString.call(_)==="[object Function]"}function j(_){var C,T;for(T in _)i(_,T)&&(C=_[T],N(C)?this[T]=C:this["_"+T]=C);this._config=_,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function $(_,C){var T=d({},_),M;for(M in C)i(C,M)&&(o(_[M])&&o(C[M])?(T[M]={},d(T[M],_[M]),d(T[M],C[M])):C[M]!=null?T[M]=C[M]:delete T[M]);for(M in _)i(_,M)&&!i(C,M)&&o(_[M])&&(T[M]=d({},T[M]));return T}function k(_){_!=null&&this.set(_)}var z;Object.keys?z=Object.keys:z=function(_){var C,T=[];for(C in _)i(_,C)&&T.push(C);return T};var V={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function Q(_,C,T){var M=this._calendar[_]||this._calendar.sameElse;return N(M)?M.call(C,T):M}function J(_,C,T){var M=""+Math.abs(_),L=C-M.length,Z=_>=0;return(Z?T?"+":"":"-")+Math.pow(10,Math.max(0,L)).toString().substr(1)+M}var D=/(\[[^\[]*\])|(\\)?([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,B=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,q={},K={};function H(_,C,T,M){var L=M;typeof M=="string"&&(L=function(){return this[M]()}),_&&(K[_]=L),C&&(K[C[0]]=function(){return J(L.apply(this,arguments),C[1],C[2])}),T&&(K[T]=function(){return this.localeData().ordinal(L.apply(this,arguments),_)})}function ee(_){return _.match(/\[[\s\S]/)?_.replace(/^\[|\]$/g,""):_.replace(/\\/g,"")}function U(_){var C=_.match(D),T,M;for(T=0,M=C.length;T=0&&B.test(_);)_=_.replace(B,M),B.lastIndex=0,T-=1;return _}var ae={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 Oe(_){var C=this._longDateFormat[_],T=this._longDateFormat[_.toUpperCase()];return C||!T?C:(this._longDateFormat[_]=T.match(D).map(function(M){return M==="MMMM"||M==="MM"||M==="DD"||M==="dddd"?M.slice(1):M}).join(""),this._longDateFormat[_])}var le="Invalid date";function Be(){return this._invalidDate}var ze="%d",rt=/\d{1,2}/;function cr(_){return this._ordinal.replace("%d",_)}var Sn={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 je(_,C,T,M){var L=this._relativeTime[T];return N(L)?L(_,C,T,M):L.replace(/%d/i,_)}function mt(_,C){var T=this._relativeTime[_>0?"future":"past"];return N(T)?T(C):T.replace(/%s/i,C)}var ht={};function ft(_,C){var T=_.toLowerCase();ht[T]=ht[T+"s"]=ht[C]=_}function te(_){return typeof _=="string"?ht[_]||ht[_.toLowerCase()]:void 0}function et(_){var C={},T,M;for(M in _)i(_,M)&&(T=te(M),T&&(C[T]=_[M]));return C}var Re={};function Pe(_,C){Re[_]=C}function oe(_){var C=[],T;for(T in _)i(_,T)&&C.push({unit:T,priority:Re[T]});return C.sort(function(M,L){return M.priority-L.priority}),C}function se(_){return _%4===0&&_%100!==0||_%400===0}function ce(_){return _<0?Math.ceil(_)||0:Math.floor(_)}function Ce(_){var C=+_,T=0;return C!==0&&isFinite(C)&&(T=ce(C)),T}function Je(_,C){return function(T){return T!=null?(ea(this,_,T),e.updateOffset(this,C),this):ir(this,_)}}function ir(_,C){return _.isValid()?_._d["get"+(_._isUTC?"UTC":"")+C]():NaN}function ea(_,C,T){_.isValid()&&!isNaN(T)&&(C==="FullYear"&&se(_.year())&&_.month()===1&&_.date()===29?(T=Ce(T),_._d["set"+(_._isUTC?"UTC":"")+C](T,_.month(),aK(T,_.month()))):_._d["set"+(_._isUTC?"UTC":"")+C](T))}function ta(_){return _=te(_),N(this[_])?this[_]():this}function xc(_,C){if(typeof _=="object"){_=et(_);var T=oe(_),M,L=T.length;for(M=0;M68?1900:2e3)};var Dqe=Je("FullYear",!0);function mZt(){return se(this.year())}function hZt(_,C,T,M,L,Z,he){var tr;return _<100&&_>=0?(tr=new Date(_+400,C,T,M,L,Z,he),isFinite(tr.getFullYear())&&tr.setFullYear(_)):tr=new Date(_,C,T,M,L,Z,he),tr}function o2(_){var C,T;return _<100&&_>=0?(T=Array.prototype.slice.call(arguments),T[0]=_+400,C=new Date(Date.UTC.apply(null,T)),isFinite(C.getUTCFullYear())&&C.setUTCFullYear(_)):C=new Date(Date.UTC.apply(null,arguments)),C}function sK(_,C,T){var M=7+C-T,L=(7+o2(_,0,M).getUTCDay()-C)%7;return-L+M-1}function Lqe(_,C,T,M,L){var Z=(7+T-M)%7,he=sK(_,M,L),tr=1+7*(C-1)+Z+he,an,Ci;return tr<=0?(an=_-1,Ci=n2(an)+tr):tr>n2(_)?(an=_+1,Ci=tr-n2(_)):(an=_,Ci=tr),{year:an,dayOfYear:Ci}}function i2(_,C,T){var M=sK(_.year(),C,T),L=Math.floor((_.dayOfYear()-M-1)/7)+1,Z,he;return L<1?(he=_.year()-1,Z=L+fC(he,C,T)):L>fC(_.year(),C,T)?(Z=L-fC(_.year(),C,T),he=_.year()+1):(he=_.year(),Z=L),{week:Z,year:he}}function fC(_,C,T){var M=sK(_,C,T),L=sK(_+1,C,T);return(n2(_)-M+L)/7}H("w",["ww",2],"wo","week"),H("W",["WW",2],"Wo","isoWeek"),ft("week","w"),ft("isoWeek","W"),Pe("week",5),Pe("isoWeek",5),Ye("w",xn),Ye("ww",xn,qi),Ye("W",xn),Ye("WW",xn,qi),uy(["w","ww","W","WW"],function(_,C,T,M){C[M.substr(0,1)]=Ce(_)});function gZt(_){return i2(_,this._week.dow,this._week.doy).week}var yZt={dow:0,doy:6};function bZt(){return this._week.dow}function _Zt(){return this._week.doy}function vZt(_){var C=this.localeData().week(this);return _==null?C:this.add((_-C)*7,"d")}function wZt(_){var C=i2(this,1,4).week;return _==null?C:this.add((_-C)*7,"d")}H("d",0,"do","day"),H("dd",0,0,function(_){return this.localeData().weekdaysMin(this,_)}),H("ddd",0,0,function(_){return this.localeData().weekdaysShort(this,_)}),H("dddd",0,0,function(_){return this.localeData().weekdays(this,_)}),H("e",0,0,"weekday"),H("E",0,0,"isoWeekday"),ft("day","d"),ft("weekday","e"),ft("isoWeekday","E"),Pe("day",11),Pe("weekday",11),Pe("isoWeekday",11),Ye("d",xn),Ye("e",xn),Ye("E",xn),Ye("dd",function(_,C){return C.weekdaysMinRegex(_)}),Ye("ddd",function(_,C){return C.weekdaysShortRegex(_)}),Ye("dddd",function(_,C){return C.weekdaysRegex(_)}),uy(["dd","ddd","dddd"],function(_,C,T,M){var L=T._locale.weekdaysParse(_,M,T._strict);L!=null?C.d=L:m(T).invalidWeekday=_}),uy(["d","e","E"],function(_,C,T,M){C[M]=Ce(_)});function SZt(_,C){return typeof _!="string"?_:isNaN(_)?(_=C.weekdaysParse(_),typeof _=="number"?_:null):parseInt(_,10)}function xZt(_,C){return typeof _=="string"?C.weekdaysParse(_)%7||7:isNaN(_)?null:_}function Bfe(_,C){return _.slice(C,7).concat(_.slice(0,C))}var CZt="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Fqe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),OZt="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),PZt=wf,EZt=wf,TZt=wf;function AZt(_,C){var T=n(this._weekdays)?this._weekdays:this._weekdays[_&&_!==!0&&this._weekdays.isFormat.test(C)?"format":"standalone"];return _===!0?Bfe(T,this._week.dow):_?T[_.day()]:T}function IZt(_){return _===!0?Bfe(this._weekdaysShort,this._week.dow):_?this._weekdaysShort[_.day()]:this._weekdaysShort}function MZt(_){return _===!0?Bfe(this._weekdaysMin,this._week.dow):_?this._weekdaysMin[_.day()]:this._weekdaysMin}function RZt(_,C,T){var M,L,Z,he=_.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],M=0;M<7;++M)Z=f([2e3,1]).day(M),this._minWeekdaysParse[M]=this.weekdaysMin(Z,"").toLocaleLowerCase(),this._shortWeekdaysParse[M]=this.weekdaysShort(Z,"").toLocaleLowerCase(),this._weekdaysParse[M]=this.weekdays(Z,"").toLocaleLowerCase();return T?C==="dddd"?(L=Ss.call(this._weekdaysParse,he),L!==-1?L:null):C==="ddd"?(L=Ss.call(this._shortWeekdaysParse,he),L!==-1?L:null):(L=Ss.call(this._minWeekdaysParse,he),L!==-1?L:null):C==="dddd"?(L=Ss.call(this._weekdaysParse,he),L!==-1||(L=Ss.call(this._shortWeekdaysParse,he),L!==-1)?L:(L=Ss.call(this._minWeekdaysParse,he),L!==-1?L:null)):C==="ddd"?(L=Ss.call(this._shortWeekdaysParse,he),L!==-1||(L=Ss.call(this._weekdaysParse,he),L!==-1)?L:(L=Ss.call(this._minWeekdaysParse,he),L!==-1?L:null)):(L=Ss.call(this._minWeekdaysParse,he),L!==-1||(L=Ss.call(this._weekdaysParse,he),L!==-1)?L:(L=Ss.call(this._shortWeekdaysParse,he),L!==-1?L:null))}function jZt(_,C,T){var M,L,Z;if(this._weekdaysParseExact)return RZt.call(this,_,C,T);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),M=0;M<7;M++){if(L=f([2e3,1]).day(M),T&&!this._fullWeekdaysParse[M]&&(this._fullWeekdaysParse[M]=new RegExp("^"+this.weekdays(L,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[M]=new RegExp("^"+this.weekdaysShort(L,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[M]=new RegExp("^"+this.weekdaysMin(L,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[M]||(Z="^"+this.weekdays(L,"")+"|^"+this.weekdaysShort(L,"")+"|^"+this.weekdaysMin(L,""),this._weekdaysParse[M]=new RegExp(Z.replace(".",""),"i")),T&&C==="dddd"&&this._fullWeekdaysParse[M].test(_))return M;if(T&&C==="ddd"&&this._shortWeekdaysParse[M].test(_))return M;if(T&&C==="dd"&&this._minWeekdaysParse[M].test(_))return M;if(!T&&this._weekdaysParse[M].test(_))return M}}function NZt(_){if(!this.isValid())return _!=null?this:NaN;var C=this._isUTC?this._d.getUTCDay():this._d.getDay();return _!=null?(_=SZt(_,this.localeData()),this.add(_-C,"d")):C}function DZt(_){if(!this.isValid())return _!=null?this:NaN;var C=(this.day()+7-this.localeData()._week.dow)%7;return _==null?C:this.add(_-C,"d")}function LZt(_){if(!this.isValid())return _!=null?this:NaN;if(_!=null){var C=xZt(_,this.localeData());return this.day(this.day()%7?C:C-7)}else return this.day()||7}function FZt(_){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||qfe.call(this),_?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=PZt),this._weekdaysStrictRegex&&_?this._weekdaysStrictRegex:this._weekdaysRegex)}function kZt(_){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||qfe.call(this),_?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=EZt),this._weekdaysShortStrictRegex&&_?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function $Zt(_){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||qfe.call(this),_?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=TZt),this._weekdaysMinStrictRegex&&_?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function qfe(){function _(xf,yC){return yC.length-xf.length}var C=[],T=[],M=[],L=[],Z,he,tr,an,Ci;for(Z=0;Z<7;Z++)he=f([2e3,1]).day(Z),tr=vl(this.weekdaysMin(he,"")),an=vl(this.weekdaysShort(he,"")),Ci=vl(this.weekdays(he,"")),C.push(tr),T.push(an),M.push(Ci),L.push(tr),L.push(an),L.push(Ci);C.sort(_),T.sort(_),M.sort(_),L.sort(_),this._weekdaysRegex=new RegExp("^("+L.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+M.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+T.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+C.join("|")+")","i")}function Ufe(){return this.hours()%12||12}function BZt(){return this.hours()||24}H("H",["HH",2],0,"hour"),H("h",["hh",2],0,Ufe),H("k",["kk",2],0,BZt),H("hmm",0,0,function(){return""+Ufe.apply(this)+J(this.minutes(),2)}),H("hmmss",0,0,function(){return""+Ufe.apply(this)+J(this.minutes(),2)+J(this.seconds(),2)}),H("Hmm",0,0,function(){return""+this.hours()+J(this.minutes(),2)}),H("Hmmss",0,0,function(){return""+this.hours()+J(this.minutes(),2)+J(this.seconds(),2)});function kqe(_,C){H(_,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),C)})}kqe("a",!0),kqe("A",!1),ft("hour","h"),Pe("hour",13);function $qe(_,C){return C._meridiemParse}Ye("a",$qe),Ye("A",$qe),Ye("H",xn),Ye("h",xn),Ye("k",xn),Ye("HH",xn,qi),Ye("hh",xn,qi),Ye("kk",xn,qi),Ye("hmm",_f),Ye("hmmss",uC),Ye("Hmm",_f),Ye("Hmmss",uC),En(["H","HH"],wl),En(["k","kk"],function(_,C,T){var M=Ce(_);C[wl]=M===24?0:M}),En(["a","A"],function(_,C,T){T._isPm=T._locale.isPM(_),T._meridiem=_}),En(["h","hh"],function(_,C,T){C[wl]=Ce(_),m(T).bigHour=!0}),En("hmm",function(_,C,T){var M=_.length-2;C[wl]=Ce(_.substr(0,M)),C[ly]=Ce(_.substr(M)),m(T).bigHour=!0}),En("hmmss",function(_,C,T){var M=_.length-4,L=_.length-2;C[wl]=Ce(_.substr(0,M)),C[ly]=Ce(_.substr(M,2)),C[dC]=Ce(_.substr(L)),m(T).bigHour=!0}),En("Hmm",function(_,C,T){var M=_.length-2;C[wl]=Ce(_.substr(0,M)),C[ly]=Ce(_.substr(M))}),En("Hmmss",function(_,C,T){var M=_.length-4,L=_.length-2;C[wl]=Ce(_.substr(0,M)),C[ly]=Ce(_.substr(M,2)),C[dC]=Ce(_.substr(L))});function qZt(_){return(_+"").toLowerCase().charAt(0)==="p"}var UZt=/[ap]\.?m?\.?/i,zZt=Je("Hours",!0);function HZt(_,C,T){return _>11?T?"pm":"PM":T?"am":"AM"}var Bqe={calendar:V,longDateFormat:ae,invalidDate:le,ordinal:ze,dayOfMonthOrdinalParse:rt,relativeTime:Sn,months:oZt,monthsShort:Iqe,week:yZt,weekdays:CZt,weekdaysMin:OZt,weekdaysShort:Fqe,meridiemParse:UZt},wa={},a2={},s2;function VZt(_,C){var T,M=Math.min(_.length,C.length);for(T=0;T0;){if(L=uK(Z.slice(0,T).join("-")),L)return L;if(M&&M.length>=T&&VZt(Z,M)>=T-1)break;T--}C++}return s2}function KZt(_){return _.match("^[^/\\\\]*$")!=null}function uK(_){var C=null,T;if(wa[_]===void 0&&typeof fF<"u"&&fF&&fF.exports&&KZt(_))try{C=s2._abbr,T=require,T("./locale/"+_),wE(C)}catch{wa[_]=null}return wa[_]}function wE(_,C){var T;return _&&(s(C)?T=pC(_):T=zfe(_,C),T?s2=T:typeof console<"u"&&console.warn&&console.warn("Locale "+_+" not found. Did you forget to load it?")),s2._abbr}function zfe(_,C){if(C!==null){var T,M=Bqe;if(C.abbr=_,wa[_]!=null)R("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),M=wa[_]._config;else if(C.parentLocale!=null)if(wa[C.parentLocale]!=null)M=wa[C.parentLocale]._config;else if(T=uK(C.parentLocale),T!=null)M=T._config;else return a2[C.parentLocale]||(a2[C.parentLocale]=[]),a2[C.parentLocale].push({name:_,config:C}),null;return wa[_]=new k($(M,C)),a2[_]&&a2[_].forEach(function(L){zfe(L.name,L.config)}),wE(_),wa[_]}else return delete wa[_],null}function GZt(_,C){if(C!=null){var T,M,L=Bqe;wa[_]!=null&&wa[_].parentLocale!=null?wa[_].set($(wa[_]._config,C)):(M=uK(_),M!=null&&(L=M._config),C=$(L,C),M==null&&(C.abbr=_),T=new k(C),T.parentLocale=wa[_],wa[_]=T),wE(_)}else wa[_]!=null&&(wa[_].parentLocale!=null?(wa[_]=wa[_].parentLocale,_===wE()&&wE(_)):wa[_]!=null&&delete wa[_]);return wa[_]}function pC(_){var C;if(_&&_._locale&&_._locale._abbr&&(_=_._locale._abbr),!_)return s2;if(!n(_)){if(C=uK(_),C)return C;_=[_]}return WZt(_)}function JZt(){return z(wa)}function Hfe(_){var C,T=_._a;return T&&m(_).overflow===-2&&(C=T[cC]<0||T[cC]>11?cC:T[$b]<1||T[$b]>aK(T[Pd],T[cC])?$b:T[wl]<0||T[wl]>24||T[wl]===24&&(T[ly]!==0||T[dC]!==0||T[KM]!==0)?wl:T[ly]<0||T[ly]>59?ly:T[dC]<0||T[dC]>59?dC:T[KM]<0||T[KM]>999?KM:-1,m(_)._overflowDayOfYear&&(C$b)&&(C=$b),m(_)._overflowWeeks&&C===-1&&(C=tZt),m(_)._overflowWeekday&&C===-1&&(C=rZt),m(_).overflow=C),_}var YZt=/^\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)?)?$/,ZZt=/^\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)?)?$/,XZt=/Z|[+-]\d\d(?::?\d\d)?/,lK=[["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]],Vfe=[["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/]],QZt=/^\/?Date\((-?\d+)/i,eXt=/^(?:(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}))$/,tXt={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 Uqe(_){var C,T,M=_._i,L=YZt.exec(M)||ZZt.exec(M),Z,he,tr,an,Ci=lK.length,xf=Vfe.length;if(L){for(m(_).iso=!0,C=0,T=Ci;Cn2(he)||_._dayOfYear===0)&&(m(_)._overflowDayOfYear=!0),T=o2(he,0,_._dayOfYear),_._a[cC]=T.getUTCMonth(),_._a[$b]=T.getUTCDate()),C=0;C<3&&_._a[C]==null;++C)_._a[C]=M[C]=L[C];for(;C<7;C++)_._a[C]=M[C]=_._a[C]==null?C===2?1:0:_._a[C];_._a[wl]===24&&_._a[ly]===0&&_._a[dC]===0&&_._a[KM]===0&&(_._nextDay=!0,_._a[wl]=0),_._d=(_._useUTC?o2:hZt).apply(null,M),Z=_._useUTC?_._d.getUTCDay():_._d.getDay(),_._tzm!=null&&_._d.setUTCMinutes(_._d.getUTCMinutes()-_._tzm),_._nextDay&&(_._a[wl]=24),_._w&&typeof _._w.d<"u"&&_._w.d!==Z&&(m(_).weekdayMismatch=!0)}}function lXt(_){var C,T,M,L,Z,he,tr,an,Ci;C=_._w,C.GG!=null||C.W!=null||C.E!=null?(Z=1,he=4,T=AL(C.GG,_._a[Pd],i2(ra(),1,4).year),M=AL(C.W,1),L=AL(C.E,1),(L<1||L>7)&&(an=!0)):(Z=_._locale._week.dow,he=_._locale._week.doy,Ci=i2(ra(),Z,he),T=AL(C.gg,_._a[Pd],Ci.year),M=AL(C.w,Ci.week),C.d!=null?(L=C.d,(L<0||L>6)&&(an=!0)):C.e!=null?(L=C.e+Z,(C.e<0||C.e>6)&&(an=!0)):L=Z),M<1||M>fC(T,Z,he)?m(_)._overflowWeeks=!0:an!=null?m(_)._overflowWeekday=!0:(tr=Lqe(T,M,L,Z,he),_._a[Pd]=tr.year,_._dayOfYear=tr.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function Kfe(_){if(_._f===e.ISO_8601){Uqe(_);return}if(_._f===e.RFC_2822){zqe(_);return}_._a=[],m(_).empty=!0;var C=""+_._i,T,M,L,Z,he,tr=C.length,an=0,Ci,xf;for(L=Y(_._f,_._locale).match(D)||[],xf=L.length,T=0;T0&&m(_).unusedInput.push(he),C=C.slice(C.indexOf(M)+M.length),an+=M.length),K[Z]?(M?m(_).empty=!1:m(_).unusedTokens.push(Z),r2(Z,M,_)):_._strict&&!M&&m(_).unusedTokens.push(Z);m(_).charsLeftOver=tr-an,C.length>0&&m(_).unusedInput.push(C),_._a[wl]<=12&&m(_).bigHour===!0&&_._a[wl]>0&&(m(_).bigHour=void 0),m(_).parsedDateParts=_._a.slice(0),m(_).meridiem=_._meridiem,_._a[wl]=cXt(_._locale,_._a[wl],_._meridiem),Ci=m(_).era,Ci!==null&&(_._a[Pd]=_._locale.erasConvertYear(Ci,_._a[Pd])),Wfe(_),Hfe(_)}function cXt(_,C,T){var M;return T==null?C:_.meridiemHour!=null?_.meridiemHour(C,T):(_.isPM!=null&&(M=_.isPM(T),M&&C<12&&(C+=12),!M&&C===12&&(C=0)),C)}function dXt(_){var C,T,M,L,Z,he,tr=!1,an=_._f.length;if(an===0){m(_).invalidFormat=!0,_._d=new Date(NaN);return}for(L=0;Lthis?this:_:g()});function Wqe(_,C){var T,M;if(C.length===1&&n(C[0])&&(C=C[0]),!C.length)return ra();for(T=C[0],M=1;Mthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function RXt(){if(!s(this._isDSTShifted))return this._isDSTShifted;var _={},C;return x(_,this),_=Hqe(_),_._a?(C=_._isUTC?f(_._a):ra(_._a),this._isDSTShifted=this.isValid()&&xXt(_._a,C.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function jXt(){return this.isValid()?!this._isUTC:!1}function NXt(){return this.isValid()?this._isUTC:!1}function Gqe(){return this.isValid()?this._isUTC&&this._offset===0:!1}var DXt=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,LXt=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function cy(_,C){var T=_,M=null,L,Z,he;return dK(_)?T={ms:_._milliseconds,d:_._days,M:_._months}:u(_)||!isNaN(+_)?(T={},C?T[C]=+_:T.milliseconds=+_):(M=DXt.exec(_))?(L=M[1]==="-"?-1:1,T={y:0,d:Ce(M[$b])*L,h:Ce(M[wl])*L,m:Ce(M[ly])*L,s:Ce(M[dC])*L,ms:Ce(Gfe(M[KM]*1e3))*L}):(M=LXt.exec(_))?(L=M[1]==="-"?-1:1,T={y:GM(M[2],L),M:GM(M[3],L),w:GM(M[4],L),d:GM(M[5],L),h:GM(M[6],L),m:GM(M[7],L),s:GM(M[8],L)}):T==null?T={}:typeof T=="object"&&("from"in T||"to"in T)&&(he=FXt(ra(T.from),ra(T.to)),T={},T.ms=he.milliseconds,T.M=he.months),Z=new cK(T),dK(_)&&i(_,"_locale")&&(Z._locale=_._locale),dK(_)&&i(_,"_isValid")&&(Z._isValid=_._isValid),Z}cy.fn=cK.prototype,cy.invalid=SXt;function GM(_,C){var T=_&&parseFloat(_.replace(",","."));return(isNaN(T)?0:T)*C}function Jqe(_,C){var T={};return T.months=C.month()-_.month()+(C.year()-_.year())*12,_.clone().add(T.months,"M").isAfter(C)&&--T.months,T.milliseconds=+C-+_.clone().add(T.months,"M"),T}function FXt(_,C){var T;return _.isValid()&&C.isValid()?(C=Yfe(C,_),_.isBefore(C)?T=Jqe(_,C):(T=Jqe(C,_),T.milliseconds=-T.milliseconds,T.months=-T.months),T):{milliseconds:0,months:0}}function Yqe(_,C){return function(T,M){var L,Z;return M!==null&&!isNaN(+M)&&(R(C,"moment()."+C+"(period, number) is deprecated. Please use moment()."+C+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),Z=T,T=M,M=Z),L=cy(T,M),Zqe(this,L,_),this}}function Zqe(_,C,T,M){var L=C._milliseconds,Z=Gfe(C._days),he=Gfe(C._months);_.isValid()&&(M=M??!0,he&&Rqe(_,ir(_,"Month")+he*T),Z&&ea(_,"Date",ir(_,"Date")+Z*T),L&&_._d.setTime(_._d.valueOf()+L*T),M&&e.updateOffset(_,Z||he))}var kXt=Yqe(1,"add"),$Xt=Yqe(-1,"subtract");function Xqe(_){return typeof _=="string"||_ instanceof String}function BXt(_){return P(_)||l(_)||Xqe(_)||u(_)||UXt(_)||qXt(_)||_===null||_===void 0}function qXt(_){var C=o(_)&&!a(_),T=!1,M=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],L,Z,he=M.length;for(L=0;LT.valueOf():T.valueOf()9999?W(T,C?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):N(Date.prototype.toISOString)?C?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",W(T,"Z")):W(T,C?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function rQt(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var _="moment",C="",T,M,L,Z;return this.isLocal()||(_=this.utcOffset()===0?"moment.utc":"moment.parseZone",C="Z"),T="["+_+'("]',M=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",L="-MM-DD[T]HH:mm:ss.SSS",Z=C+'[")]',this.format(T+M+L+Z)}function nQt(_){_||(_=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var C=W(this,_);return this.localeData().postformat(C)}function oQt(_,C){return this.isValid()&&(P(_)&&_.isValid()||ra(_).isValid())?cy({to:this,from:_}).locale(this.locale()).humanize(!C):this.localeData().invalidDate()}function iQt(_){return this.from(ra(),_)}function aQt(_,C){return this.isValid()&&(P(_)&&_.isValid()||ra(_).isValid())?cy({from:this,to:_}).locale(this.locale()).humanize(!C):this.localeData().invalidDate()}function sQt(_){return this.to(ra(),_)}function Qqe(_){var C;return _===void 0?this._locale._abbr:(C=pC(_),C!=null&&(this._locale=C),this)}var eUe=A("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(_){return _===void 0?this.localeData():this.locale(_)});function tUe(){return this._locale}var pK=1e3,IL=60*pK,mK=60*IL,rUe=(365*400+97)*24*mK;function ML(_,C){return(_%C+C)%C}function nUe(_,C,T){return _<100&&_>=0?new Date(_+400,C,T)-rUe:new Date(_,C,T).valueOf()}function oUe(_,C,T){return _<100&&_>=0?Date.UTC(_+400,C,T)-rUe:Date.UTC(_,C,T)}function uQt(_){var C,T;if(_=te(_),_===void 0||_==="millisecond"||!this.isValid())return this;switch(T=this._isUTC?oUe:nUe,_){case"year":C=T(this.year(),0,1);break;case"quarter":C=T(this.year(),this.month()-this.month()%3,1);break;case"month":C=T(this.year(),this.month(),1);break;case"week":C=T(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":C=T(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":C=T(this.year(),this.month(),this.date());break;case"hour":C=this._d.valueOf(),C-=ML(C+(this._isUTC?0:this.utcOffset()*IL),mK);break;case"minute":C=this._d.valueOf(),C-=ML(C,IL);break;case"second":C=this._d.valueOf(),C-=ML(C,pK);break}return this._d.setTime(C),e.updateOffset(this,!0),this}function lQt(_){var C,T;if(_=te(_),_===void 0||_==="millisecond"||!this.isValid())return this;switch(T=this._isUTC?oUe:nUe,_){case"year":C=T(this.year()+1,0,1)-1;break;case"quarter":C=T(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":C=T(this.year(),this.month()+1,1)-1;break;case"week":C=T(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":C=T(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":C=T(this.year(),this.month(),this.date()+1)-1;break;case"hour":C=this._d.valueOf(),C+=mK-ML(C+(this._isUTC?0:this.utcOffset()*IL),mK)-1;break;case"minute":C=this._d.valueOf(),C+=IL-ML(C,IL)-1;break;case"second":C=this._d.valueOf(),C+=pK-ML(C,pK)-1;break}return this._d.setTime(C),e.updateOffset(this,!0),this}function cQt(){return this._d.valueOf()-(this._offset||0)*6e4}function dQt(){return Math.floor(this.valueOf()/1e3)}function fQt(){return new Date(this.valueOf())}function pQt(){var _=this;return[_.year(),_.month(),_.date(),_.hour(),_.minute(),_.second(),_.millisecond()]}function mQt(){var _=this;return{years:_.year(),months:_.month(),date:_.date(),hours:_.hours(),minutes:_.minutes(),seconds:_.seconds(),milliseconds:_.milliseconds()}}function hQt(){return this.isValid()?this.toISOString():null}function gQt(){return b(this)}function yQt(){return d({},m(this))}function bQt(){return m(this).overflow}function _Qt(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}H("N",0,0,"eraAbbr"),H("NN",0,0,"eraAbbr"),H("NNN",0,0,"eraAbbr"),H("NNNN",0,0,"eraName"),H("NNNNN",0,0,"eraNarrow"),H("y",["y",1],"yo","eraYear"),H("y",["yy",2],0,"eraYear"),H("y",["yyy",3],0,"eraYear"),H("y",["yyyy",4],0,"eraYear"),Ye("N",Xfe),Ye("NN",Xfe),Ye("NNN",Xfe),Ye("NNNN",IQt),Ye("NNNNN",MQt),En(["N","NN","NNN","NNNN","NNNNN"],function(_,C,T,M){var L=T._locale.erasParse(_,M,T._strict);L?m(T).era=L:m(T).invalidEra=_}),Ye("y",La),Ye("yy",La),Ye("yyy",La),Ye("yyyy",La),Ye("yo",RQt),En(["y","yy","yyy","yyyy"],Pd),En(["yo"],function(_,C,T,M){var L;T._locale._eraYearOrdinalRegex&&(L=_.match(T._locale._eraYearOrdinalRegex)),T._locale.eraYearOrdinalParse?C[Pd]=T._locale.eraYearOrdinalParse(_,L):C[Pd]=parseInt(_,10)});function vQt(_,C){var T,M,L,Z=this._eras||pC("en")._eras;for(T=0,M=Z.length;T=0)return Z[M]}function SQt(_,C){var T=_.since<=_.until?1:-1;return C===void 0?e(_.since).year():e(_.since).year()+(C-_.offset)*T}function xQt(){var _,C,T,M=this.localeData().eras();for(_=0,C=M.length;_Z&&(C=Z),$Qt.call(this,_,C,T,M,L))}function $Qt(_,C,T,M,L){var Z=Lqe(_,C,T,M,L),he=o2(Z.year,0,Z.dayOfYear);return this.year(he.getUTCFullYear()),this.month(he.getUTCMonth()),this.date(he.getUTCDate()),this}H("Q",0,"Qo","quarter"),ft("quarter","Q"),Pe("quarter",7),Ye("Q",Cd),En("Q",function(_,C){C[cC]=(Ce(_)-1)*3});function BQt(_){return _==null?Math.ceil((this.month()+1)/3):this.month((_-1)*3+this.month()%3)}H("D",["DD",2],"Do","date"),ft("date","D"),Pe("date",9),Ye("D",xn),Ye("DD",xn,qi),Ye("Do",function(_,C){return _?C._dayOfMonthOrdinalParse||C._ordinalParse:C._dayOfMonthOrdinalParseLenient}),En(["D","DD"],$b),En("Do",function(_,C){C[$b]=Ce(_.match(xn)[0])});var aUe=Je("Date",!0);H("DDD",["DDDD",3],"DDDo","dayOfYear"),ft("dayOfYear","DDD"),Pe("dayOfYear",4),Ye("DDD",kb),Ye("DDDD",lp),En(["DDD","DDDD"],function(_,C,T){T._dayOfYear=Ce(_)});function qQt(_){var C=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return _==null?C:this.add(_-C,"d")}H("m",["mm",2],0,"minute"),ft("minute","m"),Pe("minute",14),Ye("m",xn),Ye("mm",xn,qi),En(["m","mm"],ly);var UQt=Je("Minutes",!1);H("s",["ss",2],0,"second"),ft("second","s"),Pe("second",15),Ye("s",xn),Ye("ss",xn,qi),En(["s","ss"],dC);var zQt=Je("Seconds",!1);H("S",0,0,function(){return~~(this.millisecond()/100)}),H(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),H(0,["SSS",3],0,"millisecond"),H(0,["SSSS",4],0,function(){return this.millisecond()*10}),H(0,["SSSSS",5],0,function(){return this.millisecond()*100}),H(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),H(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),H(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),H(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),ft("millisecond","ms"),Pe("millisecond",16),Ye("S",kb,Cd),Ye("SS",kb,qi),Ye("SSS",kb,lp);var SE,sUe;for(SE="SSSS";SE.length<=9;SE+="S")Ye(SE,La);function HQt(_,C){C[KM]=Ce(("0."+_)*1e3)}for(SE="S";SE.length<=9;SE+="S")En(SE,HQt);sUe=Je("Milliseconds",!1),H("z",0,0,"zoneAbbr"),H("zz",0,0,"zoneName");function VQt(){return this._isUTC?"UTC":""}function WQt(){return this._isUTC?"Coordinated Universal Time":""}var He=O.prototype;He.add=kXt,He.calendar=VXt,He.clone=WXt,He.diff=QXt,He.endOf=lQt,He.format=nQt,He.from=oQt,He.fromNow=iQt,He.to=aQt,He.toNow=sQt,He.get=ta,He.invalidAt=bQt,He.isAfter=KXt,He.isBefore=GXt,He.isBetween=JXt,He.isSame=YXt,He.isSameOrAfter=ZXt,He.isSameOrBefore=XXt,He.isValid=gQt,He.lang=eUe,He.locale=Qqe,He.localeData=tUe,He.max=gXt,He.min=hXt,He.parsingFlags=yQt,He.set=xc,He.startOf=uQt,He.subtract=$Xt,He.toArray=pQt,He.toObject=mQt,He.toDate=fQt,He.toISOString=tQt,He.inspect=rQt,typeof Symbol<"u"&&Symbol.for!=null&&(He[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),He.toJSON=hQt,He.toString=eQt,He.unix=dQt,He.valueOf=cQt,He.creationData=_Qt,He.eraName=xQt,He.eraNarrow=CQt,He.eraAbbr=OQt,He.eraYear=PQt,He.year=Dqe,He.isLeapYear=mZt,He.weekYear=jQt,He.isoWeekYear=NQt,He.quarter=He.quarters=BQt,He.month=jqe,He.daysInMonth=dZt,He.week=He.weeks=vZt,He.isoWeek=He.isoWeeks=wZt,He.weeksInYear=FQt,He.weeksInWeekYear=kQt,He.isoWeeksInYear=DQt,He.isoWeeksInISOWeekYear=LQt,He.date=aUe,He.day=He.days=NZt,He.weekday=DZt,He.isoWeekday=LZt,He.dayOfYear=qQt,He.hour=He.hours=zZt,He.minute=He.minutes=UQt,He.second=He.seconds=zQt,He.millisecond=He.milliseconds=sUe,He.utcOffset=OXt,He.utc=EXt,He.local=TXt,He.parseZone=AXt,He.hasAlignedHourOffset=IXt,He.isDST=MXt,He.isLocal=jXt,He.isUtcOffset=NXt,He.isUtc=Gqe,He.isUTC=Gqe,He.zoneAbbr=VQt,He.zoneName=WQt,He.dates=A("dates accessor is deprecated. Use date instead.",aUe),He.months=A("months accessor is deprecated. Use month instead",jqe),He.years=A("years accessor is deprecated. Use year instead",Dqe),He.zone=A("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",PXt),He.isDSTShifted=A("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",RXt);function KQt(_){return ra(_*1e3)}function GQt(){return ra.apply(null,arguments).parseZone()}function uUe(_){return _}var wo=k.prototype;wo.calendar=Q,wo.longDateFormat=Oe,wo.invalidDate=Be,wo.ordinal=cr,wo.preparse=uUe,wo.postformat=uUe,wo.relativeTime=je,wo.pastFuture=mt,wo.set=j,wo.eras=vQt,wo.erasParse=wQt,wo.erasConvertYear=SQt,wo.erasAbbrRegex=TQt,wo.erasNameRegex=EQt,wo.erasNarrowRegex=AQt,wo.months=sZt,wo.monthsShort=uZt,wo.monthsParse=cZt,wo.monthsRegex=pZt,wo.monthsShortRegex=fZt,wo.week=gZt,wo.firstDayOfYear=_Zt,wo.firstDayOfWeek=bZt,wo.weekdays=AZt,wo.weekdaysMin=MZt,wo.weekdaysShort=IZt,wo.weekdaysParse=jZt,wo.weekdaysRegex=FZt,wo.weekdaysShortRegex=kZt,wo.weekdaysMinRegex=$Zt,wo.isPM=qZt,wo.meridiem=HZt;function gK(_,C,T,M){var L=pC(),Z=f().set(M,C);return L[T](Z,_)}function lUe(_,C,T){if(u(_)&&(C=_,_=void 0),_=_||"",C!=null)return gK(_,C,T,"month");var M,L=[];for(M=0;M<12;M++)L[M]=gK(_,M,T,"month");return L}function epe(_,C,T,M){typeof _=="boolean"?(u(C)&&(T=C,C=void 0),C=C||""):(C=_,T=C,_=!1,u(C)&&(T=C,C=void 0),C=C||"");var L=pC(),Z=_?L._week.dow:0,he,tr=[];if(T!=null)return gK(C,(T+Z)%7,M,"day");for(he=0;he<7;he++)tr[he]=gK(C,(he+Z)%7,M,"day");return tr}function JQt(_,C){return lUe(_,C,"months")}function YQt(_,C){return lUe(_,C,"monthsShort")}function ZQt(_,C,T){return epe(_,C,T,"weekdays")}function XQt(_,C,T){return epe(_,C,T,"weekdaysShort")}function QQt(_,C,T){return epe(_,C,T,"weekdaysMin")}wE("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(_){var C=_%10,T=Ce(_%100/10)===1?"th":C===1?"st":C===2?"nd":C===3?"rd":"th";return _+T}}),e.lang=A("moment.lang is deprecated. Use moment.locale instead.",wE),e.langData=A("moment.langData is deprecated. Use moment.localeData instead.",pC);var mC=Math.abs;function eer(){var _=this._data;return this._milliseconds=mC(this._milliseconds),this._days=mC(this._days),this._months=mC(this._months),_.milliseconds=mC(_.milliseconds),_.seconds=mC(_.seconds),_.minutes=mC(_.minutes),_.hours=mC(_.hours),_.months=mC(_.months),_.years=mC(_.years),this}function cUe(_,C,T,M){var L=cy(C,T);return _._milliseconds+=M*L._milliseconds,_._days+=M*L._days,_._months+=M*L._months,_._bubble()}function ter(_,C){return cUe(this,_,C,1)}function rer(_,C){return cUe(this,_,C,-1)}function dUe(_){return _<0?Math.floor(_):Math.ceil(_)}function ner(){var _=this._milliseconds,C=this._days,T=this._months,M=this._data,L,Z,he,tr,an;return _>=0&&C>=0&&T>=0||_<=0&&C<=0&&T<=0||(_+=dUe(tpe(T)+C)*864e5,C=0,T=0),M.milliseconds=_%1e3,L=ce(_/1e3),M.seconds=L%60,Z=ce(L/60),M.minutes=Z%60,he=ce(Z/60),M.hours=he%24,C+=ce(he/24),an=ce(fUe(C)),T+=an,C-=dUe(tpe(an)),tr=ce(T/12),T%=12,M.days=C,M.months=T,M.years=tr,this}function fUe(_){return _*4800/146097}function tpe(_){return _*146097/4800}function oer(_){if(!this.isValid())return NaN;var C,T,M=this._milliseconds;if(_=te(_),_==="month"||_==="quarter"||_==="year")switch(C=this._days+M/864e5,T=this._months+fUe(C),_){case"month":return T;case"quarter":return T/3;case"year":return T/12}else switch(C=this._days+Math.round(tpe(this._months)),_){case"week":return C/7+M/6048e5;case"day":return C+M/864e5;case"hour":return C*24+M/36e5;case"minute":return C*1440+M/6e4;case"second":return C*86400+M/1e3;case"millisecond":return Math.floor(C*864e5)+M;default:throw new Error("Unknown unit "+_)}}function ier(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Ce(this._months/12)*31536e6:NaN}function hC(_){return function(){return this.as(_)}}var aer=hC("ms"),ser=hC("s"),uer=hC("m"),ler=hC("h"),cer=hC("d"),der=hC("w"),fer=hC("M"),per=hC("Q"),mer=hC("y");function her(){return cy(this)}function ger(_){return _=te(_),this.isValid()?this[_+"s"]():NaN}function JM(_){return function(){return this.isValid()?this._data[_]:NaN}}var yer=JM("milliseconds"),ber=JM("seconds"),_er=JM("minutes"),ver=JM("hours"),wer=JM("days"),Ser=JM("months"),xer=JM("years");function Cer(){return ce(this.days()/7)}var gC=Math.round,RL={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Oer(_,C,T,M,L){return L.relativeTime(C||1,!!T,_,M)}function Per(_,C,T,M){var L=cy(_).abs(),Z=gC(L.as("s")),he=gC(L.as("m")),tr=gC(L.as("h")),an=gC(L.as("d")),Ci=gC(L.as("M")),xf=gC(L.as("w")),yC=gC(L.as("y")),xE=Z<=T.ss&&["s",Z]||Z0,xE[4]=M,Oer.apply(null,xE)}function Eer(_){return _===void 0?gC:typeof _=="function"?(gC=_,!0):!1}function Ter(_,C){return RL[_]===void 0?!1:C===void 0?RL[_]:(RL[_]=C,_==="s"&&(RL.ss=C-1),!0)}function Aer(_,C){if(!this.isValid())return this.localeData().invalidDate();var T=!1,M=RL,L,Z;return typeof _=="object"&&(C=_,_=!1),typeof _=="boolean"&&(T=_),typeof C=="object"&&(M=Object.assign({},RL,C),C.s!=null&&C.ss==null&&(M.ss=C.s-1)),L=this.localeData(),Z=Per(this,!T,M,L),T&&(Z=L.pastFuture(+this,Z)),L.postformat(Z)}var rpe=Math.abs;function jL(_){return(_>0)-(_<0)||+_}function yK(){if(!this.isValid())return this.localeData().invalidDate();var _=rpe(this._milliseconds)/1e3,C=rpe(this._days),T=rpe(this._months),M,L,Z,he,tr=this.asSeconds(),an,Ci,xf,yC;return tr?(M=ce(_/60),L=ce(M/60),_%=60,M%=60,Z=ce(T/12),T%=12,he=_?_.toFixed(3).replace(/\.?0+$/,""):"",an=tr<0?"-":"",Ci=jL(this._months)!==jL(tr)?"-":"",xf=jL(this._days)!==jL(tr)?"-":"",yC=jL(this._milliseconds)!==jL(tr)?"-":"",an+"P"+(Z?Ci+Z+"Y":"")+(T?Ci+T+"M":"")+(C?xf+C+"D":"")+(L||M||_?"T":"")+(L?yC+L+"H":"")+(M?yC+M+"M":"")+(_?yC+he+"S":"")):"P0D"}var Xn=cK.prototype;Xn.isValid=wXt,Xn.abs=eer,Xn.add=ter,Xn.subtract=rer,Xn.as=oer,Xn.asMilliseconds=aer,Xn.asSeconds=ser,Xn.asMinutes=uer,Xn.asHours=ler,Xn.asDays=cer,Xn.asWeeks=der,Xn.asMonths=fer,Xn.asQuarters=per,Xn.asYears=mer,Xn.valueOf=ier,Xn._bubble=ner,Xn.clone=her,Xn.get=ger,Xn.milliseconds=yer,Xn.seconds=ber,Xn.minutes=_er,Xn.hours=ver,Xn.days=wer,Xn.weeks=Cer,Xn.months=Ser,Xn.years=xer,Xn.humanize=Aer,Xn.toISOString=yK,Xn.toString=yK,Xn.toJSON=yK,Xn.locale=Qqe,Xn.localeData=tUe,Xn.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",yK),Xn.lang=eUe,H("X",0,0,"unix"),H("x",0,0,"valueOf"),Ye("x",vf),Ye("X",cp),En("X",function(_,C,T){T._d=new Date(parseFloat(_)*1e3)}),En("x",function(_,C,T){T._d=new Date(Ce(_))});return e.version="2.29.4",r(ra),e.fn=He,e.min=yXt,e.max=bXt,e.now=_Xt,e.utc=f,e.unix=KQt,e.months=JQt,e.isDate=l,e.locale=wE,e.invalid=g,e.duration=cy,e.isMoment=P,e.weekdays=ZQt,e.parseZone=GQt,e.localeData=pC,e.isDuration=dK,e.monthsShort=YQt,e.weekdaysMin=QQt,e.defineLocale=zfe,e.updateLocale=GZt,e.locales=JZt,e.weekdaysShort=XQt,e.normalizeUnits=te,e.relativeTimeRounding=Eer,e.relativeTimeThreshold=Ter,e.calendarFormat=HXt,e.prototype=He,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})});function dVe(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function nur(t){let e=dVe(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function fVe(t){let e=dVe(t);return nur(t)?Jhe.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:Jhe.UNKNOWN_ERROR)}function pF(t){return t.replace(/^#/,"").trim().toLowerCase()}function NR(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(pF(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(pF(i))}):typeof n=="string"&&o.add(pF(n))),Array.from(o)}function pVe(t,e,r){if(e.length===0)return[];e=e.map(i=>pF(i));let n=r&&r.length>0?r:Xhe(t,"/"),o=[];for(let i of n){let a=NR(i);e.some(s=>a.includes(s))&&o.push(i)}return o}function Qhe(t){let e=(0,Zhe.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()}:Vl(new Date)}async function mF(t,e){return t.extension!="md"&&t.extension!="canvas"?null:await e.cachedRead(t)}function eJ(t){return t.basename}function DR(t){return t?t.extension==="md"||t.extension==="pdf"||t.extension==="canvas":!1}function hVe(t,e){return!t||!e?!1:t.includes(Yhe)&&e.includes(Yhe)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function LR(t){let e=[],{history:r}=t;for(let n=0;n{let a=i.slice(2,-2),s=e.getAbstractFileByPath(a);if(s instanceof Rh.TFile)o.set(s.path,s);else{let l=e.getMarkdownFiles().filter(c=>c.basename===a);l.length>0&&(ege(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 ege(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function gVe(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function yVe(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}function bVe(t){return tge.test(t)}function rge(t){let e=t.match(tge);return e?e[0]:null}function _Ve(t){let e=t.matchAll(new RegExp(tge,"g"));return Array.from(e,r=>r[0])}async function Us(t,e={}){let r=e.headers?{...e.headers}:{};delete r["content-length"],ie("==== safeFetch method request ====");let n=e.method?.toUpperCase()||"POST",i=await(0,Rh.requestUrl)({url:t,contentType:"application/json",headers:r,method:n,...["POST","PUT","PATCH"].includes(n)&&{body:e.body?.toString()},throw:!1});if(i.status>=400){let a;try{a=typeof i.json=="string"?JSON.parse(i.json):i.json}catch{try{a=typeof i.text=="string"?JSON.parse(i.text):i.text}catch{a=null}}let s=new Error(Jhe.REQUEST_FAILED(i.status));if(s.json=a,a?.detail?.reason==="Invalid license key"||a?.reason==="Invalid license key")s.message="Invalid license key";else if(a?.detail?.message||a?.message){let u=a?.detail?.message||a?.message,l=a?.detail?.reason||a?.reason;s.message=l?`${u}: ${l}`:u}else a?.detail&&(s.message=JSON.stringify(a.detail));throw s}return{ok:i.status>=200&&i.status<300,status:i.status,statusText:i.status.toString(),headers:new Headers(i.headers),url:t,type:"basic",redirected:!1,bytes:()=>Promise.resolve(new Uint8Array(0)),body:aur(i.text),bodyUsed:!0,json:()=>i.json,text:async()=>i.text,arrayBuffer:async()=>{if(i.arrayBuffer)return i.arrayBuffer;let a=i.text.replace(/^data:.*;base64,/,""),s=atob(a),u=new Uint8Array(s.length);for(let l=0;l{throw new Error("not implemented")},formData:()=>{throw new Error("not implemented")},clone:()=>{throw new Error("not implemented")}}}function aur(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function ei(t,e=!1){return t instanceof Error?t.message+` ${t?.cause?"more message: "+t.cause.message:""} -${e?t.stack:""}`:JSON.stringify(t)}function u4(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function eJ(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 Xb(t){let e=hF[t];return{...e,label:e.label||t}}function kf(t,e){let r=hF[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}async function l4(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new Rh.Notice("No active leaf found.");return}if(r.view instanceof Rh.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof Rh.MarkdownView)){new Rh.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to"),a=FR(t);e?n.replaceRange(a,o,i):n.replaceRange(a,i),new Rh.Notice("Message inserted into the active note.")}function tJ(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function rJ(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]!t.includes(e)).map(([e])=>e)}function mF(t,e){let r=!!ege().find(i=>i===t.provider),n=Qb[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 rur(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text).join(""):String(t||"")}function FR(t){let r=rur(t).replace(/[\s\S]*?<\/think>/g,"");return r=r.replace(/[\s\S]*$/g,""),r.trim()}function _Ve(){return crypto.randomUUID()}async function yy(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}}var Ghe,Rh,Whe,Jhe,Qsr,eur,fVe,Vl,Xhe,Cn=w(()=>{Fd();$r();yo();Ghe=F(uVe()),Rh=require("obsidian"),Whe={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}`};Jhe=(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)return!1}return!0})};Qsr=t=>t.last.bound.modelName||t.last.bound.model,eur=t=>t.last.bound.retriever!==void 0,fVe=t=>Qsr(t)||eur(t),Vl=(t,e="local")=>{let r=(0,Ghe.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};Xhe=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/});var gF,tge,c4,Fd=w(()=>{gy();qE();Sm();RHe();Cn();gF=class gF{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.bind({signal:i?.signal}),s=bi.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return gF.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=gF.instances.get("llm_chain");return r||(r=gF.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=Dd.fromTemplate(`Given the following conversation and a follow up question, +${e?t.stack:""}`:JSON.stringify(t)}function l4(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function tJ(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 Xb(t){let e=gF[t];return{...e,label:e.label||t}}function kf(t,e){let r=gF[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}async function c4(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new Rh.Notice("No active leaf found.");return}if(r.view instanceof Rh.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof Rh.MarkdownView)){new Rh.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to"),a=kR(t);e?n.replaceRange(a,o,i):n.replaceRange(a,i),new Rh.Notice("Message inserted into the active note.")}function rJ(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function nJ(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]!t.includes(e)).map(([e])=>e)}function hF(t,e){let r=!!nge().find(i=>i===t.provider),n=Qb[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 sur(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text).join(""):String(t||"")}function kR(t){let r=sur(t).replace(/[\s\S]*?<\/think>/g,"");return r=r.replace(/[\s\S]*$/g,""),r.trim()}function wVe(){return crypto.randomUUID()}async function yy(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}}var Zhe,Rh,Jhe,Xhe,our,iur,mVe,Vl,tge,yn=w(()=>{Fd();$r();yo();Zhe=F(cVe()),Rh=require("obsidian"),Jhe={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}`};Xhe=(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)return!1}return!0})};our=t=>t.last.bound.modelName||t.last.bound.model,iur=t=>t.last.bound.retriever!==void 0,mVe=t=>our(t)||iur(t),Vl=(t,e="local")=>{let r=(0,Zhe.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};tge=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/});var yF,oge,d4,Fd=w(()=>{gy();qE();Sm();NHe();yn();yF=class yF{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.bind({signal:i?.signal}),s=bi.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return yF.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=yF.instances.get("llm_chain");return r||(r=yF.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=Dd.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. @@ -128,7 +128,7 @@ Answer the question with as detailed as possible based only on the following con Question: {question} `),d=b=>b.map(y=>`Human: ${y[0]} Assistant: ${y[1]}`).join(` -`),f=bi.from([{question:b=>(n&&console.log("Input Question: ",b.question),b.question),chat_history:b=>{let g=d(b.chat_history);return n&&console.log("Formatted Chat History: ",g),g}},u,o,new zG,b=>{let g=FR(b);return n&&console.log("Standalone Question: ",g),g}]),p=async b=>(r(b),Ihe(b)),m=bi.from([{context:i.pipe(p),question:new go,system_message:()=>a},c,o]);return f.pipe(m)}};gF.instances=new Map;tge=gF,c4=tge});var d4=w(()=>{});var VE,Es,Pi,e_,aVe,sVe,f4,oJ,wVe,rge,SVe,nge,oge,t_,LC,jh,DC,WE,Zb,HE,jR,Khe,hF,Qb,xVe,Br,ige,Nh,Ic,Dh,$r=w(()=>{l2();Fd();d4();VE="https://api.brevilabs.com/v1",Es="copilot-chat-view",Pi="user",e_="ai",aVe=`You are Obsidian Copilot, a helpful assistant that integrates AI to Obsidian note-taking. +`),f=bi.from([{question:b=>(n&&console.log("Input Question: ",b.question),b.question),chat_history:b=>{let g=d(b.chat_history);return n&&console.log("Formatted Chat History: ",g),g}},u,o,new HG,b=>{let g=kR(b);return n&&console.log("Standalone Question: ",g),g}]),p=async b=>(r(b),jhe(b)),m=bi.from([{context:i.pipe(p),question:new go,system_message:()=>a},c,o]);return f.pipe(m)}};yF.instances=new Map;oge=yF,d4=oge});var f4=w(()=>{});var VE,Es,Pi,e_,SVe,xVe,uVe,lVe,p4,iJ,OVe,ige,PVe,age,sge,t_,FC,jh,LC,WE,Zb,HE,jR,Yhe,gF,Qb,EVe,Br,uge,Nh,Ic,Dh,$r=w(()=>{c2();Fd();f4();VE="https://api.brevilabs.com/v1",Es="copilot-chat-view",Pi="user",e_="ai",SVe="copilot-conversations",xVe="copilot-custom-prompts",uVe=`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. @@ -141,7 +141,7 @@ Assistant: ${y[1]}`).join(` 10. When generating a table, use compact formatting without excessive whitespace. 11. Always respond in the language of the user's query. 12. Do NOT mention the additional context provided such as getCurrentTime and getTimeRangeMs if it's irrelevant to the user message. - 13. If the user mentions "tags", it most likely means tags in Obsidian note properties.`,sVe=`Return the new note content or canvas JSON in a special JSON format. + 13. If the user mentions "tags", it most likely means tags in Obsidian note properties.`,lVe=`Return the new note content or canvas JSON in a special JSON format. # 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. @@ -201,88 +201,88 @@ Assistant: ${y[1]}`).join(` - 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`,f4="note_context",oJ=`Copilot index does not exist. Please index your vault first! + - Edge fromNode and toNode must reference existing node IDs`,p4="note_context",iJ=`Copilot index does not exist. Please index your vault first! 1. Set a working embedding model in QA settings. If it's not a local model, don't forget to set the API key. -2. Click 'Refresh Index for Vault' and wait for indexing to complete. If you encounter the rate limiting error, please turn your request per second down in QA setting.`,wVe=6e3,rge=.4,SVe=.4,nge=15,oge=448e3,t_={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree"},LC={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"},jh={MAX_TOKENS:6e3,TEMPERATURE:.1},DC=(m=>(m.OPENAI="openai",m.OPENAI_FORMAT="3rd party (openai-format)",m.AZURE_OPENAI="azure openai",m.ANTHROPIC="anthropic",m.COHEREAI="cohereai",m.GOOGLE="google",m.XAI="xai",m.OPENROUTERAI="openrouterai",m.GROQ="groq",m.OLLAMA="ollama",m.LM_STUDIO="lm-studio",m.COPILOT_PLUS="copilot-plus",m.MISTRAL="mistralai",m.DEEPSEEK="deepseek",m))(DC||{}),WE={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},Zb=[{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-preview-06-17",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-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,core:!0,capabilities:["vision"]},{name:"o4-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["reasoning"]},{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:"claude-3-5-sonnet-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"claude-3-5-haiku-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0},{name:"grok-3-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"grok-3-mini-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"gemini-2.5-flash",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:"command-r",provider:"cohereai",enabled:!0,isBuiltIn:!0},{name:"command-r-plus",provider:"cohereai",enabled:!0,isBuiltIn:!0},{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"]}],HE=(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))(HE||{}),jR=[{name:"copilot-plus-small",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0},{name:"copilot-plus-large",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0,believerExclusive:!0,dimensions:1024},{name:"copilot-plus-multilingual",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0,dimensions:512},{name:"text-embedding-3-small",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"text-embedding-3-large",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"embed-multilingual-light-v3.0",provider:"cohereai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"text-embedding-004",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0}],Khe="nomic-embed-text",hF={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"},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"},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"},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"},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:""}},Qb={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey",xai:"xaiApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey",deepseek:"deepseekApiKey"},xVe=["NEVER","ON STARTUP","ON MODE SWITCH"],Br={APPLY_ADHOC_PROMPT:"apply-adhoc-prompt",CLEAR_LOCAL_COPILOT_INDEX:"clear-local-copilot-index",CLEAR_COPILOT_CACHE:"clear-copilot-cache",COUNT_WORD_AND_TOKENS_SELECTION:"count-word-and-tokens-selection",COUNT_TOTAL_VAULT_TOKENS:"count-total-vault-tokens",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"},ige={[Br.APPLY_ADHOC_PROMPT]:"Apply ad-hoc custom prompt",[Br.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[Br.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[Br.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[Br.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[Br.DEBUG_WORD_COMPLETION]:"Word completion: Debug",[Br.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[Br.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[Br.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[Br.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[Br.LIST_INDEXED_FILES]:"List all indexed files (debug)",[Br.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[Br.NEW_CHAT]:"New Copilot Chat",[Br.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[Br.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[Br.SEARCH_ORAMA_DB]:"Search OramaDB (debug)",[Br.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[Br.TOGGLE_AUTOCOMPLETE]:"Toggle autocomplete",[Br.ADD_SELECTION_TO_CHAT_CONTEXT]:"Add selection to chat context"},Nh={DELAY_MS:600,MIN_TRIGGER_LENGTH:3,MAX_CONTEXT_LENGTH:1e4,KEYBIND:"Tab"},Ic={userId:yC(),isPlusUser:!1,plusLicenseKey:"",openAIApiKey:"",openAIOrgId:"",huggingfaceApiKey:"",cohereApiKey:"",anthropicApiKey:"",azureOpenAIApiKey:"",azureOpenAIApiInstanceName:"",azureOpenAIApiDeploymentName:"",azureOpenAIApiVersion:"",azureOpenAIApiEmbeddingDeploymentName:"",googleApiKey:"",openRouterAiApiKey:"",xaiApiKey:"",mistralApiKey:"",deepseekApiKey:"",defaultChainType:"llm_chain",defaultModelKey:"gpt-4.1|openai",embeddingModelKey:"text-embedding-3-small|openai",temperature:jh.TEMPERATURE,maxTokens:jh.MAX_TOKENS,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:"copilot-conversations",defaultConversationTag:"copilot-conversation",autosaveChat:!1,includeActiveNoteAsContext:!0,defaultOpenArea:"view",customPromptsFolder:"copilot-custom-prompts",indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:"",qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:3,groqApiKey:"",activeModels:Zb,activeEmbeddingModels:jR,embeddingRequestsPerMin:90,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,promptUsageTimestamps:{},promptSortStrategy:"timestamp",defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:[],projectList:[],enableAutocomplete:!1,autocompleteAcceptKey:Nh.KEYBIND,allowAdditionalContext:!0,enableWordCompletion:!1,lastDismissedVersion:null,passMarkdownImages:!0,enableCustomPromptTemplating:!0,suggestedDefaultCommands:!1},Dh={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change",ABORT_STREAM:"abort-stream"}});var sge=v(iJ=>{"use strict";iJ.byteLength=our;iJ.toByteArray=aur;iJ.fromByteArray=lur;var r_=[],Lh=[],nur=typeof Uint8Array<"u"?Uint8Array:Array,age="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(kR=0,CVe=age.length;kR0)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 our(t){var e=OVe(t),r=e[0],n=e[1];return(r+n)*3/4-n}function iur(t,e,r){return(e+r)*3/4-r}function aur(t){var e,r=OVe(t),n=r[0],o=r[1],i=new nur(iur(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=Lh[t.charCodeAt(u)]<<2|Lh[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=Lh[t.charCodeAt(u)]<<10|Lh[t.charCodeAt(u+1)]<<4|Lh[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function sur(t){return r_[t>>18&63]+r_[t>>12&63]+r_[t>>6&63]+r_[t&63]}function uur(t,e,r){for(var n,o=[],i=e;is?s:a+i));return n===1?(e=t[r-1],o.push(r_[e>>2]+r_[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(r_[e>>10]+r_[e>>4&63]+r_[e<<2&63]+"=")),o.join("")}});var PVe=v(uge=>{uge.read=function(t,e,r,n,o){var i,a,s=o*8-n-1,u=(1<>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)};uge.write=function(t,e,r,n,o,i){var a,s,u,l=i*8-o-1,c=(1<>1,f=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,m=n?1:-1,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+d>=1?e+=f/u:e+=f*Math.pow(2,1-d),e*u>=2&&(a++,u/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(e*u-1)*Math.pow(2,o),a=a+d):(s=e*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;t[r+p]=s&255,p+=m,s/=256,o-=8);for(a=a<0;t[r+p]=a&255,p+=m,a/=256,l-=8);t[r+p-m]|=h*128}});var Pp=v(vF=>{"use strict";var lge=sge(),bF=PVe(),EVe=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;vF.Buffer=be;vF.SlowBuffer=hur;vF.INSPECT_MAX_BYTES=50;var aJ=2147483647;vF.kMaxLength=aJ;be.TYPED_ARRAY_SUPPORT=cur();!be.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 cur(){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(be.prototype,"parent",{enumerable:!0,get:function(){if(be.isBuffer(this))return this.buffer}});Object.defineProperty(be.prototype,"offset",{enumerable:!0,get:function(){if(be.isBuffer(this))return this.byteOffset}});function FC(t){if(t>aJ)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,be.prototype),e}function be(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 pge(t)}return MVe(t,e,r)}be.poolSize=8192;function MVe(t,e,r){if(typeof t=="string")return fur(t,e);if(ArrayBuffer.isView(t))return pur(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(n_(t,ArrayBuffer)||t&&n_(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(n_(t,SharedArrayBuffer)||t&&n_(t.buffer,SharedArrayBuffer)))return dge(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 be.from(n,e,r);let o=mur(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return be.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)}be.from=function(t,e,r){return MVe(t,e,r)};Object.setPrototypeOf(be.prototype,Uint8Array.prototype);Object.setPrototypeOf(be,Uint8Array);function RVe(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 dur(t,e,r){return RVe(t),t<=0?FC(t):e!==void 0?typeof r=="string"?FC(t).fill(e,r):FC(t).fill(e):FC(t)}be.alloc=function(t,e,r){return dur(t,e,r)};function pge(t){return RVe(t),FC(t<0?0:mge(t)|0)}be.allocUnsafe=function(t){return pge(t)};be.allocUnsafeSlow=function(t){return pge(t)};function fur(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!be.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=jVe(t,e)|0,n=FC(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function cge(t){let e=t.length<0?0:mge(t.length)|0,r=FC(e);for(let n=0;n=aJ)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+aJ.toString(16)+" bytes");return t|0}function hur(t){return+t!=t&&(t=0),be.alloc(+t)}be.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==be.prototype};be.compare=function(e,r){if(n_(e,Uint8Array)&&(e=be.from(e,e.offset,e.byteLength)),n_(r,Uint8Array)&&(r=be.from(r,r.offset,r.byteLength)),!be.isBuffer(e)||!be.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);io.length?(be.isBuffer(a)||(a=be.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(be.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function jVe(t,e){if(be.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||n_(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 fge(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return UVe(t).length;default:if(o)return n?-1:fge(t).length;e=(""+e).toLowerCase(),o=!0}}be.byteLength=jVe;function gur(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 Pur(this,e,r);case"utf8":case"utf-8":return DVe(this,e,r);case"ascii":return Cur(this,e,r);case"latin1":case"binary":return Our(this,e,r);case"base64":return Sur(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Eur(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}be.prototype._isBuffer=!0;function $R(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}be.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;rr&&(e+=" ... "),""};EVe&&(be.prototype[EVe]=be.prototype.inspect);be.prototype.compare=function(e,r,n,o,i){if(n_(e,Uint8Array)&&(e=be.from(e,e.offset,e.byteLength)),!be.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;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,gge(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=be.from(e,n)),be.isBuffer(e))return e.length===0?-1:TVe(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):TVe(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function TVe(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;la&&(r=a-s),l=r;l>=0;l--){let c=!0;for(let d=0;do&&(n=o)):n=o;let i=e.length;n>i/2&&(n=i/2);let a;for(a=0;a>>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 yur(this,e,r,n);case"utf8":case"utf-8":return bur(this,e,r,n);case"ascii":case"latin1":case"binary":return _ur(this,e,r,n);case"base64":return vur(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wur(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};be.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Sur(t,e,r){return e===0&&r===t.length?lge.fromByteArray(t):lge.fromByteArray(t.slice(e,r))}function DVe(t,e,r){r=Math.min(t.length,r);let n=[],o=e;for(;o239?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 xur(n)}var AVe=4096;function xur(t){let e=t.length;if(e<=AVe)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let o="";for(let i=e;in&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}be.prototype.readUintLE=be.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Wl(e,r,this.length);let o=this[e],i=1,a=0;for(;++a>>0,r=r>>>0,n||Wl(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};be.prototype.readUint8=be.prototype.readUInt8=function(e,r){return e=e>>>0,r||Wl(e,1,this.length),this[e]};be.prototype.readUint16LE=be.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Wl(e,2,this.length),this[e]|this[e+1]<<8};be.prototype.readUint16BE=be.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Wl(e,2,this.length),this[e]<<8|this[e+1]};be.prototype.readUint32LE=be.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};be.prototype.readUint32BE=be.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};be.prototype.readBigUInt64LE=KE(function(e){e=e>>>0,_F(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&p4(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)<>>0,_F(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&p4(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)<>>0,r=r>>>0,n||Wl(e,r,this.length);let o=this[e],i=1,a=0;for(;++a=i&&(o-=Math.pow(2,8*r)),o};be.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Wl(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};be.prototype.readInt8=function(e,r){return e=e>>>0,r||Wl(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};be.prototype.readInt16LE=function(e,r){e=e>>>0,r||Wl(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};be.prototype.readInt16BE=function(e,r){e=e>>>0,r||Wl(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};be.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};be.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};be.prototype.readBigInt64LE=KE(function(e){e=e>>>0,_F(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&p4(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(o)<>>0,_F(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&p4(e,this.length-8);let o=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(o)<>>0,r||Wl(e,4,this.length),bF.read(this,e,!0,23,4)};be.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),bF.read(this,e,!1,23,4)};be.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Wl(e,8,this.length),bF.read(this,e,!0,52,8)};be.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Wl(e,8,this.length),bF.read(this,e,!1,52,8)};function Op(t,e,r,n,o,i){if(!be.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}be.prototype.writeUintLE=be.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;Op(this,e,r,n,s,0)}let i=1,a=0;for(this[r]=e&255;++a>>0,n=n>>>0,!o){let s=Math.pow(2,8*n)-1;Op(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};be.prototype.writeUint8=be.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,1,255,0),this[r]=e&255,r+1};be.prototype.writeUint16LE=be.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};be.prototype.writeUint16BE=be.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};be.prototype.writeUint32LE=be.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Op(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};be.prototype.writeUint32BE=be.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Op(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 LVe(t,e,r,n,o){qVe(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 FVe(t,e,r,n,o){qVe(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}be.prototype.writeBigUInt64LE=KE(function(e,r=0){return LVe(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});be.prototype.writeBigUInt64BE=KE(function(e,r=0){return FVe(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});be.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Op(this,e,r,n,u-1,-u)}let i=0,a=1,s=0;for(this[r]=e&255;++i>0)-s&255;return r+n};be.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Op(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};be.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};be.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};be.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};be.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Op(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};be.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Op(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};be.prototype.writeBigInt64LE=KE(function(e,r=0){return LVe(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});be.prototype.writeBigInt64BE=KE(function(e,r=0){return FVe(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function kVe(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 $Ve(t,e,r,n,o){return e=+e,r=r>>>0,o||kVe(t,e,r,4,34028234663852886e22,-34028234663852886e22),bF.write(t,e,r,n,23,4),r+4}be.prototype.writeFloatLE=function(e,r,n){return $Ve(this,e,r,!0,n)};be.prototype.writeFloatBE=function(e,r,n){return $Ve(this,e,r,!1,n)};function BVe(t,e,r,n,o){return e=+e,r=r>>>0,o||kVe(t,e,r,8,17976931348623157e292,-17976931348623157e292),bF.write(t,e,r,n,52,8),r+8}be.prototype.writeDoubleLE=function(e,r,n){return BVe(this,e,r,!0,n)};be.prototype.writeDoubleBE=function(e,r,n){return BVe(this,e,r,!1,n)};be.prototype.copy=function(e,r,n,o){if(!be.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=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>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let i;if(typeof e=="number")for(i=r;i2**32?o=IVe(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=IVe(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function IVe(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 Tur(t,e,r){_F(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&p4(e,t.length-(r+1))}function qVe(t,e,r,n,o,i){if(t>r||t3?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 yF.ERR_OUT_OF_RANGE("value",s,t)}Tur(n,o,i)}function _F(t,e){if(typeof t!="number")throw new yF.ERR_INVALID_ARG_TYPE(e,"number",t)}function p4(t,e,r){throw Math.floor(t)!==t?(_F(t,r),new yF.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new yF.ERR_BUFFER_OUT_OF_BOUNDS:new yF.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Aur=/[^+/0-9A-Za-z-_]/g;function Iur(t){if(t=t.split("=")[0],t=t.trim().replace(Aur,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function fge(t,e){e=e||1/0;let r,n=t.length,o=null,i=[];for(let a=0;a55295&&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 Mur(t){let e=[];for(let r=0;r>8,o=r%256,i.push(o),i.push(n);return i}function UVe(t){return lge.toByteArray(Iur(t))}function sJ(t,e,r,n){let o;for(o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function n_(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function gge(t){return t!==t}var jur=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 KE(t){return typeof BigInt>"u"?Nur:t}function Nur(){throw new Error("BigInt not supported")}});function m4(){return HVe.Platform.isDesktop&&uJ||(uJ=require("electron")?.remote?.safeStorage),uJ}async function wge(){return await crypto.subtle.importKey("raw",Dur,lJ.name,!1,["encrypt","decrypt"])}async function VVe(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 yge(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await yge(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await yge(n.apiKey||"")})))),e}async function yge(t){if(!t||t.startsWith(Sge))return t;WVe(t)&&(t=t.replace(cJ,""));try{if(m4()?.isEncryptionAvailable()){let o=m4().encryptString(t);return _ge+o.toString("base64")}let e=await wge(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(lJ,e,r);return vge+Fur(n)}catch(e){return console.error("Encryption failed:",e),t}}async function eo(t){if(!t||Lur(t))return t;if(WVe(t))return t.replace(cJ,"");if(t.startsWith(_ge)){let r=t.replace(_ge,""),n=bge.Buffer.from(r,"base64");return m4().decryptString(n)}if(t.startsWith(vge)){let r=t.replace(vge,""),n=await wge(),o=zVe(r),i=await crypto.subtle.decrypt(lJ,n,o);return new TextDecoder().decode(i)}let e=t.replace(Sge,"");try{if(m4()?.isEncryptionAvailable())try{let i=bge.Buffer.from(e,"base64");return m4().decryptString(i)}catch{}let r=await wge(),n=zVe(e),o=await crypto.subtle.decrypt(lJ,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function Lur(t){return!t.startsWith(Sge)&&!t.startsWith(cJ)}function WVe(t){return t.startsWith(cJ)}function Fur(t){let e=new Uint8Array(t),r="";for(let n=0;n{bge=F(Pp()),HVe=require("obsidian"),uJ=null;_ge="enc_desk_",vge="enc_web_",Sge="enc_",cJ="dec_",Dur=new TextEncoder().encode("obsidian-copilot-v1"),lJ={name:"AES-GCM",iv:new Uint8Array(12)}});function YVe(t){ls.set(fJ,t)}function mJ(){return ls.get(fJ)}function ZVe(t){return ls.sub(fJ,t)}function wF(){return a4(fJ,{store:ls})}function Fh(){return ls.get(pJ)}function qR(t){ls.set(pJ,t)}function XVe(t){return ls.sub(pJ,t)}function by(){return a4(pJ,{store:ls})}function UR(t){ls.set(dJ,t)}function Mc(){return ls.get(dJ)}function SF(t){return ls.sub(dJ,()=>{t(ls.get(dJ))})}function GE(t){ls.set(JVe,t)}function QVe(){return a4(JVe,{store:ls})}function zR(){return Fh()==="project"}function Cge(t){ls.set(xge,t)}function hJ(){return ls.get(xge)}function e8e(t){let e=hJ();Cge([...e,t])}function t8e(t){let e=hJ();Cge(e.filter(r=>r.id!==t))}function r8e(){Cge([])}function n8e(){return a4(xge,{store:ls})}var KVe,fJ,GVe,pJ,dJ,JVe,xge,Cl=w(()=>{Fd();nr();s4();KVe=Ih(null),fJ=Ih(t=>{let e=t(KVe);return e!==null?e:t(RR).defaultModelKey},(t,e,r)=>{e(KVe,r)}),GVe=Ih(null),pJ=Ih(t=>{let e=t(GVe);return e!==null?e:t(RR).defaultChainType},(t,e,r)=>{e(GVe,r)}),dJ=Ih(null),JVe=Ih(!1),xge=Ih([])});var p8e=v(Ui=>{"use strict";function Tge(t,e){var r=t.length;t.push(e);e:for(;0>>1,o=t[n];if(0>>1;ngJ(s,r))ugJ(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(ugJ(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function gJ(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(o8e=performance,Ui.unstable_now=function(){return o8e.now()}):(Oge=Date,i8e=Oge.now(),Ui.unstable_now=function(){return Oge.now()-i8e});var o8e,Oge,i8e,o_=[],JE=[],kur=1,kh=null,kd=3,_J=!1,HR=!1,g4=!1,u8e=typeof setTimeout=="function"?setTimeout:null,l8e=typeof clearTimeout=="function"?clearTimeout:null,a8e=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Age(t){for(var e=_y(JE);e!==null;){if(e.callback===null)bJ(JE);else if(e.startTime<=t)bJ(JE),e.sortIndex=e.expirationTime,Tge(o_,e);else break;e=_y(JE)}}function Ige(t){if(g4=!1,Age(t),!HR)if(_y(o_)!==null)HR=!0,Rge(Mge);else{var e=_y(JE);e!==null&&jge(Ige,e.startTime-t)}}function Mge(t,e){HR=!1,g4&&(g4=!1,l8e(y4),y4=-1),_J=!0;var r=kd;try{for(Age(e),kh=_y(o_);kh!==null&&(!(kh.expirationTime>e)||t&&!f8e());){var n=kh.callback;if(typeof n=="function"){kh.callback=null,kd=kh.priorityLevel;var o=n(kh.expirationTime<=e);e=Ui.unstable_now(),typeof o=="function"?kh.callback=o:kh===_y(o_)&&bJ(o_),Age(e)}else bJ(o_);kh=_y(o_)}if(kh!==null)var i=!0;else{var a=_y(JE);a!==null&&jge(Ige,a.startTime-e),i=!1}return i}finally{kh=null,kd=r,_J=!1}}var vJ=!1,yJ=null,y4=-1,c8e=5,d8e=-1;function f8e(){return!(Ui.unstable_now()-d8et||125n?(t.sortIndex=r,Tge(JE,t),_y(o_)===null&&t===_y(JE)&&(g4?(l8e(y4),y4=-1):g4=!0,jge(Ige,r-n))):(t.sortIndex=o,Tge(o_,t),HR||_J||(HR=!0,Rge(Mge))),t};Ui.unstable_shouldYield=f8e;Ui.unstable_wrapCallback=function(t){var e=kd;return function(){var r=kd;kd=e;try{return t.apply(this,arguments)}finally{kd=r}}}});var h8e=v((zzn,m8e)=>{"use strict";m8e.exports=p8e()});var wWe=v(Tm=>{"use strict";var S6e=X(),Pm=h8e();function qe(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rye=Object.prototype.hasOwnProperty,$ur=/^[: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]*$/,g8e={},y8e={};function Bur(t){return rye.call(y8e,t)?!0:rye.call(g8e,t)?!1:$ur.test(t)?y8e[t]=!0:(g8e[t]=!0,!1)}function qur(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 Uur(t,e,r,n){if(e===null||typeof e>"u"||qur(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 qf(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 Nc={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Nc[t]=new qf(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Nc[e]=new qf(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Nc[t]=new qf(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Nc[t]=new qf(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){Nc[t]=new qf(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Nc[t]=new qf(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Nc[t]=new qf(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Nc[t]=new qf(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Nc[t]=new qf(t,5,!1,t.toLowerCase(),null,!1,!1)});var Gye=/[\-:]([a-z])/g;function Jye(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(Gye,Jye);Nc[e]=new qf(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(Gye,Jye);Nc[e]=new qf(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(Gye,Jye);Nc[e]=new qf(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Nc[t]=new qf(t,1,!1,t.toLowerCase(),null,!1,!1)});Nc.xlinkHref=new qf("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Nc[t]=new qf(t,1,!1,t.toLowerCase(),null,!0,!0)});function Yye(t,e,r,n){var o=Nc.hasOwnProperty(e)?Nc[e]:null;(o!==null?o.type!==0:n||!(2(m.OPENAI="openai",m.OPENAI_FORMAT="3rd party (openai-format)",m.AZURE_OPENAI="azure openai",m.ANTHROPIC="anthropic",m.COHEREAI="cohereai",m.GOOGLE="google",m.XAI="xai",m.OPENROUTERAI="openrouterai",m.GROQ="groq",m.OLLAMA="ollama",m.LM_STUDIO="lm-studio",m.COPILOT_PLUS="copilot-plus",m.MISTRAL="mistralai",m.DEEPSEEK="deepseek",m))(LC||{}),WE={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},Zb=[{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-preview-06-17",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-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,core:!0,capabilities:["vision"]},{name:"o4-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["reasoning"]},{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:"claude-3-5-sonnet-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"claude-3-5-haiku-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0},{name:"grok-3-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"grok-3-mini-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"gemini-2.5-flash",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:"command-r",provider:"cohereai",enabled:!0,isBuiltIn:!0},{name:"command-r-plus",provider:"cohereai",enabled:!0,isBuiltIn:!0},{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"]}],HE=(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))(HE||{}),jR=[{name:"copilot-plus-small",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0},{name:"copilot-plus-large",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0,believerExclusive:!0,dimensions:1024},{name:"copilot-plus-multilingual",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0,dimensions:512},{name:"text-embedding-3-small",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"text-embedding-3-large",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"embed-multilingual-light-v3.0",provider:"cohereai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"text-embedding-004",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0}],Yhe="nomic-embed-text",gF={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"},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"},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"},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"},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:""}},Qb={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey",xai:"xaiApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey",deepseek:"deepseekApiKey"},EVe=["NEVER","ON STARTUP","ON MODE SWITCH"],Br={APPLY_ADHOC_PROMPT:"apply-adhoc-prompt",CLEAR_LOCAL_COPILOT_INDEX:"clear-local-copilot-index",CLEAR_COPILOT_CACHE:"clear-copilot-cache",COUNT_WORD_AND_TOKENS_SELECTION:"count-word-and-tokens-selection",COUNT_TOTAL_VAULT_TOKENS:"count-total-vault-tokens",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"},uge={[Br.APPLY_ADHOC_PROMPT]:"Apply ad-hoc custom prompt",[Br.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[Br.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[Br.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[Br.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[Br.DEBUG_WORD_COMPLETION]:"Word completion: Debug",[Br.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[Br.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[Br.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[Br.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[Br.LIST_INDEXED_FILES]:"List all indexed files (debug)",[Br.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[Br.NEW_CHAT]:"New Copilot Chat",[Br.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[Br.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[Br.SEARCH_ORAMA_DB]:"Search OramaDB (debug)",[Br.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[Br.TOGGLE_AUTOCOMPLETE]:"Toggle autocomplete",[Br.ADD_SELECTION_TO_CHAT_CONTEXT]:"Add selection to chat context"},Nh={DELAY_MS:600,MIN_TRIGGER_LENGTH:3,MAX_CONTEXT_LENGTH:1e4,KEYBIND:"Tab"},Ic={userId:bC(),isPlusUser:!1,plusLicenseKey:"",openAIApiKey:"",openAIOrgId:"",huggingfaceApiKey:"",cohereApiKey:"",anthropicApiKey:"",azureOpenAIApiKey:"",azureOpenAIApiInstanceName:"",azureOpenAIApiDeploymentName:"",azureOpenAIApiVersion:"",azureOpenAIApiEmbeddingDeploymentName:"",googleApiKey:"",openRouterAiApiKey:"",xaiApiKey:"",mistralApiKey:"",deepseekApiKey:"",defaultChainType:"llm_chain",defaultModelKey:"gpt-4.1|openai",embeddingModelKey:"text-embedding-3-small|openai",temperature:jh.TEMPERATURE,maxTokens:jh.MAX_TOKENS,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:SVe,defaultConversationTag:"copilot-conversation",autosaveChat:!1,includeActiveNoteAsContext:!0,defaultOpenArea:"view",customPromptsFolder:xVe,indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:`${SVe},${xVe}`,qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:3,groqApiKey:"",activeModels:Zb,activeEmbeddingModels:jR,embeddingRequestsPerMin:90,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,promptUsageTimestamps:{},promptSortStrategy:"timestamp",defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:[],projectList:[],enableAutocomplete:!1,autocompleteAcceptKey:Nh.KEYBIND,allowAdditionalContext:!0,enableWordCompletion:!1,lastDismissedVersion:null,passMarkdownImages:!0,enableCustomPromptTemplating:!0,suggestedDefaultCommands:!1},Dh={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change",ABORT_STREAM:"abort-stream"}});var cge=v(aJ=>{"use strict";aJ.byteLength=lur;aJ.toByteArray=dur;aJ.fromByteArray=mur;var r_=[],Lh=[],uur=typeof Uint8Array<"u"?Uint8Array:Array,lge="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for($R=0,TVe=lge.length;$R0)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 lur(t){var e=AVe(t),r=e[0],n=e[1];return(r+n)*3/4-n}function cur(t,e,r){return(e+r)*3/4-r}function dur(t){var e,r=AVe(t),n=r[0],o=r[1],i=new uur(cur(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=Lh[t.charCodeAt(u)]<<2|Lh[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=Lh[t.charCodeAt(u)]<<10|Lh[t.charCodeAt(u+1)]<<4|Lh[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function fur(t){return r_[t>>18&63]+r_[t>>12&63]+r_[t>>6&63]+r_[t&63]}function pur(t,e,r){for(var n,o=[],i=e;is?s:a+i));return n===1?(e=t[r-1],o.push(r_[e>>2]+r_[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(r_[e>>10]+r_[e>>4&63]+r_[e<<2&63]+"=")),o.join("")}});var IVe=v(dge=>{dge.read=function(t,e,r,n,o){var i,a,s=o*8-n-1,u=(1<>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)};dge.write=function(t,e,r,n,o,i){var a,s,u,l=i*8-o-1,c=(1<>1,f=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,m=n?1:-1,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+d>=1?e+=f/u:e+=f*Math.pow(2,1-d),e*u>=2&&(a++,u/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(e*u-1)*Math.pow(2,o),a=a+d):(s=e*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;t[r+p]=s&255,p+=m,s/=256,o-=8);for(a=a<0;t[r+p]=a&255,p+=m,a/=256,l-=8);t[r+p-m]|=h*128}});var Pp=v(wF=>{"use strict";var fge=cge(),_F=IVe(),MVe=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;wF.Buffer=be;wF.SlowBuffer=vur;wF.INSPECT_MAX_BYTES=50;var sJ=2147483647;wF.kMaxLength=sJ;be.TYPED_ARRAY_SUPPORT=hur();!be.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 hur(){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(be.prototype,"parent",{enumerable:!0,get:function(){if(be.isBuffer(this))return this.buffer}});Object.defineProperty(be.prototype,"offset",{enumerable:!0,get:function(){if(be.isBuffer(this))return this.byteOffset}});function kC(t){if(t>sJ)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,be.prototype),e}function be(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 gge(t)}return DVe(t,e,r)}be.poolSize=8192;function DVe(t,e,r){if(typeof t=="string")return yur(t,e);if(ArrayBuffer.isView(t))return bur(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(n_(t,ArrayBuffer)||t&&n_(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(n_(t,SharedArrayBuffer)||t&&n_(t.buffer,SharedArrayBuffer)))return mge(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 be.from(n,e,r);let o=_ur(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return be.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)}be.from=function(t,e,r){return DVe(t,e,r)};Object.setPrototypeOf(be.prototype,Uint8Array.prototype);Object.setPrototypeOf(be,Uint8Array);function LVe(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 gur(t,e,r){return LVe(t),t<=0?kC(t):e!==void 0?typeof r=="string"?kC(t).fill(e,r):kC(t).fill(e):kC(t)}be.alloc=function(t,e,r){return gur(t,e,r)};function gge(t){return LVe(t),kC(t<0?0:yge(t)|0)}be.allocUnsafe=function(t){return gge(t)};be.allocUnsafeSlow=function(t){return gge(t)};function yur(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!be.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=FVe(t,e)|0,n=kC(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function pge(t){let e=t.length<0?0:yge(t.length)|0,r=kC(e);for(let n=0;n=sJ)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+sJ.toString(16)+" bytes");return t|0}function vur(t){return+t!=t&&(t=0),be.alloc(+t)}be.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==be.prototype};be.compare=function(e,r){if(n_(e,Uint8Array)&&(e=be.from(e,e.offset,e.byteLength)),n_(r,Uint8Array)&&(r=be.from(r,r.offset,r.byteLength)),!be.isBuffer(e)||!be.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);io.length?(be.isBuffer(a)||(a=be.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(be.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function FVe(t,e){if(be.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||n_(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 hge(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return WVe(t).length;default:if(o)return n?-1:hge(t).length;e=(""+e).toLowerCase(),o=!0}}be.byteLength=FVe;function wur(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 Mur(this,e,r);case"utf8":case"utf-8":return $Ve(this,e,r);case"ascii":return Aur(this,e,r);case"latin1":case"binary":return Iur(this,e,r);case"base64":return Eur(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rur(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}be.prototype._isBuffer=!0;function BR(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}be.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;rr&&(e+=" ... "),""};MVe&&(be.prototype[MVe]=be.prototype.inspect);be.prototype.compare=function(e,r,n,o,i){if(n_(e,Uint8Array)&&(e=be.from(e,e.offset,e.byteLength)),!be.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;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,_ge(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=be.from(e,n)),be.isBuffer(e))return e.length===0?-1:RVe(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):RVe(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function RVe(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;la&&(r=a-s),l=r;l>=0;l--){let c=!0;for(let d=0;do&&(n=o)):n=o;let i=e.length;n>i/2&&(n=i/2);let a;for(a=0;a>>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 Sur(this,e,r,n);case"utf8":case"utf-8":return xur(this,e,r,n);case"ascii":case"latin1":case"binary":return Cur(this,e,r,n);case"base64":return Our(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pur(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};be.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Eur(t,e,r){return e===0&&r===t.length?fge.fromByteArray(t):fge.fromByteArray(t.slice(e,r))}function $Ve(t,e,r){r=Math.min(t.length,r);let n=[],o=e;for(;o239?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 Tur(n)}var jVe=4096;function Tur(t){let e=t.length;if(e<=jVe)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let o="";for(let i=e;in&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}be.prototype.readUintLE=be.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Wl(e,r,this.length);let o=this[e],i=1,a=0;for(;++a>>0,r=r>>>0,n||Wl(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};be.prototype.readUint8=be.prototype.readUInt8=function(e,r){return e=e>>>0,r||Wl(e,1,this.length),this[e]};be.prototype.readUint16LE=be.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Wl(e,2,this.length),this[e]|this[e+1]<<8};be.prototype.readUint16BE=be.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Wl(e,2,this.length),this[e]<<8|this[e+1]};be.prototype.readUint32LE=be.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};be.prototype.readUint32BE=be.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};be.prototype.readBigUInt64LE=KE(function(e){e=e>>>0,vF(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&m4(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)<>>0,vF(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&m4(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)<>>0,r=r>>>0,n||Wl(e,r,this.length);let o=this[e],i=1,a=0;for(;++a=i&&(o-=Math.pow(2,8*r)),o};be.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Wl(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};be.prototype.readInt8=function(e,r){return e=e>>>0,r||Wl(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};be.prototype.readInt16LE=function(e,r){e=e>>>0,r||Wl(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};be.prototype.readInt16BE=function(e,r){e=e>>>0,r||Wl(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};be.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};be.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};be.prototype.readBigInt64LE=KE(function(e){e=e>>>0,vF(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&m4(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(o)<>>0,vF(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&m4(e,this.length-8);let o=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(o)<>>0,r||Wl(e,4,this.length),_F.read(this,e,!0,23,4)};be.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),_F.read(this,e,!1,23,4)};be.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Wl(e,8,this.length),_F.read(this,e,!0,52,8)};be.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Wl(e,8,this.length),_F.read(this,e,!1,52,8)};function Op(t,e,r,n,o,i){if(!be.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}be.prototype.writeUintLE=be.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;Op(this,e,r,n,s,0)}let i=1,a=0;for(this[r]=e&255;++a>>0,n=n>>>0,!o){let s=Math.pow(2,8*n)-1;Op(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};be.prototype.writeUint8=be.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,1,255,0),this[r]=e&255,r+1};be.prototype.writeUint16LE=be.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};be.prototype.writeUint16BE=be.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};be.prototype.writeUint32LE=be.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Op(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};be.prototype.writeUint32BE=be.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Op(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 BVe(t,e,r,n,o){VVe(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 qVe(t,e,r,n,o){VVe(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}be.prototype.writeBigUInt64LE=KE(function(e,r=0){return BVe(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});be.prototype.writeBigUInt64BE=KE(function(e,r=0){return qVe(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});be.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Op(this,e,r,n,u-1,-u)}let i=0,a=1,s=0;for(this[r]=e&255;++i>0)-s&255;return r+n};be.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Op(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};be.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};be.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};be.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};be.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Op(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};be.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Op(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};be.prototype.writeBigInt64LE=KE(function(e,r=0){return BVe(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});be.prototype.writeBigInt64BE=KE(function(e,r=0){return qVe(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function UVe(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 zVe(t,e,r,n,o){return e=+e,r=r>>>0,o||UVe(t,e,r,4,34028234663852886e22,-34028234663852886e22),_F.write(t,e,r,n,23,4),r+4}be.prototype.writeFloatLE=function(e,r,n){return zVe(this,e,r,!0,n)};be.prototype.writeFloatBE=function(e,r,n){return zVe(this,e,r,!1,n)};function HVe(t,e,r,n,o){return e=+e,r=r>>>0,o||UVe(t,e,r,8,17976931348623157e292,-17976931348623157e292),_F.write(t,e,r,n,52,8),r+8}be.prototype.writeDoubleLE=function(e,r,n){return HVe(this,e,r,!0,n)};be.prototype.writeDoubleBE=function(e,r,n){return HVe(this,e,r,!1,n)};be.prototype.copy=function(e,r,n,o){if(!be.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=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>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let i;if(typeof e=="number")for(i=r;i2**32?o=NVe(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=NVe(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function NVe(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 jur(t,e,r){vF(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&m4(e,t.length-(r+1))}function VVe(t,e,r,n,o,i){if(t>r||t3?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 bF.ERR_OUT_OF_RANGE("value",s,t)}jur(n,o,i)}function vF(t,e){if(typeof t!="number")throw new bF.ERR_INVALID_ARG_TYPE(e,"number",t)}function m4(t,e,r){throw Math.floor(t)!==t?(vF(t,r),new bF.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new bF.ERR_BUFFER_OUT_OF_BOUNDS:new bF.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Nur=/[^+/0-9A-Za-z-_]/g;function Dur(t){if(t=t.split("=")[0],t=t.trim().replace(Nur,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function hge(t,e){e=e||1/0;let r,n=t.length,o=null,i=[];for(let a=0;a55295&&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 Lur(t){let e=[];for(let r=0;r>8,o=r%256,i.push(o),i.push(n);return i}function WVe(t){return fge.toByteArray(Dur(t))}function uJ(t,e,r,n){let o;for(o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function n_(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function _ge(t){return t!==t}var kur=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 KE(t){return typeof BigInt>"u"?$ur:t}function $ur(){throw new Error("BigInt not supported")}});function h4(){return GVe.Platform.isDesktop&&lJ||(lJ=require("electron")?.remote?.safeStorage),lJ}async function Cge(){return await crypto.subtle.importKey("raw",Bur,cJ.name,!1,["encrypt","decrypt"])}async function JVe(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 vge(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await vge(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await vge(n.apiKey||"")})))),e}async function vge(t){if(!t||t.startsWith(Oge))return t;YVe(t)&&(t=t.replace(dJ,""));try{if(h4()?.isEncryptionAvailable()){let o=h4().encryptString(t);return Sge+o.toString("base64")}let e=await Cge(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(cJ,e,r);return xge+Uur(n)}catch(e){return console.error("Encryption failed:",e),t}}async function eo(t){if(!t||qur(t))return t;if(YVe(t))return t.replace(dJ,"");if(t.startsWith(Sge)){let r=t.replace(Sge,""),n=wge.Buffer.from(r,"base64");return h4().decryptString(n)}if(t.startsWith(xge)){let r=t.replace(xge,""),n=await Cge(),o=KVe(r),i=await crypto.subtle.decrypt(cJ,n,o);return new TextDecoder().decode(i)}let e=t.replace(Oge,"");try{if(h4()?.isEncryptionAvailable())try{let i=wge.Buffer.from(e,"base64");return h4().decryptString(i)}catch{}let r=await Cge(),n=KVe(e),o=await crypto.subtle.decrypt(cJ,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function qur(t){return!t.startsWith(Oge)&&!t.startsWith(dJ)}function YVe(t){return t.startsWith(dJ)}function Uur(t){let e=new Uint8Array(t),r="";for(let n=0;n{wge=F(Pp()),GVe=require("obsidian"),lJ=null;Sge="enc_desk_",xge="enc_web_",Oge="enc_",dJ="dec_",Bur=new TextEncoder().encode("obsidian-copilot-v1"),cJ={name:"AES-GCM",iv:new Uint8Array(12)}});function e8e(t){ls.set(pJ,t)}function hJ(){return ls.get(pJ)}function t8e(t){return ls.sub(pJ,t)}function SF(){return s4(pJ,{store:ls})}function Fh(){return ls.get(mJ)}function UR(t){ls.set(mJ,t)}function r8e(t){return ls.sub(mJ,t)}function by(){return s4(mJ,{store:ls})}function zR(t){ls.set(fJ,t)}function Mc(){return ls.get(fJ)}function xF(t){return ls.sub(fJ,()=>{t(ls.get(fJ))})}function GE(t){ls.set(QVe,t)}function n8e(){return s4(QVe,{store:ls})}function HR(){return Fh()==="project"}function Ege(t){ls.set(Pge,t)}function gJ(){return ls.get(Pge)}function o8e(t){let e=gJ();Ege([...e,t])}function i8e(t){let e=gJ();Ege(e.filter(r=>r.id!==t))}function a8e(){Ege([])}function s8e(){return s4(Pge,{store:ls})}var ZVe,pJ,XVe,mJ,fJ,QVe,Pge,Cl=w(()=>{Fd();nr();u4();ZVe=Ih(null),pJ=Ih(t=>{let e=t(ZVe);return e!==null?e:t(RR).defaultModelKey},(t,e,r)=>{e(ZVe,r)}),XVe=Ih(null),mJ=Ih(t=>{let e=t(XVe);return e!==null?e:t(RR).defaultChainType},(t,e,r)=>{e(XVe,r)}),fJ=Ih(null),QVe=Ih(!1),Pge=Ih([])});var y8e=v(Ui=>{"use strict";function Mge(t,e){var r=t.length;t.push(e);e:for(;0>>1,o=t[n];if(0>>1;nyJ(s,r))uyJ(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(uyJ(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function yJ(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(u8e=performance,Ui.unstable_now=function(){return u8e.now()}):(Tge=Date,l8e=Tge.now(),Ui.unstable_now=function(){return Tge.now()-l8e});var u8e,Tge,l8e,o_=[],JE=[],zur=1,kh=null,kd=3,vJ=!1,VR=!1,y4=!1,f8e=typeof setTimeout=="function"?setTimeout:null,p8e=typeof clearTimeout=="function"?clearTimeout:null,c8e=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Rge(t){for(var e=_y(JE);e!==null;){if(e.callback===null)_J(JE);else if(e.startTime<=t)_J(JE),e.sortIndex=e.expirationTime,Mge(o_,e);else break;e=_y(JE)}}function jge(t){if(y4=!1,Rge(t),!VR)if(_y(o_)!==null)VR=!0,Dge(Nge);else{var e=_y(JE);e!==null&&Lge(jge,e.startTime-t)}}function Nge(t,e){VR=!1,y4&&(y4=!1,p8e(b4),b4=-1),vJ=!0;var r=kd;try{for(Rge(e),kh=_y(o_);kh!==null&&(!(kh.expirationTime>e)||t&&!g8e());){var n=kh.callback;if(typeof n=="function"){kh.callback=null,kd=kh.priorityLevel;var o=n(kh.expirationTime<=e);e=Ui.unstable_now(),typeof o=="function"?kh.callback=o:kh===_y(o_)&&_J(o_),Rge(e)}else _J(o_);kh=_y(o_)}if(kh!==null)var i=!0;else{var a=_y(JE);a!==null&&Lge(jge,a.startTime-e),i=!1}return i}finally{kh=null,kd=r,vJ=!1}}var wJ=!1,bJ=null,b4=-1,m8e=5,h8e=-1;function g8e(){return!(Ui.unstable_now()-h8et||125n?(t.sortIndex=r,Mge(JE,t),_y(o_)===null&&t===_y(JE)&&(y4?(p8e(b4),b4=-1):y4=!0,Lge(jge,r-n))):(t.sortIndex=o,Mge(o_,t),VR||vJ||(VR=!0,Dge(Nge))),t};Ui.unstable_shouldYield=g8e;Ui.unstable_wrapCallback=function(t){var e=kd;return function(){var r=kd;kd=e;try{return t.apply(this,arguments)}finally{kd=r}}}});var _8e=v((Gzn,b8e)=>{"use strict";b8e.exports=y8e()});var OWe=v(Tm=>{"use strict";var P6e=X(),Pm=_8e();function qe(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),iye=Object.prototype.hasOwnProperty,Hur=/^[: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]*$/,v8e={},w8e={};function Vur(t){return iye.call(w8e,t)?!0:iye.call(v8e,t)?!1:Hur.test(t)?w8e[t]=!0:(v8e[t]=!0,!1)}function Wur(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 Kur(t,e,r,n){if(e===null||typeof e>"u"||Wur(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 qf(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 Nc={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Nc[t]=new qf(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Nc[e]=new qf(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Nc[t]=new qf(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Nc[t]=new qf(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){Nc[t]=new qf(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Nc[t]=new qf(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Nc[t]=new qf(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Nc[t]=new qf(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Nc[t]=new qf(t,5,!1,t.toLowerCase(),null,!1,!1)});var Zye=/[\-:]([a-z])/g;function Xye(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(Zye,Xye);Nc[e]=new qf(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(Zye,Xye);Nc[e]=new qf(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(Zye,Xye);Nc[e]=new qf(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Nc[t]=new qf(t,1,!1,t.toLowerCase(),null,!1,!1)});Nc.xlinkHref=new qf("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Nc[t]=new qf(t,1,!1,t.toLowerCase(),null,!0,!0)});function Qye(t,e,r,n){var o=Nc.hasOwnProperty(e)?Nc[e]:null;(o!==null?o.type!==0:n||!(2s||o[a]!==i[s]){var u=` -`+o[a].replace(" at new "," at ");return t.displayName&&u.includes("")&&(u=u.replace("",t.displayName)),u}while(1<=a&&0<=s);break}}}finally{Dge=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?P4(t):""}function zur(t){switch(t.tag){case 5:return P4(t.type);case 16:return P4("Lazy");case 13:return P4("Suspense");case 19:return P4("SuspenseList");case 0:case 2:case 15:return t=Lge(t.type,!1),t;case 11:return t=Lge(t.type.render,!1),t;case 1:return t=Lge(t.type,!0),t;default:return""}}function aye(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 PF:return"Fragment";case OF:return"Portal";case nye:return"Profiler";case Zye:return"StrictMode";case oye:return"Suspense";case iye:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case O6e:return(t.displayName||"Context")+".Consumer";case C6e:return(t._context.displayName||"Context")+".Provider";case Xye:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Qye:return e=t.displayName||null,e!==null?e:aye(t.type)||"Memo";case ZE:e=t._payload,t=t._init;try{return aye(t(e))}catch{}}return null}function Hur(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 aye(e);case 8:return e===Zye?"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 dT(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function E6e(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Vur(t){var e=E6e(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 SJ(t){t._valueTracker||(t._valueTracker=Vur(t))}function T6e(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=E6e(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function YJ(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 sye(t,e){var r=e.checked;return $a({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function _8e(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=dT(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 A6e(t,e){e=e.checked,e!=null&&Yye(t,"checked",e,!1)}function uye(t,e){A6e(t,e);var r=dT(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")?lye(t,e.type,r):e.hasOwnProperty("defaultValue")&&lye(t,e.type,dT(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function v8e(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 lye(t,e,r){(e!=="number"||YJ(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var E4=Array.isArray;function FF(t,e,r,n){if(t=t.options,e){e={};for(var o=0;o"+e.valueOf().toString()+"",e=xJ.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function B4(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var I4={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},Wur=["Webkit","ms","Moz","O"];Object.keys(I4).forEach(function(t){Wur.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),I4[e]=I4[t]})});function j6e(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||I4.hasOwnProperty(t)&&I4[t]?(""+e).trim():e+"px"}function N6e(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=j6e(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var Kur=$a({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 fye(t,e){if(e){if(Kur[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(qe(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(qe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(qe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(qe(62))}}function pye(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 mye=null;function ebe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var hye=null,kF=null,$F=null;function x8e(t){if(t=o3(t)){if(typeof hye!="function")throw Error(qe(280));var e=t.stateNode;e&&(e=C7(e),hye(t.stateNode,t.type,e))}}function D6e(t){kF?$F?$F.push(t):$F=[t]:kF=t}function L6e(){if(kF){var t=kF,e=$F;if($F=kF=null,x8e(t),e)for(t=0;t>>=0,t===0?32:31-(olr(t)/ilr|0)|0}var CJ=64,OJ=4194304;function T4(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 e7(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=T4(s):(i&=a,i!==0&&(n=T4(i)))}else a=r&~o,a!==0?n=T4(a):i!==0&&(n=T4(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;0r;r++)e.push(t);return e}function r3(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Cy(e),t[e]=r}function llr(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=R4),R8e=" ",j8e=!1;function r5e(t,e){switch(t){case"keyup":return Flr.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function n5e(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var EF=!1;function $lr(t,e){switch(t){case"compositionend":return n5e(e);case"keypress":return e.which!==32?null:(j8e=!0,R8e);case"textInput":return t=e.data,t===R8e&&j8e?null:t;default:return null}}function Blr(t,e){if(EF)return t==="compositionend"||!ube&&r5e(t,e)?(t=e5e(),qJ=ibe=tT=null,EF=!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)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=L8e(r)}}function s5e(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?s5e(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function u5e(){for(var t=window,e=YJ();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=YJ(t.document)}return e}function lbe(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 Jlr(t){var e=u5e(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&s5e(r.ownerDocument.documentElement,r)){if(n!==null&&lbe(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=F8e(r,i);var a=F8e(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=document.documentMode,TF=null,wye=null,N4=null,Sye=!1;function k8e(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Sye||TF==null||TF!==YJ(n)||(n=TF,"selectionStart"in n&&lbe(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}),N4&&W4(N4,n)||(N4=n,n=n7(wye,"onSelect"),0MF||(t.current=Tye[MF],Tye[MF]=null,MF--)}function zi(t,e){MF++,Tye[MF]=t.current,t.current=e}var fT={},Ud=mT(fT),Ap=mT(!1),XR=fT;function HF(t,e){var r=t.type.contextTypes;if(!r)return fT;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 Ip(t){return t=t.childContextTypes,t!=null}function i7(){aa(Ap),aa(Ud)}function K8e(t,e,r){if(Ud.current!==fT)throw Error(qe(168));zi(Ud,e),zi(Ap,r)}function y5e(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(qe(108,Hur(t)||"Unknown",o));return $a({},r,n)}function a7(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||fT,XR=Ud.current,zi(Ud,t),zi(Ap,Ap.current),!0}function G8e(t,e,r){var n=t.stateNode;if(!n)throw Error(qe(169));r?(t=y5e(t,e,XR),n.__reactInternalMemoizedMergedChildContext=t,aa(Ap),aa(Ud),zi(Ud,t)):aa(Ap),zi(Ap,r)}var $C=null,O7=!1,Kge=!1;function b5e(t){$C===null?$C=[t]:$C.push(t)}function icr(t){O7=!0,b5e(t)}function hT(){if(!Kge&&$C!==null){Kge=!0;var t=0,e=_i;try{var r=$C;for(_i=1;t>=a,o-=a,BC=1<<32-Cy(e)+o|r<A?(I=E,E=null):I=E.sibling;var R=f(g,E,S[A],x);if(R===null){E===null&&(E=I);break}t&&E&&R.alternate===null&&e(g,E),y=i(R,y,A),P===null?O=R:P.sibling=R,P=R,E=I}if(A===S.length)return r(g,E),Ca&&VR(g,A),O;if(E===null){for(;AA?(I=E,E=null):I=E.sibling;var N=f(g,E,R.value,x);if(N===null){E===null&&(E=I);break}t&&E&&N.alternate===null&&e(g,E),y=i(N,y,A),P===null?O=N:P.sibling=N,P=N,E=I}if(R.done)return r(g,E),Ca&&VR(g,A),O;if(E===null){for(;!R.done;A++,R=S.next())R=d(g,R.value,x),R!==null&&(y=i(R,y,A),P===null?O=R:P.sibling=R,P=R);return Ca&&VR(g,A),O}for(E=n(g,E);!R.done;A++,R=S.next())R=p(E,g,A,R.value,x),R!==null&&(t&&R.alternate!==null&&E.delete(R.key===null?A:R.key),y=i(R,y,A),P===null?O=R:P.sibling=R,P=R);return t&&E.forEach(function(j){return e(g,j)}),Ca&&VR(g,A),O}function b(g,y,S,x){if(typeof S=="object"&&S!==null&&S.type===PF&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case wJ:e:{for(var O=S.key,P=y;P!==null;){if(P.key===O){if(O=S.type,O===PF){if(P.tag===7){r(g,P.sibling),y=o(P,S.props.children),y.return=g,g=y;break e}}else if(P.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===ZE&&t6e(O)===P.type){r(g,P.sibling),y=o(P,S.props),y.ref=S4(g,P,S),y.return=g,g=y;break e}r(g,P);break}else e(g,P);P=P.sibling}S.type===PF?(y=ZR(S.props.children,g.mode,x,S.key),y.return=g,g=y):(x=JJ(S.type,S.key,S.props,null,g.mode,x),x.ref=S4(g,y,S),x.return=g,g=x)}return a(g);case OF:e:{for(P=S.key;y!==null;){if(y.key===P)if(y.tag===4&&y.stateNode.containerInfo===S.containerInfo&&y.stateNode.implementation===S.implementation){r(g,y.sibling),y=o(y,S.children||[]),y.return=g,g=y;break e}else{r(g,y);break}else e(g,y);y=y.sibling}y=tye(S,g.mode,x),y.return=g,g=y}return a(g);case ZE:return P=S._init,b(g,y,P(S._payload),x)}if(E4(S))return m(g,y,S,x);if(b4(S))return h(g,y,S,x);LJ(g,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,y!==null&&y.tag===6?(r(g,y.sibling),y=o(y,S),y.return=g,g=y):(r(g,y),y=eye(S,g.mode,x),y.return=g,g=y),a(g)):r(g,y)}return b}var WF=P5e(!0),E5e=P5e(!1),i3={},l_=mT(i3),Y4=mT(i3),Z4=mT(i3);function JR(t){if(t===i3)throw Error(qe(174));return t}function bbe(t,e){switch(zi(Z4,e),zi(Y4,t),zi(l_,i3),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:dye(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=dye(e,t)}aa(l_),zi(l_,e)}function KF(){aa(l_),aa(Y4),aa(Z4)}function T5e(t){JR(Z4.current);var e=JR(l_.current),r=dye(e,t.type);e!==r&&(zi(Y4,t),zi(l_,r))}function _be(t){Y4.current===t&&(aa(l_),aa(Y4))}var Fa=mT(0);function f7(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 Gge=[];function vbe(){for(var t=0;tr?r:4,t(!0);var n=Jge.transition;Jge.transition={};try{t(!1),e()}finally{_i=r,Jge.transition=n}}function H5e(){return Hh().memoizedState}function lcr(t,e,r){var n=lT(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},V5e(t))W5e(e,r);else if(r=S5e(t,e,r,n),r!==null){var o=Bf();Oy(r,t,n,o),K5e(r,e,n)}}function ccr(t,e,r){var n=lT(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(V5e(t))W5e(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,Py(s,a)){var u=e.interleaved;u===null?(o.next=o,gbe(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=S5e(t,e,o,n),r!==null&&(o=Bf(),Oy(r,t,n,o),K5e(r,e,n))}}function V5e(t){var e=t.alternate;return t===ka||e!==null&&e===ka}function W5e(t,e){D4=p7=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function K5e(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,rbe(t,r)}}var m7={readContext:zh,useCallback:$d,useContext:$d,useEffect:$d,useImperativeHandle:$d,useInsertionEffect:$d,useLayoutEffect:$d,useMemo:$d,useReducer:$d,useRef:$d,useState:$d,useDebugValue:$d,useDeferredValue:$d,useTransition:$d,useMutableSource:$d,useSyncExternalStore:$d,useId:$d,unstable_isNewReconciler:!1},dcr={readContext:zh,useCallback:function(t,e){return a_().memoizedState=[t,e===void 0?null:e],t},useContext:zh,useEffect:n6e,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,VJ(4194308,4,$5e.bind(null,e,t),r)},useLayoutEffect:function(t,e){return VJ(4194308,4,t,e)},useInsertionEffect:function(t,e){return VJ(4,2,t,e)},useMemo:function(t,e){var r=a_();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=a_();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=lcr.bind(null,ka,t),[n.memoizedState,t]},useRef:function(t){var e=a_();return t={current:t},e.memoizedState=t},useState:r6e,useDebugValue:Obe,useDeferredValue:function(t){return a_().memoizedState=t},useTransition:function(){var t=r6e(!1),e=t[0];return t=ucr.bind(null,t[1]),a_().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ka,o=a_();if(Ca){if(r===void 0)throw Error(qe(407));r=r()}else{if(r=e(),Gl===null)throw Error(qe(349));(e1&30)!==0||M5e(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,n6e(j5e.bind(null,n,i,t),[t]),n.flags|=2048,e3(9,R5e.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=a_(),e=Gl.identifierPrefix;if(Ca){var r=qC,n=BC;r=(n&~(1<<32-Cy(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=X4++,0")&&(u=u.replace("",t.displayName)),u}while(1<=a&&0<=s);break}}}finally{kge=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?E4(t):""}function Gur(t){switch(t.tag){case 5:return E4(t.type);case 16:return E4("Lazy");case 13:return E4("Suspense");case 19:return E4("SuspenseList");case 0:case 2:case 15:return t=$ge(t.type,!1),t;case 11:return t=$ge(t.type.render,!1),t;case 1:return t=$ge(t.type,!0),t;default:return""}}function lye(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 EF:return"Fragment";case PF:return"Portal";case aye:return"Profiler";case ebe:return"StrictMode";case sye:return"Suspense";case uye:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case A6e:return(t.displayName||"Context")+".Consumer";case T6e:return(t._context.displayName||"Context")+".Provider";case tbe:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case rbe:return e=t.displayName||null,e!==null?e:lye(t.type)||"Memo";case ZE:e=t._payload,t=t._init;try{return lye(t(e))}catch{}}return null}function Jur(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 lye(e);case 8:return e===ebe?"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 dT(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function M6e(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Yur(t){var e=M6e(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 xJ(t){t._valueTracker||(t._valueTracker=Yur(t))}function R6e(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=M6e(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function ZJ(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 cye(t,e){var r=e.checked;return $a({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function x8e(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=dT(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 j6e(t,e){e=e.checked,e!=null&&Qye(t,"checked",e,!1)}function dye(t,e){j6e(t,e);var r=dT(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")?fye(t,e.type,r):e.hasOwnProperty("defaultValue")&&fye(t,e.type,dT(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function C8e(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 fye(t,e,r){(e!=="number"||ZJ(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var T4=Array.isArray;function kF(t,e,r,n){if(t=t.options,e){e={};for(var o=0;o"+e.valueOf().toString()+"",e=CJ.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function q4(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var M4={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},Zur=["Webkit","ms","Moz","O"];Object.keys(M4).forEach(function(t){Zur.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),M4[e]=M4[t]})});function F6e(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||M4.hasOwnProperty(t)&&M4[t]?(""+e).trim():e+"px"}function k6e(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=F6e(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var Xur=$a({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 hye(t,e){if(e){if(Xur[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(qe(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(qe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(qe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(qe(62))}}function gye(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 yye=null;function nbe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var bye=null,$F=null,BF=null;function E8e(t){if(t=i3(t)){if(typeof bye!="function")throw Error(qe(280));var e=t.stateNode;e&&(e=O7(e),bye(t.stateNode,t.type,e))}}function $6e(t){$F?BF?BF.push(t):BF=[t]:$F=t}function B6e(){if($F){var t=$F,e=BF;if(BF=$F=null,E8e(t),e)for(t=0;t>>=0,t===0?32:31-(llr(t)/clr|0)|0}var OJ=64,PJ=4194304;function A4(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 t7(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=A4(s):(i&=a,i!==0&&(n=A4(i)))}else a=r&~o,a!==0?n=A4(a):i!==0&&(n=A4(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;0r;r++)e.push(t);return e}function n3(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Cy(e),t[e]=r}function mlr(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=j4),L8e=" ",F8e=!1;function a5e(t,e){switch(t){case"keyup":return Ulr.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function s5e(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var TF=!1;function Hlr(t,e){switch(t){case"compositionend":return s5e(e);case"keypress":return e.which!==32?null:(F8e=!0,L8e);case"textInput":return t=e.data,t===L8e&&F8e?null:t;default:return null}}function Vlr(t,e){if(TF)return t==="compositionend"||!dbe&&a5e(t,e)?(t=o5e(),UJ=ube=tT=null,TF=!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)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=B8e(r)}}function d5e(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?d5e(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function f5e(){for(var t=window,e=ZJ();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=ZJ(t.document)}return e}function fbe(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 ecr(t){var e=f5e(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&d5e(r.ownerDocument.documentElement,r)){if(n!==null&&fbe(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=q8e(r,i);var a=q8e(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=document.documentMode,AF=null,Cye=null,D4=null,Oye=!1;function U8e(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Oye||AF==null||AF!==ZJ(n)||(n=AF,"selectionStart"in n&&fbe(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}),D4&&K4(D4,n)||(D4=n,n=o7(Cye,"onSelect"),0RF||(t.current=Mye[RF],Mye[RF]=null,RF--)}function zi(t,e){RF++,Mye[RF]=t.current,t.current=e}var fT={},Ud=mT(fT),Ap=mT(!1),QR=fT;function VF(t,e){var r=t.type.contextTypes;if(!r)return fT;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 Ip(t){return t=t.childContextTypes,t!=null}function a7(){aa(Ap),aa(Ud)}function Z8e(t,e,r){if(Ud.current!==fT)throw Error(qe(168));zi(Ud,e),zi(Ap,r)}function w5e(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(qe(108,Jur(t)||"Unknown",o));return $a({},r,n)}function s7(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||fT,QR=Ud.current,zi(Ud,t),zi(Ap,Ap.current),!0}function X8e(t,e,r){var n=t.stateNode;if(!n)throw Error(qe(169));r?(t=w5e(t,e,QR),n.__reactInternalMemoizedMergedChildContext=t,aa(Ap),aa(Ud),zi(Ud,t)):aa(Ap),zi(Ap,r)}var BC=null,P7=!1,Yge=!1;function S5e(t){BC===null?BC=[t]:BC.push(t)}function ccr(t){P7=!0,S5e(t)}function hT(){if(!Yge&&BC!==null){Yge=!0;var t=0,e=_i;try{var r=BC;for(_i=1;t>=a,o-=a,qC=1<<32-Cy(e)+o|r<A?(I=E,E=null):I=E.sibling;var R=f(g,E,S[A],x);if(R===null){E===null&&(E=I);break}t&&E&&R.alternate===null&&e(g,E),y=i(R,y,A),P===null?O=R:P.sibling=R,P=R,E=I}if(A===S.length)return r(g,E),Ca&&WR(g,A),O;if(E===null){for(;AA?(I=E,E=null):I=E.sibling;var N=f(g,E,R.value,x);if(N===null){E===null&&(E=I);break}t&&E&&N.alternate===null&&e(g,E),y=i(N,y,A),P===null?O=N:P.sibling=N,P=N,E=I}if(R.done)return r(g,E),Ca&&WR(g,A),O;if(E===null){for(;!R.done;A++,R=S.next())R=d(g,R.value,x),R!==null&&(y=i(R,y,A),P===null?O=R:P.sibling=R,P=R);return Ca&&WR(g,A),O}for(E=n(g,E);!R.done;A++,R=S.next())R=p(E,g,A,R.value,x),R!==null&&(t&&R.alternate!==null&&E.delete(R.key===null?A:R.key),y=i(R,y,A),P===null?O=R:P.sibling=R,P=R);return t&&E.forEach(function(j){return e(g,j)}),Ca&&WR(g,A),O}function b(g,y,S,x){if(typeof S=="object"&&S!==null&&S.type===EF&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case SJ:e:{for(var O=S.key,P=y;P!==null;){if(P.key===O){if(O=S.type,O===EF){if(P.tag===7){r(g,P.sibling),y=o(P,S.props.children),y.return=g,g=y;break e}}else if(P.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===ZE&&i6e(O)===P.type){r(g,P.sibling),y=o(P,S.props),y.ref=x4(g,P,S),y.return=g,g=y;break e}r(g,P);break}else e(g,P);P=P.sibling}S.type===EF?(y=XR(S.props.children,g.mode,x,S.key),y.return=g,g=y):(x=YJ(S.type,S.key,S.props,null,g.mode,x),x.ref=x4(g,y,S),x.return=g,g=x)}return a(g);case PF:e:{for(P=S.key;y!==null;){if(y.key===P)if(y.tag===4&&y.stateNode.containerInfo===S.containerInfo&&y.stateNode.implementation===S.implementation){r(g,y.sibling),y=o(y,S.children||[]),y.return=g,g=y;break e}else{r(g,y);break}else e(g,y);y=y.sibling}y=oye(S,g.mode,x),y.return=g,g=y}return a(g);case ZE:return P=S._init,b(g,y,P(S._payload),x)}if(T4(S))return m(g,y,S,x);if(_4(S))return h(g,y,S,x);FJ(g,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,y!==null&&y.tag===6?(r(g,y.sibling),y=o(y,S),y.return=g,g=y):(r(g,y),y=nye(S,g.mode,x),y.return=g,g=y),a(g)):r(g,y)}return b}var KF=I5e(!0),M5e=I5e(!1),a3={},l_=mT(a3),Z4=mT(a3),X4=mT(a3);function YR(t){if(t===a3)throw Error(qe(174));return t}function wbe(t,e){switch(zi(X4,e),zi(Z4,t),zi(l_,a3),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:mye(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=mye(e,t)}aa(l_),zi(l_,e)}function GF(){aa(l_),aa(Z4),aa(X4)}function R5e(t){YR(X4.current);var e=YR(l_.current),r=mye(e,t.type);e!==r&&(zi(Z4,t),zi(l_,r))}function Sbe(t){Z4.current===t&&(aa(l_),aa(Z4))}var Fa=mT(0);function p7(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 Zge=[];function xbe(){for(var t=0;tr?r:4,t(!0);var n=Xge.transition;Xge.transition={};try{t(!1),e()}finally{_i=r,Xge.transition=n}}function G5e(){return Hh().memoizedState}function mcr(t,e,r){var n=lT(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},J5e(t))Y5e(e,r);else if(r=P5e(t,e,r,n),r!==null){var o=Bf();Oy(r,t,n,o),Z5e(r,e,n)}}function hcr(t,e,r){var n=lT(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(J5e(t))Y5e(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,Py(s,a)){var u=e.interleaved;u===null?(o.next=o,_be(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=P5e(t,e,o,n),r!==null&&(o=Bf(),Oy(r,t,n,o),Z5e(r,e,n))}}function J5e(t){var e=t.alternate;return t===ka||e!==null&&e===ka}function Y5e(t,e){L4=m7=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Z5e(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,ibe(t,r)}}var h7={readContext:zh,useCallback:$d,useContext:$d,useEffect:$d,useImperativeHandle:$d,useInsertionEffect:$d,useLayoutEffect:$d,useMemo:$d,useReducer:$d,useRef:$d,useState:$d,useDebugValue:$d,useDeferredValue:$d,useTransition:$d,useMutableSource:$d,useSyncExternalStore:$d,useId:$d,unstable_isNewReconciler:!1},gcr={readContext:zh,useCallback:function(t,e){return a_().memoizedState=[t,e===void 0?null:e],t},useContext:zh,useEffect:s6e,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,WJ(4194308,4,z5e.bind(null,e,t),r)},useLayoutEffect:function(t,e){return WJ(4194308,4,t,e)},useInsertionEffect:function(t,e){return WJ(4,2,t,e)},useMemo:function(t,e){var r=a_();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=a_();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=mcr.bind(null,ka,t),[n.memoizedState,t]},useRef:function(t){var e=a_();return t={current:t},e.memoizedState=t},useState:a6e,useDebugValue:Tbe,useDeferredValue:function(t){return a_().memoizedState=t},useTransition:function(){var t=a6e(!1),e=t[0];return t=pcr.bind(null,t[1]),a_().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ka,o=a_();if(Ca){if(r===void 0)throw Error(qe(407));r=r()}else{if(r=e(),Gl===null)throw Error(qe(349));(t1&30)!==0||D5e(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,s6e(F5e.bind(null,n,i,t),[t]),n.flags|=2048,t3(9,L5e.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=a_(),e=Gl.identifierPrefix;if(Ca){var r=UC,n=qC;r=(n&~(1<<32-Cy(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Q4++,0<\/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[s_]=e,t[J4]=n,rWe(t,e,!1,!1),e.stateNode=t;e:{switch(a=pye(r,n),r){case"dialog":ia("cancel",t),ia("close",t),o=n;break;case"iframe":case"object":case"embed":ia("load",t),o=n;break;case"video":case"audio":for(o=0;oJF&&(e.flags|=128,n=!0,x4(i,!1),e.lanes=4194304)}else{if(!n)if(t=f7(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),x4(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Ca)return Bd(e),null}else 2*Ts()-i.renderingStartTime>JF&&r!==1073741824&&(e.flags|=128,n=!0,x4(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=Ts(),e.sibling=null,r=Fa.current,zi(Fa,n?r&1|2:r&1),e):(Bd(e),null);case 22:case 23:return Mbe(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(xm&1073741824)!==0&&(Bd(e),e.subtreeFlags&6&&(e.flags|=8192)):Bd(e),null;case 24:return null;case 25:return null}throw Error(qe(156,e.tag))}function _cr(t,e){switch(dbe(e),e.tag){case 1:return Ip(e.type)&&i7(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return KF(),aa(Ap),aa(Ud),vbe(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return _be(e),null;case 13:if(aa(Fa),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(qe(340));VF()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return aa(Fa),null;case 4:return KF(),null;case 10:return hbe(e.type._context),null;case 22:case 23:return Mbe(),null;case 24:return null;default:return null}}var kJ=!1,qd=!1,vcr=typeof WeakSet=="function"?WeakSet:Set,Ct=null;function DF(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){cs(t,e,n)}else r.current=null}function Bye(t,e,r){try{r()}catch(n){cs(t,e,n)}}var f6e=!1;function wcr(t,e){if(xye=t7,t=u5e(),lbe(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(Cye={focusedElem:t,selectionRange:r},t7=!1,Ct=e;Ct!==null;)if(e=Ct,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Ct=t;else for(;Ct!==null;){e=Ct;try{var m=e.alternate;if((e.flags&1024)!==0)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var h=m.memoizedProps,b=m.memoizedState,g=e.stateNode,y=g.getSnapshotBeforeUpdate(e.elementType===e.type?h:wy(e.type,h),b);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(qe(163))}}catch(x){cs(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,Ct=t;break}Ct=e.return}return m=f6e,f6e=!1,m}function L4(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&&Bye(e,r,i)}o=o.next}while(o!==n)}}function T7(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 qye(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 iWe(t){var e=t.alternate;e!==null&&(t.alternate=null,iWe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[s_],delete e[J4],delete e[Eye],delete e[ncr],delete e[ocr])),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 aWe(t){return t.tag===5||t.tag===3||t.tag===4}function p6e(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||aWe(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 Uye(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=o7));else if(n!==4&&(t=t.child,t!==null))for(Uye(t,e,r),t=t.sibling;t!==null;)Uye(t,e,r),t=t.sibling}function zye(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(zye(t,e,r),t=t.sibling;t!==null;)zye(t,e,r),t=t.sibling}var Rc=null,Sy=!1;function YE(t,e,r){for(r=r.child;r!==null;)sWe(t,e,r),r=r.sibling}function sWe(t,e,r){if(u_&&typeof u_.onCommitFiberUnmount=="function")try{u_.onCommitFiberUnmount(v7,r)}catch{}switch(r.tag){case 5:qd||DF(r,e);case 6:var n=Rc,o=Sy;Rc=null,YE(t,e,r),Rc=n,Sy=o,Rc!==null&&(Sy?(t=Rc,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Rc.removeChild(r.stateNode));break;case 18:Rc!==null&&(Sy?(t=Rc,r=r.stateNode,t.nodeType===8?Wge(t.parentNode,r):t.nodeType===1&&Wge(t,r),H4(t)):Wge(Rc,r.stateNode));break;case 4:n=Rc,o=Sy,Rc=r.stateNode.containerInfo,Sy=!0,YE(t,e,r),Rc=n,Sy=o;break;case 0:case 11:case 14:case 15:if(!qd&&(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)&&Bye(r,e,a),o=o.next}while(o!==n)}YE(t,e,r);break;case 1:if(!qd&&(DF(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){cs(r,e,s)}YE(t,e,r);break;case 21:YE(t,e,r);break;case 22:r.mode&1?(qd=(n=qd)||r.memoizedState!==null,YE(t,e,r),qd=n):YE(t,e,r);break;default:YE(t,e,r)}}function m6e(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new vcr),e.forEach(function(n){var o=Icr.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function vy(t,e){var r=e.deletions;if(r!==null)for(var n=0;no&&(o=a),n&=~i}if(n=o,n=Ts()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*xcr(n/1960))-n,10t?16:t,rT===null)var n=!1;else{if(t=rT,rT=null,y7=0,(bo&6)!==0)throw Error(qe(331));var o=bo;for(bo|=4,Ct=t.current;Ct!==null;){var i=Ct,a=i.child;if((Ct.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;uTs()-Abe?YR(t,0):Tbe|=r),Mp(t,e)}function hWe(t,e){e===0&&((t.mode&1)===0?e=1:(e=OJ,OJ<<=1,(OJ&130023424)===0&&(OJ=4194304)));var r=Bf();t=VC(t,e),t!==null&&(r3(t,e,r),Mp(t,r))}function Acr(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),hWe(t,r)}function Icr(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(qe(314))}n!==null&&n.delete(e),hWe(t,r)}var gWe;gWe=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ap.current)Tp=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return Tp=!1,ycr(t,e,r);Tp=(t.flags&131072)!==0}else Tp=!1,Ca&&(e.flags&1048576)!==0&&_5e(e,u7,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;WJ(t,e),t=e.pendingProps;var o=HF(e,Ud.current);qF(e,r),o=Sbe(null,e,n,t,o,r);var i=xbe();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,Ip(n)?(i=!0,a7(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,ybe(e),o.updater=P7,e.stateNode=o,o._reactInternals=e,jye(e,n,t,r),e=Lye(null,e,n,!0,i,r)):(e.tag=0,Ca&&i&&cbe(e),$f(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(WJ(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=Rcr(n),t=wy(n,t),o){case 0:e=Dye(null,e,n,t,r);break e;case 1:e=l6e(null,e,n,t,r);break e;case 11:e=s6e(null,e,n,t,r);break e;case 14:e=u6e(null,e,n,wy(n.type,t),r);break e}throw Error(qe(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:wy(n,o),Dye(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:wy(n,o),l6e(t,e,n,o,r);case 3:e:{if(Q5e(e),t===null)throw Error(qe(387));n=e.pendingProps,i=e.memoizedState,o=i.element,x5e(t,e),d7(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=GF(Error(qe(423)),e),e=c6e(t,e,n,r,o);break e}else if(n!==o){o=GF(Error(qe(424)),e),e=c6e(t,e,n,r,o);break e}else for(Cm=aT(e.stateNode.containerInfo.firstChild),Om=e,Ca=!0,xy=null,r=E5e(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(VF(),n===o){e=WC(t,e,r);break e}$f(t,e,n,r)}e=e.child}return e;case 5:return T5e(e),t===null&&Iye(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,Oye(n,o)?a=null:i!==null&&Oye(n,i)&&(e.flags|=32),X5e(t,e),$f(t,e,a,r),e.child;case 6:return t===null&&Iye(e),null;case 13:return eWe(t,e,r);case 4:return bbe(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=WF(e,null,n,r):$f(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:wy(n,o),s6e(t,e,n,o,r);case 7:return $f(t,e,e.pendingProps,r),e.child;case 8:return $f(t,e,e.pendingProps.children,r),e.child;case 12:return $f(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,zi(l7,n._currentValue),n._currentValue=a,i!==null)if(Py(i.value,a)){if(i.children===o.children&&!Ap.current){e=WC(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=UC(-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),Mye(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(qe(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),Mye(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}$f(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,qF(e,r),o=zh(o),n=n(o),e.flags|=1,$f(t,e,n,r),e.child;case 14:return n=e.type,o=wy(n,e.pendingProps),o=wy(n.type,o),u6e(t,e,n,o,r);case 15:return Y5e(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:wy(n,o),WJ(t,e),e.tag=1,Ip(n)?(t=!0,a7(e)):t=!1,qF(e,r),O5e(e,n,o),jye(e,n,o,r),Lye(null,e,n,!0,t,r);case 19:return tWe(t,e,r);case 22:return Z5e(t,e,r)}throw Error(qe(156,e.tag))};function yWe(t,e){return z6e(t,e)}function Mcr(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 qh(t,e,r,n){return new Mcr(t,e,r,n)}function jbe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Rcr(t){if(typeof t=="function")return jbe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Xye)return 11;if(t===Qye)return 14}return 2}function cT(t,e){var r=t.alternate;return r===null?(r=qh(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 JJ(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")jbe(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case PF:return ZR(r.children,o,i,e);case Zye:a=8,o|=8;break;case nye:return t=qh(12,r,e,o|2),t.elementType=nye,t.lanes=i,t;case oye:return t=qh(13,r,e,o),t.elementType=oye,t.lanes=i,t;case iye:return t=qh(19,r,e,o),t.elementType=iye,t.lanes=i,t;case P6e:return I7(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case C6e:a=10;break e;case O6e:a=9;break e;case Xye:a=11;break e;case Qye:a=14;break e;case ZE:a=16,n=null;break e}throw Error(qe(130,t==null?t:typeof t,""))}return e=qh(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function ZR(t,e,r,n){return t=qh(7,t,n,e),t.lanes=r,t}function I7(t,e,r,n){return t=qh(22,t,n,e),t.elementType=P6e,t.lanes=r,t.stateNode={isHidden:!1},t}function eye(t,e,r){return t=qh(6,t,null,e),t.lanes=r,t}function tye(t,e,r){return e=qh(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function jcr(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=kge(0),this.expirationTimes=kge(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=kge(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Nbe(t,e,r,n,o,i,a,s,u){return t=new jcr(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=qh(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},ybe(i),t}function Ncr(t,e,r){var n=3{"use strict";function SWe(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(SWe)}catch(t){console.error(t)}}SWe(),xWe.exports=wWe()});var Dc=v(kbe=>{"use strict";var CWe=ds();kbe.createRoot=CWe.createRoot,kbe.hydrateRoot=CWe.hydrateRoot;var Wzn});function OWe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function PWe(...t){return e=>{let r=!1,n=t.map(o=>{let i=OWe(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{$cr=F(X(),1)});var AWe=v(D7=>{"use strict";var Bcr=X(),qcr=Symbol.for("react.element"),Ucr=Symbol.for("react.fragment"),zcr=Object.prototype.hasOwnProperty,Hcr=Bcr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Vcr={key:!0,ref:!0,__self:!0,__source:!0};function TWe(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)zcr.call(e,n)&&!Vcr.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:qcr,type:t,key:i,ref:a,props:o,_owner:Hcr.current}}D7.Fragment=Ucr;D7.jsx=TWe;D7.jsxs=TWe});var ft=v((Yzn,IWe)=>{"use strict";IWe.exports=AWe()});function GC(t){let e=Wcr(t),r=El.forwardRef((n,o)=>{let{children:i,...a}=n,s=El.Children.toArray(i),u=s.find(Kcr);if(u){let l=u.props.children,c=s.map(d=>d===u?El.Children.count(l)>1?El.Children.only(null):El.isValidElement(l)?l.props.children:null:d);return(0,XF.jsx)(e,{...a,ref:o,children:El.isValidElement(l)?El.cloneElement(l,void 0,c):null})}return(0,XF.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Wcr(t){let e=El.forwardRef((r,n)=>{let{children:o,...i}=r;if(El.isValidElement(o)){let a=Jcr(o),s=Gcr(i,o.props);return o.type!==El.Fragment&&(s.ref=n?PWe(n,a):a),El.cloneElement(o,s)}return El.Children.count(o)>1?El.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}function jWe(t){let e=({children:r})=>(0,XF.jsx)(XF.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=RWe,e}function Kcr(t){return El.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===RWe}function Gcr(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 Jcr(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 El,XF,MWe,RWe,i1=w(()=>{El=F(X(),1);EWe();XF=F(ft(),1);MWe=GC("Slot");RWe=Symbol("radix.slottable")});function NWe(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{});var DWe,LWe,QF,F7=w(()=>{$be();DWe=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,LWe=L7,QF=(t,e)=>r=>{var n;if(e?.variants==null)return LWe(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=DWe(c)||DWe(d);return o[l][f]}),s=r&&Object.entries(r).reduce((l,c)=>{let[d,f]=c;return f===void 0||(l[d]=f),l},{}),u=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((l,c)=>{let{class:d,className:f,...p}=c;return Object.entries(p).every(m=>{let[h,b]=m;return Array.isArray(b)?b.includes({...i,...s}[h]):{...i,...s}[h]===b})?[...l,d,f]:l},[]);return LWe(t,a,u,r?.class,r?.className)}});function sdr(){let t=0,e,r,n="";for(;td(c),t());return r=odr(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=adr(u,r);return o(u,c),c}return function(){return i(sdr.apply(null,arguments))}}var Ube,Ycr,qWe,FWe,Zcr,Xcr,qbe,kWe,Qcr,edr,tdr,UWe,rdr,ndr,odr,idr,adr,zWe,sa,HWe,udr,ldr,cdr,ddr,fdr,pdr,mdr,JC,gT,ek,Bbe,a3,hdr,tn,yT,gdr,ydr,bdr,_dr,vdr,wdr,s3,tk,Sdr,VWe,xdr,Cdr,BWe,Odr,u3,Pdr,Edr,WWe,KWe=w(()=>{Ube="-",Ycr=t=>{let e=Xcr(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(Ube);return s[0]===""&&s.length!==1&&s.shift(),qWe(s,e)||Zcr(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},qWe=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?qWe(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(Ube);return e.validators.find(({validator:a})=>a(i))?.classGroupId},FWe=/^\[(.+)\]$/,Zcr=t=>{if(FWe.test(t)){let e=FWe.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},Xcr=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return edr(Object.entries(t.classGroups),r).forEach(([i,a])=>{qbe(a,n,i,e)}),n},qbe=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:kWe(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(Qcr(o)){qbe(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{qbe(a,kWe(e,i),r,n)})})},kWe=(t,e)=>{let r=t;return e.split(Ube).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Qcr=t=>t.isThemeGetter,edr=(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,tdr=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)}}},UWe="!",rdr=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 b=0;bc?d-c:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:h}};return r?s=>r({className:s,parseClassName:a}):a},ndr=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},odr=t=>({cache:tdr(t.cacheSize),parseClassName:rdr(t),...Ycr(t)}),idr=/\s+/,adr=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(idr),s="";for(let u=a.length-1;u>=0;u-=1){let l=a[u],{modifiers:c,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=r(l),m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){s=l+(s.length>0?" "+s:s);continue}if(h=n(f),!h){s=l+(s.length>0?" "+s:s);continue}m=!1}let b=ndr(c).join(":"),g=d?b+UWe:b,y=g+h;if(i.includes(y))continue;i.push(y);let S=o(h,m);for(let x=0;x0?" "+s:s)}return s};zWe=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},HWe=/^\[(?:([a-z-]+):)?(.+)\]$/i,udr=/^\d+\/\d+$/,ldr=new Set(["px","full","screen"]),cdr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ddr=/\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$/,fdr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,pdr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mdr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,JC=t=>ek(t)||ldr.has(t)||udr.test(t),gT=t=>tk(t,"length",Sdr),ek=t=>!!t&&!Number.isNaN(Number(t)),Bbe=t=>tk(t,"number",ek),a3=t=>!!t&&Number.isInteger(Number(t)),hdr=t=>t.endsWith("%")&&ek(t.slice(0,-1)),tn=t=>HWe.test(t),yT=t=>cdr.test(t),gdr=new Set(["length","size","percentage"]),ydr=t=>tk(t,gdr,VWe),bdr=t=>tk(t,"position",VWe),_dr=new Set(["image","url"]),vdr=t=>tk(t,_dr,Cdr),wdr=t=>tk(t,"",xdr),s3=()=>!0,tk=(t,e,r)=>{let n=HWe.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},Sdr=t=>ddr.test(t)&&!fdr.test(t),VWe=()=>!1,xdr=t=>pdr.test(t),Cdr=t=>mdr.test(t),BWe=()=>{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"),m=sa("gradientColorStopPositions"),h=sa("inset"),b=sa("margin"),g=sa("opacity"),y=sa("padding"),S=sa("saturate"),x=sa("scale"),O=sa("sepia"),P=sa("skew"),E=sa("space"),A=sa("translate"),I=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",tn,e],j=()=>[tn,e],$=()=>["",JC,gT],k=()=>["auto",ek,tn],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",tn],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],q=()=>[ek,tn];return{cacheSize:500,separator:":",theme:{colors:[s3],spacing:[JC,gT],blur:["none","",yT,tn],brightness:q(),borderColor:[t],borderRadius:["none","","full",yT,tn],borderSpacing:j(),borderWidth:$(),contrast:q(),grayscale:D(),hueRotate:q(),invert:D(),gap:j(),gradientColorStops:[t],gradientColorStopPositions:[hdr,gT],inset:N(),margin:N(),opacity:q(),padding:j(),saturate:q(),scale:q(),sepia:D(),skew:q(),space:j(),translate:j()},classGroups:{aspect:[{aspect:["auto","square","video",tn]}],container:["container"],columns:[{columns:[yT]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"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:[...z(),tn]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",a3,tn]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",tn]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",a3,tn]}],"grid-cols":[{"grid-cols":[s3]}],"col-start-end":[{col:["auto",{span:["full",a3,tn]},tn]}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":[s3]}],"row-start-end":[{row:["auto",{span:[a3,tn]},tn]}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",tn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",tn]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...J()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...J(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...J(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",tn,e]}],"min-w":[{"min-w":[tn,e,"min","max","fit"]}],"max-w":[{"max-w":[tn,e,"none","full","min","max","fit","prose",{screen:[yT]},yT]}],h:[{h:[tn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[tn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[tn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[tn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",yT,gT]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Bbe]}],"font-family":[{font:[s3]}],"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",tn]}],"line-clamp":[{"line-clamp":["none",ek,Bbe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",JC,tn]}],"list-image":[{"list-image":["none",tn]}],"list-style-type":[{list:["none","disc","decimal",tn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",JC,gT]}],"underline-offset":[{"underline-offset":["auto",JC,tn]}],"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:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",tn]}],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",tn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...z(),bdr]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",ydr]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},vdr]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:V()}],"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:["",...V()]}],"outline-offset":[{"outline-offset":[JC,tn]}],"outline-w":[{outline:[JC,gT]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[JC,gT]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",yT,wdr]}],"shadow-color":[{shadow:[s3]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",yT,tn]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[S]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"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",tn]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",tn]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",tn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[a3,tn]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",tn]}],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",tn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",tn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[JC,gT,Bbe]}],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"]}}},Odr=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{u3(t,"cacheSize",e),u3(t,"prefix",r),u3(t,"separator",n),u3(t,"experimentalParseClassName",o);for(let s in a)Pdr(t[s],a[s]);for(let s in i)Edr(t[s],i[s]);return t},u3=(t,e,r)=>{r!==void 0&&(t[e]=r)},Pdr=(t,e)=>{if(e)for(let r in e)u3(t,r,e[r])},Edr=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},WWe=(t,...e)=>typeof t=="function"?$We(BWe,t,...e):$We(()=>Odr(BWe(),t),...e)});function _e(...t){return Tdr(L7(t))}var Tdr,Tn=w(()=>{$be();KWe();Tdr=WWe({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 k7,Adr,ge,ti=w(()=>{k7=F(X());i1();F7();Tn();Adr=QF("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"}}),ge=k7.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>k7.createElement(n?MWe:"button",{className:_e(Adr({variant:e,size:r,className:t})),ref:i,...o}));ge.displayName="Button"});var GWe,$7,zbe=w(()=>{GWe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$7=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim()});var JWe,YWe=w(()=>{JWe={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 l3,ZWe,XWe=w(()=>{l3=F(X());YWe();zbe();ZWe=(0,l3.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,l3.createElement)("svg",{ref:u,...JWe,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:$7("lucide",o),...s},[...a.map(([l,c])=>(0,l3.createElement)(l,c)),...Array.isArray(i)?i:[i]]))});var B7,we,It=w(()=>{B7=F(X());zbe();XWe();we=(t,e)=>{let r=(0,B7.forwardRef)(({className:n,...o},i)=>(0,B7.createElement)(ZWe,{ref:i,iconNode:e,className:$7(`lucide-${GWe(t)}`,n),...o}));return r.displayName=`${t}`,r}});var YC,QWe=w(()=>{It();YC=we("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]])});var c3,e9e=w(()=>{It();c3=we("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])});var a1,t9e=w(()=>{It();a1=we("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 Jl,r9e=w(()=>{It();Jl=we("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])});var Hi,n9e=w(()=>{It();Hi=we("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])});var ZC,o9e=w(()=>{It();ZC=we("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])});var Ey,i9e=w(()=>{It();Ey=we("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])});var di,a9e=w(()=>{It();di=we("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 Am,s9e=w(()=>{It();Am=we("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var bT,u9e=w(()=>{It();bT=we("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]])});var _T,l9e=w(()=>{It();_T=we("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 d3,c9e=w(()=>{It();d3=we("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])});var f3,d9e=w(()=>{It();f3=we("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]])});var p3,f9e=w(()=>{It();p3=we("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 c_,p9e=w(()=>{It();c_=we("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 Ty,m9e=w(()=>{It();Ty=we("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 Im,h9e=w(()=>{It();Im=we("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]])});var m3,g9e=w(()=>{It();m3=we("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 h3,y9e=w(()=>{It();h3=we("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 g3,b9e=w(()=>{It();g3=we("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 XC,_9e=w(()=>{It();XC=we("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 vT,v9e=w(()=>{It();vT=we("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 s1,w9e=w(()=>{It();s1=we("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 y3,S9e=w(()=>{It();y3=we("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 QC,x9e=w(()=>{It();QC=we("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 b3,C9e=w(()=>{It();b3=we("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 _3,O9e=w(()=>{It();_3=we("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 v3,P9e=w(()=>{It();v3=we("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 w3,E9e=w(()=>{It();w3=we("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 Ay,T9e=w(()=>{It();Ay=we("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 S3,A9e=w(()=>{It();S3=we("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 x3,I9e=w(()=>{It();x3=we("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 Iy,M9e=w(()=>{It();Iy=we("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 u1,R9e=w(()=>{It();u1=we("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 d_,j9e=w(()=>{It();d_=we("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 C3,N9e=w(()=>{It();C3=we("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 O3,D9e=w(()=>{It();O3=we("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 f_,L9e=w(()=>{It();f_=we("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 P3,F9e=w(()=>{It();P3=we("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 l1,k9e=w(()=>{It();l1=we("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 eO,$9e=w(()=>{It();eO=we("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 Yl,B9e=w(()=>{It();Yl=we("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])});var E3,q9e=w(()=>{It();E3=we("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 rk,U9e=w(()=>{It();rk=we("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 p_,z9e=w(()=>{It();p_=we("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 tO,H9e=w(()=>{It();tO=we("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 nk,V9e=w(()=>{It();nk=we("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 ok,W9e=w(()=>{It();ok=we("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 Mm,K9e=w(()=>{It();Mm=we("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])});var T3,G9e=w(()=>{It();T3=we("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 m_,J9e=w(()=>{It();m_=we("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 A3,Y9e=w(()=>{It();A3=we("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 c1,Z9e=w(()=>{It();c1=we("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])});var Vh,X9e=w(()=>{It();Vh=we("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 rO,Q9e=w(()=>{It();rO=we("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 Rp,eKe=w(()=>{It();Rp=we("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 d1,tKe=w(()=>{It();d1=we("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 I3,rKe=w(()=>{It();I3=we("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 Rm,nKe=w(()=>{It();Rm=we("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 Uf,oKe=w(()=>{It();Uf=we("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 M3,iKe=w(()=>{It();M3=we("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 f1,aKe=w(()=>{It();f1=we("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 Vi,sKe=w(()=>{It();Vi=we("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])});var yn=w(()=>{a9e();s9e();u9e();l9e();_9e();v9e();B9e();z9e();H9e();X9e();Q9e();eKe();oKe();QWe();e9e();t9e();r9e();n9e();o9e();i9e();c9e();d9e();f9e();p9e();m9e();h9e();g9e();y9e();b9e();w9e();S9e();x9e();C9e();O9e();P9e();E9e();T9e();A9e();I9e();M9e();R9e();j9e();N9e();D9e();L9e();F9e();k9e();$9e();q9e();U9e();V9e();W9e();K9e();G9e();J9e();Y9e();Z9e();tKe();rKe();nKe();iKe();aKe();sKe();});function Idr({onCancel:t}){let e=ue(),r=Hbe(e.defaultModelKey)&&Hbe(e.embeddingModelKey);return h_.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},h_.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},h_.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&h_.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.")),h_.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},h_.default.createElement(ge,{variant:"ghost",onClick:t},"Close"),h_.default.createElement(ge,{variant:"default",onClick:()=>{p1(LC.EXPIRED_MODAL)}},"Renew Now ",h_.default.createElement(s1,{className:"tw-size-4"}))))}var h_,uKe,lKe,q7,cKe=w(()=>{h_=F(X()),uKe=require("obsidian"),lKe=F(Dc());ti();nO();$r();yn();nr();q7=class extends uKe.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=(0,lKe.createRoot)(e);let r=()=>{this.close()};this.root.render(h_.default.createElement(Idr,{onCancel:r}))}onClose(){this.root.unmount()}}});var Rr,wT=w(()=>{Rr=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}}});var dKe=v(U7=>{"use strict";Object.defineProperty(U7,"__esModule",{value:!0});U7.V2ChatStreamRequestCitationMode=void 0;U7.V2ChatStreamRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var fKe=v(z7=>{"use strict";Object.defineProperty(z7,"__esModule",{value:!0});z7.V2ChatRequestCitationMode=void 0;z7.V2ChatRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var mKe=v(pKe=>{"use strict";Object.defineProperty(pKe,"__esModule",{value:!0})});var gKe=v(hKe=>{"use strict";Object.defineProperty(hKe,"__esModule",{value:!0})});var bKe=v(yKe=>{"use strict";Object.defineProperty(yKe,"__esModule",{value:!0})});var vKe=v(_Ke=>{"use strict";Object.defineProperty(_Ke,"__esModule",{value:!0})});var SKe=v(wKe=>{"use strict";Object.defineProperty(wKe,"__esModule",{value:!0})});var CKe=v(xKe=>{"use strict";Object.defineProperty(xKe,"__esModule",{value:!0})});var PKe=v(OKe=>{"use strict";Object.defineProperty(OKe,"__esModule",{value:!0})});var TKe=v(EKe=>{"use strict";Object.defineProperty(EKe,"__esModule",{value:!0})});var IKe=v(AKe=>{"use strict";Object.defineProperty(AKe,"__esModule",{value:!0})});var RKe=v(MKe=>{"use strict";Object.defineProperty(MKe,"__esModule",{value:!0})});var NKe=v(jKe=>{"use strict";Object.defineProperty(jKe,"__esModule",{value:!0})});var LKe=v(DKe=>{"use strict";Object.defineProperty(DKe,"__esModule",{value:!0})});var kKe=v(FKe=>{"use strict";Object.defineProperty(FKe,"__esModule",{value:!0})});var BKe=v($Ke=>{"use strict";Object.defineProperty($Ke,"__esModule",{value:!0})});var UKe=v(qKe=>{"use strict";Object.defineProperty(qKe,"__esModule",{value:!0})});var HKe=v(zKe=>{"use strict";Object.defineProperty(zKe,"__esModule",{value:!0})});var WKe=v(VKe=>{"use strict";Object.defineProperty(VKe,"__esModule",{value:!0})});var GKe=v(KKe=>{"use strict";Object.defineProperty(KKe,"__esModule",{value:!0})});var YKe=v(JKe=>{"use strict";Object.defineProperty(JKe,"__esModule",{value:!0})});var XKe=v(ZKe=>{"use strict";Object.defineProperty(ZKe,"__esModule",{value:!0})});var eGe=v(QKe=>{"use strict";Object.defineProperty(QKe,"__esModule",{value:!0})});var rGe=v(tGe=>{"use strict";Object.defineProperty(tGe,"__esModule",{value:!0})});var oGe=v(nGe=>{"use strict";Object.defineProperty(nGe,"__esModule",{value:!0})});var iGe=v(H7=>{"use strict";Object.defineProperty(H7,"__esModule",{value:!0});H7.ChatFinishReason=void 0;H7.ChatFinishReason={Complete:"complete",StopSequence:"stop_sequence",MaxTokens:"max_tokens",ToolCall:"tool_call",Error:"error",ContentBlocked:"content_blocked",ErrorLimit:"error_limit"}});var sGe=v(aGe=>{"use strict";Object.defineProperty(aGe,"__esModule",{value:!0})});var lGe=v(uGe=>{"use strict";Object.defineProperty(uGe,"__esModule",{value:!0})});var dGe=v(cGe=>{"use strict";Object.defineProperty(cGe,"__esModule",{value:!0})});var pGe=v(fGe=>{"use strict";Object.defineProperty(fGe,"__esModule",{value:!0})});var hGe=v(mGe=>{"use strict";Object.defineProperty(mGe,"__esModule",{value:!0})});var yGe=v(gGe=>{"use strict";Object.defineProperty(gGe,"__esModule",{value:!0})});var _Ge=v(bGe=>{"use strict";Object.defineProperty(bGe,"__esModule",{value:!0})});var wGe=v(vGe=>{"use strict";Object.defineProperty(vGe,"__esModule",{value:!0})});var xGe=v(SGe=>{"use strict";Object.defineProperty(SGe,"__esModule",{value:!0})});var OGe=v(CGe=>{"use strict";Object.defineProperty(CGe,"__esModule",{value:!0})});var EGe=v(PGe=>{"use strict";Object.defineProperty(PGe,"__esModule",{value:!0})});var AGe=v(TGe=>{"use strict";Object.defineProperty(TGe,"__esModule",{value:!0})});var MGe=v(IGe=>{"use strict";Object.defineProperty(IGe,"__esModule",{value:!0})});var jGe=v(RGe=>{"use strict";Object.defineProperty(RGe,"__esModule",{value:!0})});var DGe=v(NGe=>{"use strict";Object.defineProperty(NGe,"__esModule",{value:!0})});var FGe=v(LGe=>{"use strict";Object.defineProperty(LGe,"__esModule",{value:!0})});var $Ge=v(kGe=>{"use strict";Object.defineProperty(kGe,"__esModule",{value:!0})});var qGe=v(BGe=>{"use strict";Object.defineProperty(BGe,"__esModule",{value:!0})});var zGe=v(UGe=>{"use strict";Object.defineProperty(UGe,"__esModule",{value:!0})});var VGe=v(HGe=>{"use strict";Object.defineProperty(HGe,"__esModule",{value:!0})});var KGe=v(WGe=>{"use strict";Object.defineProperty(WGe,"__esModule",{value:!0})});var JGe=v(GGe=>{"use strict";Object.defineProperty(GGe,"__esModule",{value:!0})});var ZGe=v(YGe=>{"use strict";Object.defineProperty(YGe,"__esModule",{value:!0})});var QGe=v(XGe=>{"use strict";Object.defineProperty(XGe,"__esModule",{value:!0})});var tJe=v(eJe=>{"use strict";Object.defineProperty(eJe,"__esModule",{value:!0})});var nJe=v(rJe=>{"use strict";Object.defineProperty(rJe,"__esModule",{value:!0})});var iJe=v(oJe=>{"use strict";Object.defineProperty(oJe,"__esModule",{value:!0})});var sJe=v(aJe=>{"use strict";Object.defineProperty(aJe,"__esModule",{value:!0})});var lJe=v(uJe=>{"use strict";Object.defineProperty(uJe,"__esModule",{value:!0})});var dJe=v(cJe=>{"use strict";Object.defineProperty(cJe,"__esModule",{value:!0})});var pJe=v(fJe=>{"use strict";Object.defineProperty(fJe,"__esModule",{value:!0})});var hJe=v(mJe=>{"use strict";Object.defineProperty(mJe,"__esModule",{value:!0})});var yJe=v(gJe=>{"use strict";Object.defineProperty(gJe,"__esModule",{value:!0})});var Vbe=v(Tt=>{"use strict";var Mdr=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]}),$t=Tt&&Tt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Mdr(e,t,r)};Object.defineProperty(Tt,"__esModule",{value:!0});$t(dKe(),Tt);$t(fKe(),Tt);$t(mKe(),Tt);$t(gKe(),Tt);$t(bKe(),Tt);$t(vKe(),Tt);$t(SKe(),Tt);$t(CKe(),Tt);$t(PKe(),Tt);$t(TKe(),Tt);$t(IKe(),Tt);$t(RKe(),Tt);$t(NKe(),Tt);$t(LKe(),Tt);$t(kKe(),Tt);$t(BKe(),Tt);$t(UKe(),Tt);$t(HKe(),Tt);$t(WKe(),Tt);$t(GKe(),Tt);$t(YKe(),Tt);$t(XKe(),Tt);$t(eGe(),Tt);$t(rGe(),Tt);$t(oGe(),Tt);$t(iGe(),Tt);$t(sGe(),Tt);$t(lGe(),Tt);$t(dGe(),Tt);$t(pGe(),Tt);$t(hGe(),Tt);$t(yGe(),Tt);$t(_Ge(),Tt);$t(wGe(),Tt);$t(xGe(),Tt);$t(OGe(),Tt);$t(EGe(),Tt);$t(AGe(),Tt);$t(MGe(),Tt);$t(jGe(),Tt);$t(DGe(),Tt);$t(FGe(),Tt);$t($Ge(),Tt);$t(qGe(),Tt);$t(zGe(),Tt);$t(VGe(),Tt);$t(KGe(),Tt);$t(JGe(),Tt);$t(ZGe(),Tt);$t(QGe(),Tt);$t(tJe(),Tt);$t(nJe(),Tt);$t(iJe(),Tt);$t(sJe(),Tt);$t(lJe(),Tt);$t(dJe(),Tt);$t(pJe(),Tt);$t(hJe(),Tt);$t(yJe(),Tt)});var Wbe=v(bJe=>{"use strict";Object.defineProperty(bJe,"__esModule",{value:!0})});var _Je=v(m1=>{"use strict";var Rdr=m1&&m1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jdr=m1&&m1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Rdr(e,t,r)};Object.defineProperty(m1,"__esModule",{value:!0});jdr(Wbe(),m1)});var wJe=v(ST=>{"use strict";var Ndr=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]}),vJe=ST&&ST.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ndr(e,t,r)};Object.defineProperty(ST,"__esModule",{value:!0});vJe(Vbe(),ST);vJe(_Je(),ST)});var SJe=v(V7=>{"use strict";Object.defineProperty(V7,"__esModule",{value:!0});V7.CreateEmbedJobRequestTruncate=void 0;V7.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var Kbe=v(h1=>{"use strict";var Ddr=h1&&h1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ldr=h1&&h1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ddr(e,t,r)};Object.defineProperty(h1,"__esModule",{value:!0});Ldr(SJe(),h1)});var Gbe=v(xJe=>{"use strict";Object.defineProperty(xJe,"__esModule",{value:!0})});var CJe=v(g1=>{"use strict";var Fdr=g1&&g1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kdr=g1&&g1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Fdr(e,t,r)};Object.defineProperty(g1,"__esModule",{value:!0});kdr(Gbe(),g1)});var PJe=v(xT=>{"use strict";var $dr=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]}),OJe=xT&&xT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$dr(e,t,r)};Object.defineProperty(xT,"__esModule",{value:!0});OJe(Kbe(),xT);OJe(CJe(),xT)});var TJe=v(EJe=>{"use strict";Object.defineProperty(EJe,"__esModule",{value:!0})});var IJe=v(AJe=>{"use strict";Object.defineProperty(AJe,"__esModule",{value:!0})});var RJe=v(MJe=>{"use strict";Object.defineProperty(MJe,"__esModule",{value:!0})});var NJe=v(jJe=>{"use strict";Object.defineProperty(jJe,"__esModule",{value:!0})});var LJe=v(DJe=>{"use strict";Object.defineProperty(DJe,"__esModule",{value:!0})});var Jbe=v(My=>{"use strict";var Bdr=My&&My.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R3=My&&My.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Bdr(e,t,r)};Object.defineProperty(My,"__esModule",{value:!0});R3(TJe(),My);R3(IJe(),My);R3(RJe(),My);R3(NJe(),My);R3(LJe(),My)});var Ybe=v(FJe=>{"use strict";Object.defineProperty(FJe,"__esModule",{value:!0})});var kJe=v(y1=>{"use strict";var qdr=y1&&y1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Udr=y1&&y1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qdr(e,t,r)};Object.defineProperty(y1,"__esModule",{value:!0});Udr(Ybe(),y1)});var BJe=v(CT=>{"use strict";var zdr=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]}),$Je=CT&&CT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zdr(e,t,r)};Object.defineProperty(CT,"__esModule",{value:!0});$Je(Jbe(),CT);$Je(kJe(),CT)});var qJe=v(W7=>{"use strict";Object.defineProperty(W7,"__esModule",{value:!0});W7.BaseType=void 0;W7.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var UJe=v(K7=>{"use strict";Object.defineProperty(K7,"__esModule",{value:!0});K7.Strategy=void 0;K7.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var HJe=v(zJe=>{"use strict";Object.defineProperty(zJe,"__esModule",{value:!0})});var WJe=v(VJe=>{"use strict";Object.defineProperty(VJe,"__esModule",{value:!0})});var GJe=v(KJe=>{"use strict";Object.defineProperty(KJe,"__esModule",{value:!0})});var YJe=v(JJe=>{"use strict";Object.defineProperty(JJe,"__esModule",{value:!0})});var ZJe=v(G7=>{"use strict";Object.defineProperty(G7,"__esModule",{value:!0});G7.Status=void 0;G7.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 QJe=v(XJe=>{"use strict";Object.defineProperty(XJe,"__esModule",{value:!0})});var t7e=v(e7e=>{"use strict";Object.defineProperty(e7e,"__esModule",{value:!0})});var n7e=v(r7e=>{"use strict";Object.defineProperty(r7e,"__esModule",{value:!0})});var i7e=v(o7e=>{"use strict";Object.defineProperty(o7e,"__esModule",{value:!0})});var s7e=v(a7e=>{"use strict";Object.defineProperty(a7e,"__esModule",{value:!0})});var l7e=v(u7e=>{"use strict";Object.defineProperty(u7e,"__esModule",{value:!0})});var d7e=v(c7e=>{"use strict";Object.defineProperty(c7e,"__esModule",{value:!0})});var p7e=v(f7e=>{"use strict";Object.defineProperty(f7e,"__esModule",{value:!0})});var h7e=v(m7e=>{"use strict";Object.defineProperty(m7e,"__esModule",{value:!0})});var y7e=v(g7e=>{"use strict";Object.defineProperty(g7e,"__esModule",{value:!0})});var Zbe=v(Ba=>{"use strict";var Hdr=Ba&&Ba.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lc=Ba&&Ba.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Hdr(e,t,r)};Object.defineProperty(Ba,"__esModule",{value:!0});Lc(qJe(),Ba);Lc(UJe(),Ba);Lc(HJe(),Ba);Lc(WJe(),Ba);Lc(GJe(),Ba);Lc(YJe(),Ba);Lc(ZJe(),Ba);Lc(QJe(),Ba);Lc(t7e(),Ba);Lc(n7e(),Ba);Lc(i7e(),Ba);Lc(s7e(),Ba);Lc(l7e(),Ba);Lc(d7e(),Ba);Lc(p7e(),Ba);Lc(h7e(),Ba);Lc(y7e(),Ba)});var b7e=v(b1=>{"use strict";var Vdr=b1&&b1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wdr=b1&&b1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vdr(e,t,r)};Object.defineProperty(b1,"__esModule",{value:!0});Wdr(Zbe(),b1)});var v7e=v(jm=>{"use strict";var _7e=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]}),Kdr=jm&&jm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gdr=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)&&_7e(e,t,r);return Kdr(e,t),e},Jdr=jm&&jm.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_7e(e,t,r)};Object.defineProperty(jm,"__esModule",{value:!0});jm.finetuning=void 0;jm.finetuning=Gdr(b7e());Jdr(Zbe(),jm)});var Xbe=v(w7e=>{"use strict";Object.defineProperty(w7e,"__esModule",{value:!0})});var S7e=v(_1=>{"use strict";var Ydr=_1&&_1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zdr=_1&&_1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ydr(e,t,r)};Object.defineProperty(_1,"__esModule",{value:!0});Zdr(Xbe(),_1)});var C7e=v(OT=>{"use strict";var Xdr=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]}),x7e=OT&&OT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xdr(e,t,r)};Object.defineProperty(OT,"__esModule",{value:!0});x7e(v7e(),OT);x7e(S7e(),OT)});var Qbe=v(O7e=>{"use strict";Object.defineProperty(O7e,"__esModule",{value:!0})});var P7e=v(v1=>{"use strict";var Qdr=v1&&v1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),efr=v1&&v1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Qdr(e,t,r)};Object.defineProperty(v1,"__esModule",{value:!0});efr(Qbe(),v1)});var E7e=v(w1=>{"use strict";var tfr=w1&&w1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=w1&&w1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tfr(e,t,r)};Object.defineProperty(w1,"__esModule",{value:!0});rfr(P7e(),w1)});var e_e=v(T7e=>{"use strict";Object.defineProperty(T7e,"__esModule",{value:!0})});var A7e=v(S1=>{"use strict";var nfr=S1&&S1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ofr=S1&&S1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nfr(e,t,r)};Object.defineProperty(S1,"__esModule",{value:!0});ofr(e_e(),S1)});var I7e=v(x1=>{"use strict";var ifr=x1&&x1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),afr=x1&&x1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ifr(e,t,r)};Object.defineProperty(x1,"__esModule",{value:!0});afr(A7e(),x1)});var R7e=v(ri=>{"use strict";var M7e=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]}),sfr=ri&&ri.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ik=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)&&M7e(e,t,r);return sfr(e,t),e},oO=ri&&ri.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&M7e(e,t,r)};Object.defineProperty(ri,"__esModule",{value:!0});ri.models=ri.connectors=ri.finetuning=ri.datasets=ri.embedJobs=ri.v2=void 0;ri.v2=ik(wJe());oO(Vbe(),ri);ri.embedJobs=ik(PJe());oO(Kbe(),ri);ri.datasets=ik(BJe());oO(Jbe(),ri);ri.finetuning=ik(C7e());ri.connectors=ik(E7e());ri.models=ik(I7e());oO(Wbe(),ri);oO(Gbe(),ri);oO(Ybe(),ri);oO(Qbe(),ri);oO(e_e(),ri);oO(Xbe(),ri)});var j7e=v(J7=>{"use strict";Object.defineProperty(J7,"__esModule",{value:!0});J7.ChatStreamRequestPromptTruncation=void 0;J7.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var N7e=v(Y7=>{"use strict";Object.defineProperty(Y7,"__esModule",{value:!0});Y7.ChatStreamRequestCitationQuality=void 0;Y7.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var L7e=v(D7e=>{"use strict";Object.defineProperty(D7e,"__esModule",{value:!0})});var F7e=v(Z7=>{"use strict";Object.defineProperty(Z7,"__esModule",{value:!0});Z7.ChatStreamRequestSafetyMode=void 0;Z7.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var $7e=v(k7e=>{"use strict";Object.defineProperty(k7e,"__esModule",{value:!0})});var q7e=v(B7e=>{"use strict";Object.defineProperty(B7e,"__esModule",{value:!0})});var z7e=v(U7e=>{"use strict";Object.defineProperty(U7e,"__esModule",{value:!0})});var V7e=v(H7e=>{"use strict";Object.defineProperty(H7e,"__esModule",{value:!0})});var K7e=v(W7e=>{"use strict";Object.defineProperty(W7e,"__esModule",{value:!0})});var G7e=v(X7=>{"use strict";Object.defineProperty(X7,"__esModule",{value:!0});X7.ChatRequestPromptTruncation=void 0;X7.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var J7e=v(Q7=>{"use strict";Object.defineProperty(Q7,"__esModule",{value:!0});Q7.ChatRequestCitationQuality=void 0;Q7.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var Z7e=v(Y7e=>{"use strict";Object.defineProperty(Y7e,"__esModule",{value:!0})});var X7e=v(eY=>{"use strict";Object.defineProperty(eY,"__esModule",{value:!0});eY.ChatRequestSafetyMode=void 0;eY.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var Q7e=v(tY=>{"use strict";Object.defineProperty(tY,"__esModule",{value:!0});tY.GenerateStreamRequestTruncate=void 0;tY.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var eYe=v(rY=>{"use strict";Object.defineProperty(rY,"__esModule",{value:!0});rY.GenerateStreamRequestReturnLikelihoods=void 0;rY.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var tYe=v(nY=>{"use strict";Object.defineProperty(nY,"__esModule",{value:!0});nY.GenerateRequestTruncate=void 0;nY.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var rYe=v(oY=>{"use strict";Object.defineProperty(oY,"__esModule",{value:!0});oY.GenerateRequestReturnLikelihoods=void 0;oY.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var nYe=v(iY=>{"use strict";Object.defineProperty(iY,"__esModule",{value:!0});iY.EmbedRequestTruncate=void 0;iY.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var iYe=v(oYe=>{"use strict";Object.defineProperty(oYe,"__esModule",{value:!0})});var sYe=v(aYe=>{"use strict";Object.defineProperty(aYe,"__esModule",{value:!0})});var lYe=v(uYe=>{"use strict";Object.defineProperty(uYe,"__esModule",{value:!0})});var dYe=v(cYe=>{"use strict";Object.defineProperty(cYe,"__esModule",{value:!0})});var pYe=v(fYe=>{"use strict";Object.defineProperty(fYe,"__esModule",{value:!0})});var mYe=v(aY=>{"use strict";Object.defineProperty(aY,"__esModule",{value:!0});aY.ClassifyRequestTruncate=void 0;aY.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var gYe=v(hYe=>{"use strict";Object.defineProperty(hYe,"__esModule",{value:!0})});var yYe=v(sY=>{"use strict";Object.defineProperty(sY,"__esModule",{value:!0});sY.ClassifyResponseClassificationsItemClassificationType=void 0;sY.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var _Ye=v(bYe=>{"use strict";Object.defineProperty(bYe,"__esModule",{value:!0})});var wYe=v(vYe=>{"use strict";Object.defineProperty(vYe,"__esModule",{value:!0})});var SYe=v(uY=>{"use strict";Object.defineProperty(uY,"__esModule",{value:!0});uY.SummarizeRequestLength=void 0;uY.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var xYe=v(lY=>{"use strict";Object.defineProperty(lY,"__esModule",{value:!0});lY.SummarizeRequestFormat=void 0;lY.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var CYe=v(cY=>{"use strict";Object.defineProperty(cY,"__esModule",{value:!0});cY.SummarizeRequestExtractiveness=void 0;cY.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var PYe=v(OYe=>{"use strict";Object.defineProperty(OYe,"__esModule",{value:!0})});var TYe=v(EYe=>{"use strict";Object.defineProperty(EYe,"__esModule",{value:!0})});var IYe=v(AYe=>{"use strict";Object.defineProperty(AYe,"__esModule",{value:!0})});var RYe=v(MYe=>{"use strict";Object.defineProperty(MYe,"__esModule",{value:!0})});var NYe=v(jYe=>{"use strict";Object.defineProperty(jYe,"__esModule",{value:!0})});var LYe=v(DYe=>{"use strict";Object.defineProperty(DYe,"__esModule",{value:!0})});var kYe=v(FYe=>{"use strict";Object.defineProperty(FYe,"__esModule",{value:!0})});var BYe=v($Ye=>{"use strict";Object.defineProperty($Ye,"__esModule",{value:!0})});var UYe=v(qYe=>{"use strict";Object.defineProperty(qYe,"__esModule",{value:!0})});var HYe=v(zYe=>{"use strict";Object.defineProperty(zYe,"__esModule",{value:!0})});var WYe=v(VYe=>{"use strict";Object.defineProperty(VYe,"__esModule",{value:!0})});var GYe=v(KYe=>{"use strict";Object.defineProperty(KYe,"__esModule",{value:!0})});var YYe=v(JYe=>{"use strict";Object.defineProperty(JYe,"__esModule",{value:!0})});var XYe=v(ZYe=>{"use strict";Object.defineProperty(ZYe,"__esModule",{value:!0})});var eZe=v(QYe=>{"use strict";Object.defineProperty(QYe,"__esModule",{value:!0})});var rZe=v(tZe=>{"use strict";Object.defineProperty(tZe,"__esModule",{value:!0})});var oZe=v(nZe=>{"use strict";Object.defineProperty(nZe,"__esModule",{value:!0})});var aZe=v(iZe=>{"use strict";Object.defineProperty(iZe,"__esModule",{value:!0})});var uZe=v(sZe=>{"use strict";Object.defineProperty(sZe,"__esModule",{value:!0})});var cZe=v(lZe=>{"use strict";Object.defineProperty(lZe,"__esModule",{value:!0})});var dZe=v(dY=>{"use strict";Object.defineProperty(dY,"__esModule",{value:!0});dY.FinishReason=void 0;dY.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var pZe=v(fZe=>{"use strict";Object.defineProperty(fZe,"__esModule",{value:!0})});var hZe=v(mZe=>{"use strict";Object.defineProperty(mZe,"__esModule",{value:!0})});var yZe=v(gZe=>{"use strict";Object.defineProperty(gZe,"__esModule",{value:!0})});var _Ze=v(bZe=>{"use strict";Object.defineProperty(bZe,"__esModule",{value:!0})});var wZe=v(vZe=>{"use strict";Object.defineProperty(vZe,"__esModule",{value:!0})});var xZe=v(SZe=>{"use strict";Object.defineProperty(SZe,"__esModule",{value:!0})});var OZe=v(CZe=>{"use strict";Object.defineProperty(CZe,"__esModule",{value:!0})});var EZe=v(PZe=>{"use strict";Object.defineProperty(PZe,"__esModule",{value:!0})});var AZe=v(TZe=>{"use strict";Object.defineProperty(TZe,"__esModule",{value:!0})});var MZe=v(IZe=>{"use strict";Object.defineProperty(IZe,"__esModule",{value:!0})});var jZe=v(RZe=>{"use strict";Object.defineProperty(RZe,"__esModule",{value:!0})});var DZe=v(NZe=>{"use strict";Object.defineProperty(NZe,"__esModule",{value:!0})});var LZe=v(fY=>{"use strict";Object.defineProperty(fY,"__esModule",{value:!0});fY.ChatStreamEndEventFinishReason=void 0;fY.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var kZe=v(FZe=>{"use strict";Object.defineProperty(FZe,"__esModule",{value:!0})});var BZe=v($Ze=>{"use strict";Object.defineProperty($Ze,"__esModule",{value:!0})});var UZe=v(qZe=>{"use strict";Object.defineProperty(qZe,"__esModule",{value:!0})});var HZe=v(zZe=>{"use strict";Object.defineProperty(zZe,"__esModule",{value:!0})});var WZe=v(VZe=>{"use strict";Object.defineProperty(VZe,"__esModule",{value:!0})});var GZe=v(KZe=>{"use strict";Object.defineProperty(KZe,"__esModule",{value:!0})});var YZe=v(JZe=>{"use strict";Object.defineProperty(JZe,"__esModule",{value:!0})});var XZe=v(ZZe=>{"use strict";Object.defineProperty(ZZe,"__esModule",{value:!0})});var eXe=v(QZe=>{"use strict";Object.defineProperty(QZe,"__esModule",{value:!0})});var rXe=v(tXe=>{"use strict";Object.defineProperty(tXe,"__esModule",{value:!0})});var oXe=v(nXe=>{"use strict";Object.defineProperty(nXe,"__esModule",{value:!0})});var aXe=v(iXe=>{"use strict";Object.defineProperty(iXe,"__esModule",{value:!0})});var uXe=v(sXe=>{"use strict";Object.defineProperty(sXe,"__esModule",{value:!0})});var cXe=v(lXe=>{"use strict";Object.defineProperty(lXe,"__esModule",{value:!0})});var fXe=v(dXe=>{"use strict";Object.defineProperty(dXe,"__esModule",{value:!0})});var mXe=v(pXe=>{"use strict";Object.defineProperty(pXe,"__esModule",{value:!0})});var gXe=v(hXe=>{"use strict";Object.defineProperty(hXe,"__esModule",{value:!0})});var bXe=v(yXe=>{"use strict";Object.defineProperty(yXe,"__esModule",{value:!0})});var vXe=v(_Xe=>{"use strict";Object.defineProperty(_Xe,"__esModule",{value:!0})});var SXe=v(wXe=>{"use strict";Object.defineProperty(wXe,"__esModule",{value:!0})});var xXe=v(pY=>{"use strict";Object.defineProperty(pY,"__esModule",{value:!0});pY.EmbedInputType=void 0;pY.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering"}});var CXe=v(mY=>{"use strict";Object.defineProperty(mY,"__esModule",{value:!0});mY.EmbeddingType=void 0;mY.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"}});var PXe=v(OXe=>{"use strict";Object.defineProperty(OXe,"__esModule",{value:!0})});var TXe=v(EXe=>{"use strict";Object.defineProperty(EXe,"__esModule",{value:!0})});var IXe=v(AXe=>{"use strict";Object.defineProperty(AXe,"__esModule",{value:!0})});var MXe=v(hY=>{"use strict";Object.defineProperty(hY,"__esModule",{value:!0});hY.EmbedJobStatus=void 0;hY.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var RXe=v(gY=>{"use strict";Object.defineProperty(gY,"__esModule",{value:!0});gY.EmbedJobTruncate=void 0;gY.EmbedJobTruncate={Start:"START",End:"END"}});var NXe=v(jXe=>{"use strict";Object.defineProperty(jXe,"__esModule",{value:!0})});var LXe=v(DXe=>{"use strict";Object.defineProperty(DXe,"__esModule",{value:!0})});var kXe=v(FXe=>{"use strict";Object.defineProperty(FXe,"__esModule",{value:!0})});var BXe=v($Xe=>{"use strict";Object.defineProperty($Xe,"__esModule",{value:!0})});var UXe=v(qXe=>{"use strict";Object.defineProperty(qXe,"__esModule",{value:!0})});var zXe=v(yY=>{"use strict";Object.defineProperty(yY,"__esModule",{value:!0});yY.DatasetValidationStatus=void 0;yY.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var HXe=v(bY=>{"use strict";Object.defineProperty(bY,"__esModule",{value:!0});bY.DatasetType=void 0;bY.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 WXe=v(VXe=>{"use strict";Object.defineProperty(VXe,"__esModule",{value:!0})});var GXe=v(KXe=>{"use strict";Object.defineProperty(KXe,"__esModule",{value:!0})});var YXe=v(JXe=>{"use strict";Object.defineProperty(JXe,"__esModule",{value:!0})});var XXe=v(ZXe=>{"use strict";Object.defineProperty(ZXe,"__esModule",{value:!0})});var eQe=v(QXe=>{"use strict";Object.defineProperty(QXe,"__esModule",{value:!0})});var rQe=v(tQe=>{"use strict";Object.defineProperty(tQe,"__esModule",{value:!0})});var oQe=v(nQe=>{"use strict";Object.defineProperty(nQe,"__esModule",{value:!0})});var aQe=v(iQe=>{"use strict";Object.defineProperty(iQe,"__esModule",{value:!0})});var uQe=v(sQe=>{"use strict";Object.defineProperty(sQe,"__esModule",{value:!0})});var cQe=v(lQe=>{"use strict";Object.defineProperty(lQe,"__esModule",{value:!0})});var fQe=v(dQe=>{"use strict";Object.defineProperty(dQe,"__esModule",{value:!0})});var mQe=v(pQe=>{"use strict";Object.defineProperty(pQe,"__esModule",{value:!0})});var hQe=v(_Y=>{"use strict";Object.defineProperty(_Y,"__esModule",{value:!0});_Y.ConnectorAuthStatus=void 0;_Y.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var yQe=v(gQe=>{"use strict";Object.defineProperty(gQe,"__esModule",{value:!0})});var _Qe=v(bQe=>{"use strict";Object.defineProperty(bQe,"__esModule",{value:!0})});var wQe=v(vQe=>{"use strict";Object.defineProperty(vQe,"__esModule",{value:!0})});var SQe=v(vY=>{"use strict";Object.defineProperty(vY,"__esModule",{value:!0});vY.AuthTokenType=void 0;vY.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var CQe=v(xQe=>{"use strict";Object.defineProperty(xQe,"__esModule",{value:!0})});var PQe=v(OQe=>{"use strict";Object.defineProperty(OQe,"__esModule",{value:!0})});var TQe=v(EQe=>{"use strict";Object.defineProperty(EQe,"__esModule",{value:!0})});var IQe=v(AQe=>{"use strict";Object.defineProperty(AQe,"__esModule",{value:!0})});var RQe=v(MQe=>{"use strict";Object.defineProperty(MQe,"__esModule",{value:!0})});var NQe=v(jQe=>{"use strict";Object.defineProperty(jQe,"__esModule",{value:!0})});var DQe=v(wY=>{"use strict";Object.defineProperty(wY,"__esModule",{value:!0});wY.CompatibleEndpoint=void 0;wY.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var FQe=v(LQe=>{"use strict";Object.defineProperty(LQe,"__esModule",{value:!0})});var $Qe=v(kQe=>{"use strict";Object.defineProperty(kQe,"__esModule",{value:!0})});var BQe=v(pe=>{"use strict";var ufr=pe&&pe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Se=pe&&pe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ufr(e,t,r)};Object.defineProperty(pe,"__esModule",{value:!0});Se(j7e(),pe);Se(N7e(),pe);Se(L7e(),pe);Se(F7e(),pe);Se($7e(),pe);Se(q7e(),pe);Se(z7e(),pe);Se(V7e(),pe);Se(K7e(),pe);Se(G7e(),pe);Se(J7e(),pe);Se(Z7e(),pe);Se(X7e(),pe);Se(Q7e(),pe);Se(eYe(),pe);Se(tYe(),pe);Se(rYe(),pe);Se(nYe(),pe);Se(iYe(),pe);Se(sYe(),pe);Se(lYe(),pe);Se(dYe(),pe);Se(pYe(),pe);Se(mYe(),pe);Se(gYe(),pe);Se(yYe(),pe);Se(_Ye(),pe);Se(wYe(),pe);Se(SYe(),pe);Se(xYe(),pe);Se(CYe(),pe);Se(PYe(),pe);Se(TYe(),pe);Se(IYe(),pe);Se(RYe(),pe);Se(NYe(),pe);Se(LYe(),pe);Se(kYe(),pe);Se(BYe(),pe);Se(UYe(),pe);Se(HYe(),pe);Se(WYe(),pe);Se(GYe(),pe);Se(YYe(),pe);Se(XYe(),pe);Se(eZe(),pe);Se(rZe(),pe);Se(oZe(),pe);Se(aZe(),pe);Se(uZe(),pe);Se(cZe(),pe);Se(dZe(),pe);Se(pZe(),pe);Se(hZe(),pe);Se(yZe(),pe);Se(_Ze(),pe);Se(wZe(),pe);Se(xZe(),pe);Se(OZe(),pe);Se(EZe(),pe);Se(AZe(),pe);Se(MZe(),pe);Se(jZe(),pe);Se(DZe(),pe);Se(LZe(),pe);Se(kZe(),pe);Se(BZe(),pe);Se(UZe(),pe);Se(HZe(),pe);Se(WZe(),pe);Se(GZe(),pe);Se(YZe(),pe);Se(XZe(),pe);Se(eXe(),pe);Se(rXe(),pe);Se(oXe(),pe);Se(aXe(),pe);Se(uXe(),pe);Se(cXe(),pe);Se(fXe(),pe);Se(mXe(),pe);Se(gXe(),pe);Se(bXe(),pe);Se(vXe(),pe);Se(SXe(),pe);Se(xXe(),pe);Se(CXe(),pe);Se(PXe(),pe);Se(TXe(),pe);Se(IXe(),pe);Se(MXe(),pe);Se(RXe(),pe);Se(NXe(),pe);Se(LXe(),pe);Se(kXe(),pe);Se(BXe(),pe);Se(UXe(),pe);Se(zXe(),pe);Se(HXe(),pe);Se(WXe(),pe);Se(GXe(),pe);Se(YXe(),pe);Se(XXe(),pe);Se(eQe(),pe);Se(rQe(),pe);Se(oQe(),pe);Se(aQe(),pe);Se(uQe(),pe);Se(cQe(),pe);Se(fQe(),pe);Se(mQe(),pe);Se(hQe(),pe);Se(yQe(),pe);Se(_Qe(),pe);Se(wQe(),pe);Se(SQe(),pe);Se(CQe(),pe);Se(PQe(),pe);Se(TQe(),pe);Se(IQe(),pe);Se(RQe(),pe);Se(NQe(),pe);Se(DQe(),pe);Se(FQe(),pe);Se($Qe(),pe)});var qQe=v(SY=>{"use strict";Object.defineProperty(SY,"__esModule",{value:!0});SY.CohereError=void 0;var t_e=class t extends Error{constructor({message:e,statusCode:r,body:n}){super(lfr({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),r!=null&&(this.statusCode=r),n!==void 0&&(this.body=n)}};SY.CohereError=t_e;function lfr({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 UQe=v(xY=>{"use strict";Object.defineProperty(xY,"__esModule",{value:!0});xY.CohereTimeoutError=void 0;var r_e=class t extends Error{constructor(){super("Timeout"),Object.setPrototypeOf(this,t.prototype)}};xY.CohereTimeoutError=r_e});var As=v(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.CohereTimeoutError=ak.CohereError=void 0;var cfr=qQe();Object.defineProperty(ak,"CohereError",{enumerable:!0,get:function(){return cfr.CohereError}});var dfr=UQe();Object.defineProperty(ak,"CohereTimeoutError",{enumerable:!0,get:function(){return dfr.CohereTimeoutError}})});var zQe=v(g_=>{"use strict";var ffr=g_&&g_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pfr=g_&&g_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mfr=g_&&g_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ffr(e,t,r);return pfr(e,t),e};Object.defineProperty(g_,"__esModule",{value:!0});g_.BadRequestError=void 0;var hfr=mfr(As()),n_e=class t extends hfr.CohereError{constructor(e){super({message:"BadRequestError",statusCode:400,body:e}),Object.setPrototypeOf(this,t.prototype)}};g_.BadRequestError=n_e});var HQe=v(y_=>{"use strict";var gfr=y_&&y_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yfr=y_&&y_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bfr=y_&&y_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gfr(e,t,r);return yfr(e,t),e};Object.defineProperty(y_,"__esModule",{value:!0});y_.UnauthorizedError=void 0;var _fr=bfr(As()),o_e=class t extends _fr.CohereError{constructor(e){super({message:"UnauthorizedError",statusCode:401,body:e}),Object.setPrototypeOf(this,t.prototype)}};y_.UnauthorizedError=o_e});var VQe=v(b_=>{"use strict";var vfr=b_&&b_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wfr=b_&&b_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sfr=b_&&b_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vfr(e,t,r);return wfr(e,t),e};Object.defineProperty(b_,"__esModule",{value:!0});b_.ForbiddenError=void 0;var xfr=Sfr(As()),i_e=class t extends xfr.CohereError{constructor(e){super({message:"ForbiddenError",statusCode:403,body:e}),Object.setPrototypeOf(this,t.prototype)}};b_.ForbiddenError=i_e});var WQe=v(__=>{"use strict";var Cfr=__&&__.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ofr=__&&__.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pfr=__&&__.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Cfr(e,t,r);return Ofr(e,t),e};Object.defineProperty(__,"__esModule",{value:!0});__.NotFoundError=void 0;var Efr=Pfr(As()),a_e=class t extends Efr.CohereError{constructor(e){super({message:"NotFoundError",statusCode:404,body:e}),Object.setPrototypeOf(this,t.prototype)}};__.NotFoundError=a_e});var KQe=v(v_=>{"use strict";var Tfr=v_&&v_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Afr=v_&&v_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ifr=v_&&v_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tfr(e,t,r);return Afr(e,t),e};Object.defineProperty(v_,"__esModule",{value:!0});v_.UnprocessableEntityError=void 0;var Mfr=Ifr(As()),s_e=class t extends Mfr.CohereError{constructor(e){super({message:"UnprocessableEntityError",statusCode:422,body:e}),Object.setPrototypeOf(this,t.prototype)}};v_.UnprocessableEntityError=s_e});var GQe=v(w_=>{"use strict";var Rfr=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]}),jfr=w_&&w_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nfr=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)&&Rfr(e,t,r);return jfr(e,t),e};Object.defineProperty(w_,"__esModule",{value:!0});w_.TooManyRequestsError=void 0;var Dfr=Nfr(As()),u_e=class t extends Dfr.CohereError{constructor(e){super({message:"TooManyRequestsError",statusCode:429,body:e}),Object.setPrototypeOf(this,t.prototype)}};w_.TooManyRequestsError=u_e});var JQe=v(S_=>{"use strict";var Lfr=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]}),Ffr=S_&&S_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kfr=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)&&Lfr(e,t,r);return Ffr(e,t),e};Object.defineProperty(S_,"__esModule",{value:!0});S_.ClientClosedRequestError=void 0;var $fr=kfr(As()),l_e=class t extends $fr.CohereError{constructor(e){super({message:"ClientClosedRequestError",statusCode:499,body:e}),Object.setPrototypeOf(this,t.prototype)}};S_.ClientClosedRequestError=l_e});var YQe=v(x_=>{"use strict";var Bfr=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]}),qfr=x_&&x_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ufr=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)&&Bfr(e,t,r);return qfr(e,t),e};Object.defineProperty(x_,"__esModule",{value:!0});x_.InternalServerError=void 0;var zfr=Ufr(As()),c_e=class t extends zfr.CohereError{constructor(e){super({message:"InternalServerError",statusCode:500,body:e}),Object.setPrototypeOf(this,t.prototype)}};x_.InternalServerError=c_e});var ZQe=v(C_=>{"use strict";var Hfr=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]}),Vfr=C_&&C_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wfr=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)&&Hfr(e,t,r);return Vfr(e,t),e};Object.defineProperty(C_,"__esModule",{value:!0});C_.NotImplementedError=void 0;var Kfr=Wfr(As()),d_e=class t extends Kfr.CohereError{constructor(e){super({message:"NotImplementedError",statusCode:501,body:e}),Object.setPrototypeOf(this,t.prototype)}};C_.NotImplementedError=d_e});var XQe=v(O_=>{"use strict";var Gfr=O_&&O_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jfr=O_&&O_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yfr=O_&&O_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gfr(e,t,r);return Jfr(e,t),e};Object.defineProperty(O_,"__esModule",{value:!0});O_.ServiceUnavailableError=void 0;var Zfr=Yfr(As()),f_e=class t extends Zfr.CohereError{constructor(e){super({message:"ServiceUnavailableError",statusCode:503,body:e}),Object.setPrototypeOf(this,t.prototype)}};O_.ServiceUnavailableError=f_e});var QQe=v(P_=>{"use strict";var Xfr=P_&&P_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qfr=P_&&P_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),epr=P_&&P_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xfr(e,t,r);return Qfr(e,t),e};Object.defineProperty(P_,"__esModule",{value:!0});P_.GatewayTimeoutError=void 0;var tpr=epr(As()),p_e=class t extends tpr.CohereError{constructor(e){super({message:"GatewayTimeoutError",statusCode:504,body:e}),Object.setPrototypeOf(this,t.prototype)}};P_.GatewayTimeoutError=p_e});var eet=v(Fc=>{"use strict";var rpr=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]}),Ry=Fc&&Fc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rpr(e,t,r)};Object.defineProperty(Fc,"__esModule",{value:!0});Ry(zQe(),Fc);Ry(HQe(),Fc);Ry(VQe(),Fc);Ry(WQe(),Fc);Ry(KQe(),Fc);Ry(GQe(),Fc);Ry(JQe(),Fc);Ry(YQe(),Fc);Ry(ZQe(),Fc);Ry(XQe(),Fc);Ry(QQe(),Fc)});var ret=v(tet=>{"use strict";Object.defineProperty(tet,"__esModule",{value:!0})});var net=v(C1=>{"use strict";var npr=C1&&C1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),opr=C1&&C1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&npr(e,t,r)};Object.defineProperty(C1,"__esModule",{value:!0});opr(ret(),C1)});var iO=v(E_=>{"use strict";var ipr=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]}),CY=E_&&E_.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ipr(e,t,r)};Object.defineProperty(E_,"__esModule",{value:!0});CY(R7e(),E_);CY(BQe(),E_);CY(eet(),E_);CY(net(),E_)});var g_e={};Cf(g_e,{__addDisposableResource:()=>Pet,__assign:()=>OY,__asyncDelegator:()=>yet,__asyncGenerator:()=>get,__asyncValues:()=>bet,__await:()=>sk,__awaiter:()=>cet,__classPrivateFieldGet:()=>xet,__classPrivateFieldIn:()=>Oet,__classPrivateFieldSet:()=>Cet,__createBinding:()=>EY,__decorate:()=>aet,__disposeResources:()=>Eet,__esDecorate:()=>apr,__exportStar:()=>fet,__extends:()=>oet,__generator:()=>det,__importDefault:()=>wet,__importStar:()=>vet,__makeTemplateObject:()=>_et,__metadata:()=>uet,__param:()=>set,__propKey:()=>upr,__read:()=>h_e,__rest:()=>iet,__runInitializers:()=>spr,__setFunctionName:()=>lpr,__spread:()=>pet,__spreadArray:()=>het,__spreadArrays:()=>met,__values:()=>PY,default:()=>fpr});function oet(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");m_e(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function iet(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=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 set(t,e){return function(r,n){e(r,n,t)}}function apr(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var b=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(d=a(b.get))&&(c.get=d),(d=a(b.set))&&(c.set=d),(d=a(b.init))&&o.unshift(d)}else(d=a(b))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function spr(t,e,r){for(var n=arguments.length>2,o=0;o0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]=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 h_e(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 pet(){for(var t=[],e=0;e1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof sk?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function yet(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:sk(t[o](a)),done:!1}:i?i(a):a}:i}}function bet(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 PY=="function"?PY(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 _et(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function vet(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EY(e,t,r);return cpr(e,t),e}function wet(t){return t&&t.__esModule?t:{default:t}}function xet(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 Cet(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 Oet(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 Pet(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 Eet(t){function e(i){t.error=t.hasError?new dpr(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 m_e,OY,EY,cpr,dpr,fpr,y_e=w(()=>{m_e=function(t,e){return m_e=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])},m_e(t,e)};OY=function(){return OY=Object.assign||function(e){for(var r,n=1,o=arguments.length;n{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.MAX_HASHABLE_LENGTH=Wh.INIT=Wh.KEY=Wh.DIGEST_LENGTH=Wh.BLOCK_SIZE=void 0;Wh.BLOCK_SIZE=64;Wh.DIGEST_LENGTH=32;Wh.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]);Wh.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];Wh.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var Tet=v(TY=>{"use strict";Object.defineProperty(TY,"__esModule",{value:!0});TY.RawSha256=void 0;var Kh=b_e(),ppr=function(){function t(){this.state=Int32Array.from(Kh.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>Kh.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===Kh.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%Kh.BLOCK_SIZE>=Kh.BLOCK_SIZE-8){for(var o=this.bufferLength;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>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var h=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(m+this.temp[f-7]|0)+(h+this.temp[f-16]|0)}var b=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(Kh.KEY[f]+this.temp[f]|0)|0)|0,g=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&i^o&a^i&a)|0;d=c,c=l,l=u,u=s+b|0,s=a,a=i,i=o,o=b+g|0}n[0]+=o,n[1]+=i,n[2]+=a,n[3]+=s,n[4]+=u,n[5]+=l,n[6]+=c,n[7]+=d},t}();TY.RawSha256=ppr});var Met=v((FWn,Iet)=>{var AY=Object.defineProperty,mpr=Object.getOwnPropertyDescriptor,hpr=Object.getOwnPropertyNames,gpr=Object.prototype.hasOwnProperty,ypr=(t,e)=>AY(t,"name",{value:e,configurable:!0}),bpr=(t,e)=>{for(var r in e)AY(t,r,{get:e[r],enumerable:!0})},_pr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of hpr(e))!gpr.call(t,o)&&o!==r&&AY(t,o,{get:()=>e[o],enumerable:!(n=mpr(e,o))||n.enumerable});return t},vpr=t=>_pr(AY({},"__esModule",{value:!0}),t),Aet={};bpr(Aet,{isArrayBuffer:()=>wpr});Iet.exports=vpr(Aet);var wpr=ypr(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var Det=v((kWn,Net)=>{var IY=Object.defineProperty,Spr=Object.getOwnPropertyDescriptor,xpr=Object.getOwnPropertyNames,Cpr=Object.prototype.hasOwnProperty,Ret=(t,e)=>IY(t,"name",{value:e,configurable:!0}),Opr=(t,e)=>{for(var r in e)IY(t,r,{get:e[r],enumerable:!0})},Ppr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of xpr(e))!Cpr.call(t,o)&&o!==r&&IY(t,o,{get:()=>e[o],enumerable:!(n=Spr(e,o))||n.enumerable});return t},Epr=t=>Ppr(IY({},"__esModule",{value:!0}),t),jet={};Opr(jet,{fromArrayBuffer:()=>Apr,fromString:()=>Ipr});Net.exports=Epr(jet);var Tpr=Met(),__e=Pp(),Apr=Ret((t,e=0,r=t.byteLength-e)=>{if(!(0,Tpr.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return __e.Buffer.from(t,e,r)},"fromArrayBuffer"),Ipr=Ret((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?__e.Buffer.from(t,e):__e.Buffer.from(t)},"fromString")});var Bet=v(($Wn,$et)=>{var MY=Object.defineProperty,Mpr=Object.getOwnPropertyDescriptor,Rpr=Object.getOwnPropertyNames,jpr=Object.prototype.hasOwnProperty,v_e=(t,e)=>MY(t,"name",{value:e,configurable:!0}),Npr=(t,e)=>{for(var r in e)MY(t,r,{get:e[r],enumerable:!0})},Dpr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Rpr(e))!jpr.call(t,o)&&o!==r&&MY(t,o,{get:()=>e[o],enumerable:!(n=Mpr(e,o))||n.enumerable});return t},Lpr=t=>Dpr(MY({},"__esModule",{value:!0}),t),Let={};Npr(Let,{fromUtf8:()=>ket,toUint8Array:()=>Fpr,toUtf8:()=>kpr});$et.exports=Lpr(Let);var Fet=Det(),ket=v_e(t=>{let e=(0,Fet.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),Fpr=v_e(t=>typeof t=="string"?ket(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),kpr=v_e(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,Fet.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var qet=v(RY=>{"use strict";Object.defineProperty(RY,"__esModule",{value:!0});RY.convertToBuffer=void 0;var $pr=Bet(),Bpr=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:$pr.fromUtf8;function qpr(t){return t instanceof Uint8Array?t:typeof t=="string"?Bpr(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}RY.convertToBuffer=qpr});var Uet=v(jY=>{"use strict";Object.defineProperty(jY,"__esModule",{value:!0});jY.isEmptyData=void 0;function Upr(t){return typeof t=="string"?t.length===0:t.byteLength===0}jY.isEmptyData=Upr});var zet=v(NY=>{"use strict";Object.defineProperty(NY,"__esModule",{value:!0});NY.numToUint8=void 0;function zpr(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}NY.numToUint8=zpr});var Het=v(DY=>{"use strict";Object.defineProperty(DY,"__esModule",{value:!0});DY.uint32ArrayFrom=void 0;function Hpr(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),r=0;r{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});T_.uint32ArrayFrom=T_.numToUint8=T_.isEmptyData=T_.convertToBuffer=void 0;var Vpr=qet();Object.defineProperty(T_,"convertToBuffer",{enumerable:!0,get:function(){return Vpr.convertToBuffer}});var Wpr=Uet();Object.defineProperty(T_,"isEmptyData",{enumerable:!0,get:function(){return Wpr.isEmptyData}});var Kpr=zet();Object.defineProperty(T_,"numToUint8",{enumerable:!0,get:function(){return Kpr.numToUint8}});var Gpr=Het();Object.defineProperty(T_,"uint32ArrayFrom",{enumerable:!0,get:function(){return Gpr.uint32ArrayFrom}})});var Wet=v($Y=>{"use strict";Object.defineProperty($Y,"__esModule",{value:!0});$Y.Sha256=void 0;var Vet=(y_e(),zl(g_e)),kY=b_e(),FY=Tet(),w_e=LY(),Jpr=function(){function t(e){this.secret=e,this.hash=new FY.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,w_e.isEmptyData)(e)||this.error))try{this.hash.update((0,w_e.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 Vet.__awaiter(this,void 0,void 0,function(){return Vet.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new FY.RawSha256,this.secret){this.outer=new FY.RawSha256;var e=Ypr(this.secret),r=new Uint8Array(kY.BLOCK_SIZE);r.set(e);for(var n=0;nkY.BLOCK_SIZE){var r=new FY.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array(kY.BLOCK_SIZE);return n.set(e),n}});var x_e=v(S_e=>{"use strict";Object.defineProperty(S_e,"__esModule",{value:!0});var Zpr=(y_e(),zl(g_e));Zpr.__exportStar(Wet(),S_e)});var Ket=w(()=>{});var Get=w(()=>{});var Jet=w(()=>{});var O1,j3=w(()=>{O1=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 Tl,Yet=w(()=>{j3();Tl=class t extends O1{constructor(e,r=!0){super(e,r),this.name="CredentialsProviderError",Object.setPrototypeOf(this,t.prototype)}}});var Zet=w(()=>{j3()});var Xet=w(()=>{j3()});var Qet=w(()=>{});var ett,ttt=w(()=>{ett=(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 aO=w(()=>{Yet();j3();Zet();Xet();Qet();ttt()});function BY(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 C_e=w(()=>{});var rtt=w(()=>{});var ntt=w(()=>{rtt()});var ott=w(()=>{});var itt,att=w(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(itt||(itt={}))});var O_e,stt=w(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(O_e||(O_e={}))});var utt=w(()=>{});var ltt=w(()=>{});var ctt=w(()=>{});var dtt=w(()=>{});var ftt=w(()=>{att();stt();utt();ltt();ctt();dtt()});var ptt=w(()=>{});var mtt=w(()=>{});var htt=w(()=>{});var gtt=w(()=>{});var ytt=w(()=>{});var btt=w(()=>{});var _tt=w(()=>{});var vtt=w(()=>{ytt();btt();_tt()});var wtt=w(()=>{});var Stt=w(()=>{});var uk,xtt=w(()=>{(function(t){t.HTTP="http",t.HTTPS="https"})(uk||(uk={}))});var Ctt=w(()=>{});var Ott=w(()=>{});var Ptt=w(()=>{});var Ett=w(()=>{});var Ttt=w(()=>{});var Att=w(()=>{Ctt();Ott();Ptt();Ett();Ttt()});var Itt=w(()=>{});var lk,P_e=w(()=>{(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(lk||(lk={}))});var Mtt=w(()=>{P_e()});var Rtt=w(()=>{});var jtt=w(()=>{Mtt();Rtt();P_e()});var Nm,Ntt=w(()=>{(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(Nm||(Nm={}))});var Dtt=w(()=>{});var Ltt=w(()=>{});var Ftt=w(()=>{});var ktt=w(()=>{});var $tt=w(()=>{});var Btt=w(()=>{Ltt();Ftt();ktt();$tt()});var qtt=w(()=>{});var ck,Utt=w(()=>{ck="__smithy_context"});var ztt=w(()=>{});var Htt,Vtt=w(()=>{(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(Htt||(Htt={}))});var Wtt=w(()=>{});var Ktt=w(()=>{});var Gtt=w(()=>{});var Jtt=w(()=>{});var Ytt=w(()=>{});var Ztt=w(()=>{});var Xtt=w(()=>{});var Qtt=w(()=>{});var ert=w(()=>{});var trt,rrt=w(()=>{(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(trt||(trt={}))});var nrt=w(()=>{});var ort=w(()=>{});var irt=w(()=>{});var art=w(()=>{});var srt=w(()=>{});var urt=w(()=>{});var Hs=w(()=>{ott();ftt();ptt();mtt();htt();gtt();vtt();wtt();Stt();xtt();Att();Itt();jtt();Ntt();Dtt();Btt();qtt();Utt();ztt();Vtt();Wtt();Ktt();Gtt();Jtt();Ytt();Ztt();Xtt();Qtt();ert();rrt();nrt();ort();irt();art();srt();urt()});var lrt=w(()=>{Hs()});var crt=w(()=>{});var drt=w(()=>{});function Xpr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var qY,frt=w(()=>{qY=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=Xpr(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 prt=w(()=>{});var mrt=w(()=>{});var hrt=w(()=>{});var grt=w(()=>{ntt();lrt();crt();drt();frt();prt();mrt();hrt()});var Qpr,emr,UY,E_e=w(()=>{grt();Qpr=t=>e=>async r=>{if(!qY.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)},emr={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},UY=t=>({applyToStack:e=>{e.add(Qpr(t),emr)}})});var tmr,rmr,zY,yrt=w(()=>{tmr=()=>(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}},rmr={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},zY=t=>({applyToStack:e=>{e.add(tmr(),rmr)}})});var T_e=w(()=>{yrt()});var brt=w(()=>{});var _rt=w(()=>{brt()});var vrt=w(()=>{Hs()});var wrt=w(()=>{});var Srt=w(()=>{});function nmr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var HY,xrt=w(()=>{HY=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=nmr(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 Crt=w(()=>{});var Ort=w(()=>{});var Prt=w(()=>{});var Ert=w(()=>{_rt();vrt();wrt();Srt();xrt();Crt();Ort();Prt()});var Trt,omr,imr,amr,smr,VY,A_e=w(()=>{Ert();Trt="X-Amzn-Trace-Id",omr="AWS_LAMBDA_FUNCTION_NAME",imr="_X_AMZN_TRACE_ID",amr=t=>e=>async r=>{let{request:n}=r;if(!HY.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(Trt))return e(r);let o=process.env[omr],i=process.env[imr],a=s=>typeof s=="string"&&s.length>0;return a(o)&&a(i)&&(n.headers[Trt]=i),e({...r,request:n})},smr={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},VY=t=>({applyToStack:e=>{e.add(amr(t),smr)}})});function WY(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}var Art=w(()=>{});var umr,N3,I_e=w(()=>{umr=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}$"),N3=t=>umr.test(t)||t.startsWith("[")&&t.endsWith("]")});var lmr,D3,M_e=w(()=>{lmr=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),D3=(t,e=!1)=>{if(!e)return lmr.test(t);let r=t.split(".");for(let n of r)if(!D3(n))return!1;return!0}});var sO,KY=w(()=>{sO={}});var uO,Irt=w(()=>{uO="endpoints"});function Gh(t){return typeof t!="object"||t==null?t:"ref"in t?`$${Gh(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(Gh).join(", ")})`:JSON.stringify(t,null,2)}var Mrt=w(()=>{});var L3=w(()=>{Irt();Mrt()});var Wi,Rrt=w(()=>{Wi=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var jrt=w(()=>{});var Nrt=w(()=>{});var Drt=w(()=>{});var Lrt=w(()=>{});var Frt=w(()=>{});var krt=w(()=>{});var Jh=w(()=>{Rrt();jrt();Nrt();Drt();Lrt();Frt();krt()});var $rt,Brt=w(()=>{$rt=(t,e)=>t===e});var qrt,Urt=w(()=>{Jh();qrt=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 Wi(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new Wi(`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 GY,zrt=w(()=>{Jh();Urt();GY=(t,e)=>qrt(e).reduce((r,n)=>{if(typeof r!="object")throw new Wi(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var Hrt,Vrt=w(()=>{Hrt=t=>t!=null});var Wrt,Krt=w(()=>{Wrt=t=>!t});var R_e,Grt,Jrt=w(()=>{Hs();I_e();R_e={[uk.HTTP]:80,[uk.HTTPS]:443},Grt=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:f,port:p,protocol:m="",path:h="",query:b={}}=t,g=new URL(`${m}//${f}${p?`:${p}`:""}${h}`);return g.search=Object.entries(b).map(([y,S])=>`${y}=${S}`).join("&"),g}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;let r=e.href,{host:n,hostname:o,pathname:i,protocol:a,search:s}=e;if(s)return null;let u=a.slice(0,-1);if(!Object.values(uk).includes(u))return null;let l=N3(o),c=r.includes(`${n}:${R_e[u]}`)||typeof t=="string"&&t.includes(`${n}:${R_e[u]}`),d=`${n}${c?`:${R_e[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var Yrt,Zrt=w(()=>{Yrt=(t,e)=>t===e});var Xrt,Qrt=w(()=>{Xrt=(t,e,r,n)=>e>=r||t.length{ent=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var j_e=w(()=>{Brt();zrt();Vrt();M_e();Krt();Jrt();Zrt();Qrt();tnt()});var rnt,nnt=w(()=>{j_e();rnt={booleanEquals:$rt,getAttr:GY,isSet:Hrt,isValidHostLabel:D3,not:Wrt,parseURL:Grt,stringEquals:Yrt,substring:Xrt,uriEncode:ent}});var JY,N_e=w(()=>{j_e();JY=(t,e)=>{let r=[],n={...e.endpointParams,...e.referenceRecord},o=0;for(;o{ont=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var PT,F3=w(()=>{Jh();D_e();N_e();int();PT=(t,e,r)=>{if(typeof t=="string")return JY(t,r);if(t.fn)return YY(t,r);if(t.ref)return ont(t,r);throw new Wi(`'${e}': ${String(t)} is not a string, function or reference.`)}});var YY,D_e=w(()=>{KY();nnt();F3();YY=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:PT(i,"arg",r)),o=t.split(".");return o[0]in sO&&o[1]!=null?sO[o[0]][o[1]](...n):rnt[t](...n)}});var ant,snt=w(()=>{L3();Jh();D_e();ant=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new Wi(`'${t}' is already defined in Reference Record.`);let n=YY(e,r);return r.logger?.debug?.(`${uO} evaluateCondition: ${Gh(e)} = ${Gh(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var dk,ZY=w(()=>{L3();snt();dk=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=ant(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${uO} assign: ${i.name} := ${Gh(i.value)}`))}return{result:!0,referenceRecord:r}}});var unt,lnt=w(()=>{Jh();F3();unt=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=PT(i,"Header value entry",e);if(typeof a!="string")throw new Wi(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var L_e,cnt=w(()=>{Jh();N_e();F_e();L_e=(t,e)=>{if(Array.isArray(t))return t.map(r=>L_e(r,e));switch(typeof t){case"string":return JY(t,e);case"object":if(t===null)throw new Wi(`Unexpected endpoint property: ${t}`);return XY(t,e);case"boolean":return t;default:throw new Wi(`Unexpected endpoint property type: ${typeof t}`)}}});var XY,F_e=w(()=>{cnt();XY=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:L_e(o,e)}),{})});var dnt,fnt=w(()=>{Jh();F3();dnt=(t,e)=>{let r=PT(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 Wi(`Endpoint URL must be a string, got ${typeof r}`)}});var pnt,mnt=w(()=>{L3();ZY();lnt();F_e();fnt();pnt=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=dk(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${uO} Resolving endpoint from template: ${Gh(n)}`),{...l!=null&&{headers:unt(l,a)},...u!=null&&{properties:XY(u,a)},url:dnt(s,a)}}});var hnt,gnt=w(()=>{Jh();ZY();F3();hnt=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=dk(r,e);if(o)throw new Wi(PT(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var ynt,bnt=w(()=>{ZY();k_e();ynt=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=dk(r,e);if(o)return QY(n,{...e,referenceRecord:{...e.referenceRecord,...i}})}});var QY,k_e=w(()=>{Jh();mnt();gnt();bnt();QY=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=pnt(r,e);if(n)return n}else if(r.type==="error")hnt(r,e);else if(r.type==="tree"){let n=ynt(r,e);if(n)return n}else throw new Wi(`Unknown endpoint rule: ${r}`);throw new Wi("Rules evaluation failed")}});var _nt=w(()=>{KY();k_e()});var k3,vnt=w(()=>{L3();Jh();_nt();k3=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${uO} Initial EndpointParams: ${Gh(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 Wi(`Missing required parameter: '${l}'`);let u=QY(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?.(`${uO} Resolved endpoint: ${Gh(u)}`),u}});var ET=w(()=>{I_e();M_e();KY();vnt();Jh()});var $_e=w(()=>{ET()});var B_e,wnt=w(()=>{ET();$_e();B_e=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!B_e(r))return!1;return!0}return!(!D3(t)||t.length<3||t.length>63||t!==t.toLowerCase()||N3(t))}});var Snt,cmr,xnt,Cnt=w(()=>{Snt=":",cmr="/",xnt=t=>{let e=t.split(Snt);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(Snt)==="")return null;let u=s.map(l=>l.split(cmr)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var Pnt,Ont=w(()=>{Pnt={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 fmr,pmr,Ent,Tnt,q_e=w(()=>{Ont();fmr=Pnt,pmr="",Ent=t=>{let{partitions:e}=fmr;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}},Tnt=()=>pmr});var $3,Ant=w(()=>{ET();wnt();Cnt();q_e();$3={isVirtualHostableS3Bucket:B_e,parseArn:xnt,partition:Ent};sO.aws=$3});var Int=w(()=>{ET()});var Mnt=w(()=>{ET()});var Rnt=w(()=>{});var jnt=w(()=>{});var Nnt=w(()=>{});var Dnt=w(()=>{});var Lnt=w(()=>{});var Fnt=w(()=>{Mnt();Rnt();jnt();Nnt();Dnt();Lnt()});var eZ=w(()=>{Ant();q_e();$_e();Int();Fnt()});var knt=w(()=>{});var $nt=w(()=>{knt()});var Bnt=w(()=>{Hs()});var qnt=w(()=>{});var Unt=w(()=>{});function mmr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var tZ,znt=w(()=>{tZ=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=mmr(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 Hnt=w(()=>{});var Vnt=w(()=>{});var Wnt=w(()=>{});var Knt=w(()=>{$nt();Bnt();qnt();Unt();znt();Hnt();Vnt();Wnt()});var U_e,rZ,z_e,nZ,Gnt,Jnt,H_e,Ynt=w(()=>{U_e="user-agent",rZ="x-amz-user-agent",z_e=" ",nZ="/",Gnt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,Jnt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,H_e="-"});var hmr,V_e,gmr,oZ,Znt=w(()=>{eZ();Knt();Ynt();hmr=t=>(e,r)=>async n=>{let{request:o}=n;if(!tZ.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(V_e)||[],s=(await t.defaultUserAgentProvider()).map(V_e),u=t?.customUserAgent?.map(V_e)||[],l=Tnt(),c=(l?[l]:[]).concat([...s,...a,...u]).join(z_e),d=[...s.filter(f=>f.startsWith("aws-sdk-")),...u].join(z_e);return t.runtime!=="browser"?(d&&(i[rZ]=i[rZ]?`${i[U_e]} ${d}`:d),i[U_e]=c):i[rZ]=c,e({...n,request:o})},V_e=t=>{let e=t[0].split(nZ).map(a=>a.replace(Gnt,H_e)).join(nZ),r=t[1]?.replace(Jnt,H_e),n=e.indexOf(nZ),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}`}},"")},gmr={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},oZ=t=>({applyToStack:e=>{e.add(hmr(t),gmr)}})});var W_e=w(()=>{Art();Znt()});var Xnt=w(()=>{});var Qnt=w(()=>{});var iZ,eot=w(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(iZ||(iZ={}))});var K_e=w(()=>{Xnt();Qnt();eot()});var aZ,tot=w(()=>{K_e();aZ=!1});var sZ,rot=w(()=>{K_e();sZ=!1});var A_,not=w(()=>{Hs();A_=t=>t[ck]||(t[ck]={})});var zd,oot=w(()=>{zd=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var jy=w(()=>{not();oot()});var iot=w(()=>{jy()});var aot=w(()=>{});var sot=w(()=>{jy();aot()});var uot=w(()=>{tot();rot();iot();sot()});var lot=w(()=>{});var uZ,G_e=w(()=>{uZ=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var J_e,cot=w(()=>{G_e();J_e=t=>uZ(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var lZ,dot=w(()=>{cot();G_e();lZ=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return J_e(e);let n=await e();return J_e(n)},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return uZ(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}}});var fot=w(()=>{lot();dot()});var pot=w(()=>{});var mot=w(()=>{});var hot=w(()=>{});var got=w(()=>{});var yot=w(()=>{});var bot=w(()=>{});var _ot=w(()=>{hot();got();yot();bot()});var vot=w(()=>{pot();mot();_ot()});var B3=w(()=>{uot();fot();vot()});function bmr(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var Y_e,cZ=w(()=>{Hs();jy();Y_e=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=bmr(t.httpAuthSchemes),s=A_(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 wot,_mr,vmr,wmr,Smr,xmr,Sot=w(()=>{wot=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),xmr(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Smr(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},_mr=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,vmr=/(\d+\.){3}\d+/,wmr=/\.\./,Smr=t=>_mr.test(t)&&!vmr.test(t)&&!wmr.test(t),xmr=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 xot=w(()=>{Sot()});var Cot,Oot=w(()=>{Cot=(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 Pot,Eot=w(()=>{Pot=async t=>{}});function Tot(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 Aot=w(()=>{});var TT,dZ=w(()=>{Aot();TT=t=>{if(typeof t=="string")return TT(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=Tot(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var fZ,pZ=w(()=>{dZ();fZ=t=>typeof t=="object"?"url"in t?TT(t.url):t:TT(t)});var Iot,Cmr,Z_e=w(()=>{xot();Oot();Eot();pZ();Iot=async(t,e,r,n)=>{if(!r.endpoint){let a=await Pot(r.serviceId||"");a&&(r.endpoint=()=>Promise.resolve(fZ(a)))}let o=await Cmr(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},Cmr=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 Cot(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 wot(n),n}});var Mot=w(()=>{Z_e();pZ()});var Rot,X_e=w(()=>{jy();Z_e();Rot=({config:t,instructions:e})=>(r,n)=>async o=>{let i=await Iot(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=A_(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 jot,Q_e=w(()=>{jot=(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 Not,eve=w(()=>{Not=(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 Nt(t,e,r){return{applyToStack:n=>{n.add(jot(t,r),Omr),n.add(Not(t,e),q3)}}}var Omr,q3,Dot=w(()=>{Q_e();eve();Omr={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},q3={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var to=w(()=>{Q_e();Dot();eve()});var tve,Dt,Lot=w(()=>{to();X_e();tve={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:q3.name},Dt=(t,e)=>({applyToStack:r=>{r.addRelativeTo(Rot({config:t,instructions:e}),tve)}})});var mZ,Fot=w(()=>{jy();pZ();mZ=t=>{let e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>fZ(await zd(r)()):void 0;return{...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:zd(t.useDualstackEndpoint??!1),useFipsEndpoint:zd(t.useFipsEndpoint??!1)}}});var kot=w(()=>{});var zn=w(()=>{Mot();X_e();Lot();Fot();kot()});var Pmr,hZ,$ot=w(()=>{zn();cZ();Pmr={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:tve.name},hZ=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(Y_e(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),Pmr)}})});var wXn,Bot=w(()=>{to();cZ();wXn={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:q3.name}});var qot=w(()=>{cZ();$ot();Bot()});var Uot=w(()=>{});var zot=w(()=>{Uot()});var Hot=w(()=>{Hs()});var Vot=w(()=>{});var Wot=w(()=>{});function Emr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var P1,Kot=w(()=>{P1=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=Emr(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 Got=w(()=>{});var Jot=w(()=>{});var Yot=w(()=>{});var U3=w(()=>{zot();Hot();Vot();Wot();Kot();Got();Jot();Yot()});var Tmr,Amr,Zot,rve=w(()=>{U3();Hs();jy();Tmr=t=>e=>{throw e},Amr=(t,e)=>{},Zot=t=>(e,r)=>async n=>{if(!P1.isInstance(n.request))return e(n);let i=A_(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||Tmr)(a));return(u.successHandler||Amr)(l.response,a),l}});var Ny,I_,z3,gZ=w(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(Ny||(Ny={}));I_=3,z3=Ny.STANDARD});var Xot,Qot,eit,tit,rit=w(()=>{Xot=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Qot=["TimeoutError","RequestTimeout","RequestTimeoutException"],eit=[500,502,503,504],tit=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"]});var Imr,fk,yZ,nit,H3=w(()=>{rit();Imr=t=>t.$metadata?.clockSkewCorrected,fk=t=>t.$metadata?.httpStatusCode===429||Xot.includes(t.name)||t.$retryable?.throttling==!0,yZ=t=>Imr(t)||Qot.includes(t.name)||tit.includes(t?.code||"")||eit.includes(t.$metadata?.httpStatusCode||0),nit=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!yZ(t)}return!1}});var V3,nve=w(()=>{H3();V3=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(),fk(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 bZ,_Z,pk=w(()=>{bZ="amz-sdk-invocation-id",_Z="amz-sdk-request"});var oit,iit=w(()=>{pk();oit=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var ove,ait=w(()=>{pk();ove=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var E1,wZ=w(()=>{gZ();pk();iit();ait();E1=class{constructor(e){this.maxAttempts=e,this.mode=Ny.STANDARD,this.capacity=500,this.retryBackoffStrategy=oit(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return ove({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,ove({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 ${I_}`),I_}}shouldRetry(e,r,n){return e.getRetryCount()+1=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(e){return e==="TRANSIENT"?10:5}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}});var SZ,dit=w(()=>{gZ();nve();wZ();SZ=class{constructor(e,r){this.maxAttemptsProvider=e,this.mode=Ny.ADAPTIVE;let{rateLimiter:n}=r??{};this.rateLimiter=n??new V3,this.standardRetryStrategy=new E1(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 fit=w(()=>{pk();wZ()});var pit=w(()=>{});var M_=w(()=>{dit();fit();nve();wZ();gZ();pk();pit()});var mit=w(()=>{});var hit=w(()=>{mit()});var git=w(()=>{Hs()});var yit=w(()=>{});var bit=w(()=>{});function Mmr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var hk,_it=w(()=>{hk=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=Mmr(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 W3,vit=w(()=>{W3=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 wit=w(()=>{});var Sit=w(()=>{});var xZ=w(()=>{hit();git();yit();bit();_it();vit();wit();Sit()});var xit=w(()=>{M_()});var ave=w(()=>{M_()});var sve=w(()=>{H3()});var uve,lve=w(()=>{uve=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 cve=w(()=>{xZ();H3();M_();xit();ave();sve();lve()});var Cit=w(()=>{M_();cve()});var CZ,Oit=w(()=>{jy();M_();CZ=t=>{let{retryStrategy:e}=t,r=zd(t.maxAttempts??I_);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await zd(t.retryMode)()===Ny.ADAPTIVE?new SZ(r):new E1(r))}}});var Pit=w(()=>{xZ();M_()});var AT,Eit=w(()=>{AT=class{trace(){}debug(){}info(){}warn(){}error(){}}});var T1,IT,gk,Tit,Ait,Iit=w(()=>{T1=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},IT=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,gk=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>Tit[p.step]-Tit[f.step]||Ait[p.priority||"normal"]-Ait[f.priority||"normal"]),i=d=>{let f=!1,p=m=>{let h=T1(m.name,m.aliases);if(h.includes(d)){f=!0;for(let b of h)n.delete(b);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},a=d=>{let f=!1,p=m=>{if(m.middleware===d){f=!0;for(let h of T1(m.name,m.aliases))n.delete(h);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},s=d=>(t.forEach(f=>{d.add(f.middleware,{...f})}),e.forEach(f=>{d.addRelativeTo(f.middleware,{...f})}),d.identifyOnResolve?.(c.identifyOnResolve()),d),u=d=>{let f=[];return d.before.forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f.push(d),d.after.reverse().forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f},l=(d=!1)=>{let f=[],p=[],m={};return t.forEach(b=>{let g={...b,before:[],after:[]};for(let y of T1(g.name,g.aliases))m[y]=g;f.push(g)}),e.forEach(b=>{let g={...b,before:[],after:[]};for(let y of T1(g.name,g.aliases))m[y]=g;p.push(g)}),p.forEach(b=>{if(b.toMiddleware){let g=m[b.toMiddleware];if(g===void 0){if(d)return;throw new Error(`${b.toMiddleware} is not found when adding ${IT(b.name,b.aliases)} middleware ${b.relation} ${b.toMiddleware}`)}b.relation==="after"&&g.after.push(b),b.relation==="before"&&g.before.push(b)}}),o(f).map(u).reduce((b,g)=>(b.push(...g),b),[])},c={add:(d,f={})=>{let{name:p,override:m,aliases:h}=f,b={step:"initialize",priority:"normal",middleware:d,...f},g=T1(p,h);if(g.length>0){if(g.some(y=>n.has(y))){if(!m)throw new Error(`Duplicate middleware name '${IT(p,h)}'`);for(let y of g){let S=t.findIndex(O=>O.name===y||O.aliases?.some(P=>P===y));if(S===-1)continue;let x=t[S];if(x.step!==b.step||b.priority!==x.priority)throw new Error(`"${IT(x.name,x.aliases)}" middleware with ${x.priority} priority in ${x.step} step cannot be overridden by "${IT(p,h)}" middleware with ${b.priority} priority in ${b.step} step.`);t.splice(S,1)}}for(let y of g)n.add(y)}t.push(b)},addRelativeTo:(d,f)=>{let{name:p,override:m,aliases:h}=f,b={middleware:d,...f},g=T1(p,h);if(g.length>0){if(g.some(y=>n.has(y))){if(!m)throw new Error(`Duplicate middleware name '${IT(p,h)}'`);for(let y of g){let S=e.findIndex(O=>O.name===y||O.aliases?.some(P=>P===y));if(S===-1)continue;let x=e[S];if(x.toMiddleware!==b.toMiddleware||x.relation!==b.relation)throw new Error(`"${IT(x.name,x.aliases)}" middleware ${x.relation} "${x.toMiddleware}" middleware cannot be overridden by "${IT(p,h)}" middleware ${b.relation} "${b.toMiddleware}" middleware.`);e.splice(S,1)}}for(let y of g)n.add(y)}e.push(b)},clone:()=>s(gk()),use:d=>{d.applyToStack(c)},remove:d=>typeof d=="string"?i(d):a(d),removeByTag:d=>{let f=!1,p=m=>{let{tags:h,name:b,aliases:g}=m;if(h&&h.includes(d)){let y=T1(b,g);for(let S of y)n.delete(S);return f=!0,!1}return!0};return t=t.filter(p),e=e.filter(p),f},concat:d=>{let f=s(gk());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 IT(d.name,d.aliases)+" - "+f}),identifyOnResolve(d){return typeof d=="boolean"&&(r=d),r},resolve:(d,f)=>{for(let p of l().map(m=>m.middleware).reverse())d=p(d,f);return r&&console.log(c.identify()),d}};return c},Tit={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},Ait={high:3,normal:2,low:1}});var dve=w(()=>{Iit()});var A1,Mit=w(()=>{dve();A1=class{constructor(e){this.middlewareStack=gk(),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 lO,I1,MT,M1,Rit,fve=w(()=>{lO={},I1=new Array(64);for(let t=0,e=65,r=90;t+e<=r;t++){let n=String.fromCharCode(t+e);lO[n]=t,I1[t]=n}for(let t=0,e=97,r=122;t+e<=r;t++){let n=String.fromCharCode(t+e),o=t+26;lO[n]=o,I1[o]=n}for(let t=0;t<10;t++){lO[t.toString(10)]=t+52;let e=t.toString(10),r=t+52;lO[e]=r,I1[r]=e}lO["+"]=62;I1[62]="+";lO["/"]=63;I1[63]="/";MT=6,M1=8,Rit=63});var RT,jit=w(()=>{fve();RT=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>=MT;let s=o/4*3;i>>=a%M1;let u=Math.floor(a/M1);for(let l=0;l>c)}}return new Uint8Array(r)}});var pve,mve=w(()=>{pve=t=>new TextEncoder().encode(t)});var Nit=w(()=>{mve()});var Dit=w(()=>{});var Lit=w(()=>{mve();Nit();Dit()});function jT(t){let e;typeof t=="string"?e=pve(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>c]}o+="==".slice(0,4-u)}return o}var Fit=w(()=>{Lit();fve()});var yk=w(()=>{jit();Fit()});var hve,gve=w(()=>{hve=t=>new TextEncoder().encode(t)});var kit=w(()=>{gve()});var OZ,$it=w(()=>{OZ=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 yve=w(()=>{gve();kit();$it()});function Bit(t,e="utf-8"){return e==="base64"?jT(t):OZ(t)}function qit(t,e){return e==="base64"?cO.mutate(RT(t)):cO.mutate(hve(t))}var Uit=w(()=>{yk();yve();bve()});var cO,bve=w(()=>{Uit();cO=class t extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return qit(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 Bit(this,e)}}});var zit=w(()=>{});var Hit=w(()=>{});var Vit=w(()=>{Hit()});var Wit=w(()=>{Hs()});var Kit=w(()=>{});var Git=w(()=>{});var Jit=w(()=>{});var K3,Yit=w(()=>{K3=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 Zit=w(()=>{});var Xit=w(()=>{});var Qit=w(()=>{Vit();Wit();Kit();Git();Jit();Yit();Zit();Xit()});var Yh,Rmr,_ve=w(()=>{Yh=t=>encodeURIComponent(t).replace(/[!'()*]/g,Rmr),Rmr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var eat=w(()=>{_ve()});var PZ=w(()=>{_ve();eat()});function tat(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=Yh(r),Array.isArray(n))for(let o=0,i=n.length;o{PZ()});function nat(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 oat=w(()=>{});var vve,NT,iat=w(()=>{Qit();rat();oat();vve={supported:void 0},NT=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)),vve.supported===void 0&&(vve.supported=typeof Request<"u"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:r}={}){this.config||(this.config=await this.configProvider);let n=this.config.requestTimeout,o=this.config.keepAlive===!0,i=this.config.credentials;if(r?.aborted){let g=new Error("Request aborted");return g.name="AbortError",Promise.reject(g)}let a=e.path,s=tat(e.query||{});s&&(a+=`?${s}`),e.fragment&&(a+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){let g=e.username??"",y=e.password??"";u=`${g}:${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),vve.supported&&(p.keepalive=o);let m=()=>{},h=new Request(d,p),b=[fetch(h).then(g=>{let y=g.headers,S={};for(let O of y.entries())S[O[0]]=O[1];return g.body!=null?{response:new K3({headers:S,reason:g.statusText,statusCode:g.status,body:g.body})}:g.blob().then(O=>({response:new K3({headers:S,reason:g.statusText,statusCode:g.status,body:O})}))}),nat(n)];return r&&b.push(new Promise((g,y)=>{let S=()=>{let x=new Error("Request aborted");x.name="AbortError",y(x)};if(typeof r.addEventListener=="function"){let x=r;x.addEventListener("abort",S,{once:!0}),m=()=>x.removeEventListener("abort",S)}else r.onabort=S})),Promise.race(b).finally(m)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function jmr(t){let e=await Dmr(t),r=RT(e);return new Uint8Array(r)}async function Nmr(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 Dmr(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 bk,aat=w(()=>{yk();bk=t=>typeof Blob=="function"&&t instanceof Blob?jmr(t):Nmr(t)});var G3=w(()=>{iat();aat()});function uat(t){let e="";for(let r=0;r{sat={},Lmr={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),sat[t]=e,Lmr[e]=t}});var wve,Sve=w(()=>{wve=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var cat,fat,dat,pat=w(()=>{G3();yk();lat();yve();Sve();cat="The stream has already been transformed.",fat=t=>{if(!dat(t)&&!wve(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(cat);return e=!0,await bk(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 jT(i);if(o==="hex")return uat(i);if(o===void 0||o==="utf8"||o==="utf-8")return OZ(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(cat);if(e=!0,dat(t))return n(t);if(wve(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},dat=t=>typeof Blob=="function"&&t instanceof Blob});var mat=w(()=>{});var hat=w(()=>{});var xve=w(()=>{bve();zit();pat();mat();hat();Sve()});var DT,gat=w(()=>{xve();DT=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return cO.mutate(t);if(!t)return cO.mutate(new Uint8Array);let r=e.streamCollector(t);return cO.mutate(await r)}});var Ot,Cve,yat=w(()=>{dve();Hs();Ot=class{constructor(){this.middlewareStack=gk()}static classBuilder(){return new Cve}resolveMiddlewareWithContext(e,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let b of o.bind(this)(d,e,r,n))this.middlewareStack.use(b);let f=e.concat(this.middlewareStack),{logger:p}=r,m={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[ck]:{commandInstance:this,...l},...c},{requestHandler:h}=r;return f.resolve(b=>h.handle(b.request,n||{}),m)}},Cve=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 Ot{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 EZ,bat=w(()=>{EZ="***SensitiveInformation***"});var TZ,_at=w(()=>{TZ=(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 R1,Fmr,vat,kmr,wat,Sat,xat,Ove,$mr,_k,ln,Cat,Oat,Bmr,J3,Y3,Pve,Pat,Eat,Tat,Eve=w(()=>{R1=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&Tat.warn(Eat(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},Fmr=Math.ceil(34028234663852886e22),vat=t=>{let e=R1(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>Fmr)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},kmr=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},wat=t=>Ove(t,32),Sat=t=>Ove(t,16),xat=t=>Ove(t,8),Ove=(t,e)=>{let r=kmr(t);if(r!==void 0&&$mr(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},$mr=(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]}},_k=(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},ln=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return Tat.warn(Eat(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},Cat=t=>R1(typeof t=="string"?J3(t):t),Oat=t=>vat(typeof t=="string"?J3(t):t),Bmr=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,J3=t=>{let e=t.match(Bmr);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},Y3=t=>wat(typeof t=="string"?J3(t):t),Pve=t=>Sat(typeof t=="string"?J3(t):t),Pat=t=>xat(typeof t=="string"?J3(t):t),Eat=t=>String(new TypeError(t).stack||t).split(` +`+i.stack}return{value:t,source:e,stack:o,digest:null}}function tye(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function Fye(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var _cr=typeof WeakMap=="function"?WeakMap:Map;function X5e(t,e,r){r=zC(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){y7||(y7=!0,Kye=n),Fye(t,e)},r}function Q5e(t,e,r){r=zC(-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(){Fye(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){Fye(t,e),typeof n!="function"&&(uT===null?uT=new Set([this]):uT.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function u6e(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new _cr;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=jcr.bind(null,t,e,r),e.then(t,t))}function l6e(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 c6e(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=zC(-1,1),e.tag=2,sT(r,e,1))),r.lanes|=1),t):(t.flags|=65536,t.lanes=o,t)}var vcr=GC.ReactCurrentOwner,Tp=!1;function $f(t,e,r,n){e.child=t===null?M5e(e,null,r,n):KF(e,t.child,r,n)}function d6e(t,e,r,n,o){r=r.render;var i=e.ref;return UF(e,o),n=Obe(t,e,r,n,i,o),r=Pbe(),t!==null&&!Tp?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,KC(t,e,o)):(Ca&&r&&pbe(e),e.flags|=1,$f(t,e,n,o),e.child)}function f6e(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!Lbe(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,eWe(t,e,i,n,o)):(t=YJ(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:K4,r(a,n)&&t.ref===e.ref)return KC(t,e,o)}return e.flags|=1,t=cT(i,n),t.ref=e.ref,t.return=e,e.child=t}function eWe(t,e,r,n,o){if(t!==null){var i=t.memoizedProps;if(K4(i,n)&&t.ref===e.ref)if(Tp=!1,e.pendingProps=n=i,(t.lanes&o)!==0)(t.flags&131072)!==0&&(Tp=!0);else return e.lanes=t.lanes,KC(t,e,o)}return kye(t,e,r,n,o)}function tWe(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},zi(FF,xm),xm|=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,zi(FF,xm),xm|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,zi(FF,xm),xm|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,zi(FF,xm),xm|=n;return $f(t,e,o,r),e.child}function rWe(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function kye(t,e,r,n,o){var i=Ip(r)?QR:Ud.current;return i=VF(e,i),UF(e,o),r=Obe(t,e,r,n,i,o),n=Pbe(),t!==null&&!Tp?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,KC(t,e,o)):(Ca&&n&&pbe(e),e.flags|=1,$f(t,e,r,o),e.child)}function p6e(t,e,r,n,o){if(Ip(r)){var i=!0;s7(e)}else i=!1;if(UF(e,o),e.stateNode===null)KJ(t,e),A5e(e,r,n),Lye(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=zh(l):(l=Ip(r)?QR:Ud.current,l=VF(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)&&o6e(e,a,n,l),XE=!1;var f=e.memoizedState;a.state=f,f7(e,n,a,o),u=e.memoizedState,s!==n||f!==u||Ap.current||XE?(typeof c=="function"&&(Dye(e,r,c,n),u=e.memoizedState),(s=XE||n6e(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,E5e(t,e),s=e.memoizedProps,l=e.type===e.elementType?s:wy(e.type,s),a.props=l,d=e.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=zh(u):(u=Ip(r)?QR:Ud.current,u=VF(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)&&o6e(e,a,n,u),XE=!1,f=e.memoizedState,a.state=f,f7(e,n,a,o);var m=e.memoizedState;s!==d||f!==m||Ap.current||XE?(typeof p=="function"&&(Dye(e,r,p,n),m=e.memoizedState),(l=XE||n6e(e,r,l,n,f,m,u)||!1)?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,m,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,m,u)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=m),a.props=n,a.state=m,a.context=u,n=l):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),n=!1)}return $ye(t,e,r,n,i,o)}function $ye(t,e,r,n,o,i){rWe(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&X8e(e,r,!1),KC(t,e,i);n=e.stateNode,vcr.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=KF(e,t.child,null,i),e.child=KF(e,null,s,i)):$f(t,e,s,i),e.memoizedState=n.state,o&&X8e(e,r,!0),e.child}function nWe(t){var e=t.stateNode;e.pendingContext?Z8e(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Z8e(t,e.context,!1),wbe(t,e.containerInfo)}function m6e(t,e,r,n,o){return WF(),hbe(o),e.flags|=256,$f(t,e,r,n),e.child}var Bye={dehydrated:null,treeContext:null,retryLane:0};function qye(t){return{baseLanes:t,cachePool:null,transitions:null}}function oWe(t,e,r){var n=e.pendingProps,o=Fa.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),zi(Fa,o&1),t===null)return jye(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=M7(a,n,0,null),t=XR(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=qye(r),e.memoizedState=Bye,t):Abe(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return wcr(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=cT(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=cT(s,i):(i=XR(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?qye(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=Bye,n}return i=t.child,t=i.sibling,n=cT(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 Abe(t,e){return e=M7({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function kJ(t,e,r,n){return n!==null&&hbe(n),KF(e,t.child,null,r),t=Abe(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function wcr(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=tye(Error(qe(422))),kJ(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=M7({mode:"visible",children:n.children},o,0,null),i=XR(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,(e.mode&1)!==0&&KF(e,t.child,null,a),e.child.memoizedState=qye(a),e.memoizedState=Bye,i);if((e.mode&1)===0)return kJ(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(qe(419)),n=tye(i,n,void 0),kJ(t,e,a,n)}if(s=(a&t.childLanes)!==0,Tp||s){if(n=Gl,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,WC(t,o),Oy(n,t,o,-1))}return Dbe(),n=tye(Error(qe(421))),kJ(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=Ncr.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,Cm=aT(o.nextSibling),Om=e,Ca=!0,xy=null,t!==null&&($h[Bh++]=qC,$h[Bh++]=UC,$h[Bh++]=e1,qC=t.id,UC=t.overflow,e1=e),e=Abe(e,n.children),e.flags|=4096,e)}function h6e(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),Nye(t.return,e,r)}function rye(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 iWe(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if($f(t,e,n.children,r),n=Fa.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&&h6e(t,r,e);else if(t.tag===19)h6e(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(zi(Fa,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&&p7(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),rye(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&&p7(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}rye(e,!0,r,null,i);break;case"together":rye(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function KJ(t,e){(e.mode&1)===0&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function KC(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),r1|=e.lanes,(r&e.childLanes)===0)return null;if(t!==null&&e.child!==t.child)throw Error(qe(153));if(e.child!==null){for(t=e.child,r=cT(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=cT(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function Scr(t,e,r){switch(e.tag){case 3:nWe(e),WF();break;case 5:R5e(e);break;case 1:Ip(e.type)&&s7(e);break;case 4:wbe(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;zi(c7,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(zi(Fa,Fa.current&1),e.flags|=128,null):(r&e.child.childLanes)!==0?oWe(t,e,r):(zi(Fa,Fa.current&1),t=KC(t,e,r),t!==null?t.sibling:null);zi(Fa,Fa.current&1);break;case 19:if(n=(r&e.childLanes)!==0,(t.flags&128)!==0){if(n)return iWe(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),zi(Fa,Fa.current),n)break;return null;case 22:case 23:return e.lanes=0,tWe(t,e,r)}return KC(t,e,r)}var aWe,Uye,sWe,uWe;aWe=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}};Uye=function(){};sWe=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,YR(l_.current);var i=null;switch(r){case"input":o=cye(t,o),n=cye(t,n),i=[];break;case"select":o=$a({},o,{value:void 0}),n=$a({},n,{value:void 0}),i=[];break;case"textarea":o=pye(t,o),n=pye(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=i7)}hye(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"&&(B4.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"&&(B4.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&ia("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)}};uWe=function(t,e,r,n){r!==n&&(e.flags|=4)};function C4(t,e){if(!Ca)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 Bd(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 xcr(t,e,r){var n=e.pendingProps;switch(mbe(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bd(e),null;case 1:return Ip(e.type)&&a7(),Bd(e),null;case 3:return n=e.stateNode,GF(),aa(Ap),aa(Ud),xbe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(LJ(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,xy!==null&&(Yye(xy),xy=null))),Uye(t,e),Bd(e),null;case 5:Sbe(e);var o=YR(X4.current);if(r=e.type,t!==null&&e.stateNode!=null)sWe(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(qe(166));return Bd(e),null}if(t=YR(l_.current),LJ(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[s_]=e,n[Y4]=i,t=(e.mode&1)!==0,r){case"dialog":ia("cancel",n),ia("close",n);break;case"iframe":case"object":case"embed":ia("load",n);break;case"video":case"audio":for(o=0;o<\/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[s_]=e,t[Y4]=n,aWe(t,e,!1,!1),e.stateNode=t;e:{switch(a=gye(r,n),r){case"dialog":ia("cancel",t),ia("close",t),o=n;break;case"iframe":case"object":case"embed":ia("load",t),o=n;break;case"video":case"audio":for(o=0;oYF&&(e.flags|=128,n=!0,C4(i,!1),e.lanes=4194304)}else{if(!n)if(t=p7(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),C4(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Ca)return Bd(e),null}else 2*Ts()-i.renderingStartTime>YF&&r!==1073741824&&(e.flags|=128,n=!0,C4(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=Ts(),e.sibling=null,r=Fa.current,zi(Fa,n?r&1|2:r&1),e):(Bd(e),null);case 22:case 23:return Nbe(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(xm&1073741824)!==0&&(Bd(e),e.subtreeFlags&6&&(e.flags|=8192)):Bd(e),null;case 24:return null;case 25:return null}throw Error(qe(156,e.tag))}function Ccr(t,e){switch(mbe(e),e.tag){case 1:return Ip(e.type)&&a7(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return GF(),aa(Ap),aa(Ud),xbe(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return Sbe(e),null;case 13:if(aa(Fa),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(qe(340));WF()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return aa(Fa),null;case 4:return GF(),null;case 10:return bbe(e.type._context),null;case 22:case 23:return Nbe(),null;case 24:return null;default:return null}}var $J=!1,qd=!1,Ocr=typeof WeakSet=="function"?WeakSet:Set,Ct=null;function LF(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){cs(t,e,n)}else r.current=null}function zye(t,e,r){try{r()}catch(n){cs(t,e,n)}}var g6e=!1;function Pcr(t,e){if(Pye=r7,t=f5e(),fbe(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(Eye={focusedElem:t,selectionRange:r},r7=!1,Ct=e;Ct!==null;)if(e=Ct,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Ct=t;else for(;Ct!==null;){e=Ct;try{var m=e.alternate;if((e.flags&1024)!==0)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var h=m.memoizedProps,b=m.memoizedState,g=e.stateNode,y=g.getSnapshotBeforeUpdate(e.elementType===e.type?h:wy(e.type,h),b);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(qe(163))}}catch(x){cs(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,Ct=t;break}Ct=e.return}return m=g6e,g6e=!1,m}function F4(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&&zye(e,r,i)}o=o.next}while(o!==n)}}function A7(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 Hye(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 lWe(t){var e=t.alternate;e!==null&&(t.alternate=null,lWe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[s_],delete e[Y4],delete e[Iye],delete e[ucr],delete e[lcr])),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 cWe(t){return t.tag===5||t.tag===3||t.tag===4}function y6e(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||cWe(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 Vye(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=i7));else if(n!==4&&(t=t.child,t!==null))for(Vye(t,e,r),t=t.sibling;t!==null;)Vye(t,e,r),t=t.sibling}function Wye(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(Wye(t,e,r),t=t.sibling;t!==null;)Wye(t,e,r),t=t.sibling}var Rc=null,Sy=!1;function YE(t,e,r){for(r=r.child;r!==null;)dWe(t,e,r),r=r.sibling}function dWe(t,e,r){if(u_&&typeof u_.onCommitFiberUnmount=="function")try{u_.onCommitFiberUnmount(w7,r)}catch{}switch(r.tag){case 5:qd||LF(r,e);case 6:var n=Rc,o=Sy;Rc=null,YE(t,e,r),Rc=n,Sy=o,Rc!==null&&(Sy?(t=Rc,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Rc.removeChild(r.stateNode));break;case 18:Rc!==null&&(Sy?(t=Rc,r=r.stateNode,t.nodeType===8?Jge(t.parentNode,r):t.nodeType===1&&Jge(t,r),V4(t)):Jge(Rc,r.stateNode));break;case 4:n=Rc,o=Sy,Rc=r.stateNode.containerInfo,Sy=!0,YE(t,e,r),Rc=n,Sy=o;break;case 0:case 11:case 14:case 15:if(!qd&&(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)&&zye(r,e,a),o=o.next}while(o!==n)}YE(t,e,r);break;case 1:if(!qd&&(LF(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){cs(r,e,s)}YE(t,e,r);break;case 21:YE(t,e,r);break;case 22:r.mode&1?(qd=(n=qd)||r.memoizedState!==null,YE(t,e,r),qd=n):YE(t,e,r);break;default:YE(t,e,r)}}function b6e(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new Ocr),e.forEach(function(n){var o=Dcr.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function vy(t,e){var r=e.deletions;if(r!==null)for(var n=0;no&&(o=a),n&=~i}if(n=o,n=Ts()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Tcr(n/1960))-n,10t?16:t,rT===null)var n=!1;else{if(t=rT,rT=null,b7=0,(bo&6)!==0)throw Error(qe(331));var o=bo;for(bo|=4,Ct=t.current;Ct!==null;){var i=Ct,a=i.child;if((Ct.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;uTs()-Rbe?ZR(t,0):Mbe|=r),Mp(t,e)}function _We(t,e){e===0&&((t.mode&1)===0?e=1:(e=PJ,PJ<<=1,(PJ&130023424)===0&&(PJ=4194304)));var r=Bf();t=WC(t,e),t!==null&&(n3(t,e,r),Mp(t,r))}function Ncr(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),_We(t,r)}function Dcr(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(qe(314))}n!==null&&n.delete(e),_We(t,r)}var vWe;vWe=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ap.current)Tp=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return Tp=!1,Scr(t,e,r);Tp=(t.flags&131072)!==0}else Tp=!1,Ca&&(e.flags&1048576)!==0&&x5e(e,l7,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;KJ(t,e),t=e.pendingProps;var o=VF(e,Ud.current);UF(e,r),o=Obe(null,e,n,t,o,r);var i=Pbe();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,Ip(n)?(i=!0,s7(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,vbe(e),o.updater=E7,e.stateNode=o,o._reactInternals=e,Lye(e,n,t,r),e=$ye(null,e,n,!0,i,r)):(e.tag=0,Ca&&i&&pbe(e),$f(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(KJ(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=Fcr(n),t=wy(n,t),o){case 0:e=kye(null,e,n,t,r);break e;case 1:e=p6e(null,e,n,t,r);break e;case 11:e=d6e(null,e,n,t,r);break e;case 14:e=f6e(null,e,n,wy(n.type,t),r);break e}throw Error(qe(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:wy(n,o),kye(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:wy(n,o),p6e(t,e,n,o,r);case 3:e:{if(nWe(e),t===null)throw Error(qe(387));n=e.pendingProps,i=e.memoizedState,o=i.element,E5e(t,e),f7(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=JF(Error(qe(423)),e),e=m6e(t,e,n,r,o);break e}else if(n!==o){o=JF(Error(qe(424)),e),e=m6e(t,e,n,r,o);break e}else for(Cm=aT(e.stateNode.containerInfo.firstChild),Om=e,Ca=!0,xy=null,r=M5e(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(WF(),n===o){e=KC(t,e,r);break e}$f(t,e,n,r)}e=e.child}return e;case 5:return R5e(e),t===null&&jye(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,Tye(n,o)?a=null:i!==null&&Tye(n,i)&&(e.flags|=32),rWe(t,e),$f(t,e,a,r),e.child;case 6:return t===null&&jye(e),null;case 13:return oWe(t,e,r);case 4:return wbe(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=KF(e,null,n,r):$f(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:wy(n,o),d6e(t,e,n,o,r);case 7:return $f(t,e,e.pendingProps,r),e.child;case 8:return $f(t,e,e.pendingProps.children,r),e.child;case 12:return $f(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,zi(c7,n._currentValue),n._currentValue=a,i!==null)if(Py(i.value,a)){if(i.children===o.children&&!Ap.current){e=KC(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=zC(-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),Nye(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(qe(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),Nye(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}$f(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,UF(e,r),o=zh(o),n=n(o),e.flags|=1,$f(t,e,n,r),e.child;case 14:return n=e.type,o=wy(n,e.pendingProps),o=wy(n.type,o),f6e(t,e,n,o,r);case 15:return eWe(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:wy(n,o),KJ(t,e),e.tag=1,Ip(n)?(t=!0,s7(e)):t=!1,UF(e,r),A5e(e,n,o),Lye(e,n,o,r),$ye(null,e,n,!0,t,r);case 19:return iWe(t,e,r);case 22:return tWe(t,e,r)}throw Error(qe(156,e.tag))};function wWe(t,e){return K6e(t,e)}function Lcr(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 qh(t,e,r,n){return new Lcr(t,e,r,n)}function Lbe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Fcr(t){if(typeof t=="function")return Lbe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===tbe)return 11;if(t===rbe)return 14}return 2}function cT(t,e){var r=t.alternate;return r===null?(r=qh(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 YJ(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")Lbe(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case EF:return XR(r.children,o,i,e);case ebe:a=8,o|=8;break;case aye:return t=qh(12,r,e,o|2),t.elementType=aye,t.lanes=i,t;case sye:return t=qh(13,r,e,o),t.elementType=sye,t.lanes=i,t;case uye:return t=qh(19,r,e,o),t.elementType=uye,t.lanes=i,t;case I6e:return M7(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case T6e:a=10;break e;case A6e:a=9;break e;case tbe:a=11;break e;case rbe:a=14;break e;case ZE:a=16,n=null;break e}throw Error(qe(130,t==null?t:typeof t,""))}return e=qh(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function XR(t,e,r,n){return t=qh(7,t,n,e),t.lanes=r,t}function M7(t,e,r,n){return t=qh(22,t,n,e),t.elementType=I6e,t.lanes=r,t.stateNode={isHidden:!1},t}function nye(t,e,r){return t=qh(6,t,null,e),t.lanes=r,t}function oye(t,e,r){return e=qh(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function kcr(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=qge(0),this.expirationTimes=qge(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qge(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Fbe(t,e,r,n,o,i,a,s,u){return t=new kcr(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=qh(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},vbe(i),t}function $cr(t,e,r){var n=3{"use strict";function PWe(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(PWe)}catch(t){console.error(t)}}PWe(),EWe.exports=OWe()});var Dc=v(qbe=>{"use strict";var TWe=ds();qbe.createRoot=TWe.createRoot,qbe.hydrateRoot=TWe.hydrateRoot;var Zzn});function AWe(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=AWe(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{Hcr=F(X(),1)});var jWe=v(L7=>{"use strict";var Vcr=X(),Wcr=Symbol.for("react.element"),Kcr=Symbol.for("react.fragment"),Gcr=Object.prototype.hasOwnProperty,Jcr=Vcr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ycr={key:!0,ref:!0,__self:!0,__source:!0};function RWe(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)Gcr.call(e,n)&&!Ycr.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:Wcr,type:t,key:i,ref:a,props:o,_owner:Jcr.current}}L7.Fragment=Kcr;L7.jsx=RWe;L7.jsxs=RWe});var pt=v((t2n,NWe)=>{"use strict";NWe.exports=jWe()});function JC(t){let e=Zcr(t),r=El.forwardRef((n,o)=>{let{children:i,...a}=n,s=El.Children.toArray(i),u=s.find(Xcr);if(u){let l=u.props.children,c=s.map(d=>d===u?El.Children.count(l)>1?El.Children.only(null):El.isValidElement(l)?l.props.children:null:d);return(0,QF.jsx)(e,{...a,ref:o,children:El.isValidElement(l)?El.cloneElement(l,void 0,c):null})}return(0,QF.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Zcr(t){let e=El.forwardRef((r,n)=>{let{children:o,...i}=r;if(El.isValidElement(o)){let a=edr(o),s=Qcr(i,o.props);return o.type!==El.Fragment&&(s.ref=n?IWe(n,a):a),El.cloneElement(o,s)}return El.Children.count(o)>1?El.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}function FWe(t){let e=({children:r})=>(0,QF.jsx)(QF.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=LWe,e}function Xcr(t){return El.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===LWe}function Qcr(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 edr(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 El,QF,DWe,LWe,a1=w(()=>{El=F(X(),1);MWe();QF=F(pt(),1);DWe=JC("Slot");LWe=Symbol("radix.slottable")});function kWe(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{});var $We,BWe,ek,k7=w(()=>{Ube();$We=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,BWe=F7,ek=(t,e)=>r=>{var n;if(e?.variants==null)return BWe(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=$We(c)||$We(d);return o[l][f]}),s=r&&Object.entries(r).reduce((l,c)=>{let[d,f]=c;return f===void 0||(l[d]=f),l},{}),u=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((l,c)=>{let{class:d,className:f,...p}=c;return Object.entries(p).every(m=>{let[h,b]=m;return Array.isArray(b)?b.includes({...i,...s}[h]):{...i,...s}[h]===b})?[...l,d,f]:l},[]);return BWe(t,a,u,r?.class,r?.className)}});function fdr(){let t=0,e,r,n="";for(;td(c),t());return r=ldr(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=ddr(u,r);return o(u,c),c}return function(){return i(fdr.apply(null,arguments))}}var Vbe,tdr,VWe,qWe,rdr,ndr,Hbe,UWe,odr,idr,adr,WWe,sdr,udr,ldr,cdr,ddr,KWe,sa,GWe,pdr,mdr,hdr,gdr,ydr,bdr,_dr,YC,gT,tk,zbe,s3,vdr,tn,yT,wdr,Sdr,xdr,Cdr,Odr,Pdr,u3,rk,Edr,JWe,Tdr,Adr,HWe,Idr,l3,Mdr,Rdr,YWe,ZWe=w(()=>{Vbe="-",tdr=t=>{let e=ndr(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(Vbe);return s[0]===""&&s.length!==1&&s.shift(),VWe(s,e)||rdr(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},VWe=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?VWe(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(Vbe);return e.validators.find(({validator:a})=>a(i))?.classGroupId},qWe=/^\[(.+)\]$/,rdr=t=>{if(qWe.test(t)){let e=qWe.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},ndr=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return idr(Object.entries(t.classGroups),r).forEach(([i,a])=>{Hbe(a,n,i,e)}),n},Hbe=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:UWe(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(odr(o)){Hbe(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{Hbe(a,UWe(e,i),r,n)})})},UWe=(t,e)=>{let r=t;return e.split(Vbe).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},odr=t=>t.isThemeGetter,idr=(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,adr=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)}}},WWe="!",sdr=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 b=0;bc?d-c:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:h}};return r?s=>r({className:s,parseClassName:a}):a},udr=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},ldr=t=>({cache:adr(t.cacheSize),parseClassName:sdr(t),...tdr(t)}),cdr=/\s+/,ddr=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(cdr),s="";for(let u=a.length-1;u>=0;u-=1){let l=a[u],{modifiers:c,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=r(l),m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){s=l+(s.length>0?" "+s:s);continue}if(h=n(f),!h){s=l+(s.length>0?" "+s:s);continue}m=!1}let b=udr(c).join(":"),g=d?b+WWe:b,y=g+h;if(i.includes(y))continue;i.push(y);let S=o(h,m);for(let x=0;x0?" "+s:s)}return s};KWe=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},GWe=/^\[(?:([a-z-]+):)?(.+)\]$/i,pdr=/^\d+\/\d+$/,mdr=new Set(["px","full","screen"]),hdr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gdr=/\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$/,ydr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,bdr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_dr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,YC=t=>tk(t)||mdr.has(t)||pdr.test(t),gT=t=>rk(t,"length",Edr),tk=t=>!!t&&!Number.isNaN(Number(t)),zbe=t=>rk(t,"number",tk),s3=t=>!!t&&Number.isInteger(Number(t)),vdr=t=>t.endsWith("%")&&tk(t.slice(0,-1)),tn=t=>GWe.test(t),yT=t=>hdr.test(t),wdr=new Set(["length","size","percentage"]),Sdr=t=>rk(t,wdr,JWe),xdr=t=>rk(t,"position",JWe),Cdr=new Set(["image","url"]),Odr=t=>rk(t,Cdr,Adr),Pdr=t=>rk(t,"",Tdr),u3=()=>!0,rk=(t,e,r)=>{let n=GWe.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},Edr=t=>gdr.test(t)&&!ydr.test(t),JWe=()=>!1,Tdr=t=>bdr.test(t),Adr=t=>_dr.test(t),HWe=()=>{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"),m=sa("gradientColorStopPositions"),h=sa("inset"),b=sa("margin"),g=sa("opacity"),y=sa("padding"),S=sa("saturate"),x=sa("scale"),O=sa("sepia"),P=sa("skew"),E=sa("space"),A=sa("translate"),I=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",tn,e],j=()=>[tn,e],$=()=>["",YC,gT],k=()=>["auto",tk,tn],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",tn],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],q=()=>[tk,tn];return{cacheSize:500,separator:":",theme:{colors:[u3],spacing:[YC,gT],blur:["none","",yT,tn],brightness:q(),borderColor:[t],borderRadius:["none","","full",yT,tn],borderSpacing:j(),borderWidth:$(),contrast:q(),grayscale:D(),hueRotate:q(),invert:D(),gap:j(),gradientColorStops:[t],gradientColorStopPositions:[vdr,gT],inset:N(),margin:N(),opacity:q(),padding:j(),saturate:q(),scale:q(),sepia:D(),skew:q(),space:j(),translate:j()},classGroups:{aspect:[{aspect:["auto","square","video",tn]}],container:["container"],columns:[{columns:[yT]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"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:[...z(),tn]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",s3,tn]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",tn]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",s3,tn]}],"grid-cols":[{"grid-cols":[u3]}],"col-start-end":[{col:["auto",{span:["full",s3,tn]},tn]}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":[u3]}],"row-start-end":[{row:["auto",{span:[s3,tn]},tn]}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",tn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",tn]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...J()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...J(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...J(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",tn,e]}],"min-w":[{"min-w":[tn,e,"min","max","fit"]}],"max-w":[{"max-w":[tn,e,"none","full","min","max","fit","prose",{screen:[yT]},yT]}],h:[{h:[tn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[tn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[tn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[tn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",yT,gT]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",zbe]}],"font-family":[{font:[u3]}],"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",tn]}],"line-clamp":[{"line-clamp":["none",tk,zbe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",YC,tn]}],"list-image":[{"list-image":["none",tn]}],"list-style-type":[{list:["none","disc","decimal",tn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",YC,gT]}],"underline-offset":[{"underline-offset":["auto",YC,tn]}],"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:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",tn]}],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",tn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...z(),xdr]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Sdr]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Odr]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:V()}],"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:["",...V()]}],"outline-offset":[{"outline-offset":[YC,tn]}],"outline-w":[{outline:[YC,gT]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[YC,gT]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",yT,Pdr]}],"shadow-color":[{shadow:[u3]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",yT,tn]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[S]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"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",tn]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",tn]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",tn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[s3,tn]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",tn]}],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",tn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",tn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[YC,gT,zbe]}],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"]}}},Idr=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{l3(t,"cacheSize",e),l3(t,"prefix",r),l3(t,"separator",n),l3(t,"experimentalParseClassName",o);for(let s in a)Mdr(t[s],a[s]);for(let s in i)Rdr(t[s],i[s]);return t},l3=(t,e,r)=>{r!==void 0&&(t[e]=r)},Mdr=(t,e)=>{if(e)for(let r in e)l3(t,r,e[r])},Rdr=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},YWe=(t,...e)=>typeof t=="function"?zWe(HWe,t,...e):zWe(()=>Idr(HWe(),t),...e)});function _e(...t){return jdr(F7(t))}var jdr,Tn=w(()=>{Ube();ZWe();jdr=YWe({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 $7,Ndr,ge,ti=w(()=>{$7=F(X());a1();k7();Tn();Ndr=ek("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"}}),ge=$7.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>$7.createElement(n?DWe:"button",{className:_e(Ndr({variant:e,size:r,className:t})),ref:i,...o}));ge.displayName="Button"});var XWe,B7,Wbe=w(()=>{XWe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),B7=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim()});var QWe,e9e=w(()=>{QWe={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 c3,t9e,r9e=w(()=>{c3=F(X());e9e();Wbe();t9e=(0,c3.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,c3.createElement)("svg",{ref:u,...QWe,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:B7("lucide",o),...s},[...a.map(([l,c])=>(0,c3.createElement)(l,c)),...Array.isArray(i)?i:[i]]))});var q7,we,It=w(()=>{q7=F(X());Wbe();r9e();we=(t,e)=>{let r=(0,q7.forwardRef)(({className:n,...o},i)=>(0,q7.createElement)(t9e,{ref:i,iconNode:e,className:B7(`lucide-${XWe(t)}`,n),...o}));return r.displayName=`${t}`,r}});var ZC,n9e=w(()=>{It();ZC=we("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]])});var d3,o9e=w(()=>{It();d3=we("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])});var s1,i9e=w(()=>{It();s1=we("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 Jl,a9e=w(()=>{It();Jl=we("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])});var Hi,s9e=w(()=>{It();Hi=we("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])});var XC,u9e=w(()=>{It();XC=we("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])});var Ey,l9e=w(()=>{It();Ey=we("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])});var di,c9e=w(()=>{It();di=we("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 Am,d9e=w(()=>{It();Am=we("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var bT,f9e=w(()=>{It();bT=we("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]])});var _T,p9e=w(()=>{It();_T=we("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 f3,m9e=w(()=>{It();f3=we("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])});var p3,h9e=w(()=>{It();p3=we("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]])});var m3,g9e=w(()=>{It();m3=we("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 c_,y9e=w(()=>{It();c_=we("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 Ty,b9e=w(()=>{It();Ty=we("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 Im,_9e=w(()=>{It();Im=we("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]])});var h3,v9e=w(()=>{It();h3=we("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 g3,w9e=w(()=>{It();g3=we("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 y3,S9e=w(()=>{It();y3=we("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 QC,x9e=w(()=>{It();QC=we("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 vT,C9e=w(()=>{It();vT=we("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 u1,O9e=w(()=>{It();u1=we("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 b3,P9e=w(()=>{It();b3=we("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 eO,E9e=w(()=>{It();eO=we("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 _3,T9e=w(()=>{It();_3=we("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 v3,A9e=w(()=>{It();v3=we("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 w3,I9e=w(()=>{It();w3=we("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 S3,M9e=w(()=>{It();S3=we("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 Ay,R9e=w(()=>{It();Ay=we("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 x3,j9e=w(()=>{It();x3=we("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 C3,N9e=w(()=>{It();C3=we("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 Iy,D9e=w(()=>{It();Iy=we("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 l1,L9e=w(()=>{It();l1=we("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 d_,F9e=w(()=>{It();d_=we("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 O3,k9e=w(()=>{It();O3=we("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 P3,$9e=w(()=>{It();P3=we("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 f_,B9e=w(()=>{It();f_=we("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 E3,q9e=w(()=>{It();E3=we("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 c1,U9e=w(()=>{It();c1=we("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 tO,z9e=w(()=>{It();tO=we("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 Yl,H9e=w(()=>{It();Yl=we("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])});var T3,V9e=w(()=>{It();T3=we("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 nk,W9e=w(()=>{It();nk=we("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 p_,K9e=w(()=>{It();p_=we("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 rO,G9e=w(()=>{It();rO=we("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 ok,J9e=w(()=>{It();ok=we("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 ik,Y9e=w(()=>{It();ik=we("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 Mm,Z9e=w(()=>{It();Mm=we("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])});var A3,X9e=w(()=>{It();A3=we("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 m_,Q9e=w(()=>{It();m_=we("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 I3,eKe=w(()=>{It();I3=we("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 d1,tKe=w(()=>{It();d1=we("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])});var Vh,rKe=w(()=>{It();Vh=we("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 nO,nKe=w(()=>{It();nO=we("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 Rp,oKe=w(()=>{It();Rp=we("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 f1,iKe=w(()=>{It();f1=we("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 M3,aKe=w(()=>{It();M3=we("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 Rm,sKe=w(()=>{It();Rm=we("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 Uf,uKe=w(()=>{It();Uf=we("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 R3,lKe=w(()=>{It();R3=we("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 p1,cKe=w(()=>{It();p1=we("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 Vi,dKe=w(()=>{It();Vi=we("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])});var bn=w(()=>{c9e();d9e();f9e();p9e();x9e();C9e();H9e();K9e();G9e();rKe();nKe();oKe();uKe();n9e();o9e();i9e();a9e();s9e();u9e();l9e();m9e();h9e();g9e();y9e();b9e();_9e();v9e();w9e();S9e();O9e();P9e();E9e();T9e();A9e();I9e();M9e();R9e();j9e();N9e();D9e();L9e();F9e();k9e();$9e();B9e();q9e();U9e();z9e();V9e();W9e();J9e();Y9e();Z9e();X9e();Q9e();eKe();tKe();iKe();aKe();sKe();lKe();cKe();dKe();});function Ddr({onCancel:t}){let e=ue(),r=Kbe(e.defaultModelKey)&&Kbe(e.embeddingModelKey);return h_.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},h_.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},h_.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&h_.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.")),h_.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},h_.default.createElement(ge,{variant:"ghost",onClick:t},"Close"),h_.default.createElement(ge,{variant:"default",onClick:()=>{m1(FC.EXPIRED_MODAL)}},"Renew Now ",h_.default.createElement(u1,{className:"tw-size-4"}))))}var h_,fKe,pKe,U7,mKe=w(()=>{h_=F(X()),fKe=require("obsidian"),pKe=F(Dc());ti();oO();$r();bn();nr();U7=class extends fKe.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=(0,pKe.createRoot)(e);let r=()=>{this.close()};this.root.render(h_.default.createElement(Ddr,{onCancel:r}))}onClose(){this.root.unmount()}}});var Rr,wT=w(()=>{Rr=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}}});var hKe=v(z7=>{"use strict";Object.defineProperty(z7,"__esModule",{value:!0});z7.V2ChatStreamRequestCitationMode=void 0;z7.V2ChatStreamRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var gKe=v(H7=>{"use strict";Object.defineProperty(H7,"__esModule",{value:!0});H7.V2ChatRequestCitationMode=void 0;H7.V2ChatRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var bKe=v(yKe=>{"use strict";Object.defineProperty(yKe,"__esModule",{value:!0})});var vKe=v(_Ke=>{"use strict";Object.defineProperty(_Ke,"__esModule",{value:!0})});var SKe=v(wKe=>{"use strict";Object.defineProperty(wKe,"__esModule",{value:!0})});var CKe=v(xKe=>{"use strict";Object.defineProperty(xKe,"__esModule",{value:!0})});var PKe=v(OKe=>{"use strict";Object.defineProperty(OKe,"__esModule",{value:!0})});var TKe=v(EKe=>{"use strict";Object.defineProperty(EKe,"__esModule",{value:!0})});var IKe=v(AKe=>{"use strict";Object.defineProperty(AKe,"__esModule",{value:!0})});var RKe=v(MKe=>{"use strict";Object.defineProperty(MKe,"__esModule",{value:!0})});var NKe=v(jKe=>{"use strict";Object.defineProperty(jKe,"__esModule",{value:!0})});var LKe=v(DKe=>{"use strict";Object.defineProperty(DKe,"__esModule",{value:!0})});var kKe=v(FKe=>{"use strict";Object.defineProperty(FKe,"__esModule",{value:!0})});var BKe=v($Ke=>{"use strict";Object.defineProperty($Ke,"__esModule",{value:!0})});var UKe=v(qKe=>{"use strict";Object.defineProperty(qKe,"__esModule",{value:!0})});var HKe=v(zKe=>{"use strict";Object.defineProperty(zKe,"__esModule",{value:!0})});var WKe=v(VKe=>{"use strict";Object.defineProperty(VKe,"__esModule",{value:!0})});var GKe=v(KKe=>{"use strict";Object.defineProperty(KKe,"__esModule",{value:!0})});var YKe=v(JKe=>{"use strict";Object.defineProperty(JKe,"__esModule",{value:!0})});var XKe=v(ZKe=>{"use strict";Object.defineProperty(ZKe,"__esModule",{value:!0})});var eGe=v(QKe=>{"use strict";Object.defineProperty(QKe,"__esModule",{value:!0})});var rGe=v(tGe=>{"use strict";Object.defineProperty(tGe,"__esModule",{value:!0})});var oGe=v(nGe=>{"use strict";Object.defineProperty(nGe,"__esModule",{value:!0})});var aGe=v(iGe=>{"use strict";Object.defineProperty(iGe,"__esModule",{value:!0})});var uGe=v(sGe=>{"use strict";Object.defineProperty(sGe,"__esModule",{value:!0})});var lGe=v(V7=>{"use strict";Object.defineProperty(V7,"__esModule",{value:!0});V7.ChatFinishReason=void 0;V7.ChatFinishReason={Complete:"complete",StopSequence:"stop_sequence",MaxTokens:"max_tokens",ToolCall:"tool_call",Error:"error",ContentBlocked:"content_blocked",ErrorLimit:"error_limit"}});var dGe=v(cGe=>{"use strict";Object.defineProperty(cGe,"__esModule",{value:!0})});var pGe=v(fGe=>{"use strict";Object.defineProperty(fGe,"__esModule",{value:!0})});var hGe=v(mGe=>{"use strict";Object.defineProperty(mGe,"__esModule",{value:!0})});var yGe=v(gGe=>{"use strict";Object.defineProperty(gGe,"__esModule",{value:!0})});var _Ge=v(bGe=>{"use strict";Object.defineProperty(bGe,"__esModule",{value:!0})});var wGe=v(vGe=>{"use strict";Object.defineProperty(vGe,"__esModule",{value:!0})});var xGe=v(SGe=>{"use strict";Object.defineProperty(SGe,"__esModule",{value:!0})});var OGe=v(CGe=>{"use strict";Object.defineProperty(CGe,"__esModule",{value:!0})});var EGe=v(PGe=>{"use strict";Object.defineProperty(PGe,"__esModule",{value:!0})});var AGe=v(TGe=>{"use strict";Object.defineProperty(TGe,"__esModule",{value:!0})});var MGe=v(IGe=>{"use strict";Object.defineProperty(IGe,"__esModule",{value:!0})});var jGe=v(RGe=>{"use strict";Object.defineProperty(RGe,"__esModule",{value:!0})});var DGe=v(NGe=>{"use strict";Object.defineProperty(NGe,"__esModule",{value:!0})});var FGe=v(LGe=>{"use strict";Object.defineProperty(LGe,"__esModule",{value:!0})});var $Ge=v(kGe=>{"use strict";Object.defineProperty(kGe,"__esModule",{value:!0})});var qGe=v(BGe=>{"use strict";Object.defineProperty(BGe,"__esModule",{value:!0})});var zGe=v(UGe=>{"use strict";Object.defineProperty(UGe,"__esModule",{value:!0})});var VGe=v(HGe=>{"use strict";Object.defineProperty(HGe,"__esModule",{value:!0})});var KGe=v(WGe=>{"use strict";Object.defineProperty(WGe,"__esModule",{value:!0})});var JGe=v(GGe=>{"use strict";Object.defineProperty(GGe,"__esModule",{value:!0})});var ZGe=v(YGe=>{"use strict";Object.defineProperty(YGe,"__esModule",{value:!0})});var QGe=v(XGe=>{"use strict";Object.defineProperty(XGe,"__esModule",{value:!0})});var tJe=v(eJe=>{"use strict";Object.defineProperty(eJe,"__esModule",{value:!0})});var nJe=v(rJe=>{"use strict";Object.defineProperty(rJe,"__esModule",{value:!0})});var iJe=v(oJe=>{"use strict";Object.defineProperty(oJe,"__esModule",{value:!0})});var sJe=v(aJe=>{"use strict";Object.defineProperty(aJe,"__esModule",{value:!0})});var lJe=v(uJe=>{"use strict";Object.defineProperty(uJe,"__esModule",{value:!0})});var dJe=v(cJe=>{"use strict";Object.defineProperty(cJe,"__esModule",{value:!0})});var pJe=v(fJe=>{"use strict";Object.defineProperty(fJe,"__esModule",{value:!0})});var hJe=v(mJe=>{"use strict";Object.defineProperty(mJe,"__esModule",{value:!0})});var yJe=v(gJe=>{"use strict";Object.defineProperty(gJe,"__esModule",{value:!0})});var _Je=v(bJe=>{"use strict";Object.defineProperty(bJe,"__esModule",{value:!0})});var wJe=v(vJe=>{"use strict";Object.defineProperty(vJe,"__esModule",{value:!0})});var Gbe=v(Tt=>{"use strict";var Ldr=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]}),$t=Tt&&Tt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ldr(e,t,r)};Object.defineProperty(Tt,"__esModule",{value:!0});$t(hKe(),Tt);$t(gKe(),Tt);$t(bKe(),Tt);$t(vKe(),Tt);$t(SKe(),Tt);$t(CKe(),Tt);$t(PKe(),Tt);$t(TKe(),Tt);$t(IKe(),Tt);$t(RKe(),Tt);$t(NKe(),Tt);$t(LKe(),Tt);$t(kKe(),Tt);$t(BKe(),Tt);$t(UKe(),Tt);$t(HKe(),Tt);$t(WKe(),Tt);$t(GKe(),Tt);$t(YKe(),Tt);$t(XKe(),Tt);$t(eGe(),Tt);$t(rGe(),Tt);$t(oGe(),Tt);$t(aGe(),Tt);$t(uGe(),Tt);$t(lGe(),Tt);$t(dGe(),Tt);$t(pGe(),Tt);$t(hGe(),Tt);$t(yGe(),Tt);$t(_Ge(),Tt);$t(wGe(),Tt);$t(xGe(),Tt);$t(OGe(),Tt);$t(EGe(),Tt);$t(AGe(),Tt);$t(MGe(),Tt);$t(jGe(),Tt);$t(DGe(),Tt);$t(FGe(),Tt);$t($Ge(),Tt);$t(qGe(),Tt);$t(zGe(),Tt);$t(VGe(),Tt);$t(KGe(),Tt);$t(JGe(),Tt);$t(ZGe(),Tt);$t(QGe(),Tt);$t(tJe(),Tt);$t(nJe(),Tt);$t(iJe(),Tt);$t(sJe(),Tt);$t(lJe(),Tt);$t(dJe(),Tt);$t(pJe(),Tt);$t(hJe(),Tt);$t(yJe(),Tt);$t(_Je(),Tt);$t(wJe(),Tt)});var Jbe=v(SJe=>{"use strict";Object.defineProperty(SJe,"__esModule",{value:!0})});var xJe=v(h1=>{"use strict";var Fdr=h1&&h1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kdr=h1&&h1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Fdr(e,t,r)};Object.defineProperty(h1,"__esModule",{value:!0});kdr(Jbe(),h1)});var OJe=v(ST=>{"use strict";var $dr=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]}),CJe=ST&&ST.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$dr(e,t,r)};Object.defineProperty(ST,"__esModule",{value:!0});CJe(Gbe(),ST);CJe(xJe(),ST)});var PJe=v(W7=>{"use strict";Object.defineProperty(W7,"__esModule",{value:!0});W7.CreateEmbedJobRequestTruncate=void 0;W7.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var Ybe=v(g1=>{"use strict";var Bdr=g1&&g1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qdr=g1&&g1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Bdr(e,t,r)};Object.defineProperty(g1,"__esModule",{value:!0});qdr(PJe(),g1)});var Zbe=v(EJe=>{"use strict";Object.defineProperty(EJe,"__esModule",{value:!0})});var TJe=v(y1=>{"use strict";var Udr=y1&&y1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zdr=y1&&y1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Udr(e,t,r)};Object.defineProperty(y1,"__esModule",{value:!0});zdr(Zbe(),y1)});var IJe=v(xT=>{"use strict";var Hdr=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]}),AJe=xT&&xT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Hdr(e,t,r)};Object.defineProperty(xT,"__esModule",{value:!0});AJe(Ybe(),xT);AJe(TJe(),xT)});var RJe=v(MJe=>{"use strict";Object.defineProperty(MJe,"__esModule",{value:!0})});var NJe=v(jJe=>{"use strict";Object.defineProperty(jJe,"__esModule",{value:!0})});var LJe=v(DJe=>{"use strict";Object.defineProperty(DJe,"__esModule",{value:!0})});var kJe=v(FJe=>{"use strict";Object.defineProperty(FJe,"__esModule",{value:!0})});var BJe=v($Je=>{"use strict";Object.defineProperty($Je,"__esModule",{value:!0})});var Xbe=v(My=>{"use strict";var Vdr=My&&My.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),j3=My&&My.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vdr(e,t,r)};Object.defineProperty(My,"__esModule",{value:!0});j3(RJe(),My);j3(NJe(),My);j3(LJe(),My);j3(kJe(),My);j3(BJe(),My)});var Qbe=v(qJe=>{"use strict";Object.defineProperty(qJe,"__esModule",{value:!0})});var UJe=v(b1=>{"use strict";var Wdr=b1&&b1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kdr=b1&&b1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Wdr(e,t,r)};Object.defineProperty(b1,"__esModule",{value:!0});Kdr(Qbe(),b1)});var HJe=v(CT=>{"use strict";var Gdr=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]}),zJe=CT&&CT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Gdr(e,t,r)};Object.defineProperty(CT,"__esModule",{value:!0});zJe(Xbe(),CT);zJe(UJe(),CT)});var VJe=v(K7=>{"use strict";Object.defineProperty(K7,"__esModule",{value:!0});K7.BaseType=void 0;K7.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var WJe=v(G7=>{"use strict";Object.defineProperty(G7,"__esModule",{value:!0});G7.Strategy=void 0;G7.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var GJe=v(KJe=>{"use strict";Object.defineProperty(KJe,"__esModule",{value:!0})});var YJe=v(JJe=>{"use strict";Object.defineProperty(JJe,"__esModule",{value:!0})});var XJe=v(ZJe=>{"use strict";Object.defineProperty(ZJe,"__esModule",{value:!0})});var e7e=v(QJe=>{"use strict";Object.defineProperty(QJe,"__esModule",{value:!0})});var t7e=v(J7=>{"use strict";Object.defineProperty(J7,"__esModule",{value:!0});J7.Status=void 0;J7.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 n7e=v(r7e=>{"use strict";Object.defineProperty(r7e,"__esModule",{value:!0})});var i7e=v(o7e=>{"use strict";Object.defineProperty(o7e,"__esModule",{value:!0})});var s7e=v(a7e=>{"use strict";Object.defineProperty(a7e,"__esModule",{value:!0})});var l7e=v(u7e=>{"use strict";Object.defineProperty(u7e,"__esModule",{value:!0})});var d7e=v(c7e=>{"use strict";Object.defineProperty(c7e,"__esModule",{value:!0})});var p7e=v(f7e=>{"use strict";Object.defineProperty(f7e,"__esModule",{value:!0})});var h7e=v(m7e=>{"use strict";Object.defineProperty(m7e,"__esModule",{value:!0})});var y7e=v(g7e=>{"use strict";Object.defineProperty(g7e,"__esModule",{value:!0})});var _7e=v(b7e=>{"use strict";Object.defineProperty(b7e,"__esModule",{value:!0})});var w7e=v(v7e=>{"use strict";Object.defineProperty(v7e,"__esModule",{value:!0})});var e_e=v(Ba=>{"use strict";var Jdr=Ba&&Ba.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lc=Ba&&Ba.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jdr(e,t,r)};Object.defineProperty(Ba,"__esModule",{value:!0});Lc(VJe(),Ba);Lc(WJe(),Ba);Lc(GJe(),Ba);Lc(YJe(),Ba);Lc(XJe(),Ba);Lc(e7e(),Ba);Lc(t7e(),Ba);Lc(n7e(),Ba);Lc(i7e(),Ba);Lc(s7e(),Ba);Lc(l7e(),Ba);Lc(d7e(),Ba);Lc(p7e(),Ba);Lc(h7e(),Ba);Lc(y7e(),Ba);Lc(_7e(),Ba);Lc(w7e(),Ba)});var S7e=v(_1=>{"use strict";var Ydr=_1&&_1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zdr=_1&&_1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ydr(e,t,r)};Object.defineProperty(_1,"__esModule",{value:!0});Zdr(e_e(),_1)});var C7e=v(jm=>{"use strict";var x7e=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]}),Xdr=jm&&jm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qdr=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)&&x7e(e,t,r);return Xdr(e,t),e},efr=jm&&jm.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&x7e(e,t,r)};Object.defineProperty(jm,"__esModule",{value:!0});jm.finetuning=void 0;jm.finetuning=Qdr(S7e());efr(e_e(),jm)});var t_e=v(O7e=>{"use strict";Object.defineProperty(O7e,"__esModule",{value:!0})});var P7e=v(v1=>{"use strict";var tfr=v1&&v1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=v1&&v1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tfr(e,t,r)};Object.defineProperty(v1,"__esModule",{value:!0});rfr(t_e(),v1)});var T7e=v(OT=>{"use strict";var nfr=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]}),E7e=OT&&OT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nfr(e,t,r)};Object.defineProperty(OT,"__esModule",{value:!0});E7e(C7e(),OT);E7e(P7e(),OT)});var r_e=v(A7e=>{"use strict";Object.defineProperty(A7e,"__esModule",{value:!0})});var I7e=v(w1=>{"use strict";var ofr=w1&&w1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ifr=w1&&w1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ofr(e,t,r)};Object.defineProperty(w1,"__esModule",{value:!0});ifr(r_e(),w1)});var M7e=v(S1=>{"use strict";var afr=S1&&S1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sfr=S1&&S1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&afr(e,t,r)};Object.defineProperty(S1,"__esModule",{value:!0});sfr(I7e(),S1)});var n_e=v(R7e=>{"use strict";Object.defineProperty(R7e,"__esModule",{value:!0})});var j7e=v(x1=>{"use strict";var ufr=x1&&x1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lfr=x1&&x1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ufr(e,t,r)};Object.defineProperty(x1,"__esModule",{value:!0});lfr(n_e(),x1)});var N7e=v(C1=>{"use strict";var cfr=C1&&C1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dfr=C1&&C1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cfr(e,t,r)};Object.defineProperty(C1,"__esModule",{value:!0});dfr(j7e(),C1)});var L7e=v(ri=>{"use strict";var D7e=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]}),ffr=ri&&ri.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ak=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)&&D7e(e,t,r);return ffr(e,t),e},iO=ri&&ri.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&D7e(e,t,r)};Object.defineProperty(ri,"__esModule",{value:!0});ri.models=ri.connectors=ri.finetuning=ri.datasets=ri.embedJobs=ri.v2=void 0;ri.v2=ak(OJe());iO(Gbe(),ri);ri.embedJobs=ak(IJe());iO(Ybe(),ri);ri.datasets=ak(HJe());iO(Xbe(),ri);ri.finetuning=ak(T7e());ri.connectors=ak(M7e());ri.models=ak(N7e());iO(Jbe(),ri);iO(Zbe(),ri);iO(Qbe(),ri);iO(r_e(),ri);iO(n_e(),ri);iO(t_e(),ri)});var F7e=v(Y7=>{"use strict";Object.defineProperty(Y7,"__esModule",{value:!0});Y7.ChatStreamRequestPromptTruncation=void 0;Y7.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var k7e=v(Z7=>{"use strict";Object.defineProperty(Z7,"__esModule",{value:!0});Z7.ChatStreamRequestCitationQuality=void 0;Z7.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var B7e=v($7e=>{"use strict";Object.defineProperty($7e,"__esModule",{value:!0})});var q7e=v(X7=>{"use strict";Object.defineProperty(X7,"__esModule",{value:!0});X7.ChatStreamRequestSafetyMode=void 0;X7.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var z7e=v(U7e=>{"use strict";Object.defineProperty(U7e,"__esModule",{value:!0})});var V7e=v(H7e=>{"use strict";Object.defineProperty(H7e,"__esModule",{value:!0})});var K7e=v(W7e=>{"use strict";Object.defineProperty(W7e,"__esModule",{value:!0})});var J7e=v(G7e=>{"use strict";Object.defineProperty(G7e,"__esModule",{value:!0})});var Z7e=v(Y7e=>{"use strict";Object.defineProperty(Y7e,"__esModule",{value:!0})});var X7e=v(Q7=>{"use strict";Object.defineProperty(Q7,"__esModule",{value:!0});Q7.ChatRequestPromptTruncation=void 0;Q7.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var Q7e=v(eY=>{"use strict";Object.defineProperty(eY,"__esModule",{value:!0});eY.ChatRequestCitationQuality=void 0;eY.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var tYe=v(eYe=>{"use strict";Object.defineProperty(eYe,"__esModule",{value:!0})});var rYe=v(tY=>{"use strict";Object.defineProperty(tY,"__esModule",{value:!0});tY.ChatRequestSafetyMode=void 0;tY.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var nYe=v(rY=>{"use strict";Object.defineProperty(rY,"__esModule",{value:!0});rY.GenerateStreamRequestTruncate=void 0;rY.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var oYe=v(nY=>{"use strict";Object.defineProperty(nY,"__esModule",{value:!0});nY.GenerateStreamRequestReturnLikelihoods=void 0;nY.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var iYe=v(oY=>{"use strict";Object.defineProperty(oY,"__esModule",{value:!0});oY.GenerateRequestTruncate=void 0;oY.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var aYe=v(iY=>{"use strict";Object.defineProperty(iY,"__esModule",{value:!0});iY.GenerateRequestReturnLikelihoods=void 0;iY.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var sYe=v(aY=>{"use strict";Object.defineProperty(aY,"__esModule",{value:!0});aY.EmbedRequestTruncate=void 0;aY.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var lYe=v(uYe=>{"use strict";Object.defineProperty(uYe,"__esModule",{value:!0})});var dYe=v(cYe=>{"use strict";Object.defineProperty(cYe,"__esModule",{value:!0})});var pYe=v(fYe=>{"use strict";Object.defineProperty(fYe,"__esModule",{value:!0})});var hYe=v(mYe=>{"use strict";Object.defineProperty(mYe,"__esModule",{value:!0})});var yYe=v(gYe=>{"use strict";Object.defineProperty(gYe,"__esModule",{value:!0})});var bYe=v(sY=>{"use strict";Object.defineProperty(sY,"__esModule",{value:!0});sY.ClassifyRequestTruncate=void 0;sY.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var vYe=v(_Ye=>{"use strict";Object.defineProperty(_Ye,"__esModule",{value:!0})});var wYe=v(uY=>{"use strict";Object.defineProperty(uY,"__esModule",{value:!0});uY.ClassifyResponseClassificationsItemClassificationType=void 0;uY.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var xYe=v(SYe=>{"use strict";Object.defineProperty(SYe,"__esModule",{value:!0})});var OYe=v(CYe=>{"use strict";Object.defineProperty(CYe,"__esModule",{value:!0})});var PYe=v(lY=>{"use strict";Object.defineProperty(lY,"__esModule",{value:!0});lY.SummarizeRequestLength=void 0;lY.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var EYe=v(cY=>{"use strict";Object.defineProperty(cY,"__esModule",{value:!0});cY.SummarizeRequestFormat=void 0;cY.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var TYe=v(dY=>{"use strict";Object.defineProperty(dY,"__esModule",{value:!0});dY.SummarizeRequestExtractiveness=void 0;dY.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var IYe=v(AYe=>{"use strict";Object.defineProperty(AYe,"__esModule",{value:!0})});var RYe=v(MYe=>{"use strict";Object.defineProperty(MYe,"__esModule",{value:!0})});var NYe=v(jYe=>{"use strict";Object.defineProperty(jYe,"__esModule",{value:!0})});var LYe=v(DYe=>{"use strict";Object.defineProperty(DYe,"__esModule",{value:!0})});var kYe=v(FYe=>{"use strict";Object.defineProperty(FYe,"__esModule",{value:!0})});var BYe=v($Ye=>{"use strict";Object.defineProperty($Ye,"__esModule",{value:!0})});var UYe=v(qYe=>{"use strict";Object.defineProperty(qYe,"__esModule",{value:!0})});var HYe=v(zYe=>{"use strict";Object.defineProperty(zYe,"__esModule",{value:!0})});var WYe=v(VYe=>{"use strict";Object.defineProperty(VYe,"__esModule",{value:!0})});var GYe=v(KYe=>{"use strict";Object.defineProperty(KYe,"__esModule",{value:!0})});var YYe=v(JYe=>{"use strict";Object.defineProperty(JYe,"__esModule",{value:!0})});var XYe=v(ZYe=>{"use strict";Object.defineProperty(ZYe,"__esModule",{value:!0})});var eZe=v(QYe=>{"use strict";Object.defineProperty(QYe,"__esModule",{value:!0})});var rZe=v(tZe=>{"use strict";Object.defineProperty(tZe,"__esModule",{value:!0})});var oZe=v(nZe=>{"use strict";Object.defineProperty(nZe,"__esModule",{value:!0})});var aZe=v(iZe=>{"use strict";Object.defineProperty(iZe,"__esModule",{value:!0})});var uZe=v(sZe=>{"use strict";Object.defineProperty(sZe,"__esModule",{value:!0})});var cZe=v(lZe=>{"use strict";Object.defineProperty(lZe,"__esModule",{value:!0})});var fZe=v(dZe=>{"use strict";Object.defineProperty(dZe,"__esModule",{value:!0})});var mZe=v(pZe=>{"use strict";Object.defineProperty(pZe,"__esModule",{value:!0})});var hZe=v(fY=>{"use strict";Object.defineProperty(fY,"__esModule",{value:!0});fY.FinishReason=void 0;fY.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var yZe=v(gZe=>{"use strict";Object.defineProperty(gZe,"__esModule",{value:!0})});var _Ze=v(bZe=>{"use strict";Object.defineProperty(bZe,"__esModule",{value:!0})});var wZe=v(vZe=>{"use strict";Object.defineProperty(vZe,"__esModule",{value:!0})});var xZe=v(SZe=>{"use strict";Object.defineProperty(SZe,"__esModule",{value:!0})});var OZe=v(CZe=>{"use strict";Object.defineProperty(CZe,"__esModule",{value:!0})});var EZe=v(PZe=>{"use strict";Object.defineProperty(PZe,"__esModule",{value:!0})});var AZe=v(TZe=>{"use strict";Object.defineProperty(TZe,"__esModule",{value:!0})});var MZe=v(IZe=>{"use strict";Object.defineProperty(IZe,"__esModule",{value:!0})});var jZe=v(RZe=>{"use strict";Object.defineProperty(RZe,"__esModule",{value:!0})});var DZe=v(NZe=>{"use strict";Object.defineProperty(NZe,"__esModule",{value:!0})});var FZe=v(LZe=>{"use strict";Object.defineProperty(LZe,"__esModule",{value:!0})});var $Ze=v(kZe=>{"use strict";Object.defineProperty(kZe,"__esModule",{value:!0})});var BZe=v(pY=>{"use strict";Object.defineProperty(pY,"__esModule",{value:!0});pY.ChatStreamEndEventFinishReason=void 0;pY.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var UZe=v(qZe=>{"use strict";Object.defineProperty(qZe,"__esModule",{value:!0})});var HZe=v(zZe=>{"use strict";Object.defineProperty(zZe,"__esModule",{value:!0})});var WZe=v(VZe=>{"use strict";Object.defineProperty(VZe,"__esModule",{value:!0})});var GZe=v(KZe=>{"use strict";Object.defineProperty(KZe,"__esModule",{value:!0})});var YZe=v(JZe=>{"use strict";Object.defineProperty(JZe,"__esModule",{value:!0})});var XZe=v(ZZe=>{"use strict";Object.defineProperty(ZZe,"__esModule",{value:!0})});var eXe=v(QZe=>{"use strict";Object.defineProperty(QZe,"__esModule",{value:!0})});var rXe=v(tXe=>{"use strict";Object.defineProperty(tXe,"__esModule",{value:!0})});var oXe=v(nXe=>{"use strict";Object.defineProperty(nXe,"__esModule",{value:!0})});var aXe=v(iXe=>{"use strict";Object.defineProperty(iXe,"__esModule",{value:!0})});var uXe=v(sXe=>{"use strict";Object.defineProperty(sXe,"__esModule",{value:!0})});var cXe=v(lXe=>{"use strict";Object.defineProperty(lXe,"__esModule",{value:!0})});var fXe=v(dXe=>{"use strict";Object.defineProperty(dXe,"__esModule",{value:!0})});var mXe=v(pXe=>{"use strict";Object.defineProperty(pXe,"__esModule",{value:!0})});var gXe=v(hXe=>{"use strict";Object.defineProperty(hXe,"__esModule",{value:!0})});var bXe=v(yXe=>{"use strict";Object.defineProperty(yXe,"__esModule",{value:!0})});var vXe=v(_Xe=>{"use strict";Object.defineProperty(_Xe,"__esModule",{value:!0})});var SXe=v(wXe=>{"use strict";Object.defineProperty(wXe,"__esModule",{value:!0})});var CXe=v(xXe=>{"use strict";Object.defineProperty(xXe,"__esModule",{value:!0})});var PXe=v(OXe=>{"use strict";Object.defineProperty(OXe,"__esModule",{value:!0})});var EXe=v(mY=>{"use strict";Object.defineProperty(mY,"__esModule",{value:!0});mY.EmbedInputType=void 0;mY.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering"}});var TXe=v(hY=>{"use strict";Object.defineProperty(hY,"__esModule",{value:!0});hY.EmbeddingType=void 0;hY.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"}});var IXe=v(AXe=>{"use strict";Object.defineProperty(AXe,"__esModule",{value:!0})});var RXe=v(MXe=>{"use strict";Object.defineProperty(MXe,"__esModule",{value:!0})});var NXe=v(jXe=>{"use strict";Object.defineProperty(jXe,"__esModule",{value:!0})});var DXe=v(gY=>{"use strict";Object.defineProperty(gY,"__esModule",{value:!0});gY.EmbedJobStatus=void 0;gY.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var LXe=v(yY=>{"use strict";Object.defineProperty(yY,"__esModule",{value:!0});yY.EmbedJobTruncate=void 0;yY.EmbedJobTruncate={Start:"START",End:"END"}});var kXe=v(FXe=>{"use strict";Object.defineProperty(FXe,"__esModule",{value:!0})});var BXe=v($Xe=>{"use strict";Object.defineProperty($Xe,"__esModule",{value:!0})});var UXe=v(qXe=>{"use strict";Object.defineProperty(qXe,"__esModule",{value:!0})});var HXe=v(zXe=>{"use strict";Object.defineProperty(zXe,"__esModule",{value:!0})});var WXe=v(VXe=>{"use strict";Object.defineProperty(VXe,"__esModule",{value:!0})});var KXe=v(bY=>{"use strict";Object.defineProperty(bY,"__esModule",{value:!0});bY.DatasetValidationStatus=void 0;bY.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var GXe=v(_Y=>{"use strict";Object.defineProperty(_Y,"__esModule",{value:!0});_Y.DatasetType=void 0;_Y.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 YXe=v(JXe=>{"use strict";Object.defineProperty(JXe,"__esModule",{value:!0})});var XXe=v(ZXe=>{"use strict";Object.defineProperty(ZXe,"__esModule",{value:!0})});var eQe=v(QXe=>{"use strict";Object.defineProperty(QXe,"__esModule",{value:!0})});var rQe=v(tQe=>{"use strict";Object.defineProperty(tQe,"__esModule",{value:!0})});var oQe=v(nQe=>{"use strict";Object.defineProperty(nQe,"__esModule",{value:!0})});var aQe=v(iQe=>{"use strict";Object.defineProperty(iQe,"__esModule",{value:!0})});var uQe=v(sQe=>{"use strict";Object.defineProperty(sQe,"__esModule",{value:!0})});var cQe=v(lQe=>{"use strict";Object.defineProperty(lQe,"__esModule",{value:!0})});var fQe=v(dQe=>{"use strict";Object.defineProperty(dQe,"__esModule",{value:!0})});var mQe=v(pQe=>{"use strict";Object.defineProperty(pQe,"__esModule",{value:!0})});var gQe=v(hQe=>{"use strict";Object.defineProperty(hQe,"__esModule",{value:!0})});var bQe=v(yQe=>{"use strict";Object.defineProperty(yQe,"__esModule",{value:!0})});var _Qe=v(vY=>{"use strict";Object.defineProperty(vY,"__esModule",{value:!0});vY.ConnectorAuthStatus=void 0;vY.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var wQe=v(vQe=>{"use strict";Object.defineProperty(vQe,"__esModule",{value:!0})});var xQe=v(SQe=>{"use strict";Object.defineProperty(SQe,"__esModule",{value:!0})});var OQe=v(CQe=>{"use strict";Object.defineProperty(CQe,"__esModule",{value:!0})});var PQe=v(wY=>{"use strict";Object.defineProperty(wY,"__esModule",{value:!0});wY.AuthTokenType=void 0;wY.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var TQe=v(EQe=>{"use strict";Object.defineProperty(EQe,"__esModule",{value:!0})});var IQe=v(AQe=>{"use strict";Object.defineProperty(AQe,"__esModule",{value:!0})});var RQe=v(MQe=>{"use strict";Object.defineProperty(MQe,"__esModule",{value:!0})});var NQe=v(jQe=>{"use strict";Object.defineProperty(jQe,"__esModule",{value:!0})});var LQe=v(DQe=>{"use strict";Object.defineProperty(DQe,"__esModule",{value:!0})});var kQe=v(FQe=>{"use strict";Object.defineProperty(FQe,"__esModule",{value:!0})});var $Qe=v(SY=>{"use strict";Object.defineProperty(SY,"__esModule",{value:!0});SY.CompatibleEndpoint=void 0;SY.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var qQe=v(BQe=>{"use strict";Object.defineProperty(BQe,"__esModule",{value:!0})});var zQe=v(UQe=>{"use strict";Object.defineProperty(UQe,"__esModule",{value:!0})});var HQe=v(pe=>{"use strict";var pfr=pe&&pe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Se=pe&&pe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&pfr(e,t,r)};Object.defineProperty(pe,"__esModule",{value:!0});Se(F7e(),pe);Se(k7e(),pe);Se(B7e(),pe);Se(q7e(),pe);Se(z7e(),pe);Se(V7e(),pe);Se(K7e(),pe);Se(J7e(),pe);Se(Z7e(),pe);Se(X7e(),pe);Se(Q7e(),pe);Se(tYe(),pe);Se(rYe(),pe);Se(nYe(),pe);Se(oYe(),pe);Se(iYe(),pe);Se(aYe(),pe);Se(sYe(),pe);Se(lYe(),pe);Se(dYe(),pe);Se(pYe(),pe);Se(hYe(),pe);Se(yYe(),pe);Se(bYe(),pe);Se(vYe(),pe);Se(wYe(),pe);Se(xYe(),pe);Se(OYe(),pe);Se(PYe(),pe);Se(EYe(),pe);Se(TYe(),pe);Se(IYe(),pe);Se(RYe(),pe);Se(NYe(),pe);Se(LYe(),pe);Se(kYe(),pe);Se(BYe(),pe);Se(UYe(),pe);Se(HYe(),pe);Se(WYe(),pe);Se(GYe(),pe);Se(YYe(),pe);Se(XYe(),pe);Se(eZe(),pe);Se(rZe(),pe);Se(oZe(),pe);Se(aZe(),pe);Se(uZe(),pe);Se(cZe(),pe);Se(fZe(),pe);Se(mZe(),pe);Se(hZe(),pe);Se(yZe(),pe);Se(_Ze(),pe);Se(wZe(),pe);Se(xZe(),pe);Se(OZe(),pe);Se(EZe(),pe);Se(AZe(),pe);Se(MZe(),pe);Se(jZe(),pe);Se(DZe(),pe);Se(FZe(),pe);Se($Ze(),pe);Se(BZe(),pe);Se(UZe(),pe);Se(HZe(),pe);Se(WZe(),pe);Se(GZe(),pe);Se(YZe(),pe);Se(XZe(),pe);Se(eXe(),pe);Se(rXe(),pe);Se(oXe(),pe);Se(aXe(),pe);Se(uXe(),pe);Se(cXe(),pe);Se(fXe(),pe);Se(mXe(),pe);Se(gXe(),pe);Se(bXe(),pe);Se(vXe(),pe);Se(SXe(),pe);Se(CXe(),pe);Se(PXe(),pe);Se(EXe(),pe);Se(TXe(),pe);Se(IXe(),pe);Se(RXe(),pe);Se(NXe(),pe);Se(DXe(),pe);Se(LXe(),pe);Se(kXe(),pe);Se(BXe(),pe);Se(UXe(),pe);Se(HXe(),pe);Se(WXe(),pe);Se(KXe(),pe);Se(GXe(),pe);Se(YXe(),pe);Se(XXe(),pe);Se(eQe(),pe);Se(rQe(),pe);Se(oQe(),pe);Se(aQe(),pe);Se(uQe(),pe);Se(cQe(),pe);Se(fQe(),pe);Se(mQe(),pe);Se(gQe(),pe);Se(bQe(),pe);Se(_Qe(),pe);Se(wQe(),pe);Se(xQe(),pe);Se(OQe(),pe);Se(PQe(),pe);Se(TQe(),pe);Se(IQe(),pe);Se(RQe(),pe);Se(NQe(),pe);Se(LQe(),pe);Se(kQe(),pe);Se($Qe(),pe);Se(qQe(),pe);Se(zQe(),pe)});var VQe=v(xY=>{"use strict";Object.defineProperty(xY,"__esModule",{value:!0});xY.CohereError=void 0;var o_e=class t extends Error{constructor({message:e,statusCode:r,body:n}){super(mfr({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),r!=null&&(this.statusCode=r),n!==void 0&&(this.body=n)}};xY.CohereError=o_e;function mfr({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 WQe=v(CY=>{"use strict";Object.defineProperty(CY,"__esModule",{value:!0});CY.CohereTimeoutError=void 0;var i_e=class t extends Error{constructor(){super("Timeout"),Object.setPrototypeOf(this,t.prototype)}};CY.CohereTimeoutError=i_e});var As=v(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.CohereTimeoutError=sk.CohereError=void 0;var hfr=VQe();Object.defineProperty(sk,"CohereError",{enumerable:!0,get:function(){return hfr.CohereError}});var gfr=WQe();Object.defineProperty(sk,"CohereTimeoutError",{enumerable:!0,get:function(){return gfr.CohereTimeoutError}})});var KQe=v(g_=>{"use strict";var yfr=g_&&g_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bfr=g_&&g_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_fr=g_&&g_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yfr(e,t,r);return bfr(e,t),e};Object.defineProperty(g_,"__esModule",{value:!0});g_.BadRequestError=void 0;var vfr=_fr(As()),a_e=class t extends vfr.CohereError{constructor(e){super({message:"BadRequestError",statusCode:400,body:e}),Object.setPrototypeOf(this,t.prototype)}};g_.BadRequestError=a_e});var GQe=v(y_=>{"use strict";var wfr=y_&&y_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Sfr=y_&&y_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xfr=y_&&y_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wfr(e,t,r);return Sfr(e,t),e};Object.defineProperty(y_,"__esModule",{value:!0});y_.UnauthorizedError=void 0;var Cfr=xfr(As()),s_e=class t extends Cfr.CohereError{constructor(e){super({message:"UnauthorizedError",statusCode:401,body:e}),Object.setPrototypeOf(this,t.prototype)}};y_.UnauthorizedError=s_e});var JQe=v(b_=>{"use strict";var Ofr=b_&&b_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pfr=b_&&b_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Efr=b_&&b_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ofr(e,t,r);return Pfr(e,t),e};Object.defineProperty(b_,"__esModule",{value:!0});b_.ForbiddenError=void 0;var Tfr=Efr(As()),u_e=class t extends Tfr.CohereError{constructor(e){super({message:"ForbiddenError",statusCode:403,body:e}),Object.setPrototypeOf(this,t.prototype)}};b_.ForbiddenError=u_e});var YQe=v(__=>{"use strict";var Afr=__&&__.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ifr=__&&__.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mfr=__&&__.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Afr(e,t,r);return Ifr(e,t),e};Object.defineProperty(__,"__esModule",{value:!0});__.NotFoundError=void 0;var Rfr=Mfr(As()),l_e=class t extends Rfr.CohereError{constructor(e){super({message:"NotFoundError",statusCode:404,body:e}),Object.setPrototypeOf(this,t.prototype)}};__.NotFoundError=l_e});var ZQe=v(v_=>{"use strict";var jfr=v_&&v_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Nfr=v_&&v_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dfr=v_&&v_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jfr(e,t,r);return Nfr(e,t),e};Object.defineProperty(v_,"__esModule",{value:!0});v_.UnprocessableEntityError=void 0;var Lfr=Dfr(As()),c_e=class t extends Lfr.CohereError{constructor(e){super({message:"UnprocessableEntityError",statusCode:422,body:e}),Object.setPrototypeOf(this,t.prototype)}};v_.UnprocessableEntityError=c_e});var XQe=v(w_=>{"use strict";var Ffr=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]}),kfr=w_&&w_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$fr=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)&&Ffr(e,t,r);return kfr(e,t),e};Object.defineProperty(w_,"__esModule",{value:!0});w_.TooManyRequestsError=void 0;var Bfr=$fr(As()),d_e=class t extends Bfr.CohereError{constructor(e){super({message:"TooManyRequestsError",statusCode:429,body:e}),Object.setPrototypeOf(this,t.prototype)}};w_.TooManyRequestsError=d_e});var QQe=v(S_=>{"use strict";var qfr=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]}),Ufr=S_&&S_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zfr=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)&&qfr(e,t,r);return Ufr(e,t),e};Object.defineProperty(S_,"__esModule",{value:!0});S_.ClientClosedRequestError=void 0;var Hfr=zfr(As()),f_e=class t extends Hfr.CohereError{constructor(e){super({message:"ClientClosedRequestError",statusCode:499,body:e}),Object.setPrototypeOf(this,t.prototype)}};S_.ClientClosedRequestError=f_e});var eet=v(x_=>{"use strict";var Vfr=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]}),Wfr=x_&&x_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kfr=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)&&Vfr(e,t,r);return Wfr(e,t),e};Object.defineProperty(x_,"__esModule",{value:!0});x_.InternalServerError=void 0;var Gfr=Kfr(As()),p_e=class t extends Gfr.CohereError{constructor(e){super({message:"InternalServerError",statusCode:500,body:e}),Object.setPrototypeOf(this,t.prototype)}};x_.InternalServerError=p_e});var tet=v(C_=>{"use strict";var Jfr=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]}),Yfr=C_&&C_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zfr=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)&&Jfr(e,t,r);return Yfr(e,t),e};Object.defineProperty(C_,"__esModule",{value:!0});C_.NotImplementedError=void 0;var Xfr=Zfr(As()),m_e=class t extends Xfr.CohereError{constructor(e){super({message:"NotImplementedError",statusCode:501,body:e}),Object.setPrototypeOf(this,t.prototype)}};C_.NotImplementedError=m_e});var ret=v(O_=>{"use strict";var Qfr=O_&&O_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),epr=O_&&O_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tpr=O_&&O_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Qfr(e,t,r);return epr(e,t),e};Object.defineProperty(O_,"__esModule",{value:!0});O_.ServiceUnavailableError=void 0;var rpr=tpr(As()),h_e=class t extends rpr.CohereError{constructor(e){super({message:"ServiceUnavailableError",statusCode:503,body:e}),Object.setPrototypeOf(this,t.prototype)}};O_.ServiceUnavailableError=h_e});var net=v(P_=>{"use strict";var npr=P_&&P_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),opr=P_&&P_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ipr=P_&&P_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&npr(e,t,r);return opr(e,t),e};Object.defineProperty(P_,"__esModule",{value:!0});P_.GatewayTimeoutError=void 0;var apr=ipr(As()),g_e=class t extends apr.CohereError{constructor(e){super({message:"GatewayTimeoutError",statusCode:504,body:e}),Object.setPrototypeOf(this,t.prototype)}};P_.GatewayTimeoutError=g_e});var oet=v(Fc=>{"use strict";var spr=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]}),Ry=Fc&&Fc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&spr(e,t,r)};Object.defineProperty(Fc,"__esModule",{value:!0});Ry(KQe(),Fc);Ry(GQe(),Fc);Ry(JQe(),Fc);Ry(YQe(),Fc);Ry(ZQe(),Fc);Ry(XQe(),Fc);Ry(QQe(),Fc);Ry(eet(),Fc);Ry(tet(),Fc);Ry(ret(),Fc);Ry(net(),Fc)});var aet=v(iet=>{"use strict";Object.defineProperty(iet,"__esModule",{value:!0})});var set=v(O1=>{"use strict";var upr=O1&&O1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lpr=O1&&O1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&upr(e,t,r)};Object.defineProperty(O1,"__esModule",{value:!0});lpr(aet(),O1)});var aO=v(E_=>{"use strict";var cpr=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]}),OY=E_&&E_.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cpr(e,t,r)};Object.defineProperty(E_,"__esModule",{value:!0});OY(L7e(),E_);OY(HQe(),E_);OY(oet(),E_);OY(set(),E_)});var __e={};Cf(__e,{__addDisposableResource:()=>Iet,__assign:()=>PY,__asyncDelegator:()=>wet,__asyncGenerator:()=>vet,__asyncValues:()=>xet,__await:()=>uk,__awaiter:()=>met,__classPrivateFieldGet:()=>Eet,__classPrivateFieldIn:()=>Aet,__classPrivateFieldSet:()=>Tet,__createBinding:()=>TY,__decorate:()=>det,__disposeResources:()=>Met,__esDecorate:()=>dpr,__exportStar:()=>get,__extends:()=>uet,__generator:()=>het,__importDefault:()=>Pet,__importStar:()=>Oet,__makeTemplateObject:()=>Cet,__metadata:()=>pet,__param:()=>fet,__propKey:()=>ppr,__read:()=>b_e,__rest:()=>cet,__runInitializers:()=>fpr,__setFunctionName:()=>mpr,__spread:()=>yet,__spreadArray:()=>_et,__spreadArrays:()=>bet,__values:()=>EY,default:()=>ypr});function uet(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");y_e(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function cet(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=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 fet(t,e){return function(r,n){e(r,n,t)}}function dpr(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var b=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(d=a(b.get))&&(c.get=d),(d=a(b.set))&&(c.set=d),(d=a(b.init))&&o.unshift(d)}else(d=a(b))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function fpr(t,e,r){for(var n=arguments.length>2,o=0;o0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]=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 b_e(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 yet(){for(var t=[],e=0;e1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof uk?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function wet(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:uk(t[o](a)),done:!1}:i?i(a):a}:i}}function xet(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 EY=="function"?EY(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 Cet(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Oet(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TY(e,t,r);return hpr(e,t),e}function Pet(t){return t&&t.__esModule?t:{default:t}}function Eet(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 Tet(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 Aet(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 Iet(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 Met(t){function e(i){t.error=t.hasError?new gpr(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 y_e,PY,TY,hpr,gpr,ypr,v_e=w(()=>{y_e=function(t,e){return y_e=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])},y_e(t,e)};PY=function(){return PY=Object.assign||function(e){for(var r,n=1,o=arguments.length;n{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.MAX_HASHABLE_LENGTH=Wh.INIT=Wh.KEY=Wh.DIGEST_LENGTH=Wh.BLOCK_SIZE=void 0;Wh.BLOCK_SIZE=64;Wh.DIGEST_LENGTH=32;Wh.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]);Wh.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];Wh.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var Ret=v(AY=>{"use strict";Object.defineProperty(AY,"__esModule",{value:!0});AY.RawSha256=void 0;var Kh=w_e(),bpr=function(){function t(){this.state=Int32Array.from(Kh.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>Kh.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===Kh.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%Kh.BLOCK_SIZE>=Kh.BLOCK_SIZE-8){for(var o=this.bufferLength;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>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var h=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(m+this.temp[f-7]|0)+(h+this.temp[f-16]|0)}var b=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(Kh.KEY[f]+this.temp[f]|0)|0)|0,g=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&i^o&a^i&a)|0;d=c,c=l,l=u,u=s+b|0,s=a,a=i,i=o,o=b+g|0}n[0]+=o,n[1]+=i,n[2]+=a,n[3]+=s,n[4]+=u,n[5]+=l,n[6]+=c,n[7]+=d},t}();AY.RawSha256=bpr});var Det=v((UWn,Net)=>{var IY=Object.defineProperty,_pr=Object.getOwnPropertyDescriptor,vpr=Object.getOwnPropertyNames,wpr=Object.prototype.hasOwnProperty,Spr=(t,e)=>IY(t,"name",{value:e,configurable:!0}),xpr=(t,e)=>{for(var r in e)IY(t,r,{get:e[r],enumerable:!0})},Cpr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of vpr(e))!wpr.call(t,o)&&o!==r&&IY(t,o,{get:()=>e[o],enumerable:!(n=_pr(e,o))||n.enumerable});return t},Opr=t=>Cpr(IY({},"__esModule",{value:!0}),t),jet={};xpr(jet,{isArrayBuffer:()=>Ppr});Net.exports=Opr(jet);var Ppr=Spr(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var $et=v((zWn,ket)=>{var MY=Object.defineProperty,Epr=Object.getOwnPropertyDescriptor,Tpr=Object.getOwnPropertyNames,Apr=Object.prototype.hasOwnProperty,Let=(t,e)=>MY(t,"name",{value:e,configurable:!0}),Ipr=(t,e)=>{for(var r in e)MY(t,r,{get:e[r],enumerable:!0})},Mpr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Tpr(e))!Apr.call(t,o)&&o!==r&&MY(t,o,{get:()=>e[o],enumerable:!(n=Epr(e,o))||n.enumerable});return t},Rpr=t=>Mpr(MY({},"__esModule",{value:!0}),t),Fet={};Ipr(Fet,{fromArrayBuffer:()=>Npr,fromString:()=>Dpr});ket.exports=Rpr(Fet);var jpr=Det(),S_e=Pp(),Npr=Let((t,e=0,r=t.byteLength-e)=>{if(!(0,jpr.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return S_e.Buffer.from(t,e,r)},"fromArrayBuffer"),Dpr=Let((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?S_e.Buffer.from(t,e):S_e.Buffer.from(t)},"fromString")});var Het=v((HWn,zet)=>{var RY=Object.defineProperty,Lpr=Object.getOwnPropertyDescriptor,Fpr=Object.getOwnPropertyNames,kpr=Object.prototype.hasOwnProperty,x_e=(t,e)=>RY(t,"name",{value:e,configurable:!0}),$pr=(t,e)=>{for(var r in e)RY(t,r,{get:e[r],enumerable:!0})},Bpr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Fpr(e))!kpr.call(t,o)&&o!==r&&RY(t,o,{get:()=>e[o],enumerable:!(n=Lpr(e,o))||n.enumerable});return t},qpr=t=>Bpr(RY({},"__esModule",{value:!0}),t),Bet={};$pr(Bet,{fromUtf8:()=>Uet,toUint8Array:()=>Upr,toUtf8:()=>zpr});zet.exports=qpr(Bet);var qet=$et(),Uet=x_e(t=>{let e=(0,qet.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),Upr=x_e(t=>typeof t=="string"?Uet(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),zpr=x_e(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,qet.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var Vet=v(jY=>{"use strict";Object.defineProperty(jY,"__esModule",{value:!0});jY.convertToBuffer=void 0;var Hpr=Het(),Vpr=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:Hpr.fromUtf8;function Wpr(t){return t instanceof Uint8Array?t:typeof t=="string"?Vpr(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}jY.convertToBuffer=Wpr});var Wet=v(NY=>{"use strict";Object.defineProperty(NY,"__esModule",{value:!0});NY.isEmptyData=void 0;function Kpr(t){return typeof t=="string"?t.length===0:t.byteLength===0}NY.isEmptyData=Kpr});var Ket=v(DY=>{"use strict";Object.defineProperty(DY,"__esModule",{value:!0});DY.numToUint8=void 0;function Gpr(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}DY.numToUint8=Gpr});var Get=v(LY=>{"use strict";Object.defineProperty(LY,"__esModule",{value:!0});LY.uint32ArrayFrom=void 0;function Jpr(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),r=0;r{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});T_.uint32ArrayFrom=T_.numToUint8=T_.isEmptyData=T_.convertToBuffer=void 0;var Ypr=Vet();Object.defineProperty(T_,"convertToBuffer",{enumerable:!0,get:function(){return Ypr.convertToBuffer}});var Zpr=Wet();Object.defineProperty(T_,"isEmptyData",{enumerable:!0,get:function(){return Zpr.isEmptyData}});var Xpr=Ket();Object.defineProperty(T_,"numToUint8",{enumerable:!0,get:function(){return Xpr.numToUint8}});var Qpr=Get();Object.defineProperty(T_,"uint32ArrayFrom",{enumerable:!0,get:function(){return Qpr.uint32ArrayFrom}})});var Yet=v(BY=>{"use strict";Object.defineProperty(BY,"__esModule",{value:!0});BY.Sha256=void 0;var Jet=(v_e(),zl(__e)),$Y=w_e(),kY=Ret(),C_e=FY(),emr=function(){function t(e){this.secret=e,this.hash=new kY.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,C_e.isEmptyData)(e)||this.error))try{this.hash.update((0,C_e.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 Jet.__awaiter(this,void 0,void 0,function(){return Jet.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new kY.RawSha256,this.secret){this.outer=new kY.RawSha256;var e=tmr(this.secret),r=new Uint8Array($Y.BLOCK_SIZE);r.set(e);for(var n=0;n<$Y.BLOCK_SIZE;n++)e[n]^=54,r[n]^=92;this.hash.update(e),this.outer.update(r);for(var n=0;n$Y.BLOCK_SIZE){var r=new kY.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array($Y.BLOCK_SIZE);return n.set(e),n}});var P_e=v(O_e=>{"use strict";Object.defineProperty(O_e,"__esModule",{value:!0});var rmr=(v_e(),zl(__e));rmr.__exportStar(Yet(),O_e)});var Zet=w(()=>{});var Xet=w(()=>{});var Qet=w(()=>{});var P1,N3=w(()=>{P1=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 Tl,ett=w(()=>{N3();Tl=class t extends P1{constructor(e,r=!0){super(e,r),this.name="CredentialsProviderError",Object.setPrototypeOf(this,t.prototype)}}});var ttt=w(()=>{N3()});var rtt=w(()=>{N3()});var ntt=w(()=>{});var ott,itt=w(()=>{ott=(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 sO=w(()=>{ett();N3();ttt();rtt();ntt();itt()});function qY(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 E_e=w(()=>{});var att=w(()=>{});var stt=w(()=>{att()});var utt=w(()=>{});var ltt,ctt=w(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(ltt||(ltt={}))});var T_e,dtt=w(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(T_e||(T_e={}))});var ftt=w(()=>{});var ptt=w(()=>{});var mtt=w(()=>{});var htt=w(()=>{});var gtt=w(()=>{ctt();dtt();ftt();ptt();mtt();htt()});var ytt=w(()=>{});var btt=w(()=>{});var _tt=w(()=>{});var vtt=w(()=>{});var wtt=w(()=>{});var Stt=w(()=>{});var xtt=w(()=>{});var Ctt=w(()=>{wtt();Stt();xtt()});var Ott=w(()=>{});var Ptt=w(()=>{});var lk,Ett=w(()=>{(function(t){t.HTTP="http",t.HTTPS="https"})(lk||(lk={}))});var Ttt=w(()=>{});var Att=w(()=>{});var Itt=w(()=>{});var Mtt=w(()=>{});var Rtt=w(()=>{});var jtt=w(()=>{Ttt();Att();Itt();Mtt();Rtt()});var Ntt=w(()=>{});var ck,A_e=w(()=>{(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(ck||(ck={}))});var Dtt=w(()=>{A_e()});var Ltt=w(()=>{});var Ftt=w(()=>{Dtt();Ltt();A_e()});var Nm,ktt=w(()=>{(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(Nm||(Nm={}))});var $tt=w(()=>{});var Btt=w(()=>{});var qtt=w(()=>{});var Utt=w(()=>{});var ztt=w(()=>{});var Htt=w(()=>{Btt();qtt();Utt();ztt()});var Vtt=w(()=>{});var dk,Wtt=w(()=>{dk="__smithy_context"});var Ktt=w(()=>{});var Gtt,Jtt=w(()=>{(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(Gtt||(Gtt={}))});var Ytt=w(()=>{});var Ztt=w(()=>{});var Xtt=w(()=>{});var Qtt=w(()=>{});var ert=w(()=>{});var trt=w(()=>{});var rrt=w(()=>{});var nrt=w(()=>{});var ort=w(()=>{});var irt,art=w(()=>{(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(irt||(irt={}))});var srt=w(()=>{});var urt=w(()=>{});var lrt=w(()=>{});var crt=w(()=>{});var drt=w(()=>{});var frt=w(()=>{});var Hs=w(()=>{utt();gtt();ytt();btt();_tt();vtt();Ctt();Ott();Ptt();Ett();jtt();Ntt();Ftt();ktt();$tt();Htt();Vtt();Wtt();Ktt();Jtt();Ytt();Ztt();Xtt();Qtt();ert();trt();rrt();nrt();ort();art();srt();urt();lrt();crt();drt();frt()});var prt=w(()=>{Hs()});var mrt=w(()=>{});var hrt=w(()=>{});function nmr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var UY,grt=w(()=>{UY=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=nmr(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 yrt=w(()=>{});var brt=w(()=>{});var _rt=w(()=>{});var vrt=w(()=>{stt();prt();mrt();hrt();grt();yrt();brt();_rt()});var omr,imr,zY,I_e=w(()=>{vrt();omr=t=>e=>async r=>{if(!UY.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)},imr={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},zY=t=>({applyToStack:e=>{e.add(omr(t),imr)}})});var amr,smr,HY,wrt=w(()=>{amr=()=>(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}},smr={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},HY=t=>({applyToStack:e=>{e.add(amr(),smr)}})});var M_e=w(()=>{wrt()});var Srt=w(()=>{});var xrt=w(()=>{Srt()});var Crt=w(()=>{Hs()});var Ort=w(()=>{});var Prt=w(()=>{});function umr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var VY,Ert=w(()=>{VY=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=umr(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 Trt=w(()=>{});var Art=w(()=>{});var Irt=w(()=>{});var Mrt=w(()=>{xrt();Crt();Ort();Prt();Ert();Trt();Art();Irt()});var Rrt,lmr,cmr,dmr,fmr,WY,R_e=w(()=>{Mrt();Rrt="X-Amzn-Trace-Id",lmr="AWS_LAMBDA_FUNCTION_NAME",cmr="_X_AMZN_TRACE_ID",dmr=t=>e=>async r=>{let{request:n}=r;if(!VY.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(Rrt))return e(r);let o=process.env[lmr],i=process.env[cmr],a=s=>typeof s=="string"&&s.length>0;return a(o)&&a(i)&&(n.headers[Rrt]=i),e({...r,request:n})},fmr={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},WY=t=>({applyToStack:e=>{e.add(dmr(t),fmr)}})});function KY(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}var jrt=w(()=>{});var pmr,D3,j_e=w(()=>{pmr=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}$"),D3=t=>pmr.test(t)||t.startsWith("[")&&t.endsWith("]")});var mmr,L3,N_e=w(()=>{mmr=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),L3=(t,e=!1)=>{if(!e)return mmr.test(t);let r=t.split(".");for(let n of r)if(!L3(n))return!1;return!0}});var uO,GY=w(()=>{uO={}});var lO,Nrt=w(()=>{lO="endpoints"});function Gh(t){return typeof t!="object"||t==null?t:"ref"in t?`$${Gh(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(Gh).join(", ")})`:JSON.stringify(t,null,2)}var Drt=w(()=>{});var F3=w(()=>{Nrt();Drt()});var Wi,Lrt=w(()=>{Wi=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var Frt=w(()=>{});var krt=w(()=>{});var $rt=w(()=>{});var Brt=w(()=>{});var qrt=w(()=>{});var Urt=w(()=>{});var Jh=w(()=>{Lrt();Frt();krt();$rt();Brt();qrt();Urt()});var zrt,Hrt=w(()=>{zrt=(t,e)=>t===e});var Vrt,Wrt=w(()=>{Jh();Vrt=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 Wi(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new Wi(`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 JY,Krt=w(()=>{Jh();Wrt();JY=(t,e)=>Vrt(e).reduce((r,n)=>{if(typeof r!="object")throw new Wi(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var Grt,Jrt=w(()=>{Grt=t=>t!=null});var Yrt,Zrt=w(()=>{Yrt=t=>!t});var D_e,Xrt,Qrt=w(()=>{Hs();j_e();D_e={[lk.HTTP]:80,[lk.HTTPS]:443},Xrt=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:f,port:p,protocol:m="",path:h="",query:b={}}=t,g=new URL(`${m}//${f}${p?`:${p}`:""}${h}`);return g.search=Object.entries(b).map(([y,S])=>`${y}=${S}`).join("&"),g}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;let r=e.href,{host:n,hostname:o,pathname:i,protocol:a,search:s}=e;if(s)return null;let u=a.slice(0,-1);if(!Object.values(lk).includes(u))return null;let l=D3(o),c=r.includes(`${n}:${D_e[u]}`)||typeof t=="string"&&t.includes(`${n}:${D_e[u]}`),d=`${n}${c?`:${D_e[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var ent,tnt=w(()=>{ent=(t,e)=>t===e});var rnt,nnt=w(()=>{rnt=(t,e,r,n)=>e>=r||t.length{ont=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var L_e=w(()=>{Hrt();Krt();Jrt();N_e();Zrt();Qrt();tnt();nnt();int()});var ant,snt=w(()=>{L_e();ant={booleanEquals:zrt,getAttr:JY,isSet:Grt,isValidHostLabel:L3,not:Yrt,parseURL:Xrt,stringEquals:ent,substring:rnt,uriEncode:ont}});var YY,F_e=w(()=>{L_e();YY=(t,e)=>{let r=[],n={...e.endpointParams,...e.referenceRecord},o=0;for(;o{unt=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var PT,k3=w(()=>{Jh();k_e();F_e();lnt();PT=(t,e,r)=>{if(typeof t=="string")return YY(t,r);if(t.fn)return ZY(t,r);if(t.ref)return unt(t,r);throw new Wi(`'${e}': ${String(t)} is not a string, function or reference.`)}});var ZY,k_e=w(()=>{GY();snt();k3();ZY=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:PT(i,"arg",r)),o=t.split(".");return o[0]in uO&&o[1]!=null?uO[o[0]][o[1]](...n):ant[t](...n)}});var cnt,dnt=w(()=>{F3();Jh();k_e();cnt=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new Wi(`'${t}' is already defined in Reference Record.`);let n=ZY(e,r);return r.logger?.debug?.(`${lO} evaluateCondition: ${Gh(e)} = ${Gh(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var fk,XY=w(()=>{F3();dnt();fk=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=cnt(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${lO} assign: ${i.name} := ${Gh(i.value)}`))}return{result:!0,referenceRecord:r}}});var fnt,pnt=w(()=>{Jh();k3();fnt=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=PT(i,"Header value entry",e);if(typeof a!="string")throw new Wi(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var $_e,mnt=w(()=>{Jh();F_e();B_e();$_e=(t,e)=>{if(Array.isArray(t))return t.map(r=>$_e(r,e));switch(typeof t){case"string":return YY(t,e);case"object":if(t===null)throw new Wi(`Unexpected endpoint property: ${t}`);return QY(t,e);case"boolean":return t;default:throw new Wi(`Unexpected endpoint property type: ${typeof t}`)}}});var QY,B_e=w(()=>{mnt();QY=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:$_e(o,e)}),{})});var hnt,gnt=w(()=>{Jh();k3();hnt=(t,e)=>{let r=PT(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 Wi(`Endpoint URL must be a string, got ${typeof r}`)}});var ynt,bnt=w(()=>{F3();XY();pnt();B_e();gnt();ynt=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=fk(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${lO} Resolving endpoint from template: ${Gh(n)}`),{...l!=null&&{headers:fnt(l,a)},...u!=null&&{properties:QY(u,a)},url:hnt(s,a)}}});var _nt,vnt=w(()=>{Jh();XY();k3();_nt=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=fk(r,e);if(o)throw new Wi(PT(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var wnt,Snt=w(()=>{XY();q_e();wnt=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=fk(r,e);if(o)return eZ(n,{...e,referenceRecord:{...e.referenceRecord,...i}})}});var eZ,q_e=w(()=>{Jh();bnt();vnt();Snt();eZ=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=ynt(r,e);if(n)return n}else if(r.type==="error")_nt(r,e);else if(r.type==="tree"){let n=wnt(r,e);if(n)return n}else throw new Wi(`Unknown endpoint rule: ${r}`);throw new Wi("Rules evaluation failed")}});var xnt=w(()=>{GY();q_e()});var $3,Cnt=w(()=>{F3();Jh();xnt();$3=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${lO} Initial EndpointParams: ${Gh(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 Wi(`Missing required parameter: '${l}'`);let u=eZ(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?.(`${lO} Resolved endpoint: ${Gh(u)}`),u}});var ET=w(()=>{j_e();N_e();GY();Cnt();Jh()});var U_e=w(()=>{ET()});var z_e,Ont=w(()=>{ET();U_e();z_e=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!z_e(r))return!1;return!0}return!(!L3(t)||t.length<3||t.length>63||t!==t.toLowerCase()||D3(t))}});var Pnt,hmr,Ent,Tnt=w(()=>{Pnt=":",hmr="/",Ent=t=>{let e=t.split(Pnt);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(Pnt)==="")return null;let u=s.map(l=>l.split(hmr)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var Int,Ant=w(()=>{Int={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 ymr,bmr,Mnt,Rnt,H_e=w(()=>{Ant();ymr=Int,bmr="",Mnt=t=>{let{partitions:e}=ymr;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}},Rnt=()=>bmr});var B3,jnt=w(()=>{ET();Ont();Tnt();H_e();B3={isVirtualHostableS3Bucket:z_e,parseArn:Ent,partition:Mnt};uO.aws=B3});var Nnt=w(()=>{ET()});var Dnt=w(()=>{ET()});var Lnt=w(()=>{});var Fnt=w(()=>{});var knt=w(()=>{});var $nt=w(()=>{});var Bnt=w(()=>{});var qnt=w(()=>{Dnt();Lnt();Fnt();knt();$nt();Bnt()});var tZ=w(()=>{jnt();H_e();U_e();Nnt();qnt()});var Unt=w(()=>{});var znt=w(()=>{Unt()});var Hnt=w(()=>{Hs()});var Vnt=w(()=>{});var Wnt=w(()=>{});function _mr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var rZ,Knt=w(()=>{rZ=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=_mr(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 Gnt=w(()=>{});var Jnt=w(()=>{});var Ynt=w(()=>{});var Znt=w(()=>{znt();Hnt();Vnt();Wnt();Knt();Gnt();Jnt();Ynt()});var V_e,nZ,W_e,oZ,Xnt,Qnt,K_e,eot=w(()=>{V_e="user-agent",nZ="x-amz-user-agent",W_e=" ",oZ="/",Xnt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,Qnt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,K_e="-"});var vmr,G_e,wmr,iZ,tot=w(()=>{tZ();Znt();eot();vmr=t=>(e,r)=>async n=>{let{request:o}=n;if(!rZ.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(G_e)||[],s=(await t.defaultUserAgentProvider()).map(G_e),u=t?.customUserAgent?.map(G_e)||[],l=Rnt(),c=(l?[l]:[]).concat([...s,...a,...u]).join(W_e),d=[...s.filter(f=>f.startsWith("aws-sdk-")),...u].join(W_e);return t.runtime!=="browser"?(d&&(i[nZ]=i[nZ]?`${i[V_e]} ${d}`:d),i[V_e]=c):i[nZ]=c,e({...n,request:o})},G_e=t=>{let e=t[0].split(oZ).map(a=>a.replace(Xnt,K_e)).join(oZ),r=t[1]?.replace(Qnt,K_e),n=e.indexOf(oZ),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}`}},"")},wmr={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},iZ=t=>({applyToStack:e=>{e.add(vmr(t),wmr)}})});var J_e=w(()=>{jrt();tot()});var rot=w(()=>{});var not=w(()=>{});var aZ,oot=w(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(aZ||(aZ={}))});var Y_e=w(()=>{rot();not();oot()});var sZ,iot=w(()=>{Y_e();sZ=!1});var uZ,aot=w(()=>{Y_e();uZ=!1});var A_,sot=w(()=>{Hs();A_=t=>t[dk]||(t[dk]={})});var zd,uot=w(()=>{zd=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var jy=w(()=>{sot();uot()});var lot=w(()=>{jy()});var cot=w(()=>{});var dot=w(()=>{jy();cot()});var fot=w(()=>{iot();aot();lot();dot()});var pot=w(()=>{});var lZ,Z_e=w(()=>{lZ=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var X_e,mot=w(()=>{Z_e();X_e=t=>lZ(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var cZ,hot=w(()=>{mot();Z_e();cZ=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return X_e(e);let n=await e();return X_e(n)},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return lZ(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}}});var got=w(()=>{pot();hot()});var yot=w(()=>{});var bot=w(()=>{});var _ot=w(()=>{});var vot=w(()=>{});var wot=w(()=>{});var Sot=w(()=>{});var xot=w(()=>{_ot();vot();wot();Sot()});var Cot=w(()=>{yot();bot();xot()});var q3=w(()=>{fot();got();Cot()});function xmr(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var Q_e,dZ=w(()=>{Hs();jy();Q_e=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=xmr(t.httpAuthSchemes),s=A_(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 Oot,Cmr,Omr,Pmr,Emr,Tmr,Pot=w(()=>{Oot=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Tmr(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Emr(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},Cmr=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,Omr=/(\d+\.){3}\d+/,Pmr=/\.\./,Emr=t=>Cmr.test(t)&&!Omr.test(t)&&!Pmr.test(t),Tmr=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 Eot=w(()=>{Pot()});var Tot,Aot=w(()=>{Tot=(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 Iot,Mot=w(()=>{Iot=async t=>{}});function Rot(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 jot=w(()=>{});var TT,fZ=w(()=>{jot();TT=t=>{if(typeof t=="string")return TT(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=Rot(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var pZ,mZ=w(()=>{fZ();pZ=t=>typeof t=="object"?"url"in t?TT(t.url):t:TT(t)});var Not,Amr,eve=w(()=>{Eot();Aot();Mot();mZ();Not=async(t,e,r,n)=>{if(!r.endpoint){let a=await Iot(r.serviceId||"");a&&(r.endpoint=()=>Promise.resolve(pZ(a)))}let o=await Amr(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},Amr=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 Tot(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 Oot(n),n}});var Dot=w(()=>{eve();mZ()});var Lot,tve=w(()=>{jy();eve();Lot=({config:t,instructions:e})=>(r,n)=>async o=>{let i=await Not(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=A_(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 Fot,rve=w(()=>{Fot=(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 kot,nve=w(()=>{kot=(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 Nt(t,e,r){return{applyToStack:n=>{n.add(Fot(t,r),Imr),n.add(kot(t,e),U3)}}}var Imr,U3,$ot=w(()=>{rve();nve();Imr={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},U3={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var to=w(()=>{rve();$ot();nve()});var ove,Dt,Bot=w(()=>{to();tve();ove={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:U3.name},Dt=(t,e)=>({applyToStack:r=>{r.addRelativeTo(Lot({config:t,instructions:e}),ove)}})});var hZ,qot=w(()=>{jy();mZ();hZ=t=>{let e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>pZ(await zd(r)()):void 0;return{...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:zd(t.useDualstackEndpoint??!1),useFipsEndpoint:zd(t.useFipsEndpoint??!1)}}});var Uot=w(()=>{});var zn=w(()=>{Dot();tve();Bot();qot();Uot()});var Mmr,gZ,zot=w(()=>{zn();dZ();Mmr={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:ove.name},gZ=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(Q_e(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),Mmr)}})});var PXn,Hot=w(()=>{to();dZ();PXn={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:U3.name}});var Vot=w(()=>{dZ();zot();Hot()});var Wot=w(()=>{});var Kot=w(()=>{Wot()});var Got=w(()=>{Hs()});var Jot=w(()=>{});var Yot=w(()=>{});function Rmr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var E1,Zot=w(()=>{E1=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=Rmr(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 Xot=w(()=>{});var Qot=w(()=>{});var eit=w(()=>{});var z3=w(()=>{Kot();Got();Jot();Yot();Zot();Xot();Qot();eit()});var jmr,Nmr,tit,ive=w(()=>{z3();Hs();jy();jmr=t=>e=>{throw e},Nmr=(t,e)=>{},tit=t=>(e,r)=>async n=>{if(!E1.isInstance(n.request))return e(n);let i=A_(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||jmr)(a));return(u.successHandler||Nmr)(l.response,a),l}});var Ny,I_,H3,yZ=w(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(Ny||(Ny={}));I_=3,H3=Ny.STANDARD});var rit,nit,oit,iit,ait=w(()=>{rit=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],nit=["TimeoutError","RequestTimeout","RequestTimeoutException"],oit=[500,502,503,504],iit=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"]});var Dmr,pk,bZ,sit,V3=w(()=>{ait();Dmr=t=>t.$metadata?.clockSkewCorrected,pk=t=>t.$metadata?.httpStatusCode===429||rit.includes(t.name)||t.$retryable?.throttling==!0,bZ=t=>Dmr(t)||nit.includes(t.name)||iit.includes(t?.code||"")||oit.includes(t.$metadata?.httpStatusCode||0),sit=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!bZ(t)}return!1}});var W3,ave=w(()=>{V3();W3=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(),pk(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 _Z,vZ,mk=w(()=>{_Z="amz-sdk-invocation-id",vZ="amz-sdk-request"});var uit,lit=w(()=>{mk();uit=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var sve,cit=w(()=>{mk();sve=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var T1,SZ=w(()=>{yZ();mk();lit();cit();T1=class{constructor(e){this.maxAttempts=e,this.mode=Ny.STANDARD,this.capacity=500,this.retryBackoffStrategy=uit(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return sve({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,sve({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 ${I_}`),I_}}shouldRetry(e,r,n){return e.getRetryCount()+1=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(e){return e==="TRANSIENT"?10:5}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}});var xZ,hit=w(()=>{yZ();ave();SZ();xZ=class{constructor(e,r){this.maxAttemptsProvider=e,this.mode=Ny.ADAPTIVE;let{rateLimiter:n}=r??{};this.rateLimiter=n??new W3,this.standardRetryStrategy=new T1(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 git=w(()=>{mk();SZ()});var yit=w(()=>{});var M_=w(()=>{hit();git();ave();SZ();yZ();mk();yit()});var bit=w(()=>{});var _it=w(()=>{bit()});var vit=w(()=>{Hs()});var wit=w(()=>{});var Sit=w(()=>{});function Lmr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var gk,xit=w(()=>{gk=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Lmr(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 K3,Cit=w(()=>{K3=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 Oit=w(()=>{});var Pit=w(()=>{});var CZ=w(()=>{_it();vit();wit();Sit();xit();Cit();Oit();Pit()});var Eit=w(()=>{M_()});var lve=w(()=>{M_()});var cve=w(()=>{V3()});var dve,fve=w(()=>{dve=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 pve=w(()=>{CZ();V3();M_();Eit();lve();cve();fve()});var Tit=w(()=>{M_();pve()});var OZ,Ait=w(()=>{jy();M_();OZ=t=>{let{retryStrategy:e}=t,r=zd(t.maxAttempts??I_);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await zd(t.retryMode)()===Ny.ADAPTIVE?new xZ(r):new T1(r))}}});var Iit=w(()=>{CZ();M_()});var AT,Mit=w(()=>{AT=class{trace(){}debug(){}info(){}warn(){}error(){}}});var A1,IT,yk,Rit,jit,Nit=w(()=>{A1=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},IT=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,yk=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>Rit[p.step]-Rit[f.step]||jit[p.priority||"normal"]-jit[f.priority||"normal"]),i=d=>{let f=!1,p=m=>{let h=A1(m.name,m.aliases);if(h.includes(d)){f=!0;for(let b of h)n.delete(b);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},a=d=>{let f=!1,p=m=>{if(m.middleware===d){f=!0;for(let h of A1(m.name,m.aliases))n.delete(h);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},s=d=>(t.forEach(f=>{d.add(f.middleware,{...f})}),e.forEach(f=>{d.addRelativeTo(f.middleware,{...f})}),d.identifyOnResolve?.(c.identifyOnResolve()),d),u=d=>{let f=[];return d.before.forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f.push(d),d.after.reverse().forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f},l=(d=!1)=>{let f=[],p=[],m={};return t.forEach(b=>{let g={...b,before:[],after:[]};for(let y of A1(g.name,g.aliases))m[y]=g;f.push(g)}),e.forEach(b=>{let g={...b,before:[],after:[]};for(let y of A1(g.name,g.aliases))m[y]=g;p.push(g)}),p.forEach(b=>{if(b.toMiddleware){let g=m[b.toMiddleware];if(g===void 0){if(d)return;throw new Error(`${b.toMiddleware} is not found when adding ${IT(b.name,b.aliases)} middleware ${b.relation} ${b.toMiddleware}`)}b.relation==="after"&&g.after.push(b),b.relation==="before"&&g.before.push(b)}}),o(f).map(u).reduce((b,g)=>(b.push(...g),b),[])},c={add:(d,f={})=>{let{name:p,override:m,aliases:h}=f,b={step:"initialize",priority:"normal",middleware:d,...f},g=A1(p,h);if(g.length>0){if(g.some(y=>n.has(y))){if(!m)throw new Error(`Duplicate middleware name '${IT(p,h)}'`);for(let y of g){let S=t.findIndex(O=>O.name===y||O.aliases?.some(P=>P===y));if(S===-1)continue;let x=t[S];if(x.step!==b.step||b.priority!==x.priority)throw new Error(`"${IT(x.name,x.aliases)}" middleware with ${x.priority} priority in ${x.step} step cannot be overridden by "${IT(p,h)}" middleware with ${b.priority} priority in ${b.step} step.`);t.splice(S,1)}}for(let y of g)n.add(y)}t.push(b)},addRelativeTo:(d,f)=>{let{name:p,override:m,aliases:h}=f,b={middleware:d,...f},g=A1(p,h);if(g.length>0){if(g.some(y=>n.has(y))){if(!m)throw new Error(`Duplicate middleware name '${IT(p,h)}'`);for(let y of g){let S=e.findIndex(O=>O.name===y||O.aliases?.some(P=>P===y));if(S===-1)continue;let x=e[S];if(x.toMiddleware!==b.toMiddleware||x.relation!==b.relation)throw new Error(`"${IT(x.name,x.aliases)}" middleware ${x.relation} "${x.toMiddleware}" middleware cannot be overridden by "${IT(p,h)}" middleware ${b.relation} "${b.toMiddleware}" middleware.`);e.splice(S,1)}}for(let y of g)n.add(y)}e.push(b)},clone:()=>s(yk()),use:d=>{d.applyToStack(c)},remove:d=>typeof d=="string"?i(d):a(d),removeByTag:d=>{let f=!1,p=m=>{let{tags:h,name:b,aliases:g}=m;if(h&&h.includes(d)){let y=A1(b,g);for(let S of y)n.delete(S);return f=!0,!1}return!0};return t=t.filter(p),e=e.filter(p),f},concat:d=>{let f=s(yk());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 IT(d.name,d.aliases)+" - "+f}),identifyOnResolve(d){return typeof d=="boolean"&&(r=d),r},resolve:(d,f)=>{for(let p of l().map(m=>m.middleware).reverse())d=p(d,f);return r&&console.log(c.identify()),d}};return c},Rit={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},jit={high:3,normal:2,low:1}});var mve=w(()=>{Nit()});var I1,Dit=w(()=>{mve();I1=class{constructor(e){this.middlewareStack=yk(),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 cO,M1,MT,R1,Lit,hve=w(()=>{cO={},M1=new Array(64);for(let t=0,e=65,r=90;t+e<=r;t++){let n=String.fromCharCode(t+e);cO[n]=t,M1[t]=n}for(let t=0,e=97,r=122;t+e<=r;t++){let n=String.fromCharCode(t+e),o=t+26;cO[n]=o,M1[o]=n}for(let t=0;t<10;t++){cO[t.toString(10)]=t+52;let e=t.toString(10),r=t+52;cO[e]=r,M1[r]=e}cO["+"]=62;M1[62]="+";cO["/"]=63;M1[63]="/";MT=6,R1=8,Lit=63});var RT,Fit=w(()=>{hve();RT=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>=MT;let s=o/4*3;i>>=a%R1;let u=Math.floor(a/R1);for(let l=0;l>c)}}return new Uint8Array(r)}});var gve,yve=w(()=>{gve=t=>new TextEncoder().encode(t)});var kit=w(()=>{yve()});var $it=w(()=>{});var Bit=w(()=>{yve();kit();$it()});function jT(t){let e;typeof t=="string"?e=gve(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>c]}o+="==".slice(0,4-u)}return o}var qit=w(()=>{Bit();hve()});var bk=w(()=>{Fit();qit()});var bve,_ve=w(()=>{bve=t=>new TextEncoder().encode(t)});var Uit=w(()=>{_ve()});var PZ,zit=w(()=>{PZ=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 vve=w(()=>{_ve();Uit();zit()});function Hit(t,e="utf-8"){return e==="base64"?jT(t):PZ(t)}function Vit(t,e){return e==="base64"?dO.mutate(RT(t)):dO.mutate(bve(t))}var Wit=w(()=>{bk();vve();wve()});var dO,wve=w(()=>{Wit();dO=class t extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return Vit(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 Hit(this,e)}}});var Kit=w(()=>{});var Git=w(()=>{});var Jit=w(()=>{Git()});var Yit=w(()=>{Hs()});var Zit=w(()=>{});var Xit=w(()=>{});var Qit=w(()=>{});var G3,eat=w(()=>{G3=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 tat=w(()=>{});var rat=w(()=>{});var nat=w(()=>{Jit();Yit();Zit();Xit();Qit();eat();tat();rat()});var Yh,Fmr,Sve=w(()=>{Yh=t=>encodeURIComponent(t).replace(/[!'()*]/g,Fmr),Fmr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var oat=w(()=>{Sve()});var EZ=w(()=>{Sve();oat()});function iat(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=Yh(r),Array.isArray(n))for(let o=0,i=n.length;o{EZ()});function sat(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 uat=w(()=>{});var xve,NT,lat=w(()=>{nat();aat();uat();xve={supported:void 0},NT=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)),xve.supported===void 0&&(xve.supported=typeof Request<"u"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:r}={}){this.config||(this.config=await this.configProvider);let n=this.config.requestTimeout,o=this.config.keepAlive===!0,i=this.config.credentials;if(r?.aborted){let g=new Error("Request aborted");return g.name="AbortError",Promise.reject(g)}let a=e.path,s=iat(e.query||{});s&&(a+=`?${s}`),e.fragment&&(a+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){let g=e.username??"",y=e.password??"";u=`${g}:${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),xve.supported&&(p.keepalive=o);let m=()=>{},h=new Request(d,p),b=[fetch(h).then(g=>{let y=g.headers,S={};for(let O of y.entries())S[O[0]]=O[1];return g.body!=null?{response:new G3({headers:S,reason:g.statusText,statusCode:g.status,body:g.body})}:g.blob().then(O=>({response:new G3({headers:S,reason:g.statusText,statusCode:g.status,body:O})}))}),sat(n)];return r&&b.push(new Promise((g,y)=>{let S=()=>{let x=new Error("Request aborted");x.name="AbortError",y(x)};if(typeof r.addEventListener=="function"){let x=r;x.addEventListener("abort",S,{once:!0}),m=()=>x.removeEventListener("abort",S)}else r.onabort=S})),Promise.race(b).finally(m)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function kmr(t){let e=await Bmr(t),r=RT(e);return new Uint8Array(r)}async function $mr(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 Bmr(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 _k,cat=w(()=>{bk();_k=t=>typeof Blob=="function"&&t instanceof Blob?kmr(t):$mr(t)});var J3=w(()=>{lat();cat()});function fat(t){let e="";for(let r=0;r{dat={},qmr={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),dat[t]=e,qmr[e]=t}});var Cve,Ove=w(()=>{Cve=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var mat,gat,hat,yat=w(()=>{J3();bk();pat();vve();Ove();mat="The stream has already been transformed.",gat=t=>{if(!hat(t)&&!Cve(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(mat);return e=!0,await _k(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 jT(i);if(o==="hex")return fat(i);if(o===void 0||o==="utf8"||o==="utf-8")return PZ(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(mat);if(e=!0,hat(t))return n(t);if(Cve(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},hat=t=>typeof Blob=="function"&&t instanceof Blob});var bat=w(()=>{});var _at=w(()=>{});var Pve=w(()=>{wve();Kit();yat();bat();_at();Ove()});var DT,vat=w(()=>{Pve();DT=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return dO.mutate(t);if(!t)return dO.mutate(new Uint8Array);let r=e.streamCollector(t);return dO.mutate(await r)}});var Ot,Eve,wat=w(()=>{mve();Hs();Ot=class{constructor(){this.middlewareStack=yk()}static classBuilder(){return new Eve}resolveMiddlewareWithContext(e,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let b of o.bind(this)(d,e,r,n))this.middlewareStack.use(b);let f=e.concat(this.middlewareStack),{logger:p}=r,m={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[dk]:{commandInstance:this,...l},...c},{requestHandler:h}=r;return f.resolve(b=>h.handle(b.request,n||{}),m)}},Eve=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 Ot{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 TZ,Sat=w(()=>{TZ="***SensitiveInformation***"});var AZ,xat=w(()=>{AZ=(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 j1,Umr,Cat,zmr,Oat,Pat,Eat,Tve,Hmr,vk,ln,Tat,Aat,Vmr,Y3,Z3,Ave,Iat,Mat,Rat,Ive=w(()=>{j1=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&Rat.warn(Mat(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},Umr=Math.ceil(34028234663852886e22),Cat=t=>{let e=j1(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>Umr)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},zmr=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},Oat=t=>Tve(t,32),Pat=t=>Tve(t,16),Eat=t=>Tve(t,8),Tve=(t,e)=>{let r=zmr(t);if(r!==void 0&&Hmr(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},Hmr=(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]}},vk=(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},ln=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return Rat.warn(Mat(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},Tat=t=>j1(typeof t=="string"?Y3(t):t),Aat=t=>Cat(typeof t=="string"?Y3(t):t),Vmr=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Y3=t=>{let e=t.match(Vmr);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},Z3=t=>Oat(typeof t=="string"?Y3(t):t),Ave=t=>Pat(typeof t=="string"?Y3(t):t),Iat=t=>Eat(typeof t=="string"?Y3(t):t),Mat=t=>String(new TypeError(t).stack||t).split(` `).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(` -`),Tat={warn:console.warn}});var qmr,Umr,Aat,zmr,Iat,hro,gro,yro,AZ,Mat,bro,Hmr,Vmr,Wmr,j1,Kmr,Gmr,Tve,Rat=w(()=>{Eve();qmr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Umr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),Aat=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Umr.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=Pve(Tve(n)),d=j1(o,"month",1,12),f=j1(i,"day",1,31);return Mat(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},zmr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),Iat=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=zmr.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=Pve(Tve(n)),f=j1(o,"month",1,12),p=j1(i,"day",1,31),m=Mat(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&m.setTime(m.getTime()-Gmr(c)),m},hro=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$/),gro=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$/),yro=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})$/),AZ=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=Cat(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))},Mat=(t,e,r,n)=>{let o=e-1;return Vmr(t,o,r),new Date(Date.UTC(t,o,r,j1(n.hours,"hour",0,23),j1(n.minutes,"minute",0,59),j1(n.seconds,"seconds",0,60),Kmr(n.fractionalMilliseconds)))},bro=50*365*24*60*60*1e3,Hmr=[31,28,31,30,31,30,31,31,30,31,30,31],Vmr=(t,e,r)=>{let n=Hmr[e];if(e===1&&Wmr(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${qmr[e]} in ${t}: ${r}`)},Wmr=t=>t%4===0&&(t%100!==0||t%400===0),j1=(t,e,r,n)=>{let o=Pat(Tve(t));if(on)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},Kmr=t=>t==null?0:Oat("0."+t)*1e3,Gmr=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},Tve=t=>{let e=0;for(;e{vk=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}},qa=(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 Jmr,IZ,Ymr,jat=w(()=>{Ave();Jmr=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{let o=Ymr(t),i=o.httpStatusCode?o.httpStatusCode+"":void 0,a=new r({name:e?.code||e?.Code||n||i||"UnknownError",$fault:"client",$metadata:o});throw qa(a,e)},IZ=t=>({output:e,parsedBody:r,errorCode:n})=>{Jmr({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},Ymr=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 MZ,Nat=w(()=>{MZ=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 Dat=w(()=>{});var Lat,Fat,kat=w(()=>{Hs();Lat=t=>{let e=[];for(let r in lk){let n=lk[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}}},Fat=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var $at,Bat,qat=w(()=>{$at=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},Bat=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var RZ,jZ,Uat=w(()=>{kat();qat();RZ=t=>({...Lat(t),...$at(t)}),jZ=t=>({...Fat(t),...Bat(t)})});var zat=w(()=>{Uat()});function NZ(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var Ive=w(()=>{});var Hat=w(()=>{});var Mve,Vat=w(()=>{Mve=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]=Mve(t[r]));return t}});var Rve,Wat=w(()=>{Rve=function(){let t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};Rve.prototype=Object.create(String.prototype,{constructor:{value:Rve,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(Rve,String)});var Z3,Zmr,Xmr,Qmr,Kat=w(()=>{Z3=(t,e)=>{let r={};for(let n in e)Zmr(r,t,e,n);return r},Zmr=(t,e,r,n)=>{if(e!==null){let a=r[n];typeof a=="function"&&(a=[,a]);let[s=Xmr,u=Qmr,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)}},Xmr=t=>t!=null,Qmr=t=>t});var Gat=w(()=>{Ive()});var Jat=w(()=>{});var or,Yat=w(()=>{or=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(or);if(typeof t=="object"){let e={};for(let r of Object.keys(t))t[r]!=null&&(e[r]=or(t[r]));return e}return t}});var Zat=w(()=>{});var ar=w(()=>{Eit();Mit();gat();yat();bat();_at();Rat();jat();Nat();Dat();zat();Ave();Ive();Hat();Vat();Wat();Kat();Eve();Gat();Jat();Yat();Zat()});var Xat,Qat=w(()=>{Xat=t=>t?.body instanceof ReadableStream});var ehr,thr,rhr,nhr,jve,DZ,ohr,est=w(()=>{xZ();H3();ar();M_();l2();Qat();lve();ehr=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(thr(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=hk.isInstance(c);for(d&&(c.headers[bZ]=yC());;)try{d&&(c.headers[_Z]=`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=rhr(f);if(s=uve(f),d&&Xat(c))throw(r.logger instanceof AT?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),s;try{a=await o.refreshRetryTokenForRetry(a,p)}catch{throw s.$metadata||(s.$metadata={}),s.$metadata.attempts=u+1,s.$metadata.totalRetryDelay=l,s}u=a.getRetryCount();let m=a.getRetryDelay();l+=m,await new Promise(h=>setTimeout(h,m))}}else return o=o,o?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",o.mode]]),o.retry(e,n)},thr=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",rhr=t=>{let e={error:t,errorType:nhr(t)},r=ohr(t.$response);return r&&(e.retryAfterHint=r),e},nhr=t=>fk(t)?"THROTTLING":yZ(t)?"TRANSIENT":nit(t)?"SERVER_ERROR":"CLIENT_ERROR",jve={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},DZ=t=>({applyToStack:e=>{e.add(ehr(t),jve)}}),ohr=t=>{if(!W3.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 LZ=w(()=>{Cit();cve();Oit();ave();Pit();sve();est()});var ihr,FZ,tst=w(()=>{LZ();rve();ihr={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:jve.name},FZ=t=>({applyToStack:e=>{e.addRelativeTo(Zot(t),ihr)}})});var rst=w(()=>{rve();tst()});var wk,nst=w(()=>{wk=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 ost=w(()=>{U3();Hs()});var ist=w(()=>{U3()});var Sk,ast=w(()=>{Sk=class{async sign(e,r,n){return e}}});var sst=w(()=>{ost();ist();ast()});var ahr,ust,Nve,lst,cst=w(()=>{ahr=t=>e=>Nve(e)&&e.expiration.getTime()-Date.now()t.expiration!==void 0,lst=(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 dst=w(()=>{nst();sst();cst()});var fst=w(()=>{Hs()});var xk,pst=w(()=>{xk=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var mst=w(()=>{U3();ar()});function Dve(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 shr(e,a.client,s,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield d;let f=l;l=uhr(d,n),c=!!(l&&(!a.stopOnSameToken||l!==f))}return void 0}}var shr,uhr,hst=w(()=>{shr=async(t,e,r,...n)=>await e.send(new t(r),...n);uhr=(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 LT=w(()=>{qot();rst();dst();fst();pst();mst();hst()});var gst=w(()=>{});var yst=w(()=>{gst()});var bst=w(()=>{Hs()});var _st=w(()=>{});var vst=w(()=>{});function lhr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var kZ,wst=w(()=>{kZ=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=lhr(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 Sst=w(()=>{});var xst=w(()=>{});var Cst=w(()=>{});var Ost=w(()=>{yst();bst();_st();vst();wst();Sst();xst();Cst()});function chr(t){return e=>async r=>{let n=r.request;if(kZ.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(Pst)===-1)try{let a=t(o);n.headers={...n.headers,[Pst]:String(a)}}catch{}}return e({...r,request:n})}}var Pst,dhr,$Z,Lve=w(()=>{Ost();Pst="content-length";dhr={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},$Z=t=>({applyToStack:e=>{e.add(chr(t.bodyLengthChecker),dhr)}})});var Est=w(()=>{});var Tst=w(()=>{Est()});var Ast=w(()=>{});var Ist=w(()=>{Ast()});var Mst=w(()=>{Hs()});var Rst=w(()=>{});var jst=w(()=>{});function fhr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var FT,Nst=w(()=>{FT=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=fhr(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 BZ,Dst=w(()=>{BZ=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 Lst=w(()=>{});var Fst=w(()=>{});var X3=w(()=>{Ist();Mst();Rst();jst();Nst();Dst();Lst();Fst()});var Fve,kst=w(()=>{X3();Fve=t=>BZ.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var qZ,kve=w(()=>{qZ=t=>new Date(Date.now()+t)});var $st,Bst=w(()=>{kve();$st=(t,e)=>Math.abs(qZ(e).getTime()-t)>=3e5});var $ve,qst=w(()=>{Bst();$ve=(t,e)=>{let r=Date.parse(t);return $st(r,e)?r-Date.now():e}});var Ust=w(()=>{kst();kve();qst()});var Q3,zst,N1,Hst=w(()=>{X3();Ust();Q3=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},zst=async t=>{let e=Q3("context",t.context),r=Q3("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await Q3("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},N1=class{async sign(e,r,n){if(!FT.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await zst(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:qZ(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??Fve(r.$response);if(n){let o=Q3("config",e.config),i=o.systemClockOffset;o.systemClockOffset=$ve(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=Fve(e);if(n){let o=Q3("config",r.config);o.systemClockOffset=$ve(n,o.systemClockOffset)}}}});var Vst=w(()=>{LT();aO()});function Kst(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{Wst={},Bve={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Wst[t]=e,Bve[e]=t}});var tH,qve=w(()=>{tH=t=>new TextEncoder().encode(t)});var kT,Gst=w(()=>{qve();kT=t=>typeof t=="string"?tH(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var Jst=w(()=>{});var rH=w(()=>{qve();Gst();Jst()});var Yst,Zst,Uve,Xst,Qst,zve,Hve,Vve,Wve,phr,eut,tut,nH,rut,nut,out,iut,UZ,aut,sut,uut,Kve,lut,D1=w(()=>{Yst="X-Amz-Algorithm",Zst="X-Amz-Credential",Uve="X-Amz-Date",Xst="X-Amz-SignedHeaders",Qst="X-Amz-Expires",zve="X-Amz-Signature",Hve="X-Amz-Security-Token",Vve="authorization",Wve=Uve.toLowerCase(),phr="date",eut=[Vve,Wve,phr],tut=zve.toLowerCase(),nH="x-amz-content-sha256",rut=Hve.toLowerCase(),nut={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},out=/^proxy-/,iut=/^sec-/,UZ="AWS4-HMAC-SHA256",aut="AWS4-HMAC-SHA256-PAYLOAD",sut="UNSIGNED-PAYLOAD",uut=50,Kve="aws4_request",lut=60*60*24*7});var zZ,Gve,HZ,dut,cut,Jve=w(()=>{eH();rH();D1();zZ={},Gve=[],HZ=(t,e,r)=>`${t}/${e}/${r}/${Kve}`,dut=async(t,e,r,n,o)=>{let i=await cut(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${Dy(i)}:${e.sessionToken}`;if(a in zZ)return zZ[a];for(Gve.push(a);Gve.length>uut;)delete zZ[Gve.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,Kve])s=await cut(t,s,u);return zZ[a]=s},cut=(t,e,r)=>{let n=new t(e);return n.update(kT(r)),n.digest()}});var VZ,Yve=w(()=>{D1();VZ=({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 nut||e?.has(i)||out.test(i)||iut.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var Zve,Xve=w(()=>{PZ();D1();Zve=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===tut)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${Yh(n)}=${Yh(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).reduce((i,a)=>i.concat([`${Yh(n)}=${Yh(a)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")}});var fut,put=w(()=>{fut=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var oH,Qve=w(()=>{put();eH();rH();D1();oH=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===nH)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||fut(e)){let n=new r;return n.update(kT(e)),Dy(await n.digest())}return sut}});function hut(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var WZ,mut,mhr,ewe,gut=w(()=>{eH();rH();WZ=class{format(e){let r=[];for(let i of Object.keys(e)){let a=tH(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=tH(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(ewe.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!mhr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(Kst(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"})(mut||(mut={}));mhr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,ewe=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&&hut(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&hut(e),parseInt(Dy(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var yut,but=w(()=>{yut=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var twe,rwe=w(()=>{X3();twe=(t,e={})=>{let{headers:r,query:n={}}=FT.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 KZ,nwe=w(()=>{X3();D1();KZ=t=>{t=FT.clone(t);for(let e of Object.keys(t.headers))eut.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var _ut,hhr,vut=w(()=>{_ut=t=>hhr(t).toISOString().replace(/\.\d{3}Z$/,"Z"),hhr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var iH,GZ,wut,Sut=w(()=>{eH();jy();PZ();rH();D1();Jve();Yve();Xve();Qve();gut();but();rwe();nwe();vut();iH=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new WZ,this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=zd(n),this.credentialProvider=zd(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}=GZ(n);if(o>lut)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=HZ(p,d,l??this.service),h=twe(KZ(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[Hve]=c.sessionToken),h.query[Yst]=UZ,h.query[Zst]=`${c.accessKeyId}/${m}`,h.query[Uve]=f,h.query[Qst]=o.toString(10);let b=VZ(h,i,s);return h.query[Xst]=wut(b),h.query[zve]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,b,await oH(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=GZ(n),c=HZ(u,s,a??this.service),d=await oH({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=Dy(await f.digest()),m=[aut,l,c,o,p,d].join(` -`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=GZ(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update(kT(e)),Dy(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=KZ(e),{longDate:c,shortDate:d}=GZ(r),f=HZ(d,u,a??this.service);l.headers[Wve]=c,s.sessionToken&&(l.headers[rut]=s.sessionToken);let p=await oH(l,this.sha256);!yut(nH,l.headers)&&this.applyChecksum&&(l.headers[nH]=p);let m=VZ(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[Vve]=`${UZ} Credential=${s.accessKeyId}/${f}, SignedHeaders=${wut(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method} +`),Rat={warn:console.warn}});var Wmr,Kmr,jat,Gmr,Nat,vro,wro,Sro,IZ,Dat,xro,Jmr,Ymr,Zmr,N1,Xmr,Qmr,Mve,Lat=w(()=>{Ive();Wmr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Kmr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),jat=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Kmr.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=Ave(Mve(n)),d=N1(o,"month",1,12),f=N1(i,"day",1,31);return Dat(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},Gmr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),Nat=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Gmr.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=Ave(Mve(n)),f=N1(o,"month",1,12),p=N1(i,"day",1,31),m=Dat(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&m.setTime(m.getTime()-Qmr(c)),m},vro=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$/),wro=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$/),Sro=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})$/),IZ=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=Tat(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))},Dat=(t,e,r,n)=>{let o=e-1;return Ymr(t,o,r),new Date(Date.UTC(t,o,r,N1(n.hours,"hour",0,23),N1(n.minutes,"minute",0,59),N1(n.seconds,"seconds",0,60),Xmr(n.fractionalMilliseconds)))},xro=50*365*24*60*60*1e3,Jmr=[31,28,31,30,31,30,31,31,30,31,30,31],Ymr=(t,e,r)=>{let n=Jmr[e];if(e===1&&Zmr(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${Wmr[e]} in ${t}: ${r}`)},Zmr=t=>t%4===0&&(t%100!==0||t%400===0),N1=(t,e,r,n)=>{let o=Iat(Mve(t));if(on)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},Xmr=t=>t==null?0:Aat("0."+t)*1e3,Qmr=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},Mve=t=>{let e=0;for(;e{wk=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}},qa=(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 ehr,MZ,thr,Fat=w(()=>{Rve();ehr=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{let o=thr(t),i=o.httpStatusCode?o.httpStatusCode+"":void 0,a=new r({name:e?.code||e?.Code||n||i||"UnknownError",$fault:"client",$metadata:o});throw qa(a,e)},MZ=t=>({output:e,parsedBody:r,errorCode:n})=>{ehr({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},thr=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 RZ,kat=w(()=>{RZ=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 $at=w(()=>{});var Bat,qat,Uat=w(()=>{Hs();Bat=t=>{let e=[];for(let r in ck){let n=ck[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}}},qat=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var zat,Hat,Vat=w(()=>{zat=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},Hat=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var jZ,NZ,Wat=w(()=>{Uat();Vat();jZ=t=>({...Bat(t),...zat(t)}),NZ=t=>({...qat(t),...Hat(t)})});var Kat=w(()=>{Wat()});function DZ(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var jve=w(()=>{});var Gat=w(()=>{});var Nve,Jat=w(()=>{Nve=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]=Nve(t[r]));return t}});var Dve,Yat=w(()=>{Dve=function(){let t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};Dve.prototype=Object.create(String.prototype,{constructor:{value:Dve,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(Dve,String)});var X3,rhr,nhr,ohr,Zat=w(()=>{X3=(t,e)=>{let r={};for(let n in e)rhr(r,t,e,n);return r},rhr=(t,e,r,n)=>{if(e!==null){let a=r[n];typeof a=="function"&&(a=[,a]);let[s=nhr,u=ohr,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)}},nhr=t=>t!=null,ohr=t=>t});var Xat=w(()=>{jve()});var Qat=w(()=>{});var or,est=w(()=>{or=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(or);if(typeof t=="object"){let e={};for(let r of Object.keys(t))t[r]!=null&&(e[r]=or(t[r]));return e}return t}});var tst=w(()=>{});var ar=w(()=>{Mit();Dit();vat();wat();Sat();xat();Lat();Fat();kat();$at();Kat();Rve();jve();Gat();Jat();Yat();Zat();Ive();Xat();Qat();est();tst()});var rst,nst=w(()=>{rst=t=>t?.body instanceof ReadableStream});var ihr,ahr,shr,uhr,Lve,LZ,lhr,ost=w(()=>{CZ();V3();ar();M_();c2();nst();fve();ihr=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(ahr(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=gk.isInstance(c);for(d&&(c.headers[_Z]=bC());;)try{d&&(c.headers[vZ]=`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=shr(f);if(s=dve(f),d&&rst(c))throw(r.logger instanceof AT?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),s;try{a=await o.refreshRetryTokenForRetry(a,p)}catch{throw s.$metadata||(s.$metadata={}),s.$metadata.attempts=u+1,s.$metadata.totalRetryDelay=l,s}u=a.getRetryCount();let m=a.getRetryDelay();l+=m,await new Promise(h=>setTimeout(h,m))}}else return o=o,o?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",o.mode]]),o.retry(e,n)},ahr=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",shr=t=>{let e={error:t,errorType:uhr(t)},r=lhr(t.$response);return r&&(e.retryAfterHint=r),e},uhr=t=>pk(t)?"THROTTLING":bZ(t)?"TRANSIENT":sit(t)?"SERVER_ERROR":"CLIENT_ERROR",Lve={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},LZ=t=>({applyToStack:e=>{e.add(ihr(t),Lve)}}),lhr=t=>{if(!K3.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 FZ=w(()=>{Tit();pve();Ait();lve();Iit();cve();ost()});var chr,kZ,ist=w(()=>{FZ();ive();chr={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:Lve.name},kZ=t=>({applyToStack:e=>{e.addRelativeTo(tit(t),chr)}})});var ast=w(()=>{ive();ist()});var Sk,sst=w(()=>{Sk=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 ust=w(()=>{z3();Hs()});var lst=w(()=>{z3()});var xk,cst=w(()=>{xk=class{async sign(e,r,n){return e}}});var dst=w(()=>{ust();lst();cst()});var dhr,fst,Fve,pst,mst=w(()=>{dhr=t=>e=>Fve(e)&&e.expiration.getTime()-Date.now()t.expiration!==void 0,pst=(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 hst=w(()=>{sst();dst();mst()});var gst=w(()=>{Hs()});var Ck,yst=w(()=>{Ck=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var bst=w(()=>{z3();ar()});function kve(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 fhr(e,a.client,s,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield d;let f=l;l=phr(d,n),c=!!(l&&(!a.stopOnSameToken||l!==f))}return void 0}}var fhr,phr,_st=w(()=>{fhr=async(t,e,r,...n)=>await e.send(new t(r),...n);phr=(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 LT=w(()=>{Vot();ast();hst();gst();yst();bst();_st()});var vst=w(()=>{});var wst=w(()=>{vst()});var Sst=w(()=>{Hs()});var xst=w(()=>{});var Cst=w(()=>{});function mhr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var $Z,Ost=w(()=>{$Z=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=mhr(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 Pst=w(()=>{});var Est=w(()=>{});var Tst=w(()=>{});var Ast=w(()=>{wst();Sst();xst();Cst();Ost();Pst();Est();Tst()});function hhr(t){return e=>async r=>{let n=r.request;if($Z.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(Ist)===-1)try{let a=t(o);n.headers={...n.headers,[Ist]:String(a)}}catch{}}return e({...r,request:n})}}var Ist,ghr,BZ,$ve=w(()=>{Ast();Ist="content-length";ghr={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},BZ=t=>({applyToStack:e=>{e.add(hhr(t.bodyLengthChecker),ghr)}})});var Mst=w(()=>{});var Rst=w(()=>{Mst()});var jst=w(()=>{});var Nst=w(()=>{jst()});var Dst=w(()=>{Hs()});var Lst=w(()=>{});var Fst=w(()=>{});function yhr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var FT,kst=w(()=>{FT=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=yhr(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 qZ,$st=w(()=>{qZ=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 Bst=w(()=>{});var qst=w(()=>{});var Q3=w(()=>{Nst();Dst();Lst();Fst();kst();$st();Bst();qst()});var Bve,Ust=w(()=>{Q3();Bve=t=>qZ.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var UZ,qve=w(()=>{UZ=t=>new Date(Date.now()+t)});var zst,Hst=w(()=>{qve();zst=(t,e)=>Math.abs(UZ(e).getTime()-t)>=3e5});var Uve,Vst=w(()=>{Hst();Uve=(t,e)=>{let r=Date.parse(t);return zst(r,e)?r-Date.now():e}});var Wst=w(()=>{Ust();qve();Vst()});var eH,Kst,D1,Gst=w(()=>{Q3();Wst();eH=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},Kst=async t=>{let e=eH("context",t.context),r=eH("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await eH("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},D1=class{async sign(e,r,n){if(!FT.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await Kst(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:UZ(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??Bve(r.$response);if(n){let o=eH("config",e.config),i=o.systemClockOffset;o.systemClockOffset=Uve(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=Bve(e);if(n){let o=eH("config",r.config);o.systemClockOffset=Uve(n,o.systemClockOffset)}}}});var Jst=w(()=>{LT();sO()});function Zst(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{Yst={},zve={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Yst[t]=e,zve[e]=t}});var rH,Hve=w(()=>{rH=t=>new TextEncoder().encode(t)});var kT,Xst=w(()=>{Hve();kT=t=>typeof t=="string"?rH(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var Qst=w(()=>{});var nH=w(()=>{Hve();Xst();Qst()});var eut,tut,Vve,rut,nut,Wve,Kve,Gve,Jve,bhr,out,iut,oH,aut,sut,uut,lut,zZ,cut,dut,fut,Yve,put,L1=w(()=>{eut="X-Amz-Algorithm",tut="X-Amz-Credential",Vve="X-Amz-Date",rut="X-Amz-SignedHeaders",nut="X-Amz-Expires",Wve="X-Amz-Signature",Kve="X-Amz-Security-Token",Gve="authorization",Jve=Vve.toLowerCase(),bhr="date",out=[Gve,Jve,bhr],iut=Wve.toLowerCase(),oH="x-amz-content-sha256",aut=Kve.toLowerCase(),sut={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},uut=/^proxy-/,lut=/^sec-/,zZ="AWS4-HMAC-SHA256",cut="AWS4-HMAC-SHA256-PAYLOAD",dut="UNSIGNED-PAYLOAD",fut=50,Yve="aws4_request",put=60*60*24*7});var HZ,Zve,VZ,hut,mut,Xve=w(()=>{tH();nH();L1();HZ={},Zve=[],VZ=(t,e,r)=>`${t}/${e}/${r}/${Yve}`,hut=async(t,e,r,n,o)=>{let i=await mut(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${Dy(i)}:${e.sessionToken}`;if(a in HZ)return HZ[a];for(Zve.push(a);Zve.length>fut;)delete HZ[Zve.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,Yve])s=await mut(t,s,u);return HZ[a]=s},mut=(t,e,r)=>{let n=new t(e);return n.update(kT(r)),n.digest()}});var WZ,Qve=w(()=>{L1();WZ=({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 sut||e?.has(i)||uut.test(i)||lut.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var ewe,twe=w(()=>{EZ();L1();ewe=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===iut)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${Yh(n)}=${Yh(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).reduce((i,a)=>i.concat([`${Yh(n)}=${Yh(a)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")}});var gut,yut=w(()=>{gut=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var iH,rwe=w(()=>{yut();tH();nH();L1();iH=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===oH)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||gut(e)){let n=new r;return n.update(kT(e)),Dy(await n.digest())}return dut}});function _ut(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var KZ,but,_hr,nwe,vut=w(()=>{tH();nH();KZ=class{format(e){let r=[];for(let i of Object.keys(e)){let a=rH(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=rH(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(nwe.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!_hr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(Zst(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"})(but||(but={}));_hr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,nwe=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&&_ut(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&_ut(e),parseInt(Dy(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var wut,Sut=w(()=>{wut=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var owe,iwe=w(()=>{Q3();owe=(t,e={})=>{let{headers:r,query:n={}}=FT.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 GZ,awe=w(()=>{Q3();L1();GZ=t=>{t=FT.clone(t);for(let e of Object.keys(t.headers))out.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var xut,vhr,Cut=w(()=>{xut=t=>vhr(t).toISOString().replace(/\.\d{3}Z$/,"Z"),vhr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var aH,JZ,Out,Put=w(()=>{tH();jy();EZ();nH();L1();Xve();Qve();twe();rwe();vut();Sut();iwe();awe();Cut();aH=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new KZ,this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=zd(n),this.credentialProvider=zd(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}=JZ(n);if(o>put)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=VZ(p,d,l??this.service),h=owe(GZ(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[Kve]=c.sessionToken),h.query[eut]=zZ,h.query[tut]=`${c.accessKeyId}/${m}`,h.query[Vve]=f,h.query[nut]=o.toString(10);let b=WZ(h,i,s);return h.query[rut]=Out(b),h.query[Wve]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,b,await iH(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=JZ(n),c=VZ(u,s,a??this.service),d=await iH({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=Dy(await f.digest()),m=[cut,l,c,o,p,d].join(` +`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=JZ(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update(kT(e)),Dy(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=GZ(e),{longDate:c,shortDate:d}=JZ(r),f=VZ(d,u,a??this.service);l.headers[Jve]=c,s.sessionToken&&(l.headers[aut]=s.sessionToken);let p=await iH(l,this.sha256);!wut(oH,l.headers)&&this.applyChecksum&&(l.headers[oH]=p);let m=WZ(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[Gve]=`${zZ} Credential=${s.accessKeyId}/${f}, SignedHeaders=${Out(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method} ${this.getCanonicalPath(e)} -${Zve(e)} +${ewe(e)} ${o.map(i=>`${i}:${r[i]}`).join(` `)} ${o.join(";")} -${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update(kT(n));let i=await o.digest();return`${UZ} +${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update(kT(n));let i=await o.digest();return`${zZ} ${e} ${r} -${Dy(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 Yh(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(kT(i)),Dy(await a.digest())}getSigningKey(e,r,n,o){return dut(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")}},GZ=t=>{let e=_ut(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},wut=t=>Object.keys(t).sort().join(";")});var xut=w(()=>{Sut();Yve();Xve();Qve();rwe();nwe();Jve()});var JZ,Cut=w(()=>{LT();xut();JZ=t=>{let e;t.credentials&&(e=lst(t.credentials,ust,Nve)),e||(t.credentialDefaultProvider?e=xk(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=xk(t.signer):t.regionInfoProvider?i=()=>xk(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||iH;return new d(c)}):i=async a=>{a=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await xk(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||iH;return new c(l)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:i}}});var Out=w(()=>{Hst();Vst();Cut()});var Put=w(()=>{Out()});var Eut=w(()=>{});var Tut=w(()=>{ar()});var YZ,owe=w(()=>{ar();YZ=(t,e)=>DT(t,e).then(r=>e.utf8Encoder(r))});var Is,Aut,Iut,Mut=w(()=>{owe();Is=(t,e)=>YZ(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{}}),Aut=async(t,e)=>{let r=await Is(t,e);return r.message=r.message??r.Message,r},Iut=(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 ZZ=v(dO=>{"use strict";var Rut=":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",ghr=Rut+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",jut="["+Rut+"]["+ghr+"]*",yhr=new RegExp("^"+jut+"$"),bhr=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"u")};dO.isExist=function(t){return typeof t<"u"};dO.isEmptyObject=function(t){return Object.keys(t).length===0};dO.merge=function(t,e,r){if(e){let n=Object.keys(e),o=n.length;for(let i=0;i{"use strict";var iwe=ZZ(),vhr={allowBooleanAttributes:!1,unpairedTags:[]};kut.validate=function(t,e){e=Object.assign({},vhr,e);let r=[],n=!1,o=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let i=0;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--),!Thr(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",Ms("InvalidTag",d,zf(t,i))}let l=xhr(t,i);if(l===!1)return Ms("InvalidAttr","Attributes for '"+u+"' have open quote.",zf(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=Fut(c,e);if(f===!0)n=!0;else return Ms(f.err.code,f.err.msg,zf(t,d+f.err.line))}else if(s)if(l.tagClosed){if(c.trim().length>0)return Ms("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",zf(t,a));if(r.length===0)return Ms("InvalidTag","Closing tag '"+u+"' has not been opened.",zf(t,a));{let d=r.pop();if(u!==d.tagName){let f=zf(t,d.tagStartPos);return Ms("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",zf(t,a))}r.length==0&&(o=!0)}}else return Ms("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",zf(t,i));else{let d=Fut(c,e);if(d!==!0)return Ms(d.err.code,d.err.msg,zf(t,i-c.length+d.err.line));if(o===!0)return Ms("InvalidXml","Multiple possible root nodes found.",zf(t,i));e.unpairedTags.indexOf(u)!==-1||r.push({tagName:u,tagStartPos:a}),n=!0}for(i++;i0)return Ms("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Ms("InvalidXml","Start tag expected.",1);return!0};function Nut(t){return t===" "||t===" "||t===` -`||t==="\r"}function Dut(t,e){let r=e;for(;e5&&n==="xml")return Ms("InvalidXml","XML declaration allowed only at the start of the document.",zf(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Lut(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e"){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"&&(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"){e+=2;break}}return e}var whr='"',Shr="'";function xhr(t,e){let r="",n="",o=!1;for(;e"&&n===""){o=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:o}}var Chr=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Fut(t,e){let r=iwe.getAllMatches(t,Chr),n={};for(let o=0;o{var $ut={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}},Ahr=function(t){return Object.assign({},$ut,t)};swe.buildOptions=Ahr;swe.defaultOptions=$ut});var Uut=v((Uao,qut)=>{"use strict";var uwe=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})}};qut.exports=uwe});var Hut=v((zao,zut)=>{var Ihr=ZZ();function Mhr(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"){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 Rhr(t,e){let r="";for(;e{var $hr=/^[-+]?0x[a-fA-F0-9]+$/,Bhr=/^([\-\+])?(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 qhr={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Uhr(t,e={}){if(e=Object.assign({},qhr,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&&$hr.test(r))return Number.parseInt(r,16);{let n=Bhr.exec(r);if(n){let o=n[1],i=n[2],a=zhr(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 zhr(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}Vut.exports=Uhr});var Jut=v((Vao,Gut)=>{"use strict";var Kut=ZZ(),sH=Uut(),Hhr=Hut(),Vhr=Wut(),lwe=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=Whr,this.parseXml=Zhr,this.parseTextData=Khr,this.resolveNameSpace=Ghr,this.buildAttributesMap=Yhr,this.isItStopNode=tgr,this.replaceEntitiesValue=Qhr,this.readStopNodeData=ngr,this.saveTextToParentTag=egr,this.addChild=Xhr}};function Whr(t){let e=Object.keys(t);for(let r=0;r0)){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?dwe(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?dwe(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Ghr(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 Jhr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Yhr(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=Kut.getAllMatches(t,Jhr),o=n.length,i={};for(let a=0;a",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: `);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=cwe(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 sH(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=L1(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=Hhr(t,i);this.docTypeEntities=s.entities,i=s.i}else if(t.substr(i+1,2)==="!["){let s=L1(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=cwe(t,i,this.options.removeNSPrefix),u=s.tagName,l=s.rawTagName,c=s.tagExp,d=s.attrExpPresent,f=s.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,o,!1));let p=r;if(p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==e.tagname&&(o+=o?"."+u:u),this.isItStopNode(this.options.stopNodes,o,u)){let m="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),i=s.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=s.closeIndex;else{let b=this.readStopNodeData(t,l,f+1);if(!b)throw new Error(`Unexpected end of ${l}`);i=b.i,m=b.tagContent}let h=new sH(u);u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),m&&(m=this.parseTextData(m,u,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),h.add(this.options.textNodeName,m),this.addChild(r,h,o)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));let m=new sH(u);u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),o=o.substr(0,o.lastIndexOf("."))}else{let m=new sH(u);this.tagsNodeStack.push(r),u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),r=m}n="",i=f}}else n+=t[i];return e.child};function Xhr(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var Qhr=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 egr(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 tgr(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 rgr(t,e,r=">"){let n,o="";for(let i=e;i",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=L1(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=L1(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=L1(t,"]]>",r,"StopNode is not closed.")-2;else{let i=cwe(t,r,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,r=i.closeIndex)}}function dwe(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:Vhr(t,r)}else return Kut.isExist(t)?t:""}Gut.exports=lwe});var Xut=v(Zut=>{"use strict";function ogr(t,e){return Yut(t,e)}function Yut(t,e,r){let n,o={};for(let i=0;i0&&(o[e.textNodeName]=n):n!==void 0&&(o[e.textNodeName]=n),o}function igr(t){let e=Object.keys(t);for(let r=0;r{var{buildOptions:ugr}=But(),lgr=Jut(),{prettify:cgr}=Xut(),dgr=awe(),fwe=class{constructor(e){this.externalEntities={},this.options=ugr(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=dgr.validate(e,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new lgr(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:cgr(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 ' '");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};Qut.exports=fwe});var ilt=v((Gao,olt)=>{var fgr=` -`;function pgr(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=fgr),rlt(t,e,"",r)}function rlt(t,e,r,n){let o="",i=!1;for(let a=0;a`,i=!1;continue}else if(u===e.commentPropName){o+=n+``,i=!0;continue}else if(u[0]==="?"){let m=tlt(s[":@"],e),h=u==="?xml"?"":n,b=s[u][0][e.textNodeName];b=b.length!==0?" "+b:"",o+=h+`<${u}${b}${m}?>`,i=!0;continue}let c=n;c!==""&&(c+=e.indentBy);let d=tlt(s[":@"],e),f=n+`<${u}${d}`,p=rlt(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}`:(o+=f+">",p&&n!==""&&(p.includes("/>")||p.includes("`),i=!0}return o}function mgr(t){let e=Object.keys(t);for(let r=0;r0&&e.processEntities)for(let r=0;r{"use strict";var ggr=ilt(),ygr={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:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function $T(t){this.options=Object.assign({},ygr,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=vgr),this.processTextOrObjNode=bgr,this.options.format?(this.indentate=_gr,this.tagEndChar=`> +${Dy(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 Yh(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(kT(i)),Dy(await a.digest())}getSigningKey(e,r,n,o){return hut(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")}},JZ=t=>{let e=xut(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},Out=t=>Object.keys(t).sort().join(";")});var Eut=w(()=>{Put();Qve();twe();rwe();iwe();awe();Xve()});var YZ,Tut=w(()=>{LT();Eut();YZ=t=>{let e;t.credentials&&(e=pst(t.credentials,fst,Fve)),e||(t.credentialDefaultProvider?e=Ck(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=Ck(t.signer):t.regionInfoProvider?i=()=>Ck(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||aH;return new d(c)}):i=async a=>{a=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await Ck(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||aH;return new c(l)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:i}}});var Aut=w(()=>{Gst();Jst();Tut()});var Iut=w(()=>{Aut()});var Mut=w(()=>{});var Rut=w(()=>{ar()});var ZZ,swe=w(()=>{ar();ZZ=(t,e)=>DT(t,e).then(r=>e.utf8Encoder(r))});var Is,jut,Nut,Dut=w(()=>{swe();Is=(t,e)=>ZZ(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{}}),jut=async(t,e)=>{let r=await Is(t,e);return r.message=r.message??r.Message,r},Nut=(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 XZ=v(fO=>{"use strict";var Lut=":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",whr=Lut+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Fut="["+Lut+"]["+whr+"]*",Shr=new RegExp("^"+Fut+"$"),xhr=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"u")};fO.isExist=function(t){return typeof t<"u"};fO.isEmptyObject=function(t){return Object.keys(t).length===0};fO.merge=function(t,e,r){if(e){let n=Object.keys(e),o=n.length;for(let i=0;i{"use strict";var uwe=XZ(),Ohr={allowBooleanAttributes:!1,unpairedTags:[]};Uut.validate=function(t,e){e=Object.assign({},Ohr,e);let r=[],n=!1,o=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let i=0;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--),!jhr(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",Ms("InvalidTag",d,zf(t,i))}let l=Thr(t,i);if(l===!1)return Ms("InvalidAttr","Attributes for '"+u+"' have open quote.",zf(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=qut(c,e);if(f===!0)n=!0;else return Ms(f.err.code,f.err.msg,zf(t,d+f.err.line))}else if(s)if(l.tagClosed){if(c.trim().length>0)return Ms("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",zf(t,a));if(r.length===0)return Ms("InvalidTag","Closing tag '"+u+"' has not been opened.",zf(t,a));{let d=r.pop();if(u!==d.tagName){let f=zf(t,d.tagStartPos);return Ms("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",zf(t,a))}r.length==0&&(o=!0)}}else return Ms("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",zf(t,i));else{let d=qut(c,e);if(d!==!0)return Ms(d.err.code,d.err.msg,zf(t,i-c.length+d.err.line));if(o===!0)return Ms("InvalidXml","Multiple possible root nodes found.",zf(t,i));e.unpairedTags.indexOf(u)!==-1||r.push({tagName:u,tagStartPos:a}),n=!0}for(i++;i0)return Ms("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Ms("InvalidXml","Start tag expected.",1);return!0};function kut(t){return t===" "||t===" "||t===` +`||t==="\r"}function $ut(t,e){let r=e;for(;e5&&n==="xml")return Ms("InvalidXml","XML declaration allowed only at the start of the document.",zf(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function But(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e"){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"&&(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"){e+=2;break}}return e}var Phr='"',Ehr="'";function Thr(t,e){let r="",n="",o=!1;for(;e"&&n===""){o=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:o}}var Ahr=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function qut(t,e){let r=uwe.getAllMatches(t,Ahr),n={};for(let o=0;o{var zut={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}},Nhr=function(t){return Object.assign({},zut,t)};cwe.buildOptions=Nhr;cwe.defaultOptions=zut});var Wut=v((Kao,Vut)=>{"use strict";var dwe=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})}};Vut.exports=dwe});var Gut=v((Gao,Kut)=>{var Dhr=XZ();function Lhr(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"){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 Fhr(t,e){let r="";for(;e{var Hhr=/^[-+]?0x[a-fA-F0-9]+$/,Vhr=/^([\-\+])?(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 Whr={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Khr(t,e={}){if(e=Object.assign({},Whr,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&&Hhr.test(r))return Number.parseInt(r,16);{let n=Vhr.exec(r);if(n){let o=n[1],i=n[2],a=Ghr(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 Ghr(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}Jut.exports=Khr});var Qut=v((Yao,Xut)=>{"use strict";var Zut=XZ(),uH=Wut(),Jhr=Gut(),Yhr=Yut(),fwe=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=Zhr,this.parseXml=rgr,this.parseTextData=Xhr,this.resolveNameSpace=Qhr,this.buildAttributesMap=tgr,this.isItStopNode=agr,this.replaceEntitiesValue=ogr,this.readStopNodeData=ugr,this.saveTextToParentTag=igr,this.addChild=ngr}};function Zhr(t){let e=Object.keys(t);for(let r=0;r0)){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?mwe(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?mwe(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Qhr(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 egr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function tgr(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=Zut.getAllMatches(t,egr),o=n.length,i={};for(let a=0;a",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: `);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=pwe(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 uH(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=F1(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=Jhr(t,i);this.docTypeEntities=s.entities,i=s.i}else if(t.substr(i+1,2)==="!["){let s=F1(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=pwe(t,i,this.options.removeNSPrefix),u=s.tagName,l=s.rawTagName,c=s.tagExp,d=s.attrExpPresent,f=s.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,o,!1));let p=r;if(p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==e.tagname&&(o+=o?"."+u:u),this.isItStopNode(this.options.stopNodes,o,u)){let m="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),i=s.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=s.closeIndex;else{let b=this.readStopNodeData(t,l,f+1);if(!b)throw new Error(`Unexpected end of ${l}`);i=b.i,m=b.tagContent}let h=new uH(u);u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),m&&(m=this.parseTextData(m,u,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),h.add(this.options.textNodeName,m),this.addChild(r,h,o)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));let m=new uH(u);u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),o=o.substr(0,o.lastIndexOf("."))}else{let m=new uH(u);this.tagsNodeStack.push(r),u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),r=m}n="",i=f}}else n+=t[i];return e.child};function ngr(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var ogr=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 igr(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 agr(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 sgr(t,e,r=">"){let n,o="";for(let i=e;i",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=F1(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=F1(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=F1(t,"]]>",r,"StopNode is not closed.")-2;else{let i=pwe(t,r,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,r=i.closeIndex)}}function mwe(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:Yhr(t,r)}else return Zut.isExist(t)?t:""}Xut.exports=fwe});var rlt=v(tlt=>{"use strict";function lgr(t,e){return elt(t,e)}function elt(t,e,r){let n,o={};for(let i=0;i0&&(o[e.textNodeName]=n):n!==void 0&&(o[e.textNodeName]=n),o}function cgr(t){let e=Object.keys(t);for(let r=0;r{var{buildOptions:pgr}=Hut(),mgr=Qut(),{prettify:hgr}=rlt(),ggr=lwe(),hwe=class{constructor(e){this.externalEntities={},this.options=pgr(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=ggr.validate(e,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new mgr(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:hgr(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 ' '");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};nlt.exports=hwe});var llt=v((Qao,ult)=>{var ygr=` +`;function bgr(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=ygr),alt(t,e,"",r)}function alt(t,e,r,n){let o="",i=!1;for(let a=0;a`,i=!1;continue}else if(u===e.commentPropName){o+=n+``,i=!0;continue}else if(u[0]==="?"){let m=ilt(s[":@"],e),h=u==="?xml"?"":n,b=s[u][0][e.textNodeName];b=b.length!==0?" "+b:"",o+=h+`<${u}${b}${m}?>`,i=!0;continue}let c=n;c!==""&&(c+=e.indentBy);let d=ilt(s[":@"],e),f=n+`<${u}${d}`,p=alt(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}`:(o+=f+">",p&&n!==""&&(p.includes("/>")||p.includes("`),i=!0}return o}function _gr(t){let e=Object.keys(t);for(let r=0;r0&&e.processEntities)for(let r=0;r{"use strict";var wgr=llt(),Sgr={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:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function $T(t){this.options=Object.assign({},Sgr,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Ogr),this.processTextOrObjNode=xgr,this.options.format?(this.indentate=Cgr,this.tagEndChar=`> `,this.newLine=` -`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}$T.prototype.build=function(t){return this.options.preserveOrder?ggr(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};$T.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"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"+t+o:this.options.commentPropName!==!1&&e===this.options.commentPropName&&i.length===0?this.indentate(n)+``+this.newLine:this.indentate(n)+"<"+e+r+i+this.tagEndChar+t+this.indentate(n)+o}};$T.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+``+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+"0&&this.options.processEntities)for(let e=0;e{"use strict";var wgr=awe(),Sgr=elt(),xgr=slt();ult.exports={XMLParser:Sgr,XMLValidator:wgr,XMLBuilder:xgr}});var clt,R_,dlt,flt=w(()=>{ar();clt=F(llt());owe();R_=(t,e)=>YZ(t,e).then(r=>{if(r.length){let n=new clt.XMLParser({attributeNamePrefix:"",htmlEntities:!0,ignoreAttributes:!1,ignoreDeclaration:!0,parseTagValue:!1,trimValues:!1,tagValueProcessor:(u,l)=>l.trim()===""&&l.includes(` +`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}$T.prototype.build=function(t){return this.options.preserveOrder?wgr(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};$T.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"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"+t+o:this.options.commentPropName!==!1&&e===this.options.commentPropName&&i.length===0?this.indentate(n)+``+this.newLine:this.indentate(n)+"<"+e+r+i+this.tagEndChar+t+this.indentate(n)+o}};$T.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+``+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+"0&&this.options.processEntities)for(let e=0;e{"use strict";var Pgr=lwe(),Egr=olt(),Tgr=dlt();flt.exports={XMLParser:Egr,XMLValidator:Pgr,XMLBuilder:Tgr}});var mlt,R_,hlt,glt=w(()=>{ar();mlt=F(plt());swe();R_=(t,e)=>ZZ(t,e).then(r=>{if(r.length){let n=new mlt.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]),Mve(s)}return{}}),dlt=async(t,e)=>{let r=await R_(t,e);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r}});var plt=w(()=>{Eut();Tut();Mut();flt()});var F1=w(()=>{Tst();Put();plt()});function Cgr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function XZ(t){return{schemeId:"smithy.api#noAuth"}}var mlt,hlt,glt,pwe=w(()=>{F1();jy();mlt=async(t,e,r)=>({operation:A_(e).operation,region:await zd(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});hlt=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(XZ(t));break}case"GetId":{e.push(XZ(t));break}case"GetOpenIdToken":{e.push(XZ(t));break}case"UnlinkIdentity":{e.push(XZ(t));break}default:e.push(Cgr(t))}return e},glt=t=>({...JZ(t)})});var ylt,Cr,ua=w(()=>{ylt=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),Cr={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var _lt,blt=w(()=>{_lt={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 mwe,hwe,vlt,wlt=w(()=>{mwe={name:"SHA-256"},hwe={name:"HMAC",hash:mwe},vlt=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 Ck(){return typeof window<"u"?window:typeof self<"u"?self:Pgr}var Pgr,gwe=w(()=>{Pgr={}});var Ok,ywe,bwe=w(()=>{Ok=F(LY());wlt();gwe();ywe=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,Ok.isEmptyData)(e)){var r=(0,Ok.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 Ck().crypto.subtle.sign(hwe,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,Ok.isEmptyData)(this.toHash)?Promise.resolve(vlt):Promise.resolve().then(function(){return Ck().crypto.subtle.digest(mwe,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){Ck().crypto.subtle.importKey("raw",(0,Ok.convertToBuffer)(e.secret),hwe,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function Slt(t){if(Tgr(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return Agr(e)}return!1}function Tgr(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function Agr(t){return t&&Egr.every(function(e){return typeof t[e]=="function"})}var Egr,xlt=w(()=>{Egr=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var Clt=w(()=>{xlt()});var Olt,Plt,QZ,Elt=w(()=>{bwe();Olt=F(x_e());Clt();gwe();Plt=F(LY()),QZ=function(){function t(e){Slt(Ck())?this.hash=new ywe(e):this.hash=new Olt.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,Plt.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var _we=w(()=>{Elt();bwe()});var wwe=v((uH,vwe)=>{(function(t,e){typeof uH=="object"&&typeof vwe=="object"?vwe.exports=e():typeof define=="function"&&define.amd?define([],e):typeof uH=="object"?uH.bowser=e():t.bowser=e()})(uH,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(n,o,i){r.o(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:i})},r.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,o){if(1&o&&(n=r(n)),8&o||4&o&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&o&&typeof n!="string")for(var a in n)r.d(i,a,function(s){return n[s]}.bind(null,a));return i},r.n=function(n){var o=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(o,"a",o),o},r.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)},r.p="",r(r.s=90)}({17:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=r(18),o=function(){function i(){}return i.getFirstMatch=function(a,s){var u=s.match(a);return u&&u.length>0&&u[1]||""},i.getSecondMatch=function(a,s){var u=s.match(a);return u&&u.length>1&&u[2]||""},i.matchAndReturnConst=function(a,s,u){if(a.test(s))return u},i.getWindowsVersionName=function(a){switch(a){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),s[0]===10)switch(s[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},i.getAndroidVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),!(s[0]===1&&s[1]<5))return s[0]===1&&s[1]<6?"Cupcake":s[0]===1&&s[1]>=6?"Donut":s[0]===2&&s[1]<2?"Eclair":s[0]===2&&s[1]===2?"Froyo":s[0]===2&&s[1]>2?"Gingerbread":s[0]===3?"Honeycomb":s[0]===4&&s[1]<1?"Ice Cream Sandwich":s[0]===4&&s[1]<4?"Jelly Bean":s[0]===4&&s[1]>=4?"KitKat":s[0]===5?"Lollipop":s[0]===6?"Marshmallow":s[0]===7?"Nougat":s[0]===8?"Oreo":s[0]===9?"Pie":void 0},i.getVersionPrecision=function(a){return a.split(".").length},i.compareVersions=function(a,s,u){u===void 0&&(u=!1);var l=i.getVersionPrecision(a),c=i.getVersionPrecision(s),d=Math.max(l,c),f=0,p=i.map([a,s],function(m){var h=d-i.getVersionPrecision(m),b=m+new Array(h+1).join(".0");return i.map(b.split("."),function(g){return new Array(20-g.length).join("0")+g}).reverse()});for(u&&(f=d-Math.min(l,c)),d-=1;d>=f;){if(p[0][d]>p[1][d])return 1;if(p[0][d]===p[1][d]){if(d===f)return 0;d-=1}else if(p[0][d]1?c-1:0),f=1;f0){var y=Object.keys(m),S=s.default.find(y,function(I){return p.isOS(I)});if(S){var x=this.satisfies(m[S]);if(x!==void 0)return x}var O=s.default.find(y,function(I){return p.isPlatform(I)});if(O){var P=this.satisfies(m[O]);if(P!==void 0)return P}}if(g>0){var E=Object.keys(b),A=s.default.find(E,function(I){return p.isBrowser(I,!0)});if(A!==void 0)return this.compareVersion(b[A])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var m=this.getBrowserName().toLowerCase(),h=f.toLowerCase(),b=s.default.getBrowserTypeByAlias(h);return p&&b&&(h=b.toLowerCase()),h===m},d.compareVersion=function(f){var p=[0],m=f,h=!1,b=this.getBrowserVersion();if(typeof b=="string")return f[0]===">"||f[0]==="<"?(m=f.substr(1),f[1]==="="?(h=!0,m=f.substr(2)):p=[],f[0]===">"?p.push(1):p.push(-1)):f[0]==="="?m=f.substr(1):f[0]==="~"&&(h=!0,m=f.substr(1)),p.indexOf(s.default.compareVersions(b,m,h))>-1},d.isOS=function(f){return this.getOSName(!0)===String(f).toLowerCase()},d.isPlatform=function(f){return this.getPlatformType(!0)===String(f).toLowerCase()},d.isEngine=function(f){return this.getEngineName(!0)===String(f).toLowerCase()},d.is=function(f,p){return p===void 0&&(p=!1),this.isBrowser(f,p)||this.isOS(f)||this.isPlatform(f)},d.some=function(f){var p=this;return f===void 0&&(f=[]),f.some(function(m){return p.is(m)})},c}();e.default=l,t.exports=e.default},92:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(s){var u={name:"Googlebot"},l=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/opera/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opr\/|opios/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/SamsungBrowser/i],describe:function(s){var u={name:"Samsung Internet for Android"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Whale/i],describe:function(s){var u={name:"NAVER Whale Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MZBrowser/i],describe:function(s){var u={name:"MZ Browser"},l=o.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/focus/i],describe:function(s){var u={name:"Focus"},l=o.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/swing/i],describe:function(s){var u={name:"Swing"},l=o.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/coast/i],describe:function(s){var u={name:"Opera Coast"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(s){var u={name:"Opera Touch"},l=o.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/yabrowser/i],describe:function(s){var u={name:"Yandex Browser"},l=o.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/ucbrowser/i],describe:function(s){var u={name:"UC Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Maxthon|mxios/i],describe:function(s){var u={name:"Maxthon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/epiphany/i],describe:function(s){var u={name:"Epiphany"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/puffin/i],describe:function(s){var u={name:"Puffin"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sleipnir/i],describe:function(s){var u={name:"Sleipnir"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/k-meleon/i],describe:function(s){var u={name:"K-Meleon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/micromessenger/i],describe:function(s){var u={name:"WeChat"},l=o.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qqbrowser/i],describe:function(s){var u={name:/qqbrowserlite/i.test(s)?"QQ Browser Lite":"QQ Browser"},l=o.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/msie|trident/i],describe:function(s){var u={name:"Internet Explorer"},l=o.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/\sedg\//i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/edg([ea]|ios)/i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/vivaldi/i],describe:function(s){var u={name:"Vivaldi"},l=o.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/seamonkey/i],describe:function(s){var u={name:"SeaMonkey"},l=o.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sailfish/i],describe:function(s){var u={name:"Sailfish"},l=o.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,s);return l&&(u.version=l),u}},{test:[/silk/i],describe:function(s){var u={name:"Amazon Silk"},l=o.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/phantom/i],describe:function(s){var u={name:"PhantomJS"},l=o.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/slimerjs/i],describe:function(s){var u={name:"SlimerJS"},l=o.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u={name:"BlackBerry"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u={name:"WebOS Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/bada/i],describe:function(s){var u={name:"Bada"},l=o.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/tizen/i],describe:function(s){var u={name:"Tizen"},l=o.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qupzilla/i],describe:function(s){var u={name:"QupZilla"},l=o.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/firefox|iceweasel|fxios/i],describe:function(s){var u={name:"Firefox"},l=o.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/electron/i],describe:function(s){var u={name:"Electron"},l=o.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MiuiBrowser/i],describe:function(s){var u={name:"Miui"},l=o.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/chromium/i],describe:function(s){var u={name:"Chromium"},l=o.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/chrome|crios|crmo/i],describe:function(s){var u={name:"Chrome"},l=o.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/GSA/i],describe:function(s){var u={name:"Google Search"},l=o.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u={name:"Android Browser"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/playstation 4/i],describe:function(s){var u={name:"PlayStation 4"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/safari|applewebkit/i],describe:function(s){var u={name:"Safari"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/.*/i],describe:function(s){var u=s.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:o.default.getFirstMatch(u,s),version:o.default.getSecondMatch(u,s)}}}];e.default=a,t.exports=e.default},93:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/Roku\/DVP/],describe:function(s){var u=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,s);return{name:i.OS_MAP.Roku,version:u}}},{test:[/windows phone/i],describe:function(s){var u=o.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.WindowsPhone,version:u}}},{test:[/windows /i],describe:function(s){var u=o.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,s),l=o.default.getWindowsVersionName(u);return{name:i.OS_MAP.Windows,version:u,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(s){var u={name:i.OS_MAP.iOS},l=o.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,s);return l&&(u.version=l),u}},{test:[/macintosh/i],describe:function(s){var u=o.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,s).replace(/[_\s]/g,"."),l=o.default.getMacOSVersionName(u),c={name:i.OS_MAP.MacOS,version:u};return l&&(c.versionName=l),c}},{test:[/(ipod|iphone|ipad)/i],describe:function(s){var u=o.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,s).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:u}}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u=o.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,s),l=o.default.getAndroidVersionName(u),c={name:i.OS_MAP.Android,version:u};return l&&(c.versionName=l),c}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u=o.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,s),l={name:i.OS_MAP.WebOS};return u&&u.length&&(l.version=u),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u=o.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,s)||o.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,s)||o.default.getFirstMatch(/\bbb(\d+)/i,s);return{name:i.OS_MAP.BlackBerry,version:u}}},{test:[/bada/i],describe:function(s){var u=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Bada,version:u}}},{test:[/tizen/i],describe:function(s){var u=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Tizen,version:u}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(s){var u=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.PlayStation4,version:u}}}];e.default=a,t.exports=e.default},94:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(s){var u=o.default.getFirstMatch(/(can-l01)/i,s)&&"Nova",l={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return u&&(l.model=u),l}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){var u=s.test(/ipod|iphone/i),l=s.test(/like (ipod|iphone)/i);return u&&!l},describe:function(s){var u=o.default.getFirstMatch(/(ipod|iphone)/i,s);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:u}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName(!0)==="blackberry"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(s){return s.getBrowserName(!0)==="bada"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName()==="windows phone"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(s){var u=Number(String(s.getOSVersion()).split(".")[0]);return s.getOSName(!0)==="android"&&u>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){return s.getOSName(!0)==="android"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getOSName(!0)==="macos"},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(s){return s.getOSName(!0)==="windows"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="linux"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="playstation 4"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(s){return s.getOSName(!0)==="roku"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];e.default=a,t.exports=e.default},95:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:function(s){return s.getBrowserName(!0)==="microsoft edge"},describe:function(s){if(/\sedg\//i.test(s))return{name:i.ENGINE_MAP.Blink};var u=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:i.ENGINE_MAP.EdgeHTML,version:u}}},{test:[/trident/i],describe:function(s){var u={name:i.ENGINE_MAP.Trident},l=o.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){return s.test(/presto/i)},describe:function(s){var u={name:i.ENGINE_MAP.Presto},l=o.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=s.test(/gecko/i),l=s.test(/like gecko/i);return u&&!l},describe:function(s){var u={name:i.ENGINE_MAP.Gecko},l=o.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(s){var u={name:i.ENGINE_MAP.WebKit},l=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}}];e.default=a,t.exports=e.default}})})});var Tlt,eX,Swe=w(()=>{Tlt=F(wwe()),eX=({serviceId:t,clientVersion:e})=>async()=>{let r=typeof window<"u"&&window?.navigator?.userAgent?Tlt.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 Alt=w(()=>{});var tX,Ilt=w(()=>{tX=t=>()=>Promise.reject(t)});var xwe=w(()=>{Alt();Ilt()});var Mlt,rX,Rlt=w(()=>{Mlt=typeof TextEncoder=="function"?new TextEncoder:null,rX=t=>{if(typeof t=="string"){if(Mlt)return Mlt.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 Cwe=w(()=>{Rlt()});var Owe,Pwe=w(()=>{Owe=t=>new TextEncoder().encode(t)});var jlt=w(()=>{Pwe()});var Nlt,Dlt=w(()=>{Nlt=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 Llt=w(()=>{Pwe();jlt();Dlt()});var Wlt,N_,D_,Ek,Flt,cH,Pk,lH,fO,Ewe,klt,$lt,Blt,Klt,Glt,j_,qlt,Ult,zlt,Hlt,Vlt,Igr,Jlt,Ylt=w(()=>{Wlt="required",N_="fn",D_="argv",Ek="ref",Flt="isSet",cH="booleanEquals",Pk="error",lH="endpoint",fO="tree",Ewe="PartitionResult",klt={[Wlt]:!1,type:"String"},$lt={[Wlt]:!0,default:!1,type:"Boolean"},Blt={[Ek]:"Endpoint"},Klt={[N_]:cH,[D_]:[{[Ek]:"UseFIPS"},!0]},Glt={[N_]:cH,[D_]:[{[Ek]:"UseDualStack"},!0]},j_={},qlt={[N_]:"getAttr",[D_]:[{[Ek]:Ewe},"supportsFIPS"]},Ult={[N_]:cH,[D_]:[!0,{[N_]:"getAttr",[D_]:[{[Ek]:Ewe},"supportsDualStack"]}]},zlt=[Klt],Hlt=[Glt],Vlt=[{[Ek]:"Region"}],Igr={version:"1.0",parameters:{Region:klt,UseDualStack:$lt,UseFIPS:$lt,Endpoint:klt},rules:[{conditions:[{[N_]:Flt,[D_]:[Blt]}],rules:[{conditions:zlt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Pk},{conditions:Hlt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Pk},{endpoint:{url:Blt,properties:j_,headers:j_},type:lH}],type:fO},{conditions:[{[N_]:Flt,[D_]:Vlt}],rules:[{conditions:[{[N_]:"aws.partition",[D_]:Vlt,assign:Ewe}],rules:[{conditions:[Klt,Glt],rules:[{conditions:[{[N_]:cH,[D_]:[!0,qlt]},Ult],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:j_,headers:j_},type:lH}],type:fO},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Pk}],type:fO},{conditions:zlt,rules:[{conditions:[{[N_]:cH,[D_]:[qlt,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:j_,headers:j_},type:lH}],type:fO},{error:"FIPS is enabled but this partition does not support FIPS",type:Pk}],type:fO},{conditions:Hlt,rules:[{conditions:[Ult],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:j_,headers:j_},type:lH}],type:fO},{error:"DualStack is enabled but this partition does not support DualStack",type:Pk}],type:fO},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:j_,headers:j_},type:lH}],type:fO}],type:fO},{error:"Invalid Configuration: Missing Region",type:Pk}]},Jlt=Igr});var Zlt,Xlt=w(()=>{eZ();ET();Ylt();Zlt=(t,e={})=>k3(Jlt,{endpointParams:t,logger:e.logger});sO.aws=$3});var Qlt,ect=w(()=>{F1();LT();ar();dZ();yk();Llt();pwe();Xlt();Qlt=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??RT,base64Encoder:t?.base64Encoder??jT,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??Zlt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??hlt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new N1},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Sk}],logger:t?.logger??new AT,serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??TT,utf8Decoder:t?.utf8Decoder??Owe,utf8Encoder:t?.utf8Encoder??Nlt})});var tct,rct=w(()=>{tct=["in-region","cross-region","mobile","standard","legacy"]});var nct,nX,Mgr,oct=w(()=>{aO();nct=F(wwe());rct();nX=({defaultsMode:t}={})=>ett(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(Mgr()?"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 ${tct.join(", ")}, got ${e}`)}}),Mgr=()=>{let e=(typeof window<"u"&&window?.navigator?.userAgent?nct.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return e==="tablet"||e==="mobile"}});var Twe=w(()=>{oct()});var ict,act=w(()=>{blt();_we();Swe();B3();G3();xwe();Cwe();M_();ect();ar();Twe();ict=t=>{let e=nX(t),r=()=>e().then(MZ),n=Qlt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??rX,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??eX({serviceId:n.serviceId,clientVersion:_lt.version}),maxAttempts:t?.maxAttempts??I_,region:t?.region??tX("Region is missing"),requestHandler:NT.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||z3),sha256:t?.sha256??QZ,streamCollector:t?.streamCollector??bk,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(aZ)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(sZ))}}});var oX,iX,sct=w(()=>{oX=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}}},iX=t=>({region:t.region()})});var uct=w(()=>{});var Awe=w(()=>{});var lct=w(()=>{Awe()});var cct=w(()=>{lct();Awe()});var dct=w(()=>{uct();cct()});var Iwe=w(()=>{sct();dct()});var fct,pct,mct=w(()=>{fct=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},pct=t=>({httpHandler:t.httpHandler()})});var hct=w(()=>{mct()});var gct=w(()=>{Hs()});var yct=w(()=>{});var bct=w(()=>{});function jgr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var aX,_ct=w(()=>{aX=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=jgr(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 vct=w(()=>{});var wct=w(()=>{});var Sct=w(()=>{});var Mwe=w(()=>{hct();gct();yct();bct();_ct();vct();wct();Sct()});var xct,Cct,Oct=w(()=>{xct=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}}},Cct=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var sX,Pct,Ect=w(()=>{Iwe();Mwe();ar();Oct();sX=t=>t,Pct=(t,e)=>{let r={...sX(oX(t)),...sX(RZ(t)),...sX(fct(t)),...sX(xct(t))};return e.forEach(n=>n.configure(r)),{...t,...iX(r),...jZ(r),...pct(r),...Cct(r)}}});var BT,uX=w(()=>{E_e();T_e();A_e();W_e();B3();LT();Lve();zn();LZ();ar();pwe();ua();act();Ect();BT=class extends A1{constructor(...[e]){let r=ict(e||{}),n=ylt(r),o=WY(n),i=CZ(o),a=lZ(i),s=a,u=mZ(s),l=glt(u),c=Pct(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(oZ(this.config)),this.middlewareStack.use(DZ(this.config)),this.middlewareStack.use($Z(this.config)),this.middlewareStack.use(UY(this.config)),this.middlewareStack.use(zY(this.config)),this.middlewareStack.use(VY(this.config)),this.middlewareStack.use(hZ(this.config,{httpAuthSchemeParametersProvider:mlt,identityProviderConfigProvider:async d=>new wk({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(FZ(this.config))}destroy(){super.destroy()}}});var Hd,Rwe=w(()=>{ar();Hd=class t extends vk{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var lX,cX,dX,fX,pX,mX,hX,gX,yX,bX,_X,jwe=w(()=>{Rwe();lX=class t extends Hd{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,t.prototype)}},cX=class t extends Hd{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},dX=class t extends Hd{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},fX=class t extends Hd{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},pX=class t extends Hd{constructor(e){super({name:"ResourceConflictException",$fault:"client",...e}),this.name="ResourceConflictException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},mX=class t extends Hd{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},hX=class t extends Hd{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},gX=class t extends Hd{constructor(e){super({name:"ExternalServiceException",$fault:"client",...e}),this.name="ExternalServiceException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},yX=class t extends Hd{constructor(e){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...e}),this.name="InvalidIdentityPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},bX=class t extends Hd{constructor(e){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...e}),this.name="DeveloperUserAlreadyRegisteredException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_X=class t extends Hd{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}}});function Ha(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}}var Tct,Act,Ict,Mct,Rct,jct,Nct,Dct,Lct,Fct,kct,$ct,Bct,qct,Uct,zct,Hct,Vct,Wct,Kct,Gct,Jct,Yct,Zct,Xct,Qct,edt,tdt,rdt,ndt,odt,idt,adt,sdt,udt,ldt,cdt,ddt,fdt,pdt,mdt,hdt,gdt,ydt,bdt,_dt,Ua,Dgr,Lgr,Fgr,kgr,$gr,Bgr,qgr,Ugr,zgr,Hgr,Vgr,Wgr,Kgr,Ggr,vdt,Jgr,ro,Ygr,za,Oa=w(()=>{F1();Mwe();ar();Rwe();jwe();Tct=async(t,e)=>{let r=Ha("CreateIdentityPool"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Act=async(t,e)=>{let r=Ha("DeleteIdentities"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Ict=async(t,e)=>{let r=Ha("DeleteIdentityPool"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Mct=async(t,e)=>{let r=Ha("DescribeIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Rct=async(t,e)=>{let r=Ha("DescribeIdentityPool"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},jct=async(t,e)=>{let r=Ha("GetCredentialsForIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Nct=async(t,e)=>{let r=Ha("GetId"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Dct=async(t,e)=>{let r=Ha("GetIdentityPoolRoles"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Lct=async(t,e)=>{let r=Ha("GetOpenIdToken"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Fct=async(t,e)=>{let r=Ha("GetOpenIdTokenForDeveloperIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},kct=async(t,e)=>{let r=Ha("GetPrincipalTagAttributeMap"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},$ct=async(t,e)=>{let r=Ha("ListIdentities"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Bct=async(t,e)=>{let r=Ha("ListIdentityPools"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},qct=async(t,e)=>{let r=Ha("ListTagsForResource"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Uct=async(t,e)=>{let r=Ha("LookupDeveloperIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},zct=async(t,e)=>{let r=Ha("MergeDeveloperIdentities"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Hct=async(t,e)=>{let r=Ha("SetIdentityPoolRoles"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Vct=async(t,e)=>{let r=Ha("SetPrincipalTagAttributeMap"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Wct=async(t,e)=>{let r=Ha("TagResource"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Kct=async(t,e)=>{let r=Ha("UnlinkDeveloperIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Gct=async(t,e)=>{let r=Ha("UnlinkIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Jct=async(t,e)=>{let r=Ha("UntagResource"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Yct=async(t,e)=>{let r=Ha("UpdateIdentityPool"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Zct=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},Xct=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},Qct=async(t,e)=>t.statusCode>=300?Ua(t,e):(await DT(t.body,e),{$metadata:ro(t)}),edt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=vdt(r,e),{$metadata:ro(t),...n}},tdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},rdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=Kgr(r,e),{$metadata:ro(t),...n}},ndt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},odt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},idt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},adt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},sdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},udt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=Jgr(r,e),{$metadata:ro(t),...n}},ldt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},cdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},ddt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},fdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},pdt=async(t,e)=>t.statusCode>=300?Ua(t,e):(await DT(t.body,e),{$metadata:ro(t)}),mdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},hdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},gdt=async(t,e)=>t.statusCode>=300?Ua(t,e):(await DT(t.body,e),{$metadata:ro(t)}),ydt=async(t,e)=>t.statusCode>=300?Ua(t,e):(await DT(t.body,e),{$metadata:ro(t)}),bdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},_dt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},Ua=async(t,e)=>{let r={...t,body:await Aut(t.body,e)},n=Iut(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":throw await kgr(r,e);case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":throw await Bgr(r,e);case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":throw await qgr(r,e);case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":throw await Ugr(r,e);case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":throw await zgr(r,e);case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":throw await Vgr(r,e);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":throw await Hgr(r,e);case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":throw await Fgr(r,e);case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":throw await $gr(r,e);case"DeveloperUserAlreadyRegisteredException":case"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException":throw await Lgr(r,e);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentity#ConcurrentModificationException":throw await Dgr(r,e);default:let o=r.body;return Ygr({output:t,parsedBody:o,errorCode:n})}},Dgr=async(t,e)=>{let r=t.body,n=or(r),o=new _X({$metadata:ro(t),...n});return qa(o,r)},Lgr=async(t,e)=>{let r=t.body,n=or(r),o=new bX({$metadata:ro(t),...n});return qa(o,r)},Fgr=async(t,e)=>{let r=t.body,n=or(r),o=new gX({$metadata:ro(t),...n});return qa(o,r)},kgr=async(t,e)=>{let r=t.body,n=or(r),o=new lX({$metadata:ro(t),...n});return qa(o,r)},$gr=async(t,e)=>{let r=t.body,n=or(r),o=new yX({$metadata:ro(t),...n});return qa(o,r)},Bgr=async(t,e)=>{let r=t.body,n=or(r),o=new cX({$metadata:ro(t),...n});return qa(o,r)},qgr=async(t,e)=>{let r=t.body,n=or(r),o=new dX({$metadata:ro(t),...n});return qa(o,r)},Ugr=async(t,e)=>{let r=t.body,n=or(r),o=new fX({$metadata:ro(t),...n});return qa(o,r)},zgr=async(t,e)=>{let r=t.body,n=or(r),o=new pX({$metadata:ro(t),...n});return qa(o,r)},Hgr=async(t,e)=>{let r=t.body,n=or(r),o=new hX({$metadata:ro(t),...n});return qa(o,r)},Vgr=async(t,e)=>{let r=t.body,n=or(r),o=new mX({$metadata:ro(t),...n});return qa(o,r)},Wgr=(t,e)=>Z3(t,{AccessKeyId:ln,Expiration:r=>_k(AZ(R1(r))),SecretKey:ln,SessionToken:ln}),Kgr=(t,e)=>Z3(t,{Credentials:r=>Wgr(r,e),IdentityId:ln}),Ggr=(t,e)=>(t||[]).filter(n=>n!=null).map(n=>vdt(n,e)),vdt=(t,e)=>Z3(t,{CreationDate:r=>_k(AZ(R1(r))),IdentityId:ln,LastModifiedDate:r=>_k(AZ(R1(r))),Logins:or}),Jgr=(t,e)=>Z3(t,{Identities:r=>Ggr(r,e),IdentityPoolId:ln,NextToken:ln}),ro=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"]}),Ygr=IZ(Hd),za=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 aX(l)}});var vX,Nwe=w(()=>{zn();to();ar();ua();Oa();vX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").f(void 0,void 0).ser(Tct).de(Zct).build(){}});var wX,Dwe=w(()=>{zn();to();ar();ua();Oa();wX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").f(void 0,void 0).ser(Act).de(Xct).build(){}});var SX,Lwe=w(()=>{zn();to();ar();ua();Oa();SX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").f(void 0,void 0).ser(Ict).de(Qct).build(){}});var xX,Fwe=w(()=>{zn();to();ar();ua();Oa();xX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").f(void 0,void 0).ser(Mct).de(edt).build(){}});var CX,kwe=w(()=>{zn();to();ar();ua();Oa();CX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").f(void 0,void 0).ser(Rct).de(tdt).build(){}});var Tk,$we=w(()=>{zn();to();ar();ua();Oa();Tk=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").f(void 0,void 0).ser(jct).de(rdt).build(){}});var Ak,Bwe=w(()=>{zn();to();ar();ua();Oa();Ak=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").f(void 0,void 0).ser(Nct).de(ndt).build(){}});var OX,qwe=w(()=>{zn();to();ar();ua();Oa();OX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").f(void 0,void 0).ser(Dct).de(odt).build(){}});var PX,Uwe=w(()=>{zn();to();ar();ua();Oa();PX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").f(void 0,void 0).ser(Lct).de(idt).build(){}});var EX,zwe=w(()=>{zn();to();ar();ua();Oa();EX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").f(void 0,void 0).ser(Fct).de(adt).build(){}});var TX,Hwe=w(()=>{zn();to();ar();ua();Oa();TX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(kct).de(sdt).build(){}});var AX,Vwe=w(()=>{zn();to();ar();ua();Oa();AX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").f(void 0,void 0).ser($ct).de(udt).build(){}});var Ik,IX=w(()=>{zn();to();ar();ua();Oa();Ik=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").f(void 0,void 0).ser(Bct).de(ldt).build(){}});var MX,Wwe=w(()=>{zn();to();ar();ua();Oa();MX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").f(void 0,void 0).ser(qct).de(cdt).build(){}});var RX,Kwe=w(()=>{zn();to();ar();ua();Oa();RX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").f(void 0,void 0).ser(Uct).de(ddt).build(){}});var jX,Gwe=w(()=>{zn();to();ar();ua();Oa();jX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").f(void 0,void 0).ser(zct).de(fdt).build(){}});var NX,Jwe=w(()=>{zn();to();ar();ua();Oa();NX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").f(void 0,void 0).ser(Hct).de(pdt).build(){}});var DX,Ywe=w(()=>{zn();to();ar();ua();Oa();DX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(Vct).de(mdt).build(){}});var LX,Zwe=w(()=>{zn();to();ar();ua();Oa();LX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").f(void 0,void 0).ser(Wct).de(hdt).build(){}});var FX,Xwe=w(()=>{zn();to();ar();ua();Oa();FX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").f(void 0,void 0).ser(Kct).de(gdt).build(){}});var kX,Qwe=w(()=>{zn();to();ar();ua();Oa();kX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").f(void 0,void 0).ser(Gct).de(ydt).build(){}});var $X,e0e=w(()=>{zn();to();ar();ua();Oa();$X=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").f(void 0,void 0).ser(Jct).de(bdt).build(){}});var BX,t0e=w(()=>{zn();to();ar();ua();Oa();BX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").f(void 0,void 0).ser(Yct).de(_dt).build(){}});var Zgr,r0e,wdt=w(()=>{ar();uX();Nwe();Dwe();Lwe();Fwe();kwe();$we();Bwe();qwe();Uwe();zwe();Hwe();Vwe();IX();Wwe();Kwe();Gwe();Jwe();Ywe();Zwe();Xwe();Qwe();e0e();t0e();Zgr={CreateIdentityPoolCommand:vX,DeleteIdentitiesCommand:wX,DeleteIdentityPoolCommand:SX,DescribeIdentityCommand:xX,DescribeIdentityPoolCommand:CX,GetCredentialsForIdentityCommand:Tk,GetIdCommand:Ak,GetIdentityPoolRolesCommand:OX,GetOpenIdTokenCommand:PX,GetOpenIdTokenForDeveloperIdentityCommand:EX,GetPrincipalTagAttributeMapCommand:TX,ListIdentitiesCommand:AX,ListIdentityPoolsCommand:Ik,ListTagsForResourceCommand:MX,LookupDeveloperIdentityCommand:RX,MergeDeveloperIdentitiesCommand:jX,SetIdentityPoolRolesCommand:NX,SetPrincipalTagAttributeMapCommand:DX,TagResourceCommand:LX,UnlinkDeveloperIdentityCommand:FX,UnlinkIdentityCommand:kX,UntagResourceCommand:$X,UpdateIdentityPoolCommand:BX},r0e=class extends BT{};TZ(Zgr,r0e)});var Sdt=w(()=>{Nwe();Dwe();Lwe();Fwe();kwe();$we();Bwe();qwe();Uwe();zwe();Hwe();Vwe();IX();Wwe();Kwe();Gwe();Jwe();Ywe();Zwe();Xwe();Qwe();e0e();t0e()});var xdt=w(()=>{});var lpo,Cdt=w(()=>{LT();uX();IX();lpo=Dve(BT,Ik,"NextToken","NextToken","MaxResults")});var Odt=w(()=>{xdt();Cdt()});var Pdt=w(()=>{jwe()});var Edt=w(()=>{uX();wdt();Sdt();Odt();Pdt()});var n0e={};Cf(n0e,{CognitoIdentityClient:()=>BT,GetCredentialsForIdentityCommand:()=>Tk,GetIdCommand:()=>Ak});var o0e=w(()=>{Edt()});function qX(t){return async()=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:r}=await Promise.resolve().then(()=>(o0e(),n0e)),{Credentials:{AccessKeyId:n=Xgr(t.logger),Expiration:o,SecretKey:i=eyr(t.logger),SessionToken:a}=Qgr(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 BY(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:n,secretAccessKey:i,sessionToken:a,expiration:o}}}function Xgr(t){throw new Tl("Response from Amazon Cognito contained no access key ID",{logger:t})}function Qgr(t){throw new Tl("Response from Amazon Cognito contained no credentials",{logger:t})}function eyr(t){throw new Tl("Response from Amazon Cognito contained no secret key",{logger:t})}var i0e=w(()=>{aO();C_e()});var a0e,UX,Tdt=w(()=>{a0e="IdentityIds",UX=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(a0e,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(a0e,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(a0e)))}).catch(i=>{throw n.close(),i})})}}});var zX,Adt=w(()=>{zX=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 Idt(){return typeof self=="object"&&self.indexedDB?new UX:typeof window=="object"&&window.localStorage?window.localStorage:tyr}var tyr,Mdt=w(()=>{Tdt();Adt();tyr=new zX});function Rdt({accountId:t,cache:e=Idt(),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(()=>(o0e(),n0e)),m=r??new p(Object.assign({},n??{},{region:n?.region??l?.region})),h=c&&await e.getItem(c);if(!h){let{IdentityId:b=ryr(u)}=await m.send(new f({AccountId:t,IdentityPoolId:i,Logins:a?await BY(a):void 0}));h=b,c&&Promise.resolve(e.setItem(c,h)).catch(()=>{})}return d=qX({client:m,customRoleArn:o,logins:a,identityId:h}),d()};return()=>d().catch(async f=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),f})}function ryr(t){throw new Tl("Response from Amazon Cognito contained no identity ID",{logger:t})}var jdt=w(()=>{aO();i0e();Mdt();C_e()});var s0e=w(()=>{Ket();Get();Jet();i0e();jdt()});var nyr,Ndt=w(()=>{s0e();nyr=t=>qX({...t})});var oyr,Ddt=w(()=>{s0e();oyr=t=>Rdt({...t})});var iyr,ayr,syr,Ldt,Fdt=w(()=>{aO();iyr="169.254.170.2",ayr="169.254.170.23",syr="[fd00:ec2::23]",Ldt=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===iyr||t.hostname===ayr||t.hostname===syr)){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 Tl(`URL not accepted. It must either be HTTPS or match one of the following: +`);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]),Nve(s)}return{}}),hlt=async(t,e)=>{let r=await R_(t,e);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r}});var ylt=w(()=>{Mut();Rut();Dut();glt()});var k1=w(()=>{Rst();Iut();ylt()});function Agr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function QZ(t){return{schemeId:"smithy.api#noAuth"}}var blt,_lt,vlt,gwe=w(()=>{k1();jy();blt=async(t,e,r)=>({operation:A_(e).operation,region:await zd(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});_lt=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(QZ(t));break}case"GetId":{e.push(QZ(t));break}case"GetOpenIdToken":{e.push(QZ(t));break}case"UnlinkIdentity":{e.push(QZ(t));break}default:e.push(Agr(t))}return e},vlt=t=>({...YZ(t)})});var wlt,Cr,ua=w(()=>{wlt=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),Cr={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var xlt,Slt=w(()=>{xlt={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 ywe,bwe,Clt,Olt=w(()=>{ywe={name:"SHA-256"},bwe={name:"HMAC",hash:ywe},Clt=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 Ok(){return typeof window<"u"?window:typeof self<"u"?self:Mgr}var Mgr,_we=w(()=>{Mgr={}});var Pk,vwe,wwe=w(()=>{Pk=F(FY());Olt();_we();vwe=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,Pk.isEmptyData)(e)){var r=(0,Pk.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 Ok().crypto.subtle.sign(bwe,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,Pk.isEmptyData)(this.toHash)?Promise.resolve(Clt):Promise.resolve().then(function(){return Ok().crypto.subtle.digest(ywe,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){Ok().crypto.subtle.importKey("raw",(0,Pk.convertToBuffer)(e.secret),bwe,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function Plt(t){if(jgr(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return Ngr(e)}return!1}function jgr(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function Ngr(t){return t&&Rgr.every(function(e){return typeof t[e]=="function"})}var Rgr,Elt=w(()=>{Rgr=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var Tlt=w(()=>{Elt()});var Alt,Ilt,eX,Mlt=w(()=>{wwe();Alt=F(P_e());Tlt();_we();Ilt=F(FY()),eX=function(){function t(e){Plt(Ok())?this.hash=new vwe(e):this.hash=new Alt.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,Ilt.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var Swe=w(()=>{Mlt();wwe()});var Cwe=v((lH,xwe)=>{(function(t,e){typeof lH=="object"&&typeof xwe=="object"?xwe.exports=e():typeof define=="function"&&define.amd?define([],e):typeof lH=="object"?lH.bowser=e():t.bowser=e()})(lH,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(n,o,i){r.o(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:i})},r.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,o){if(1&o&&(n=r(n)),8&o||4&o&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&o&&typeof n!="string")for(var a in n)r.d(i,a,function(s){return n[s]}.bind(null,a));return i},r.n=function(n){var o=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(o,"a",o),o},r.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)},r.p="",r(r.s=90)}({17:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=r(18),o=function(){function i(){}return i.getFirstMatch=function(a,s){var u=s.match(a);return u&&u.length>0&&u[1]||""},i.getSecondMatch=function(a,s){var u=s.match(a);return u&&u.length>1&&u[2]||""},i.matchAndReturnConst=function(a,s,u){if(a.test(s))return u},i.getWindowsVersionName=function(a){switch(a){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),s[0]===10)switch(s[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},i.getAndroidVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),!(s[0]===1&&s[1]<5))return s[0]===1&&s[1]<6?"Cupcake":s[0]===1&&s[1]>=6?"Donut":s[0]===2&&s[1]<2?"Eclair":s[0]===2&&s[1]===2?"Froyo":s[0]===2&&s[1]>2?"Gingerbread":s[0]===3?"Honeycomb":s[0]===4&&s[1]<1?"Ice Cream Sandwich":s[0]===4&&s[1]<4?"Jelly Bean":s[0]===4&&s[1]>=4?"KitKat":s[0]===5?"Lollipop":s[0]===6?"Marshmallow":s[0]===7?"Nougat":s[0]===8?"Oreo":s[0]===9?"Pie":void 0},i.getVersionPrecision=function(a){return a.split(".").length},i.compareVersions=function(a,s,u){u===void 0&&(u=!1);var l=i.getVersionPrecision(a),c=i.getVersionPrecision(s),d=Math.max(l,c),f=0,p=i.map([a,s],function(m){var h=d-i.getVersionPrecision(m),b=m+new Array(h+1).join(".0");return i.map(b.split("."),function(g){return new Array(20-g.length).join("0")+g}).reverse()});for(u&&(f=d-Math.min(l,c)),d-=1;d>=f;){if(p[0][d]>p[1][d])return 1;if(p[0][d]===p[1][d]){if(d===f)return 0;d-=1}else if(p[0][d]1?c-1:0),f=1;f0){var y=Object.keys(m),S=s.default.find(y,function(I){return p.isOS(I)});if(S){var x=this.satisfies(m[S]);if(x!==void 0)return x}var O=s.default.find(y,function(I){return p.isPlatform(I)});if(O){var P=this.satisfies(m[O]);if(P!==void 0)return P}}if(g>0){var E=Object.keys(b),A=s.default.find(E,function(I){return p.isBrowser(I,!0)});if(A!==void 0)return this.compareVersion(b[A])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var m=this.getBrowserName().toLowerCase(),h=f.toLowerCase(),b=s.default.getBrowserTypeByAlias(h);return p&&b&&(h=b.toLowerCase()),h===m},d.compareVersion=function(f){var p=[0],m=f,h=!1,b=this.getBrowserVersion();if(typeof b=="string")return f[0]===">"||f[0]==="<"?(m=f.substr(1),f[1]==="="?(h=!0,m=f.substr(2)):p=[],f[0]===">"?p.push(1):p.push(-1)):f[0]==="="?m=f.substr(1):f[0]==="~"&&(h=!0,m=f.substr(1)),p.indexOf(s.default.compareVersions(b,m,h))>-1},d.isOS=function(f){return this.getOSName(!0)===String(f).toLowerCase()},d.isPlatform=function(f){return this.getPlatformType(!0)===String(f).toLowerCase()},d.isEngine=function(f){return this.getEngineName(!0)===String(f).toLowerCase()},d.is=function(f,p){return p===void 0&&(p=!1),this.isBrowser(f,p)||this.isOS(f)||this.isPlatform(f)},d.some=function(f){var p=this;return f===void 0&&(f=[]),f.some(function(m){return p.is(m)})},c}();e.default=l,t.exports=e.default},92:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(s){var u={name:"Googlebot"},l=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/opera/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opr\/|opios/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/SamsungBrowser/i],describe:function(s){var u={name:"Samsung Internet for Android"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Whale/i],describe:function(s){var u={name:"NAVER Whale Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MZBrowser/i],describe:function(s){var u={name:"MZ Browser"},l=o.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/focus/i],describe:function(s){var u={name:"Focus"},l=o.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/swing/i],describe:function(s){var u={name:"Swing"},l=o.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/coast/i],describe:function(s){var u={name:"Opera Coast"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(s){var u={name:"Opera Touch"},l=o.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/yabrowser/i],describe:function(s){var u={name:"Yandex Browser"},l=o.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/ucbrowser/i],describe:function(s){var u={name:"UC Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Maxthon|mxios/i],describe:function(s){var u={name:"Maxthon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/epiphany/i],describe:function(s){var u={name:"Epiphany"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/puffin/i],describe:function(s){var u={name:"Puffin"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sleipnir/i],describe:function(s){var u={name:"Sleipnir"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/k-meleon/i],describe:function(s){var u={name:"K-Meleon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/micromessenger/i],describe:function(s){var u={name:"WeChat"},l=o.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qqbrowser/i],describe:function(s){var u={name:/qqbrowserlite/i.test(s)?"QQ Browser Lite":"QQ Browser"},l=o.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/msie|trident/i],describe:function(s){var u={name:"Internet Explorer"},l=o.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/\sedg\//i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/edg([ea]|ios)/i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/vivaldi/i],describe:function(s){var u={name:"Vivaldi"},l=o.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/seamonkey/i],describe:function(s){var u={name:"SeaMonkey"},l=o.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sailfish/i],describe:function(s){var u={name:"Sailfish"},l=o.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,s);return l&&(u.version=l),u}},{test:[/silk/i],describe:function(s){var u={name:"Amazon Silk"},l=o.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/phantom/i],describe:function(s){var u={name:"PhantomJS"},l=o.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/slimerjs/i],describe:function(s){var u={name:"SlimerJS"},l=o.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u={name:"BlackBerry"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u={name:"WebOS Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/bada/i],describe:function(s){var u={name:"Bada"},l=o.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/tizen/i],describe:function(s){var u={name:"Tizen"},l=o.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qupzilla/i],describe:function(s){var u={name:"QupZilla"},l=o.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/firefox|iceweasel|fxios/i],describe:function(s){var u={name:"Firefox"},l=o.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/electron/i],describe:function(s){var u={name:"Electron"},l=o.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MiuiBrowser/i],describe:function(s){var u={name:"Miui"},l=o.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/chromium/i],describe:function(s){var u={name:"Chromium"},l=o.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/chrome|crios|crmo/i],describe:function(s){var u={name:"Chrome"},l=o.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/GSA/i],describe:function(s){var u={name:"Google Search"},l=o.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u={name:"Android Browser"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/playstation 4/i],describe:function(s){var u={name:"PlayStation 4"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/safari|applewebkit/i],describe:function(s){var u={name:"Safari"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/.*/i],describe:function(s){var u=s.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:o.default.getFirstMatch(u,s),version:o.default.getSecondMatch(u,s)}}}];e.default=a,t.exports=e.default},93:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/Roku\/DVP/],describe:function(s){var u=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,s);return{name:i.OS_MAP.Roku,version:u}}},{test:[/windows phone/i],describe:function(s){var u=o.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.WindowsPhone,version:u}}},{test:[/windows /i],describe:function(s){var u=o.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,s),l=o.default.getWindowsVersionName(u);return{name:i.OS_MAP.Windows,version:u,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(s){var u={name:i.OS_MAP.iOS},l=o.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,s);return l&&(u.version=l),u}},{test:[/macintosh/i],describe:function(s){var u=o.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,s).replace(/[_\s]/g,"."),l=o.default.getMacOSVersionName(u),c={name:i.OS_MAP.MacOS,version:u};return l&&(c.versionName=l),c}},{test:[/(ipod|iphone|ipad)/i],describe:function(s){var u=o.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,s).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:u}}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u=o.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,s),l=o.default.getAndroidVersionName(u),c={name:i.OS_MAP.Android,version:u};return l&&(c.versionName=l),c}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u=o.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,s),l={name:i.OS_MAP.WebOS};return u&&u.length&&(l.version=u),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u=o.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,s)||o.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,s)||o.default.getFirstMatch(/\bbb(\d+)/i,s);return{name:i.OS_MAP.BlackBerry,version:u}}},{test:[/bada/i],describe:function(s){var u=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Bada,version:u}}},{test:[/tizen/i],describe:function(s){var u=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Tizen,version:u}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(s){var u=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.PlayStation4,version:u}}}];e.default=a,t.exports=e.default},94:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(s){var u=o.default.getFirstMatch(/(can-l01)/i,s)&&"Nova",l={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return u&&(l.model=u),l}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){var u=s.test(/ipod|iphone/i),l=s.test(/like (ipod|iphone)/i);return u&&!l},describe:function(s){var u=o.default.getFirstMatch(/(ipod|iphone)/i,s);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:u}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName(!0)==="blackberry"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(s){return s.getBrowserName(!0)==="bada"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName()==="windows phone"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(s){var u=Number(String(s.getOSVersion()).split(".")[0]);return s.getOSName(!0)==="android"&&u>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){return s.getOSName(!0)==="android"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getOSName(!0)==="macos"},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(s){return s.getOSName(!0)==="windows"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="linux"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="playstation 4"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(s){return s.getOSName(!0)==="roku"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];e.default=a,t.exports=e.default},95:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:function(s){return s.getBrowserName(!0)==="microsoft edge"},describe:function(s){if(/\sedg\//i.test(s))return{name:i.ENGINE_MAP.Blink};var u=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:i.ENGINE_MAP.EdgeHTML,version:u}}},{test:[/trident/i],describe:function(s){var u={name:i.ENGINE_MAP.Trident},l=o.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){return s.test(/presto/i)},describe:function(s){var u={name:i.ENGINE_MAP.Presto},l=o.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=s.test(/gecko/i),l=s.test(/like gecko/i);return u&&!l},describe:function(s){var u={name:i.ENGINE_MAP.Gecko},l=o.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(s){var u={name:i.ENGINE_MAP.WebKit},l=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}}];e.default=a,t.exports=e.default}})})});var Rlt,tX,Owe=w(()=>{Rlt=F(Cwe()),tX=({serviceId:t,clientVersion:e})=>async()=>{let r=typeof window<"u"&&window?.navigator?.userAgent?Rlt.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 jlt=w(()=>{});var rX,Nlt=w(()=>{rX=t=>()=>Promise.reject(t)});var Pwe=w(()=>{jlt();Nlt()});var Dlt,nX,Llt=w(()=>{Dlt=typeof TextEncoder=="function"?new TextEncoder:null,nX=t=>{if(typeof t=="string"){if(Dlt)return Dlt.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 Ewe=w(()=>{Llt()});var Twe,Awe=w(()=>{Twe=t=>new TextEncoder().encode(t)});var Flt=w(()=>{Awe()});var klt,$lt=w(()=>{klt=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 Blt=w(()=>{Awe();Flt();$lt()});var Ylt,N_,D_,Tk,qlt,dH,Ek,cH,pO,Iwe,Ult,zlt,Hlt,Zlt,Xlt,j_,Vlt,Wlt,Klt,Glt,Jlt,Dgr,Qlt,ect=w(()=>{Ylt="required",N_="fn",D_="argv",Tk="ref",qlt="isSet",dH="booleanEquals",Ek="error",cH="endpoint",pO="tree",Iwe="PartitionResult",Ult={[Ylt]:!1,type:"String"},zlt={[Ylt]:!0,default:!1,type:"Boolean"},Hlt={[Tk]:"Endpoint"},Zlt={[N_]:dH,[D_]:[{[Tk]:"UseFIPS"},!0]},Xlt={[N_]:dH,[D_]:[{[Tk]:"UseDualStack"},!0]},j_={},Vlt={[N_]:"getAttr",[D_]:[{[Tk]:Iwe},"supportsFIPS"]},Wlt={[N_]:dH,[D_]:[!0,{[N_]:"getAttr",[D_]:[{[Tk]:Iwe},"supportsDualStack"]}]},Klt=[Zlt],Glt=[Xlt],Jlt=[{[Tk]:"Region"}],Dgr={version:"1.0",parameters:{Region:Ult,UseDualStack:zlt,UseFIPS:zlt,Endpoint:Ult},rules:[{conditions:[{[N_]:qlt,[D_]:[Hlt]}],rules:[{conditions:Klt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Ek},{conditions:Glt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Ek},{endpoint:{url:Hlt,properties:j_,headers:j_},type:cH}],type:pO},{conditions:[{[N_]:qlt,[D_]:Jlt}],rules:[{conditions:[{[N_]:"aws.partition",[D_]:Jlt,assign:Iwe}],rules:[{conditions:[Zlt,Xlt],rules:[{conditions:[{[N_]:dH,[D_]:[!0,Vlt]},Wlt],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:j_,headers:j_},type:cH}],type:pO},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Ek}],type:pO},{conditions:Klt,rules:[{conditions:[{[N_]:dH,[D_]:[Vlt,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:j_,headers:j_},type:cH}],type:pO},{error:"FIPS is enabled but this partition does not support FIPS",type:Ek}],type:pO},{conditions:Glt,rules:[{conditions:[Wlt],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:j_,headers:j_},type:cH}],type:pO},{error:"DualStack is enabled but this partition does not support DualStack",type:Ek}],type:pO},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:j_,headers:j_},type:cH}],type:pO}],type:pO},{error:"Invalid Configuration: Missing Region",type:Ek}]},Qlt=Dgr});var tct,rct=w(()=>{tZ();ET();ect();tct=(t,e={})=>$3(Qlt,{endpointParams:t,logger:e.logger});uO.aws=B3});var nct,oct=w(()=>{k1();LT();ar();fZ();bk();Blt();gwe();rct();nct=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??RT,base64Encoder:t?.base64Encoder??jT,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??tct,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??_lt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new D1},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new xk}],logger:t?.logger??new AT,serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??TT,utf8Decoder:t?.utf8Decoder??Twe,utf8Encoder:t?.utf8Encoder??klt})});var ict,act=w(()=>{ict=["in-region","cross-region","mobile","standard","legacy"]});var sct,oX,Lgr,uct=w(()=>{sO();sct=F(Cwe());act();oX=({defaultsMode:t}={})=>ott(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(Lgr()?"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 ${ict.join(", ")}, got ${e}`)}}),Lgr=()=>{let e=(typeof window<"u"&&window?.navigator?.userAgent?sct.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return e==="tablet"||e==="mobile"}});var Mwe=w(()=>{uct()});var lct,cct=w(()=>{Slt();Swe();Owe();q3();J3();Pwe();Ewe();M_();oct();ar();Mwe();lct=t=>{let e=oX(t),r=()=>e().then(RZ),n=nct(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??nX,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??tX({serviceId:n.serviceId,clientVersion:xlt.version}),maxAttempts:t?.maxAttempts??I_,region:t?.region??rX("Region is missing"),requestHandler:NT.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||H3),sha256:t?.sha256??eX,streamCollector:t?.streamCollector??_k,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(sZ)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(uZ))}}});var iX,aX,dct=w(()=>{iX=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}}},aX=t=>({region:t.region()})});var fct=w(()=>{});var Rwe=w(()=>{});var pct=w(()=>{Rwe()});var mct=w(()=>{pct();Rwe()});var hct=w(()=>{fct();mct()});var jwe=w(()=>{dct();hct()});var gct,yct,bct=w(()=>{gct=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},yct=t=>({httpHandler:t.httpHandler()})});var _ct=w(()=>{bct()});var vct=w(()=>{Hs()});var wct=w(()=>{});var Sct=w(()=>{});function kgr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var sX,xct=w(()=>{sX=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=kgr(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 Cct=w(()=>{});var Oct=w(()=>{});var Pct=w(()=>{});var Nwe=w(()=>{_ct();vct();wct();Sct();xct();Cct();Oct();Pct()});var Ect,Tct,Act=w(()=>{Ect=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}}},Tct=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var uX,Ict,Mct=w(()=>{jwe();Nwe();ar();Act();uX=t=>t,Ict=(t,e)=>{let r={...uX(iX(t)),...uX(jZ(t)),...uX(gct(t)),...uX(Ect(t))};return e.forEach(n=>n.configure(r)),{...t,...aX(r),...NZ(r),...yct(r),...Tct(r)}}});var BT,lX=w(()=>{I_e();M_e();R_e();J_e();q3();LT();$ve();zn();FZ();ar();gwe();ua();cct();Mct();BT=class extends I1{constructor(...[e]){let r=lct(e||{}),n=wlt(r),o=KY(n),i=OZ(o),a=cZ(i),s=a,u=hZ(s),l=vlt(u),c=Ict(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(iZ(this.config)),this.middlewareStack.use(LZ(this.config)),this.middlewareStack.use(BZ(this.config)),this.middlewareStack.use(zY(this.config)),this.middlewareStack.use(HY(this.config)),this.middlewareStack.use(WY(this.config)),this.middlewareStack.use(gZ(this.config,{httpAuthSchemeParametersProvider:blt,identityProviderConfigProvider:async d=>new Sk({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(kZ(this.config))}destroy(){super.destroy()}}});var Hd,Dwe=w(()=>{ar();Hd=class t extends wk{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var cX,dX,fX,pX,mX,hX,gX,yX,bX,_X,vX,Lwe=w(()=>{Dwe();cX=class t extends Hd{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,t.prototype)}},dX=class t extends Hd{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},fX=class t extends Hd{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},pX=class t extends Hd{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},mX=class t extends Hd{constructor(e){super({name:"ResourceConflictException",$fault:"client",...e}),this.name="ResourceConflictException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},hX=class t extends Hd{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},gX=class t extends Hd{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},yX=class t extends Hd{constructor(e){super({name:"ExternalServiceException",$fault:"client",...e}),this.name="ExternalServiceException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},bX=class t extends Hd{constructor(e){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...e}),this.name="InvalidIdentityPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_X=class t extends Hd{constructor(e){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...e}),this.name="DeveloperUserAlreadyRegisteredException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},vX=class t extends Hd{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}}});function Ha(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}}var Rct,jct,Nct,Dct,Lct,Fct,kct,$ct,Bct,qct,Uct,zct,Hct,Vct,Wct,Kct,Gct,Jct,Yct,Zct,Xct,Qct,edt,tdt,rdt,ndt,odt,idt,adt,sdt,udt,ldt,cdt,ddt,fdt,pdt,mdt,hdt,gdt,ydt,bdt,_dt,vdt,wdt,Sdt,xdt,Ua,Bgr,qgr,Ugr,zgr,Hgr,Vgr,Wgr,Kgr,Ggr,Jgr,Ygr,Zgr,Xgr,Qgr,Cdt,eyr,ro,tyr,za,Oa=w(()=>{k1();Nwe();ar();Dwe();Lwe();Rct=async(t,e)=>{let r=Ha("CreateIdentityPool"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},jct=async(t,e)=>{let r=Ha("DeleteIdentities"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Nct=async(t,e)=>{let r=Ha("DeleteIdentityPool"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Dct=async(t,e)=>{let r=Ha("DescribeIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Lct=async(t,e)=>{let r=Ha("DescribeIdentityPool"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Fct=async(t,e)=>{let r=Ha("GetCredentialsForIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},kct=async(t,e)=>{let r=Ha("GetId"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},$ct=async(t,e)=>{let r=Ha("GetIdentityPoolRoles"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Bct=async(t,e)=>{let r=Ha("GetOpenIdToken"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},qct=async(t,e)=>{let r=Ha("GetOpenIdTokenForDeveloperIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Uct=async(t,e)=>{let r=Ha("GetPrincipalTagAttributeMap"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},zct=async(t,e)=>{let r=Ha("ListIdentities"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Hct=async(t,e)=>{let r=Ha("ListIdentityPools"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Vct=async(t,e)=>{let r=Ha("ListTagsForResource"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Wct=async(t,e)=>{let r=Ha("LookupDeveloperIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Kct=async(t,e)=>{let r=Ha("MergeDeveloperIdentities"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Gct=async(t,e)=>{let r=Ha("SetIdentityPoolRoles"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Jct=async(t,e)=>{let r=Ha("SetPrincipalTagAttributeMap"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Yct=async(t,e)=>{let r=Ha("TagResource"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Zct=async(t,e)=>{let r=Ha("UnlinkDeveloperIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Xct=async(t,e)=>{let r=Ha("UnlinkIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Qct=async(t,e)=>{let r=Ha("UntagResource"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},edt=async(t,e)=>{let r=Ha("UpdateIdentityPool"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},tdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},rdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},ndt=async(t,e)=>t.statusCode>=300?Ua(t,e):(await DT(t.body,e),{$metadata:ro(t)}),odt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=Cdt(r,e),{$metadata:ro(t),...n}},idt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},adt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=Xgr(r,e),{$metadata:ro(t),...n}},sdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},udt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},ldt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},cdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},ddt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},fdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=eyr(r,e),{$metadata:ro(t),...n}},pdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},mdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},hdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},gdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},ydt=async(t,e)=>t.statusCode>=300?Ua(t,e):(await DT(t.body,e),{$metadata:ro(t)}),bdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},_dt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},vdt=async(t,e)=>t.statusCode>=300?Ua(t,e):(await DT(t.body,e),{$metadata:ro(t)}),wdt=async(t,e)=>t.statusCode>=300?Ua(t,e):(await DT(t.body,e),{$metadata:ro(t)}),Sdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},xdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},Ua=async(t,e)=>{let r={...t,body:await jut(t.body,e)},n=Nut(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":throw await zgr(r,e);case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":throw await Vgr(r,e);case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":throw await Wgr(r,e);case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":throw await Kgr(r,e);case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":throw await Ggr(r,e);case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":throw await Ygr(r,e);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":throw await Jgr(r,e);case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":throw await Ugr(r,e);case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":throw await Hgr(r,e);case"DeveloperUserAlreadyRegisteredException":case"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException":throw await qgr(r,e);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentity#ConcurrentModificationException":throw await Bgr(r,e);default:let o=r.body;return tyr({output:t,parsedBody:o,errorCode:n})}},Bgr=async(t,e)=>{let r=t.body,n=or(r),o=new vX({$metadata:ro(t),...n});return qa(o,r)},qgr=async(t,e)=>{let r=t.body,n=or(r),o=new _X({$metadata:ro(t),...n});return qa(o,r)},Ugr=async(t,e)=>{let r=t.body,n=or(r),o=new yX({$metadata:ro(t),...n});return qa(o,r)},zgr=async(t,e)=>{let r=t.body,n=or(r),o=new cX({$metadata:ro(t),...n});return qa(o,r)},Hgr=async(t,e)=>{let r=t.body,n=or(r),o=new bX({$metadata:ro(t),...n});return qa(o,r)},Vgr=async(t,e)=>{let r=t.body,n=or(r),o=new dX({$metadata:ro(t),...n});return qa(o,r)},Wgr=async(t,e)=>{let r=t.body,n=or(r),o=new fX({$metadata:ro(t),...n});return qa(o,r)},Kgr=async(t,e)=>{let r=t.body,n=or(r),o=new pX({$metadata:ro(t),...n});return qa(o,r)},Ggr=async(t,e)=>{let r=t.body,n=or(r),o=new mX({$metadata:ro(t),...n});return qa(o,r)},Jgr=async(t,e)=>{let r=t.body,n=or(r),o=new gX({$metadata:ro(t),...n});return qa(o,r)},Ygr=async(t,e)=>{let r=t.body,n=or(r),o=new hX({$metadata:ro(t),...n});return qa(o,r)},Zgr=(t,e)=>X3(t,{AccessKeyId:ln,Expiration:r=>vk(IZ(j1(r))),SecretKey:ln,SessionToken:ln}),Xgr=(t,e)=>X3(t,{Credentials:r=>Zgr(r,e),IdentityId:ln}),Qgr=(t,e)=>(t||[]).filter(n=>n!=null).map(n=>Cdt(n,e)),Cdt=(t,e)=>X3(t,{CreationDate:r=>vk(IZ(j1(r))),IdentityId:ln,LastModifiedDate:r=>vk(IZ(j1(r))),Logins:or}),eyr=(t,e)=>X3(t,{Identities:r=>Qgr(r,e),IdentityPoolId:ln,NextToken:ln}),ro=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"]}),tyr=MZ(Hd),za=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 sX(l)}});var wX,Fwe=w(()=>{zn();to();ar();ua();Oa();wX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").f(void 0,void 0).ser(Rct).de(tdt).build(){}});var SX,kwe=w(()=>{zn();to();ar();ua();Oa();SX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").f(void 0,void 0).ser(jct).de(rdt).build(){}});var xX,$we=w(()=>{zn();to();ar();ua();Oa();xX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").f(void 0,void 0).ser(Nct).de(ndt).build(){}});var CX,Bwe=w(()=>{zn();to();ar();ua();Oa();CX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").f(void 0,void 0).ser(Dct).de(odt).build(){}});var OX,qwe=w(()=>{zn();to();ar();ua();Oa();OX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").f(void 0,void 0).ser(Lct).de(idt).build(){}});var Ak,Uwe=w(()=>{zn();to();ar();ua();Oa();Ak=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").f(void 0,void 0).ser(Fct).de(adt).build(){}});var Ik,zwe=w(()=>{zn();to();ar();ua();Oa();Ik=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").f(void 0,void 0).ser(kct).de(sdt).build(){}});var PX,Hwe=w(()=>{zn();to();ar();ua();Oa();PX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").f(void 0,void 0).ser($ct).de(udt).build(){}});var EX,Vwe=w(()=>{zn();to();ar();ua();Oa();EX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").f(void 0,void 0).ser(Bct).de(ldt).build(){}});var TX,Wwe=w(()=>{zn();to();ar();ua();Oa();TX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").f(void 0,void 0).ser(qct).de(cdt).build(){}});var AX,Kwe=w(()=>{zn();to();ar();ua();Oa();AX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(Uct).de(ddt).build(){}});var IX,Gwe=w(()=>{zn();to();ar();ua();Oa();IX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").f(void 0,void 0).ser(zct).de(fdt).build(){}});var Mk,MX=w(()=>{zn();to();ar();ua();Oa();Mk=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").f(void 0,void 0).ser(Hct).de(pdt).build(){}});var RX,Jwe=w(()=>{zn();to();ar();ua();Oa();RX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").f(void 0,void 0).ser(Vct).de(mdt).build(){}});var jX,Ywe=w(()=>{zn();to();ar();ua();Oa();jX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").f(void 0,void 0).ser(Wct).de(hdt).build(){}});var NX,Zwe=w(()=>{zn();to();ar();ua();Oa();NX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").f(void 0,void 0).ser(Kct).de(gdt).build(){}});var DX,Xwe=w(()=>{zn();to();ar();ua();Oa();DX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").f(void 0,void 0).ser(Gct).de(ydt).build(){}});var LX,Qwe=w(()=>{zn();to();ar();ua();Oa();LX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(Jct).de(bdt).build(){}});var FX,e0e=w(()=>{zn();to();ar();ua();Oa();FX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").f(void 0,void 0).ser(Yct).de(_dt).build(){}});var kX,t0e=w(()=>{zn();to();ar();ua();Oa();kX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").f(void 0,void 0).ser(Zct).de(vdt).build(){}});var $X,r0e=w(()=>{zn();to();ar();ua();Oa();$X=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").f(void 0,void 0).ser(Xct).de(wdt).build(){}});var BX,n0e=w(()=>{zn();to();ar();ua();Oa();BX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").f(void 0,void 0).ser(Qct).de(Sdt).build(){}});var qX,o0e=w(()=>{zn();to();ar();ua();Oa();qX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").f(void 0,void 0).ser(edt).de(xdt).build(){}});var ryr,i0e,Odt=w(()=>{ar();lX();Fwe();kwe();$we();Bwe();qwe();Uwe();zwe();Hwe();Vwe();Wwe();Kwe();Gwe();MX();Jwe();Ywe();Zwe();Xwe();Qwe();e0e();t0e();r0e();n0e();o0e();ryr={CreateIdentityPoolCommand:wX,DeleteIdentitiesCommand:SX,DeleteIdentityPoolCommand:xX,DescribeIdentityCommand:CX,DescribeIdentityPoolCommand:OX,GetCredentialsForIdentityCommand:Ak,GetIdCommand:Ik,GetIdentityPoolRolesCommand:PX,GetOpenIdTokenCommand:EX,GetOpenIdTokenForDeveloperIdentityCommand:TX,GetPrincipalTagAttributeMapCommand:AX,ListIdentitiesCommand:IX,ListIdentityPoolsCommand:Mk,ListTagsForResourceCommand:RX,LookupDeveloperIdentityCommand:jX,MergeDeveloperIdentitiesCommand:NX,SetIdentityPoolRolesCommand:DX,SetPrincipalTagAttributeMapCommand:LX,TagResourceCommand:FX,UnlinkDeveloperIdentityCommand:kX,UnlinkIdentityCommand:$X,UntagResourceCommand:BX,UpdateIdentityPoolCommand:qX},i0e=class extends BT{};AZ(ryr,i0e)});var Pdt=w(()=>{Fwe();kwe();$we();Bwe();qwe();Uwe();zwe();Hwe();Vwe();Wwe();Kwe();Gwe();MX();Jwe();Ywe();Zwe();Xwe();Qwe();e0e();t0e();r0e();n0e();o0e()});var Edt=w(()=>{});var mpo,Tdt=w(()=>{LT();lX();MX();mpo=kve(BT,Mk,"NextToken","NextToken","MaxResults")});var Adt=w(()=>{Edt();Tdt()});var Idt=w(()=>{Lwe()});var Mdt=w(()=>{lX();Odt();Pdt();Adt();Idt()});var a0e={};Cf(a0e,{CognitoIdentityClient:()=>BT,GetCredentialsForIdentityCommand:()=>Ak,GetIdCommand:()=>Ik});var s0e=w(()=>{Mdt()});function UX(t){return async()=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:r}=await Promise.resolve().then(()=>(s0e(),a0e)),{Credentials:{AccessKeyId:n=nyr(t.logger),Expiration:o,SecretKey:i=iyr(t.logger),SessionToken:a}=oyr(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 qY(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:n,secretAccessKey:i,sessionToken:a,expiration:o}}}function nyr(t){throw new Tl("Response from Amazon Cognito contained no access key ID",{logger:t})}function oyr(t){throw new Tl("Response from Amazon Cognito contained no credentials",{logger:t})}function iyr(t){throw new Tl("Response from Amazon Cognito contained no secret key",{logger:t})}var u0e=w(()=>{sO();E_e()});var l0e,zX,Rdt=w(()=>{l0e="IdentityIds",zX=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(l0e,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(l0e,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(l0e)))}).catch(i=>{throw n.close(),i})})}}});var HX,jdt=w(()=>{HX=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 Ndt(){return typeof self=="object"&&self.indexedDB?new zX:typeof window=="object"&&window.localStorage?window.localStorage:ayr}var ayr,Ddt=w(()=>{Rdt();jdt();ayr=new HX});function Ldt({accountId:t,cache:e=Ndt(),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(()=>(s0e(),a0e)),m=r??new p(Object.assign({},n??{},{region:n?.region??l?.region})),h=c&&await e.getItem(c);if(!h){let{IdentityId:b=syr(u)}=await m.send(new f({AccountId:t,IdentityPoolId:i,Logins:a?await qY(a):void 0}));h=b,c&&Promise.resolve(e.setItem(c,h)).catch(()=>{})}return d=UX({client:m,customRoleArn:o,logins:a,identityId:h}),d()};return()=>d().catch(async f=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),f})}function syr(t){throw new Tl("Response from Amazon Cognito contained no identity ID",{logger:t})}var Fdt=w(()=>{sO();u0e();Ddt();E_e()});var c0e=w(()=>{Zet();Xet();Qet();u0e();Fdt()});var uyr,kdt=w(()=>{c0e();uyr=t=>UX({...t})});var lyr,$dt=w(()=>{c0e();lyr=t=>Ldt({...t})});var cyr,dyr,fyr,Bdt,qdt=w(()=>{sO();cyr="169.254.170.2",dyr="169.254.170.23",fyr="[fd00:ec2::23]",Bdt=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===cyr||t.hostname===dyr||t.hostname===fyr)){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 Tl(`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 kdt=w(()=>{});var $dt=w(()=>{kdt()});var Bdt=w(()=>{Hs()});var qdt=w(()=>{});var Udt=w(()=>{});function uyr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var HX,zdt=w(()=>{HX=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=uyr(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 Hdt=w(()=>{});var Vdt=w(()=>{});var Wdt=w(()=>{});var Kdt=w(()=>{$dt();Bdt();qdt();Udt();zdt();Hdt();Vdt();Wdt()});function Gdt(t){return new HX({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 Jdt(t,e){let n=await fat(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 Tl("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:Aat(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new Tl(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new Tl(`Server responded with status: ${t.statusCode}`,{logger:e})}var Ydt=w(()=>{aO();Kdt();ar();xve()});var Zdt,Xdt=w(()=>{Zdt=(t,e,r)=>async()=>{for(let n=0;nsetTimeout(i,r))}return await t()}});var u0e,Qdt=w(()=>{G3();aO();Fdt();Ydt();Xdt();u0e=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new Tl("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);Ldt(n,t.logger);let o=new NT;return Zdt(async()=>{let i=Gdt(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return Jdt(a.response)},t.maxRetries??3,t.timeout??1e3)}});var eft=w(()=>{Qdt()});function lyr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function tft(t){return{schemeId:"smithy.api#noAuth"}}var rft,nft,cyr,oft,l0e=w(()=>{F1();jy();dH();rft=async(t,e,r)=>({operation:A_(e).operation,region:await zd(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});nft=t=>{let e=[];switch(t.operation){case"AssumeRoleWithSAML":{e.push(tft(t));break}case"AssumeRoleWithWebIdentity":{e.push(tft(t));break}default:e.push(lyr(t))}return e},cyr=t=>({...t,stsClientCtor:Zh}),oft=t=>{let e=cyr(t);return{...JZ(e)}}});var ift,Vd,L_=w(()=>{ift=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),Vd={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 sft,aft=w(()=>{sft={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 c0e,d0e=w(()=>{c0e=t=>new TextEncoder().encode(t)});var uft=w(()=>{d0e()});var lft,cft=w(()=>{lft=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 dft=w(()=>{d0e();uft();cft()});var Sft,rn,xo,Co,UT,qT,kc,xft,Cft,Oft,Pa,fft,F_,Mk,p0e,pft,f0e,Pft,mft,$c,hft,Eft,Tft,Wd,Dm,gft,Aft,Ift,yft,Mft,bft,_ft,vft,wft,fyr,Rft,jft=w(()=>{Sft="required",rn="type",xo="fn",Co="argv",UT="ref",qT="booleanEquals",kc="stringEquals",xft="sigv4",Cft="sts",Oft="us-east-1",Pa="endpoint",fft="https://sts.{Region}.{PartitionResult#dnsSuffix}",F_="tree",Mk="error",p0e="getAttr",pft={[Sft]:!1,[rn]:"String"},f0e={[Sft]:!0,default:!1,[rn]:"Boolean"},Pft={[UT]:"Endpoint"},mft={[xo]:"isSet",[Co]:[{[UT]:"Region"}]},$c={[UT]:"Region"},hft={[xo]:"aws.partition",[Co]:[$c],assign:"PartitionResult"},Eft={[UT]:"UseFIPS"},Tft={[UT]:"UseDualStack"},Wd={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:xft,signingName:Cft,signingRegion:Oft}]},headers:{}},Dm={},gft={conditions:[{[xo]:kc,[Co]:[$c,"aws-global"]}],[Pa]:Wd,[rn]:Pa},Aft={[xo]:qT,[Co]:[Eft,!0]},Ift={[xo]:qT,[Co]:[Tft,!0]},yft={[xo]:p0e,[Co]:[{[UT]:"PartitionResult"},"supportsFIPS"]},Mft={[UT]:"PartitionResult"},bft={[xo]:qT,[Co]:[!0,{[xo]:p0e,[Co]:[Mft,"supportsDualStack"]}]},_ft=[{[xo]:"isSet",[Co]:[Pft]}],vft=[Aft],wft=[Ift],fyr={version:"1.0",parameters:{Region:pft,UseDualStack:f0e,UseFIPS:f0e,Endpoint:pft,UseGlobalEndpoint:f0e},rules:[{conditions:[{[xo]:qT,[Co]:[{[UT]:"UseGlobalEndpoint"},!0]},{[xo]:"not",[Co]:_ft},mft,hft,{[xo]:qT,[Co]:[Eft,!1]},{[xo]:qT,[Co]:[Tft,!1]}],rules:[{conditions:[{[xo]:kc,[Co]:[$c,"ap-northeast-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"ap-south-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"ap-southeast-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"ap-southeast-2"]}],endpoint:Wd,[rn]:Pa},gft,{conditions:[{[xo]:kc,[Co]:[$c,"ca-central-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-central-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-north-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-west-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-west-2"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-west-3"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"sa-east-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,Oft]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"us-east-2"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"us-west-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"us-west-2"]}],endpoint:Wd,[rn]:Pa},{endpoint:{url:fft,properties:{authSchemes:[{name:xft,signingName:Cft,signingRegion:"{Region}"}]},headers:Dm},[rn]:Pa}],[rn]:F_},{conditions:_ft,rules:[{conditions:vft,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[rn]:Mk},{conditions:wft,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[rn]:Mk},{endpoint:{url:Pft,properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_},{conditions:[mft],rules:[{conditions:[hft],rules:[{conditions:[Aft,Ift],rules:[{conditions:[{[xo]:qT,[Co]:[!0,yft]},bft],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[rn]:Mk}],[rn]:F_},{conditions:vft,rules:[{conditions:[{[xo]:qT,[Co]:[yft,!0]}],rules:[{conditions:[{[xo]:kc,[Co]:[{[xo]:p0e,[Co]:[Mft,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:Dm,headers:Dm},[rn]:Pa},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_},{error:"FIPS is enabled but this partition does not support FIPS",[rn]:Mk}],[rn]:F_},{conditions:wft,rules:[{conditions:[bft],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_},{error:"DualStack is enabled but this partition does not support DualStack",[rn]:Mk}],[rn]:F_},gft,{endpoint:{url:fft,properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_}],[rn]:F_},{error:"Invalid Configuration: Missing Region",[rn]:Mk}]},Rft=fyr});var Nft,Dft=w(()=>{eZ();ET();jft();Nft=(t,e={})=>k3(Rft,{endpointParams:t,logger:e.logger});sO.aws=$3});var Lft,Fft=w(()=>{F1();LT();ar();dZ();yk();dft();l0e();Dft();Lft=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??RT,base64Encoder:t?.base64Encoder??jT,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??Nft,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??nft,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new N1},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Sk}],logger:t?.logger??new AT,serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??TT,utf8Decoder:t?.utf8Decoder??c0e,utf8Encoder:t?.utf8Encoder??lft})});var kft,$ft=w(()=>{aft();_we();Swe();B3();G3();xwe();Cwe();M_();Fft();ar();Twe();kft=t=>{let e=nX(t),r=()=>e().then(MZ),n=Lft(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??rX,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??eX({serviceId:n.serviceId,clientVersion:sft.version}),maxAttempts:t?.maxAttempts??I_,region:t?.region??tX("Region is missing"),requestHandler:NT.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||z3),sha256:t?.sha256??QZ,streamCollector:t?.streamCollector??bk,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(aZ)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(sZ))}}});var Bft,qft,Uft=w(()=>{Bft=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},qft=t=>({httpHandler:t.httpHandler()})});var zft=w(()=>{Uft()});var Hft=w(()=>{Hs()});var Vft=w(()=>{});var Wft=w(()=>{});function pyr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var VX,Kft=w(()=>{VX=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=pyr(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 Gft=w(()=>{});var Jft=w(()=>{});var Yft=w(()=>{});var m0e=w(()=>{zft();Hft();Vft();Wft();Kft();Gft();Jft();Yft()});var Zft,Xft,Qft=w(()=>{Zft=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}}},Xft=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var WX,ept,tpt=w(()=>{Iwe();m0e();ar();Qft();WX=t=>t,ept=(t,e)=>{let r={...WX(oX(t)),...WX(RZ(t)),...WX(Bft(t)),...WX(Zft(t))};return e.forEach(n=>n.configure(r)),{...t,...iX(r),...jZ(r),...qft(r),...Xft(r)}}});var Zh,dH=w(()=>{E_e();T_e();A_e();W_e();B3();LT();Lve();zn();LZ();ar();l0e();L_();$ft();tpt();Zh=class extends A1{constructor(...[e]){let r=kft(e||{}),n=ift(r),o=WY(n),i=CZ(o),a=lZ(i),s=a,u=mZ(s),l=oft(u),c=ept(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(oZ(this.config)),this.middlewareStack.use(DZ(this.config)),this.middlewareStack.use($Z(this.config)),this.middlewareStack.use(UY(this.config)),this.middlewareStack.use(zY(this.config)),this.middlewareStack.use(VY(this.config)),this.middlewareStack.use(hZ(this.config,{httpAuthSchemeParametersProvider:rft,identityProviderConfigProvider:async d=>new wk({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(FZ(this.config))}destroy(){super.destroy()}}});var Hf,KX=w(()=>{ar();Hf=class t extends vk{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var fH,pH,mH,hH,gH,yH,bH,_H,Rk,h0e,g0e,y0e,b0e,_0e,v0e,w0e,zT=w(()=>{ar();KX();fH=class t extends Hf{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},pH=class t extends Hf{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},mH=class t extends Hf{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},hH=class t extends Hf{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},gH=class t extends Hf{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},yH=class t extends Hf{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},bH=class t extends Hf{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_H=class t extends Hf{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Rk=t=>({...t,...t.SecretAccessKey&&{SecretAccessKey:EZ}}),h0e=t=>({...t,...t.Credentials&&{Credentials:Rk(t.Credentials)}}),g0e=t=>({...t,...t.SAMLAssertion&&{SAMLAssertion:EZ}}),y0e=t=>({...t,...t.Credentials&&{Credentials:Rk(t.Credentials)}}),b0e=t=>({...t,...t.WebIdentityToken&&{WebIdentityToken:EZ}}),_0e=t=>({...t,...t.Credentials&&{Credentials:Rk(t.Credentials)}}),v0e=t=>({...t,...t.Credentials&&{Credentials:Rk(t.Credentials)}}),w0e=t=>({...t,...t.Credentials&&{Credentials:Rk(t.Credentials)}})});var rpt,npt,opt,ipt,apt,spt,upt,lpt,cpt,dpt,fpt,ppt,mpt,hpt,gpt,ypt,HT,myr,hyr,gyr,yyr,byr,_yr,vyr,wyr,Syr,xyr,Cyr,Oyr,Pyr,Eyr,Tyr,Ayr,GX,Iyr,Myr,Ryr,jyr,Nyr,bpt,Y0e,Dyr,Lyr,Fyr,vH,kyr,$yr,Byr,qyr,Uyr,zyr,Hyr,Vyr,Wyr,Kyr,Gyr,Jyr,Yyr,Zyr,Kd,Xyr,VT,WT,KT,GT,jk,Qyr,S0e,pO,ebr,tbr,Nk,mO,Dk,Vf,x0e,rbr,C0e,Wf,O0e,P0e,E0e,T0e,A0e,nbr,obr,ibr,abr,I0e,M0e,R0e,j0e,Xh,Qh,N0e,D0e,L0e,F0e,eg,k0e,hO,Lk,$0e,B0e,q0e,U0e,tg,Fk,z0e,H0e,kk,$k,V0e,W0e,JT,K0e,G0e,J0e,Ea,YT,sbr,gO=w(()=>{F1();m0e();ar();zT();KX();rpt=async(t,e)=>{let r=WT,n;return n=YT({...Syr(t,e),[GT]:Qyr,[JT]:KT}),VT(e,r,"/",void 0,n)},npt=async(t,e)=>{let r=WT,n;return n=YT({...xyr(t,e),[GT]:ebr,[JT]:KT}),VT(e,r,"/",void 0,n)},opt=async(t,e)=>{let r=WT,n;return n=YT({...Cyr(t,e),[GT]:tbr,[JT]:KT}),VT(e,r,"/",void 0,n)},ipt=async(t,e)=>{let r=WT,n;return n=YT({...Oyr(t,e),[GT]:rbr,[JT]:KT}),VT(e,r,"/",void 0,n)},apt=async(t,e)=>{let r=WT,n;return n=YT({...Pyr(t,e),[GT]:nbr,[JT]:KT}),VT(e,r,"/",void 0,n)},spt=async(t,e)=>{let r=WT,n;return n=YT({...Eyr(t,e),[GT]:obr,[JT]:KT}),VT(e,r,"/",void 0,n)},upt=async(t,e)=>{let r=WT,n;return n=YT({...Tyr(t,e),[GT]:ibr,[JT]:KT}),VT(e,r,"/",void 0,n)},lpt=async(t,e)=>{let r=WT,n;return n=YT({...Ayr(t,e),[GT]:abr,[JT]:KT}),VT(e,r,"/",void 0,n)},cpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Dyr(r.AssumeRoleResult,e),{$metadata:Kd(t),...n}},dpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Lyr(r.AssumeRoleWithSAMLResult,e),{$metadata:Kd(t),...n}},fpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Fyr(r.AssumeRoleWithWebIdentityResult,e),{$metadata:Kd(t),...n}},ppt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=kyr(r.DecodeAuthorizationMessageResult,e),{$metadata:Kd(t),...n}},mpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=qyr(r.GetAccessKeyInfoResult,e),{$metadata:Kd(t),...n}},hpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Uyr(r.GetCallerIdentityResult,e),{$metadata:Kd(t),...n}},gpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=zyr(r.GetFederationTokenResult,e),{$metadata:Kd(t),...n}},ypt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Hyr(r.GetSessionTokenResult,e),{$metadata:Kd(t),...n}},HT=async(t,e)=>{let r={...t,body:await dlt(t.body,e)},n=sbr(t,r.body);switch(n){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await myr(r,e);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await _yr(r,e);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await vyr(r,e);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await wyr(r,e);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await gyr(r,e);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await byr(r,e);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await hyr(r,e);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await yyr(r,e);default:let o=r.body;return Xyr({output:t,parsedBody:o.Error,errorCode:n})}},myr=async(t,e)=>{let r=t.body,n=$yr(r.Error,e),o=new fH({$metadata:Kd(t),...n});return qa(o,r)},hyr=async(t,e)=>{let r=t.body,n=Vyr(r.Error,e),o=new bH({$metadata:Kd(t),...n});return qa(o,r)},gyr=async(t,e)=>{let r=t.body,n=Wyr(r.Error,e),o=new gH({$metadata:Kd(t),...n});return qa(o,r)},yyr=async(t,e)=>{let r=t.body,n=Kyr(r.Error,e),o=new _H({$metadata:Kd(t),...n});return qa(o,r)},byr=async(t,e)=>{let r=t.body,n=Gyr(r.Error,e),o=new yH({$metadata:Kd(t),...n});return qa(o,r)},_yr=async(t,e)=>{let r=t.body,n=Jyr(r.Error,e),o=new pH({$metadata:Kd(t),...n});return qa(o,r)},vyr=async(t,e)=>{let r=t.body,n=Yyr(r.Error,e),o=new mH({$metadata:Kd(t),...n});return qa(o,r)},wyr=async(t,e)=>{let r=t.body,n=Zyr(r.Error,e),o=new hH({$metadata:Kd(t),...n});return qa(o,r)},Syr=(t,e)=>{let r={};if(t[hO]!=null&&(r[hO]=t[hO]),t[Lk]!=null&&(r[Lk]=t[Lk]),t[Qh]!=null){let n=GX(t[Qh],e);t[Qh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[Xh]!=null&&(r[Xh]=t[Xh]),t[Wf]!=null&&(r[Wf]=t[Wf]),t[kk]!=null){let n=bpt(t[kk],e);t[kk]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}if(t[V0e]!=null){let n=Nyr(t[V0e],e);t[V0e]?.length===0&&(r.TransitiveTagKeys=[]),Object.entries(n).forEach(([o,i])=>{let a=`TransitiveTagKeys.${o}`;r[a]=i})}if(t[P0e]!=null&&(r[P0e]=t[P0e]),t[Fk]!=null&&(r[Fk]=t[Fk]),t[$k]!=null&&(r[$k]=t[$k]),t[tg]!=null&&(r[tg]=t[tg]),t[L0e]!=null){let n=Ryr(t[L0e],e);t[L0e]?.length===0&&(r.ProvidedContexts=[]),Object.entries(n).forEach(([o,i])=>{let a=`ProvidedContexts.${o}`;r[a]=i})}return r},xyr=(t,e)=>{let r={};if(t[hO]!=null&&(r[hO]=t[hO]),t[N0e]!=null&&(r[N0e]=t[N0e]),t[q0e]!=null&&(r[q0e]=t[q0e]),t[Qh]!=null){let n=GX(t[Qh],e);t[Qh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[Xh]!=null&&(r[Xh]=t[Xh]),t[Wf]!=null&&(r[Wf]=t[Wf]),r},Cyr=(t,e)=>{let r={};if(t[hO]!=null&&(r[hO]=t[hO]),t[Lk]!=null&&(r[Lk]=t[Lk]),t[G0e]!=null&&(r[G0e]=t[G0e]),t[F0e]!=null&&(r[F0e]=t[F0e]),t[Qh]!=null){let n=GX(t[Qh],e);t[Qh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[Xh]!=null&&(r[Xh]=t[Xh]),t[Wf]!=null&&(r[Wf]=t[Wf]),r},Oyr=(t,e)=>{let r={};return t[E0e]!=null&&(r[E0e]=t[E0e]),r},Pyr=(t,e)=>{let r={};return t[jk]!=null&&(r[jk]=t[jk]),r},Eyr=(t,e)=>({}),Tyr=(t,e)=>{let r={};if(t[R0e]!=null&&(r[R0e]=t[R0e]),t[Xh]!=null&&(r[Xh]=t[Xh]),t[Qh]!=null){let n=GX(t[Qh],e);t[Qh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[Wf]!=null&&(r[Wf]=t[Wf]),t[kk]!=null){let n=bpt(t[kk],e);t[kk]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}return r},Ayr=(t,e)=>{let r={};return t[Wf]!=null&&(r[Wf]=t[Wf]),t[Fk]!=null&&(r[Fk]=t[Fk]),t[$k]!=null&&(r[$k]=t[$k]),r},GX=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=Iyr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},Iyr=(t,e)=>{let r={};return t[J0e]!=null&&(r[J0e]=t[J0e]),r},Myr=(t,e)=>{let r={};return t[D0e]!=null&&(r[D0e]=t[D0e]),t[x0e]!=null&&(r[x0e]=t[x0e]),r},Ryr=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=Myr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},jyr=(t,e)=>{let r={};return t[M0e]!=null&&(r[M0e]=t[M0e]),t[K0e]!=null&&(r[K0e]=t[K0e]),r},Nyr=(t,e)=>{let r={},n=1;for(let o of t)o!==null&&(r[`member.${n}`]=o,n++);return r},bpt=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=jyr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},Y0e=(t,e)=>{let r={};return t[S0e]!=null&&(r[S0e]=ln(t[S0e])),t[mO]!=null&&(r[mO]=ln(t[mO])),r},Dyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=vH(t[Vf],e)),t[pO]!=null&&(r[pO]=Y0e(t[pO],e)),t[eg]!=null&&(r[eg]=Y3(t[eg])),t[tg]!=null&&(r[tg]=ln(t[tg])),r},Lyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=vH(t[Vf],e)),t[pO]!=null&&(r[pO]=Y0e(t[pO],e)),t[eg]!=null&&(r[eg]=Y3(t[eg])),t[$0e]!=null&&(r[$0e]=ln(t[$0e])),t[z0e]!=null&&(r[z0e]=ln(t[z0e])),t[I0e]!=null&&(r[I0e]=ln(t[I0e])),t[Dk]!=null&&(r[Dk]=ln(t[Dk])),t[j0e]!=null&&(r[j0e]=ln(t[j0e])),t[tg]!=null&&(r[tg]=ln(t[tg])),r},Fyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=vH(t[Vf],e)),t[U0e]!=null&&(r[U0e]=ln(t[U0e])),t[pO]!=null&&(r[pO]=Y0e(t[pO],e)),t[eg]!=null&&(r[eg]=Y3(t[eg])),t[k0e]!=null&&(r[k0e]=ln(t[k0e])),t[Dk]!=null&&(r[Dk]=ln(t[Dk])),t[tg]!=null&&(r[tg]=ln(t[tg])),r},vH=(t,e)=>{let r={};return t[jk]!=null&&(r[jk]=ln(t[jk])),t[B0e]!=null&&(r[B0e]=ln(t[B0e])),t[H0e]!=null&&(r[H0e]=ln(t[H0e])),t[O0e]!=null&&(r[O0e]=_k(Iat(t[O0e]))),r},kyr=(t,e)=>{let r={};return t[C0e]!=null&&(r[C0e]=ln(t[C0e])),r},$yr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Byr=(t,e)=>{let r={};return t[A0e]!=null&&(r[A0e]=ln(t[A0e])),t[mO]!=null&&(r[mO]=ln(t[mO])),r},qyr=(t,e)=>{let r={};return t[Nk]!=null&&(r[Nk]=ln(t[Nk])),r},Uyr=(t,e)=>{let r={};return t[W0e]!=null&&(r[W0e]=ln(t[W0e])),t[Nk]!=null&&(r[Nk]=ln(t[Nk])),t[mO]!=null&&(r[mO]=ln(t[mO])),r},zyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=vH(t[Vf],e)),t[T0e]!=null&&(r[T0e]=Byr(t[T0e],e)),t[eg]!=null&&(r[eg]=Y3(t[eg])),r},Hyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=vH(t[Vf],e)),r},Vyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Wyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Kyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Gyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Jyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Yyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Zyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Kd=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"]}),Xyr=IZ(Hf),VT=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 VX(l)},WT={"content-type":"application/x-www-form-urlencoded"},KT="2011-06-15",GT="Action",jk="AccessKeyId",Qyr="AssumeRole",S0e="AssumedRoleId",pO="AssumedRoleUser",ebr="AssumeRoleWithSAML",tbr="AssumeRoleWithWebIdentity",Nk="Account",mO="Arn",Dk="Audience",Vf="Credentials",x0e="ContextAssertion",rbr="DecodeAuthorizationMessage",C0e="DecodedMessage",Wf="DurationSeconds",O0e="Expiration",P0e="ExternalId",E0e="EncodedMessage",T0e="FederatedUser",A0e="FederatedUserId",nbr="GetAccessKeyInfo",obr="GetCallerIdentity",ibr="GetFederationToken",abr="GetSessionToken",I0e="Issuer",M0e="Key",R0e="Name",j0e="NameQualifier",Xh="Policy",Qh="PolicyArns",N0e="PrincipalArn",D0e="ProviderArn",L0e="ProvidedContexts",F0e="ProviderId",eg="PackedPolicySize",k0e="Provider",hO="RoleArn",Lk="RoleSessionName",$0e="Subject",B0e="SecretAccessKey",q0e="SAMLAssertion",U0e="SubjectFromWebIdentityToken",tg="SourceIdentity",Fk="SerialNumber",z0e="SubjectType",H0e="SessionToken",kk="Tags",$k="TokenCode",V0e="TransitiveTagKeys",W0e="UserId",JT="Version",K0e="Value",G0e="WebIdentityToken",J0e="arn",Ea="message",YT=t=>Object.entries(t).map(([e,r])=>NZ(e)+"="+NZ(r)).join("&"),sbr=(t,e)=>{if(e.Error?.Code!==void 0)return e.Error.Code;if(t.statusCode==404)return"NotFound"}});var yO,JX=w(()=>{zn();to();ar();L_();zT();gO();yO=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,h0e).ser(rpt).de(cpt).build(){}});var wH,Z0e=w(()=>{zn();to();ar();L_();zT();gO();wH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(g0e,y0e).ser(npt).de(dpt).build(){}});var k1,YX=w(()=>{zn();to();ar();L_();zT();gO();k1=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(b0e,_0e).ser(opt).de(fpt).build(){}});var SH,X0e=w(()=>{zn();to();ar();L_();gO();SH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(ipt).de(ppt).build(){}});var xH,Q0e=w(()=>{zn();to();ar();L_();gO();xH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(apt).de(mpt).build(){}});var CH,eSe=w(()=>{zn();to();ar();L_();gO();CH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(spt).de(hpt).build(){}});var OH,tSe=w(()=>{zn();to();ar();L_();zT();gO();OH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,v0e).ser(upt).de(gpt).build(){}});var PH,rSe=w(()=>{zn();to();ar();L_();zT();gO();PH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,w0e).ser(lpt).de(ypt).build(){}});var ubr,ZX,_pt=w(()=>{ar();JX();Z0e();YX();X0e();Q0e();eSe();tSe();rSe();dH();ubr={AssumeRoleCommand:yO,AssumeRoleWithSAMLCommand:wH,AssumeRoleWithWebIdentityCommand:k1,DecodeAuthorizationMessageCommand:SH,GetAccessKeyInfoCommand:xH,GetCallerIdentityCommand:CH,GetFederationTokenCommand:OH,GetSessionTokenCommand:PH},ZX=class extends Zh{};TZ(ubr,ZX)});var vpt=w(()=>{JX();Z0e();YX();X0e();Q0e();eSe();tSe();rSe()});var wpt=w(()=>{zT()});var Spt,xpt,Cpt,Opt,Ppt,Ept,Tpt=w(()=>{JX();YX();Spt="us-east-1",xpt=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},Cpt=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)`,`${Spt} (STS default)`),n??o??Spt},Opt=(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 Cpt(c,t?.parentClientConfig?.region,f),m=!Ept(d);r=new e({credentialDefaultProvider:()=>async()=>n,region:p,requestHandler:m?d:void 0,logger:l})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new yO(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=xpt(s);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}}}},Ppt=(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 Cpt(u,t?.parentClientConfig?.region,c),f=!Ept(l);r=new e({region:d,requestHandler:f?l:void 0,logger:s})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new k1(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=xpt(i);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}}}},Ept=t=>t?.metadata?.handlerProtocol==="h2"});var Apt,Ipt,Mpt,lbr,Rpt=w(()=>{Tpt();dH();Apt=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,Ipt=(t={},e)=>Opt(t,Apt(Zh,e)),Mpt=(t={},e)=>Ppt(t,Apt(Zh,e)),lbr=t=>e=>t({roleAssumer:Ipt(e),roleAssumerWithWebIdentity:Mpt(e),...e})});var jpt={};Cf(jpt,{$Command:()=>Ot,AssumeRoleCommand:()=>yO,AssumeRoleResponseFilterSensitiveLog:()=>h0e,AssumeRoleWithSAMLCommand:()=>wH,AssumeRoleWithSAMLRequestFilterSensitiveLog:()=>g0e,AssumeRoleWithSAMLResponseFilterSensitiveLog:()=>y0e,AssumeRoleWithWebIdentityCommand:()=>k1,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:()=>b0e,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:()=>_0e,CredentialsFilterSensitiveLog:()=>Rk,DecodeAuthorizationMessageCommand:()=>SH,ExpiredTokenException:()=>fH,GetAccessKeyInfoCommand:()=>xH,GetCallerIdentityCommand:()=>CH,GetFederationTokenCommand:()=>OH,GetFederationTokenResponseFilterSensitiveLog:()=>v0e,GetSessionTokenCommand:()=>PH,GetSessionTokenResponseFilterSensitiveLog:()=>w0e,IDPCommunicationErrorException:()=>bH,IDPRejectedClaimException:()=>gH,InvalidAuthorizationMessageException:()=>_H,InvalidIdentityTokenException:()=>yH,MalformedPolicyDocumentException:()=>pH,PackedPolicyTooLargeException:()=>mH,RegionDisabledException:()=>hH,STS:()=>ZX,STSClient:()=>Zh,STSServiceException:()=>Hf,__Client:()=>A1,decorateDefaultCredentialProvider:()=>lbr,getDefaultRoleAssumer:()=>Ipt,getDefaultRoleAssumerWithWebIdentity:()=>Mpt});var nSe=w(()=>{dH();_pt();vpt();wpt();Rpt();KX()});var Npt={};Cf(Npt,{AssumeRoleCommand:()=>yO,STSClient:()=>Zh});var Dpt=w(()=>{nSe()});var cbr,Lpt=w(()=>{aO();cbr=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 Tl("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(()=>(Dpt(),Npt));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 Tl(`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 Fpt=w(()=>{});var kpt,$pt=w(()=>{kpt=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(()=>(nSe(),jpt));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 Bpt=w(()=>{Fpt();$pt()});var dbr,qpt=w(()=>{Bpt();dbr=t=>kpt({...t})});var Upt={};Cf(Upt,{fromCognitoIdentity:()=>nyr,fromCognitoIdentityPool:()=>oyr,fromHttp:()=>u0e,fromTemporaryCredentials:()=>cbr,fromWebToken:()=>dbr});var zpt=w(()=>{Ndt();Ddt();eft();Lpt();qpt()});var $1={};Cf($1,{__addDisposableResource:()=>cmt,__assign:()=>XX,__asyncDelegator:()=>rmt,__asyncGenerator:()=>tmt,__asyncValues:()=>nmt,__await:()=>Bk,__awaiter:()=>Jpt,__classPrivateFieldGet:()=>smt,__classPrivateFieldIn:()=>lmt,__classPrivateFieldSet:()=>umt,__createBinding:()=>eQ,__decorate:()=>Wpt,__disposeResources:()=>dmt,__esDecorate:()=>fbr,__exportStar:()=>Zpt,__extends:()=>Hpt,__generator:()=>Ypt,__importDefault:()=>amt,__importStar:()=>imt,__makeTemplateObject:()=>omt,__metadata:()=>Gpt,__param:()=>Kpt,__propKey:()=>mbr,__read:()=>iSe,__rest:()=>Vpt,__runInitializers:()=>pbr,__setFunctionName:()=>hbr,__spread:()=>Xpt,__spreadArray:()=>emt,__spreadArrays:()=>Qpt,__values:()=>QX,default:()=>bbr});function Hpt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");oSe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Vpt(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=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 Kpt(t,e){return function(r,n){e(r,n,t)}}function fbr(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var b=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(d=a(b.get))&&(c.get=d),(d=a(b.set))&&(c.set=d),(d=a(b.init))&&o.unshift(d)}else(d=a(b))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function pbr(t,e,r){for(var n=arguments.length>2,o=0;o0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]=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 iSe(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 Xpt(){for(var t=[],e=0;e1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof Bk?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function rmt(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:Bk(t[o](a)),done:!1}:i?i(a):a}:i}}function nmt(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 QX=="function"?QX(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 omt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function imt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eQ(e,t,r);return gbr(e,t),e}function amt(t){return t&&t.__esModule?t:{default:t}}function smt(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 umt(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 lmt(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 cmt(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 dmt(t){function e(i){t.error=t.hasError?new ybr(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 oSe,XX,eQ,gbr,ybr,bbr,B1=w(()=>{oSe=function(t,e){return oSe=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])},oSe(t,e)};XX=function(){return XX=Object.assign||function(e){for(var r,n=1,o=arguments.length;n{"use strict";Object.defineProperty(fmt,"__esModule",{value:!0})});var mmt=v(EH=>{"use strict";Object.defineProperty(EH,"__esModule",{value:!0});EH.HttpAuthLocation=void 0;var _br;(function(t){t.HEADER="header",t.QUERY="query"})(_br=EH.HttpAuthLocation||(EH.HttpAuthLocation={}))});var gmt=v(hmt=>{"use strict";Object.defineProperty(hmt,"__esModule",{value:!0})});var bmt=v(ymt=>{"use strict";Object.defineProperty(ymt,"__esModule",{value:!0})});var vmt=v(_mt=>{"use strict";Object.defineProperty(_mt,"__esModule",{value:!0})});var Smt=v(wmt=>{"use strict";Object.defineProperty(wmt,"__esModule",{value:!0})});var Cmt=v(xmt=>{"use strict";Object.defineProperty(xmt,"__esModule",{value:!0})});var Pmt=v(Omt=>{"use strict";Object.defineProperty(Omt,"__esModule",{value:!0})});var Tmt=v(Emt=>{"use strict";Object.defineProperty(Emt,"__esModule",{value:!0})});var Amt=v(TH=>{"use strict";Object.defineProperty(TH,"__esModule",{value:!0});var aSe=(B1(),zl($1));aSe.__exportStar(Cmt(),TH);aSe.__exportStar(Pmt(),TH);aSe.__exportStar(Tmt(),TH)});var Mmt=v(Imt=>{"use strict";Object.defineProperty(Imt,"__esModule",{value:!0})});var jmt=v(Rmt=>{"use strict";Object.defineProperty(Rmt,"__esModule",{value:!0})});var Nmt=v(AH=>{"use strict";Object.defineProperty(AH,"__esModule",{value:!0});AH.EndpointURLScheme=void 0;var vbr;(function(t){t.HTTP="http",t.HTTPS="https"})(vbr=AH.EndpointURLScheme||(AH.EndpointURLScheme={}))});var Lmt=v(Dmt=>{"use strict";Object.defineProperty(Dmt,"__esModule",{value:!0})});var kmt=v(Fmt=>{"use strict";Object.defineProperty(Fmt,"__esModule",{value:!0})});var Bmt=v($mt=>{"use strict";Object.defineProperty($mt,"__esModule",{value:!0})});var Umt=v(qmt=>{"use strict";Object.defineProperty(qmt,"__esModule",{value:!0})});var Hmt=v(zmt=>{"use strict";Object.defineProperty(zmt,"__esModule",{value:!0})});var Vmt=v(q1=>{"use strict";Object.defineProperty(q1,"__esModule",{value:!0});var IH=(B1(),zl($1));IH.__exportStar(Lmt(),q1);IH.__exportStar(kmt(),q1);IH.__exportStar(Bmt(),q1);IH.__exportStar(Umt(),q1);IH.__exportStar(Hmt(),q1)});var Kmt=v(Wmt=>{"use strict";Object.defineProperty(Wmt,"__esModule",{value:!0})});var Gmt=v(MH=>{"use strict";Object.defineProperty(MH,"__esModule",{value:!0});MH.FieldPosition=void 0;var wbr;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(wbr=MH.FieldPosition||(MH.FieldPosition={}))});var Ymt=v(Jmt=>{"use strict";Object.defineProperty(Jmt,"__esModule",{value:!0})});var Xmt=v(Zmt=>{"use strict";Object.defineProperty(Zmt,"__esModule",{value:!0})});var eht=v(tQ=>{"use strict";Object.defineProperty(tQ,"__esModule",{value:!0});var Qmt=(B1(),zl($1));Qmt.__exportStar(Ymt(),tQ);Qmt.__exportStar(Xmt(),tQ)});var rht=v(tht=>{"use strict";Object.defineProperty(tht,"__esModule",{value:!0})});var oht=v(nht=>{"use strict";Object.defineProperty(nht,"__esModule",{value:!0})});var aht=v(iht=>{"use strict";Object.defineProperty(iht,"__esModule",{value:!0})});var uht=v(sht=>{"use strict";Object.defineProperty(sht,"__esModule",{value:!0})});var cht=v(lht=>{"use strict";Object.defineProperty(lht,"__esModule",{value:!0})});var fht=v(dht=>{"use strict";Object.defineProperty(dht,"__esModule",{value:!0})});var mht=v(pht=>{"use strict";Object.defineProperty(pht,"__esModule",{value:!0})});var ght=v(hht=>{"use strict";Object.defineProperty(hht,"__esModule",{value:!0})});var bht=v(yht=>{"use strict";Object.defineProperty(yht,"__esModule",{value:!0})});var vht=v(_ht=>{"use strict";Object.defineProperty(_ht,"__esModule",{value:!0})});var Sht=v(wht=>{"use strict";Object.defineProperty(wht,"__esModule",{value:!0})});var Cht=v(xht=>{"use strict";Object.defineProperty(xht,"__esModule",{value:!0})});var Pht=v(Oht=>{"use strict";Object.defineProperty(Oht,"__esModule",{value:!0})});var Eht=v(RH=>{"use strict";Object.defineProperty(RH,"__esModule",{value:!0});RH.RequestHandlerProtocol=void 0;var Sbr;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(Sbr=RH.RequestHandlerProtocol||(RH.RequestHandlerProtocol={}))});var Aht=v(Tht=>{"use strict";Object.defineProperty(Tht,"__esModule",{value:!0})});var Mht=v(Iht=>{"use strict";Object.defineProperty(Iht,"__esModule",{value:!0})});var jht=v(Rht=>{"use strict";Object.defineProperty(Rht,"__esModule",{value:!0})});var Dht=v(Nht=>{"use strict";Object.defineProperty(Nht,"__esModule",{value:!0})});var Fht=v(Lht=>{"use strict";Object.defineProperty(Lht,"__esModule",{value:!0})});var kht=v(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});var _o=(B1(),zl($1));_o.__exportStar(pmt(),Hn);_o.__exportStar(mmt(),Hn);_o.__exportStar(gmt(),Hn);_o.__exportStar(bmt(),Hn);_o.__exportStar(vmt(),Hn);_o.__exportStar(Smt(),Hn);_o.__exportStar(Amt(),Hn);_o.__exportStar(Mmt(),Hn);_o.__exportStar(jmt(),Hn);_o.__exportStar(Nmt(),Hn);_o.__exportStar(Vmt(),Hn);_o.__exportStar(Kmt(),Hn);_o.__exportStar(Gmt(),Hn);_o.__exportStar(eht(),Hn);_o.__exportStar(rht(),Hn);_o.__exportStar(oht(),Hn);_o.__exportStar(aht(),Hn);_o.__exportStar(uht(),Hn);_o.__exportStar(cht(),Hn);_o.__exportStar(fht(),Hn);_o.__exportStar(mht(),Hn);_o.__exportStar(ght(),Hn);_o.__exportStar(bht(),Hn);_o.__exportStar(vht(),Hn);_o.__exportStar(Sht(),Hn);_o.__exportStar(Cht(),Hn);_o.__exportStar(Pht(),Hn);_o.__exportStar(Eht(),Hn);_o.__exportStar(Aht(),Hn);_o.__exportStar(Mht(),Hn);_o.__exportStar(jht(),Hn);_o.__exportStar(Dht(),Hn);_o.__exportStar(Fht(),Hn)});var $ht=v(rQ=>{"use strict";Object.defineProperty(rQ,"__esModule",{value:!0});rQ.Field=void 0;var xbr=kht(),sSe=class{constructor({name:e,kind:r=xbr.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}};rQ.Field=sSe});var Bht=v(nQ=>{"use strict";Object.defineProperty(nQ,"__esModule",{value:!0});nQ.Fields=void 0;var uSe=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)}};nQ.Fields=uSe});var Uht=v(qht=>{"use strict";Object.defineProperty(qht,"__esModule",{value:!0})});var zht=v(oQ=>{"use strict";Object.defineProperty(oQ,"__esModule",{value:!0});oQ.HttpRequest=void 0;var lSe=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=Cbr(e.query)),e}};oQ.HttpRequest=lSe;function Cbr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}});var Hht=v(iQ=>{"use strict";Object.defineProperty(iQ,"__esModule",{value:!0});iQ.HttpResponse=void 0;var cSe=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"}};iQ.HttpResponse=cSe});var Vht=v(aQ=>{"use strict";Object.defineProperty(aQ,"__esModule",{value:!0});aQ.isValidHostname=void 0;function Obr(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}aQ.isValidHostname=Obr});var Kht=v(Wht=>{"use strict";Object.defineProperty(Wht,"__esModule",{value:!0})});var Ght=v(bO=>{"use strict";Object.defineProperty(bO,"__esModule",{value:!0});var U1=(B1(),zl($1));U1.__exportStar($ht(),bO);U1.__exportStar(Bht(),bO);U1.__exportStar(Uht(),bO);U1.__exportStar(zht(),bO);U1.__exportStar(Hht(),bO);U1.__exportStar(Vht(),bO);U1.__exportStar(Kht(),bO)});var Jht=v(dSe=>{"use strict";Object.defineProperty(dSe,"__esModule",{value:!0});var Pbr=(B1(),zl($1));Pbr.__exportStar(Ght(),dSe)});var z1={};Cf(z1,{__addDisposableResource:()=>ggt,__assign:()=>sQ,__asyncDelegator:()=>ugt,__asyncGenerator:()=>sgt,__asyncValues:()=>lgt,__await:()=>qk,__awaiter:()=>tgt,__classPrivateFieldGet:()=>pgt,__classPrivateFieldIn:()=>hgt,__classPrivateFieldSet:()=>mgt,__createBinding:()=>lQ,__decorate:()=>Xht,__disposeResources:()=>ygt,__esDecorate:()=>Ebr,__exportStar:()=>ngt,__extends:()=>Yht,__generator:()=>rgt,__importDefault:()=>fgt,__importStar:()=>dgt,__makeTemplateObject:()=>cgt,__metadata:()=>egt,__param:()=>Qht,__propKey:()=>Abr,__read:()=>pSe,__rest:()=>Zht,__runInitializers:()=>Tbr,__setFunctionName:()=>Ibr,__spread:()=>ogt,__spreadArray:()=>agt,__spreadArrays:()=>igt,__values:()=>uQ,default:()=>jbr});function Yht(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");fSe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Zht(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=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 Qht(t,e){return function(r,n){e(r,n,t)}}function Ebr(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var b=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(d=a(b.get))&&(c.get=d),(d=a(b.set))&&(c.set=d),(d=a(b.init))&&o.unshift(d)}else(d=a(b))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function Tbr(t,e,r){for(var n=arguments.length>2,o=0;o0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]=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 pSe(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 ogt(){for(var t=[],e=0;e1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof qk?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function ugt(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:qk(t[o](a)),done:!1}:i?i(a):a}:i}}function lgt(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 uQ=="function"?uQ(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 cgt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function dgt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lQ(e,t,r);return Mbr(e,t),e}function fgt(t){return t&&t.__esModule?t:{default:t}}function pgt(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 mgt(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 hgt(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 ggt(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 ygt(t){function e(i){t.error=t.hasError?new Rbr(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 fSe,sQ,lQ,Mbr,Rbr,jbr,H1=w(()=>{fSe=function(t,e){return fSe=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])},fSe(t,e)};sQ=function(){return sQ=Object.assign||function(e){for(var r,n=1,o=arguments.length;nhSe,__asyncDelegator:()=>Wbr,__asyncGenerator:()=>Vbr,__asyncValues:()=>Kbr,__await:()=>jH,__awaiter:()=>$br,__classPrivateFieldGet:()=>Zbr,__classPrivateFieldSet:()=>Xbr,__createBinding:()=>qbr,__decorate:()=>Lbr,__exportStar:()=>Ubr,__extends:()=>Nbr,__generator:()=>Bbr,__importDefault:()=>Ybr,__importStar:()=>Jbr,__makeTemplateObject:()=>Gbr,__metadata:()=>kbr,__param:()=>Fbr,__read:()=>bgt,__rest:()=>Dbr,__spread:()=>zbr,__spreadArrays:()=>Hbr,__values:()=>gSe});function Nbr(t,e){mSe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Dbr(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=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 Fbr(t,e){return function(r,n){e(r,n,t)}}function kbr(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function $br(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 Bbr(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]=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 bgt(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 zbr(){for(var t=[],e=0;e1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof jH?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 Wbr(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:jH(t[o](a)),done:o==="return"}:i?i(a):a}:i}}function Kbr(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 gSe=="function"?gSe(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 Gbr(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Jbr(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 Ybr(t){return t&&t.__esModule?t:{default:t}}function Zbr(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Xbr(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 mSe,hSe,bSe=w(()=>{mSe=function(t,e){return mSe=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])},mSe(t,e)};hSe=function(){return hSe=Object.assign||function(e){for(var r,n=1,o=arguments.length;n{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});Uk.toUtf8=Uk.fromUtf8=void 0;var Qbr=t=>{let e=[];for(let r=0,n=t.length;r>6|192,o&63|128);else if(r+1>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)};Uk.fromUtf8=Qbr;var e_r=t=>{let e="";for(let r=0,n=t.length;rs.toString(16)).join("%");e+=decodeURIComponent(a)}else e+=String.fromCharCode((o&15)<<12|(t[++r]&63)<<6|t[++r]&63)}return e};Uk.toUtf8=e_r});var vgt=v(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});zk.toUtf8=zk.fromUtf8=void 0;function t_r(t){return new TextEncoder().encode(t)}zk.fromUtf8=t_r;function r_r(t){return new TextDecoder("utf-8").decode(t)}zk.toUtf8=r_r});var xgt=v(Hk=>{"use strict";Object.defineProperty(Hk,"__esModule",{value:!0});Hk.toUtf8=Hk.fromUtf8=void 0;var wgt=_gt(),Sgt=vgt(),n_r=t=>typeof TextEncoder=="function"?(0,Sgt.fromUtf8)(t):(0,wgt.fromUtf8)(t);Hk.fromUtf8=n_r;var o_r=t=>typeof TextDecoder=="function"?(0,Sgt.toUtf8)(t):(0,wgt.toUtf8)(t);Hk.toUtf8=o_r});var Cgt=v(cQ=>{"use strict";Object.defineProperty(cQ,"__esModule",{value:!0});cQ.convertToBuffer=void 0;var i_r=xgt(),a_r=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:i_r.fromUtf8;function s_r(t){return t instanceof Uint8Array?t:typeof t=="string"?a_r(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}cQ.convertToBuffer=s_r});var Ogt=v(dQ=>{"use strict";Object.defineProperty(dQ,"__esModule",{value:!0});dQ.isEmptyData=void 0;function u_r(t){return typeof t=="string"?t.length===0:t.byteLength===0}dQ.isEmptyData=u_r});var Pgt=v(fQ=>{"use strict";Object.defineProperty(fQ,"__esModule",{value:!0});fQ.numToUint8=void 0;function l_r(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}fQ.numToUint8=l_r});var Egt=v(pQ=>{"use strict";Object.defineProperty(pQ,"__esModule",{value:!0});pQ.uint32ArrayFrom=void 0;function c_r(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),r=0;r{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});k_.uint32ArrayFrom=k_.numToUint8=k_.isEmptyData=k_.convertToBuffer=void 0;var d_r=Cgt();Object.defineProperty(k_,"convertToBuffer",{enumerable:!0,get:function(){return d_r.convertToBuffer}});var f_r=Ogt();Object.defineProperty(k_,"isEmptyData",{enumerable:!0,get:function(){return f_r.isEmptyData}});var p_r=Pgt();Object.defineProperty(k_,"numToUint8",{enumerable:!0,get:function(){return p_r.numToUint8}});var m_r=Egt();Object.defineProperty(k_,"uint32ArrayFrom",{enumerable:!0,get:function(){return m_r.uint32ArrayFrom}})});var Igt=v(mQ=>{"use strict";Object.defineProperty(mQ,"__esModule",{value:!0});mQ.AwsCrc32=void 0;var Tgt=(bSe(),zl(ySe)),vSe=_Se(),Agt=hQ(),h_r=function(){function t(){this.crc32=new Agt.Crc32}return t.prototype.update=function(e){(0,vSe.isEmptyData)(e)||this.crc32.update((0,vSe.convertToBuffer)(e))},t.prototype.digest=function(){return Tgt.__awaiter(this,void 0,void 0,function(){return Tgt.__generator(this,function(e){return[2,(0,vSe.numToUint8)(this.crc32.digest())]})})},t.prototype.reset=function(){this.crc32=new Agt.Crc32},t}();mQ.AwsCrc32=h_r});var hQ=v(ZT=>{"use strict";Object.defineProperty(ZT,"__esModule",{value:!0});ZT.AwsCrc32=ZT.Crc32=ZT.crc32=void 0;var g_r=(bSe(),zl(ySe)),y_r=_Se();function b_r(t){return new Mgt().update(t).digest()}ZT.crc32=b_r;var Mgt=function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var r,n;try{for(var o=g_r.__values(e),i=o.next();!i.done;i=o.next()){var a=i.value;this.checksum=this.checksum>>>8^v_r[(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}();ZT.Crc32=Mgt;var __r=[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],v_r=(0,y_r.uint32ArrayFrom)(__r),w_r=Igt();Object.defineProperty(ZT,"AwsCrc32",{enumerable:!0,get:function(){return w_r.AwsCrc32}})});var Wk=v(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});Vk.toHex=Vk.fromHex=void 0;var Rgt={},wSe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Rgt[t]=e,wSe[e]=t}function S_r(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{"use strict";Object.defineProperty(gQ,"__esModule",{value:!0});gQ.Int64=void 0;var C_r=Wk(),SSe=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&&jgt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&jgt(e),parseInt((0,C_r.toHex)(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};gQ.Int64=SSe;function jgt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}});var PSe=v(yQ=>{"use strict";Object.defineProperty(yQ,"__esModule",{value:!0});yQ.HeaderMarshaller=void 0;var Kk=Wk(),CSe=xSe(),OSe=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(CSe.Int64.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!j_r.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set((0,Kk.fromHex)(e.value.replace(/\-/g,"")),1),d}}parse(e){let r={},n=0;for(;n{"use strict";Object.defineProperty(bQ,"__esModule",{value:!0});bQ.splitMessage=void 0;var N_r=hQ(),Lgt=4,XT=Lgt*2,V1=4,D_r=XT+V1*2;function L_r({byteLength:t,byteOffset:e,buffer:r}){if(t{"use strict";Object.defineProperty(_Q,"__esModule",{value:!0});_Q.EventStreamCodec=void 0;var F_r=hQ(),k_r=PSe(),$_r=Fgt(),ESe=class{constructor(e,r){this.headerMarshaller=new k_r.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 F_r.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,$_r.splitMessage)(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}};_Q.EventStreamCodec=ESe});var Bgt=v($gt=>{"use strict";Object.defineProperty($gt,"__esModule",{value:!0})});var qgt=v(vQ=>{"use strict";Object.defineProperty(vQ,"__esModule",{value:!0});vQ.MessageDecoderStream=void 0;var TSe=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)}};vQ.MessageDecoderStream=TSe});var Ugt=v(wQ=>{"use strict";Object.defineProperty(wQ,"__esModule",{value:!0});wQ.MessageEncoderStream=void 0;var ASe=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))}};wQ.MessageEncoderStream=ASe});var zgt=v(SQ=>{"use strict";Object.defineProperty(SQ,"__esModule",{value:!0});SQ.SmithyMessageDecoderStream=void 0;var ISe=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)}}};SQ.SmithyMessageDecoderStream=ISe});var Hgt=v(xQ=>{"use strict";Object.defineProperty(xQ,"__esModule",{value:!0});xQ.SmithyMessageEncoderStream=void 0;var MSe=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)}};xQ.SmithyMessageEncoderStream=MSe});var Vgt=v($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});var QT=(H1(),zl(z1));QT.__exportStar(kgt(),$_);QT.__exportStar(PSe(),$_);QT.__exportStar(xSe(),$_);QT.__exportStar(Bgt(),$_);QT.__exportStar(qgt(),$_);QT.__exportStar(Ugt(),$_);QT.__exportStar(zgt(),$_);QT.__exportStar(Hgt(),$_)});var Wgt=v(CQ=>{"use strict";Object.defineProperty(CQ,"__esModule",{value:!0});CQ.normalizeProvider=void 0;var B_r=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};CQ.normalizeProvider=B_r});var Kgt=v(RSe=>{"use strict";Object.defineProperty(RSe,"__esModule",{value:!0});var q_r=(H1(),zl(z1));q_r.__exportStar(Wgt(),RSe)});var jSe=v(OQ=>{"use strict";Object.defineProperty(OQ,"__esModule",{value:!0});OQ.isArrayBuffer=void 0;var U_r=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";OQ.isArrayBuffer=U_r});var DSe=v(Gk=>{"use strict";Object.defineProperty(Gk,"__esModule",{value:!0});Gk.fromString=Gk.fromArrayBuffer=void 0;var z_r=jSe(),NSe=Pp(),H_r=(t,e=0,r=t.byteLength-e)=>{if(!(0,z_r.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return NSe.Buffer.from(t,e,r)};Gk.fromArrayBuffer=H_r;var V_r=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?NSe.Buffer.from(t,e):NSe.Buffer.from(t)};Gk.fromString=V_r});var LSe=v(PQ=>{"use strict";Object.defineProperty(PQ,"__esModule",{value:!0});PQ.fromUtf8=void 0;var W_r=DSe(),K_r=t=>{let e=(0,W_r.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)};PQ.fromUtf8=K_r});var Ggt=v(EQ=>{"use strict";Object.defineProperty(EQ,"__esModule",{value:!0});EQ.toUint8Array=void 0;var G_r=LSe(),J_r=t=>typeof t=="string"?(0,G_r.fromUtf8)(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t);EQ.toUint8Array=J_r});var Jgt=v(TQ=>{"use strict";Object.defineProperty(TQ,"__esModule",{value:!0});TQ.toUtf8=void 0;var Y_r=DSe(),Z_r=t=>(0,Y_r.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8");TQ.toUtf8=Z_r});var AQ=v(NH=>{"use strict";Object.defineProperty(NH,"__esModule",{value:!0});var FSe=(H1(),zl(z1));FSe.__exportStar(LSe(),NH);FSe.__exportStar(Ggt(),NH);FSe.__exportStar(Jgt(),NH)});var W1=v(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.MAX_PRESIGNED_TTL=Lt.KEY_TYPE_IDENTIFIER=Lt.MAX_CACHE_SIZE=Lt.UNSIGNED_PAYLOAD=Lt.EVENT_ALGORITHM_IDENTIFIER=Lt.ALGORITHM_IDENTIFIER_V4A=Lt.ALGORITHM_IDENTIFIER=Lt.UNSIGNABLE_PATTERNS=Lt.SEC_HEADER_PATTERN=Lt.PROXY_HEADER_PATTERN=Lt.ALWAYS_UNSIGNABLE_HEADERS=Lt.HOST_HEADER=Lt.TOKEN_HEADER=Lt.SHA256_HEADER=Lt.SIGNATURE_HEADER=Lt.GENERATED_HEADERS=Lt.DATE_HEADER=Lt.AMZ_DATE_HEADER=Lt.AUTH_HEADER=Lt.REGION_SET_PARAM=Lt.TOKEN_QUERY_PARAM=Lt.SIGNATURE_QUERY_PARAM=Lt.EXPIRES_QUERY_PARAM=Lt.SIGNED_HEADERS_QUERY_PARAM=Lt.AMZ_DATE_QUERY_PARAM=Lt.CREDENTIAL_QUERY_PARAM=Lt.ALGORITHM_QUERY_PARAM=void 0;Lt.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm";Lt.CREDENTIAL_QUERY_PARAM="X-Amz-Credential";Lt.AMZ_DATE_QUERY_PARAM="X-Amz-Date";Lt.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders";Lt.EXPIRES_QUERY_PARAM="X-Amz-Expires";Lt.SIGNATURE_QUERY_PARAM="X-Amz-Signature";Lt.TOKEN_QUERY_PARAM="X-Amz-Security-Token";Lt.REGION_SET_PARAM="X-Amz-Region-Set";Lt.AUTH_HEADER="authorization";Lt.AMZ_DATE_HEADER=Lt.AMZ_DATE_QUERY_PARAM.toLowerCase();Lt.DATE_HEADER="date";Lt.GENERATED_HEADERS=[Lt.AUTH_HEADER,Lt.AMZ_DATE_HEADER,Lt.DATE_HEADER];Lt.SIGNATURE_HEADER=Lt.SIGNATURE_QUERY_PARAM.toLowerCase();Lt.SHA256_HEADER="x-amz-content-sha256";Lt.TOKEN_HEADER=Lt.TOKEN_QUERY_PARAM.toLowerCase();Lt.HOST_HEADER="host";Lt.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};Lt.PROXY_HEADER_PATTERN=/^proxy-/;Lt.SEC_HEADER_PATTERN=/^sec-/;Lt.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i];Lt.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256";Lt.ALGORITHM_IDENTIFIER_V4A="AWS4-ECDSA-P256-SHA256";Lt.EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD";Lt.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD";Lt.MAX_CACHE_SIZE=50;Lt.KEY_TYPE_IDENTIFIER="aws4_request";Lt.MAX_PRESIGNED_TTL=60*60*24*7});var $Se=v(eA=>{"use strict";Object.defineProperty(eA,"__esModule",{value:!0});eA.clearCredentialCache=eA.getSigningKey=eA.createScope=void 0;var X_r=Wk(),Q_r=AQ(),kSe=W1(),Jk={},IQ=[],evr=(t,e,r)=>`${t}/${e}/${r}/${kSe.KEY_TYPE_IDENTIFIER}`;eA.createScope=evr;var tvr=async(t,e,r,n,o)=>{let i=await Ygt(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${(0,X_r.toHex)(i)}:${e.sessionToken}`;if(a in Jk)return Jk[a];for(IQ.push(a);IQ.length>kSe.MAX_CACHE_SIZE;)delete Jk[IQ.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,kSe.KEY_TYPE_IDENTIFIER])s=await Ygt(t,s,u);return Jk[a]=s};eA.getSigningKey=tvr;var rvr=()=>{IQ.length=0,Object.keys(Jk).forEach(t=>{delete Jk[t]})};eA.clearCredentialCache=rvr;var Ygt=(t,e,r)=>{let n=new t(e);return n.update((0,Q_r.toUint8Array)(r)),n.digest()}});var qSe=v(MQ=>{"use strict";Object.defineProperty(MQ,"__esModule",{value:!0});MQ.getCanonicalHeaders=void 0;var BSe=W1(),nvr=({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 BSe.ALWAYS_UNSIGNABLE_HEADERS||e?.has(i)||BSe.PROXY_HEADER_PATTERN.test(i)||BSe.SEC_HEADER_PATTERN.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n};MQ.getCanonicalHeaders=nvr});var USe=v(RQ=>{"use strict";Object.defineProperty(RQ,"__esModule",{value:!0});RQ.escapeUri=void 0;var ovr=t=>encodeURIComponent(t).replace(/[!'()*]/g,ivr);RQ.escapeUri=ovr;var ivr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var Zgt=v(jQ=>{"use strict";Object.defineProperty(jQ,"__esModule",{value:!0});jQ.escapeUriPath=void 0;var avr=USe(),svr=t=>t.split("/").map(avr.escapeUri).join("/");jQ.escapeUriPath=svr});var Qgt=v(NQ=>{"use strict";Object.defineProperty(NQ,"__esModule",{value:!0});var Xgt=(H1(),zl(z1));Xgt.__exportStar(USe(),NQ);Xgt.__exportStar(Zgt(),NQ)});var zSe=v(LQ=>{"use strict";Object.defineProperty(LQ,"__esModule",{value:!0});LQ.getCanonicalQuery=void 0;var DQ=Qgt(),uvr=W1(),lvr=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===uvr.SIGNATURE_HEADER)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${(0,DQ.escapeUri)(n)}=${(0,DQ.escapeUri)(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).sort().reduce((i,a)=>i.concat([`${(0,DQ.escapeUri)(n)}=${(0,DQ.escapeUri)(a)}`]),[]).join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")};LQ.getCanonicalQuery=lvr});var HSe=v(FQ=>{"use strict";Object.defineProperty(FQ,"__esModule",{value:!0});FQ.getPayloadHash=void 0;var cvr=jSe(),dvr=Wk(),fvr=AQ(),eyt=W1(),pvr=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===eyt.SHA256_HEADER)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||(0,cvr.isArrayBuffer)(e)){let n=new r;return n.update((0,fvr.toUint8Array)(e)),(0,dvr.toHex)(await n.digest())}return eyt.UNSIGNED_PAYLOAD};FQ.getPayloadHash=pvr});var tyt=v(tA=>{"use strict";Object.defineProperty(tA,"__esModule",{value:!0});tA.deleteHeader=tA.getHeaderValue=tA.hasHeader=void 0;var mvr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1};tA.hasHeader=mvr;var hvr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return e[r]};tA.getHeaderValue=hvr;var gvr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))t===r.toLowerCase()&&delete e[r]};tA.deleteHeader=gvr});var VSe=v(K1=>{"use strict";Object.defineProperty(K1,"__esModule",{value:!0});K1.cloneQuery=K1.cloneRequest=void 0;var yvr=({headers:t,query:e,...r})=>({...r,headers:{...t},query:e?(0,K1.cloneQuery)(e):void 0});K1.cloneRequest=yvr;var bvr=t=>Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{});K1.cloneQuery=bvr});var WSe=v(kQ=>{"use strict";Object.defineProperty(kQ,"__esModule",{value:!0});kQ.moveHeadersToQuery=void 0;var _vr=VSe(),vvr=(t,e={})=>{var r;let{headers:n,query:o={}}=typeof t.clone=="function"?t.clone():(0,_vr.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}};kQ.moveHeadersToQuery=vvr});var KSe=v($Q=>{"use strict";Object.defineProperty($Q,"__esModule",{value:!0});$Q.prepareRequest=void 0;var wvr=VSe(),Svr=W1(),xvr=t=>{t=typeof t.clone=="function"?t.clone():(0,wvr.cloneRequest)(t);for(let e of Object.keys(t.headers))Svr.GENERATED_HEADERS.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t};$Q.prepareRequest=xvr});var ryt=v(G1=>{"use strict";Object.defineProperty(G1,"__esModule",{value:!0});G1.toDate=G1.iso8601=void 0;var Cvr=t=>(0,G1.toDate)(t).toISOString().replace(/\.\d{3}Z$/,"Z");G1.iso8601=Cvr;var Ovr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;G1.toDate=Ovr});var syt=v(zQ=>{"use strict";Object.defineProperty(zQ,"__esModule",{value:!0});zQ.SignatureV4=void 0;var Pvr=Vgt(),BQ=Wk(),nyt=Kgt(),DH=AQ(),Bc=W1(),qQ=$Se(),oyt=qSe(),Evr=zSe(),GSe=HSe(),Tvr=tyt(),Avr=WSe(),iyt=KSe(),Ivr=ryt(),JSe=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerMarshaller=new Pvr.HeaderMarshaller(DH.toUtf8,DH.fromUtf8),this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=(0,nyt.normalizeProvider)(n),this.credentialProvider=(0,nyt.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}=UQ(n);if(o>Bc.MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=(0,qQ.createScope)(p,d,l??this.service),h=(0,Avr.moveHeadersToQuery)((0,iyt.prepareRequest)(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[Bc.TOKEN_QUERY_PARAM]=c.sessionToken),h.query[Bc.ALGORITHM_QUERY_PARAM]=Bc.ALGORITHM_IDENTIFIER,h.query[Bc.CREDENTIAL_QUERY_PARAM]=`${c.accessKeyId}/${m}`,h.query[Bc.AMZ_DATE_QUERY_PARAM]=f,h.query[Bc.EXPIRES_QUERY_PARAM]=o.toString(10);let b=(0,oyt.getCanonicalHeaders)(h,i,s);return h.query[Bc.SIGNED_HEADERS_QUERY_PARAM]=ayt(b),h.query[Bc.SIGNATURE_QUERY_PARAM]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,b,await(0,GSe.getPayloadHash)(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=UQ(n),c=(0,qQ.createScope)(u,s,a??this.service),d=await(0,GSe.getPayloadHash)({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=(0,BQ.toHex)(await f.digest()),m=[Bc.EVENT_ALGORITHM_IDENTIFIER,l,c,o,p,d].join(` -`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerMarshaller.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=UQ(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update((0,DH.toUint8Array)(e)),(0,BQ.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,iyt.prepareRequest)(e),{longDate:c,shortDate:d}=UQ(r),f=(0,qQ.createScope)(d,u,a??this.service);l.headers[Bc.AMZ_DATE_HEADER]=c,s.sessionToken&&(l.headers[Bc.TOKEN_HEADER]=s.sessionToken);let p=await(0,GSe.getPayloadHash)(l,this.sha256);!(0,Tvr.hasHeader)(Bc.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[Bc.SHA256_HEADER]=p);let m=(0,oyt.getCanonicalHeaders)(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[Bc.AUTH_HEADER]=`${Bc.ALGORITHM_IDENTIFIER} Credential=${s.accessKeyId}/${f}, SignedHeaders=${ayt(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method} + - EKS container host 169.254.170.23 or [fd00:ec2::23]`,{logger:e})}}});var Udt=w(()=>{});var zdt=w(()=>{Udt()});var Hdt=w(()=>{Hs()});var Vdt=w(()=>{});var Wdt=w(()=>{});function pyr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var VX,Kdt=w(()=>{VX=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=pyr(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 Gdt=w(()=>{});var Jdt=w(()=>{});var Ydt=w(()=>{});var Zdt=w(()=>{zdt();Hdt();Vdt();Wdt();Kdt();Gdt();Jdt();Ydt()});function Xdt(t){return new VX({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 Qdt(t,e){let n=await gat(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 Tl("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:jat(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new Tl(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new Tl(`Server responded with status: ${t.statusCode}`,{logger:e})}var eft=w(()=>{sO();Zdt();ar();Pve()});var tft,rft=w(()=>{tft=(t,e,r)=>async()=>{for(let n=0;nsetTimeout(i,r))}return await t()}});var d0e,nft=w(()=>{J3();sO();qdt();eft();rft();d0e=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new Tl("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);Bdt(n,t.logger);let o=new NT;return tft(async()=>{let i=Xdt(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return Qdt(a.response)},t.maxRetries??3,t.timeout??1e3)}});var oft=w(()=>{nft()});function myr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function ift(t){return{schemeId:"smithy.api#noAuth"}}var aft,sft,hyr,uft,f0e=w(()=>{k1();jy();fH();aft=async(t,e,r)=>({operation:A_(e).operation,region:await zd(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});sft=t=>{let e=[];switch(t.operation){case"AssumeRoleWithSAML":{e.push(ift(t));break}case"AssumeRoleWithWebIdentity":{e.push(ift(t));break}default:e.push(myr(t))}return e},hyr=t=>({...t,stsClientCtor:Zh}),uft=t=>{let e=hyr(t);return{...YZ(e)}}});var lft,Vd,L_=w(()=>{lft=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),Vd={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 dft,cft=w(()=>{dft={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 p0e,m0e=w(()=>{p0e=t=>new TextEncoder().encode(t)});var fft=w(()=>{m0e()});var pft,mft=w(()=>{pft=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 hft=w(()=>{m0e();fft();mft()});var Pft,rn,xo,Co,UT,qT,kc,Eft,Tft,Aft,Pa,gft,F_,Rk,g0e,yft,h0e,Ift,bft,$c,_ft,Mft,Rft,Wd,Dm,vft,jft,Nft,wft,Dft,Sft,xft,Cft,Oft,yyr,Lft,Fft=w(()=>{Pft="required",rn="type",xo="fn",Co="argv",UT="ref",qT="booleanEquals",kc="stringEquals",Eft="sigv4",Tft="sts",Aft="us-east-1",Pa="endpoint",gft="https://sts.{Region}.{PartitionResult#dnsSuffix}",F_="tree",Rk="error",g0e="getAttr",yft={[Pft]:!1,[rn]:"String"},h0e={[Pft]:!0,default:!1,[rn]:"Boolean"},Ift={[UT]:"Endpoint"},bft={[xo]:"isSet",[Co]:[{[UT]:"Region"}]},$c={[UT]:"Region"},_ft={[xo]:"aws.partition",[Co]:[$c],assign:"PartitionResult"},Mft={[UT]:"UseFIPS"},Rft={[UT]:"UseDualStack"},Wd={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:Eft,signingName:Tft,signingRegion:Aft}]},headers:{}},Dm={},vft={conditions:[{[xo]:kc,[Co]:[$c,"aws-global"]}],[Pa]:Wd,[rn]:Pa},jft={[xo]:qT,[Co]:[Mft,!0]},Nft={[xo]:qT,[Co]:[Rft,!0]},wft={[xo]:g0e,[Co]:[{[UT]:"PartitionResult"},"supportsFIPS"]},Dft={[UT]:"PartitionResult"},Sft={[xo]:qT,[Co]:[!0,{[xo]:g0e,[Co]:[Dft,"supportsDualStack"]}]},xft=[{[xo]:"isSet",[Co]:[Ift]}],Cft=[jft],Oft=[Nft],yyr={version:"1.0",parameters:{Region:yft,UseDualStack:h0e,UseFIPS:h0e,Endpoint:yft,UseGlobalEndpoint:h0e},rules:[{conditions:[{[xo]:qT,[Co]:[{[UT]:"UseGlobalEndpoint"},!0]},{[xo]:"not",[Co]:xft},bft,_ft,{[xo]:qT,[Co]:[Mft,!1]},{[xo]:qT,[Co]:[Rft,!1]}],rules:[{conditions:[{[xo]:kc,[Co]:[$c,"ap-northeast-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"ap-south-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"ap-southeast-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"ap-southeast-2"]}],endpoint:Wd,[rn]:Pa},vft,{conditions:[{[xo]:kc,[Co]:[$c,"ca-central-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-central-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-north-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-west-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-west-2"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-west-3"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"sa-east-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,Aft]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"us-east-2"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"us-west-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"us-west-2"]}],endpoint:Wd,[rn]:Pa},{endpoint:{url:gft,properties:{authSchemes:[{name:Eft,signingName:Tft,signingRegion:"{Region}"}]},headers:Dm},[rn]:Pa}],[rn]:F_},{conditions:xft,rules:[{conditions:Cft,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[rn]:Rk},{conditions:Oft,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[rn]:Rk},{endpoint:{url:Ift,properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_},{conditions:[bft],rules:[{conditions:[_ft],rules:[{conditions:[jft,Nft],rules:[{conditions:[{[xo]:qT,[Co]:[!0,wft]},Sft],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[rn]:Rk}],[rn]:F_},{conditions:Cft,rules:[{conditions:[{[xo]:qT,[Co]:[wft,!0]}],rules:[{conditions:[{[xo]:kc,[Co]:[{[xo]:g0e,[Co]:[Dft,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:Dm,headers:Dm},[rn]:Pa},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_},{error:"FIPS is enabled but this partition does not support FIPS",[rn]:Rk}],[rn]:F_},{conditions:Oft,rules:[{conditions:[Sft],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_},{error:"DualStack is enabled but this partition does not support DualStack",[rn]:Rk}],[rn]:F_},vft,{endpoint:{url:gft,properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_}],[rn]:F_},{error:"Invalid Configuration: Missing Region",[rn]:Rk}]},Lft=yyr});var kft,$ft=w(()=>{tZ();ET();Fft();kft=(t,e={})=>$3(Lft,{endpointParams:t,logger:e.logger});uO.aws=B3});var Bft,qft=w(()=>{k1();LT();ar();fZ();bk();hft();f0e();$ft();Bft=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??RT,base64Encoder:t?.base64Encoder??jT,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??kft,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??sft,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new D1},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new xk}],logger:t?.logger??new AT,serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??TT,utf8Decoder:t?.utf8Decoder??p0e,utf8Encoder:t?.utf8Encoder??pft})});var Uft,zft=w(()=>{cft();Swe();Owe();q3();J3();Pwe();Ewe();M_();qft();ar();Mwe();Uft=t=>{let e=oX(t),r=()=>e().then(RZ),n=Bft(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??nX,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??tX({serviceId:n.serviceId,clientVersion:dft.version}),maxAttempts:t?.maxAttempts??I_,region:t?.region??rX("Region is missing"),requestHandler:NT.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||H3),sha256:t?.sha256??eX,streamCollector:t?.streamCollector??_k,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(sZ)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(uZ))}}});var Hft,Vft,Wft=w(()=>{Hft=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},Vft=t=>({httpHandler:t.httpHandler()})});var Kft=w(()=>{Wft()});var Gft=w(()=>{Hs()});var Jft=w(()=>{});var Yft=w(()=>{});function byr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var WX,Zft=w(()=>{WX=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=byr(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 Xft=w(()=>{});var Qft=w(()=>{});var ept=w(()=>{});var y0e=w(()=>{Kft();Gft();Jft();Yft();Zft();Xft();Qft();ept()});var tpt,rpt,npt=w(()=>{tpt=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}}},rpt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var KX,opt,ipt=w(()=>{jwe();y0e();ar();npt();KX=t=>t,opt=(t,e)=>{let r={...KX(iX(t)),...KX(jZ(t)),...KX(Hft(t)),...KX(tpt(t))};return e.forEach(n=>n.configure(r)),{...t,...aX(r),...NZ(r),...Vft(r),...rpt(r)}}});var Zh,fH=w(()=>{I_e();M_e();R_e();J_e();q3();LT();$ve();zn();FZ();ar();f0e();L_();zft();ipt();Zh=class extends I1{constructor(...[e]){let r=Uft(e||{}),n=lft(r),o=KY(n),i=OZ(o),a=cZ(i),s=a,u=hZ(s),l=uft(u),c=opt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(iZ(this.config)),this.middlewareStack.use(LZ(this.config)),this.middlewareStack.use(BZ(this.config)),this.middlewareStack.use(zY(this.config)),this.middlewareStack.use(HY(this.config)),this.middlewareStack.use(WY(this.config)),this.middlewareStack.use(gZ(this.config,{httpAuthSchemeParametersProvider:aft,identityProviderConfigProvider:async d=>new Sk({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(kZ(this.config))}destroy(){super.destroy()}}});var Hf,GX=w(()=>{ar();Hf=class t extends wk{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var pH,mH,hH,gH,yH,bH,_H,vH,jk,b0e,_0e,v0e,w0e,S0e,x0e,C0e,zT=w(()=>{ar();GX();pH=class t extends Hf{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},mH=class t extends Hf{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},hH=class t extends Hf{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},gH=class t extends Hf{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},yH=class t extends Hf{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},bH=class t extends Hf{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_H=class t extends Hf{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},vH=class t extends Hf{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},jk=t=>({...t,...t.SecretAccessKey&&{SecretAccessKey:TZ}}),b0e=t=>({...t,...t.Credentials&&{Credentials:jk(t.Credentials)}}),_0e=t=>({...t,...t.SAMLAssertion&&{SAMLAssertion:TZ}}),v0e=t=>({...t,...t.Credentials&&{Credentials:jk(t.Credentials)}}),w0e=t=>({...t,...t.WebIdentityToken&&{WebIdentityToken:TZ}}),S0e=t=>({...t,...t.Credentials&&{Credentials:jk(t.Credentials)}}),x0e=t=>({...t,...t.Credentials&&{Credentials:jk(t.Credentials)}}),C0e=t=>({...t,...t.Credentials&&{Credentials:jk(t.Credentials)}})});var apt,spt,upt,lpt,cpt,dpt,fpt,ppt,mpt,hpt,gpt,ypt,bpt,_pt,vpt,wpt,HT,_yr,vyr,wyr,Syr,xyr,Cyr,Oyr,Pyr,Eyr,Tyr,Ayr,Iyr,Myr,Ryr,jyr,Nyr,JX,Dyr,Lyr,Fyr,kyr,$yr,Spt,Q0e,Byr,qyr,Uyr,wH,zyr,Hyr,Vyr,Wyr,Kyr,Gyr,Jyr,Yyr,Zyr,Xyr,Qyr,ebr,tbr,rbr,Kd,nbr,VT,WT,KT,GT,Nk,obr,O0e,mO,ibr,abr,Dk,hO,Lk,Vf,P0e,sbr,E0e,Wf,T0e,A0e,I0e,M0e,R0e,ubr,lbr,cbr,dbr,j0e,N0e,D0e,L0e,Xh,Qh,F0e,k0e,$0e,B0e,eg,q0e,gO,Fk,U0e,z0e,H0e,V0e,tg,kk,W0e,K0e,$k,Bk,G0e,J0e,JT,Y0e,Z0e,X0e,Ea,YT,fbr,yO=w(()=>{k1();y0e();ar();zT();GX();apt=async(t,e)=>{let r=WT,n;return n=YT({...Eyr(t,e),[GT]:obr,[JT]:KT}),VT(e,r,"/",void 0,n)},spt=async(t,e)=>{let r=WT,n;return n=YT({...Tyr(t,e),[GT]:ibr,[JT]:KT}),VT(e,r,"/",void 0,n)},upt=async(t,e)=>{let r=WT,n;return n=YT({...Ayr(t,e),[GT]:abr,[JT]:KT}),VT(e,r,"/",void 0,n)},lpt=async(t,e)=>{let r=WT,n;return n=YT({...Iyr(t,e),[GT]:sbr,[JT]:KT}),VT(e,r,"/",void 0,n)},cpt=async(t,e)=>{let r=WT,n;return n=YT({...Myr(t,e),[GT]:ubr,[JT]:KT}),VT(e,r,"/",void 0,n)},dpt=async(t,e)=>{let r=WT,n;return n=YT({...Ryr(t,e),[GT]:lbr,[JT]:KT}),VT(e,r,"/",void 0,n)},fpt=async(t,e)=>{let r=WT,n;return n=YT({...jyr(t,e),[GT]:cbr,[JT]:KT}),VT(e,r,"/",void 0,n)},ppt=async(t,e)=>{let r=WT,n;return n=YT({...Nyr(t,e),[GT]:dbr,[JT]:KT}),VT(e,r,"/",void 0,n)},mpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Byr(r.AssumeRoleResult,e),{$metadata:Kd(t),...n}},hpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=qyr(r.AssumeRoleWithSAMLResult,e),{$metadata:Kd(t),...n}},gpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Uyr(r.AssumeRoleWithWebIdentityResult,e),{$metadata:Kd(t),...n}},ypt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=zyr(r.DecodeAuthorizationMessageResult,e),{$metadata:Kd(t),...n}},bpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Wyr(r.GetAccessKeyInfoResult,e),{$metadata:Kd(t),...n}},_pt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Kyr(r.GetCallerIdentityResult,e),{$metadata:Kd(t),...n}},vpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Gyr(r.GetFederationTokenResult,e),{$metadata:Kd(t),...n}},wpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Jyr(r.GetSessionTokenResult,e),{$metadata:Kd(t),...n}},HT=async(t,e)=>{let r={...t,body:await hlt(t.body,e)},n=fbr(t,r.body);switch(n){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await _yr(r,e);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await Cyr(r,e);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await Oyr(r,e);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await Pyr(r,e);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await wyr(r,e);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await xyr(r,e);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await vyr(r,e);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await Syr(r,e);default:let o=r.body;return nbr({output:t,parsedBody:o.Error,errorCode:n})}},_yr=async(t,e)=>{let r=t.body,n=Hyr(r.Error,e),o=new pH({$metadata:Kd(t),...n});return qa(o,r)},vyr=async(t,e)=>{let r=t.body,n=Yyr(r.Error,e),o=new _H({$metadata:Kd(t),...n});return qa(o,r)},wyr=async(t,e)=>{let r=t.body,n=Zyr(r.Error,e),o=new yH({$metadata:Kd(t),...n});return qa(o,r)},Syr=async(t,e)=>{let r=t.body,n=Xyr(r.Error,e),o=new vH({$metadata:Kd(t),...n});return qa(o,r)},xyr=async(t,e)=>{let r=t.body,n=Qyr(r.Error,e),o=new bH({$metadata:Kd(t),...n});return qa(o,r)},Cyr=async(t,e)=>{let r=t.body,n=ebr(r.Error,e),o=new mH({$metadata:Kd(t),...n});return qa(o,r)},Oyr=async(t,e)=>{let r=t.body,n=tbr(r.Error,e),o=new hH({$metadata:Kd(t),...n});return qa(o,r)},Pyr=async(t,e)=>{let r=t.body,n=rbr(r.Error,e),o=new gH({$metadata:Kd(t),...n});return qa(o,r)},Eyr=(t,e)=>{let r={};if(t[gO]!=null&&(r[gO]=t[gO]),t[Fk]!=null&&(r[Fk]=t[Fk]),t[Qh]!=null){let n=JX(t[Qh],e);t[Qh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[Xh]!=null&&(r[Xh]=t[Xh]),t[Wf]!=null&&(r[Wf]=t[Wf]),t[$k]!=null){let n=Spt(t[$k],e);t[$k]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}if(t[G0e]!=null){let n=$yr(t[G0e],e);t[G0e]?.length===0&&(r.TransitiveTagKeys=[]),Object.entries(n).forEach(([o,i])=>{let a=`TransitiveTagKeys.${o}`;r[a]=i})}if(t[A0e]!=null&&(r[A0e]=t[A0e]),t[kk]!=null&&(r[kk]=t[kk]),t[Bk]!=null&&(r[Bk]=t[Bk]),t[tg]!=null&&(r[tg]=t[tg]),t[$0e]!=null){let n=Fyr(t[$0e],e);t[$0e]?.length===0&&(r.ProvidedContexts=[]),Object.entries(n).forEach(([o,i])=>{let a=`ProvidedContexts.${o}`;r[a]=i})}return r},Tyr=(t,e)=>{let r={};if(t[gO]!=null&&(r[gO]=t[gO]),t[F0e]!=null&&(r[F0e]=t[F0e]),t[H0e]!=null&&(r[H0e]=t[H0e]),t[Qh]!=null){let n=JX(t[Qh],e);t[Qh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[Xh]!=null&&(r[Xh]=t[Xh]),t[Wf]!=null&&(r[Wf]=t[Wf]),r},Ayr=(t,e)=>{let r={};if(t[gO]!=null&&(r[gO]=t[gO]),t[Fk]!=null&&(r[Fk]=t[Fk]),t[Z0e]!=null&&(r[Z0e]=t[Z0e]),t[B0e]!=null&&(r[B0e]=t[B0e]),t[Qh]!=null){let n=JX(t[Qh],e);t[Qh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[Xh]!=null&&(r[Xh]=t[Xh]),t[Wf]!=null&&(r[Wf]=t[Wf]),r},Iyr=(t,e)=>{let r={};return t[I0e]!=null&&(r[I0e]=t[I0e]),r},Myr=(t,e)=>{let r={};return t[Nk]!=null&&(r[Nk]=t[Nk]),r},Ryr=(t,e)=>({}),jyr=(t,e)=>{let r={};if(t[D0e]!=null&&(r[D0e]=t[D0e]),t[Xh]!=null&&(r[Xh]=t[Xh]),t[Qh]!=null){let n=JX(t[Qh],e);t[Qh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[Wf]!=null&&(r[Wf]=t[Wf]),t[$k]!=null){let n=Spt(t[$k],e);t[$k]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}return r},Nyr=(t,e)=>{let r={};return t[Wf]!=null&&(r[Wf]=t[Wf]),t[kk]!=null&&(r[kk]=t[kk]),t[Bk]!=null&&(r[Bk]=t[Bk]),r},JX=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=Dyr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},Dyr=(t,e)=>{let r={};return t[X0e]!=null&&(r[X0e]=t[X0e]),r},Lyr=(t,e)=>{let r={};return t[k0e]!=null&&(r[k0e]=t[k0e]),t[P0e]!=null&&(r[P0e]=t[P0e]),r},Fyr=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=Lyr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},kyr=(t,e)=>{let r={};return t[N0e]!=null&&(r[N0e]=t[N0e]),t[Y0e]!=null&&(r[Y0e]=t[Y0e]),r},$yr=(t,e)=>{let r={},n=1;for(let o of t)o!==null&&(r[`member.${n}`]=o,n++);return r},Spt=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=kyr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},Q0e=(t,e)=>{let r={};return t[O0e]!=null&&(r[O0e]=ln(t[O0e])),t[hO]!=null&&(r[hO]=ln(t[hO])),r},Byr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=wH(t[Vf],e)),t[mO]!=null&&(r[mO]=Q0e(t[mO],e)),t[eg]!=null&&(r[eg]=Z3(t[eg])),t[tg]!=null&&(r[tg]=ln(t[tg])),r},qyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=wH(t[Vf],e)),t[mO]!=null&&(r[mO]=Q0e(t[mO],e)),t[eg]!=null&&(r[eg]=Z3(t[eg])),t[U0e]!=null&&(r[U0e]=ln(t[U0e])),t[W0e]!=null&&(r[W0e]=ln(t[W0e])),t[j0e]!=null&&(r[j0e]=ln(t[j0e])),t[Lk]!=null&&(r[Lk]=ln(t[Lk])),t[L0e]!=null&&(r[L0e]=ln(t[L0e])),t[tg]!=null&&(r[tg]=ln(t[tg])),r},Uyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=wH(t[Vf],e)),t[V0e]!=null&&(r[V0e]=ln(t[V0e])),t[mO]!=null&&(r[mO]=Q0e(t[mO],e)),t[eg]!=null&&(r[eg]=Z3(t[eg])),t[q0e]!=null&&(r[q0e]=ln(t[q0e])),t[Lk]!=null&&(r[Lk]=ln(t[Lk])),t[tg]!=null&&(r[tg]=ln(t[tg])),r},wH=(t,e)=>{let r={};return t[Nk]!=null&&(r[Nk]=ln(t[Nk])),t[z0e]!=null&&(r[z0e]=ln(t[z0e])),t[K0e]!=null&&(r[K0e]=ln(t[K0e])),t[T0e]!=null&&(r[T0e]=vk(Nat(t[T0e]))),r},zyr=(t,e)=>{let r={};return t[E0e]!=null&&(r[E0e]=ln(t[E0e])),r},Hyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Vyr=(t,e)=>{let r={};return t[R0e]!=null&&(r[R0e]=ln(t[R0e])),t[hO]!=null&&(r[hO]=ln(t[hO])),r},Wyr=(t,e)=>{let r={};return t[Dk]!=null&&(r[Dk]=ln(t[Dk])),r},Kyr=(t,e)=>{let r={};return t[J0e]!=null&&(r[J0e]=ln(t[J0e])),t[Dk]!=null&&(r[Dk]=ln(t[Dk])),t[hO]!=null&&(r[hO]=ln(t[hO])),r},Gyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=wH(t[Vf],e)),t[M0e]!=null&&(r[M0e]=Vyr(t[M0e],e)),t[eg]!=null&&(r[eg]=Z3(t[eg])),r},Jyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=wH(t[Vf],e)),r},Yyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Zyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Xyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Qyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},ebr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},tbr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},rbr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Kd=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"]}),nbr=MZ(Hf),VT=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 WX(l)},WT={"content-type":"application/x-www-form-urlencoded"},KT="2011-06-15",GT="Action",Nk="AccessKeyId",obr="AssumeRole",O0e="AssumedRoleId",mO="AssumedRoleUser",ibr="AssumeRoleWithSAML",abr="AssumeRoleWithWebIdentity",Dk="Account",hO="Arn",Lk="Audience",Vf="Credentials",P0e="ContextAssertion",sbr="DecodeAuthorizationMessage",E0e="DecodedMessage",Wf="DurationSeconds",T0e="Expiration",A0e="ExternalId",I0e="EncodedMessage",M0e="FederatedUser",R0e="FederatedUserId",ubr="GetAccessKeyInfo",lbr="GetCallerIdentity",cbr="GetFederationToken",dbr="GetSessionToken",j0e="Issuer",N0e="Key",D0e="Name",L0e="NameQualifier",Xh="Policy",Qh="PolicyArns",F0e="PrincipalArn",k0e="ProviderArn",$0e="ProvidedContexts",B0e="ProviderId",eg="PackedPolicySize",q0e="Provider",gO="RoleArn",Fk="RoleSessionName",U0e="Subject",z0e="SecretAccessKey",H0e="SAMLAssertion",V0e="SubjectFromWebIdentityToken",tg="SourceIdentity",kk="SerialNumber",W0e="SubjectType",K0e="SessionToken",$k="Tags",Bk="TokenCode",G0e="TransitiveTagKeys",J0e="UserId",JT="Version",Y0e="Value",Z0e="WebIdentityToken",X0e="arn",Ea="message",YT=t=>Object.entries(t).map(([e,r])=>DZ(e)+"="+DZ(r)).join("&"),fbr=(t,e)=>{if(e.Error?.Code!==void 0)return e.Error.Code;if(t.statusCode==404)return"NotFound"}});var bO,YX=w(()=>{zn();to();ar();L_();zT();yO();bO=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,b0e).ser(apt).de(mpt).build(){}});var SH,eSe=w(()=>{zn();to();ar();L_();zT();yO();SH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(_0e,v0e).ser(spt).de(hpt).build(){}});var $1,ZX=w(()=>{zn();to();ar();L_();zT();yO();$1=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(w0e,S0e).ser(upt).de(gpt).build(){}});var xH,tSe=w(()=>{zn();to();ar();L_();yO();xH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(lpt).de(ypt).build(){}});var CH,rSe=w(()=>{zn();to();ar();L_();yO();CH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(cpt).de(bpt).build(){}});var OH,nSe=w(()=>{zn();to();ar();L_();yO();OH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(dpt).de(_pt).build(){}});var PH,oSe=w(()=>{zn();to();ar();L_();zT();yO();PH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,x0e).ser(fpt).de(vpt).build(){}});var EH,iSe=w(()=>{zn();to();ar();L_();zT();yO();EH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,C0e).ser(ppt).de(wpt).build(){}});var pbr,XX,xpt=w(()=>{ar();YX();eSe();ZX();tSe();rSe();nSe();oSe();iSe();fH();pbr={AssumeRoleCommand:bO,AssumeRoleWithSAMLCommand:SH,AssumeRoleWithWebIdentityCommand:$1,DecodeAuthorizationMessageCommand:xH,GetAccessKeyInfoCommand:CH,GetCallerIdentityCommand:OH,GetFederationTokenCommand:PH,GetSessionTokenCommand:EH},XX=class extends Zh{};AZ(pbr,XX)});var Cpt=w(()=>{YX();eSe();ZX();tSe();rSe();nSe();oSe();iSe()});var Opt=w(()=>{zT()});var Ppt,Ept,Tpt,Apt,Ipt,Mpt,Rpt=w(()=>{YX();ZX();Ppt="us-east-1",Ept=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},Tpt=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)`,`${Ppt} (STS default)`),n??o??Ppt},Apt=(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 Tpt(c,t?.parentClientConfig?.region,f),m=!Mpt(d);r=new e({credentialDefaultProvider:()=>async()=>n,region:p,requestHandler:m?d:void 0,logger:l})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new bO(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=Ept(s);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}}}},Ipt=(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 Tpt(u,t?.parentClientConfig?.region,c),f=!Mpt(l);r=new e({region:d,requestHandler:f?l:void 0,logger:s})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new $1(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=Ept(i);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}}}},Mpt=t=>t?.metadata?.handlerProtocol==="h2"});var jpt,Npt,Dpt,mbr,Lpt=w(()=>{Rpt();fH();jpt=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,Npt=(t={},e)=>Apt(t,jpt(Zh,e)),Dpt=(t={},e)=>Ipt(t,jpt(Zh,e)),mbr=t=>e=>t({roleAssumer:Npt(e),roleAssumerWithWebIdentity:Dpt(e),...e})});var Fpt={};Cf(Fpt,{$Command:()=>Ot,AssumeRoleCommand:()=>bO,AssumeRoleResponseFilterSensitiveLog:()=>b0e,AssumeRoleWithSAMLCommand:()=>SH,AssumeRoleWithSAMLRequestFilterSensitiveLog:()=>_0e,AssumeRoleWithSAMLResponseFilterSensitiveLog:()=>v0e,AssumeRoleWithWebIdentityCommand:()=>$1,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:()=>w0e,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:()=>S0e,CredentialsFilterSensitiveLog:()=>jk,DecodeAuthorizationMessageCommand:()=>xH,ExpiredTokenException:()=>pH,GetAccessKeyInfoCommand:()=>CH,GetCallerIdentityCommand:()=>OH,GetFederationTokenCommand:()=>PH,GetFederationTokenResponseFilterSensitiveLog:()=>x0e,GetSessionTokenCommand:()=>EH,GetSessionTokenResponseFilterSensitiveLog:()=>C0e,IDPCommunicationErrorException:()=>_H,IDPRejectedClaimException:()=>yH,InvalidAuthorizationMessageException:()=>vH,InvalidIdentityTokenException:()=>bH,MalformedPolicyDocumentException:()=>mH,PackedPolicyTooLargeException:()=>hH,RegionDisabledException:()=>gH,STS:()=>XX,STSClient:()=>Zh,STSServiceException:()=>Hf,__Client:()=>I1,decorateDefaultCredentialProvider:()=>mbr,getDefaultRoleAssumer:()=>Npt,getDefaultRoleAssumerWithWebIdentity:()=>Dpt});var aSe=w(()=>{fH();xpt();Cpt();Opt();Lpt();GX()});var kpt={};Cf(kpt,{AssumeRoleCommand:()=>bO,STSClient:()=>Zh});var $pt=w(()=>{aSe()});var hbr,Bpt=w(()=>{sO();hbr=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 Tl("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(()=>($pt(),kpt));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 Tl(`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 qpt=w(()=>{});var Upt,zpt=w(()=>{Upt=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(()=>(aSe(),Fpt));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 Hpt=w(()=>{qpt();zpt()});var gbr,Vpt=w(()=>{Hpt();gbr=t=>Upt({...t})});var Wpt={};Cf(Wpt,{fromCognitoIdentity:()=>uyr,fromCognitoIdentityPool:()=>lyr,fromHttp:()=>d0e,fromTemporaryCredentials:()=>hbr,fromWebToken:()=>gbr});var Kpt=w(()=>{kdt();$dt();oft();Bpt();Vpt()});var B1={};Cf(B1,{__addDisposableResource:()=>mmt,__assign:()=>QX,__asyncDelegator:()=>amt,__asyncGenerator:()=>imt,__asyncValues:()=>smt,__await:()=>qk,__awaiter:()=>Qpt,__classPrivateFieldGet:()=>dmt,__classPrivateFieldIn:()=>pmt,__classPrivateFieldSet:()=>fmt,__createBinding:()=>tQ,__decorate:()=>Ypt,__disposeResources:()=>hmt,__esDecorate:()=>ybr,__exportStar:()=>tmt,__extends:()=>Gpt,__generator:()=>emt,__importDefault:()=>cmt,__importStar:()=>lmt,__makeTemplateObject:()=>umt,__metadata:()=>Xpt,__param:()=>Zpt,__propKey:()=>_br,__read:()=>uSe,__rest:()=>Jpt,__runInitializers:()=>bbr,__setFunctionName:()=>vbr,__spread:()=>rmt,__spreadArray:()=>omt,__spreadArrays:()=>nmt,__values:()=>eQ,default:()=>xbr});function Gpt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");sSe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Jpt(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=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 Zpt(t,e){return function(r,n){e(r,n,t)}}function ybr(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var b=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(d=a(b.get))&&(c.get=d),(d=a(b.set))&&(c.set=d),(d=a(b.init))&&o.unshift(d)}else(d=a(b))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function bbr(t,e,r){for(var n=arguments.length>2,o=0;o0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]=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 uSe(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 rmt(){for(var t=[],e=0;e1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof qk?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function amt(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:qk(t[o](a)),done:!1}:i?i(a):a}:i}}function smt(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 eQ=="function"?eQ(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 umt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function lmt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tQ(e,t,r);return wbr(e,t),e}function cmt(t){return t&&t.__esModule?t:{default:t}}function dmt(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 fmt(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 pmt(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 mmt(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 hmt(t){function e(i){t.error=t.hasError?new Sbr(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 sSe,QX,tQ,wbr,Sbr,xbr,q1=w(()=>{sSe=function(t,e){return sSe=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])},sSe(t,e)};QX=function(){return QX=Object.assign||function(e){for(var r,n=1,o=arguments.length;n{"use strict";Object.defineProperty(gmt,"__esModule",{value:!0})});var bmt=v(TH=>{"use strict";Object.defineProperty(TH,"__esModule",{value:!0});TH.HttpAuthLocation=void 0;var Cbr;(function(t){t.HEADER="header",t.QUERY="query"})(Cbr=TH.HttpAuthLocation||(TH.HttpAuthLocation={}))});var vmt=v(_mt=>{"use strict";Object.defineProperty(_mt,"__esModule",{value:!0})});var Smt=v(wmt=>{"use strict";Object.defineProperty(wmt,"__esModule",{value:!0})});var Cmt=v(xmt=>{"use strict";Object.defineProperty(xmt,"__esModule",{value:!0})});var Pmt=v(Omt=>{"use strict";Object.defineProperty(Omt,"__esModule",{value:!0})});var Tmt=v(Emt=>{"use strict";Object.defineProperty(Emt,"__esModule",{value:!0})});var Imt=v(Amt=>{"use strict";Object.defineProperty(Amt,"__esModule",{value:!0})});var Rmt=v(Mmt=>{"use strict";Object.defineProperty(Mmt,"__esModule",{value:!0})});var jmt=v(AH=>{"use strict";Object.defineProperty(AH,"__esModule",{value:!0});var lSe=(q1(),zl(B1));lSe.__exportStar(Tmt(),AH);lSe.__exportStar(Imt(),AH);lSe.__exportStar(Rmt(),AH)});var Dmt=v(Nmt=>{"use strict";Object.defineProperty(Nmt,"__esModule",{value:!0})});var Fmt=v(Lmt=>{"use strict";Object.defineProperty(Lmt,"__esModule",{value:!0})});var kmt=v(IH=>{"use strict";Object.defineProperty(IH,"__esModule",{value:!0});IH.EndpointURLScheme=void 0;var Obr;(function(t){t.HTTP="http",t.HTTPS="https"})(Obr=IH.EndpointURLScheme||(IH.EndpointURLScheme={}))});var Bmt=v($mt=>{"use strict";Object.defineProperty($mt,"__esModule",{value:!0})});var Umt=v(qmt=>{"use strict";Object.defineProperty(qmt,"__esModule",{value:!0})});var Hmt=v(zmt=>{"use strict";Object.defineProperty(zmt,"__esModule",{value:!0})});var Wmt=v(Vmt=>{"use strict";Object.defineProperty(Vmt,"__esModule",{value:!0})});var Gmt=v(Kmt=>{"use strict";Object.defineProperty(Kmt,"__esModule",{value:!0})});var Jmt=v(U1=>{"use strict";Object.defineProperty(U1,"__esModule",{value:!0});var MH=(q1(),zl(B1));MH.__exportStar(Bmt(),U1);MH.__exportStar(Umt(),U1);MH.__exportStar(Hmt(),U1);MH.__exportStar(Wmt(),U1);MH.__exportStar(Gmt(),U1)});var Zmt=v(Ymt=>{"use strict";Object.defineProperty(Ymt,"__esModule",{value:!0})});var Xmt=v(RH=>{"use strict";Object.defineProperty(RH,"__esModule",{value:!0});RH.FieldPosition=void 0;var Pbr;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(Pbr=RH.FieldPosition||(RH.FieldPosition={}))});var eht=v(Qmt=>{"use strict";Object.defineProperty(Qmt,"__esModule",{value:!0})});var rht=v(tht=>{"use strict";Object.defineProperty(tht,"__esModule",{value:!0})});var oht=v(rQ=>{"use strict";Object.defineProperty(rQ,"__esModule",{value:!0});var nht=(q1(),zl(B1));nht.__exportStar(eht(),rQ);nht.__exportStar(rht(),rQ)});var aht=v(iht=>{"use strict";Object.defineProperty(iht,"__esModule",{value:!0})});var uht=v(sht=>{"use strict";Object.defineProperty(sht,"__esModule",{value:!0})});var cht=v(lht=>{"use strict";Object.defineProperty(lht,"__esModule",{value:!0})});var fht=v(dht=>{"use strict";Object.defineProperty(dht,"__esModule",{value:!0})});var mht=v(pht=>{"use strict";Object.defineProperty(pht,"__esModule",{value:!0})});var ght=v(hht=>{"use strict";Object.defineProperty(hht,"__esModule",{value:!0})});var bht=v(yht=>{"use strict";Object.defineProperty(yht,"__esModule",{value:!0})});var vht=v(_ht=>{"use strict";Object.defineProperty(_ht,"__esModule",{value:!0})});var Sht=v(wht=>{"use strict";Object.defineProperty(wht,"__esModule",{value:!0})});var Cht=v(xht=>{"use strict";Object.defineProperty(xht,"__esModule",{value:!0})});var Pht=v(Oht=>{"use strict";Object.defineProperty(Oht,"__esModule",{value:!0})});var Tht=v(Eht=>{"use strict";Object.defineProperty(Eht,"__esModule",{value:!0})});var Iht=v(Aht=>{"use strict";Object.defineProperty(Aht,"__esModule",{value:!0})});var Mht=v(jH=>{"use strict";Object.defineProperty(jH,"__esModule",{value:!0});jH.RequestHandlerProtocol=void 0;var Ebr;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(Ebr=jH.RequestHandlerProtocol||(jH.RequestHandlerProtocol={}))});var jht=v(Rht=>{"use strict";Object.defineProperty(Rht,"__esModule",{value:!0})});var Dht=v(Nht=>{"use strict";Object.defineProperty(Nht,"__esModule",{value:!0})});var Fht=v(Lht=>{"use strict";Object.defineProperty(Lht,"__esModule",{value:!0})});var $ht=v(kht=>{"use strict";Object.defineProperty(kht,"__esModule",{value:!0})});var qht=v(Bht=>{"use strict";Object.defineProperty(Bht,"__esModule",{value:!0})});var Uht=v(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});var _o=(q1(),zl(B1));_o.__exportStar(ymt(),Hn);_o.__exportStar(bmt(),Hn);_o.__exportStar(vmt(),Hn);_o.__exportStar(Smt(),Hn);_o.__exportStar(Cmt(),Hn);_o.__exportStar(Pmt(),Hn);_o.__exportStar(jmt(),Hn);_o.__exportStar(Dmt(),Hn);_o.__exportStar(Fmt(),Hn);_o.__exportStar(kmt(),Hn);_o.__exportStar(Jmt(),Hn);_o.__exportStar(Zmt(),Hn);_o.__exportStar(Xmt(),Hn);_o.__exportStar(oht(),Hn);_o.__exportStar(aht(),Hn);_o.__exportStar(uht(),Hn);_o.__exportStar(cht(),Hn);_o.__exportStar(fht(),Hn);_o.__exportStar(mht(),Hn);_o.__exportStar(ght(),Hn);_o.__exportStar(bht(),Hn);_o.__exportStar(vht(),Hn);_o.__exportStar(Sht(),Hn);_o.__exportStar(Cht(),Hn);_o.__exportStar(Pht(),Hn);_o.__exportStar(Tht(),Hn);_o.__exportStar(Iht(),Hn);_o.__exportStar(Mht(),Hn);_o.__exportStar(jht(),Hn);_o.__exportStar(Dht(),Hn);_o.__exportStar(Fht(),Hn);_o.__exportStar($ht(),Hn);_o.__exportStar(qht(),Hn)});var zht=v(nQ=>{"use strict";Object.defineProperty(nQ,"__esModule",{value:!0});nQ.Field=void 0;var Tbr=Uht(),cSe=class{constructor({name:e,kind:r=Tbr.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}};nQ.Field=cSe});var Hht=v(oQ=>{"use strict";Object.defineProperty(oQ,"__esModule",{value:!0});oQ.Fields=void 0;var dSe=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)}};oQ.Fields=dSe});var Wht=v(Vht=>{"use strict";Object.defineProperty(Vht,"__esModule",{value:!0})});var Kht=v(iQ=>{"use strict";Object.defineProperty(iQ,"__esModule",{value:!0});iQ.HttpRequest=void 0;var fSe=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=Abr(e.query)),e}};iQ.HttpRequest=fSe;function Abr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}});var Ght=v(aQ=>{"use strict";Object.defineProperty(aQ,"__esModule",{value:!0});aQ.HttpResponse=void 0;var pSe=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"}};aQ.HttpResponse=pSe});var Jht=v(sQ=>{"use strict";Object.defineProperty(sQ,"__esModule",{value:!0});sQ.isValidHostname=void 0;function Ibr(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}sQ.isValidHostname=Ibr});var Zht=v(Yht=>{"use strict";Object.defineProperty(Yht,"__esModule",{value:!0})});var Xht=v(_O=>{"use strict";Object.defineProperty(_O,"__esModule",{value:!0});var z1=(q1(),zl(B1));z1.__exportStar(zht(),_O);z1.__exportStar(Hht(),_O);z1.__exportStar(Wht(),_O);z1.__exportStar(Kht(),_O);z1.__exportStar(Ght(),_O);z1.__exportStar(Jht(),_O);z1.__exportStar(Zht(),_O)});var Qht=v(mSe=>{"use strict";Object.defineProperty(mSe,"__esModule",{value:!0});var Mbr=(q1(),zl(B1));Mbr.__exportStar(Xht(),mSe)});var H1={};Cf(H1,{__addDisposableResource:()=>vgt,__assign:()=>uQ,__asyncDelegator:()=>fgt,__asyncGenerator:()=>dgt,__asyncValues:()=>pgt,__await:()=>Uk,__awaiter:()=>igt,__classPrivateFieldGet:()=>ygt,__classPrivateFieldIn:()=>_gt,__classPrivateFieldSet:()=>bgt,__createBinding:()=>cQ,__decorate:()=>rgt,__disposeResources:()=>wgt,__esDecorate:()=>Rbr,__exportStar:()=>sgt,__extends:()=>egt,__generator:()=>agt,__importDefault:()=>ggt,__importStar:()=>hgt,__makeTemplateObject:()=>mgt,__metadata:()=>ogt,__param:()=>ngt,__propKey:()=>Nbr,__read:()=>gSe,__rest:()=>tgt,__runInitializers:()=>jbr,__setFunctionName:()=>Dbr,__spread:()=>ugt,__spreadArray:()=>cgt,__spreadArrays:()=>lgt,__values:()=>lQ,default:()=>kbr});function egt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");hSe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function tgt(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=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 ngt(t,e){return function(r,n){e(r,n,t)}}function Rbr(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var b=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(d=a(b.get))&&(c.get=d),(d=a(b.set))&&(c.set=d),(d=a(b.init))&&o.unshift(d)}else(d=a(b))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function jbr(t,e,r){for(var n=arguments.length>2,o=0;o0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]=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 gSe(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 ugt(){for(var t=[],e=0;e1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof Uk?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function fgt(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:Uk(t[o](a)),done:!1}:i?i(a):a}:i}}function pgt(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 lQ=="function"?lQ(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 mgt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function hgt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cQ(e,t,r);return Lbr(e,t),e}function ggt(t){return t&&t.__esModule?t:{default:t}}function ygt(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 bgt(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 _gt(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 vgt(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 wgt(t){function e(i){t.error=t.hasError?new Fbr(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 hSe,uQ,cQ,Lbr,Fbr,kbr,V1=w(()=>{hSe=function(t,e){return hSe=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])},hSe(t,e)};uQ=function(){return uQ=Object.assign||function(e){for(var r,n=1,o=arguments.length;nbSe,__asyncDelegator:()=>Zbr,__asyncGenerator:()=>Ybr,__asyncValues:()=>Xbr,__await:()=>NH,__awaiter:()=>Hbr,__classPrivateFieldGet:()=>r_r,__classPrivateFieldSet:()=>n_r,__createBinding:()=>Wbr,__decorate:()=>qbr,__exportStar:()=>Kbr,__extends:()=>$br,__generator:()=>Vbr,__importDefault:()=>t_r,__importStar:()=>e_r,__makeTemplateObject:()=>Qbr,__metadata:()=>zbr,__param:()=>Ubr,__read:()=>Sgt,__rest:()=>Bbr,__spread:()=>Gbr,__spreadArrays:()=>Jbr,__values:()=>_Se});function $br(t,e){ySe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Bbr(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=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 Ubr(t,e){return function(r,n){e(r,n,t)}}function zbr(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Hbr(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 Vbr(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]=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 Sgt(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 Gbr(){for(var t=[],e=0;e1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof NH?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 Zbr(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:NH(t[o](a)),done:o==="return"}:i?i(a):a}:i}}function Xbr(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 _Se=="function"?_Se(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 Qbr(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function e_r(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 t_r(t){return t&&t.__esModule?t:{default:t}}function r_r(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function n_r(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 ySe,bSe,wSe=w(()=>{ySe=function(t,e){return ySe=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])},ySe(t,e)};bSe=function(){return bSe=Object.assign||function(e){for(var r,n=1,o=arguments.length;n{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});zk.toUtf8=zk.fromUtf8=void 0;var o_r=t=>{let e=[];for(let r=0,n=t.length;r>6|192,o&63|128);else if(r+1>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)};zk.fromUtf8=o_r;var i_r=t=>{let e="";for(let r=0,n=t.length;rs.toString(16)).join("%");e+=decodeURIComponent(a)}else e+=String.fromCharCode((o&15)<<12|(t[++r]&63)<<6|t[++r]&63)}return e};zk.toUtf8=i_r});var Cgt=v(Hk=>{"use strict";Object.defineProperty(Hk,"__esModule",{value:!0});Hk.toUtf8=Hk.fromUtf8=void 0;function a_r(t){return new TextEncoder().encode(t)}Hk.fromUtf8=a_r;function s_r(t){return new TextDecoder("utf-8").decode(t)}Hk.toUtf8=s_r});var Egt=v(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});Vk.toUtf8=Vk.fromUtf8=void 0;var Ogt=xgt(),Pgt=Cgt(),u_r=t=>typeof TextEncoder=="function"?(0,Pgt.fromUtf8)(t):(0,Ogt.fromUtf8)(t);Vk.fromUtf8=u_r;var l_r=t=>typeof TextDecoder=="function"?(0,Pgt.toUtf8)(t):(0,Ogt.toUtf8)(t);Vk.toUtf8=l_r});var Tgt=v(dQ=>{"use strict";Object.defineProperty(dQ,"__esModule",{value:!0});dQ.convertToBuffer=void 0;var c_r=Egt(),d_r=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:c_r.fromUtf8;function f_r(t){return t instanceof Uint8Array?t:typeof t=="string"?d_r(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}dQ.convertToBuffer=f_r});var Agt=v(fQ=>{"use strict";Object.defineProperty(fQ,"__esModule",{value:!0});fQ.isEmptyData=void 0;function p_r(t){return typeof t=="string"?t.length===0:t.byteLength===0}fQ.isEmptyData=p_r});var Igt=v(pQ=>{"use strict";Object.defineProperty(pQ,"__esModule",{value:!0});pQ.numToUint8=void 0;function m_r(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}pQ.numToUint8=m_r});var Mgt=v(mQ=>{"use strict";Object.defineProperty(mQ,"__esModule",{value:!0});mQ.uint32ArrayFrom=void 0;function h_r(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),r=0;r{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});k_.uint32ArrayFrom=k_.numToUint8=k_.isEmptyData=k_.convertToBuffer=void 0;var g_r=Tgt();Object.defineProperty(k_,"convertToBuffer",{enumerable:!0,get:function(){return g_r.convertToBuffer}});var y_r=Agt();Object.defineProperty(k_,"isEmptyData",{enumerable:!0,get:function(){return y_r.isEmptyData}});var b_r=Igt();Object.defineProperty(k_,"numToUint8",{enumerable:!0,get:function(){return b_r.numToUint8}});var __r=Mgt();Object.defineProperty(k_,"uint32ArrayFrom",{enumerable:!0,get:function(){return __r.uint32ArrayFrom}})});var Ngt=v(hQ=>{"use strict";Object.defineProperty(hQ,"__esModule",{value:!0});hQ.AwsCrc32=void 0;var Rgt=(wSe(),zl(vSe)),xSe=SSe(),jgt=gQ(),v_r=function(){function t(){this.crc32=new jgt.Crc32}return t.prototype.update=function(e){(0,xSe.isEmptyData)(e)||this.crc32.update((0,xSe.convertToBuffer)(e))},t.prototype.digest=function(){return Rgt.__awaiter(this,void 0,void 0,function(){return Rgt.__generator(this,function(e){return[2,(0,xSe.numToUint8)(this.crc32.digest())]})})},t.prototype.reset=function(){this.crc32=new jgt.Crc32},t}();hQ.AwsCrc32=v_r});var gQ=v(ZT=>{"use strict";Object.defineProperty(ZT,"__esModule",{value:!0});ZT.AwsCrc32=ZT.Crc32=ZT.crc32=void 0;var w_r=(wSe(),zl(vSe)),S_r=SSe();function x_r(t){return new Dgt().update(t).digest()}ZT.crc32=x_r;var Dgt=function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var r,n;try{for(var o=w_r.__values(e),i=o.next();!i.done;i=o.next()){var a=i.value;this.checksum=this.checksum>>>8^O_r[(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}();ZT.Crc32=Dgt;var C_r=[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],O_r=(0,S_r.uint32ArrayFrom)(C_r),P_r=Ngt();Object.defineProperty(ZT,"AwsCrc32",{enumerable:!0,get:function(){return P_r.AwsCrc32}})});var Kk=v(Wk=>{"use strict";Object.defineProperty(Wk,"__esModule",{value:!0});Wk.toHex=Wk.fromHex=void 0;var Lgt={},CSe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Lgt[t]=e,CSe[e]=t}function E_r(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{"use strict";Object.defineProperty(yQ,"__esModule",{value:!0});yQ.Int64=void 0;var A_r=Kk(),OSe=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&&Fgt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&Fgt(e),parseInt((0,A_r.toHex)(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};yQ.Int64=OSe;function Fgt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}});var ASe=v(bQ=>{"use strict";Object.defineProperty(bQ,"__esModule",{value:!0});bQ.HeaderMarshaller=void 0;var Gk=Kk(),ESe=PSe(),TSe=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(ESe.Int64.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!k_r.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set((0,Gk.fromHex)(e.value.replace(/\-/g,"")),1),d}}parse(e){let r={},n=0;for(;n{"use strict";Object.defineProperty(_Q,"__esModule",{value:!0});_Q.splitMessage=void 0;var $_r=gQ(),Bgt=4,XT=Bgt*2,W1=4,B_r=XT+W1*2;function q_r({byteLength:t,byteOffset:e,buffer:r}){if(t{"use strict";Object.defineProperty(vQ,"__esModule",{value:!0});vQ.EventStreamCodec=void 0;var U_r=gQ(),z_r=ASe(),H_r=qgt(),ISe=class{constructor(e,r){this.headerMarshaller=new z_r.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 U_r.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,H_r.splitMessage)(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}};vQ.EventStreamCodec=ISe});var Hgt=v(zgt=>{"use strict";Object.defineProperty(zgt,"__esModule",{value:!0})});var Vgt=v(wQ=>{"use strict";Object.defineProperty(wQ,"__esModule",{value:!0});wQ.MessageDecoderStream=void 0;var MSe=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)}};wQ.MessageDecoderStream=MSe});var Wgt=v(SQ=>{"use strict";Object.defineProperty(SQ,"__esModule",{value:!0});SQ.MessageEncoderStream=void 0;var RSe=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))}};SQ.MessageEncoderStream=RSe});var Kgt=v(xQ=>{"use strict";Object.defineProperty(xQ,"__esModule",{value:!0});xQ.SmithyMessageDecoderStream=void 0;var jSe=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)}}};xQ.SmithyMessageDecoderStream=jSe});var Ggt=v(CQ=>{"use strict";Object.defineProperty(CQ,"__esModule",{value:!0});CQ.SmithyMessageEncoderStream=void 0;var NSe=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)}};CQ.SmithyMessageEncoderStream=NSe});var Jgt=v($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});var QT=(V1(),zl(H1));QT.__exportStar(Ugt(),$_);QT.__exportStar(ASe(),$_);QT.__exportStar(PSe(),$_);QT.__exportStar(Hgt(),$_);QT.__exportStar(Vgt(),$_);QT.__exportStar(Wgt(),$_);QT.__exportStar(Kgt(),$_);QT.__exportStar(Ggt(),$_)});var Ygt=v(OQ=>{"use strict";Object.defineProperty(OQ,"__esModule",{value:!0});OQ.normalizeProvider=void 0;var V_r=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};OQ.normalizeProvider=V_r});var Zgt=v(DSe=>{"use strict";Object.defineProperty(DSe,"__esModule",{value:!0});var W_r=(V1(),zl(H1));W_r.__exportStar(Ygt(),DSe)});var LSe=v(PQ=>{"use strict";Object.defineProperty(PQ,"__esModule",{value:!0});PQ.isArrayBuffer=void 0;var K_r=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";PQ.isArrayBuffer=K_r});var kSe=v(Jk=>{"use strict";Object.defineProperty(Jk,"__esModule",{value:!0});Jk.fromString=Jk.fromArrayBuffer=void 0;var G_r=LSe(),FSe=Pp(),J_r=(t,e=0,r=t.byteLength-e)=>{if(!(0,G_r.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return FSe.Buffer.from(t,e,r)};Jk.fromArrayBuffer=J_r;var Y_r=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?FSe.Buffer.from(t,e):FSe.Buffer.from(t)};Jk.fromString=Y_r});var $Se=v(EQ=>{"use strict";Object.defineProperty(EQ,"__esModule",{value:!0});EQ.fromUtf8=void 0;var Z_r=kSe(),X_r=t=>{let e=(0,Z_r.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)};EQ.fromUtf8=X_r});var Xgt=v(TQ=>{"use strict";Object.defineProperty(TQ,"__esModule",{value:!0});TQ.toUint8Array=void 0;var Q_r=$Se(),evr=t=>typeof t=="string"?(0,Q_r.fromUtf8)(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t);TQ.toUint8Array=evr});var Qgt=v(AQ=>{"use strict";Object.defineProperty(AQ,"__esModule",{value:!0});AQ.toUtf8=void 0;var tvr=kSe(),rvr=t=>(0,tvr.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8");AQ.toUtf8=rvr});var IQ=v(DH=>{"use strict";Object.defineProperty(DH,"__esModule",{value:!0});var BSe=(V1(),zl(H1));BSe.__exportStar($Se(),DH);BSe.__exportStar(Xgt(),DH);BSe.__exportStar(Qgt(),DH)});var K1=v(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.MAX_PRESIGNED_TTL=Lt.KEY_TYPE_IDENTIFIER=Lt.MAX_CACHE_SIZE=Lt.UNSIGNED_PAYLOAD=Lt.EVENT_ALGORITHM_IDENTIFIER=Lt.ALGORITHM_IDENTIFIER_V4A=Lt.ALGORITHM_IDENTIFIER=Lt.UNSIGNABLE_PATTERNS=Lt.SEC_HEADER_PATTERN=Lt.PROXY_HEADER_PATTERN=Lt.ALWAYS_UNSIGNABLE_HEADERS=Lt.HOST_HEADER=Lt.TOKEN_HEADER=Lt.SHA256_HEADER=Lt.SIGNATURE_HEADER=Lt.GENERATED_HEADERS=Lt.DATE_HEADER=Lt.AMZ_DATE_HEADER=Lt.AUTH_HEADER=Lt.REGION_SET_PARAM=Lt.TOKEN_QUERY_PARAM=Lt.SIGNATURE_QUERY_PARAM=Lt.EXPIRES_QUERY_PARAM=Lt.SIGNED_HEADERS_QUERY_PARAM=Lt.AMZ_DATE_QUERY_PARAM=Lt.CREDENTIAL_QUERY_PARAM=Lt.ALGORITHM_QUERY_PARAM=void 0;Lt.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm";Lt.CREDENTIAL_QUERY_PARAM="X-Amz-Credential";Lt.AMZ_DATE_QUERY_PARAM="X-Amz-Date";Lt.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders";Lt.EXPIRES_QUERY_PARAM="X-Amz-Expires";Lt.SIGNATURE_QUERY_PARAM="X-Amz-Signature";Lt.TOKEN_QUERY_PARAM="X-Amz-Security-Token";Lt.REGION_SET_PARAM="X-Amz-Region-Set";Lt.AUTH_HEADER="authorization";Lt.AMZ_DATE_HEADER=Lt.AMZ_DATE_QUERY_PARAM.toLowerCase();Lt.DATE_HEADER="date";Lt.GENERATED_HEADERS=[Lt.AUTH_HEADER,Lt.AMZ_DATE_HEADER,Lt.DATE_HEADER];Lt.SIGNATURE_HEADER=Lt.SIGNATURE_QUERY_PARAM.toLowerCase();Lt.SHA256_HEADER="x-amz-content-sha256";Lt.TOKEN_HEADER=Lt.TOKEN_QUERY_PARAM.toLowerCase();Lt.HOST_HEADER="host";Lt.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};Lt.PROXY_HEADER_PATTERN=/^proxy-/;Lt.SEC_HEADER_PATTERN=/^sec-/;Lt.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i];Lt.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256";Lt.ALGORITHM_IDENTIFIER_V4A="AWS4-ECDSA-P256-SHA256";Lt.EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD";Lt.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD";Lt.MAX_CACHE_SIZE=50;Lt.KEY_TYPE_IDENTIFIER="aws4_request";Lt.MAX_PRESIGNED_TTL=60*60*24*7});var USe=v(eA=>{"use strict";Object.defineProperty(eA,"__esModule",{value:!0});eA.clearCredentialCache=eA.getSigningKey=eA.createScope=void 0;var nvr=Kk(),ovr=IQ(),qSe=K1(),Yk={},MQ=[],ivr=(t,e,r)=>`${t}/${e}/${r}/${qSe.KEY_TYPE_IDENTIFIER}`;eA.createScope=ivr;var avr=async(t,e,r,n,o)=>{let i=await eyt(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${(0,nvr.toHex)(i)}:${e.sessionToken}`;if(a in Yk)return Yk[a];for(MQ.push(a);MQ.length>qSe.MAX_CACHE_SIZE;)delete Yk[MQ.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,qSe.KEY_TYPE_IDENTIFIER])s=await eyt(t,s,u);return Yk[a]=s};eA.getSigningKey=avr;var svr=()=>{MQ.length=0,Object.keys(Yk).forEach(t=>{delete Yk[t]})};eA.clearCredentialCache=svr;var eyt=(t,e,r)=>{let n=new t(e);return n.update((0,ovr.toUint8Array)(r)),n.digest()}});var HSe=v(RQ=>{"use strict";Object.defineProperty(RQ,"__esModule",{value:!0});RQ.getCanonicalHeaders=void 0;var zSe=K1(),uvr=({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 zSe.ALWAYS_UNSIGNABLE_HEADERS||e?.has(i)||zSe.PROXY_HEADER_PATTERN.test(i)||zSe.SEC_HEADER_PATTERN.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n};RQ.getCanonicalHeaders=uvr});var VSe=v(jQ=>{"use strict";Object.defineProperty(jQ,"__esModule",{value:!0});jQ.escapeUri=void 0;var lvr=t=>encodeURIComponent(t).replace(/[!'()*]/g,cvr);jQ.escapeUri=lvr;var cvr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var tyt=v(NQ=>{"use strict";Object.defineProperty(NQ,"__esModule",{value:!0});NQ.escapeUriPath=void 0;var dvr=VSe(),fvr=t=>t.split("/").map(dvr.escapeUri).join("/");NQ.escapeUriPath=fvr});var nyt=v(DQ=>{"use strict";Object.defineProperty(DQ,"__esModule",{value:!0});var ryt=(V1(),zl(H1));ryt.__exportStar(VSe(),DQ);ryt.__exportStar(tyt(),DQ)});var WSe=v(FQ=>{"use strict";Object.defineProperty(FQ,"__esModule",{value:!0});FQ.getCanonicalQuery=void 0;var LQ=nyt(),pvr=K1(),mvr=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===pvr.SIGNATURE_HEADER)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${(0,LQ.escapeUri)(n)}=${(0,LQ.escapeUri)(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).sort().reduce((i,a)=>i.concat([`${(0,LQ.escapeUri)(n)}=${(0,LQ.escapeUri)(a)}`]),[]).join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")};FQ.getCanonicalQuery=mvr});var KSe=v(kQ=>{"use strict";Object.defineProperty(kQ,"__esModule",{value:!0});kQ.getPayloadHash=void 0;var hvr=LSe(),gvr=Kk(),yvr=IQ(),oyt=K1(),bvr=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===oyt.SHA256_HEADER)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||(0,hvr.isArrayBuffer)(e)){let n=new r;return n.update((0,yvr.toUint8Array)(e)),(0,gvr.toHex)(await n.digest())}return oyt.UNSIGNED_PAYLOAD};kQ.getPayloadHash=bvr});var iyt=v(tA=>{"use strict";Object.defineProperty(tA,"__esModule",{value:!0});tA.deleteHeader=tA.getHeaderValue=tA.hasHeader=void 0;var _vr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1};tA.hasHeader=_vr;var vvr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return e[r]};tA.getHeaderValue=vvr;var wvr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))t===r.toLowerCase()&&delete e[r]};tA.deleteHeader=wvr});var GSe=v(G1=>{"use strict";Object.defineProperty(G1,"__esModule",{value:!0});G1.cloneQuery=G1.cloneRequest=void 0;var Svr=({headers:t,query:e,...r})=>({...r,headers:{...t},query:e?(0,G1.cloneQuery)(e):void 0});G1.cloneRequest=Svr;var xvr=t=>Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{});G1.cloneQuery=xvr});var JSe=v($Q=>{"use strict";Object.defineProperty($Q,"__esModule",{value:!0});$Q.moveHeadersToQuery=void 0;var Cvr=GSe(),Ovr=(t,e={})=>{var r;let{headers:n,query:o={}}=typeof t.clone=="function"?t.clone():(0,Cvr.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}};$Q.moveHeadersToQuery=Ovr});var YSe=v(BQ=>{"use strict";Object.defineProperty(BQ,"__esModule",{value:!0});BQ.prepareRequest=void 0;var Pvr=GSe(),Evr=K1(),Tvr=t=>{t=typeof t.clone=="function"?t.clone():(0,Pvr.cloneRequest)(t);for(let e of Object.keys(t.headers))Evr.GENERATED_HEADERS.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t};BQ.prepareRequest=Tvr});var ayt=v(J1=>{"use strict";Object.defineProperty(J1,"__esModule",{value:!0});J1.toDate=J1.iso8601=void 0;var Avr=t=>(0,J1.toDate)(t).toISOString().replace(/\.\d{3}Z$/,"Z");J1.iso8601=Avr;var Ivr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;J1.toDate=Ivr});var dyt=v(HQ=>{"use strict";Object.defineProperty(HQ,"__esModule",{value:!0});HQ.SignatureV4=void 0;var Mvr=Jgt(),qQ=Kk(),syt=Zgt(),LH=IQ(),Bc=K1(),UQ=USe(),uyt=HSe(),Rvr=WSe(),ZSe=KSe(),jvr=iyt(),Nvr=JSe(),lyt=YSe(),Dvr=ayt(),XSe=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerMarshaller=new Mvr.HeaderMarshaller(LH.toUtf8,LH.fromUtf8),this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=(0,syt.normalizeProvider)(n),this.credentialProvider=(0,syt.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}=zQ(n);if(o>Bc.MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=(0,UQ.createScope)(p,d,l??this.service),h=(0,Nvr.moveHeadersToQuery)((0,lyt.prepareRequest)(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[Bc.TOKEN_QUERY_PARAM]=c.sessionToken),h.query[Bc.ALGORITHM_QUERY_PARAM]=Bc.ALGORITHM_IDENTIFIER,h.query[Bc.CREDENTIAL_QUERY_PARAM]=`${c.accessKeyId}/${m}`,h.query[Bc.AMZ_DATE_QUERY_PARAM]=f,h.query[Bc.EXPIRES_QUERY_PARAM]=o.toString(10);let b=(0,uyt.getCanonicalHeaders)(h,i,s);return h.query[Bc.SIGNED_HEADERS_QUERY_PARAM]=cyt(b),h.query[Bc.SIGNATURE_QUERY_PARAM]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,b,await(0,ZSe.getPayloadHash)(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=zQ(n),c=(0,UQ.createScope)(u,s,a??this.service),d=await(0,ZSe.getPayloadHash)({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=(0,qQ.toHex)(await f.digest()),m=[Bc.EVENT_ALGORITHM_IDENTIFIER,l,c,o,p,d].join(` +`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerMarshaller.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=zQ(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update((0,LH.toUint8Array)(e)),(0,qQ.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,lyt.prepareRequest)(e),{longDate:c,shortDate:d}=zQ(r),f=(0,UQ.createScope)(d,u,a??this.service);l.headers[Bc.AMZ_DATE_HEADER]=c,s.sessionToken&&(l.headers[Bc.TOKEN_HEADER]=s.sessionToken);let p=await(0,ZSe.getPayloadHash)(l,this.sha256);!(0,jvr.hasHeader)(Bc.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[Bc.SHA256_HEADER]=p);let m=(0,uyt.getCanonicalHeaders)(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[Bc.AUTH_HEADER]=`${Bc.ALGORITHM_IDENTIFIER} Credential=${s.accessKeyId}/${f}, SignedHeaders=${cyt(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method} ${this.getCanonicalPath(e)} -${(0,Evr.getCanonicalQuery)(e)} +${(0,Rvr.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,DH.toUint8Array)(n));let i=await o.digest();return`${Bc.ALGORITHM_IDENTIFIER} +${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update((0,LH.toUint8Array)(n));let i=await o.digest();return`${Bc.ALGORITHM_IDENTIFIER} ${e} ${r} -${(0,BQ.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,DH.toUint8Array)(i)),(0,BQ.toHex)(await a.digest())}getSigningKey(e,r,n,o){return(0,qQ.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")}};zQ.SignatureV4=JSe;var UQ=t=>{let e=(0,Ivr.iso8601)(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},ayt=t=>Object.keys(t).sort().join(";")});var lyt=v(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});jp.prepareRequest=jp.moveHeadersToQuery=jp.getPayloadHash=jp.getCanonicalQuery=jp.getCanonicalHeaders=void 0;var uyt=(H1(),zl(z1));uyt.__exportStar(syt(),jp);var Mvr=qSe();Object.defineProperty(jp,"getCanonicalHeaders",{enumerable:!0,get:function(){return Mvr.getCanonicalHeaders}});var Rvr=zSe();Object.defineProperty(jp,"getCanonicalQuery",{enumerable:!0,get:function(){return Rvr.getCanonicalQuery}});var jvr=HSe();Object.defineProperty(jp,"getPayloadHash",{enumerable:!0,get:function(){return jvr.getPayloadHash}});var Nvr=WSe();Object.defineProperty(jp,"moveHeadersToQuery",{enumerable:!0,get:function(){return Nvr.moveHeadersToQuery}});var Dvr=KSe();Object.defineProperty(jp,"prepareRequest",{enumerable:!0,get:function(){return Dvr.prepareRequest}});uyt.__exportStar($Se(),jp)});var cyt=v(YSe=>{"use strict";Object.defineProperty(YSe,"__esModule",{value:!0});var Lvr=(H1(),zl(z1));Lvr.__exportStar(lyt(),YSe)});var Va=v((W_o,dyt)=>{"use strict";dyt.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 Yk=v((K_o,HQ)=>{"use strict";var{AbortController:fyt,AbortSignal:Fvr}=typeof self<"u"?self:typeof window<"u"?window:void 0;HQ.exports=fyt;HQ.exports.AbortSignal=Fvr;HQ.exports.default=fyt});var LH=v((G_o,ZSe)=>{"use strict";var Zk=typeof Reflect=="object"?Reflect:null,pyt=Zk&&typeof Zk.apply=="function"?Zk.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},VQ;Zk&&typeof Zk.ownKeys=="function"?VQ=Zk.ownKeys:Object.getOwnPropertySymbols?VQ=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:VQ=function(e){return Object.getOwnPropertyNames(e)};function kvr(t){console&&console.warn&&console.warn(t)}var hyt=Number.isNaN||function(e){return e!==e};function Ei(){Ei.init.call(this)}ZSe.exports=Ei;ZSe.exports.once=Uvr;Ei.EventEmitter=Ei;Ei.prototype._events=void 0;Ei.prototype._eventsCount=0;Ei.prototype._maxListeners=void 0;var myt=10;function WQ(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ei,"defaultMaxListeners",{enumerable:!0,get:function(){return myt},set:function(t){if(typeof t!="number"||t<0||hyt(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");myt=t}});Ei.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};Ei.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||hyt(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 gyt(t){return t._maxListeners===void 0?Ei.defaultMaxListeners:t._maxListeners}Ei.prototype.getMaxListeners=function(){return gyt(this)};Ei.prototype.emit=function(e){for(var r=[],n=1;n0&&(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")pyt(u,this,r);else for(var l=u.length,c=wyt(u,l),n=0;n0&&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,kvr(s)}return t}Ei.prototype.addListener=function(e,r){return yyt(this,e,r,!1)};Ei.prototype.on=Ei.prototype.addListener;Ei.prototype.prependListener=function(e,r){return yyt(this,e,r,!0)};function $vr(){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 byt(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=$vr.bind(n);return o.listener=r,n.wrapFn=o,o}Ei.prototype.once=function(e,r){return WQ(r),this.on(e,byt(this,e,r)),this};Ei.prototype.prependOnceListener=function(e,r){return WQ(r),this.prependListener(e,byt(this,e,r)),this};Ei.prototype.removeListener=function(e,r){var n,o,i,a,s;if(WQ(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():Bvr(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};Ei.prototype.off=Ei.prototype.removeListener;Ei.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=0;o--)this.removeListener(e,r[o]);return this};function _yt(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?qvr(o):wyt(o,o.length)}Ei.prototype.listeners=function(e){return _yt(this,e,!0)};Ei.prototype.rawListeners=function(e){return _yt(this,e,!1)};Ei.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):vyt.call(t,e)};Ei.prototype.listenerCount=vyt;function vyt(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}Ei.prototype.eventNames=function(){return this._eventsCount>0?VQ(this._events):[]};function wyt(t,e){for(var r=new Array(e),n=0;n{"use strict";var Hvr=Pp(),{kResistStopPropagation:Vvr,SymbolDispose:Wvr}=Va(),Kvr=globalThis.AbortSignal||Yk().AbortSignal,Gvr=globalThis.AbortController||Yk().AbortController,Jvr=Object.getPrototypeOf(async function(){}).constructor,xyt=globalThis.Blob||Hvr.Blob,Yvr=typeof xyt<"u"?function(e){return e instanceof xyt}:function(e){return!1},Cyt=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},Zvr=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},XSe=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{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 Jvr},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Yvr,deprecate(t,e){return t},addAbortListener:LH().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);Cyt(e,"signal"),Zvr(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Vvr]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Wvr](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:Kvr.any||function(e){if(e.length===1)return e[0];let r=new Gvr,n=()=>r.abort();return e.forEach(o=>{Cyt(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};QSe.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Kf=v((Y_o,Eyt)=>{"use strict";var{format:Xvr,inspect:KQ,AggregateError:Qvr}=Gd(),ewr=globalThis.AggregateError||Qvr,twr=Symbol("kIsNodeError"),rwr=["string","function","number","object","Function","Object","boolean","bigint","symbol"],nwr=/^([A-Z][a-z0-9]*)+$/,owr="__node_internal_",GQ={};function J1(t,e){if(!t)throw new GQ.ERR_INTERNAL_ASSERTION(e)}function Oyt(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 iwr(t,e,r){if(typeof e=="function")return J1(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 J1(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Xvr(e,...r)}function qc(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(iwr(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[twr]=!0,GQ[t]=n}function Pyt(t){let e=owr+t.name;return Object.defineProperty(t,"name",{value:e}),t}function awr(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new ewr([e,t],e.message);return r.code=e.code,r}return t||e}var exe=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new GQ.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};qc("ERR_ASSERTION","%s",Error);qc("ERR_INVALID_ARG_TYPE",(t,e,r)=>{J1(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)J1(typeof u=="string","All expected entries have to be of type string"),rwr.includes(u)?o.push(u.toLowerCase()):nwr.test(u)?i.push(u):(J1(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=KQ(r,{depth:-1});n+=`. Received ${u}`}}else{let u=KQ(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);qc("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=KQ(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);qc("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);qc("ERR_MISSING_ARGS",(...t)=>{J1(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);qc("ERR_OUT_OF_RANGE",(t,e,r)=>{J1(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=Oyt(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=Oyt(n)),n+="n"):n=KQ(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);qc("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);qc("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);qc("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);qc("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);qc("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);qc("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);qc("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);qc("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);qc("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);qc("ERR_STREAM_WRITE_AFTER_END","write after end",Error);qc("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Eyt.exports={AbortError:exe,aggregateTwoErrors:Pyt(awr),hideStackFrames:Pyt,codes:GQ}});var Qk=v((Z_o,Fyt)=>{"use strict";var{ArrayIsArray:rxe,ArrayPrototypeIncludes:Myt,ArrayPrototypeJoin:Ryt,ArrayPrototypeMap:swr,NumberIsInteger:nxe,NumberIsNaN:uwr,NumberMAX_SAFE_INTEGER:lwr,NumberMIN_SAFE_INTEGER:cwr,NumberParseInt:dwr,ObjectPrototypeHasOwnProperty:fwr,RegExpPrototypeExec:jyt,String:pwr,StringPrototypeToUpperCase:mwr,StringPrototypeTrim:hwr}=Va(),{hideStackFrames:rg,codes:{ERR_SOCKET_BAD_PORT:gwr,ERR_INVALID_ARG_TYPE:Jd,ERR_INVALID_ARG_VALUE:Xk,ERR_OUT_OF_RANGE:Y1,ERR_UNKNOWN_SIGNAL:Tyt}}=Kf(),{normalizeEncoding:ywr}=Gd(),{isAsyncFunction:bwr,isArrayBufferView:_wr}=Gd().types,Ayt={};function vwr(t){return t===(t|0)}function wwr(t){return t===t>>>0}var Swr=/^[0-7]+$/,xwr="must be a 32-bit unsigned integer or an octal string";function Cwr(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(jyt(Swr,t)===null)throw new Xk(e,t,xwr);t=dwr(t,8)}return Nyt(t,e),t}var Owr=rg((t,e,r=cwr,n=lwr)=>{if(typeof t!="number")throw new Jd(e,"number",t);if(!nxe(t))throw new Y1(e,"an integer",t);if(tn)throw new Y1(e,`>= ${r} && <= ${n}`,t)}),Pwr=rg((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Jd(e,"number",t);if(!nxe(t))throw new Y1(e,"an integer",t);if(tn)throw new Y1(e,`>= ${r} && <= ${n}`,t)}),Nyt=rg((t,e,r=!1)=>{if(typeof t!="number")throw new Jd(e,"number",t);if(!nxe(t))throw new Y1(e,"an integer",t);let n=r?1:0,o=4294967295;if(to)throw new Y1(e,`>= ${n} && <= ${o}`,t)});function oxe(t,e){if(typeof t!="string")throw new Jd(e,"string",t)}function Ewr(t,e,r=void 0,n){if(typeof t!="number")throw new Jd(e,"number",t);if(r!=null&&tn||(r!=null||n!=null)&&uwr(t))throw new Y1(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Twr=rg((t,e,r)=>{if(!Myt(r,t)){let o="must be one of: "+Ryt(swr(r,i=>typeof i=="string"?`'${i}'`:pwr(i)),", ");throw new Xk(e,t,o)}});function Dyt(t,e){if(typeof t!="boolean")throw new Jd(e,"boolean",t)}function txe(t,e,r){return t==null||!fwr(t,e)?r:t[e]}var Awr=rg((t,e,r=null)=>{let n=txe(r,"allowArray",!1),o=txe(r,"allowFunction",!1);if(!txe(r,"nullable",!1)&&t===null||!n&&rxe(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new Jd(e,"Object",t)}),Iwr=rg((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Jd(e,"a dictionary",t)}),JQ=rg((t,e,r=0)=>{if(!rxe(t))throw new Jd(e,"Array",t);if(t.length{if(!_wr(t))throw new Jd(e,["Buffer","TypedArray","DataView"],t)});function Lwr(t,e){let r=ywr(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Xk("encoding",e,`is invalid for data of length ${n}`)}function Fwr(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&hwr(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new gwr(e,t,r);return t|0}var Lyt=rg((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Jd(e,"AbortSignal",t)}),kwr=rg((t,e)=>{if(typeof t!="function")throw new Jd(e,"Function",t)}),$wr=rg((t,e)=>{if(typeof t!="function"||bwr(t))throw new Jd(e,"Function",t)}),Bwr=rg((t,e)=>{if(t!==void 0)throw new Jd(e,"undefined",t)});function qwr(t,e,r){if(!Myt(r,t))throw new Jd(e,`('${Ryt(r,"|")}')`,t)}var Uwr=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Iyt(t,e){if(typeof t>"u"||!jyt(Uwr,t))throw new Xk(e,t,'must be an array or string of format "; rel=preload; as=style"')}function zwr(t){if(typeof t=="string")return Iyt(t,"hints"),t;if(rxe(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n; rel=preload; as=style"')}Fyt.exports={isInt32:vwr,isUint32:wwr,parseFileMode:Cwr,validateArray:JQ,validateStringArray:Mwr,validateBooleanArray:Rwr,validateAbortSignalArray:jwr,validateBoolean:Dyt,validateBuffer:Dwr,validateDictionary:Iwr,validateEncoding:Lwr,validateFunction:kwr,validateInt32:Pwr,validateInteger:Owr,validateNumber:Ewr,validateObject:Awr,validateOneOf:Twr,validatePlainFunction:$wr,validatePort:Fwr,validateSignalName:Nwr,validateString:oxe,validateUint32:Nyt,validateUndefined:Bwr,validateUnion:qwr,validateAbortSignal:Lyt,validateLinkHeaderValue:zwr}});var rA=v((X_o,qyt)=>{var Rs=qyt.exports={},B_,q_;function ixe(){throw new Error("setTimeout has not been defined")}function axe(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?B_=setTimeout:B_=ixe}catch{B_=ixe}try{typeof clearTimeout=="function"?q_=clearTimeout:q_=axe}catch{q_=axe}})();function kyt(t){if(B_===setTimeout)return setTimeout(t,0);if((B_===ixe||!B_)&&setTimeout)return B_=setTimeout,setTimeout(t,0);try{return B_(t,0)}catch{try{return B_.call(null,t,0)}catch{return B_.call(this,t,0)}}}function Hwr(t){if(q_===clearTimeout)return clearTimeout(t);if((q_===axe||!q_)&&clearTimeout)return q_=clearTimeout,clearTimeout(t);try{return q_(t)}catch{try{return q_.call(null,t)}catch{return q_.call(this,t)}}}var _O=[],e$=!1,Z1,YQ=-1;function Vwr(){!e$||!Z1||(e$=!1,Z1.length?_O=Z1.concat(_O):YQ=-1,_O.length&&$yt())}function $yt(){if(!e$){var t=kyt(Vwr);e$=!0;for(var e=_O.length;e;){for(Z1=_O,_O=[];++YQ1)for(var r=1;r{"use strict";var{SymbolAsyncIterator:Uyt,SymbolIterator:zyt,SymbolFor:X1}=Va(),Hyt=X1("nodejs.stream.destroyed"),Vyt=X1("nodejs.stream.errored"),sxe=X1("nodejs.stream.readable"),uxe=X1("nodejs.stream.writable"),Wyt=X1("nodejs.stream.disturbed"),Wwr=X1("nodejs.webstream.isClosedPromise"),Kwr=X1("nodejs.webstream.controllerErrorFunction");function ZQ(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 XQ(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 Gwr(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function U_(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Kyt(t){return!!(t&&!U_(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Gyt(t){return!!(t&&!U_(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Jyt(t){return!!(t&&!U_(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Jwr(t){return Kyt(t)||Gyt(t)||Jyt(t)}function Ywr(t,e){return t==null?!1:e===!0?typeof t[Uyt]=="function":e===!1?typeof t[zyt]=="function":typeof t[Uyt]=="function"||typeof t[zyt]=="function"}function QQ(t){if(!U_(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Hyt]||n!=null&&n.destroyed)}function Yyt(t){if(!XQ(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 Zwr(t,e){if(!XQ(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 Xwr(t){if(!ZQ(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 Zyt(t,e){if(!ZQ(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 Xyt(t){return t&&t[sxe]!=null?t[sxe]:typeof t?.readable!="boolean"?null:QQ(t)?!1:ZQ(t)&&t.readable&&!Zyt(t)}function Qyt(t){return t&&t[uxe]!=null?t[uxe]:typeof t?.writable!="boolean"?null:QQ(t)?!1:XQ(t)&&t.writable&&!Yyt(t)}function Qwr(t,e){return U_(t)?QQ(t)?!0:!(e?.readable!==!1&&Xyt(t)||e?.writable!==!1&&Qyt(t)):null}function e0r(t){var e,r;return U_(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 t0r(t){var e,r;return U_(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 r0r(t){if(!U_(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"&&ebt(t)?t._closed:null}function ebt(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function tbt(t){return typeof t._sent100=="boolean"&&ebt(t)}function n0r(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 o0r(t){if(!U_(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&tbt(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function i0r(t){var e;return!!(t&&((e=t[Wyt])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function a0r(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[Vyt])!==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))}rbt.exports={isDestroyed:QQ,kIsDestroyed:Hyt,isDisturbed:i0r,kIsDisturbed:Wyt,isErrored:a0r,kIsErrored:Vyt,isReadable:Xyt,kIsReadable:sxe,kIsClosedPromise:Wwr,kControllerErrorFunction:Kwr,kIsWritable:uxe,isClosed:r0r,isDuplexNodeStream:Gwr,isFinished:Qwr,isIterable:Ywr,isReadableNodeStream:ZQ,isReadableStream:Kyt,isReadableEnded:Xwr,isReadableFinished:Zyt,isReadableErrored:t0r,isNodeStream:U_,isWebStream:Jwr,isWritable:Qyt,isWritableNodeStream:XQ,isWritableStream:Gyt,isWritableEnded:Yyt,isWritableFinished:Zwr,isWritableErrored:e0r,isServerRequest:n0r,isServerResponse:tbt,willEmitClose:o0r,isTransformStream:Jyt}});var wO=v((evo,pxe)=>{var nA=rA(),{AbortError:dbt,codes:s0r}=Kf(),{ERR_INVALID_ARG_TYPE:u0r,ERR_STREAM_PREMATURE_CLOSE:nbt}=s0r,{kEmptyObject:cxe,once:dxe}=Gd(),{validateAbortSignal:l0r,validateFunction:c0r,validateObject:d0r,validateBoolean:f0r}=Qk(),{Promise:p0r,PromisePrototypeThen:m0r,SymbolDispose:fbt}=Va(),{isClosed:h0r,isReadable:obt,isReadableNodeStream:lxe,isReadableStream:g0r,isReadableFinished:ibt,isReadableErrored:abt,isWritable:sbt,isWritableNodeStream:ubt,isWritableStream:y0r,isWritableFinished:lbt,isWritableErrored:cbt,isNodeStream:b0r,willEmitClose:_0r,kIsClosedPromise:v0r}=z_(),t$;function w0r(t){return t.setHeader&&typeof t.abort=="function"}var fxe=()=>{};function pbt(t,e,r){var n,o;if(arguments.length===2?(r=e,e=cxe):e==null?e=cxe:d0r(e,"options"),c0r(r,"callback"),l0r(e.signal,"options.signal"),r=dxe(r),g0r(t)||y0r(t))return S0r(t,e,r);if(!b0r(t))throw new u0r("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:lxe(t),a=(o=e.writable)!==null&&o!==void 0?o:ubt(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=_0r(t)&&lxe(t)===i&&ubt(t)===a,d=lbt(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=ibt(t,!1),m=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},h=O=>{r.call(t,O)},b=h0r(t),g=()=>{b=!0;let O=cbt(t)||abt(t);if(O&&typeof O!="boolean")return r.call(t,O);if(i&&!p&&lxe(t,!0)&&!ibt(t,!1))return r.call(t,new nbt);if(a&&!d&&!lbt(t,!1))return r.call(t,new nbt);r.call(t)},y=()=>{b=!0;let O=cbt(t)||abt(t);if(O&&typeof O!="boolean")return r.call(t,O);r.call(t)},S=()=>{t.req.on("finish",f)};w0r(t)?(t.on("complete",f),c||t.on("abort",g),t.req?S():t.on("request",S)):a&&!s&&(t.on("end",l),t.on("close",l)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",m),t.on("finish",f),e.error!==!1&&t.on("error",h),t.on("close",g),b?nA.nextTick(g):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||nA.nextTick(y):(!i&&(!c||obt(t))&&(d||sbt(t)===!1)||!a&&(!c||sbt(t))&&(p||obt(t)===!1)||u&&t.req&&t.aborted)&&nA.nextTick(y);let x=()=>{r=fxe,t.removeListener("aborted",g),t.removeListener("complete",f),t.removeListener("abort",g),t.removeListener("request",S),t.req&&t.req.removeListener("finish",f),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",f),t.removeListener("end",m),t.removeListener("error",h),t.removeListener("close",g)};if(e.signal&&!b){let O=()=>{let P=r;x(),P.call(t,new dbt(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)nA.nextTick(O);else{t$=t$||Gd().addAbortListener;let P=t$(e.signal,O),E=r;r=dxe((...A)=>{P[fbt](),E.apply(t,A)})}}return x}function S0r(t,e,r){let n=!1,o=fxe;if(e.signal)if(o=()=>{n=!0,r.call(t,new dbt(void 0,{cause:e.signal.reason}))},e.signal.aborted)nA.nextTick(o);else{t$=t$||Gd().addAbortListener;let a=t$(e.signal,o),s=r;r=dxe((...u)=>{a[fbt](),s.apply(t,u)})}let i=(...a)=>{n||nA.nextTick(()=>r.apply(t,a))};return m0r(t[v0r].promise,i,i),fxe}function x0r(t,e){var r;let n=!1;return e===null&&(e=cxe),(r=e)!==null&&r!==void 0&&r.cleanup&&(f0r(e.cleanup,"cleanup"),n=e.cleanup),new p0r((o,i)=>{let a=pbt(t,e,s=>{n&&a(),s?i(s):o()})})}pxe.exports=pbt;pxe.exports.finished=x0r});var Q1=v((tvo,wbt)=>{"use strict";var H_=rA(),{aggregateTwoErrors:C0r,codes:{ERR_MULTIPLE_CALLBACK:O0r},AbortError:P0r}=Kf(),{Symbol:gbt}=Va(),{kIsDestroyed:E0r,isDestroyed:T0r,isFinished:A0r,isServerRequest:I0r}=z_(),ybt=gbt("kDestroy"),mxe=gbt("kConstruct");function bbt(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function M0r(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):(bbt(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?mbt(this,t,e):this.once(ybt,function(i){mbt(this,C0r(i,t),e)}),this)}function mbt(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;bbt(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?H_.nextTick(R0r,t,i):H_.nextTick(_bt,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function R0r(t,e){hxe(t,e),_bt(t)}function _bt(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 hxe(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 j0r(){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 gxe(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?H_.nextTick(hxe,t,e):hxe(t,e))}function N0r(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(mxe,e),!(t.listenerCount(mxe)>1)&&H_.nextTick(D0r,t)}function D0r(t){let e=!1;function r(n){if(e){gxe(t,n??new O0r);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(ybt,n):n?gxe(t,n,!0):H_.nextTick(L0r,t)}try{t._construct(n=>{H_.nextTick(r,n)})}catch(n){H_.nextTick(r,n)}}function L0r(t){t.emit(mxe)}function hbt(t){return t?.setHeader&&typeof t.abort=="function"}function vbt(t){t.emit("close")}function F0r(t,e){t.emit("error",e),H_.nextTick(vbt,t)}function k0r(t,e){!t||T0r(t)||(!e&&!A0r(t)&&(e=new P0r),I0r(t)?(t.socket=null,t.destroy(e)):hbt(t)?t.abort():hbt(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?H_.nextTick(F0r,t,e):H_.nextTick(vbt,t),t.destroyed||(t[E0r]=!0))}wbt.exports={construct:N0r,destroyer:k0r,destroy:M0r,undestroy:j0r,errorOrDestroy:gxe}});var ree=v((rvo,xbt)=>{"use strict";var{ArrayIsArray:$0r,ObjectSetPrototypeOf:Sbt}=Va(),{EventEmitter:eee}=LH();function tee(t){eee.call(this,t)}Sbt(tee.prototype,eee.prototype);Sbt(tee,eee);tee.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(),eee.listenerCount(this,"error")===0&&this.emit("error",c)}yxe(r,"error",u),yxe(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 yxe(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):$0r(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}xbt.exports={Stream:tee,prependListener:yxe}});var FH=v((nvo,nee)=>{"use strict";var{SymbolDispose:B0r}=Va(),{AbortError:Cbt,codes:q0r}=Kf(),{isNodeStream:Obt,isWebStream:U0r,kControllerErrorFunction:z0r}=z_(),H0r=wO(),{ERR_INVALID_ARG_TYPE:Pbt}=q0r,bxe,V0r=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Pbt(e,"AbortSignal",t)};nee.exports.addAbortSignal=function(e,r){if(V0r(e,"signal"),!Obt(r)&&!U0r(r))throw new Pbt("stream",["ReadableStream","WritableStream","Stream"],r);return nee.exports.addAbortSignalNoValidate(e,r)};nee.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Obt(e)?()=>{e.destroy(new Cbt(void 0,{cause:t.reason}))}:()=>{e[z0r](new Cbt(void 0,{cause:t.reason}))};if(t.aborted)r();else{bxe=bxe||Gd().addAbortListener;let n=bxe(t,r);H0r(e,n[B0r])}return e}});var Abt=v((ivo,Tbt)=>{"use strict";var{StringPrototypeSlice:Ebt,SymbolIterator:W0r,TypedArrayPrototypeSet:oee,Uint8Array:K0r}=Va(),{Buffer:_xe}=Pp(),{inspect:G0r}=Gd();Tbt.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 _xe.alloc(0);let r=_xe.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)oee(r,n.data,o),o+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(ei.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+=Ebt(i,0,e),this.head=n,n.data=Ebt(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=_xe.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)oee(r,a,n-e),e-=a.length;else{e===a.length?(oee(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(oee(r,new K0r(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 G0r(this,{...r,depth:0,customInspect:!1})}}});var kH=v((avo,jbt)=>{"use strict";var{MathFloor:J0r,NumberIsInteger:Y0r}=Va(),{validateInteger:Z0r}=Qk(),{ERR_INVALID_ARG_VALUE:X0r}=Kf().codes,Ibt=16*1024,Mbt=16;function Q0r(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Rbt(t){return t?Mbt:Ibt}function eSr(t,e){Z0r(e,"value",0),t?Mbt=e:Ibt=e}function tSr(t,e,r,n){let o=Q0r(e,n,r);if(o!=null){if(!Y0r(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new X0r(i,o)}return J0r(o)}return Rbt(t.objectMode)}jbt.exports={getHighWaterMark:tSr,getDefaultHighWaterMark:Rbt,setDefaultHighWaterMark:eSr}});var Lbt=v((vxe,Dbt)=>{var iee=Pp(),V_=iee.Buffer;function Nbt(t,e){for(var r in t)e[r]=t[r]}V_.from&&V_.alloc&&V_.allocUnsafe&&V_.allocUnsafeSlow?Dbt.exports=iee:(Nbt(iee,vxe),vxe.Buffer=ej);function ej(t,e,r){return V_(t,e,r)}ej.prototype=Object.create(V_.prototype);Nbt(V_,ej);ej.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return V_(t,e,r)};ej.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=V_(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};ej.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return V_(t)};ej.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return iee.SlowBuffer(t)}});var $bt=v(kbt=>{"use strict";var Sxe=Lbt().Buffer,Fbt=Sxe.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 rSr(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 nSr(t){var e=rSr(t);if(typeof e!="string"&&(Sxe.isEncoding===Fbt||!Fbt(t)))throw new Error("Unknown encoding: "+t);return e||t}kbt.StringDecoder=$H;function $H(t){this.encoding=nSr(t);var e;switch(this.encoding){case"utf16le":this.text=lSr,this.end=cSr,e=4;break;case"utf8":this.fillLast=aSr,e=4;break;case"base64":this.text=dSr,this.end=fSr,e=3;break;default:this.write=pSr,this.end=mSr;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Sxe.allocUnsafe(e)}$H.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>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function oSr(t,e,r){var n=e.length-1;if(n=0?(o>0&&(t.lastNeed=o-1),o):--n=0?(o>0&&(t.lastNeed=o-2),o):--n=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function iSr(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 aSr(t){var e=this.lastTotal-this.lastNeed,r=iSr(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 sSr(t,e){var r=oSr(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 uSr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function lSr(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 cSr(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 dSr(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 fSr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function pSr(t){return t.toString(this.encoding)}function mSr(t){return t&&t.length?this.write(t):""}});var xxe=v((uvo,zbt)=>{"use strict";var Bbt=rA(),{PromisePrototypeThen:hSr,SymbolAsyncIterator:qbt,SymbolIterator:Ubt}=Va(),{Buffer:gSr}=Pp(),{ERR_INVALID_ARG_TYPE:ySr,ERR_STREAM_NULL_VALUES:bSr}=Kf().codes;function _Sr(t,e,r){let n;if(typeof e=="string"||e instanceof gSr)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[qbt])o=!0,n=e[qbt]();else if(e&&e[Ubt])o=!1,n=e[Ubt]();else throw new ySr("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){hSr(s(l),()=>Bbt.nextTick(c,l),d=>Bbt.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 bSr;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}zbt.exports=_Sr});var qH=v((lvo,s_t)=>{var Ly=rA(),{ArrayPrototypeIndexOf:vSr,NumberIsInteger:wSr,NumberIsNaN:SSr,NumberParseInt:xSr,ObjectDefineProperties:Mxe,ObjectKeys:CSr,ObjectSetPrototypeOf:Wbt,Promise:Kbt,SafeSet:OSr,SymbolAsyncDispose:PSr,SymbolAsyncIterator:ESr,Symbol:TSr}=Va();s_t.exports=cn;cn.ReadableState=lee;var{EventEmitter:ASr}=LH(),{Stream:oA,prependListener:ISr}=ree(),{Buffer:Cxe}=Pp(),{addAbortSignal:MSr}=FH(),Gbt=wO(),jn=Gd().debuglog("stream",t=>{jn=t}),RSr=Abt(),o$=Q1(),{getHighWaterMark:jSr,getDefaultHighWaterMark:NSr}=kH(),{aggregateTwoErrors:Hbt,codes:{ERR_INVALID_ARG_TYPE:DSr,ERR_METHOD_NOT_IMPLEMENTED:LSr,ERR_OUT_OF_RANGE:FSr,ERR_STREAM_PUSH_AFTER_EOF:kSr,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:$Sr},AbortError:BSr}=Kf(),{validateObject:qSr}=Qk(),tj=TSr("kPaused"),{StringDecoder:Jbt}=$bt(),USr=xxe();Wbt(cn.prototype,oA.prototype);Wbt(cn,oA);var Oxe=()=>{},{errorOrDestroy:r$}=o$,n$=1,zSr=2,Ybt=4,BH=8,Zbt=16,aee=32,see=64,Xbt=128,HSr=256,VSr=512,WSr=1024,Axe=2048,Ixe=4096,KSr=8192,GSr=16384,JSr=32768,Qbt=65536,YSr=1<<17,ZSr=1<<18;function Al(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Mxe(lee.prototype,{objectMode:Al(n$),ended:Al(zSr),endEmitted:Al(Ybt),reading:Al(BH),constructed:Al(Zbt),sync:Al(aee),needReadable:Al(see),emittedReadable:Al(Xbt),readableListening:Al(HSr),resumeScheduled:Al(VSr),errorEmitted:Al(WSr),emitClose:Al(Axe),autoDestroy:Al(Ixe),destroyed:Al(KSr),closed:Al(GSr),closeEmitted:Al(JSr),multiAwaitDrain:Al(Qbt),readingMore:Al(YSr),dataEmitted:Al(ZSr)});function lee(t,e,r){typeof r!="boolean"&&(r=e instanceof W_()),this.state=Axe|Ixe|Zbt|aee,t&&t.objectMode&&(this.state|=n$),r&&t&&t.readableObjectMode&&(this.state|=n$),this.highWaterMark=t?jSr(this,t,"readableHighWaterMark",r):NSr(!1),this.buffer=new RSr,this.length=0,this.pipes=[],this.flowing=null,this[tj]=null,t&&t.emitClose===!1&&(this.state&=~Axe),t&&t.autoDestroy===!1&&(this.state&=~Ixe),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Jbt(t.encoding),this.encoding=t.encoding)}function cn(t){if(!(this instanceof cn))return new cn(t);let e=this instanceof W_();this._readableState=new lee(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&&MSr(t.signal,this)),oA.call(this,t),o$.construct(this,()=>{this._readableState.needReadable&&uee(this,this._readableState)})}cn.prototype.destroy=o$.destroy;cn.prototype._undestroy=o$.undestroy;cn.prototype._destroy=function(t,e){e(t)};cn.prototype[ASr.captureRejectionSymbol]=function(t){this.destroy(t)};cn.prototype[PSr]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new BSr,this.destroy(t)),new Kbt((e,r)=>Gbt(this,n=>n&&n!==t?r(n):e(null)))};cn.prototype.push=function(t,e){return e_t(this,t,e,!1)};cn.prototype.unshift=function(t,e){return e_t(this,t,e,!0)};function e_t(t,e,r,n){jn("readableAddChunk",e);let o=t._readableState,i;if((o.state&n$)===0&&(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=Cxe.from(e,r).toString(o.encoding):(e=Cxe.from(e,r),r=""))):e instanceof Cxe?r="":oA._isUint8Array(e)?(e=oA._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new DSr("chunk",["string","Buffer","Uint8Array"],e))),i)r$(t,i);else if(e===null)o.state&=~BH,exr(t,o);else if((o.state&n$)!==0||e&&e.length>0)if(n)if((o.state&Ybt)!==0)r$(t,new $Sr);else{if(o.destroyed||o.errored)return!1;Pxe(t,o,e,!0)}else if(o.ended)r$(t,new kSr);else{if(o.destroyed||o.errored)return!1;o.state&=~BH,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?Pxe(t,o,e,!1):uee(t,o)):Pxe(t,o,e,!1)}else n||(o.state&=~BH,uee(t,o));return!o.ended&&(o.length0?((e.state&Qbt)!==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&see)!==0&&cee(t)),uee(t,e)}cn.prototype.isPaused=function(){let t=this._readableState;return t[tj]===!0||t.flowing===!1};cn.prototype.setEncoding=function(t){let e=new Jbt(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 XSr=1073741824;function QSr(t){if(t>XSr)throw new FSr("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Vbt(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&n$)!==0?1:SSr(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}cn.prototype.read=function(t){jn("read",t),t===void 0?t=NaN:wSr(t)||(t=xSr(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=QSr(t)),t!==0&&(e.state&=~Xbt),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return jn("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Exe(this):cee(this),null;if(t=Vbt(t,e),t===0&&e.ended)return e.length===0&&Exe(this),null;let n=(e.state&see)!==0;if(jn("need readable",n),(e.length===0||e.length-t0?o=i_t(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&&Exe(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function exr(t,e){if(jn("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?cee(t):(e.needReadable=!1,e.emittedReadable=!0,t_t(t))}}function cee(t){let e=t._readableState;jn("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(jn("emitReadable",e.flowing),e.emittedReadable=!0,Ly.nextTick(t_t,t))}function t_t(t){let e=t._readableState;jn("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,n_t(t)}function uee(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Ly.nextTick(txr,t,e))}function txr(t,e){for(;!e.reading&&!e.ended&&(e.length1&&n.pipes.includes(t)&&(jn("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=rxr(r,t),t.on("drain",u))}r.on("data",f);function f(g){jn("ondata");let y=t.write(g);jn("dest.write",y),y===!1&&d()}function p(g){if(jn("onerror",g),b(),t.removeListener("error",p),t.listenerCount("error")===0){let y=t._writableState||t._readableState;y&&!y.errorEmitted?r$(t,g):t.emit("error",g)}}ISr(t,"error",p);function m(){t.removeListener("finish",h),b()}t.once("close",m);function h(){jn("onfinish"),t.removeListener("close",m),b()}t.once("finish",h);function b(){jn("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(jn("pipe resume"),r.resume()),t};function rxr(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(jn("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(jn("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}cn.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;i0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,jn("on readable",n.length,n.reading),n.length?cee(this):n.reading||Ly.nextTick(nxr,this)),r};cn.prototype.addListener=cn.prototype.on;cn.prototype.removeListener=function(t,e){let r=oA.prototype.removeListener.call(this,t,e);return t==="readable"&&Ly.nextTick(r_t,this),r};cn.prototype.off=cn.prototype.removeListener;cn.prototype.removeAllListeners=function(t){let e=oA.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Ly.nextTick(r_t,this),e};function r_t(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[tj]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function nxr(t){jn("readable nexttick read 0"),t.read(0)}cn.prototype.resume=function(){let t=this._readableState;return t.flowing||(jn("resume"),t.flowing=!t.readableListening,oxr(this,t)),t[tj]=!1,this};function oxr(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Ly.nextTick(ixr,t,e))}function ixr(t,e){jn("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),n_t(t),e.flowing&&!e.reading&&t.read(0)}cn.prototype.pause=function(){return jn("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(jn("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[tj]=!0,this};function n_t(t){let e=t._readableState;for(jn("flow",e.flowing);e.flowing&&t.read()!==null;);}cn.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=>{r$(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=CSr(t);for(let n=1;n{o=a?Hbt(o,a):null,r(),r=Oxe});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 Kbt(n)}}}catch(a){throw o=Hbt(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?o$.destroyer(t,null):(t.off("readable",n),i())}}Mxe(cn.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}}});Mxe(lee.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[tj]!==!1},set(t){this[tj]=!!t}}});cn._fromList=i_t;function i_t(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 Exe(t){let e=t._readableState;jn("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Ly.nextTick(sxr,e,t))}function sxr(t,e){if(jn("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)Ly.nextTick(uxr,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function uxr(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}cn.from=function(t,e){return USr(cn,t,e)};var Txe;function a_t(){return Txe===void 0&&(Txe={}),Txe}cn.fromWeb=function(t,e){return a_t().newStreamReadableFromReadableStream(t,e)};cn.toWeb=function(t,e){return a_t().newReadableStreamFromStreamReadable(t,e)};cn.wrap=function(t,e){var r,n;return new cn({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){o$.destroyer(t,o),i(o)}}).wrap(t)}});var hee=v((cvo,__t)=>{var rj=rA(),{ArrayPrototypeSlice:c_t,Error:lxr,FunctionPrototypeSymbolHasInstance:d_t,ObjectDefineProperty:f_t,ObjectDefineProperties:cxr,ObjectSetPrototypeOf:p_t,StringPrototypeToLowerCase:dxr,Symbol:fxr,SymbolHasInstance:pxr}=Va();__t.exports=Wa;Wa.WritableState=HH;var{EventEmitter:mxr}=LH(),UH=ree().Stream,{Buffer:dee}=Pp(),mee=Q1(),{addAbortSignal:hxr}=FH(),{getHighWaterMark:gxr,getDefaultHighWaterMark:yxr}=kH(),{ERR_INVALID_ARG_TYPE:bxr,ERR_METHOD_NOT_IMPLEMENTED:_xr,ERR_MULTIPLE_CALLBACK:m_t,ERR_STREAM_CANNOT_PIPE:vxr,ERR_STREAM_DESTROYED:zH,ERR_STREAM_ALREADY_FINISHED:wxr,ERR_STREAM_NULL_VALUES:Sxr,ERR_STREAM_WRITE_AFTER_END:xxr,ERR_UNKNOWN_ENCODING:h_t}=Kf().codes,{errorOrDestroy:i$}=mee;p_t(Wa.prototype,UH.prototype);p_t(Wa,UH);function Nxe(){}var a$=fxr("kOnFinished");function HH(t,e,r){typeof r!="boolean"&&(r=e instanceof W_()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?gxr(this,t,"writableHighWaterMark",r):yxr(!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=Oxr.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,pee(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[a$]=[]}function pee(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}HH.prototype.getBuffer=function(){return c_t(this.buffered,this.bufferedIndex)};f_t(HH.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Wa(t){let e=this instanceof W_();if(!e&&!d_t(Wa,this))return new Wa(t);this._writableState=new HH(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&&hxr(t.signal,this)),UH.call(this,t),mee.construct(this,()=>{let r=this._writableState;r.writing||Lxe(this,r),Fxe(this,r)})}f_t(Wa,pxr,{__proto__:null,value:function(t){return d_t(this,t)?!0:this!==Wa?!1:t&&t._writableState instanceof HH}});Wa.prototype.pipe=function(){i$(this,new vxr)};function g_t(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"&&!dee.isEncoding(r))throw new h_t(r);typeof n!="function"&&(n=Nxe)}if(e===null)throw new Sxr;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=dee.from(e,r),r="buffer");else if(e instanceof dee)r="buffer";else if(UH._isUint8Array(e))e=UH._uint8ArrayToBuffer(e),r="buffer";else throw new bxr("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new xxr:o.destroyed&&(i=new zH("write")),i?(rj.nextTick(n,i),i$(t,i,!0),i):(o.pendingcb++,Cxr(t,o,e,r,n))}Wa.prototype.write=function(t,e,r){return g_t(this,t,e,r)===!0};Wa.prototype.cork=function(){this._writableState.corked++};Wa.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Lxe(this,t))};Wa.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=dxr(e)),!dee.isEncoding(e))throw new h_t(e);return this._writableState.defaultEncoding=e,this};function Cxr(t,e,r,n,o){let i=e.objectMode?1:r.length;e.length+=i;let a=e.lengthr.bufferedIndex&&Lxe(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},rj.nextTick(Pxr,r.afterWriteTickInfo)):y_t(t,r,1,o))}function Pxr({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,y_t(t,e,r,n)}function y_t(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&&Dxe(e),Fxe(t,e)}function Dxe(t){if(t.writing)return;for(let o=t.bufferedIndex;o1&&t._writev){e.pendingcb-=i-1;let s=e.allNoop?Nxe:l=>{for(let c=a;c256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}Wa.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new _xr("_write()")};Wa.prototype._writev=null;Wa.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=g_t(this,t,e);i instanceof lxr&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,Fxe(this,n,!0),n.ended=!0):n.finished?o=new wxr("end"):n.destroyed&&(o=new zH("end"))),typeof r=="function"&&(o||n.finished?rj.nextTick(r,o):n[a$].push(r)),this};function fee(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 Exr(t,e){let r=!1;function n(o){if(r){i$(t,o??m_t());return}if(r=!0,e.pendingcb--,o){let i=e[a$].splice(0);for(let a=0;a{fee(o)?jxe(n,o):o.pendingcb--},t,e)):fee(e)&&(e.pendingcb++,jxe(t,e))))}function jxe(t,e){e.pendingcb--,e.finished=!0;let r=e[a$].splice(0);for(let n=0;n{var kxe=rA(),Ixr=Pp(),{isReadable:Mxr,isWritable:Rxr,isIterable:v_t,isNodeStream:jxr,isReadableNodeStream:w_t,isWritableNodeStream:S_t,isDuplexNodeStream:Nxr,isReadableStream:x_t,isWritableStream:C_t}=z_(),O_t=wO(),{AbortError:M_t,codes:{ERR_INVALID_ARG_TYPE:Dxr,ERR_INVALID_RETURN_VALUE:P_t}}=Kf(),{destroyer:u$}=Q1(),Lxr=W_(),R_t=qH(),Fxr=hee(),{createDeferredPromise:E_t}=Gd(),T_t=xxe(),A_t=globalThis.Blob||Ixr.Blob,kxr=typeof A_t<"u"?function(e){return e instanceof A_t}:function(e){return!1},$xr=globalThis.AbortController||Yk().AbortController,{FunctionPrototypeCall:I_t}=Va(),iA=class extends Lxr{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)}};j_t.exports=function t(e,r){if(Nxr(e))return e;if(w_t(e))return s$({readable:e});if(S_t(e))return s$({writable:e});if(jxr(e))return s$({writable:!1,readable:!1});if(x_t(e))return s$({readable:R_t.fromWeb(e)});if(C_t(e))return s$({writable:Fxr.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=Bxr(e);if(v_t(o))return T_t(iA,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=I_t(u,o,d=>{if(d!=null)throw new P_t("nully","body",d)},d=>{u$(l,d)});return l=new iA({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,kxe.nextTick(d,null)}catch(f){kxe.nextTick(d,f)}})},destroy:s})}throw new P_t("Iterable, AsyncIterable or AsyncFunction",r,o)}if(kxr(e))return t(e.arrayBuffer());if(v_t(e))return T_t(iA,e,{objectMode:!0,writable:!1});if(x_t(e?.readable)&&C_t(e?.writable))return iA.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?w_t(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?S_t(e?.writable)?e?.writable:t(e.writable):void 0;return s$({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return I_t(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{u$(o,i)}),o=new iA({objectMode:!0,writable:!1,read(){}})}throw new Dxr(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function Bxr(t){let{promise:e,resolve:r}=E_t(),n=new $xr,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(kxe.nextTick(l),u)return;if(o.aborted)throw new M_t(void 0,{cause:o.reason});({promise:e,resolve:r}=E_t()),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 s$(t){let e=t.readable&&typeof t.readable.read!="function"?R_t.wrap(t.readable):t.readable,r=t.writable,n=!!Mxr(e),o=!!Rxr(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new iA({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(O_t(r,d=>{o=!1,d&&u$(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&&(O_t(e,d=>{n=!1,d&&u$(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 M_t),s=null,i=null,a=null,u===null?f(d):(u=f,u$(r,d),u$(e,d))},l}});var W_=v((fvo,F_t)=>{"use strict";var{ObjectDefineProperties:qxr,ObjectGetOwnPropertyDescriptor:SO,ObjectKeys:Uxr,ObjectSetPrototypeOf:D_t}=Va();F_t.exports=Fy;var qxe=qH(),ng=hee();D_t(Fy.prototype,qxe.prototype);D_t(Fy,qxe);{let t=Uxr(ng.prototype);for(let e=0;e{"use strict";var{ObjectSetPrototypeOf:k_t,Symbol:zxr}=Va();$_t.exports=xO;var{ERR_METHOD_NOT_IMPLEMENTED:Hxr}=Kf().codes,zxe=W_(),{getHighWaterMark:Vxr}=kH();k_t(xO.prototype,zxe.prototype);k_t(xO,zxe);var VH=zxr("kCallback");function xO(t){if(!(this instanceof xO))return new xO(t);let e=t?Vxr(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),zxe.call(this,t),this._readableState.sync=!1,this[VH]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Wxr)}function Uxe(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 Wxr(){this._final!==Uxe&&Uxe.call(this)}xO.prototype._final=Uxe;xO.prototype._transform=function(t,e,r){throw new Hxr("_transform()")};xO.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{"use strict";var{ObjectSetPrototypeOf:B_t}=Va();q_t.exports=l$;var Vxe=Hxe();B_t(l$.prototype,Vxe.prototype);B_t(l$,Vxe);function l$(t){if(!(this instanceof l$))return new l$(t);Vxe.call(this,t)}l$.prototype._transform=function(t,e,r){r(null,t)}});var _ee=v((hvo,W_t)=>{var WH=rA(),{ArrayIsArray:Kxr,Promise:Gxr,SymbolAsyncIterator:Jxr,SymbolDispose:Yxr}=Va(),bee=wO(),{once:Zxr}=Gd(),Xxr=Q1(),U_t=W_(),{aggregateTwoErrors:Qxr,codes:{ERR_INVALID_ARG_TYPE:tCe,ERR_INVALID_RETURN_VALUE:Kxe,ERR_MISSING_ARGS:eCr,ERR_STREAM_DESTROYED:tCr,ERR_STREAM_PREMATURE_CLOSE:rCr},AbortError:nCr}=Kf(),{validateFunction:oCr,validateAbortSignal:iCr}=Qk(),{isIterable:nj,isReadable:Gxe,isReadableNodeStream:yee,isNodeStream:z_t,isTransformStream:c$,isWebStream:aCr,isReadableStream:Jxe,isReadableFinished:sCr}=z_(),uCr=globalThis.AbortController||Yk().AbortController,Yxe,Zxe,Xxe;function H_t(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=bee(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,Xxr.destroyer(t,i||new tCr("pipe")))},cleanup:o}}function lCr(t){return oCr(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function Qxe(t){if(nj(t))return t;if(yee(t))return cCr(t);throw new tCe("val",["Readable","Iterable","AsyncIterable"],t)}async function*cCr(t){Zxe||(Zxe=qH()),yield*Zxe.prototype[Jxr].call(t)}async function gee(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new Gxr((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=bee(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?Qxr(o,l):l)}finally{u(),e.off("drain",a)}}async function eCe(t,e,r,{end:n}){c$(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 dCr(...t){return V_t(t,Zxr(lCr(t)))}function V_t(t,e,r){if(t.length===1&&Kxr(t[0])&&(t=t[0]),t.length<2)throw new eCr("streams");let n=new uCr,o=n.signal,i=r?.signal,a=[];iCr(i,"options.signal");function s(){m(new nCr)}Xxe=Xxe||Gd().addAbortListener;let u;i&&(u=Xxe(i,s));let l,c,d=[],f=0;function p(S){m(S,--f===0)}function m(S,x){var O;if(S&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=S),!(!l&&!x)){for(;d.length;)d.shift()(l);(O=u)===null||O===void 0||O[Yxr](),n.abort(),x&&(l||a.forEach(P=>P()),WH.nextTick(e,l,c))}}let h;for(let S=0;S0,E=O||r?.end!==!1,A=S===t.length-1;if(z_t(x)){let I=function(R){R&&R.name!=="AbortError"&&R.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(R)};var y=I;if(E){let{destroy:R,cleanup:N}=H_t(x,O,P);d.push(R),Gxe(x)&&A&&a.push(N)}x.on("error",I),Gxe(x)&&A&&a.push(()=>{x.removeListener("error",I)})}if(S===0)if(typeof x=="function"){if(h=x({signal:o}),!nj(h))throw new Kxe("Iterable, AsyncIterable or Stream","source",h)}else nj(x)||yee(x)||c$(x)?h=x:h=U_t.from(x);else if(typeof x=="function"){if(c$(h)){var b;h=Qxe((b=h)===null||b===void 0?void 0:b.readable)}else h=Qxe(h);if(h=x(h,{signal:o}),O){if(!nj(h,!0))throw new Kxe("AsyncIterable",`transform[${S-1}]`,h)}else{var g;Yxe||(Yxe=Wxe());let I=new Yxe({objectMode:!0}),R=(g=h)===null||g===void 0?void 0:g.then;if(typeof R=="function")f++,R.call(h,$=>{c=$,$!=null&&I.write($),E&&I.end(),WH.nextTick(p)},$=>{I.destroy($),WH.nextTick(p,$)});else if(nj(h,!0))f++,gee(h,I,p,{end:E});else if(Jxe(h)||c$(h)){let $=h.readable||h;f++,gee($,I,p,{end:E})}else throw new Kxe("AsyncIterable or Promise","destination",h);h=I;let{destroy:N,cleanup:j}=H_t(h,!1,!0);d.push(N),A&&a.push(j)}}else if(z_t(x)){if(yee(h)){f+=2;let I=fCr(h,x,p,{end:E});Gxe(x)&&A&&a.push(I)}else if(c$(h)||Jxe(h)){let I=h.readable||h;f++,gee(I,x,p,{end:E})}else if(nj(h))f++,gee(h,x,p,{end:E});else throw new tCe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=x}else if(aCr(x)){if(yee(h))f++,eCe(Qxe(h),x,p,{end:E});else if(Jxe(h)||nj(h))f++,eCe(h,x,p,{end:E});else if(c$(h))f++,eCe(h.readable,x,p,{end:E});else throw new tCe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=x}else h=U_t.from(x)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&WH.nextTick(s),h}function fCr(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new rCr)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;sCr(t)?WH.nextTick(a):t.once("end",a)}else r();return bee(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)}),bee(e,{readable:!1,writable:!0},r)}W_t.exports={pipelineImpl:V_t,pipeline:dCr}});var nCe=v((gvo,X_t)=>{"use strict";var{pipeline:pCr}=_ee(),vee=W_(),{destroyer:mCr}=Q1(),{isNodeStream:wee,isReadable:K_t,isWritable:G_t,isWebStream:rCe,isTransformStream:oj,isWritableStream:J_t,isReadableStream:Y_t}=z_(),{AbortError:hCr,codes:{ERR_INVALID_ARG_VALUE:Z_t,ERR_MISSING_ARGS:gCr}}=Kf(),yCr=wO();X_t.exports=function(...e){if(e.length===0)throw new gCr("streams");if(e.length===1)return vee.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=vee.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=vee.from(e[p])}for(let p=0;p0&&!(G_t(e[p])||J_t(e[p])||oj(e[p])))throw new Z_t(`streams[${p}]`,r[p],"must be writable")}let n,o,i,a,s;function u(p){let m=a;a=null,m?m(p):p?s.destroy(p):!f&&!d&&s.destroy()}let l=e[0],c=pCr(e,u),d=!!(G_t(l)||J_t(l)||oj(l)),f=!!(K_t(c)||Y_t(c)||oj(c));if(s=new vee({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(wee(l))s._write=function(m,h,b){l.write(m,h)?b():n=b},s._final=function(m){l.end(),o=m},l.on("drain",function(){if(n){let m=n;n=null,m()}});else if(rCe(l)){let h=(oj(l)?l.writable:l).getWriter();s._write=async function(b,g,y){try{await h.ready,h.write(b).catch(()=>{}),y()}catch(S){y(S)}},s._final=async function(b){try{await h.ready,h.close().catch(()=>{}),o=b}catch(g){b(g)}}}let p=oj(c)?c.readable:c;yCr(p,()=>{if(o){let m=o;o=null,m()}})}if(f){if(wee(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(rCe(c)){let m=(oj(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:h,done:b}=await m.read();if(!s.push(h))return;if(b){s.push(null);return}}catch{return}}}}return s._destroy=function(p,m){!p&&a!==null&&(p=new hCr),i=null,n=null,o=null,a===null?m(p):(a=m,wee(c)&&mCr(c,p))},s}});var uvt=v((yvo,aCe)=>{"use strict";var bCr=globalThis.AbortController||Yk().AbortController,{codes:{ERR_INVALID_ARG_VALUE:_Cr,ERR_INVALID_ARG_TYPE:KH,ERR_MISSING_ARGS:vCr,ERR_OUT_OF_RANGE:wCr},AbortError:K_}=Kf(),{validateAbortSignal:ij,validateInteger:Q_t,validateObject:aj}=Qk(),SCr=Va().Symbol("kWeak"),xCr=Va().Symbol("kResistStopPropagation"),{finished:CCr}=wO(),OCr=nCe(),{addAbortSignalNoValidate:PCr}=FH(),{isWritable:ECr,isNodeStream:TCr}=z_(),{deprecate:ACr}=Gd(),{ArrayPrototypePush:ICr,Boolean:MCr,MathFloor:evt,Number:RCr,NumberIsNaN:jCr,Promise:tvt,PromiseReject:rvt,PromiseResolve:NCr,PromisePrototypeThen:nvt,Symbol:ivt}=Va(),See=ivt("kEmpty"),ovt=ivt("kEof");function DCr(t,e){if(e!=null&&aj(e,"options"),e?.signal!=null&&ij(e.signal,"options.signal"),TCr(t)&&!ECr(t))throw new _Cr("stream",t,"must be writable");let r=OCr(this,t);return e!=null&&e.signal&&PCr(e.signal,r),r}function xee(t,e){if(typeof t!="function")throw new KH("fn",["Function","AsyncFunction"],t);e!=null&&aj(e,"options"),e?.signal!=null&&ij(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=evt(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=evt(e.highWaterMark)),Q_t(r,"options.concurrency",1),Q_t(n,"options.highWaterMark",0),n+=r,async function*(){let i=Gd().AbortSignalAny([e?.signal].filter(MCr)),a=this,s=[],u={signal:i},l,c,d=!1,f=0;function p(){d=!0,m()}function m(){f-=1,h()}function h(){c&&!d&&f=n||f>=r)&&await new tvt(y=>{c=y})}s.push(ovt)}catch(g){let y=rvt(g);nvt(y,m,p),s.push(y)}finally{d=!0,l&&(l(),l=null)}}b();try{for(;;){for(;s.length>0;){let g=await s[0];if(g===ovt)return;if(i.aborted)throw new K_;g!==See&&(yield g),s.shift(),h()}await new tvt(g=>{l=g})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function LCr(t=void 0){return t!=null&&aj(t,"options"),t?.signal!=null&&ij(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 K_({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function avt(t,e=void 0){for await(let r of iCe.call(this,t,e))return!0;return!1}async function FCr(t,e=void 0){if(typeof t!="function")throw new KH("fn",["Function","AsyncFunction"],t);return!await avt.call(this,async(...r)=>!await t(...r),e)}async function kCr(t,e){for await(let r of iCe.call(this,t,e))return r}async function $Cr(t,e){if(typeof t!="function")throw new KH("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),See}for await(let n of xee.call(this,r,e));}function iCe(t,e){if(typeof t!="function")throw new KH("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:See}return xee.call(this,r,e)}var oCe=class extends vCr{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function BCr(t,e,r){var n;if(typeof t!="function")throw new KH("reducer",["Function","AsyncFunction"],t);r!=null&&aj(r,"options"),r?.signal!=null&&ij(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new K_(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await CCr(this.destroy(l)),l}let i=new bCr,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[SCr]:this,[xCr]:!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 K_;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new oCe}finally{i.abort()}return e}async function qCr(t){t!=null&&aj(t,"options"),t?.signal!=null&&ij(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 K_(void 0,{cause:t.signal.reason});ICr(e,n)}return e}function UCr(t,e){let r=xee.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function svt(t){if(t=RCr(t),jCr(t))return 0;if(t<0)throw new wCr("number",">= 0",t);return t}function zCr(t,e=void 0){return e!=null&&aj(e,"options"),e?.signal!=null&&ij(e.signal,"options.signal"),t=svt(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new K_;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new K_;t--<=0&&(yield i)}}.call(this)}function HCr(t,e=void 0){return e!=null&&aj(e,"options"),e?.signal!=null&&ij(e.signal,"options.signal"),t=svt(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new K_;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new K_;if(t-- >0&&(yield i),t<=0)return}}.call(this)}aCe.exports.streamReturningOperators={asIndexedPairs:ACr(LCr,"readable.asIndexedPairs will be removed in a future version."),drop:zCr,filter:iCe,flatMap:UCr,map:xee,take:HCr,compose:DCr};aCe.exports.promiseReturningOperators={every:FCr,forEach:$Cr,reduce:BCr,toArray:qCr,some:avt,find:kCr}});var sCe=v((bvo,lvt)=>{"use strict";var{ArrayPrototypePop:VCr,Promise:WCr}=Va(),{isIterable:KCr,isNodeStream:GCr,isWebStream:JCr}=z_(),{pipelineImpl:YCr}=_ee(),{finished:ZCr}=wO();uCe();function XCr(...t){return new WCr((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!GCr(i)&&!KCr(i)&&!JCr(i)){let a=VCr(t);n=a.signal,o=a.end}YCr(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}lvt.exports={finished:ZCr,pipeline:XCr}});var uCe=v((_vo,bvt)=>{var{Buffer:QCr}=Pp(),{ObjectDefineProperty:CO,ObjectKeys:fvt,ReflectApply:pvt}=Va(),{promisify:{custom:mvt}}=Gd(),{streamReturningOperators:cvt,promiseReturningOperators:dvt}=uvt(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:hvt}}=Kf(),eOr=nCe(),{setDefaultHighWaterMark:tOr,getDefaultHighWaterMark:rOr}=kH(),{pipeline:gvt}=_ee(),{destroyer:nOr}=Q1(),yvt=wO(),lCe=sCe(),GH=z_(),la=bvt.exports=ree().Stream;la.isDestroyed=GH.isDestroyed;la.isDisturbed=GH.isDisturbed;la.isErrored=GH.isErrored;la.isReadable=GH.isReadable;la.isWritable=GH.isWritable;la.Readable=qH();for(let t of fvt(cvt)){let r=function(...n){if(new.target)throw hvt();return la.Readable.from(pvt(e,this,n))};cCe=r;let e=cvt[t];CO(r,"name",{__proto__:null,value:e.name}),CO(r,"length",{__proto__:null,value:e.length}),CO(la.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var cCe;for(let t of fvt(dvt)){let r=function(...o){if(new.target)throw hvt();return pvt(e,this,o)};cCe=r;let e=dvt[t];CO(r,"name",{__proto__:null,value:e.name}),CO(r,"length",{__proto__:null,value:e.length}),CO(la.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var cCe;la.Writable=hee();la.Duplex=W_();la.Transform=Hxe();la.PassThrough=Wxe();la.pipeline=gvt;var{addAbortSignal:oOr}=FH();la.addAbortSignal=oOr;la.finished=yvt;la.destroy=nOr;la.compose=eOr;la.setDefaultHighWaterMark=tOr;la.getDefaultHighWaterMark=rOr;CO(la,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return lCe}});CO(gvt,mvt,{__proto__:null,enumerable:!0,get(){return lCe.pipeline}});CO(yvt,mvt,{__proto__:null,enumerable:!0,get(){return lCe.finished}});la.Stream=la;la._isUint8Array=function(e){return e instanceof Uint8Array};la._uint8ArrayToBuffer=function(e){return QCr.from(e.buffer,e.byteOffset,e.byteLength)}});var JH=v((vvo,js)=>{"use strict";var Il=uCe(),iOr=sCe(),aOr=Il.Readable.destroy;js.exports=Il.Readable;js.exports._uint8ArrayToBuffer=Il._uint8ArrayToBuffer;js.exports._isUint8Array=Il._isUint8Array;js.exports.isDisturbed=Il.isDisturbed;js.exports.isErrored=Il.isErrored;js.exports.isReadable=Il.isReadable;js.exports.Readable=Il.Readable;js.exports.Writable=Il.Writable;js.exports.Duplex=Il.Duplex;js.exports.Transform=Il.Transform;js.exports.PassThrough=Il.PassThrough;js.exports.addAbortSignal=Il.addAbortSignal;js.exports.finished=Il.finished;js.exports.destroy=Il.destroy;js.exports.destroy=aOr;js.exports.pipeline=Il.pipeline;js.exports.compose=Il.compose;Object.defineProperty(Il,"promises",{configurable:!0,enumerable:!0,get(){return iOr}});js.exports.Stream=Il.Stream;js.exports.default=js.exports});var sj=v((wvo,_vt)=>{"use strict";_vt.exports=TypeError});var vvt=v(()=>{});var QH=v((Cvo,Bvt)=>{var vCe=typeof Map=="function"&&Map.prototype,dCe=Object.getOwnPropertyDescriptor&&vCe?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Oee=vCe&&dCe&&typeof dCe.get=="function"?dCe.get:null,wvt=vCe&&Map.prototype.forEach,wCe=typeof Set=="function"&&Set.prototype,fCe=Object.getOwnPropertyDescriptor&&wCe?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Pee=wCe&&fCe&&typeof fCe.get=="function"?fCe.get:null,Svt=wCe&&Set.prototype.forEach,sOr=typeof WeakMap=="function"&&WeakMap.prototype,ZH=sOr?WeakMap.prototype.has:null,uOr=typeof WeakSet=="function"&&WeakSet.prototype,XH=uOr?WeakSet.prototype.has:null,lOr=typeof WeakRef=="function"&&WeakRef.prototype,xvt=lOr?WeakRef.prototype.deref:null,cOr=Boolean.prototype.valueOf,dOr=Object.prototype.toString,fOr=Function.prototype.toString,pOr=String.prototype.match,SCe=String.prototype.slice,aA=String.prototype.replace,mOr=String.prototype.toUpperCase,Cvt=String.prototype.toLowerCase,jvt=RegExp.prototype.test,Ovt=Array.prototype.concat,G_=Array.prototype.join,hOr=Array.prototype.slice,Pvt=Math.floor,hCe=typeof BigInt=="function"?BigInt.prototype.valueOf:null,pCe=Object.getOwnPropertySymbols,gCe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,d$=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Yd=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===d$||!0)?Symbol.toStringTag:null,Nvt=Object.prototype.propertyIsEnumerable,Evt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Tvt(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||jvt.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-Pvt(-t):Pvt(t);if(n!==t){var o=String(n),i=SCe.call(e,o.length+1);return aA.call(o,r,"$&_")+"."+aA.call(aA.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return aA.call(e,r,"$&_")}var yCe=vvt(),Avt=yCe.custom,Ivt=Fvt(Avt)?Avt:null,Dvt={__proto__:null,double:'"',single:"'"},gOr={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Bvt.exports=function t(e,r,n,o){var i=r||{};if(OO(i,"quoteStyle")&&!OO(Dvt,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(OO(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=OO(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(OO(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(OO(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 $vt(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?Tvt(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?Tvt(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 bCe(e)?"[Array]":"[Object]";var d=NOr(i,n);if(typeof o>"u")o=[];else if(kvt(o,e)>=0)return"[Circular]";function f($,k,z){if(k&&(o=hOr.call(o),o.push(k)),z){var V={depth:i.depth};return OO(i,"quoteStyle")&&(V.quoteStyle=i.quoteStyle),t($,V,n+1,o)}return t($,i,n+1,o)}if(typeof e=="function"&&!Mvt(e)){var p=OOr(e),m=Cee(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+G_.call(m,", ")+" }":"")}if(Fvt(e)){var h=d$?aA.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):gCe.call(e);return typeof e=="object"&&!d$?YH(h):h}if(MOr(e)){for(var b="<"+Cvt.call(String(e.nodeName)),g=e.attributes||[],y=0;y",b}if(bCe(e)){if(e.length===0)return"[]";var S=Cee(e,f);return d&&!jOr(S)?"["+_Ce(S,d)+"]":"[ "+G_.call(S,", ")+" ]"}if(_Or(e)){var x=Cee(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!Nvt.call(e,"cause")?"{ ["+String(e)+"] "+G_.call(Ovt.call("[cause]: "+f(e.cause),x),", ")+" }":x.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+G_.call(x,", ")+" }"}if(typeof e=="object"&&a){if(Ivt&&typeof e[Ivt]=="function"&&yCe)return yCe(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(POr(e)){var O=[];return wvt&&wvt.call(e,function($,k){O.push(f(k,e,!0)+" => "+f($,e))}),Rvt("Map",Oee.call(e),O,d)}if(AOr(e)){var P=[];return Svt&&Svt.call(e,function($){P.push(f($,e))}),Rvt("Set",Pee.call(e),P,d)}if(EOr(e))return mCe("WeakMap");if(IOr(e))return mCe("WeakSet");if(TOr(e))return mCe("WeakRef");if(wOr(e))return YH(f(Number(e)));if(xOr(e))return YH(f(hCe.call(e)));if(SOr(e))return YH(cOr.call(e));if(vOr(e))return YH(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(!bOr(e)&&!Mvt(e)){var E=Cee(e,f),A=Evt?Evt(e)===Object.prototype:e instanceof Object||e.constructor===Object,I=e instanceof Object?"":"null prototype",R=!A&&Yd&&Object(e)===e&&Yd in e?SCe.call(sA(e),8,-1):I?"Object":"",N=A||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",j=N+(R||I?"["+G_.call(Ovt.call([],R||[],I||[]),": ")+"] ":"");return E.length===0?j+"{}":d?j+"{"+_Ce(E,d)+"}":j+"{ "+G_.call(E,", ")+" }"}return String(e)};function Lvt(t,e,r){var n=r.quoteStyle||e,o=Dvt[n];return o+t+o}function yOr(t){return aA.call(String(t),/"/g,""")}function bCe(t){return sA(t)==="[object Array]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function bOr(t){return sA(t)==="[object Date]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function Mvt(t){return sA(t)==="[object RegExp]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function _Or(t){return sA(t)==="[object Error]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function vOr(t){return sA(t)==="[object String]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function wOr(t){return sA(t)==="[object Number]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function SOr(t){return sA(t)==="[object Boolean]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function Fvt(t){if(d$)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!gCe)return!1;try{return gCe.call(t),!0}catch{}return!1}function xOr(t){if(!t||typeof t!="object"||!hCe)return!1;try{return hCe.call(t),!0}catch{}return!1}var COr=Object.prototype.hasOwnProperty||function(t){return t in this};function OO(t,e){return COr.call(t,e)}function sA(t){return dOr.call(t)}function OOr(t){if(t.name)return t.name;var e=pOr.call(fOr.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function kvt(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return $vt(SCe.call(t,0,e.maxStringLength),e)+n}var o=gOr[e.quoteStyle||"single"];o.lastIndex=0;var i=aA.call(aA.call(t,o,"\\$1"),/[\x00-\x1f]/g,ROr);return Lvt(i,"single",e)}function ROr(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":"")+mOr.call(e.toString(16))}function YH(t){return"Object("+t+")"}function mCe(t){return t+" { ? }"}function Rvt(t,e,r,n){var o=n?_Ce(r,n):G_.call(r,", ");return t+" ("+e+") {"+o+"}"}function jOr(t){for(var e=0;e=0)return!1;return!0}function NOr(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=G_.call(Array(t.indent+1)," ");else return null;return{base:r,prev:G_.call(Array(e+1),r)}}function _Ce(t,e){if(t.length===0)return"";var r=` +${(0,qQ.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,LH.toUint8Array)(i)),(0,qQ.toHex)(await a.digest())}getSigningKey(e,r,n,o){return(0,UQ.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")}};HQ.SignatureV4=XSe;var zQ=t=>{let e=(0,Dvr.iso8601)(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},cyt=t=>Object.keys(t).sort().join(";")});var pyt=v(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});jp.prepareRequest=jp.moveHeadersToQuery=jp.getPayloadHash=jp.getCanonicalQuery=jp.getCanonicalHeaders=void 0;var fyt=(V1(),zl(H1));fyt.__exportStar(dyt(),jp);var Lvr=HSe();Object.defineProperty(jp,"getCanonicalHeaders",{enumerable:!0,get:function(){return Lvr.getCanonicalHeaders}});var Fvr=WSe();Object.defineProperty(jp,"getCanonicalQuery",{enumerable:!0,get:function(){return Fvr.getCanonicalQuery}});var kvr=KSe();Object.defineProperty(jp,"getPayloadHash",{enumerable:!0,get:function(){return kvr.getPayloadHash}});var $vr=JSe();Object.defineProperty(jp,"moveHeadersToQuery",{enumerable:!0,get:function(){return $vr.moveHeadersToQuery}});var Bvr=YSe();Object.defineProperty(jp,"prepareRequest",{enumerable:!0,get:function(){return Bvr.prepareRequest}});fyt.__exportStar(USe(),jp)});var myt=v(QSe=>{"use strict";Object.defineProperty(QSe,"__esModule",{value:!0});var qvr=(V1(),zl(H1));qvr.__exportStar(pyt(),QSe)});var Va=v((Z_o,hyt)=>{"use strict";hyt.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 Zk=v((X_o,VQ)=>{"use strict";var{AbortController:gyt,AbortSignal:Uvr}=typeof self<"u"?self:typeof window<"u"?window:void 0;VQ.exports=gyt;VQ.exports.AbortSignal=Uvr;VQ.exports.default=gyt});var FH=v((Q_o,exe)=>{"use strict";var Xk=typeof Reflect=="object"?Reflect:null,yyt=Xk&&typeof Xk.apply=="function"?Xk.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},WQ;Xk&&typeof Xk.ownKeys=="function"?WQ=Xk.ownKeys:Object.getOwnPropertySymbols?WQ=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:WQ=function(e){return Object.getOwnPropertyNames(e)};function zvr(t){console&&console.warn&&console.warn(t)}var _yt=Number.isNaN||function(e){return e!==e};function Ei(){Ei.init.call(this)}exe.exports=Ei;exe.exports.once=Kvr;Ei.EventEmitter=Ei;Ei.prototype._events=void 0;Ei.prototype._eventsCount=0;Ei.prototype._maxListeners=void 0;var byt=10;function KQ(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ei,"defaultMaxListeners",{enumerable:!0,get:function(){return byt},set:function(t){if(typeof t!="number"||t<0||_yt(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");byt=t}});Ei.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};Ei.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||_yt(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 vyt(t){return t._maxListeners===void 0?Ei.defaultMaxListeners:t._maxListeners}Ei.prototype.getMaxListeners=function(){return vyt(this)};Ei.prototype.emit=function(e){for(var r=[],n=1;n0&&(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")yyt(u,this,r);else for(var l=u.length,c=Oyt(u,l),n=0;n0&&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,zvr(s)}return t}Ei.prototype.addListener=function(e,r){return wyt(this,e,r,!1)};Ei.prototype.on=Ei.prototype.addListener;Ei.prototype.prependListener=function(e,r){return wyt(this,e,r,!0)};function Hvr(){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 Syt(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=Hvr.bind(n);return o.listener=r,n.wrapFn=o,o}Ei.prototype.once=function(e,r){return KQ(r),this.on(e,Syt(this,e,r)),this};Ei.prototype.prependOnceListener=function(e,r){return KQ(r),this.prependListener(e,Syt(this,e,r)),this};Ei.prototype.removeListener=function(e,r){var n,o,i,a,s;if(KQ(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():Vvr(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};Ei.prototype.off=Ei.prototype.removeListener;Ei.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=0;o--)this.removeListener(e,r[o]);return this};function xyt(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?Wvr(o):Oyt(o,o.length)}Ei.prototype.listeners=function(e){return xyt(this,e,!0)};Ei.prototype.rawListeners=function(e){return xyt(this,e,!1)};Ei.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Cyt.call(t,e)};Ei.prototype.listenerCount=Cyt;function Cyt(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}Ei.prototype.eventNames=function(){return this._eventsCount>0?WQ(this._events):[]};function Oyt(t,e){for(var r=new Array(e),n=0;n{"use strict";var Jvr=Pp(),{kResistStopPropagation:Yvr,SymbolDispose:Zvr}=Va(),Xvr=globalThis.AbortSignal||Zk().AbortSignal,Qvr=globalThis.AbortController||Zk().AbortController,ewr=Object.getPrototypeOf(async function(){}).constructor,Eyt=globalThis.Blob||Jvr.Blob,twr=typeof Eyt<"u"?function(e){return e instanceof Eyt}:function(e){return!1},Tyt=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},rwr=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},txe=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{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 ewr},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:twr,deprecate(t,e){return t},addAbortListener:FH().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);Tyt(e,"signal"),rwr(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Yvr]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Zvr](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:Xvr.any||function(e){if(e.length===1)return e[0];let r=new Qvr,n=()=>r.abort();return e.forEach(o=>{Tyt(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};rxe.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Kf=v((tvo,Myt)=>{"use strict";var{format:nwr,inspect:GQ,AggregateError:owr}=Gd(),iwr=globalThis.AggregateError||owr,awr=Symbol("kIsNodeError"),swr=["string","function","number","object","Function","Object","boolean","bigint","symbol"],uwr=/^([A-Z][a-z0-9]*)+$/,lwr="__node_internal_",JQ={};function Y1(t,e){if(!t)throw new JQ.ERR_INTERNAL_ASSERTION(e)}function Ayt(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 cwr(t,e,r){if(typeof e=="function")return Y1(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 Y1(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:nwr(e,...r)}function qc(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(cwr(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[awr]=!0,JQ[t]=n}function Iyt(t){let e=lwr+t.name;return Object.defineProperty(t,"name",{value:e}),t}function dwr(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new iwr([e,t],e.message);return r.code=e.code,r}return t||e}var nxe=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new JQ.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};qc("ERR_ASSERTION","%s",Error);qc("ERR_INVALID_ARG_TYPE",(t,e,r)=>{Y1(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)Y1(typeof u=="string","All expected entries have to be of type string"),swr.includes(u)?o.push(u.toLowerCase()):uwr.test(u)?i.push(u):(Y1(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=GQ(r,{depth:-1});n+=`. Received ${u}`}}else{let u=GQ(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);qc("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=GQ(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);qc("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);qc("ERR_MISSING_ARGS",(...t)=>{Y1(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);qc("ERR_OUT_OF_RANGE",(t,e,r)=>{Y1(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=Ayt(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=Ayt(n)),n+="n"):n=GQ(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);qc("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);qc("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);qc("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);qc("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);qc("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);qc("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);qc("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);qc("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);qc("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);qc("ERR_STREAM_WRITE_AFTER_END","write after end",Error);qc("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Myt.exports={AbortError:nxe,aggregateTwoErrors:Iyt(dwr),hideStackFrames:Iyt,codes:JQ}});var e$=v((rvo,qyt)=>{"use strict";var{ArrayIsArray:ixe,ArrayPrototypeIncludes:Dyt,ArrayPrototypeJoin:Lyt,ArrayPrototypeMap:fwr,NumberIsInteger:axe,NumberIsNaN:pwr,NumberMAX_SAFE_INTEGER:mwr,NumberMIN_SAFE_INTEGER:hwr,NumberParseInt:gwr,ObjectPrototypeHasOwnProperty:ywr,RegExpPrototypeExec:Fyt,String:bwr,StringPrototypeToUpperCase:_wr,StringPrototypeTrim:vwr}=Va(),{hideStackFrames:rg,codes:{ERR_SOCKET_BAD_PORT:wwr,ERR_INVALID_ARG_TYPE:Jd,ERR_INVALID_ARG_VALUE:Qk,ERR_OUT_OF_RANGE:Z1,ERR_UNKNOWN_SIGNAL:Ryt}}=Kf(),{normalizeEncoding:Swr}=Gd(),{isAsyncFunction:xwr,isArrayBufferView:Cwr}=Gd().types,jyt={};function Owr(t){return t===(t|0)}function Pwr(t){return t===t>>>0}var Ewr=/^[0-7]+$/,Twr="must be a 32-bit unsigned integer or an octal string";function Awr(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(Fyt(Ewr,t)===null)throw new Qk(e,t,Twr);t=gwr(t,8)}return kyt(t,e),t}var Iwr=rg((t,e,r=hwr,n=mwr)=>{if(typeof t!="number")throw new Jd(e,"number",t);if(!axe(t))throw new Z1(e,"an integer",t);if(tn)throw new Z1(e,`>= ${r} && <= ${n}`,t)}),Mwr=rg((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Jd(e,"number",t);if(!axe(t))throw new Z1(e,"an integer",t);if(tn)throw new Z1(e,`>= ${r} && <= ${n}`,t)}),kyt=rg((t,e,r=!1)=>{if(typeof t!="number")throw new Jd(e,"number",t);if(!axe(t))throw new Z1(e,"an integer",t);let n=r?1:0,o=4294967295;if(to)throw new Z1(e,`>= ${n} && <= ${o}`,t)});function sxe(t,e){if(typeof t!="string")throw new Jd(e,"string",t)}function Rwr(t,e,r=void 0,n){if(typeof t!="number")throw new Jd(e,"number",t);if(r!=null&&tn||(r!=null||n!=null)&&pwr(t))throw new Z1(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var jwr=rg((t,e,r)=>{if(!Dyt(r,t)){let o="must be one of: "+Lyt(fwr(r,i=>typeof i=="string"?`'${i}'`:bwr(i)),", ");throw new Qk(e,t,o)}});function $yt(t,e){if(typeof t!="boolean")throw new Jd(e,"boolean",t)}function oxe(t,e,r){return t==null||!ywr(t,e)?r:t[e]}var Nwr=rg((t,e,r=null)=>{let n=oxe(r,"allowArray",!1),o=oxe(r,"allowFunction",!1);if(!oxe(r,"nullable",!1)&&t===null||!n&&ixe(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new Jd(e,"Object",t)}),Dwr=rg((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Jd(e,"a dictionary",t)}),YQ=rg((t,e,r=0)=>{if(!ixe(t))throw new Jd(e,"Array",t);if(t.length{if(!Cwr(t))throw new Jd(e,["Buffer","TypedArray","DataView"],t)});function qwr(t,e){let r=Swr(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Qk("encoding",e,`is invalid for data of length ${n}`)}function Uwr(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&vwr(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new wwr(e,t,r);return t|0}var Byt=rg((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Jd(e,"AbortSignal",t)}),zwr=rg((t,e)=>{if(typeof t!="function")throw new Jd(e,"Function",t)}),Hwr=rg((t,e)=>{if(typeof t!="function"||xwr(t))throw new Jd(e,"Function",t)}),Vwr=rg((t,e)=>{if(t!==void 0)throw new Jd(e,"undefined",t)});function Wwr(t,e,r){if(!Dyt(r,t))throw new Jd(e,`('${Lyt(r,"|")}')`,t)}var Kwr=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Nyt(t,e){if(typeof t>"u"||!Fyt(Kwr,t))throw new Qk(e,t,'must be an array or string of format "; rel=preload; as=style"')}function Gwr(t){if(typeof t=="string")return Nyt(t,"hints"),t;if(ixe(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n; rel=preload; as=style"')}qyt.exports={isInt32:Owr,isUint32:Pwr,parseFileMode:Awr,validateArray:YQ,validateStringArray:Lwr,validateBooleanArray:Fwr,validateAbortSignalArray:kwr,validateBoolean:$yt,validateBuffer:Bwr,validateDictionary:Dwr,validateEncoding:qwr,validateFunction:zwr,validateInt32:Mwr,validateInteger:Iwr,validateNumber:Rwr,validateObject:Nwr,validateOneOf:jwr,validatePlainFunction:Hwr,validatePort:Uwr,validateSignalName:$wr,validateString:sxe,validateUint32:kyt,validateUndefined:Vwr,validateUnion:Wwr,validateAbortSignal:Byt,validateLinkHeaderValue:Gwr}});var rA=v((nvo,Vyt)=>{var Rs=Vyt.exports={},B_,q_;function uxe(){throw new Error("setTimeout has not been defined")}function lxe(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?B_=setTimeout:B_=uxe}catch{B_=uxe}try{typeof clearTimeout=="function"?q_=clearTimeout:q_=lxe}catch{q_=lxe}})();function Uyt(t){if(B_===setTimeout)return setTimeout(t,0);if((B_===uxe||!B_)&&setTimeout)return B_=setTimeout,setTimeout(t,0);try{return B_(t,0)}catch{try{return B_.call(null,t,0)}catch{return B_.call(this,t,0)}}}function Jwr(t){if(q_===clearTimeout)return clearTimeout(t);if((q_===lxe||!q_)&&clearTimeout)return q_=clearTimeout,clearTimeout(t);try{return q_(t)}catch{try{return q_.call(null,t)}catch{return q_.call(this,t)}}}var vO=[],t$=!1,X1,ZQ=-1;function Ywr(){!t$||!X1||(t$=!1,X1.length?vO=X1.concat(vO):ZQ=-1,vO.length&&zyt())}function zyt(){if(!t$){var t=Uyt(Ywr);t$=!0;for(var e=vO.length;e;){for(X1=vO,vO=[];++ZQ1)for(var r=1;r{"use strict";var{SymbolAsyncIterator:Wyt,SymbolIterator:Kyt,SymbolFor:Q1}=Va(),Gyt=Q1("nodejs.stream.destroyed"),Jyt=Q1("nodejs.stream.errored"),cxe=Q1("nodejs.stream.readable"),dxe=Q1("nodejs.stream.writable"),Yyt=Q1("nodejs.stream.disturbed"),Zwr=Q1("nodejs.webstream.isClosedPromise"),Xwr=Q1("nodejs.webstream.controllerErrorFunction");function XQ(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 QQ(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 Qwr(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function U_(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Zyt(t){return!!(t&&!U_(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Xyt(t){return!!(t&&!U_(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Qyt(t){return!!(t&&!U_(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function e0r(t){return Zyt(t)||Xyt(t)||Qyt(t)}function t0r(t,e){return t==null?!1:e===!0?typeof t[Wyt]=="function":e===!1?typeof t[Kyt]=="function":typeof t[Wyt]=="function"||typeof t[Kyt]=="function"}function eee(t){if(!U_(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Gyt]||n!=null&&n.destroyed)}function ebt(t){if(!QQ(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 r0r(t,e){if(!QQ(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 n0r(t){if(!XQ(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 tbt(t,e){if(!XQ(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 rbt(t){return t&&t[cxe]!=null?t[cxe]:typeof t?.readable!="boolean"?null:eee(t)?!1:XQ(t)&&t.readable&&!tbt(t)}function nbt(t){return t&&t[dxe]!=null?t[dxe]:typeof t?.writable!="boolean"?null:eee(t)?!1:QQ(t)&&t.writable&&!ebt(t)}function o0r(t,e){return U_(t)?eee(t)?!0:!(e?.readable!==!1&&rbt(t)||e?.writable!==!1&&nbt(t)):null}function i0r(t){var e,r;return U_(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 a0r(t){var e,r;return U_(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 s0r(t){if(!U_(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"&&obt(t)?t._closed:null}function obt(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function ibt(t){return typeof t._sent100=="boolean"&&obt(t)}function u0r(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 l0r(t){if(!U_(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&ibt(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function c0r(t){var e;return!!(t&&((e=t[Yyt])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function d0r(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[Jyt])!==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))}abt.exports={isDestroyed:eee,kIsDestroyed:Gyt,isDisturbed:c0r,kIsDisturbed:Yyt,isErrored:d0r,kIsErrored:Jyt,isReadable:rbt,kIsReadable:cxe,kIsClosedPromise:Zwr,kControllerErrorFunction:Xwr,kIsWritable:dxe,isClosed:s0r,isDuplexNodeStream:Qwr,isFinished:o0r,isIterable:t0r,isReadableNodeStream:XQ,isReadableStream:Zyt,isReadableEnded:n0r,isReadableFinished:tbt,isReadableErrored:a0r,isNodeStream:U_,isWebStream:e0r,isWritable:nbt,isWritableNodeStream:QQ,isWritableStream:Xyt,isWritableEnded:ebt,isWritableFinished:r0r,isWritableErrored:i0r,isServerRequest:u0r,isServerResponse:ibt,willEmitClose:l0r,isTransformStream:Qyt}});var SO=v((ivo,gxe)=>{var nA=rA(),{AbortError:hbt,codes:f0r}=Kf(),{ERR_INVALID_ARG_TYPE:p0r,ERR_STREAM_PREMATURE_CLOSE:sbt}=f0r,{kEmptyObject:pxe,once:mxe}=Gd(),{validateAbortSignal:m0r,validateFunction:h0r,validateObject:g0r,validateBoolean:y0r}=e$(),{Promise:b0r,PromisePrototypeThen:_0r,SymbolDispose:gbt}=Va(),{isClosed:v0r,isReadable:ubt,isReadableNodeStream:fxe,isReadableStream:w0r,isReadableFinished:lbt,isReadableErrored:cbt,isWritable:dbt,isWritableNodeStream:fbt,isWritableStream:S0r,isWritableFinished:pbt,isWritableErrored:mbt,isNodeStream:x0r,willEmitClose:C0r,kIsClosedPromise:O0r}=z_(),r$;function P0r(t){return t.setHeader&&typeof t.abort=="function"}var hxe=()=>{};function ybt(t,e,r){var n,o;if(arguments.length===2?(r=e,e=pxe):e==null?e=pxe:g0r(e,"options"),h0r(r,"callback"),m0r(e.signal,"options.signal"),r=mxe(r),w0r(t)||S0r(t))return E0r(t,e,r);if(!x0r(t))throw new p0r("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:fxe(t),a=(o=e.writable)!==null&&o!==void 0?o:fbt(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=C0r(t)&&fxe(t)===i&&fbt(t)===a,d=pbt(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=lbt(t,!1),m=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},h=O=>{r.call(t,O)},b=v0r(t),g=()=>{b=!0;let O=mbt(t)||cbt(t);if(O&&typeof O!="boolean")return r.call(t,O);if(i&&!p&&fxe(t,!0)&&!lbt(t,!1))return r.call(t,new sbt);if(a&&!d&&!pbt(t,!1))return r.call(t,new sbt);r.call(t)},y=()=>{b=!0;let O=mbt(t)||cbt(t);if(O&&typeof O!="boolean")return r.call(t,O);r.call(t)},S=()=>{t.req.on("finish",f)};P0r(t)?(t.on("complete",f),c||t.on("abort",g),t.req?S():t.on("request",S)):a&&!s&&(t.on("end",l),t.on("close",l)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",m),t.on("finish",f),e.error!==!1&&t.on("error",h),t.on("close",g),b?nA.nextTick(g):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||nA.nextTick(y):(!i&&(!c||ubt(t))&&(d||dbt(t)===!1)||!a&&(!c||dbt(t))&&(p||ubt(t)===!1)||u&&t.req&&t.aborted)&&nA.nextTick(y);let x=()=>{r=hxe,t.removeListener("aborted",g),t.removeListener("complete",f),t.removeListener("abort",g),t.removeListener("request",S),t.req&&t.req.removeListener("finish",f),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",f),t.removeListener("end",m),t.removeListener("error",h),t.removeListener("close",g)};if(e.signal&&!b){let O=()=>{let P=r;x(),P.call(t,new hbt(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)nA.nextTick(O);else{r$=r$||Gd().addAbortListener;let P=r$(e.signal,O),E=r;r=mxe((...A)=>{P[gbt](),E.apply(t,A)})}}return x}function E0r(t,e,r){let n=!1,o=hxe;if(e.signal)if(o=()=>{n=!0,r.call(t,new hbt(void 0,{cause:e.signal.reason}))},e.signal.aborted)nA.nextTick(o);else{r$=r$||Gd().addAbortListener;let a=r$(e.signal,o),s=r;r=mxe((...u)=>{a[gbt](),s.apply(t,u)})}let i=(...a)=>{n||nA.nextTick(()=>r.apply(t,a))};return _0r(t[O0r].promise,i,i),hxe}function T0r(t,e){var r;let n=!1;return e===null&&(e=pxe),(r=e)!==null&&r!==void 0&&r.cleanup&&(y0r(e.cleanup,"cleanup"),n=e.cleanup),new b0r((o,i)=>{let a=ybt(t,e,s=>{n&&a(),s?i(s):o()})})}gxe.exports=ybt;gxe.exports.finished=T0r});var ej=v((avo,Obt)=>{"use strict";var H_=rA(),{aggregateTwoErrors:A0r,codes:{ERR_MULTIPLE_CALLBACK:I0r},AbortError:M0r}=Kf(),{Symbol:vbt}=Va(),{kIsDestroyed:R0r,isDestroyed:j0r,isFinished:N0r,isServerRequest:D0r}=z_(),wbt=vbt("kDestroy"),yxe=vbt("kConstruct");function Sbt(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function L0r(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):(Sbt(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?bbt(this,t,e):this.once(wbt,function(i){bbt(this,A0r(i,t),e)}),this)}function bbt(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;Sbt(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?H_.nextTick(F0r,t,i):H_.nextTick(xbt,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function F0r(t,e){bxe(t,e),xbt(t)}function xbt(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 bxe(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 k0r(){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 _xe(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?H_.nextTick(bxe,t,e):bxe(t,e))}function $0r(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(yxe,e),!(t.listenerCount(yxe)>1)&&H_.nextTick(B0r,t)}function B0r(t){let e=!1;function r(n){if(e){_xe(t,n??new I0r);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(wbt,n):n?_xe(t,n,!0):H_.nextTick(q0r,t)}try{t._construct(n=>{H_.nextTick(r,n)})}catch(n){H_.nextTick(r,n)}}function q0r(t){t.emit(yxe)}function _bt(t){return t?.setHeader&&typeof t.abort=="function"}function Cbt(t){t.emit("close")}function U0r(t,e){t.emit("error",e),H_.nextTick(Cbt,t)}function z0r(t,e){!t||j0r(t)||(!e&&!N0r(t)&&(e=new M0r),D0r(t)?(t.socket=null,t.destroy(e)):_bt(t)?t.abort():_bt(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?H_.nextTick(U0r,t,e):H_.nextTick(Cbt,t),t.destroyed||(t[R0r]=!0))}Obt.exports={construct:$0r,destroyer:z0r,destroy:L0r,undestroy:k0r,errorOrDestroy:_xe}});var nee=v((svo,Ebt)=>{"use strict";var{ArrayIsArray:H0r,ObjectSetPrototypeOf:Pbt}=Va(),{EventEmitter:tee}=FH();function ree(t){tee.call(this,t)}Pbt(ree.prototype,tee.prototype);Pbt(ree,tee);ree.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(),tee.listenerCount(this,"error")===0&&this.emit("error",c)}vxe(r,"error",u),vxe(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 vxe(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):H0r(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Ebt.exports={Stream:ree,prependListener:vxe}});var kH=v((uvo,oee)=>{"use strict";var{SymbolDispose:V0r}=Va(),{AbortError:Tbt,codes:W0r}=Kf(),{isNodeStream:Abt,isWebStream:K0r,kControllerErrorFunction:G0r}=z_(),J0r=SO(),{ERR_INVALID_ARG_TYPE:Ibt}=W0r,wxe,Y0r=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Ibt(e,"AbortSignal",t)};oee.exports.addAbortSignal=function(e,r){if(Y0r(e,"signal"),!Abt(r)&&!K0r(r))throw new Ibt("stream",["ReadableStream","WritableStream","Stream"],r);return oee.exports.addAbortSignalNoValidate(e,r)};oee.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Abt(e)?()=>{e.destroy(new Tbt(void 0,{cause:t.reason}))}:()=>{e[G0r](new Tbt(void 0,{cause:t.reason}))};if(t.aborted)r();else{wxe=wxe||Gd().addAbortListener;let n=wxe(t,r);J0r(e,n[V0r])}return e}});var jbt=v((cvo,Rbt)=>{"use strict";var{StringPrototypeSlice:Mbt,SymbolIterator:Z0r,TypedArrayPrototypeSet:iee,Uint8Array:X0r}=Va(),{Buffer:Sxe}=Pp(),{inspect:Q0r}=Gd();Rbt.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 Sxe.alloc(0);let r=Sxe.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)iee(r,n.data,o),o+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(ei.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+=Mbt(i,0,e),this.head=n,n.data=Mbt(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=Sxe.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)iee(r,a,n-e),e-=a.length;else{e===a.length?(iee(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(iee(r,new X0r(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 Q0r(this,{...r,depth:0,customInspect:!1})}}});var $H=v((dvo,Fbt)=>{"use strict";var{MathFloor:eSr,NumberIsInteger:tSr}=Va(),{validateInteger:rSr}=e$(),{ERR_INVALID_ARG_VALUE:nSr}=Kf().codes,Nbt=16*1024,Dbt=16;function oSr(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Lbt(t){return t?Dbt:Nbt}function iSr(t,e){rSr(e,"value",0),t?Dbt=e:Nbt=e}function aSr(t,e,r,n){let o=oSr(e,n,r);if(o!=null){if(!tSr(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new nSr(i,o)}return eSr(o)}return Lbt(t.objectMode)}Fbt.exports={getHighWaterMark:aSr,getDefaultHighWaterMark:Lbt,setDefaultHighWaterMark:iSr}});var Bbt=v((xxe,$bt)=>{var aee=Pp(),V_=aee.Buffer;function kbt(t,e){for(var r in t)e[r]=t[r]}V_.from&&V_.alloc&&V_.allocUnsafe&&V_.allocUnsafeSlow?$bt.exports=aee:(kbt(aee,xxe),xxe.Buffer=tj);function tj(t,e,r){return V_(t,e,r)}tj.prototype=Object.create(V_.prototype);kbt(V_,tj);tj.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return V_(t,e,r)};tj.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=V_(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};tj.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return V_(t)};tj.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return aee.SlowBuffer(t)}});var zbt=v(Ubt=>{"use strict";var Oxe=Bbt().Buffer,qbt=Oxe.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 sSr(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 uSr(t){var e=sSr(t);if(typeof e!="string"&&(Oxe.isEncoding===qbt||!qbt(t)))throw new Error("Unknown encoding: "+t);return e||t}Ubt.StringDecoder=BH;function BH(t){this.encoding=uSr(t);var e;switch(this.encoding){case"utf16le":this.text=mSr,this.end=hSr,e=4;break;case"utf8":this.fillLast=dSr,e=4;break;case"base64":this.text=gSr,this.end=ySr,e=3;break;default:this.write=bSr,this.end=_Sr;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Oxe.allocUnsafe(e)}BH.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>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function lSr(t,e,r){var n=e.length-1;if(n=0?(o>0&&(t.lastNeed=o-1),o):--n=0?(o>0&&(t.lastNeed=o-2),o):--n=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function cSr(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 dSr(t){var e=this.lastTotal-this.lastNeed,r=cSr(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 fSr(t,e){var r=lSr(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 pSr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function mSr(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 hSr(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 gSr(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 ySr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function bSr(t){return t.toString(this.encoding)}function _Sr(t){return t&&t.length?this.write(t):""}});var Pxe=v((pvo,Kbt)=>{"use strict";var Hbt=rA(),{PromisePrototypeThen:vSr,SymbolAsyncIterator:Vbt,SymbolIterator:Wbt}=Va(),{Buffer:wSr}=Pp(),{ERR_INVALID_ARG_TYPE:SSr,ERR_STREAM_NULL_VALUES:xSr}=Kf().codes;function CSr(t,e,r){let n;if(typeof e=="string"||e instanceof wSr)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[Vbt])o=!0,n=e[Vbt]();else if(e&&e[Wbt])o=!1,n=e[Wbt]();else throw new SSr("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){vSr(s(l),()=>Hbt.nextTick(c,l),d=>Hbt.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 xSr;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}Kbt.exports=CSr});var UH=v((mvo,d_t)=>{var Ly=rA(),{ArrayPrototypeIndexOf:OSr,NumberIsInteger:PSr,NumberIsNaN:ESr,NumberParseInt:TSr,ObjectDefineProperties:Nxe,ObjectKeys:ASr,ObjectSetPrototypeOf:Ybt,Promise:Zbt,SafeSet:ISr,SymbolAsyncDispose:MSr,SymbolAsyncIterator:RSr,Symbol:jSr}=Va();d_t.exports=cn;cn.ReadableState=cee;var{EventEmitter:NSr}=FH(),{Stream:oA,prependListener:DSr}=nee(),{Buffer:Exe}=Pp(),{addAbortSignal:LSr}=kH(),Xbt=SO(),jn=Gd().debuglog("stream",t=>{jn=t}),FSr=jbt(),i$=ej(),{getHighWaterMark:kSr,getDefaultHighWaterMark:$Sr}=$H(),{aggregateTwoErrors:Gbt,codes:{ERR_INVALID_ARG_TYPE:BSr,ERR_METHOD_NOT_IMPLEMENTED:qSr,ERR_OUT_OF_RANGE:USr,ERR_STREAM_PUSH_AFTER_EOF:zSr,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:HSr},AbortError:VSr}=Kf(),{validateObject:WSr}=e$(),rj=jSr("kPaused"),{StringDecoder:Qbt}=zbt(),KSr=Pxe();Ybt(cn.prototype,oA.prototype);Ybt(cn,oA);var Txe=()=>{},{errorOrDestroy:n$}=i$,o$=1,GSr=2,e_t=4,qH=8,t_t=16,see=32,uee=64,r_t=128,JSr=256,YSr=512,ZSr=1024,Rxe=2048,jxe=4096,XSr=8192,QSr=16384,exr=32768,n_t=65536,txr=1<<17,rxr=1<<18;function Al(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Nxe(cee.prototype,{objectMode:Al(o$),ended:Al(GSr),endEmitted:Al(e_t),reading:Al(qH),constructed:Al(t_t),sync:Al(see),needReadable:Al(uee),emittedReadable:Al(r_t),readableListening:Al(JSr),resumeScheduled:Al(YSr),errorEmitted:Al(ZSr),emitClose:Al(Rxe),autoDestroy:Al(jxe),destroyed:Al(XSr),closed:Al(QSr),closeEmitted:Al(exr),multiAwaitDrain:Al(n_t),readingMore:Al(txr),dataEmitted:Al(rxr)});function cee(t,e,r){typeof r!="boolean"&&(r=e instanceof W_()),this.state=Rxe|jxe|t_t|see,t&&t.objectMode&&(this.state|=o$),r&&t&&t.readableObjectMode&&(this.state|=o$),this.highWaterMark=t?kSr(this,t,"readableHighWaterMark",r):$Sr(!1),this.buffer=new FSr,this.length=0,this.pipes=[],this.flowing=null,this[rj]=null,t&&t.emitClose===!1&&(this.state&=~Rxe),t&&t.autoDestroy===!1&&(this.state&=~jxe),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Qbt(t.encoding),this.encoding=t.encoding)}function cn(t){if(!(this instanceof cn))return new cn(t);let e=this instanceof W_();this._readableState=new cee(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&&LSr(t.signal,this)),oA.call(this,t),i$.construct(this,()=>{this._readableState.needReadable&&lee(this,this._readableState)})}cn.prototype.destroy=i$.destroy;cn.prototype._undestroy=i$.undestroy;cn.prototype._destroy=function(t,e){e(t)};cn.prototype[NSr.captureRejectionSymbol]=function(t){this.destroy(t)};cn.prototype[MSr]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new VSr,this.destroy(t)),new Zbt((e,r)=>Xbt(this,n=>n&&n!==t?r(n):e(null)))};cn.prototype.push=function(t,e){return o_t(this,t,e,!1)};cn.prototype.unshift=function(t,e){return o_t(this,t,e,!0)};function o_t(t,e,r,n){jn("readableAddChunk",e);let o=t._readableState,i;if((o.state&o$)===0&&(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=Exe.from(e,r).toString(o.encoding):(e=Exe.from(e,r),r=""))):e instanceof Exe?r="":oA._isUint8Array(e)?(e=oA._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new BSr("chunk",["string","Buffer","Uint8Array"],e))),i)n$(t,i);else if(e===null)o.state&=~qH,ixr(t,o);else if((o.state&o$)!==0||e&&e.length>0)if(n)if((o.state&e_t)!==0)n$(t,new HSr);else{if(o.destroyed||o.errored)return!1;Axe(t,o,e,!0)}else if(o.ended)n$(t,new zSr);else{if(o.destroyed||o.errored)return!1;o.state&=~qH,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?Axe(t,o,e,!1):lee(t,o)):Axe(t,o,e,!1)}else n||(o.state&=~qH,lee(t,o));return!o.ended&&(o.length0?((e.state&n_t)!==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&uee)!==0&&dee(t)),lee(t,e)}cn.prototype.isPaused=function(){let t=this._readableState;return t[rj]===!0||t.flowing===!1};cn.prototype.setEncoding=function(t){let e=new Qbt(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 nxr=1073741824;function oxr(t){if(t>nxr)throw new USr("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Jbt(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&o$)!==0?1:ESr(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}cn.prototype.read=function(t){jn("read",t),t===void 0?t=NaN:PSr(t)||(t=TSr(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=oxr(t)),t!==0&&(e.state&=~r_t),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return jn("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Ixe(this):dee(this),null;if(t=Jbt(t,e),t===0&&e.ended)return e.length===0&&Ixe(this),null;let n=(e.state&uee)!==0;if(jn("need readable",n),(e.length===0||e.length-t0?o=l_t(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&&Ixe(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function ixr(t,e){if(jn("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?dee(t):(e.needReadable=!1,e.emittedReadable=!0,i_t(t))}}function dee(t){let e=t._readableState;jn("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(jn("emitReadable",e.flowing),e.emittedReadable=!0,Ly.nextTick(i_t,t))}function i_t(t){let e=t._readableState;jn("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,s_t(t)}function lee(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Ly.nextTick(axr,t,e))}function axr(t,e){for(;!e.reading&&!e.ended&&(e.length1&&n.pipes.includes(t)&&(jn("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=sxr(r,t),t.on("drain",u))}r.on("data",f);function f(g){jn("ondata");let y=t.write(g);jn("dest.write",y),y===!1&&d()}function p(g){if(jn("onerror",g),b(),t.removeListener("error",p),t.listenerCount("error")===0){let y=t._writableState||t._readableState;y&&!y.errorEmitted?n$(t,g):t.emit("error",g)}}DSr(t,"error",p);function m(){t.removeListener("finish",h),b()}t.once("close",m);function h(){jn("onfinish"),t.removeListener("close",m),b()}t.once("finish",h);function b(){jn("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(jn("pipe resume"),r.resume()),t};function sxr(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(jn("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(jn("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}cn.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;i0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,jn("on readable",n.length,n.reading),n.length?dee(this):n.reading||Ly.nextTick(uxr,this)),r};cn.prototype.addListener=cn.prototype.on;cn.prototype.removeListener=function(t,e){let r=oA.prototype.removeListener.call(this,t,e);return t==="readable"&&Ly.nextTick(a_t,this),r};cn.prototype.off=cn.prototype.removeListener;cn.prototype.removeAllListeners=function(t){let e=oA.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Ly.nextTick(a_t,this),e};function a_t(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[rj]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function uxr(t){jn("readable nexttick read 0"),t.read(0)}cn.prototype.resume=function(){let t=this._readableState;return t.flowing||(jn("resume"),t.flowing=!t.readableListening,lxr(this,t)),t[rj]=!1,this};function lxr(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Ly.nextTick(cxr,t,e))}function cxr(t,e){jn("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),s_t(t),e.flowing&&!e.reading&&t.read(0)}cn.prototype.pause=function(){return jn("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(jn("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[rj]=!0,this};function s_t(t){let e=t._readableState;for(jn("flow",e.flowing);e.flowing&&t.read()!==null;);}cn.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=>{n$(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=ASr(t);for(let n=1;n{o=a?Gbt(o,a):null,r(),r=Txe});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 Zbt(n)}}}catch(a){throw o=Gbt(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?i$.destroyer(t,null):(t.off("readable",n),i())}}Nxe(cn.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}}});Nxe(cee.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[rj]!==!1},set(t){this[rj]=!!t}}});cn._fromList=l_t;function l_t(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 Ixe(t){let e=t._readableState;jn("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Ly.nextTick(fxr,e,t))}function fxr(t,e){if(jn("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)Ly.nextTick(pxr,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function pxr(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}cn.from=function(t,e){return KSr(cn,t,e)};var Mxe;function c_t(){return Mxe===void 0&&(Mxe={}),Mxe}cn.fromWeb=function(t,e){return c_t().newStreamReadableFromReadableStream(t,e)};cn.toWeb=function(t,e){return c_t().newReadableStreamFromStreamReadable(t,e)};cn.wrap=function(t,e){var r,n;return new cn({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){i$.destroyer(t,o),i(o)}}).wrap(t)}});var gee=v((hvo,x_t)=>{var nj=rA(),{ArrayPrototypeSlice:m_t,Error:mxr,FunctionPrototypeSymbolHasInstance:h_t,ObjectDefineProperty:g_t,ObjectDefineProperties:hxr,ObjectSetPrototypeOf:y_t,StringPrototypeToLowerCase:gxr,Symbol:yxr,SymbolHasInstance:bxr}=Va();x_t.exports=Wa;Wa.WritableState=VH;var{EventEmitter:_xr}=FH(),zH=nee().Stream,{Buffer:fee}=Pp(),hee=ej(),{addAbortSignal:vxr}=kH(),{getHighWaterMark:wxr,getDefaultHighWaterMark:Sxr}=$H(),{ERR_INVALID_ARG_TYPE:xxr,ERR_METHOD_NOT_IMPLEMENTED:Cxr,ERR_MULTIPLE_CALLBACK:b_t,ERR_STREAM_CANNOT_PIPE:Oxr,ERR_STREAM_DESTROYED:HH,ERR_STREAM_ALREADY_FINISHED:Pxr,ERR_STREAM_NULL_VALUES:Exr,ERR_STREAM_WRITE_AFTER_END:Txr,ERR_UNKNOWN_ENCODING:__t}=Kf().codes,{errorOrDestroy:a$}=hee;y_t(Wa.prototype,zH.prototype);y_t(Wa,zH);function Fxe(){}var s$=yxr("kOnFinished");function VH(t,e,r){typeof r!="boolean"&&(r=e instanceof W_()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?wxr(this,t,"writableHighWaterMark",r):Sxr(!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=Ixr.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,mee(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[s$]=[]}function mee(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}VH.prototype.getBuffer=function(){return m_t(this.buffered,this.bufferedIndex)};g_t(VH.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Wa(t){let e=this instanceof W_();if(!e&&!h_t(Wa,this))return new Wa(t);this._writableState=new VH(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&&vxr(t.signal,this)),zH.call(this,t),hee.construct(this,()=>{let r=this._writableState;r.writing||$xe(this,r),Bxe(this,r)})}g_t(Wa,bxr,{__proto__:null,value:function(t){return h_t(this,t)?!0:this!==Wa?!1:t&&t._writableState instanceof VH}});Wa.prototype.pipe=function(){a$(this,new Oxr)};function v_t(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"&&!fee.isEncoding(r))throw new __t(r);typeof n!="function"&&(n=Fxe)}if(e===null)throw new Exr;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=fee.from(e,r),r="buffer");else if(e instanceof fee)r="buffer";else if(zH._isUint8Array(e))e=zH._uint8ArrayToBuffer(e),r="buffer";else throw new xxr("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new Txr:o.destroyed&&(i=new HH("write")),i?(nj.nextTick(n,i),a$(t,i,!0),i):(o.pendingcb++,Axr(t,o,e,r,n))}Wa.prototype.write=function(t,e,r){return v_t(this,t,e,r)===!0};Wa.prototype.cork=function(){this._writableState.corked++};Wa.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||$xe(this,t))};Wa.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=gxr(e)),!fee.isEncoding(e))throw new __t(e);return this._writableState.defaultEncoding=e,this};function Axr(t,e,r,n,o){let i=e.objectMode?1:r.length;e.length+=i;let a=e.lengthr.bufferedIndex&&$xe(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},nj.nextTick(Mxr,r.afterWriteTickInfo)):w_t(t,r,1,o))}function Mxr({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,w_t(t,e,r,n)}function w_t(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&&kxe(e),Bxe(t,e)}function kxe(t){if(t.writing)return;for(let o=t.bufferedIndex;o1&&t._writev){e.pendingcb-=i-1;let s=e.allNoop?Fxe:l=>{for(let c=a;c256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}Wa.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new Cxr("_write()")};Wa.prototype._writev=null;Wa.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=v_t(this,t,e);i instanceof mxr&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,Bxe(this,n,!0),n.ended=!0):n.finished?o=new Pxr("end"):n.destroyed&&(o=new HH("end"))),typeof r=="function"&&(o||n.finished?nj.nextTick(r,o):n[s$].push(r)),this};function pee(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 Rxr(t,e){let r=!1;function n(o){if(r){a$(t,o??b_t());return}if(r=!0,e.pendingcb--,o){let i=e[s$].splice(0);for(let a=0;a{pee(o)?Lxe(n,o):o.pendingcb--},t,e)):pee(e)&&(e.pendingcb++,Lxe(t,e))))}function Lxe(t,e){e.pendingcb--,e.finished=!0;let r=e[s$].splice(0);for(let n=0;n{var qxe=rA(),Dxr=Pp(),{isReadable:Lxr,isWritable:Fxr,isIterable:C_t,isNodeStream:kxr,isReadableNodeStream:O_t,isWritableNodeStream:P_t,isDuplexNodeStream:$xr,isReadableStream:E_t,isWritableStream:T_t}=z_(),A_t=SO(),{AbortError:D_t,codes:{ERR_INVALID_ARG_TYPE:Bxr,ERR_INVALID_RETURN_VALUE:I_t}}=Kf(),{destroyer:l$}=ej(),qxr=W_(),L_t=UH(),Uxr=gee(),{createDeferredPromise:M_t}=Gd(),R_t=Pxe(),j_t=globalThis.Blob||Dxr.Blob,zxr=typeof j_t<"u"?function(e){return e instanceof j_t}:function(e){return!1},Hxr=globalThis.AbortController||Zk().AbortController,{FunctionPrototypeCall:N_t}=Va(),iA=class extends qxr{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)}};F_t.exports=function t(e,r){if($xr(e))return e;if(O_t(e))return u$({readable:e});if(P_t(e))return u$({writable:e});if(kxr(e))return u$({writable:!1,readable:!1});if(E_t(e))return u$({readable:L_t.fromWeb(e)});if(T_t(e))return u$({writable:Uxr.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=Vxr(e);if(C_t(o))return R_t(iA,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=N_t(u,o,d=>{if(d!=null)throw new I_t("nully","body",d)},d=>{l$(l,d)});return l=new iA({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,qxe.nextTick(d,null)}catch(f){qxe.nextTick(d,f)}})},destroy:s})}throw new I_t("Iterable, AsyncIterable or AsyncFunction",r,o)}if(zxr(e))return t(e.arrayBuffer());if(C_t(e))return R_t(iA,e,{objectMode:!0,writable:!1});if(E_t(e?.readable)&&T_t(e?.writable))return iA.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?O_t(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?P_t(e?.writable)?e?.writable:t(e.writable):void 0;return u$({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return N_t(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{l$(o,i)}),o=new iA({objectMode:!0,writable:!1,read(){}})}throw new Bxr(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function Vxr(t){let{promise:e,resolve:r}=M_t(),n=new Hxr,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(qxe.nextTick(l),u)return;if(o.aborted)throw new D_t(void 0,{cause:o.reason});({promise:e,resolve:r}=M_t()),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 u$(t){let e=t.readable&&typeof t.readable.read!="function"?L_t.wrap(t.readable):t.readable,r=t.writable,n=!!Lxr(e),o=!!Fxr(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new iA({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(A_t(r,d=>{o=!1,d&&l$(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&&(A_t(e,d=>{n=!1,d&&l$(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 D_t),s=null,i=null,a=null,u===null?f(d):(u=f,l$(r,d),l$(e,d))},l}});var W_=v((yvo,q_t)=>{"use strict";var{ObjectDefineProperties:Wxr,ObjectGetOwnPropertyDescriptor:xO,ObjectKeys:Kxr,ObjectSetPrototypeOf:$_t}=Va();q_t.exports=Fy;var Hxe=UH(),ng=gee();$_t(Fy.prototype,Hxe.prototype);$_t(Fy,Hxe);{let t=Kxr(ng.prototype);for(let e=0;e{"use strict";var{ObjectSetPrototypeOf:U_t,Symbol:Gxr}=Va();z_t.exports=CO;var{ERR_METHOD_NOT_IMPLEMENTED:Jxr}=Kf().codes,Wxe=W_(),{getHighWaterMark:Yxr}=$H();U_t(CO.prototype,Wxe.prototype);U_t(CO,Wxe);var WH=Gxr("kCallback");function CO(t){if(!(this instanceof CO))return new CO(t);let e=t?Yxr(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Wxe.call(this,t),this._readableState.sync=!1,this[WH]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Zxr)}function Vxe(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 Zxr(){this._final!==Vxe&&Vxe.call(this)}CO.prototype._final=Vxe;CO.prototype._transform=function(t,e,r){throw new Jxr("_transform()")};CO.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{"use strict";var{ObjectSetPrototypeOf:H_t}=Va();V_t.exports=c$;var Gxe=Kxe();H_t(c$.prototype,Gxe.prototype);H_t(c$,Gxe);function c$(t){if(!(this instanceof c$))return new c$(t);Gxe.call(this,t)}c$.prototype._transform=function(t,e,r){r(null,t)}});var vee=v((vvo,Y_t)=>{var KH=rA(),{ArrayIsArray:Xxr,Promise:Qxr,SymbolAsyncIterator:eCr,SymbolDispose:tCr}=Va(),_ee=SO(),{once:rCr}=Gd(),nCr=ej(),W_t=W_(),{aggregateTwoErrors:oCr,codes:{ERR_INVALID_ARG_TYPE:oCe,ERR_INVALID_RETURN_VALUE:Yxe,ERR_MISSING_ARGS:iCr,ERR_STREAM_DESTROYED:aCr,ERR_STREAM_PREMATURE_CLOSE:sCr},AbortError:uCr}=Kf(),{validateFunction:lCr,validateAbortSignal:cCr}=e$(),{isIterable:oj,isReadable:Zxe,isReadableNodeStream:bee,isNodeStream:K_t,isTransformStream:d$,isWebStream:dCr,isReadableStream:Xxe,isReadableFinished:fCr}=z_(),pCr=globalThis.AbortController||Zk().AbortController,Qxe,eCe,tCe;function G_t(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=_ee(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,nCr.destroyer(t,i||new aCr("pipe")))},cleanup:o}}function mCr(t){return lCr(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function rCe(t){if(oj(t))return t;if(bee(t))return hCr(t);throw new oCe("val",["Readable","Iterable","AsyncIterable"],t)}async function*hCr(t){eCe||(eCe=UH()),yield*eCe.prototype[eCr].call(t)}async function yee(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new Qxr((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=_ee(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?oCr(o,l):l)}finally{u(),e.off("drain",a)}}async function nCe(t,e,r,{end:n}){d$(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 gCr(...t){return J_t(t,rCr(mCr(t)))}function J_t(t,e,r){if(t.length===1&&Xxr(t[0])&&(t=t[0]),t.length<2)throw new iCr("streams");let n=new pCr,o=n.signal,i=r?.signal,a=[];cCr(i,"options.signal");function s(){m(new uCr)}tCe=tCe||Gd().addAbortListener;let u;i&&(u=tCe(i,s));let l,c,d=[],f=0;function p(S){m(S,--f===0)}function m(S,x){var O;if(S&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=S),!(!l&&!x)){for(;d.length;)d.shift()(l);(O=u)===null||O===void 0||O[tCr](),n.abort(),x&&(l||a.forEach(P=>P()),KH.nextTick(e,l,c))}}let h;for(let S=0;S0,E=O||r?.end!==!1,A=S===t.length-1;if(K_t(x)){let I=function(R){R&&R.name!=="AbortError"&&R.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(R)};var y=I;if(E){let{destroy:R,cleanup:N}=G_t(x,O,P);d.push(R),Zxe(x)&&A&&a.push(N)}x.on("error",I),Zxe(x)&&A&&a.push(()=>{x.removeListener("error",I)})}if(S===0)if(typeof x=="function"){if(h=x({signal:o}),!oj(h))throw new Yxe("Iterable, AsyncIterable or Stream","source",h)}else oj(x)||bee(x)||d$(x)?h=x:h=W_t.from(x);else if(typeof x=="function"){if(d$(h)){var b;h=rCe((b=h)===null||b===void 0?void 0:b.readable)}else h=rCe(h);if(h=x(h,{signal:o}),O){if(!oj(h,!0))throw new Yxe("AsyncIterable",`transform[${S-1}]`,h)}else{var g;Qxe||(Qxe=Jxe());let I=new Qxe({objectMode:!0}),R=(g=h)===null||g===void 0?void 0:g.then;if(typeof R=="function")f++,R.call(h,$=>{c=$,$!=null&&I.write($),E&&I.end(),KH.nextTick(p)},$=>{I.destroy($),KH.nextTick(p,$)});else if(oj(h,!0))f++,yee(h,I,p,{end:E});else if(Xxe(h)||d$(h)){let $=h.readable||h;f++,yee($,I,p,{end:E})}else throw new Yxe("AsyncIterable or Promise","destination",h);h=I;let{destroy:N,cleanup:j}=G_t(h,!1,!0);d.push(N),A&&a.push(j)}}else if(K_t(x)){if(bee(h)){f+=2;let I=yCr(h,x,p,{end:E});Zxe(x)&&A&&a.push(I)}else if(d$(h)||Xxe(h)){let I=h.readable||h;f++,yee(I,x,p,{end:E})}else if(oj(h))f++,yee(h,x,p,{end:E});else throw new oCe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=x}else if(dCr(x)){if(bee(h))f++,nCe(rCe(h),x,p,{end:E});else if(Xxe(h)||oj(h))f++,nCe(h,x,p,{end:E});else if(d$(h))f++,nCe(h.readable,x,p,{end:E});else throw new oCe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=x}else h=W_t.from(x)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&KH.nextTick(s),h}function yCr(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new sCr)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;fCr(t)?KH.nextTick(a):t.once("end",a)}else r();return _ee(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)}),_ee(e,{readable:!1,writable:!0},r)}Y_t.exports={pipelineImpl:J_t,pipeline:gCr}});var aCe=v((wvo,rvt)=>{"use strict";var{pipeline:bCr}=vee(),wee=W_(),{destroyer:_Cr}=ej(),{isNodeStream:See,isReadable:Z_t,isWritable:X_t,isWebStream:iCe,isTransformStream:ij,isWritableStream:Q_t,isReadableStream:evt}=z_(),{AbortError:vCr,codes:{ERR_INVALID_ARG_VALUE:tvt,ERR_MISSING_ARGS:wCr}}=Kf(),SCr=SO();rvt.exports=function(...e){if(e.length===0)throw new wCr("streams");if(e.length===1)return wee.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=wee.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=wee.from(e[p])}for(let p=0;p0&&!(X_t(e[p])||Q_t(e[p])||ij(e[p])))throw new tvt(`streams[${p}]`,r[p],"must be writable")}let n,o,i,a,s;function u(p){let m=a;a=null,m?m(p):p?s.destroy(p):!f&&!d&&s.destroy()}let l=e[0],c=bCr(e,u),d=!!(X_t(l)||Q_t(l)||ij(l)),f=!!(Z_t(c)||evt(c)||ij(c));if(s=new wee({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(See(l))s._write=function(m,h,b){l.write(m,h)?b():n=b},s._final=function(m){l.end(),o=m},l.on("drain",function(){if(n){let m=n;n=null,m()}});else if(iCe(l)){let h=(ij(l)?l.writable:l).getWriter();s._write=async function(b,g,y){try{await h.ready,h.write(b).catch(()=>{}),y()}catch(S){y(S)}},s._final=async function(b){try{await h.ready,h.close().catch(()=>{}),o=b}catch(g){b(g)}}}let p=ij(c)?c.readable:c;SCr(p,()=>{if(o){let m=o;o=null,m()}})}if(f){if(See(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(iCe(c)){let m=(ij(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:h,done:b}=await m.read();if(!s.push(h))return;if(b){s.push(null);return}}catch{return}}}}return s._destroy=function(p,m){!p&&a!==null&&(p=new vCr),i=null,n=null,o=null,a===null?m(p):(a=m,See(c)&&_Cr(c,p))},s}});var fvt=v((Svo,lCe)=>{"use strict";var xCr=globalThis.AbortController||Zk().AbortController,{codes:{ERR_INVALID_ARG_VALUE:CCr,ERR_INVALID_ARG_TYPE:GH,ERR_MISSING_ARGS:OCr,ERR_OUT_OF_RANGE:PCr},AbortError:K_}=Kf(),{validateAbortSignal:aj,validateInteger:nvt,validateObject:sj}=e$(),ECr=Va().Symbol("kWeak"),TCr=Va().Symbol("kResistStopPropagation"),{finished:ACr}=SO(),ICr=aCe(),{addAbortSignalNoValidate:MCr}=kH(),{isWritable:RCr,isNodeStream:jCr}=z_(),{deprecate:NCr}=Gd(),{ArrayPrototypePush:DCr,Boolean:LCr,MathFloor:ovt,Number:FCr,NumberIsNaN:kCr,Promise:ivt,PromiseReject:avt,PromiseResolve:$Cr,PromisePrototypeThen:svt,Symbol:lvt}=Va(),xee=lvt("kEmpty"),uvt=lvt("kEof");function BCr(t,e){if(e!=null&&sj(e,"options"),e?.signal!=null&&aj(e.signal,"options.signal"),jCr(t)&&!RCr(t))throw new CCr("stream",t,"must be writable");let r=ICr(this,t);return e!=null&&e.signal&&MCr(e.signal,r),r}function Cee(t,e){if(typeof t!="function")throw new GH("fn",["Function","AsyncFunction"],t);e!=null&&sj(e,"options"),e?.signal!=null&&aj(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=ovt(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=ovt(e.highWaterMark)),nvt(r,"options.concurrency",1),nvt(n,"options.highWaterMark",0),n+=r,async function*(){let i=Gd().AbortSignalAny([e?.signal].filter(LCr)),a=this,s=[],u={signal:i},l,c,d=!1,f=0;function p(){d=!0,m()}function m(){f-=1,h()}function h(){c&&!d&&f=n||f>=r)&&await new ivt(y=>{c=y})}s.push(uvt)}catch(g){let y=avt(g);svt(y,m,p),s.push(y)}finally{d=!0,l&&(l(),l=null)}}b();try{for(;;){for(;s.length>0;){let g=await s[0];if(g===uvt)return;if(i.aborted)throw new K_;g!==xee&&(yield g),s.shift(),h()}await new ivt(g=>{l=g})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function qCr(t=void 0){return t!=null&&sj(t,"options"),t?.signal!=null&&aj(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 K_({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function cvt(t,e=void 0){for await(let r of uCe.call(this,t,e))return!0;return!1}async function UCr(t,e=void 0){if(typeof t!="function")throw new GH("fn",["Function","AsyncFunction"],t);return!await cvt.call(this,async(...r)=>!await t(...r),e)}async function zCr(t,e){for await(let r of uCe.call(this,t,e))return r}async function HCr(t,e){if(typeof t!="function")throw new GH("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),xee}for await(let n of Cee.call(this,r,e));}function uCe(t,e){if(typeof t!="function")throw new GH("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:xee}return Cee.call(this,r,e)}var sCe=class extends OCr{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function VCr(t,e,r){var n;if(typeof t!="function")throw new GH("reducer",["Function","AsyncFunction"],t);r!=null&&sj(r,"options"),r?.signal!=null&&aj(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new K_(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await ACr(this.destroy(l)),l}let i=new xCr,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[ECr]:this,[TCr]:!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 K_;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new sCe}finally{i.abort()}return e}async function WCr(t){t!=null&&sj(t,"options"),t?.signal!=null&&aj(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 K_(void 0,{cause:t.signal.reason});DCr(e,n)}return e}function KCr(t,e){let r=Cee.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function dvt(t){if(t=FCr(t),kCr(t))return 0;if(t<0)throw new PCr("number",">= 0",t);return t}function GCr(t,e=void 0){return e!=null&&sj(e,"options"),e?.signal!=null&&aj(e.signal,"options.signal"),t=dvt(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new K_;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new K_;t--<=0&&(yield i)}}.call(this)}function JCr(t,e=void 0){return e!=null&&sj(e,"options"),e?.signal!=null&&aj(e.signal,"options.signal"),t=dvt(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new K_;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new K_;if(t-- >0&&(yield i),t<=0)return}}.call(this)}lCe.exports.streamReturningOperators={asIndexedPairs:NCr(qCr,"readable.asIndexedPairs will be removed in a future version."),drop:GCr,filter:uCe,flatMap:KCr,map:Cee,take:JCr,compose:BCr};lCe.exports.promiseReturningOperators={every:UCr,forEach:HCr,reduce:VCr,toArray:WCr,some:cvt,find:zCr}});var cCe=v((xvo,pvt)=>{"use strict";var{ArrayPrototypePop:YCr,Promise:ZCr}=Va(),{isIterable:XCr,isNodeStream:QCr,isWebStream:eOr}=z_(),{pipelineImpl:tOr}=vee(),{finished:rOr}=SO();dCe();function nOr(...t){return new ZCr((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!QCr(i)&&!XCr(i)&&!eOr(i)){let a=YCr(t);n=a.signal,o=a.end}tOr(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}pvt.exports={finished:rOr,pipeline:nOr}});var dCe=v((Cvo,Svt)=>{var{Buffer:oOr}=Pp(),{ObjectDefineProperty:OO,ObjectKeys:gvt,ReflectApply:yvt}=Va(),{promisify:{custom:bvt}}=Gd(),{streamReturningOperators:mvt,promiseReturningOperators:hvt}=fvt(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:_vt}}=Kf(),iOr=aCe(),{setDefaultHighWaterMark:aOr,getDefaultHighWaterMark:sOr}=$H(),{pipeline:vvt}=vee(),{destroyer:uOr}=ej(),wvt=SO(),fCe=cCe(),JH=z_(),la=Svt.exports=nee().Stream;la.isDestroyed=JH.isDestroyed;la.isDisturbed=JH.isDisturbed;la.isErrored=JH.isErrored;la.isReadable=JH.isReadable;la.isWritable=JH.isWritable;la.Readable=UH();for(let t of gvt(mvt)){let r=function(...n){if(new.target)throw _vt();return la.Readable.from(yvt(e,this,n))};pCe=r;let e=mvt[t];OO(r,"name",{__proto__:null,value:e.name}),OO(r,"length",{__proto__:null,value:e.length}),OO(la.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var pCe;for(let t of gvt(hvt)){let r=function(...o){if(new.target)throw _vt();return yvt(e,this,o)};pCe=r;let e=hvt[t];OO(r,"name",{__proto__:null,value:e.name}),OO(r,"length",{__proto__:null,value:e.length}),OO(la.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var pCe;la.Writable=gee();la.Duplex=W_();la.Transform=Kxe();la.PassThrough=Jxe();la.pipeline=vvt;var{addAbortSignal:lOr}=kH();la.addAbortSignal=lOr;la.finished=wvt;la.destroy=uOr;la.compose=iOr;la.setDefaultHighWaterMark=aOr;la.getDefaultHighWaterMark=sOr;OO(la,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return fCe}});OO(vvt,bvt,{__proto__:null,enumerable:!0,get(){return fCe.pipeline}});OO(wvt,bvt,{__proto__:null,enumerable:!0,get(){return fCe.finished}});la.Stream=la;la._isUint8Array=function(e){return e instanceof Uint8Array};la._uint8ArrayToBuffer=function(e){return oOr.from(e.buffer,e.byteOffset,e.byteLength)}});var YH=v((Ovo,js)=>{"use strict";var Il=dCe(),cOr=cCe(),dOr=Il.Readable.destroy;js.exports=Il.Readable;js.exports._uint8ArrayToBuffer=Il._uint8ArrayToBuffer;js.exports._isUint8Array=Il._isUint8Array;js.exports.isDisturbed=Il.isDisturbed;js.exports.isErrored=Il.isErrored;js.exports.isReadable=Il.isReadable;js.exports.Readable=Il.Readable;js.exports.Writable=Il.Writable;js.exports.Duplex=Il.Duplex;js.exports.Transform=Il.Transform;js.exports.PassThrough=Il.PassThrough;js.exports.addAbortSignal=Il.addAbortSignal;js.exports.finished=Il.finished;js.exports.destroy=Il.destroy;js.exports.destroy=dOr;js.exports.pipeline=Il.pipeline;js.exports.compose=Il.compose;Object.defineProperty(Il,"promises",{configurable:!0,enumerable:!0,get(){return cOr}});js.exports.Stream=Il.Stream;js.exports.default=js.exports});var uj=v((Pvo,xvt)=>{"use strict";xvt.exports=TypeError});var Cvt=v(()=>{});var eV=v((Avo,Hvt)=>{var xCe=typeof Map=="function"&&Map.prototype,mCe=Object.getOwnPropertyDescriptor&&xCe?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Pee=xCe&&mCe&&typeof mCe.get=="function"?mCe.get:null,Ovt=xCe&&Map.prototype.forEach,CCe=typeof Set=="function"&&Set.prototype,hCe=Object.getOwnPropertyDescriptor&&CCe?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Eee=CCe&&hCe&&typeof hCe.get=="function"?hCe.get:null,Pvt=CCe&&Set.prototype.forEach,fOr=typeof WeakMap=="function"&&WeakMap.prototype,XH=fOr?WeakMap.prototype.has:null,pOr=typeof WeakSet=="function"&&WeakSet.prototype,QH=pOr?WeakSet.prototype.has:null,mOr=typeof WeakRef=="function"&&WeakRef.prototype,Evt=mOr?WeakRef.prototype.deref:null,hOr=Boolean.prototype.valueOf,gOr=Object.prototype.toString,yOr=Function.prototype.toString,bOr=String.prototype.match,OCe=String.prototype.slice,aA=String.prototype.replace,_Or=String.prototype.toUpperCase,Tvt=String.prototype.toLowerCase,Fvt=RegExp.prototype.test,Avt=Array.prototype.concat,G_=Array.prototype.join,vOr=Array.prototype.slice,Ivt=Math.floor,bCe=typeof BigInt=="function"?BigInt.prototype.valueOf:null,gCe=Object.getOwnPropertySymbols,_Ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,f$=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Yd=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===f$||!0)?Symbol.toStringTag:null,kvt=Object.prototype.propertyIsEnumerable,Mvt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Rvt(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Fvt.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-Ivt(-t):Ivt(t);if(n!==t){var o=String(n),i=OCe.call(e,o.length+1);return aA.call(o,r,"$&_")+"."+aA.call(aA.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return aA.call(e,r,"$&_")}var vCe=Cvt(),jvt=vCe.custom,Nvt=qvt(jvt)?jvt:null,$vt={__proto__:null,double:'"',single:"'"},wOr={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Hvt.exports=function t(e,r,n,o){var i=r||{};if(PO(i,"quoteStyle")&&!PO($vt,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(PO(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=PO(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(PO(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(PO(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 zvt(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?Rvt(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?Rvt(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 wCe(e)?"[Array]":"[Object]";var d=$Or(i,n);if(typeof o>"u")o=[];else if(Uvt(o,e)>=0)return"[Circular]";function f($,k,z){if(k&&(o=vOr.call(o),o.push(k)),z){var V={depth:i.depth};return PO(i,"quoteStyle")&&(V.quoteStyle=i.quoteStyle),t($,V,n+1,o)}return t($,i,n+1,o)}if(typeof e=="function"&&!Dvt(e)){var p=IOr(e),m=Oee(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+G_.call(m,", ")+" }":"")}if(qvt(e)){var h=f$?aA.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):_Ce.call(e);return typeof e=="object"&&!f$?ZH(h):h}if(LOr(e)){for(var b="<"+Tvt.call(String(e.nodeName)),g=e.attributes||[],y=0;y",b}if(wCe(e)){if(e.length===0)return"[]";var S=Oee(e,f);return d&&!kOr(S)?"["+SCe(S,d)+"]":"[ "+G_.call(S,", ")+" ]"}if(COr(e)){var x=Oee(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!kvt.call(e,"cause")?"{ ["+String(e)+"] "+G_.call(Avt.call("[cause]: "+f(e.cause),x),", ")+" }":x.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+G_.call(x,", ")+" }"}if(typeof e=="object"&&a){if(Nvt&&typeof e[Nvt]=="function"&&vCe)return vCe(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(MOr(e)){var O=[];return Ovt&&Ovt.call(e,function($,k){O.push(f(k,e,!0)+" => "+f($,e))}),Lvt("Map",Pee.call(e),O,d)}if(NOr(e)){var P=[];return Pvt&&Pvt.call(e,function($){P.push(f($,e))}),Lvt("Set",Eee.call(e),P,d)}if(ROr(e))return yCe("WeakMap");if(DOr(e))return yCe("WeakSet");if(jOr(e))return yCe("WeakRef");if(POr(e))return ZH(f(Number(e)));if(TOr(e))return ZH(f(bCe.call(e)));if(EOr(e))return ZH(hOr.call(e));if(OOr(e))return ZH(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(!xOr(e)&&!Dvt(e)){var E=Oee(e,f),A=Mvt?Mvt(e)===Object.prototype:e instanceof Object||e.constructor===Object,I=e instanceof Object?"":"null prototype",R=!A&&Yd&&Object(e)===e&&Yd in e?OCe.call(sA(e),8,-1):I?"Object":"",N=A||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",j=N+(R||I?"["+G_.call(Avt.call([],R||[],I||[]),": ")+"] ":"");return E.length===0?j+"{}":d?j+"{"+SCe(E,d)+"}":j+"{ "+G_.call(E,", ")+" }"}return String(e)};function Bvt(t,e,r){var n=r.quoteStyle||e,o=$vt[n];return o+t+o}function SOr(t){return aA.call(String(t),/"/g,""")}function wCe(t){return sA(t)==="[object Array]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function xOr(t){return sA(t)==="[object Date]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function Dvt(t){return sA(t)==="[object RegExp]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function COr(t){return sA(t)==="[object Error]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function OOr(t){return sA(t)==="[object String]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function POr(t){return sA(t)==="[object Number]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function EOr(t){return sA(t)==="[object Boolean]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function qvt(t){if(f$)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!_Ce)return!1;try{return _Ce.call(t),!0}catch{}return!1}function TOr(t){if(!t||typeof t!="object"||!bCe)return!1;try{return bCe.call(t),!0}catch{}return!1}var AOr=Object.prototype.hasOwnProperty||function(t){return t in this};function PO(t,e){return AOr.call(t,e)}function sA(t){return gOr.call(t)}function IOr(t){if(t.name)return t.name;var e=bOr.call(yOr.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Uvt(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return zvt(OCe.call(t,0,e.maxStringLength),e)+n}var o=wOr[e.quoteStyle||"single"];o.lastIndex=0;var i=aA.call(aA.call(t,o,"\\$1"),/[\x00-\x1f]/g,FOr);return Bvt(i,"single",e)}function FOr(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":"")+_Or.call(e.toString(16))}function ZH(t){return"Object("+t+")"}function yCe(t){return t+" { ? }"}function Lvt(t,e,r,n){var o=n?SCe(r,n):G_.call(r,", ");return t+" ("+e+") {"+o+"}"}function kOr(t){for(var e=0;e=0)return!1;return!0}function $Or(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=G_.call(Array(t.indent+1)," ");else return null;return{base:r,prev:G_.call(Array(e+1),r)}}function SCe(t,e){if(t.length===0)return"";var r=` `+e.prev+e.base;return r+G_.call(t,","+r)+` -`+e.prev}function Cee(t,e){var r=bCe(t),n=[];if(r){n.length=t.length;for(var o=0;o{"use strict";var DOr=QH(),LOr=sj(),Eee=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},FOr=function(t,e){if(t){var r=Eee(t,e);return r&&r.value}},kOr=function(t,e,r){var n=Eee(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},$Or=function(t,e){return t?!!Eee(t,e):!1},BOr=function(t,e){if(t)return Eee(t,e,!0)};qvt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new LOr("Side channel does not contain "+DOr(n))},delete:function(n){var o=e&&e.next,i=BOr(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return FOr(e,n)},has:function(n){return $Or(e,n)},set:function(n,o){e||(e={next:void 0}),kOr(e,n,o)}};return r}});var xCe=v((Pvo,zvt)=>{"use strict";zvt.exports=Object});var Vvt=v((Evo,Hvt)=>{"use strict";Hvt.exports=Error});var Kvt=v((Tvo,Wvt)=>{"use strict";Wvt.exports=EvalError});var Jvt=v((Avo,Gvt)=>{"use strict";Gvt.exports=RangeError});var Zvt=v((Ivo,Yvt)=>{"use strict";Yvt.exports=ReferenceError});var Qvt=v((Mvo,Xvt)=>{"use strict";Xvt.exports=SyntaxError});var twt=v((Rvo,ewt)=>{"use strict";ewt.exports=URIError});var nwt=v((jvo,rwt)=>{"use strict";rwt.exports=Math.abs});var iwt=v((Nvo,owt)=>{"use strict";owt.exports=Math.floor});var swt=v((Dvo,awt)=>{"use strict";awt.exports=Math.max});var lwt=v((Lvo,uwt)=>{"use strict";uwt.exports=Math.min});var dwt=v((Fvo,cwt)=>{"use strict";cwt.exports=Math.pow});var pwt=v((kvo,fwt)=>{"use strict";fwt.exports=Math.round});var hwt=v(($vo,mwt)=>{"use strict";mwt.exports=Number.isNaN||function(e){return e!==e}});var ywt=v((Bvo,gwt)=>{"use strict";var qOr=hwt();gwt.exports=function(e){return qOr(e)||e===0?e:e<0?-1:1}});var _wt=v((qvo,bwt)=>{"use strict";bwt.exports=Object.getOwnPropertyDescriptor});var CCe=v((Uvo,vwt)=>{"use strict";var Tee=_wt();if(Tee)try{Tee([],"length")}catch{Tee=null}vwt.exports=Tee});var Swt=v((zvo,wwt)=>{"use strict";var Aee=Object.defineProperty||!1;if(Aee)try{Aee({},"a",{value:1})}catch{Aee=!1}wwt.exports=Aee});var Cwt=v((Hvo,xwt)=>{"use strict";xwt.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 Ewt=v((Vvo,Pwt)=>{"use strict";var Owt=typeof Symbol<"u"&&Symbol,UOr=Cwt();Pwt.exports=function(){return typeof Owt!="function"||typeof Symbol!="function"||typeof Owt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:UOr()}});var OCe=v((Wvo,Twt)=>{"use strict";Twt.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var PCe=v((Kvo,Awt)=>{"use strict";var zOr=xCe();Awt.exports=zOr.getPrototypeOf||null});var Rwt=v((Gvo,Mwt)=>{"use strict";var HOr="Function.prototype.bind called on incompatible ",VOr=Object.prototype.toString,WOr=Math.max,KOr="[object Function]",Iwt=function(e,r){for(var n=[],o=0;o{"use strict";var YOr=Rwt();jwt.exports=Function.prototype.bind||YOr});var Iee=v((Yvo,Nwt)=>{"use strict";Nwt.exports=Function.prototype.call});var ECe=v((Zvo,Dwt)=>{"use strict";Dwt.exports=Function.prototype.apply});var Fwt=v((Xvo,Lwt)=>{"use strict";Lwt.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var $wt=v((Qvo,kwt)=>{"use strict";var ZOr=eV(),XOr=ECe(),QOr=Iee(),ePr=Fwt();kwt.exports=ePr||ZOr.call(QOr,XOr)});var TCe=v((ewo,Bwt)=>{"use strict";var tPr=eV(),rPr=sj(),nPr=Iee(),oPr=$wt();Bwt.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new rPr("a function is required");return oPr(tPr,nPr,e)}});var Wwt=v((two,Vwt)=>{"use strict";var iPr=TCe(),qwt=CCe(),zwt;try{zwt=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var ACe=!!zwt&&qwt&&qwt(Object.prototype,"__proto__"),Hwt=Object,Uwt=Hwt.getPrototypeOf;Vwt.exports=ACe&&typeof ACe.get=="function"?iPr([ACe.get]):typeof Uwt=="function"?function(e){return Uwt(e==null?e:Hwt(e))}:!1});var Zwt=v((rwo,Ywt)=>{"use strict";var Kwt=OCe(),Gwt=PCe(),Jwt=Wwt();Ywt.exports=Kwt?function(e){return Kwt(e)}:Gwt?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Gwt(e)}:Jwt?function(e){return Jwt(e)}:null});var Qwt=v((nwo,Xwt)=>{"use strict";var aPr=Function.prototype.call,sPr=Object.prototype.hasOwnProperty,uPr=eV();Xwt.exports=uPr.call(aPr,sPr)});var jee=v((owo,i0t)=>{"use strict";var Nn,lPr=xCe(),cPr=Vvt(),dPr=Kvt(),fPr=Jvt(),pPr=Zvt(),h$=Qvt(),m$=sj(),mPr=twt(),hPr=nwt(),gPr=iwt(),yPr=swt(),bPr=lwt(),_Pr=dwt(),vPr=pwt(),wPr=ywt(),n0t=Function,ICe=function(t){try{return n0t('"use strict"; return ('+t+").constructor;")()}catch{}},tV=CCe(),SPr=Swt(),MCe=function(){throw new m$},xPr=tV?function(){try{return arguments.callee,MCe}catch{try{return tV(arguments,"callee").get}catch{return MCe}}}():MCe,f$=Ewt()(),Zl=Zwt(),CPr=PCe(),OPr=OCe(),o0t=ECe(),rV=Iee(),p$={},PPr=typeof Uint8Array>"u"||!Zl?Nn:Zl(Uint8Array),uj={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Nn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Nn:ArrayBuffer,"%ArrayIteratorPrototype%":f$&&Zl?Zl([][Symbol.iterator]()):Nn,"%AsyncFromSyncIteratorPrototype%":Nn,"%AsyncFunction%":p$,"%AsyncGenerator%":p$,"%AsyncGeneratorFunction%":p$,"%AsyncIteratorPrototype%":p$,"%Atomics%":typeof Atomics>"u"?Nn:Atomics,"%BigInt%":typeof BigInt>"u"?Nn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Nn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Nn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Nn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":cPr,"%eval%":eval,"%EvalError%":dPr,"%Float32Array%":typeof Float32Array>"u"?Nn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Nn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Nn:FinalizationRegistry,"%Function%":n0t,"%GeneratorFunction%":p$,"%Int8Array%":typeof Int8Array>"u"?Nn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Nn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Nn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":f$&&Zl?Zl(Zl([][Symbol.iterator]())):Nn,"%JSON%":typeof JSON=="object"?JSON:Nn,"%Map%":typeof Map>"u"?Nn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!f$||!Zl?Nn:Zl(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":lPr,"%Object.getOwnPropertyDescriptor%":tV,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Nn:Promise,"%Proxy%":typeof Proxy>"u"?Nn:Proxy,"%RangeError%":fPr,"%ReferenceError%":pPr,"%Reflect%":typeof Reflect>"u"?Nn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Nn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!f$||!Zl?Nn:Zl(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Nn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":f$&&Zl?Zl(""[Symbol.iterator]()):Nn,"%Symbol%":f$?Symbol:Nn,"%SyntaxError%":h$,"%ThrowTypeError%":xPr,"%TypedArray%":PPr,"%TypeError%":m$,"%Uint8Array%":typeof Uint8Array>"u"?Nn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Nn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Nn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Nn:Uint32Array,"%URIError%":mPr,"%WeakMap%":typeof WeakMap>"u"?Nn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Nn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Nn:WeakSet,"%Function.prototype.call%":rV,"%Function.prototype.apply%":o0t,"%Object.defineProperty%":SPr,"%Object.getPrototypeOf%":CPr,"%Math.abs%":hPr,"%Math.floor%":gPr,"%Math.max%":yPr,"%Math.min%":bPr,"%Math.pow%":_Pr,"%Math.round%":vPr,"%Math.sign%":wPr,"%Reflect.getPrototypeOf%":OPr};if(Zl)try{null.error}catch(t){e0t=Zl(Zl(t)),uj["%Error.prototype%"]=e0t}var e0t,EPr=function t(e){var r;if(e==="%AsyncFunction%")r=ICe("async function () {}");else if(e==="%GeneratorFunction%")r=ICe("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=ICe("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&Zl&&(r=Zl(o.prototype))}return uj[e]=r,r},t0t={__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"]},nV=eV(),Mee=Qwt(),TPr=nV.call(rV,Array.prototype.concat),APr=nV.call(o0t,Array.prototype.splice),r0t=nV.call(rV,String.prototype.replace),Ree=nV.call(rV,String.prototype.slice),IPr=nV.call(rV,RegExp.prototype.exec),MPr=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,RPr=/\\(\\)?/g,jPr=function(e){var r=Ree(e,0,1),n=Ree(e,-1);if(r==="%"&&n!=="%")throw new h$("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new h$("invalid intrinsic syntax, expected opening `%`");var o=[];return r0t(e,MPr,function(i,a,s,u){o[o.length]=s?r0t(u,RPr,"$1"):a||i}),o},NPr=function(e,r){var n=e,o;if(Mee(t0t,n)&&(o=t0t[n],n="%"+o[0]+"%"),Mee(uj,n)){var i=uj[n];if(i===p$&&(i=EPr(n)),typeof i>"u"&&!r)throw new m$("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new h$("intrinsic "+e+" does not exist!")};i0t.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new m$("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new m$('"allowMissing" argument must be a boolean');if(IPr(/^%?[^%]*%?$/,e)===null)throw new h$("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=jPr(e),o=n.length>0?n[0]:"",i=NPr("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],APr(n,TPr([0,1],l)));for(var c=1,d=!0;c=n.length){var h=tV(s,f);d=!!h,d&&"get"in h&&!("originalValue"in h.get)?s=h.get:s=s[f]}else d=Mee(s,f),s=s[f];d&&!u&&(uj[a]=s)}}return s}});var RCe=v((iwo,u0t)=>{"use strict";var a0t=jee(),s0t=TCe(),DPr=s0t([a0t("%String.prototype.indexOf%")]);u0t.exports=function(e,r){var n=a0t(e,!!r);return typeof n=="function"&&DPr(e,".prototype.")>-1?s0t([n]):n}});var jCe=v((awo,c0t)=>{"use strict";var LPr=jee(),oV=RCe(),FPr=QH(),kPr=sj(),l0t=LPr("%Map%",!0),$Pr=oV("Map.prototype.get",!0),BPr=oV("Map.prototype.set",!0),qPr=oV("Map.prototype.has",!0),UPr=oV("Map.prototype.delete",!0),zPr=oV("Map.prototype.size",!0);c0t.exports=!!l0t&&function(){var e,r={assert:function(n){if(!r.has(n))throw new kPr("Side channel does not contain "+FPr(n))},delete:function(n){if(e){var o=UPr(e,n);return zPr(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return $Pr(e,n)},has:function(n){return e?qPr(e,n):!1},set:function(n,o){e||(e=new l0t),BPr(e,n,o)}};return r}});var f0t=v((swo,d0t)=>{"use strict";var HPr=jee(),Dee=RCe(),VPr=QH(),Nee=jCe(),WPr=sj(),g$=HPr("%WeakMap%",!0),KPr=Dee("WeakMap.prototype.get",!0),GPr=Dee("WeakMap.prototype.set",!0),JPr=Dee("WeakMap.prototype.has",!0),YPr=Dee("WeakMap.prototype.delete",!0);d0t.exports=g$?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new WPr("Side channel does not contain "+VPr(o))},delete:function(o){if(g$&&o&&(typeof o=="object"||typeof o=="function")){if(e)return YPr(e,o)}else if(Nee&&r)return r.delete(o);return!1},get:function(o){return g$&&o&&(typeof o=="object"||typeof o=="function")&&e?KPr(e,o):r&&r.get(o)},has:function(o){return g$&&o&&(typeof o=="object"||typeof o=="function")&&e?JPr(e,o):!!r&&r.has(o)},set:function(o,i){g$&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new g$),GPr(e,o,i)):Nee&&(r||(r=Nee()),r.set(o,i))}};return n}:Nee});var m0t=v((uwo,p0t)=>{"use strict";var ZPr=sj(),XPr=QH(),QPr=Uvt(),eEr=jCe(),tEr=f0t(),rEr=tEr||eEr||QPr;p0t.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new ZPr("Side channel does not contain "+XPr(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=rEr()),e.set(n,o)}};return r}});var Lee=v((lwo,h0t)=>{"use strict";var nEr=String.prototype.replace,oEr=/%20/g,NCe={RFC1738:"RFC1738",RFC3986:"RFC3986"};h0t.exports={default:NCe.RFC3986,formatters:{RFC1738:function(t){return nEr.call(t,oEr,"+")},RFC3986:function(t){return String(t)}},RFC1738:NCe.RFC1738,RFC3986:NCe.RFC3986}});var LCe=v((cwo,y0t)=>{"use strict";var iEr=Lee(),DCe=Object.prototype.hasOwnProperty,lj=Array.isArray,J_=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),aEr=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(lj(n)){for(var o=[],i=0;i=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===iEr.RFC1738&&(l===40||l===41)){s+=a.charAt(u);continue}if(l<128){s=s+J_[l];continue}if(l<2048){s=s+(J_[192|l>>6]+J_[128|l&63]);continue}if(l<55296||l>=57344){s=s+(J_[224|l>>12]+J_[128|l>>6&63]+J_[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|a.charCodeAt(u)&1023),s+=J_[240|l>>18]+J_[128|l>>12&63]+J_[128|l>>6&63]+J_[128|l&63]}return s},dEr=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],o=0;o{"use strict";var v0t=m0t(),Fee=LCe(),iV=Lee(),gEr=Object.prototype.hasOwnProperty,b0t={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},PO=Array.isArray,yEr=Array.prototype.push,w0t=function(t,e){yEr.apply(t,PO(e)?e:[e])},bEr=Date.prototype.toISOString,_0t=iV.default,Zd={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Fee.encode,encodeValuesOnly:!1,format:_0t,formatter:iV.formatters[_0t],indices:!1,serializeDate:function(e){return bEr.call(e)},skipNulls:!1,strictNullHandling:!1},_Er=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},FCe={},vEr=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,b){for(var g=e,y=b,S=0,x=!1;(y=y.get(FCe))!==void 0&&!x;){var O=y.get(e);if(S+=1,typeof O<"u"){if(O===S)throw new RangeError("Cyclic object value");x=!0}typeof y.get(FCe)>"u"&&(S=0)}if(typeof u=="function"?g=u(r,g):g instanceof Date?g=d(g):n==="comma"&&PO(g)&&(g=Fee.maybeMap(g,function(V){return V instanceof Date?d(V):V})),g===null){if(i)return s&&!m?s(r,Zd.encoder,h,"key",f):r;g=""}if(_Er(g)||Fee.isBuffer(g)){if(s){var P=m?r:s(r,Zd.encoder,h,"key",f);return[p(P)+"="+p(s(g,Zd.encoder,h,"value",f))]}return[p(r)+"="+p(String(g))]}var E=[];if(typeof g>"u")return E;var A;if(n==="comma"&&PO(g))m&&s&&(g=Fee.maybeMap(g,s)),A=[{value:g.length>0?g.join(",")||null:void 0}];else if(PO(u))A=u;else{var I=Object.keys(g);A=l?I.sort(l):I}for(var R=o&&PO(g)&&g.length===1?r+"[]":r,N=0;N"u"?Zd.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Zd.charsetSentinel,delimiter:typeof e.delimiter>"u"?Zd.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Zd.encode,encoder:typeof e.encoder=="function"?e.encoder:Zd.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Zd.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Zd.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Zd.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Zd.strictNullHandling}};S0t.exports=function(t,e){var r=t,n=wEr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):PO(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s;e&&e.arrayFormat in b0t?s=e.arrayFormat:e&&"indices"in e?s=e.indices?"indices":"repeat":s="indices";var u=b0t[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=v0t(),d=0;d0?m+p:""}});var P0t=v((fwo,O0t)=>{"use strict";var y$=LCe(),kCe=Object.prototype.hasOwnProperty,SEr=Array.isArray,Xl={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:y$.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},xEr=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},C0t=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},CEr="utf8=%26%2310003%3B",OEr="utf8=%E2%9C%93",PEr=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-1&&(m=SEr(m)?[m]:m),kCe.call(n,p)?n[p]=y$.combine(n[p],m):n[p]=m}return n},EEr=function(t,e,r,n){for(var o=n?e:C0t(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},TEr=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&&kCe.call(Object.prototype,l)&&!n.allowPrototypes)return;c.push(l)}for(var d=0;n.depth>0&&(u=s.exec(i))!==null&&d"u"?Xl.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Xl.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Xl.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Xl.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Xl.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Xl.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Xl.comma,decoder:typeof e.decoder=="function"?e.decoder:Xl.decoder,delimiter:typeof e.delimiter=="string"||y$.isRegExp(e.delimiter)?e.delimiter:Xl.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Xl.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Xl.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Xl.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Xl.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Xl.strictNullHandling}};O0t.exports=function(t,e){var r=AEr(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?PEr(t,r):t,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a{"use strict";var IEr=x0t(),MEr=P0t(),REr=Lee();E0t.exports={formats:REr,parse:MEr,stringify:IEr}});var A0t=v(b$=>{"use strict";var jEr=b$&&b$.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(b$,"__esModule",{value:!0});b$.createRequestUrl=void 0;var NEr=jEr(T0t());function DEr(t,e){return Object.keys(e??{}).length>0?`${t}?${NEr.default.stringify(e,{arrayFormat:"repeat"})}`:t}b$.createRequestUrl=DEr});var R0t=v(kee=>{"use strict";var $Ce,BCe,qCe,UCe,zCe;Object.defineProperty(kee,"__esModule",{value:!0});kee.RUNTIME=void 0;var LEr=typeof window<"u"&&typeof window.document<"u",FEr=typeof self=="object"&&typeof self?.importScripts=="function"&&((($Ce=self.constructor)===null||$Ce===void 0?void 0:$Ce.name)==="DedicatedWorkerGlobalScope"||((BCe=self.constructor)===null||BCe===void 0?void 0:BCe.name)==="ServiceWorkerGlobalScope"||((qCe=self.constructor)===null||qCe===void 0?void 0:qCe.name)==="SharedWorkerGlobalScope"),I0t=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",M0t=typeof Bun<"u"&&typeof Bun.version<"u",kEr=typeof process<"u"&&!!process.version&&!!(!((UCe=process.versions)===null||UCe===void 0)&&UCe.node)&&!I0t&&!M0t,$Er=typeof navigator<"u"&&navigator?.product==="ReactNative",BEr=typeof globalThis<"u"&&((zCe=globalThis?.navigator)===null||zCe===void 0?void 0:zCe.userAgent)==="Cloudflare-Workers";kee.RUNTIME=qEr();function qEr(){return LEr?{type:"browser",version:window.navigator.userAgent}:BEr?{type:"workerd"}:FEr?{type:"web-worker"}:I0t?{type:"deno",version:Deno.version.deno}:M0t?{type:"bun",version:Bun.version}:kEr?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:$Er?{type:"react-native"}:{type:"unknown"}}});var _$=v($ee=>{"use strict";Object.defineProperty($ee,"__esModule",{value:!0});$ee.RUNTIME=void 0;var UEr=R0t();Object.defineProperty($ee,"RUNTIME",{enumerable:!0,get:function(){return UEr.RUNTIME}})});var HCe=v((v$,j0t)=>{"use strict";var zEr=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},cj=zEr();j0t.exports=v$=cj.fetch;cj.fetch&&(v$.default=cj.fetch.bind(cj));v$.Headers=cj.Headers;v$.Request=cj.Request;v$.Response=cj.Response});var D0t=v(og=>{"use strict";var HEr=og&&og.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VEr=og&&og.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N0t=og&&og.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HEr(e,t,r);return VEr(e,t),e},WEr=og&&og.__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(og,"__esModule",{value:!0});og.getFetchFn=void 0;var Bee=_$();function KEr(){return WEr(this,void 0,void 0,function*(){return Bee.RUNTIME.type==="node"&&Bee.RUNTIME.parsedVersion!=null&&Bee.RUNTIME.parsedVersion>=18?fetch:Bee.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>N0t(HCe()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>N0t(HCe()))).default})}og.getFetchFn=KEr});var L0t=v(w$=>{"use strict";var GEr=w$&&w$.__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(w$,"__esModule",{value:!0});w$.getRequestBody=void 0;function JEr({body:t,type:e}){return GEr(this,void 0,void 0,function*(){return e.includes("json")?JSON.stringify(t):t})}w$.getRequestBody=JEr});var F0t=v(S$=>{"use strict";var ky=S$&&S$.__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(S$,"__esModule",{value:!0});S$.Node18UniversalStreamWrapper=void 0;var VCe=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=>ky(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",()=>ky(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>ky(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=>ky(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",()=>ky(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>ky(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 ky(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 ky(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 ky(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 ky(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:()=>ky(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}}}};S$.Node18UniversalStreamWrapper=VCe});var k0t=v(x$=>{"use strict";var aV=x$&&x$.__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(x$,"__esModule",{value:!0});x$.UndiciStreamWrapper=void 0;var WCe=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 aV(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 aV(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 aV(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 aV(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:()=>aV(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}}}};x$.UndiciStreamWrapper=WCe});var $0t=v(uA=>{"use strict";var qee=uA&&uA.__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())})},YEr=uA&&uA.__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(uA,"__esModule",{value:!0});uA.NodePre18StreamWrapper=void 0;var KCe=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 qee(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 qee(this,void 0,void 0,function*(){let n=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var i=YEr(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 qee(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 qee(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};uA.NodePre18StreamWrapper=KCe});var B0t=v(ig=>{"use strict";var ZEr=ig&&ig.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XEr=ig&&ig.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GCe=ig&&ig.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZEr(e,t,r);return XEr(e,t),e},QEr=ig&&ig.__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(ig,"__esModule",{value:!0});ig.chooseStreamWrapper=void 0;var Uee=_$();function eTr(t){return QEr(this,void 0,void 0,function*(){return Uee.RUNTIME.type==="node"&&Uee.RUNTIME.parsedVersion!=null&&Uee.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>GCe(F0t()))).Node18UniversalStreamWrapper(t):Uee.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>GCe(k0t()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>GCe($0t()))).NodePre18StreamWrapper(t)})}ig.chooseStreamWrapper=eTr});var q0t=v(C$=>{"use strict";var tTr=C$&&C$.__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(C$,"__esModule",{value:!0});C$.getResponseBody=void 0;var rTr=B0t();function nTr(t,e){return tTr(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,rTr.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}})}C$.getResponseBody=nTr});var U0t=v(O$=>{"use strict";Object.defineProperty(O$,"__esModule",{value:!0});O$.anySignal=O$.getTimeoutSignal=void 0;var oTr="timeout";function iTr(t){let e=new AbortController,r=setTimeout(()=>e.abort(oTr),t);return{signal:e.signal,abortId:r}}O$.getTimeoutSignal=iTr;function aTr(...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}O$.anySignal=aTr});var H0t=v(P$=>{"use strict";var sTr=P$&&P$.__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(P$,"__esModule",{value:!0});P$.makeRequest=void 0;var z0t=U0t(),uTr=(t,e,r,n,o,i,a,s,u)=>sTr(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:m}=(0,z0t.getTimeoutSignal)(i);c=m,l.push(p)}a!=null&&l.push(a);let d=(0,z0t.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});P$.makeRequest=uTr});var V0t=v(E$=>{"use strict";var lTr=E$&&E$.__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(E$,"__esModule",{value:!0});E$.requestWithRetries=void 0;var cTr=1,dTr=60,fTr=2;function pTr(t,e=fTr){return lTr(this,void 0,void 0,function*(){let r=yield t();for(let n=0;n=500);++n){let o=Math.min(cTr*Math.pow(2,n),dTr);yield new Promise(i=>setTimeout(i,o)),r=yield t()}return r})}E$.requestWithRetries=pTr});var G0t=v(lA=>{"use strict";var W0t=lA&&lA.__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(lA,"__esModule",{value:!0});lA.fetcher=lA.fetcherImpl=void 0;var mTr=A0t(),hTr=D0t(),gTr=L0t(),yTr=q0t(),bTr=H0t(),_Tr=V0t();function K0t(t){return W0t(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,mTr.createRequestUrl)(t.url,t.queryParameters),n=yield(0,gTr.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,hTr.getFetchFn)();try{let i=yield(0,_Tr.requestWithRetries)(()=>W0t(this,void 0,void 0,function*(){return(0,bTr.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,yTr.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)}}}})}lA.fetcherImpl=K0t;lA.fetcher=K0t});var J0t=v(zee=>{"use strict";Object.defineProperty(zee,"__esModule",{value:!0});zee.getHeader=void 0;function vTr(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}zee.getHeader=vTr});var Y0t=v(T$=>{"use strict";var wTr=T$&&T$.__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(T$,"__esModule",{value:!0});T$.Supplier=void 0;T$.Supplier={get:t=>wTr(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var Z0t=v(cA=>{"use strict";Object.defineProperty(cA,"__esModule",{value:!0});cA.Supplier=cA.getHeader=cA.fetcher=void 0;var STr=G0t();Object.defineProperty(cA,"fetcher",{enumerable:!0,get:function(){return STr.fetcher}});var xTr=J0t();Object.defineProperty(cA,"getHeader",{enumerable:!0,get:function(){return xTr.getHeader}});var CTr=Y0t();Object.defineProperty(cA,"Supplier",{enumerable:!0,get:function(){return CTr.Supplier}})});var X0t=v((JCe,YCe)=>{(function(t,e){typeof JCe=="object"&&typeof YCe<"u"?YCe.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:JCe,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(U){var W={};return U.forEach(function(Y,ae){return W[Y]=ae}),W}(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(U,W){return W===void 0&&(W=function(Y){return Y}),new Uint8Array(Array.prototype.slice.call(U,0).map(W))},p=function(U){return U.replace(/=/g,"").replace(/[+\/]/g,function(W){return W=="+"?"-":"_"})},m=function(U){return U.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(U){for(var W,Y,ae,Oe,le="",Be=U.length%3,ze=0;ze255||(ae=U.charCodeAt(ze++))>255||(Oe=U.charCodeAt(ze++))>255)throw new TypeError("invalid character found");W=Y<<16|ae<<8|Oe,le+=u[W>>18&63]+u[W>>12&63]+u[W>>6&63]+u[W&63]}return Be?le.slice(0,Be-3)+"===".substring(Be):le},b=n?function(U){return btoa(U)}:o?function(U){return Buffer.from(U,"binary").toString("base64")}:h,g=o?function(U){return Buffer.from(U).toString("base64")}:function(U){for(var W=4096,Y=[],ae=0,Oe=U.length;ae>>6)+d(128|W&63):d(224|W>>>12&15)+d(128|W>>>6&63)+d(128|W&63)}else{var W=65536+(U.charCodeAt(0)-55296)*1024+(U.charCodeAt(1)-56320);return d(240|W>>>18&7)+d(128|W>>>12&63)+d(128|W>>>6&63)+d(128|W&63)}},x=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,O=function(U){return U.replace(x,S)},P=o?function(U){return Buffer.from(U,"utf8").toString("base64")}:a?function(U){return g(a.encode(U))}:function(U){return b(O(U))},E=function(U,W){return W===void 0&&(W=!1),W?p(P(U)):P(U)},A=function(U){return E(U,!0)},I=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,R=function(U){switch(U.length){case 4:var W=(7&U.charCodeAt(0))<<18|(63&U.charCodeAt(1))<<12|(63&U.charCodeAt(2))<<6|63&U.charCodeAt(3),Y=W-65536;return d((Y>>>10)+55296)+d((Y&1023)+56320);case 3:return d((15&U.charCodeAt(0))<<12|(63&U.charCodeAt(1))<<6|63&U.charCodeAt(2));default:return d((31&U.charCodeAt(0))<<6|63&U.charCodeAt(1))}},N=function(U){return U.replace(I,R)},j=function(U){if(U=U.replace(/\s+/g,""),!c.test(U))throw new TypeError("malformed base64.");U+="==".slice(2-(U.length&3));for(var W,Y="",ae,Oe,le=0;le>16&255):Oe===64?d(W>>16&255,W>>8&255):d(W>>16&255,W>>8&255,W&255);return Y},$=r?function(U){return atob(m(U))}:o?function(U){return Buffer.from(U,"base64").toString("binary")}:j,k=o?function(U){return f(Buffer.from(U,"base64"))}:function(U){return f($(U),function(W){return W.charCodeAt(0)})},z=function(U){return k(Q(U))},V=o?function(U){return Buffer.from(U,"base64").toString("utf8")}:i?function(U){return i.decode(k(U))}:function(U){return N($(U))},Q=function(U){return m(U.replace(/[-_]/g,function(W){return W=="-"?"+":"/"}))},J=function(U){return V(Q(U))},D=function(U){if(typeof U!="string")return!1;var W=U.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(W)||!/[^\s0-9a-zA-Z\-_]/.test(W)},B=function(U){return{value:U,enumerable:!1,writable:!0,configurable:!0}},q=function(){var U=function(W,Y){return Object.defineProperty(String.prototype,W,B(Y))};U("fromBase64",function(){return J(this)}),U("toBase64",function(W){return E(this,W)}),U("toBase64URI",function(){return E(this,!0)}),U("toBase64URL",function(){return E(this,!0)}),U("toUint8Array",function(){return z(this)})},K=function(){var U=function(W,Y){return Object.defineProperty(Uint8Array.prototype,W,B(Y))};U("toBase64",function(W){return y(this,W)}),U("toBase64URI",function(){return y(this,!0)}),U("toBase64URL",function(){return y(this,!0)})},H=function(){q(),K()},ee={version:t,VERSION:e,atob:$,atobPolyfill:j,btoa:b,btoaPolyfill:h,fromBase64:J,toBase64:E,encode:E,encodeURI:A,encodeURL:A,utob:O,btou:N,decode:J,isValid:D,fromUint8Array:y,toUint8Array:z,extendString:q,extendUint8Array:K,extendBuiltins:H};return ee.Base64={},Object.keys(ee).forEach(function(U){return ee.Base64[U]=ee[U]}),ee})});var eSt=v(Hee=>{"use strict";Object.defineProperty(Hee,"__esModule",{value:!0});Hee.BasicAuth=void 0;var Q0t=X0t(),OTr=/^Basic /i;Hee.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${Q0t.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(OTr,""),r=Q0t.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 tSt=v(Vee=>{"use strict";Object.defineProperty(Vee,"__esModule",{value:!0});Vee.BearerToken=void 0;var PTr=/^Bearer /i;Vee.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(PTr,"").trim()}});var rSt=v(A$=>{"use strict";Object.defineProperty(A$,"__esModule",{value:!0});A$.BearerToken=A$.BasicAuth=void 0;var ETr=eSt();Object.defineProperty(A$,"BasicAuth",{enumerable:!0,get:function(){return ETr.BasicAuth}});var TTr=tSt();Object.defineProperty(A$,"BearerToken",{enumerable:!0,get:function(){return TTr.BearerToken}})});var XCe=v(Np=>{"use strict";var nSt=Np&&Np.__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())})},oSt=Np&&Np.__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)}},$y=Np&&Np.__await||function(t){return this instanceof $y?(this.v=t,this):new $y(t)},iSt=Np&&Np.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof $y?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(Np,"__esModule",{value:!0});Np.readableStreamAsyncIterable=Np.Stream=void 0;var ATr=_$(),ITr="data:",ZCe=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=ITr,this.messageTerminator=` -`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return iSt(this,arguments,function*(){var r,n;this.controller.signal;let o=aSt(this.stream),i="",a=!1;try{for(var s=oSt(o),u;u=yield $y(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 $y(void 0);let f=yield $y(this.parse(JSON.parse(d)));yield yield $y(f),a=!1}}}catch(l){r={error:l}}finally{try{u&&!u.done&&(n=s.return)&&(yield $y(n.call(s)))}finally{if(r)throw r.error}}})}[Symbol.asyncIterator](){return iSt(this,arguments,function*(){var r,n;try{for(var o=oSt(this.iterMessages()),i;i=yield $y(o.next()),!i.done;){let a=i.value;yield yield $y(a)}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&(yield $y(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 ATr.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};Np.Stream=ZCe;function aSt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return nSt(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 nSt(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}Np.readableStreamAsyncIterable=aSt});var sSt=v(Wee=>{"use strict";Object.defineProperty(Wee,"__esModule",{value:!0});Wee.Stream=void 0;var MTr=XCe();Object.defineProperty(Wee,"Stream",{enumerable:!0,get:function(){return MTr.Stream}})});var cSt=v((Lwo,lSt)=>{"use strict";var QCe=Object.defineProperty,RTr=Object.getOwnPropertyDescriptor,jTr=Object.getOwnPropertyNames,NTr=Object.prototype.hasOwnProperty,DTr=(t,e)=>{for(var r in e)QCe(t,r,{get:e[r],enumerable:!0})},LTr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of jTr(e))!NTr.call(t,o)&&o!==r&&QCe(t,o,{get:()=>e[o],enumerable:!(n=RTr(e,o))||n.enumerable});return t},FTr=t=>LTr(QCe({},"__esModule",{value:!0}),t),uSt={};DTr(uSt,{Blob:()=>BTr,File:()=>qTr,FormData:()=>$Tr});lSt.exports=FTr(uSt);var kTr=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:$Tr,Blob:BTr,File:qTr}=kTr});var xSt=v((Fwo,SSt)=>{"use strict";var rOe=Object.defineProperty,UTr=Object.getOwnPropertyDescriptor,zTr=Object.getOwnPropertyNames,HTr=Object.prototype.hasOwnProperty,VTr=(t,e)=>{for(var r in e)rOe(t,r,{get:e[r],enumerable:!0})},WTr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of zTr(e))!HTr.call(t,o)&&o!==r&&rOe(t,o,{get:()=>e[o],enumerable:!(n=UTr(e,o))||n.enumerable});return t},KTr=t=>WTr(rOe({},"__esModule",{value:!0}),t),nOe=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},fs=(t,e,r)=>(nOe(t,e,"read from private field"),r?r.call(t):e.get(t)),Y_=(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)},sV=(t,e,r,n)=>(nOe(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),eOe=(t,e,r)=>(nOe(t,e,"access private method"),r),ySt={};VTr(ySt,{FormDataEncoder:()=>tAr,isFile:()=>fj,isFormData:()=>vSt});SSt.exports=KTr(ySt);var EO=t=>typeof t=="function",GTr=t=>EO(t[Symbol.asyncIterator]),dSt=65536;function*bSt(t){if(t.byteLength<=dSt){yield t;return}let e=0;for(;e{if(GTr(t))return fSt(t);if(EO(t.getReader))return fSt(JTr(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},pSt="abcdefghijklmnopqrstuvwxyz0123456789";function ZTr(){let t=16,e="";for(;t--;)e+=pSt[Math.random()*pSt.length<<0];return e}var _St=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==` +`+e.prev}function Oee(t,e){var r=wCe(t),n=[];if(r){n.length=t.length;for(var o=0;o{"use strict";var BOr=eV(),qOr=uj(),Tee=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},UOr=function(t,e){if(t){var r=Tee(t,e);return r&&r.value}},zOr=function(t,e,r){var n=Tee(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},HOr=function(t,e){return t?!!Tee(t,e):!1},VOr=function(t,e){if(t)return Tee(t,e,!0)};Vvt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new qOr("Side channel does not contain "+BOr(n))},delete:function(n){var o=e&&e.next,i=VOr(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return UOr(e,n)},has:function(n){return HOr(e,n)},set:function(n,o){e||(e={next:void 0}),zOr(e,n,o)}};return r}});var PCe=v((Mvo,Kvt)=>{"use strict";Kvt.exports=Object});var Jvt=v((Rvo,Gvt)=>{"use strict";Gvt.exports=Error});var Zvt=v((jvo,Yvt)=>{"use strict";Yvt.exports=EvalError});var Qvt=v((Nvo,Xvt)=>{"use strict";Xvt.exports=RangeError});var twt=v((Dvo,ewt)=>{"use strict";ewt.exports=ReferenceError});var nwt=v((Lvo,rwt)=>{"use strict";rwt.exports=SyntaxError});var iwt=v((Fvo,owt)=>{"use strict";owt.exports=URIError});var swt=v((kvo,awt)=>{"use strict";awt.exports=Math.abs});var lwt=v(($vo,uwt)=>{"use strict";uwt.exports=Math.floor});var dwt=v((Bvo,cwt)=>{"use strict";cwt.exports=Math.max});var pwt=v((qvo,fwt)=>{"use strict";fwt.exports=Math.min});var hwt=v((Uvo,mwt)=>{"use strict";mwt.exports=Math.pow});var ywt=v((zvo,gwt)=>{"use strict";gwt.exports=Math.round});var _wt=v((Hvo,bwt)=>{"use strict";bwt.exports=Number.isNaN||function(e){return e!==e}});var wwt=v((Vvo,vwt)=>{"use strict";var WOr=_wt();vwt.exports=function(e){return WOr(e)||e===0?e:e<0?-1:1}});var xwt=v((Wvo,Swt)=>{"use strict";Swt.exports=Object.getOwnPropertyDescriptor});var ECe=v((Kvo,Cwt)=>{"use strict";var Aee=xwt();if(Aee)try{Aee([],"length")}catch{Aee=null}Cwt.exports=Aee});var Pwt=v((Gvo,Owt)=>{"use strict";var Iee=Object.defineProperty||!1;if(Iee)try{Iee({},"a",{value:1})}catch{Iee=!1}Owt.exports=Iee});var Twt=v((Jvo,Ewt)=>{"use strict";Ewt.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 Mwt=v((Yvo,Iwt)=>{"use strict";var Awt=typeof Symbol<"u"&&Symbol,KOr=Twt();Iwt.exports=function(){return typeof Awt!="function"||typeof Symbol!="function"||typeof Awt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:KOr()}});var TCe=v((Zvo,Rwt)=>{"use strict";Rwt.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var ACe=v((Xvo,jwt)=>{"use strict";var GOr=PCe();jwt.exports=GOr.getPrototypeOf||null});var Lwt=v((Qvo,Dwt)=>{"use strict";var JOr="Function.prototype.bind called on incompatible ",YOr=Object.prototype.toString,ZOr=Math.max,XOr="[object Function]",Nwt=function(e,r){for(var n=[],o=0;o{"use strict";var tPr=Lwt();Fwt.exports=Function.prototype.bind||tPr});var Mee=v((two,kwt)=>{"use strict";kwt.exports=Function.prototype.call});var ICe=v((rwo,$wt)=>{"use strict";$wt.exports=Function.prototype.apply});var qwt=v((nwo,Bwt)=>{"use strict";Bwt.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var zwt=v((owo,Uwt)=>{"use strict";var rPr=tV(),nPr=ICe(),oPr=Mee(),iPr=qwt();Uwt.exports=iPr||rPr.call(oPr,nPr)});var MCe=v((iwo,Hwt)=>{"use strict";var aPr=tV(),sPr=uj(),uPr=Mee(),lPr=zwt();Hwt.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new sPr("a function is required");return lPr(aPr,uPr,e)}});var Ywt=v((awo,Jwt)=>{"use strict";var cPr=MCe(),Vwt=ECe(),Kwt;try{Kwt=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var RCe=!!Kwt&&Vwt&&Vwt(Object.prototype,"__proto__"),Gwt=Object,Wwt=Gwt.getPrototypeOf;Jwt.exports=RCe&&typeof RCe.get=="function"?cPr([RCe.get]):typeof Wwt=="function"?function(e){return Wwt(e==null?e:Gwt(e))}:!1});var t0t=v((swo,e0t)=>{"use strict";var Zwt=TCe(),Xwt=ACe(),Qwt=Ywt();e0t.exports=Zwt?function(e){return Zwt(e)}:Xwt?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Xwt(e)}:Qwt?function(e){return Qwt(e)}:null});var n0t=v((uwo,r0t)=>{"use strict";var dPr=Function.prototype.call,fPr=Object.prototype.hasOwnProperty,pPr=tV();r0t.exports=pPr.call(dPr,fPr)});var Nee=v((lwo,l0t)=>{"use strict";var Nn,mPr=PCe(),hPr=Jvt(),gPr=Zvt(),yPr=Qvt(),bPr=twt(),g$=nwt(),h$=uj(),_Pr=iwt(),vPr=swt(),wPr=lwt(),SPr=dwt(),xPr=pwt(),CPr=hwt(),OPr=ywt(),PPr=wwt(),s0t=Function,jCe=function(t){try{return s0t('"use strict"; return ('+t+").constructor;")()}catch{}},rV=ECe(),EPr=Pwt(),NCe=function(){throw new h$},TPr=rV?function(){try{return arguments.callee,NCe}catch{try{return rV(arguments,"callee").get}catch{return NCe}}}():NCe,p$=Mwt()(),Zl=t0t(),APr=ACe(),IPr=TCe(),u0t=ICe(),nV=Mee(),m$={},MPr=typeof Uint8Array>"u"||!Zl?Nn:Zl(Uint8Array),lj={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Nn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Nn:ArrayBuffer,"%ArrayIteratorPrototype%":p$&&Zl?Zl([][Symbol.iterator]()):Nn,"%AsyncFromSyncIteratorPrototype%":Nn,"%AsyncFunction%":m$,"%AsyncGenerator%":m$,"%AsyncGeneratorFunction%":m$,"%AsyncIteratorPrototype%":m$,"%Atomics%":typeof Atomics>"u"?Nn:Atomics,"%BigInt%":typeof BigInt>"u"?Nn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Nn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Nn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Nn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":hPr,"%eval%":eval,"%EvalError%":gPr,"%Float32Array%":typeof Float32Array>"u"?Nn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Nn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Nn:FinalizationRegistry,"%Function%":s0t,"%GeneratorFunction%":m$,"%Int8Array%":typeof Int8Array>"u"?Nn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Nn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Nn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p$&&Zl?Zl(Zl([][Symbol.iterator]())):Nn,"%JSON%":typeof JSON=="object"?JSON:Nn,"%Map%":typeof Map>"u"?Nn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!p$||!Zl?Nn:Zl(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":mPr,"%Object.getOwnPropertyDescriptor%":rV,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Nn:Promise,"%Proxy%":typeof Proxy>"u"?Nn:Proxy,"%RangeError%":yPr,"%ReferenceError%":bPr,"%Reflect%":typeof Reflect>"u"?Nn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Nn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!p$||!Zl?Nn:Zl(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Nn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p$&&Zl?Zl(""[Symbol.iterator]()):Nn,"%Symbol%":p$?Symbol:Nn,"%SyntaxError%":g$,"%ThrowTypeError%":TPr,"%TypedArray%":MPr,"%TypeError%":h$,"%Uint8Array%":typeof Uint8Array>"u"?Nn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Nn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Nn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Nn:Uint32Array,"%URIError%":_Pr,"%WeakMap%":typeof WeakMap>"u"?Nn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Nn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Nn:WeakSet,"%Function.prototype.call%":nV,"%Function.prototype.apply%":u0t,"%Object.defineProperty%":EPr,"%Object.getPrototypeOf%":APr,"%Math.abs%":vPr,"%Math.floor%":wPr,"%Math.max%":SPr,"%Math.min%":xPr,"%Math.pow%":CPr,"%Math.round%":OPr,"%Math.sign%":PPr,"%Reflect.getPrototypeOf%":IPr};if(Zl)try{null.error}catch(t){o0t=Zl(Zl(t)),lj["%Error.prototype%"]=o0t}var o0t,RPr=function t(e){var r;if(e==="%AsyncFunction%")r=jCe("async function () {}");else if(e==="%GeneratorFunction%")r=jCe("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=jCe("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&Zl&&(r=Zl(o.prototype))}return lj[e]=r,r},i0t={__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"]},oV=tV(),Ree=n0t(),jPr=oV.call(nV,Array.prototype.concat),NPr=oV.call(u0t,Array.prototype.splice),a0t=oV.call(nV,String.prototype.replace),jee=oV.call(nV,String.prototype.slice),DPr=oV.call(nV,RegExp.prototype.exec),LPr=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,FPr=/\\(\\)?/g,kPr=function(e){var r=jee(e,0,1),n=jee(e,-1);if(r==="%"&&n!=="%")throw new g$("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new g$("invalid intrinsic syntax, expected opening `%`");var o=[];return a0t(e,LPr,function(i,a,s,u){o[o.length]=s?a0t(u,FPr,"$1"):a||i}),o},$Pr=function(e,r){var n=e,o;if(Ree(i0t,n)&&(o=i0t[n],n="%"+o[0]+"%"),Ree(lj,n)){var i=lj[n];if(i===m$&&(i=RPr(n)),typeof i>"u"&&!r)throw new h$("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new g$("intrinsic "+e+" does not exist!")};l0t.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new h$("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new h$('"allowMissing" argument must be a boolean');if(DPr(/^%?[^%]*%?$/,e)===null)throw new g$("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=kPr(e),o=n.length>0?n[0]:"",i=$Pr("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],NPr(n,jPr([0,1],l)));for(var c=1,d=!0;c=n.length){var h=rV(s,f);d=!!h,d&&"get"in h&&!("originalValue"in h.get)?s=h.get:s=s[f]}else d=Ree(s,f),s=s[f];d&&!u&&(lj[a]=s)}}return s}});var DCe=v((cwo,f0t)=>{"use strict";var c0t=Nee(),d0t=MCe(),BPr=d0t([c0t("%String.prototype.indexOf%")]);f0t.exports=function(e,r){var n=c0t(e,!!r);return typeof n=="function"&&BPr(e,".prototype.")>-1?d0t([n]):n}});var LCe=v((dwo,m0t)=>{"use strict";var qPr=Nee(),iV=DCe(),UPr=eV(),zPr=uj(),p0t=qPr("%Map%",!0),HPr=iV("Map.prototype.get",!0),VPr=iV("Map.prototype.set",!0),WPr=iV("Map.prototype.has",!0),KPr=iV("Map.prototype.delete",!0),GPr=iV("Map.prototype.size",!0);m0t.exports=!!p0t&&function(){var e,r={assert:function(n){if(!r.has(n))throw new zPr("Side channel does not contain "+UPr(n))},delete:function(n){if(e){var o=KPr(e,n);return GPr(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return HPr(e,n)},has:function(n){return e?WPr(e,n):!1},set:function(n,o){e||(e=new p0t),VPr(e,n,o)}};return r}});var g0t=v((fwo,h0t)=>{"use strict";var JPr=Nee(),Lee=DCe(),YPr=eV(),Dee=LCe(),ZPr=uj(),y$=JPr("%WeakMap%",!0),XPr=Lee("WeakMap.prototype.get",!0),QPr=Lee("WeakMap.prototype.set",!0),eEr=Lee("WeakMap.prototype.has",!0),tEr=Lee("WeakMap.prototype.delete",!0);h0t.exports=y$?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new ZPr("Side channel does not contain "+YPr(o))},delete:function(o){if(y$&&o&&(typeof o=="object"||typeof o=="function")){if(e)return tEr(e,o)}else if(Dee&&r)return r.delete(o);return!1},get:function(o){return y$&&o&&(typeof o=="object"||typeof o=="function")&&e?XPr(e,o):r&&r.get(o)},has:function(o){return y$&&o&&(typeof o=="object"||typeof o=="function")&&e?eEr(e,o):!!r&&r.has(o)},set:function(o,i){y$&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new y$),QPr(e,o,i)):Dee&&(r||(r=Dee()),r.set(o,i))}};return n}:Dee});var b0t=v((pwo,y0t)=>{"use strict";var rEr=uj(),nEr=eV(),oEr=Wvt(),iEr=LCe(),aEr=g0t(),sEr=aEr||iEr||oEr;y0t.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new rEr("Side channel does not contain "+nEr(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=sEr()),e.set(n,o)}};return r}});var Fee=v((mwo,_0t)=>{"use strict";var uEr=String.prototype.replace,lEr=/%20/g,FCe={RFC1738:"RFC1738",RFC3986:"RFC3986"};_0t.exports={default:FCe.RFC3986,formatters:{RFC1738:function(t){return uEr.call(t,lEr,"+")},RFC3986:function(t){return String(t)}},RFC1738:FCe.RFC1738,RFC3986:FCe.RFC3986}});var $Ce=v((hwo,w0t)=>{"use strict";var cEr=Fee(),kCe=Object.prototype.hasOwnProperty,cj=Array.isArray,J_=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),dEr=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(cj(n)){for(var o=[],i=0;i=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===cEr.RFC1738&&(l===40||l===41)){s+=a.charAt(u);continue}if(l<128){s=s+J_[l];continue}if(l<2048){s=s+(J_[192|l>>6]+J_[128|l&63]);continue}if(l<55296||l>=57344){s=s+(J_[224|l>>12]+J_[128|l>>6&63]+J_[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|a.charCodeAt(u)&1023),s+=J_[240|l>>18]+J_[128|l>>12&63]+J_[128|l>>6&63]+J_[128|l&63]}return s},gEr=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],o=0;o{"use strict";var C0t=b0t(),kee=$Ce(),aV=Fee(),wEr=Object.prototype.hasOwnProperty,S0t={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},EO=Array.isArray,SEr=Array.prototype.push,O0t=function(t,e){SEr.apply(t,EO(e)?e:[e])},xEr=Date.prototype.toISOString,x0t=aV.default,Zd={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:kee.encode,encodeValuesOnly:!1,format:x0t,formatter:aV.formatters[x0t],indices:!1,serializeDate:function(e){return xEr.call(e)},skipNulls:!1,strictNullHandling:!1},CEr=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},BCe={},OEr=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,b){for(var g=e,y=b,S=0,x=!1;(y=y.get(BCe))!==void 0&&!x;){var O=y.get(e);if(S+=1,typeof O<"u"){if(O===S)throw new RangeError("Cyclic object value");x=!0}typeof y.get(BCe)>"u"&&(S=0)}if(typeof u=="function"?g=u(r,g):g instanceof Date?g=d(g):n==="comma"&&EO(g)&&(g=kee.maybeMap(g,function(V){return V instanceof Date?d(V):V})),g===null){if(i)return s&&!m?s(r,Zd.encoder,h,"key",f):r;g=""}if(CEr(g)||kee.isBuffer(g)){if(s){var P=m?r:s(r,Zd.encoder,h,"key",f);return[p(P)+"="+p(s(g,Zd.encoder,h,"value",f))]}return[p(r)+"="+p(String(g))]}var E=[];if(typeof g>"u")return E;var A;if(n==="comma"&&EO(g))m&&s&&(g=kee.maybeMap(g,s)),A=[{value:g.length>0?g.join(",")||null:void 0}];else if(EO(u))A=u;else{var I=Object.keys(g);A=l?I.sort(l):I}for(var R=o&&EO(g)&&g.length===1?r+"[]":r,N=0;N"u"?Zd.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Zd.charsetSentinel,delimiter:typeof e.delimiter>"u"?Zd.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Zd.encode,encoder:typeof e.encoder=="function"?e.encoder:Zd.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Zd.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Zd.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Zd.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Zd.strictNullHandling}};P0t.exports=function(t,e){var r=t,n=PEr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):EO(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s;e&&e.arrayFormat in S0t?s=e.arrayFormat:e&&"indices"in e?s=e.indices?"indices":"repeat":s="indices";var u=S0t[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=C0t(),d=0;d0?m+p:""}});var I0t=v((ywo,A0t)=>{"use strict";var b$=$Ce(),qCe=Object.prototype.hasOwnProperty,EEr=Array.isArray,Xl={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:b$.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},TEr=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},T0t=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},AEr="utf8=%26%2310003%3B",IEr="utf8=%E2%9C%93",MEr=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-1&&(m=EEr(m)?[m]:m),qCe.call(n,p)?n[p]=b$.combine(n[p],m):n[p]=m}return n},REr=function(t,e,r,n){for(var o=n?e:T0t(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},jEr=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&&qCe.call(Object.prototype,l)&&!n.allowPrototypes)return;c.push(l)}for(var d=0;n.depth>0&&(u=s.exec(i))!==null&&d"u"?Xl.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Xl.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Xl.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Xl.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Xl.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Xl.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Xl.comma,decoder:typeof e.decoder=="function"?e.decoder:Xl.decoder,delimiter:typeof e.delimiter=="string"||b$.isRegExp(e.delimiter)?e.delimiter:Xl.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Xl.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Xl.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Xl.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Xl.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Xl.strictNullHandling}};A0t.exports=function(t,e){var r=NEr(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?MEr(t,r):t,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a{"use strict";var DEr=E0t(),LEr=I0t(),FEr=Fee();M0t.exports={formats:FEr,parse:LEr,stringify:DEr}});var j0t=v(_$=>{"use strict";var kEr=_$&&_$.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_$,"__esModule",{value:!0});_$.createRequestUrl=void 0;var $Er=kEr(R0t());function BEr(t,e){return Object.keys(e??{}).length>0?`${t}?${$Er.default.stringify(e,{arrayFormat:"repeat"})}`:t}_$.createRequestUrl=BEr});var L0t=v($ee=>{"use strict";var UCe,zCe,HCe,VCe,WCe;Object.defineProperty($ee,"__esModule",{value:!0});$ee.RUNTIME=void 0;var qEr=typeof window<"u"&&typeof window.document<"u",UEr=typeof self=="object"&&typeof self?.importScripts=="function"&&(((UCe=self.constructor)===null||UCe===void 0?void 0:UCe.name)==="DedicatedWorkerGlobalScope"||((zCe=self.constructor)===null||zCe===void 0?void 0:zCe.name)==="ServiceWorkerGlobalScope"||((HCe=self.constructor)===null||HCe===void 0?void 0:HCe.name)==="SharedWorkerGlobalScope"),N0t=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",D0t=typeof Bun<"u"&&typeof Bun.version<"u",zEr=typeof process<"u"&&!!process.version&&!!(!((VCe=process.versions)===null||VCe===void 0)&&VCe.node)&&!N0t&&!D0t,HEr=typeof navigator<"u"&&navigator?.product==="ReactNative",VEr=typeof globalThis<"u"&&((WCe=globalThis?.navigator)===null||WCe===void 0?void 0:WCe.userAgent)==="Cloudflare-Workers";$ee.RUNTIME=WEr();function WEr(){return qEr?{type:"browser",version:window.navigator.userAgent}:VEr?{type:"workerd"}:UEr?{type:"web-worker"}:N0t?{type:"deno",version:Deno.version.deno}:D0t?{type:"bun",version:Bun.version}:zEr?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:HEr?{type:"react-native"}:{type:"unknown"}}});var v$=v(Bee=>{"use strict";Object.defineProperty(Bee,"__esModule",{value:!0});Bee.RUNTIME=void 0;var KEr=L0t();Object.defineProperty(Bee,"RUNTIME",{enumerable:!0,get:function(){return KEr.RUNTIME}})});var KCe=v((w$,F0t)=>{"use strict";var GEr=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},dj=GEr();F0t.exports=w$=dj.fetch;dj.fetch&&(w$.default=dj.fetch.bind(dj));w$.Headers=dj.Headers;w$.Request=dj.Request;w$.Response=dj.Response});var $0t=v(og=>{"use strict";var JEr=og&&og.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YEr=og&&og.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k0t=og&&og.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JEr(e,t,r);return YEr(e,t),e},ZEr=og&&og.__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(og,"__esModule",{value:!0});og.getFetchFn=void 0;var qee=v$();function XEr(){return ZEr(this,void 0,void 0,function*(){return qee.RUNTIME.type==="node"&&qee.RUNTIME.parsedVersion!=null&&qee.RUNTIME.parsedVersion>=18?fetch:qee.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>k0t(KCe()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>k0t(KCe()))).default})}og.getFetchFn=XEr});var B0t=v(S$=>{"use strict";var QEr=S$&&S$.__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(S$,"__esModule",{value:!0});S$.getRequestBody=void 0;function eTr({body:t,type:e}){return QEr(this,void 0,void 0,function*(){return e.includes("json")?JSON.stringify(t):t})}S$.getRequestBody=eTr});var q0t=v(x$=>{"use strict";var ky=x$&&x$.__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(x$,"__esModule",{value:!0});x$.Node18UniversalStreamWrapper=void 0;var GCe=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=>ky(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",()=>ky(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>ky(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=>ky(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",()=>ky(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>ky(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 ky(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 ky(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 ky(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 ky(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:()=>ky(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}}}};x$.Node18UniversalStreamWrapper=GCe});var U0t=v(C$=>{"use strict";var sV=C$&&C$.__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(C$,"__esModule",{value:!0});C$.UndiciStreamWrapper=void 0;var JCe=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 sV(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 sV(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 sV(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 sV(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:()=>sV(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}}}};C$.UndiciStreamWrapper=JCe});var z0t=v(uA=>{"use strict";var Uee=uA&&uA.__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())})},tTr=uA&&uA.__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(uA,"__esModule",{value:!0});uA.NodePre18StreamWrapper=void 0;var YCe=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 Uee(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 Uee(this,void 0,void 0,function*(){let n=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var i=tTr(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 Uee(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 Uee(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};uA.NodePre18StreamWrapper=YCe});var H0t=v(ig=>{"use strict";var rTr=ig&&ig.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nTr=ig&&ig.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZCe=ig&&ig.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rTr(e,t,r);return nTr(e,t),e},oTr=ig&&ig.__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(ig,"__esModule",{value:!0});ig.chooseStreamWrapper=void 0;var zee=v$();function iTr(t){return oTr(this,void 0,void 0,function*(){return zee.RUNTIME.type==="node"&&zee.RUNTIME.parsedVersion!=null&&zee.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>ZCe(q0t()))).Node18UniversalStreamWrapper(t):zee.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>ZCe(U0t()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>ZCe(z0t()))).NodePre18StreamWrapper(t)})}ig.chooseStreamWrapper=iTr});var V0t=v(O$=>{"use strict";var aTr=O$&&O$.__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(O$,"__esModule",{value:!0});O$.getResponseBody=void 0;var sTr=H0t();function uTr(t,e){return aTr(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,sTr.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}})}O$.getResponseBody=uTr});var W0t=v(P$=>{"use strict";Object.defineProperty(P$,"__esModule",{value:!0});P$.anySignal=P$.getTimeoutSignal=void 0;var lTr="timeout";function cTr(t){let e=new AbortController,r=setTimeout(()=>e.abort(lTr),t);return{signal:e.signal,abortId:r}}P$.getTimeoutSignal=cTr;function dTr(...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}P$.anySignal=dTr});var G0t=v(E$=>{"use strict";var fTr=E$&&E$.__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(E$,"__esModule",{value:!0});E$.makeRequest=void 0;var K0t=W0t(),pTr=(t,e,r,n,o,i,a,s,u)=>fTr(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:m}=(0,K0t.getTimeoutSignal)(i);c=m,l.push(p)}a!=null&&l.push(a);let d=(0,K0t.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});E$.makeRequest=pTr});var J0t=v(T$=>{"use strict";var mTr=T$&&T$.__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(T$,"__esModule",{value:!0});T$.requestWithRetries=void 0;var hTr=1,gTr=60,yTr=2;function bTr(t,e=yTr){return mTr(this,void 0,void 0,function*(){let r=yield t();for(let n=0;n=500);++n){let o=Math.min(hTr*Math.pow(2,n),gTr);yield new Promise(i=>setTimeout(i,o)),r=yield t()}return r})}T$.requestWithRetries=bTr});var X0t=v(lA=>{"use strict";var Y0t=lA&&lA.__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(lA,"__esModule",{value:!0});lA.fetcher=lA.fetcherImpl=void 0;var _Tr=j0t(),vTr=$0t(),wTr=B0t(),STr=V0t(),xTr=G0t(),CTr=J0t();function Z0t(t){return Y0t(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,_Tr.createRequestUrl)(t.url,t.queryParameters),n=yield(0,wTr.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,vTr.getFetchFn)();try{let i=yield(0,CTr.requestWithRetries)(()=>Y0t(this,void 0,void 0,function*(){return(0,xTr.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,STr.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)}}}})}lA.fetcherImpl=Z0t;lA.fetcher=Z0t});var Q0t=v(Hee=>{"use strict";Object.defineProperty(Hee,"__esModule",{value:!0});Hee.getHeader=void 0;function OTr(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}Hee.getHeader=OTr});var eSt=v(A$=>{"use strict";var PTr=A$&&A$.__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(A$,"__esModule",{value:!0});A$.Supplier=void 0;A$.Supplier={get:t=>PTr(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var tSt=v(cA=>{"use strict";Object.defineProperty(cA,"__esModule",{value:!0});cA.Supplier=cA.getHeader=cA.fetcher=void 0;var ETr=X0t();Object.defineProperty(cA,"fetcher",{enumerable:!0,get:function(){return ETr.fetcher}});var TTr=Q0t();Object.defineProperty(cA,"getHeader",{enumerable:!0,get:function(){return TTr.getHeader}});var ATr=eSt();Object.defineProperty(cA,"Supplier",{enumerable:!0,get:function(){return ATr.Supplier}})});var rSt=v((XCe,QCe)=>{(function(t,e){typeof XCe=="object"&&typeof QCe<"u"?QCe.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:XCe,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(U){var W={};return U.forEach(function(Y,ae){return W[Y]=ae}),W}(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(U,W){return W===void 0&&(W=function(Y){return Y}),new Uint8Array(Array.prototype.slice.call(U,0).map(W))},p=function(U){return U.replace(/=/g,"").replace(/[+\/]/g,function(W){return W=="+"?"-":"_"})},m=function(U){return U.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(U){for(var W,Y,ae,Oe,le="",Be=U.length%3,ze=0;ze255||(ae=U.charCodeAt(ze++))>255||(Oe=U.charCodeAt(ze++))>255)throw new TypeError("invalid character found");W=Y<<16|ae<<8|Oe,le+=u[W>>18&63]+u[W>>12&63]+u[W>>6&63]+u[W&63]}return Be?le.slice(0,Be-3)+"===".substring(Be):le},b=n?function(U){return btoa(U)}:o?function(U){return Buffer.from(U,"binary").toString("base64")}:h,g=o?function(U){return Buffer.from(U).toString("base64")}:function(U){for(var W=4096,Y=[],ae=0,Oe=U.length;ae>>6)+d(128|W&63):d(224|W>>>12&15)+d(128|W>>>6&63)+d(128|W&63)}else{var W=65536+(U.charCodeAt(0)-55296)*1024+(U.charCodeAt(1)-56320);return d(240|W>>>18&7)+d(128|W>>>12&63)+d(128|W>>>6&63)+d(128|W&63)}},x=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,O=function(U){return U.replace(x,S)},P=o?function(U){return Buffer.from(U,"utf8").toString("base64")}:a?function(U){return g(a.encode(U))}:function(U){return b(O(U))},E=function(U,W){return W===void 0&&(W=!1),W?p(P(U)):P(U)},A=function(U){return E(U,!0)},I=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,R=function(U){switch(U.length){case 4:var W=(7&U.charCodeAt(0))<<18|(63&U.charCodeAt(1))<<12|(63&U.charCodeAt(2))<<6|63&U.charCodeAt(3),Y=W-65536;return d((Y>>>10)+55296)+d((Y&1023)+56320);case 3:return d((15&U.charCodeAt(0))<<12|(63&U.charCodeAt(1))<<6|63&U.charCodeAt(2));default:return d((31&U.charCodeAt(0))<<6|63&U.charCodeAt(1))}},N=function(U){return U.replace(I,R)},j=function(U){if(U=U.replace(/\s+/g,""),!c.test(U))throw new TypeError("malformed base64.");U+="==".slice(2-(U.length&3));for(var W,Y="",ae,Oe,le=0;le>16&255):Oe===64?d(W>>16&255,W>>8&255):d(W>>16&255,W>>8&255,W&255);return Y},$=r?function(U){return atob(m(U))}:o?function(U){return Buffer.from(U,"base64").toString("binary")}:j,k=o?function(U){return f(Buffer.from(U,"base64"))}:function(U){return f($(U),function(W){return W.charCodeAt(0)})},z=function(U){return k(Q(U))},V=o?function(U){return Buffer.from(U,"base64").toString("utf8")}:i?function(U){return i.decode(k(U))}:function(U){return N($(U))},Q=function(U){return m(U.replace(/[-_]/g,function(W){return W=="-"?"+":"/"}))},J=function(U){return V(Q(U))},D=function(U){if(typeof U!="string")return!1;var W=U.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(W)||!/[^\s0-9a-zA-Z\-_]/.test(W)},B=function(U){return{value:U,enumerable:!1,writable:!0,configurable:!0}},q=function(){var U=function(W,Y){return Object.defineProperty(String.prototype,W,B(Y))};U("fromBase64",function(){return J(this)}),U("toBase64",function(W){return E(this,W)}),U("toBase64URI",function(){return E(this,!0)}),U("toBase64URL",function(){return E(this,!0)}),U("toUint8Array",function(){return z(this)})},K=function(){var U=function(W,Y){return Object.defineProperty(Uint8Array.prototype,W,B(Y))};U("toBase64",function(W){return y(this,W)}),U("toBase64URI",function(){return y(this,!0)}),U("toBase64URL",function(){return y(this,!0)})},H=function(){q(),K()},ee={version:t,VERSION:e,atob:$,atobPolyfill:j,btoa:b,btoaPolyfill:h,fromBase64:J,toBase64:E,encode:E,encodeURI:A,encodeURL:A,utob:O,btou:N,decode:J,isValid:D,fromUint8Array:y,toUint8Array:z,extendString:q,extendUint8Array:K,extendBuiltins:H};return ee.Base64={},Object.keys(ee).forEach(function(U){return ee.Base64[U]=ee[U]}),ee})});var oSt=v(Vee=>{"use strict";Object.defineProperty(Vee,"__esModule",{value:!0});Vee.BasicAuth=void 0;var nSt=rSt(),ITr=/^Basic /i;Vee.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${nSt.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(ITr,""),r=nSt.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 iSt=v(Wee=>{"use strict";Object.defineProperty(Wee,"__esModule",{value:!0});Wee.BearerToken=void 0;var MTr=/^Bearer /i;Wee.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(MTr,"").trim()}});var aSt=v(I$=>{"use strict";Object.defineProperty(I$,"__esModule",{value:!0});I$.BearerToken=I$.BasicAuth=void 0;var RTr=oSt();Object.defineProperty(I$,"BasicAuth",{enumerable:!0,get:function(){return RTr.BasicAuth}});var jTr=iSt();Object.defineProperty(I$,"BearerToken",{enumerable:!0,get:function(){return jTr.BearerToken}})});var tOe=v(Np=>{"use strict";var sSt=Np&&Np.__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())})},uSt=Np&&Np.__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)}},$y=Np&&Np.__await||function(t){return this instanceof $y?(this.v=t,this):new $y(t)},lSt=Np&&Np.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof $y?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(Np,"__esModule",{value:!0});Np.readableStreamAsyncIterable=Np.Stream=void 0;var NTr=v$(),DTr="data:",eOe=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=DTr,this.messageTerminator=` +`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return lSt(this,arguments,function*(){var r,n;this.controller.signal;let o=cSt(this.stream),i="",a=!1;try{for(var s=uSt(o),u;u=yield $y(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 $y(void 0);let f=yield $y(this.parse(JSON.parse(d)));yield yield $y(f),a=!1}}}catch(l){r={error:l}}finally{try{u&&!u.done&&(n=s.return)&&(yield $y(n.call(s)))}finally{if(r)throw r.error}}})}[Symbol.asyncIterator](){return lSt(this,arguments,function*(){var r,n;try{for(var o=uSt(this.iterMessages()),i;i=yield $y(o.next()),!i.done;){let a=i.value;yield yield $y(a)}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&(yield $y(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 NTr.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};Np.Stream=eOe;function cSt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return sSt(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 sSt(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}Np.readableStreamAsyncIterable=cSt});var dSt=v(Kee=>{"use strict";Object.defineProperty(Kee,"__esModule",{value:!0});Kee.Stream=void 0;var LTr=tOe();Object.defineProperty(Kee,"Stream",{enumerable:!0,get:function(){return LTr.Stream}})});var mSt=v((qwo,pSt)=>{"use strict";var rOe=Object.defineProperty,FTr=Object.getOwnPropertyDescriptor,kTr=Object.getOwnPropertyNames,$Tr=Object.prototype.hasOwnProperty,BTr=(t,e)=>{for(var r in e)rOe(t,r,{get:e[r],enumerable:!0})},qTr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of kTr(e))!$Tr.call(t,o)&&o!==r&&rOe(t,o,{get:()=>e[o],enumerable:!(n=FTr(e,o))||n.enumerable});return t},UTr=t=>qTr(rOe({},"__esModule",{value:!0}),t),fSt={};BTr(fSt,{Blob:()=>VTr,File:()=>WTr,FormData:()=>HTr});pSt.exports=UTr(fSt);var zTr=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:HTr,Blob:VTr,File:WTr}=zTr});var ESt=v((Uwo,PSt)=>{"use strict";var iOe=Object.defineProperty,KTr=Object.getOwnPropertyDescriptor,GTr=Object.getOwnPropertyNames,JTr=Object.prototype.hasOwnProperty,YTr=(t,e)=>{for(var r in e)iOe(t,r,{get:e[r],enumerable:!0})},ZTr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of GTr(e))!JTr.call(t,o)&&o!==r&&iOe(t,o,{get:()=>e[o],enumerable:!(n=KTr(e,o))||n.enumerable});return t},XTr=t=>ZTr(iOe({},"__esModule",{value:!0}),t),aOe=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},fs=(t,e,r)=>(aOe(t,e,"read from private field"),r?r.call(t):e.get(t)),Y_=(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)},uV=(t,e,r,n)=>(aOe(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),nOe=(t,e,r)=>(aOe(t,e,"access private method"),r),wSt={};YTr(wSt,{FormDataEncoder:()=>aAr,isFile:()=>pj,isFormData:()=>CSt});PSt.exports=XTr(wSt);var TO=t=>typeof t=="function",QTr=t=>TO(t[Symbol.asyncIterator]),hSt=65536;function*SSt(t){if(t.byteLength<=hSt){yield t;return}let e=0;for(;e{if(QTr(t))return gSt(t);if(TO(t.getReader))return gSt(eAr(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},ySt="abcdefghijklmnopqrstuvwxyz0123456789";function rAr(){let t=16,e="";for(;t--;)e+=ySt[Math.random()*ySt.length<<0];return e}var xSt=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==` `||e===` `&&n[r-1]!=="\r"?`\r -`:e),XTr=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function mSt(t){if(XTr(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function hSt(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var QTr=t=>new Proxy(t,{get:(e,r)=>hSt(e,r),has:(e,r)=>hSt(e,r)!==void 0}),vSt=t=>!!(t&&EO(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&EO(t.append)&&EO(t.getAll)&&EO(t.entries)&&EO(t[Symbol.iterator])),gSt=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),fj=t=>!!(t&&typeof t=="object"&&EO(t.constructor)&&t[Symbol.toStringTag]==="File"&&EO(t.stream)&&t.name!=null),eAr={enableAdditionalHeaders:!1},Kee={writable:!1,configurable:!1},dA,uV,Gee,lV,dj,cV,dV,Jee,Yee,oOe,tOe,wSt,tAr=class{constructor(t,e,r){if(Y_(this,Yee),Y_(this,tOe),Y_(this,dA,`\r -`),Y_(this,uV,void 0),Y_(this,Gee,void 0),Y_(this,lV,"-".repeat(2)),Y_(this,dj,new TextEncoder),Y_(this,cV,void 0),Y_(this,dV,void 0),Y_(this,Jee,void 0),!vSt(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(mSt(e)?r=e:n=e,n||(n=ZTr()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!mSt(r))throw new TypeError("Expected options argument to be an object.");sV(this,dV,Array.from(t.entries())),sV(this,Jee,{...eAr,...r}),sV(this,uV,fs(this,dj).encode(fs(this,dA))),sV(this,Gee,fs(this,uV).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,sV(this,cV,fs(this,dj).encode(`${fs(this,lV)}${this.boundary}${fs(this,lV)}${fs(this,dA).repeat(2)}`));let o={"Content-Type":this.contentType},i=eOe(this,tOe,wSt).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=QTr(Object.freeze(o)),Object.defineProperties(this,{boundary:Kee,contentType:Kee,contentLength:Kee,headers:Kee})}*values(){for(let[t,e]of fs(this,dV)){let r=fj(e)?e:fs(this,dj).encode(_St(e));yield eOe(this,Yee,oOe).call(this,t,r),yield r,yield fs(this,uV)}yield fs(this,cV)}async*encode(){for(let t of this.values())fj(t)?yield*YTr(t.stream()):yield*bSt(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};dA=new WeakMap;uV=new WeakMap;Gee=new WeakMap;lV=new WeakMap;dj=new WeakMap;cV=new WeakMap;dV=new WeakMap;Jee=new WeakMap;Yee=new WeakSet;oOe=function(t,e){let r="";if(r+=`${fs(this,lV)}${this.boundary}${fs(this,dA)}`,r+=`Content-Disposition: form-data; name="${gSt(t)}"`,fj(e)&&(r+=`; filename="${gSt(e.name)}"${fs(this,dA)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),fs(this,Jee).enableAdditionalHeaders===!0){let n=fj(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${fs(this,dA)}Content-Length: ${n}`)}return fs(this,dj).encode(`${r}${fs(this,dA).repeat(2)}`)};tOe=new WeakSet;wSt=function(){let t=0;for(let[e,r]of fs(this,dV)){let n=fj(r)?r:fs(this,dj).encode(_St(r)),o=fj(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=eOe(this,Yee,oOe).call(this,e,n).byteLength,t+=o,t+=fs(this,Gee)}return String(t+fs(this,cV).byteLength)}});var OSt=v(($wo,CSt)=>{CSt.exports=typeof self=="object"?self.FormData:window.FormData});var PSt=v(Ql=>{"use strict";var rAr=Ql&&Ql.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nAr=Ql&&Ql.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I$=Ql&&Ql.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rAr(e,t,r);return nAr(e,t),e},fA=Ql&&Ql.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ql,"__esModule",{value:!0});Ql.WebFormData=Ql.Node16FormData=Ql.Node18FormData=Ql.newFormData=void 0;var Zee=_$();function iOe(t){return typeof t=="object"&&t!=null&&"name"in t}function oAr(){return fA(this,void 0,void 0,function*(){let t;return Zee.RUNTIME.type==="node"&&Zee.RUNTIME.parsedVersion!=null&&Zee.RUNTIME.parsedVersion>=18?t=new Xee:Zee.RUNTIME.type==="node"?t=new Qee:t=new ete,yield t.setup(),t})}Ql.newFormData=oAr;var Xee=class{setup(){return fA(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>I$(cSt()))).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 fA(this,void 0,void 0,function*(){n==null&&iOe(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>I$(JH()))).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 fA(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>I$(xSt()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>I$(JH()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};Ql.Node18FormData=Xee;var Qee=class{setup(){return fA(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>I$(OSt()))).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 fA(this,void 0,void 0,function*(){n==null&&iOe(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>I$(JH()))).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():{}}}};Ql.Node16FormData=Qee;var ete=class{setup(){return fA(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 fA(this,void 0,void 0,function*(){n==null&&iOe(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};Ql.WebFormData=ete});var ESt=v(pj=>{"use strict";var iAr=pj&&pj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aAr=pj&&pj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&iAr(e,t,r)};Object.defineProperty(pj,"__esModule",{value:!0});aAr(PSt(),pj)});var Uc=v(tte=>{"use strict";Object.defineProperty(tte,"__esModule",{value:!0});tte.SchemaType=void 0;tte.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 Dp=v(rte=>{"use strict";Object.defineProperty(rte,"__esModule",{value:!0});rte.getErrorMessageForIncorrectType=void 0;function sAr(t,e){return`Expected ${e}. Received ${uAr(t)}.`}rte.getErrorMessageForIncorrectType=sAr;function uAr(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 TO=v(nte=>{"use strict";Object.defineProperty(nte,"__esModule",{value:!0});nte.maybeSkipValidation=void 0;function lAr(t){return Object.assign(Object.assign({},t),{json:TSt(t.json),parse:TSt(t.parse)})}nte.maybeSkipValidation=lAr;function TSt(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 aOe=v(ote=>{"use strict";Object.defineProperty(ote,"__esModule",{value:!0});ote.stringifyValidationError=void 0;function cAr(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}ote.stringifyValidationError=cAr});var uOe=v(ite=>{"use strict";Object.defineProperty(ite,"__esModule",{value:!0});ite.JsonError=void 0;var dAr=aOe(),sOe=class t extends Error{constructor(e){super(e.map(dAr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};ite.JsonError=sOe});var cOe=v(ate=>{"use strict";Object.defineProperty(ate,"__esModule",{value:!0});ate.ParseError=void 0;var fAr=aOe(),lOe=class t extends Error{constructor(e){super(e.map(fAr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};ate.ParseError=lOe});var MSt=v(pA=>{"use strict";Object.defineProperty(pA,"__esModule",{value:!0});pA.transform=pA.optional=pA.getSchemaUtils=void 0;var pAr=Uc(),mAr=uOe(),hAr=cOe();function dOe(t){return{optional:()=>ASt(t),transform:e=>ISt(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new hAr.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new mAr.JsonError(n.errors)}}}pA.getSchemaUtils=dOe;function ASt(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:()=>pAr.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),dOe(e))}pA.optional=ASt;function ISt(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),dOe(r))}pA.transform=ISt});var Lm=v(ag=>{"use strict";Object.defineProperty(ag,"__esModule",{value:!0});ag.ParseError=ag.JsonError=ag.transform=ag.optional=ag.getSchemaUtils=void 0;var fOe=MSt();Object.defineProperty(ag,"getSchemaUtils",{enumerable:!0,get:function(){return fOe.getSchemaUtils}});Object.defineProperty(ag,"optional",{enumerable:!0,get:function(){return fOe.optional}});Object.defineProperty(ag,"transform",{enumerable:!0,get:function(){return fOe.transform}});var gAr=uOe();Object.defineProperty(ag,"JsonError",{enumerable:!0,get:function(){return gAr.JsonError}});var yAr=cOe();Object.defineProperty(ag,"ParseError",{enumerable:!0,get:function(){return yAr.ParseError}})});var RSt=v(ste=>{"use strict";Object.defineProperty(ste,"__esModule",{value:!0});ste.date=void 0;var bAr=Uc(),pOe=Dp(),_Ar=TO(),vAr=Lm(),wAr=/^([+-]?\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 SAr(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,pOe.getErrorMessageForIncorrectType)(e,"string")}]}:wAr.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,pOe.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,pOe.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>bAr.SchemaType.DATE};return Object.assign(Object.assign({},(0,_Ar.maybeSkipValidation)(t)),(0,vAr.getSchemaUtils)(t))}ste.date=SAr});var jSt=v(ute=>{"use strict";Object.defineProperty(ute,"__esModule",{value:!0});ute.date=void 0;var xAr=RSt();Object.defineProperty(ute,"date",{enumerable:!0,get:function(){return xAr.date}})});var AO=v(lte=>{"use strict";Object.defineProperty(lte,"__esModule",{value:!0});lte.createIdentitySchemaCreator=void 0;var CAr=Lm(),OAr=TO();function PAr(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,OAr.maybeSkipValidation)(r)),(0,CAr.getSchemaUtils)(r))}}lte.createIdentitySchemaCreator=PAr});var DSt=v(cte=>{"use strict";Object.defineProperty(cte,"__esModule",{value:!0});cte.enum_=void 0;var EAr=Uc(),TAr=AO(),NSt=Dp();function AAr(t){let e=new Set(t);return(0,TAr.createIdentitySchemaCreator)(EAr.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,NSt.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,NSt.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}cte.enum_=AAr});var mOe=v(dte=>{"use strict";Object.defineProperty(dte,"__esModule",{value:!0});dte.enum_=void 0;var IAr=DSt();Object.defineProperty(dte,"enum_",{enumerable:!0,get:function(){return IAr.enum_}})});var hOe=v(mA=>{"use strict";Object.defineProperty(mA,"__esModule",{value:!0});mA.getMemoizedSchema=mA.constructLazyBaseSchema=mA.lazy=void 0;var MAr=Lm();function RAr(t){let e=LSt(t);return Object.assign(Object.assign({},e),(0,MAr.getSchemaUtils)(e))}mA.lazy=RAr;function LSt(t){return{parse:(e,r)=>fte(t).parse(e,r),json:(e,r)=>fte(t).json(e,r),getType:()=>fte(t).getType()}}mA.constructLazyBaseSchema=LSt;function fte(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}mA.getMemoizedSchema=fte});var gOe=v(pte=>{"use strict";Object.defineProperty(pte,"__esModule",{value:!0});pte.entries=void 0;function jAr(t){return Object.entries(t)}pte.entries=jAr});var yOe=v(mte=>{"use strict";Object.defineProperty(mte,"__esModule",{value:!0});mte.filterObject=void 0;function NAr(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}mte.filterObject=NAr});var fV=v(hte=>{"use strict";Object.defineProperty(hte,"__esModule",{value:!0});hte.isPlainObject=void 0;function DAr(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}hte.isPlainObject=DAr});var bOe=v(gte=>{"use strict";Object.defineProperty(gte,"__esModule",{value:!0});gte.keys=void 0;function LAr(t){return Object.keys(t)}gte.keys=LAr});var FSt=v(yte=>{"use strict";Object.defineProperty(yte,"__esModule",{value:!0});yte.partition=void 0;function FAr(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}yte.partition=FAr});var BSt=v(M$=>{"use strict";Object.defineProperty(M$,"__esModule",{value:!0});M$.withParsedProperties=M$.getObjectLikeUtils=void 0;var kAr=yOe(),$Ar=Dp(),BAr=fV(),qAr=Lm();function kSt(t){return{withParsedProperties:e=>$St(t,e)}}M$.getObjectLikeUtils=kSt;function $St(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,BAr.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,$Ar.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,kAr.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,qAr.getSchemaUtils)(r)),kSt(r))}M$.withParsedProperties=$St});var pV=v(R$=>{"use strict";Object.defineProperty(R$,"__esModule",{value:!0});R$.withParsedProperties=R$.getObjectLikeUtils=void 0;var qSt=BSt();Object.defineProperty(R$,"getObjectLikeUtils",{enumerable:!0,get:function(){return qSt.getObjectLikeUtils}});Object.defineProperty(R$,"withParsedProperties",{enumerable:!0,get:function(){return qSt.withParsedProperties}})});var _Oe=v(j$=>{"use strict";Object.defineProperty(j$,"__esModule",{value:!0});j$.isProperty=j$.property=void 0;function UAr(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}j$.property=UAr;function zAr(t){return t.isProperty}j$.isProperty=zAr});var wOe=v(N$=>{"use strict";Object.defineProperty(N$,"__esModule",{value:!0});N$.getObjectUtils=N$.object=void 0;var hV=Uc(),USt=gOe(),zSt=yOe(),HAr=Dp(),VAr=fV(),KSt=bOe(),WAr=TO(),KAr=FSt(),GSt=pV(),JSt=Lm(),mV=_Oe();function GAr(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,mV.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,KSt.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,USt.entries)(t)){let u=(0,mV.isProperty)(s)?s.rawKey:a,l=(0,mV.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,WSt(l)&&i.push(u)}return HSt({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,USt.entries)(t)){let s=(0,mV.isProperty)(a)?a.valueSchema:a;WSt(s)&&o.push(i)}return HSt({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,mV.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:()=>hV.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,WAr.maybeSkipValidation)(e)),(0,JSt.getSchemaUtils)(e)),(0,GSt.getObjectLikeUtils)(e)),vOe(e))}N$.object=GAr;function HSt({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,VAr.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,HAr.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 vOe(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>VSt({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>VSt({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>hV.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,JSt.getSchemaUtils)(r)),(0,GSt.getObjectLikeUtils)(r)),vOe(r))}}}N$.getObjectUtils=vOe;function VSt({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,KAr.partition)((0,KSt.keys)(e),l=>o.has(l)),s=r((0,zSt.filterObject)(e,a)),u=n((0,zSt.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 WSt(t){return!JAr(t)}function JAr(t){switch(t.getType()){case hV.SchemaType.ANY:case hV.SchemaType.UNKNOWN:case hV.SchemaType.OPTIONAL:return!0;default:return!1}}});var YSt=v(bte=>{"use strict";Object.defineProperty(bte,"__esModule",{value:!0});bte.objectWithoutOptionalProperties=void 0;var YAr=wOe();function ZAr(t){return(0,YAr.object)(t)}bte.objectWithoutOptionalProperties=ZAr});var SOe=v(sg=>{"use strict";Object.defineProperty(sg,"__esModule",{value:!0});sg.property=sg.isProperty=sg.objectWithoutOptionalProperties=sg.object=sg.getObjectUtils=void 0;var ZSt=wOe();Object.defineProperty(sg,"getObjectUtils",{enumerable:!0,get:function(){return ZSt.getObjectUtils}});Object.defineProperty(sg,"object",{enumerable:!0,get:function(){return ZSt.object}});var XAr=YSt();Object.defineProperty(sg,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return XAr.objectWithoutOptionalProperties}});var XSt=_Oe();Object.defineProperty(sg,"isProperty",{enumerable:!0,get:function(){return XSt.isProperty}});Object.defineProperty(sg,"property",{enumerable:!0,get:function(){return XSt.property}})});var QSt=v(_te=>{"use strict";Object.defineProperty(_te,"__esModule",{value:!0});_te.lazyObject=void 0;var QAr=SOe(),eIr=pV(),tIr=Lm(),xOe=hOe();function rIr(t){let e=Object.assign(Object.assign({},(0,xOe.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,xOe.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,xOe.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,tIr.getSchemaUtils)(e)),(0,eIr.getObjectLikeUtils)(e)),(0,QAr.getObjectUtils)(e))}_te.lazyObject=rIr});var ext=v(D$=>{"use strict";Object.defineProperty(D$,"__esModule",{value:!0});D$.lazyObject=D$.lazy=void 0;var nIr=hOe();Object.defineProperty(D$,"lazy",{enumerable:!0,get:function(){return nIr.lazy}});var oIr=QSt();Object.defineProperty(D$,"lazyObject",{enumerable:!0,get:function(){return oIr.lazyObject}})});var rxt=v(vte=>{"use strict";Object.defineProperty(vte,"__esModule",{value:!0});vte.list=void 0;var iIr=Uc(),aIr=Dp(),sIr=TO(),uIr=Lm();function lIr(t){let e={parse:(r,n)=>txt(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)=>txt(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:()=>iIr.SchemaType.LIST};return Object.assign(Object.assign({},(0,sIr.maybeSkipValidation)(e)),(0,uIr.getSchemaUtils)(e))}vte.list=lIr;function txt(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,aIr.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var COe=v(wte=>{"use strict";Object.defineProperty(wte,"__esModule",{value:!0});wte.list=void 0;var cIr=rxt();Object.defineProperty(wte,"list",{enumerable:!0,get:function(){return cIr.list}})});var nxt=v(Ste=>{"use strict";Object.defineProperty(Ste,"__esModule",{value:!0});Ste.stringLiteral=void 0;var dIr=Uc(),fIr=AO(),pIr=Dp();function mIr(t){return(0,fIr.createIdentitySchemaCreator)(dIr.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,pIr.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}Ste.stringLiteral=mIr});var oxt=v(xte=>{"use strict";Object.defineProperty(xte,"__esModule",{value:!0});xte.booleanLiteral=void 0;var hIr=Uc(),gIr=AO(),yIr=Dp();function bIr(t){return(0,gIr.createIdentitySchemaCreator)(hIr.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,yIr.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}xte.booleanLiteral=bIr});var ixt=v(L$=>{"use strict";Object.defineProperty(L$,"__esModule",{value:!0});L$.booleanLiteral=L$.stringLiteral=void 0;var _Ir=nxt();Object.defineProperty(L$,"stringLiteral",{enumerable:!0,get:function(){return _Ir.stringLiteral}});var vIr=oxt();Object.defineProperty(L$,"booleanLiteral",{enumerable:!0,get:function(){return vIr.booleanLiteral}})});var axt=v(Cte=>{"use strict";Object.defineProperty(Cte,"__esModule",{value:!0});Cte.any=void 0;var wIr=Uc(),SIr=AO();Cte.any=(0,SIr.createIdentitySchemaCreator)(wIr.SchemaType.ANY,t=>({ok:!0,value:t}))});var sxt=v(Ote=>{"use strict";Object.defineProperty(Ote,"__esModule",{value:!0});Ote.boolean=void 0;var xIr=Uc(),CIr=AO(),OIr=Dp();Ote.boolean=(0,CIr.createIdentitySchemaCreator)(xIr.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,OIr.getErrorMessageForIncorrectType)(t,"boolean")}]})});var uxt=v(Pte=>{"use strict";Object.defineProperty(Pte,"__esModule",{value:!0});Pte.number=void 0;var PIr=Uc(),EIr=AO(),TIr=Dp();Pte.number=(0,EIr.createIdentitySchemaCreator)(PIr.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,TIr.getErrorMessageForIncorrectType)(t,"number")}]})});var lxt=v(Ete=>{"use strict";Object.defineProperty(Ete,"__esModule",{value:!0});Ete.string=void 0;var AIr=Uc(),IIr=AO(),MIr=Dp();Ete.string=(0,IIr.createIdentitySchemaCreator)(AIr.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,MIr.getErrorMessageForIncorrectType)(t,"string")}]})});var cxt=v(Tte=>{"use strict";Object.defineProperty(Tte,"__esModule",{value:!0});Tte.unknown=void 0;var RIr=Uc(),jIr=AO();Tte.unknown=(0,jIr.createIdentitySchemaCreator)(RIr.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var dxt=v(ug=>{"use strict";Object.defineProperty(ug,"__esModule",{value:!0});ug.unknown=ug.string=ug.number=ug.boolean=ug.any=void 0;var NIr=axt();Object.defineProperty(ug,"any",{enumerable:!0,get:function(){return NIr.any}});var DIr=sxt();Object.defineProperty(ug,"boolean",{enumerable:!0,get:function(){return DIr.boolean}});var LIr=uxt();Object.defineProperty(ug,"number",{enumerable:!0,get:function(){return LIr.number}});var FIr=lxt();Object.defineProperty(ug,"string",{enumerable:!0,get:function(){return FIr.string}});var kIr=cxt();Object.defineProperty(ug,"unknown",{enumerable:!0,get:function(){return kIr.unknown}})});var pxt=v(Ate=>{"use strict";Object.defineProperty(Ate,"__esModule",{value:!0});Ate.record=void 0;var OOe=Uc(),$Ir=gOe(),BIr=Dp(),qIr=fV(),UIr=TO(),zIr=Lm();function HIr(t,e){let r={parse:(n,o)=>fxt({value:n,isKeyNumeric:t.getType()===OOe.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)=>fxt({value:n,isKeyNumeric:t.getType()===OOe.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:()=>OOe.SchemaType.RECORD};return Object.assign(Object.assign({},(0,UIr.maybeSkipValidation)(r)),(0,zIr.getSchemaUtils)(r))}Ate.record=HIr;function fxt({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,qIr.isPlainObject)(t)?(0,$Ir.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,BIr.getErrorMessageForIncorrectType)(t,"object")}]}}});var mxt=v(Ite=>{"use strict";Object.defineProperty(Ite,"__esModule",{value:!0});Ite.record=void 0;var VIr=pxt();Object.defineProperty(Ite,"record",{enumerable:!0,get:function(){return VIr.record}})});var hxt=v(Mte=>{"use strict";Object.defineProperty(Mte,"__esModule",{value:!0});Mte.set=void 0;var WIr=Uc(),KIr=Dp(),GIr=TO(),JIr=COe(),YIr=Lm();function ZIr(t){let e=(0,JIr.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,KIr.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>WIr.SchemaType.SET};return Object.assign(Object.assign({},(0,GIr.maybeSkipValidation)(r)),(0,YIr.getSchemaUtils)(r))}Mte.set=ZIr});var gxt=v(Rte=>{"use strict";Object.defineProperty(Rte,"__esModule",{value:!0});Rte.set=void 0;var XIr=hxt();Object.defineProperty(Rte,"set",{enumerable:!0,get:function(){return XIr.set}})});var bxt=v(jte=>{"use strict";Object.defineProperty(jte,"__esModule",{value:!0});jte.undiscriminatedUnion=void 0;var QIr=Uc(),eMr=TO(),tMr=Lm();function rMr(t){let e={parse:(r,n)=>yxt((o,i)=>o.parse(r,i),t,n),json:(r,n)=>yxt((o,i)=>o.json(r,i),t,n),getType:()=>QIr.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,eMr.maybeSkipValidation)(e)),(0,tMr.getSchemaUtils)(e))}jte.undiscriminatedUnion=rMr;function yxt(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 _xt=v(Nte=>{"use strict";Object.defineProperty(Nte,"__esModule",{value:!0});Nte.undiscriminatedUnion=void 0;var nMr=bxt();Object.defineProperty(Nte,"undiscriminatedUnion",{enumerable:!0,get:function(){return nMr.undiscriminatedUnion}})});var vxt=v(Dte=>{"use strict";Object.defineProperty(Dte,"__esModule",{value:!0});Dte.discriminant=void 0;function oMr(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}Dte.discriminant=oMr});var Sxt=v(F$=>{"use strict";var iMr=F$&&F$.__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);owxt({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)=>wxt({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:()=>aMr.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,cMr.maybeSkipValidation)(i)),(0,pMr.getSchemaUtils)(i)),(0,fMr.getObjectLikeUtils)(i))}F$.union=mMr;function wxt({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,uMr.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,sMr.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=iMr(u,[typeof l=="symbol"?l:l+""]);if(c==null)return{ok:!1,errors:[{path:s,message:`Missing discriminant ("${e}")`}]};let f=n(c);if(!f.ok)return{ok:!1,errors:f.errors};let p=o(f.value);if(p==null)return i?{ok:!0,value:Object.assign({[r]:f.value},d)}:{ok:!1,errors:[{path:[...s,e],message:"Unexpected discriminant value"}]};let m=a(d,p);return m.ok?{ok:!0,value:Object.assign({[r]:c},m.value)}:m}});var xxt=v(k$=>{"use strict";Object.defineProperty(k$,"__esModule",{value:!0});k$.union=k$.discriminant=void 0;var hMr=vxt();Object.defineProperty(k$,"discriminant",{enumerable:!0,get:function(){return hMr.discriminant}});var gMr=Sxt();Object.defineProperty(k$,"union",{enumerable:!0,get:function(){return gMr.union}})});var Cxt=v(Ml=>{"use strict";var yMr=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]}),Fm=Ml&&Ml.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yMr(e,t,r)};Object.defineProperty(Ml,"__esModule",{value:!0});Fm(jSt(),Ml);Fm(mOe(),Ml);Fm(ext(),Ml);Fm(COe(),Ml);Fm(ixt(),Ml);Fm(SOe(),Ml);Fm(pV(),Ml);Fm(dxt(),Ml);Fm(mxt(),Ml);Fm(Lm(),Ml);Fm(gxt(),Ml);Fm(_xt(),Ml);Fm(xxt(),Ml)});var Oxt=v(mj=>{"use strict";var bMr=mj&&mj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=mj&&mj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bMr(e,t,r)};Object.defineProperty(mj,"__esModule",{value:!0});_Mr(Cxt(),mj)});var G=v(zc=>{"use strict";var Pxt=zc&&zc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vMr=zc&&zc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gV=zc&&zc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Pxt(e,t,r)},wMr=zc&&zc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Pxt(e,t,r);return vMr(e,t),e};Object.defineProperty(zc,"__esModule",{value:!0});zc.serialization=void 0;gV(Z0t(),zc);gV(rSt(),zc);gV(sSt(),zc);gV(_$(),zc);gV(ESt(),zc);zc.serialization=wMr(Oxt())});var Txt=v(Vs=>{"use strict";var yV=Vs&&Vs.__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())})},bV=Vs&&Vs.__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)}},Ta=Vs&&Vs.__await||function(t){return this instanceof Ta?(this.v=t,this):new Ta(t)},_V=Vs&&Vs.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof Ta?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(Vs,"__esModule",{value:!0});Vs.readableStreamAsyncIterable=Vs._decodeChunks=Vs.LineDecoder=Vs._iterSSEMessages=Vs.StreamUtils=void 0;var $$=As(),POe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return _V(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=bV(Ext(e,r)),c;c=yield Ta(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 $$.CohereError({message:`Error: ${f.error}`});yield yield Ta(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 $$.CohereError({message:`Error: ${f.message}, ${f.error}`});yield yield Ta({event:d.event,data:f})}}}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&(yield Ta(s.call(l)))}finally{if(a)throw a.error}}u=!0}catch(d){if(d instanceof Error&&d.name==="AbortError")return yield Ta(void 0);throw d}finally{u||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return _V(this,arguments,function*(){var s,u;let l=new hA,c=TOe(e);try{for(var d=bV(c),f;f=yield Ta(d.next()),!f.done;){let p=f.value;for(let m of l.decode(p))yield yield Ta(m)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(u=d.return)&&(yield Ta(u.call(d)))}finally{if(s)throw s.error}}for(let p of l.flush())yield yield Ta(p)})}function i(){return _V(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=bV(o()),d;d=yield Ta(c.next()),!d.done;){let f=d.value;l||f&&(yield yield Ta(JSON.parse(f)))}}catch(f){s={error:f}}finally{try{d&&!d.done&&(u=c.return)&&(yield Ta(u.call(c)))}finally{if(s)throw s.error}}l=!0}catch(f){if(f instanceof Error&&f.name==="AbortError")return yield Ta(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 yV(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return yV(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 yV(this,void 0,void 0,function*(){yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};Vs.StreamUtils=POe;function Ext(t,e){return _V(this,arguments,function*(){var n,o;if(!t.body)throw e?.abort(),new $$.CohereError({message:"Attempted to iterate over a response with no body"});let i=new EOe,a=new hA,s=TOe(t.body);try{for(var u=bV(SMr(s)),l;l=yield Ta(u.next()),!l.done;){let c=l.value;for(let d of a.decode(c)){let f=i.decode(d);f&&(yield yield Ta(f))}}}catch(c){n={error:c}}finally{try{l&&!l.done&&(o=u.return)&&(yield Ta(o.call(u)))}finally{if(n)throw n.error}}for(let c of a.flush()){let d=i.decode(c);d&&(yield yield Ta(d))}})}Vs._iterSSEMessages=Ext;function SMr(t){return _V(this,arguments,function*(){var r,n;let o=new Uint8Array;try{for(var i=bV(t),a;a=yield Ta(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=xMr(o))!==-1;)yield yield Ta(o.slice(0,c)),o=o.slice(c)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&(yield Ta(n.call(i)))}finally{if(r)throw r.error}}o.length>0&&(yield yield Ta(o))})}function xMr(t){for(let n=0;n0&&(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 $$.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 $$.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new $$.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}};Vs.LineDecoder=hA;hA.NEWLINE_CHARS=new Set([` -`,"\r"]);hA.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function CMr(t){let e=new hA,r=[];for(let n of t)r.push(...e.decode(n));return r}Vs._decodeChunks=CMr;function OMr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function TOe(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return yV(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 yV(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}Vs.readableStreamAsyncIterable=TOe});var AOe=v(Z_=>{"use strict";var PMr=Z_&&Z_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EMr=Z_&&Z_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TMr=Z_&&Z_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PMr(e,t,r);return EMr(e,t),e};Object.defineProperty(Z_,"__esModule",{value:!0});Z_.V2ChatStreamRequestCitationMode=void 0;var AMr=TMr(G());Z_.V2ChatStreamRequestCitationMode=AMr.serialization.enum_(["FAST","ACCURATE","OFF"])});var IOe=v(X_=>{"use strict";var IMr=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]}),MMr=X_&&X_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RMr=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)&&IMr(e,t,r);return MMr(e,t),e};Object.defineProperty(X_,"__esModule",{value:!0});X_.V2ChatRequestCitationMode=void 0;var jMr=RMr(G());X_.V2ChatRequestCitationMode=jMr.serialization.enum_(["FAST","ACCURATE","OFF"])});var B$=v(Q_=>{"use strict";var NMr=Q_&&Q_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DMr=Q_&&Q_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LMr=Q_&&Q_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NMr(e,t,r);return DMr(e,t),e};Object.defineProperty(Q_,"__esModule",{value:!0});Q_.TextContent=void 0;var Axt=LMr(G());Q_.TextContent=Axt.serialization.object({text:Axt.serialization.string()})});var MOe=v(ev=>{"use strict";var FMr=ev&&ev.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kMr=ev&&ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Mr=ev&&ev.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FMr(e,t,r);return kMr(e,t),e};Object.defineProperty(ev,"__esModule",{value:!0});ev.Content=void 0;var BMr=$Mr(G()),qMr=B$();ev.Content=BMr.serialization.union("type",{text:qMr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var jOe=v(tv=>{"use strict";var UMr=tv&&tv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zMr=tv&&tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HMr=tv&&tv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UMr(e,t,r);return zMr(e,t),e};Object.defineProperty(tv,"__esModule",{value:!0});tv.UserMessageContent=void 0;var ROe=HMr(G()),VMr=MOe();tv.UserMessageContent=ROe.serialization.undiscriminatedUnion([ROe.serialization.string(),ROe.serialization.list(VMr.Content)])});var hj=v(rv=>{"use strict";var WMr=rv&&rv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KMr=rv&&rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GMr=rv&&rv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WMr(e,t,r);return KMr(e,t),e};Object.defineProperty(rv,"__esModule",{value:!0});rv.ChatDocument=void 0;var NOe=GMr(G());rv.ChatDocument=NOe.serialization.record(NOe.serialization.string(),NOe.serialization.string())});var DOe=v(nv=>{"use strict";var JMr=nv&&nv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YMr=nv&&nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZMr=nv&&nv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JMr(e,t,r);return YMr(e,t),e};Object.defineProperty(nv,"__esModule",{value:!0});nv.UserMessage=void 0;var Ixt=ZMr(G()),XMr=jOe(),QMr=hj();nv.UserMessage=Ixt.serialization.object({content:XMr.UserMessageContent,documents:Ixt.serialization.list(QMr.ChatDocument).optional()})});var FOe=v(ov=>{"use strict";var eRr=ov&&ov.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tRr=ov&&ov.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rRr=ov&&ov.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eRr(e,t,r);return tRr(e,t),e};Object.defineProperty(ov,"__esModule",{value:!0});ov.ToolCall2Function=void 0;var LOe=rRr(G());ov.ToolCall2Function=LOe.serialization.object({name:LOe.serialization.string().optional(),arguments:LOe.serialization.string().optional()})});var Lte=v(iv=>{"use strict";var nRr=iv&&iv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oRr=iv&&iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iRr=iv&&iv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nRr(e,t,r);return oRr(e,t),e};Object.defineProperty(iv,"__esModule",{value:!0});iv.ToolCall2=void 0;var kOe=iRr(G()),aRr=FOe();iv.ToolCall2=kOe.serialization.object({id:kOe.serialization.string().optional(),type:kOe.serialization.stringLiteral("function").optional(),function:aRr.ToolCall2Function.optional()})});var $Oe=v(av=>{"use strict";var sRr=av&&av.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uRr=av&&av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lRr=av&&av.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sRr(e,t,r);return uRr(e,t),e};Object.defineProperty(av,"__esModule",{value:!0});av.ToolSource=void 0;var q$=lRr(G());av.ToolSource=q$.serialization.object({id:q$.serialization.string().optional(),toolOutput:q$.serialization.property("tool_output",q$.serialization.record(q$.serialization.string(),q$.serialization.unknown()).optional())})});var BOe=v(sv=>{"use strict";var cRr=sv&&sv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dRr=sv&&sv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fRr=sv&&sv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cRr(e,t,r);return dRr(e,t),e};Object.defineProperty(sv,"__esModule",{value:!0});sv.DocumentSource=void 0;var vV=fRr(G());sv.DocumentSource=vV.serialization.object({id:vV.serialization.string().optional(),document:vV.serialization.record(vV.serialization.string(),vV.serialization.unknown()).optional()})});var qOe=v(uv=>{"use strict";var pRr=uv&&uv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mRr=uv&&uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hRr=uv&&uv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pRr(e,t,r);return mRr(e,t),e};Object.defineProperty(uv,"__esModule",{value:!0});uv.Source=void 0;var gRr=hRr(G()),yRr=$Oe(),bRr=BOe();uv.Source=gRr.serialization.union("type",{tool:yRr.ToolSource,document:bRr.DocumentSource}).transform({transform:t=>t,untransform:t=>t})});var SV=v(lv=>{"use strict";var _Rr=lv&&lv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vRr=lv&&lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wRr=lv&&lv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Rr(e,t,r);return vRr(e,t),e};Object.defineProperty(lv,"__esModule",{value:!0});lv.Citation=void 0;var wV=wRr(G()),SRr=qOe();lv.Citation=wV.serialization.object({start:wV.serialization.number().optional(),end:wV.serialization.number().optional(),text:wV.serialization.string().optional(),sources:wV.serialization.list(SRr.Source).optional()})});var UOe=v(cv=>{"use strict";var xRr=cv&&cv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CRr=cv&&cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ORr=cv&&cv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xRr(e,t,r);return CRr(e,t),e};Object.defineProperty(cv,"__esModule",{value:!0});cv.AssistantMessageContentItem=void 0;var PRr=ORr(G()),ERr=B$();cv.AssistantMessageContentItem=PRr.serialization.union("type",{text:ERr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var HOe=v(dv=>{"use strict";var TRr=dv&&dv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ARr=dv&&dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IRr=dv&&dv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TRr(e,t,r);return ARr(e,t),e};Object.defineProperty(dv,"__esModule",{value:!0});dv.AssistantMessageContent=void 0;var zOe=IRr(G()),MRr=UOe();dv.AssistantMessageContent=zOe.serialization.undiscriminatedUnion([zOe.serialization.string(),zOe.serialization.list(MRr.AssistantMessageContentItem)])});var VOe=v(fv=>{"use strict";var RRr=fv&&fv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jRr=fv&&fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NRr=fv&&fv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RRr(e,t,r);return jRr(e,t),e};Object.defineProperty(fv,"__esModule",{value:!0});fv.AssistantMessage=void 0;var U$=NRr(G()),DRr=Lte(),LRr=HOe(),FRr=SV();fv.AssistantMessage=U$.serialization.object({toolCalls:U$.serialization.property("tool_calls",U$.serialization.list(DRr.ToolCall2).optional()),toolPlan:U$.serialization.property("tool_plan",U$.serialization.string().optional()),content:LRr.AssistantMessageContent.optional(),citations:U$.serialization.list(FRr.Citation).optional()})});var WOe=v(pv=>{"use strict";var kRr=pv&&pv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Rr=pv&&pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BRr=pv&&pv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kRr(e,t,r);return $Rr(e,t),e};Object.defineProperty(pv,"__esModule",{value:!0});pv.SystemMessageContentItem=void 0;var qRr=BRr(G()),URr=B$();pv.SystemMessageContentItem=qRr.serialization.union("type",{text:URr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var GOe=v(mv=>{"use strict";var zRr=mv&&mv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HRr=mv&&mv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VRr=mv&&mv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zRr(e,t,r);return HRr(e,t),e};Object.defineProperty(mv,"__esModule",{value:!0});mv.SystemMessageContent=void 0;var KOe=VRr(G()),WRr=WOe();mv.SystemMessageContent=KOe.serialization.undiscriminatedUnion([KOe.serialization.string(),KOe.serialization.list(WRr.SystemMessageContentItem)])});var JOe=v(hv=>{"use strict";var KRr=hv&&hv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GRr=hv&&hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JRr=hv&&hv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KRr(e,t,r);return GRr(e,t),e};Object.defineProperty(hv,"__esModule",{value:!0});hv.SystemMessage=void 0;var YRr=JRr(G()),ZRr=GOe();hv.SystemMessage=YRr.serialization.object({content:ZRr.SystemMessageContent})});var YOe=v(gv=>{"use strict";var XRr=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]}),QRr=gv&&gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e1r=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)&&XRr(e,t,r);return QRr(e,t),e};Object.defineProperty(gv,"__esModule",{value:!0});gv.ToolContent=void 0;var Fte=e1r(G());gv.ToolContent=Fte.serialization.object({output:Fte.serialization.record(Fte.serialization.string(),Fte.serialization.unknown())})});var ZOe=v(yv=>{"use strict";var t1r=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]}),r1r=yv&&yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n1r=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)&&t1r(e,t,r);return r1r(e,t),e};Object.defineProperty(yv,"__esModule",{value:!0});yv.ToolMessage2ToolContentItem=void 0;var o1r=n1r(G()),i1r=YOe();yv.ToolMessage2ToolContentItem=o1r.serialization.union("type",{tool_result_object:i1r.ToolContent}).transform({transform:t=>t,untransform:t=>t})});var XOe=v(bv=>{"use strict";var a1r=bv&&bv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s1r=bv&&bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u1r=bv&&bv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&a1r(e,t,r);return s1r(e,t),e};Object.defineProperty(bv,"__esModule",{value:!0});bv.ToolMessage2=void 0;var xV=u1r(G()),l1r=ZOe();bv.ToolMessage2=xV.serialization.object({toolCallId:xV.serialization.property("tool_call_id",xV.serialization.string()),toolContent:xV.serialization.property("tool_content",xV.serialization.list(l1r.ToolMessage2ToolContentItem))})});var QOe=v(_v=>{"use strict";var c1r=_v&&_v.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d1r=_v&&_v.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f1r=_v&&_v.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&c1r(e,t,r);return d1r(e,t),e};Object.defineProperty(_v,"__esModule",{value:!0});_v.ChatMessage2=void 0;var p1r=f1r(G()),m1r=DOe(),h1r=VOe(),g1r=JOe(),y1r=XOe();_v.ChatMessage2=p1r.serialization.union("role",{user:m1r.UserMessage,assistant:h1r.AssistantMessage,system:g1r.SystemMessage,tool:y1r.ToolMessage2}).transform({transform:t=>t,untransform:t=>t})});var kte=v(vv=>{"use strict";var b1r=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]}),_1r=vv&&vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v1r=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)&&b1r(e,t,r);return _1r(e,t),e};Object.defineProperty(vv,"__esModule",{value:!0});vv.ChatMessages=void 0;var w1r=v1r(G()),S1r=QOe();vv.ChatMessages=w1r.serialization.list(S1r.ChatMessage2)});var ePe=v(wv=>{"use strict";var x1r=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]}),C1r=wv&&wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O1r=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)&&x1r(e,t,r);return C1r(e,t),e};Object.defineProperty(wv,"__esModule",{value:!0});wv.Tool2Function=void 0;var z$=O1r(G());wv.Tool2Function=z$.serialization.object({name:z$.serialization.string().optional(),description:z$.serialization.string().optional(),parameters:z$.serialization.record(z$.serialization.string(),z$.serialization.unknown()).optional()})});var $te=v(Sv=>{"use strict";var P1r=Sv&&Sv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E1r=Sv&&Sv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T1r=Sv&&Sv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P1r(e,t,r);return E1r(e,t),e};Object.defineProperty(Sv,"__esModule",{value:!0});Sv.Tool2=void 0;var Mxt=T1r(G()),A1r=ePe();Sv.Tool2=Mxt.serialization.object({type:Mxt.serialization.stringLiteral("function").optional(),function:A1r.Tool2Function.optional()})});var Bte=v(xv=>{"use strict";var I1r=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]}),M1r=xv&&xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R1r=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)&&I1r(e,t,r);return M1r(e,t),e};Object.defineProperty(xv,"__esModule",{value:!0});xv.ChatFinishReason=void 0;var j1r=R1r(G());xv.ChatFinishReason=j1r.serialization.enum_(["complete","stop_sequence","max_tokens","tool_call","error","content_blocked","error_limit"])});var tPe=v(Cv=>{"use strict";var N1r=Cv&&Cv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D1r=Cv&&Cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L1r=Cv&&Cv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&N1r(e,t,r);return D1r(e,t),e};Object.defineProperty(Cv,"__esModule",{value:!0});Cv.AssistantMessageResponseContentItem=void 0;var F1r=L1r(G()),k1r=B$();Cv.AssistantMessageResponseContentItem=F1r.serialization.union("type",{text:k1r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var rPe=v(Ov=>{"use strict";var $1r=Ov&&Ov.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B1r=Ov&&Ov.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q1r=Ov&&Ov.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$1r(e,t,r);return B1r(e,t),e};Object.defineProperty(Ov,"__esModule",{value:!0});Ov.AssistantMessageResponse=void 0;var gA=q1r(G()),U1r=Lte(),z1r=tPe(),H1r=SV();Ov.AssistantMessageResponse=gA.serialization.object({role:gA.serialization.stringLiteral("assistant"),toolCalls:gA.serialization.property("tool_calls",gA.serialization.list(U1r.ToolCall2).optional()),toolPlan:gA.serialization.property("tool_plan",gA.serialization.string().optional()),content:gA.serialization.list(z1r.AssistantMessageResponseContentItem).optional(),citations:gA.serialization.list(H1r.Citation).optional()})});var nPe=v(Pv=>{"use strict";var V1r=Pv&&Pv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W1r=Pv&&Pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K1r=Pv&&Pv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&V1r(e,t,r);return W1r(e,t),e};Object.defineProperty(Pv,"__esModule",{value:!0});Pv.UsageBilledUnits=void 0;var yA=K1r(G());Pv.UsageBilledUnits=yA.serialization.object({inputTokens:yA.serialization.property("input_tokens",yA.serialization.number().optional()),outputTokens:yA.serialization.property("output_tokens",yA.serialization.number().optional()),searchUnits:yA.serialization.property("search_units",yA.serialization.number().optional()),classifications:yA.serialization.number().optional()})});var oPe=v(Ev=>{"use strict";var G1r=Ev&&Ev.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J1r=Ev&&Ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y1r=Ev&&Ev.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G1r(e,t,r);return J1r(e,t),e};Object.defineProperty(Ev,"__esModule",{value:!0});Ev.UsageTokens=void 0;var CV=Y1r(G());Ev.UsageTokens=CV.serialization.object({inputTokens:CV.serialization.property("input_tokens",CV.serialization.number().optional()),outputTokens:CV.serialization.property("output_tokens",CV.serialization.number().optional())})});var qte=v(Tv=>{"use strict";var Z1r=Tv&&Tv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X1r=Tv&&Tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q1r=Tv&&Tv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Z1r(e,t,r);return X1r(e,t),e};Object.defineProperty(Tv,"__esModule",{value:!0});Tv.Usage=void 0;var Rxt=Q1r(G()),ejr=nPe(),tjr=oPe();Tv.Usage=Rxt.serialization.object({billedUnits:Rxt.serialization.property("billed_units",ejr.UsageBilledUnits.optional()),tokens:tjr.UsageTokens.optional()})});var jxt=v(Av=>{"use strict";var rjr=Av&&Av.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),njr=Av&&Av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ojr=Av&&Av.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rjr(e,t,r);return njr(e,t),e};Object.defineProperty(Av,"__esModule",{value:!0});Av.NonStreamedChatResponse2=void 0;var Ute=ojr(G()),ijr=Bte(),ajr=rPe(),sjr=qte();Av.NonStreamedChatResponse2=Ute.serialization.object({id:Ute.serialization.string(),finishReason:Ute.serialization.property("finish_reason",ijr.ChatFinishReason),prompt:Ute.serialization.string().optional(),message:ajr.AssistantMessageResponse.optional(),usage:sjr.Usage.optional()})});var km=v(Iv=>{"use strict";var ujr=Iv&&Iv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ljr=Iv&&Iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cjr=Iv&&Iv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ujr(e,t,r);return ljr(e,t),e};Object.defineProperty(Iv,"__esModule",{value:!0});Iv.ChatStreamEventType=void 0;var djr=cjr(G());Iv.ChatStreamEventType=djr.serialization.object({})});var iPe=v(Mv=>{"use strict";var fjr=Mv&&Mv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pjr=Mv&&Mv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mjr=Mv&&Mv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fjr(e,t,r);return pjr(e,t),e};Object.defineProperty(Mv,"__esModule",{value:!0});Mv.ChatMessageStartEventDeltaMessage=void 0;var Nxt=mjr(G());Mv.ChatMessageStartEventDeltaMessage=Nxt.serialization.object({role:Nxt.serialization.stringLiteral("assistant").optional()})});var aPe=v(Rv=>{"use strict";var hjr=Rv&&Rv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gjr=Rv&&Rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yjr=Rv&&Rv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hjr(e,t,r);return gjr(e,t),e};Object.defineProperty(Rv,"__esModule",{value:!0});Rv.ChatMessageStartEventDelta=void 0;var bjr=yjr(G()),_jr=iPe();Rv.ChatMessageStartEventDelta=bjr.serialization.object({message:_jr.ChatMessageStartEventDeltaMessage.optional()})});var sPe=v(jv=>{"use strict";var vjr=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]}),wjr=jv&&jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sjr=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)&&vjr(e,t,r);return wjr(e,t),e};Object.defineProperty(jv,"__esModule",{value:!0});jv.ChatMessageStartEvent=void 0;var Dxt=Sjr(G()),xjr=aPe(),Cjr=km();jv.ChatMessageStartEvent=Dxt.serialization.object({id:Dxt.serialization.string().optional(),delta:xjr.ChatMessageStartEventDelta.optional()}).extend(Cjr.ChatStreamEventType)});var lPe=v(Nv=>{"use strict";var Ojr=Nv&&Nv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pjr=Nv&&Nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ejr=Nv&&Nv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ojr(e,t,r);return Pjr(e,t),e};Object.defineProperty(Nv,"__esModule",{value:!0});Nv.ChatContentStartEventDeltaMessageContent=void 0;var uPe=Ejr(G());Nv.ChatContentStartEventDeltaMessageContent=uPe.serialization.object({text:uPe.serialization.string().optional(),type:uPe.serialization.stringLiteral("text").optional()})});var cPe=v(Dv=>{"use strict";var Tjr=Dv&&Dv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ajr=Dv&&Dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ijr=Dv&&Dv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tjr(e,t,r);return Ajr(e,t),e};Object.defineProperty(Dv,"__esModule",{value:!0});Dv.ChatContentStartEventDeltaMessage=void 0;var Mjr=Ijr(G()),Rjr=lPe();Dv.ChatContentStartEventDeltaMessage=Mjr.serialization.object({content:Rjr.ChatContentStartEventDeltaMessageContent.optional()})});var dPe=v(Lv=>{"use strict";var jjr=Lv&&Lv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Njr=Lv&&Lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Djr=Lv&&Lv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jjr(e,t,r);return Njr(e,t),e};Object.defineProperty(Lv,"__esModule",{value:!0});Lv.ChatContentStartEventDelta=void 0;var Ljr=Djr(G()),Fjr=cPe();Lv.ChatContentStartEventDelta=Ljr.serialization.object({message:Fjr.ChatContentStartEventDeltaMessage.optional()})});var fPe=v(Fv=>{"use strict";var kjr=Fv&&Fv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$jr=Fv&&Fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bjr=Fv&&Fv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kjr(e,t,r);return $jr(e,t),e};Object.defineProperty(Fv,"__esModule",{value:!0});Fv.ChatContentStartEvent=void 0;var Lxt=Bjr(G()),qjr=dPe(),Ujr=km();Fv.ChatContentStartEvent=Lxt.serialization.object({index:Lxt.serialization.number().optional(),delta:qjr.ChatContentStartEventDelta.optional()}).extend(Ujr.ChatStreamEventType)});var pPe=v(kv=>{"use strict";var zjr=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]}),Hjr=kv&&kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vjr=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)&&zjr(e,t,r);return Hjr(e,t),e};Object.defineProperty(kv,"__esModule",{value:!0});kv.ChatContentDeltaEventDeltaMessageContent=void 0;var Fxt=Vjr(G());kv.ChatContentDeltaEventDeltaMessageContent=Fxt.serialization.object({text:Fxt.serialization.string().optional()})});var mPe=v($v=>{"use strict";var Wjr=$v&&$v.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kjr=$v&&$v.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gjr=$v&&$v.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Wjr(e,t,r);return Kjr(e,t),e};Object.defineProperty($v,"__esModule",{value:!0});$v.ChatContentDeltaEventDeltaMessage=void 0;var Jjr=Gjr(G()),Yjr=pPe();$v.ChatContentDeltaEventDeltaMessage=Jjr.serialization.object({content:Yjr.ChatContentDeltaEventDeltaMessageContent.optional()})});var hPe=v(Bv=>{"use strict";var Zjr=Bv&&Bv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xjr=Bv&&Bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qjr=Bv&&Bv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zjr(e,t,r);return Xjr(e,t),e};Object.defineProperty(Bv,"__esModule",{value:!0});Bv.ChatContentDeltaEventDelta=void 0;var eNr=Qjr(G()),tNr=mPe();Bv.ChatContentDeltaEventDelta=eNr.serialization.object({message:tNr.ChatContentDeltaEventDeltaMessage.optional()})});var gPe=v(qv=>{"use strict";var rNr=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]}),nNr=qv&&qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oNr=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)&&rNr(e,t,r);return nNr(e,t),e};Object.defineProperty(qv,"__esModule",{value:!0});qv.ChatContentDeltaEvent=void 0;var kxt=oNr(G()),iNr=hPe(),aNr=km();qv.ChatContentDeltaEvent=kxt.serialization.object({index:kxt.serialization.number().optional(),delta:iNr.ChatContentDeltaEventDelta.optional()}).extend(aNr.ChatStreamEventType)});var yPe=v(Uv=>{"use strict";var sNr=Uv&&Uv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uNr=Uv&&Uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lNr=Uv&&Uv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sNr(e,t,r);return uNr(e,t),e};Object.defineProperty(Uv,"__esModule",{value:!0});Uv.ChatContentEndEvent=void 0;var $xt=lNr(G()),cNr=km();Uv.ChatContentEndEvent=$xt.serialization.object({index:$xt.serialization.number().optional()}).extend(cNr.ChatStreamEventType)});var _Pe=v(zv=>{"use strict";var dNr=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]}),fNr=zv&&zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pNr=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)&&dNr(e,t,r);return fNr(e,t),e};Object.defineProperty(zv,"__esModule",{value:!0});zv.ChatToolPlanDeltaEventDelta=void 0;var bPe=pNr(G());zv.ChatToolPlanDeltaEventDelta=bPe.serialization.object({toolPlan:bPe.serialization.property("tool_plan",bPe.serialization.string().optional())})});var vPe=v(Hv=>{"use strict";var mNr=Hv&&Hv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hNr=Hv&&Hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gNr=Hv&&Hv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mNr(e,t,r);return hNr(e,t),e};Object.defineProperty(Hv,"__esModule",{value:!0});Hv.ChatToolPlanDeltaEvent=void 0;var yNr=gNr(G()),bNr=_Pe(),_Nr=km();Hv.ChatToolPlanDeltaEvent=yNr.serialization.object({delta:bNr.ChatToolPlanDeltaEventDelta.optional()}).extend(_Nr.ChatStreamEventType)});var SPe=v(Vv=>{"use strict";var vNr=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]}),wNr=Vv&&Vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SNr=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)&&vNr(e,t,r);return wNr(e,t),e};Object.defineProperty(Vv,"__esModule",{value:!0});Vv.ChatToolCallStartEventDeltaToolCallFunction=void 0;var wPe=SNr(G());Vv.ChatToolCallStartEventDeltaToolCallFunction=wPe.serialization.object({name:wPe.serialization.string().optional(),arguments:wPe.serialization.string().optional()})});var CPe=v(Wv=>{"use strict";var xNr=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]}),CNr=Wv&&Wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ONr=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)&&xNr(e,t,r);return CNr(e,t),e};Object.defineProperty(Wv,"__esModule",{value:!0});Wv.ChatToolCallStartEventDeltaToolCall=void 0;var xPe=ONr(G()),PNr=SPe();Wv.ChatToolCallStartEventDeltaToolCall=xPe.serialization.object({id:xPe.serialization.string().optional(),type:xPe.serialization.stringLiteral("function").optional(),function:PNr.ChatToolCallStartEventDeltaToolCallFunction.optional()})});var OPe=v(Kv=>{"use strict";var ENr=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]}),TNr=Kv&&Kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ANr=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)&&ENr(e,t,r);return TNr(e,t),e};Object.defineProperty(Kv,"__esModule",{value:!0});Kv.ChatToolCallStartEventDelta=void 0;var Bxt=ANr(G()),INr=CPe();Kv.ChatToolCallStartEventDelta=Bxt.serialization.object({toolCall:Bxt.serialization.property("tool_call",INr.ChatToolCallStartEventDeltaToolCall.optional())})});var PPe=v(Gv=>{"use strict";var MNr=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]}),RNr=Gv&&Gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jNr=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)&&MNr(e,t,r);return RNr(e,t),e};Object.defineProperty(Gv,"__esModule",{value:!0});Gv.ChatToolCallStartEvent=void 0;var qxt=jNr(G()),NNr=OPe(),DNr=km();Gv.ChatToolCallStartEvent=qxt.serialization.object({index:qxt.serialization.number().optional(),delta:NNr.ChatToolCallStartEventDelta.optional()}).extend(DNr.ChatStreamEventType)});var EPe=v(Jv=>{"use strict";var LNr=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]}),FNr=Jv&&Jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kNr=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)&&LNr(e,t,r);return FNr(e,t),e};Object.defineProperty(Jv,"__esModule",{value:!0});Jv.ChatToolCallDeltaEventDeltaToolCallFunction=void 0;var Uxt=kNr(G());Jv.ChatToolCallDeltaEventDeltaToolCallFunction=Uxt.serialization.object({arguments:Uxt.serialization.string().optional()})});var TPe=v(Yv=>{"use strict";var $Nr=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]}),BNr=Yv&&Yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qNr=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)&&$Nr(e,t,r);return BNr(e,t),e};Object.defineProperty(Yv,"__esModule",{value:!0});Yv.ChatToolCallDeltaEventDeltaToolCall=void 0;var UNr=qNr(G()),zNr=EPe();Yv.ChatToolCallDeltaEventDeltaToolCall=UNr.serialization.object({function:zNr.ChatToolCallDeltaEventDeltaToolCallFunction.optional()})});var APe=v(Zv=>{"use strict";var HNr=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]}),VNr=Zv&&Zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WNr=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)&&HNr(e,t,r);return VNr(e,t),e};Object.defineProperty(Zv,"__esModule",{value:!0});Zv.ChatToolCallDeltaEventDelta=void 0;var zxt=WNr(G()),KNr=TPe();Zv.ChatToolCallDeltaEventDelta=zxt.serialization.object({toolCall:zxt.serialization.property("tool_call",KNr.ChatToolCallDeltaEventDeltaToolCall.optional())})});var IPe=v(Xv=>{"use strict";var GNr=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]}),JNr=Xv&&Xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YNr=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)&&GNr(e,t,r);return JNr(e,t),e};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.ChatToolCallDeltaEvent=void 0;var Hxt=YNr(G()),ZNr=APe(),XNr=km();Xv.ChatToolCallDeltaEvent=Hxt.serialization.object({index:Hxt.serialization.number().optional(),delta:ZNr.ChatToolCallDeltaEventDelta.optional()}).extend(XNr.ChatStreamEventType)});var MPe=v(Qv=>{"use strict";var QNr=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]}),eDr=Qv&&Qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tDr=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)&&QNr(e,t,r);return eDr(e,t),e};Object.defineProperty(Qv,"__esModule",{value:!0});Qv.ChatToolCallEndEvent=void 0;var Vxt=tDr(G()),rDr=km();Qv.ChatToolCallEndEvent=Vxt.serialization.object({index:Vxt.serialization.number().optional()}).extend(rDr.ChatStreamEventType)});var RPe=v(ew=>{"use strict";var nDr=ew&&ew.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oDr=ew&&ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iDr=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)&&nDr(e,t,r);return oDr(e,t),e};Object.defineProperty(ew,"__esModule",{value:!0});ew.ChatMessageEndEventDelta=void 0;var Wxt=iDr(G()),aDr=Bte(),sDr=qte();ew.ChatMessageEndEventDelta=Wxt.serialization.object({finishReason:Wxt.serialization.property("finish_reason",aDr.ChatFinishReason.optional()),usage:sDr.Usage.optional()})});var jPe=v(tw=>{"use strict";var uDr=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]}),lDr=tw&&tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cDr=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)&&uDr(e,t,r);return lDr(e,t),e};Object.defineProperty(tw,"__esModule",{value:!0});tw.ChatMessageEndEvent=void 0;var Kxt=cDr(G()),dDr=RPe(),fDr=km();tw.ChatMessageEndEvent=Kxt.serialization.object({id:Kxt.serialization.string().optional(),delta:dDr.ChatMessageEndEventDelta.optional()}).extend(fDr.ChatStreamEventType)});var NPe=v(rw=>{"use strict";var pDr=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]}),mDr=rw&&rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hDr=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)&&pDr(e,t,r);return mDr(e,t),e};Object.defineProperty(rw,"__esModule",{value:!0});rw.CitationStartEventDeltaMessage=void 0;var gDr=hDr(G()),yDr=SV();rw.CitationStartEventDeltaMessage=gDr.serialization.object({citations:yDr.Citation.optional()})});var DPe=v(nw=>{"use strict";var bDr=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]}),_Dr=nw&&nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vDr=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)&&bDr(e,t,r);return _Dr(e,t),e};Object.defineProperty(nw,"__esModule",{value:!0});nw.CitationStartEventDelta=void 0;var wDr=vDr(G()),SDr=NPe();nw.CitationStartEventDelta=wDr.serialization.object({message:SDr.CitationStartEventDeltaMessage.optional()})});var LPe=v(ow=>{"use strict";var xDr=ow&&ow.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CDr=ow&&ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ODr=ow&&ow.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xDr(e,t,r);return CDr(e,t),e};Object.defineProperty(ow,"__esModule",{value:!0});ow.CitationStartEvent=void 0;var Gxt=ODr(G()),PDr=DPe(),EDr=km();ow.CitationStartEvent=Gxt.serialization.object({index:Gxt.serialization.number().optional(),delta:PDr.CitationStartEventDelta.optional()}).extend(EDr.ChatStreamEventType)});var FPe=v(iw=>{"use strict";var TDr=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]}),ADr=iw&&iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IDr=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)&&TDr(e,t,r);return ADr(e,t),e};Object.defineProperty(iw,"__esModule",{value:!0});iw.CitationEndEvent=void 0;var Jxt=IDr(G()),MDr=km();iw.CitationEndEvent=Jxt.serialization.object({index:Jxt.serialization.number().optional()}).extend(MDr.ChatStreamEventType)});var Yxt=v(aw=>{"use strict";var RDr=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]}),jDr=aw&&aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NDr=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)&&RDr(e,t,r);return jDr(e,t),e};Object.defineProperty(aw,"__esModule",{value:!0});aw.StreamedChatResponse2=void 0;var DDr=NDr(G()),LDr=sPe(),FDr=fPe(),kDr=gPe(),$Dr=yPe(),BDr=vPe(),qDr=PPe(),UDr=IPe(),zDr=MPe(),HDr=LPe(),VDr=FPe(),WDr=jPe();aw.StreamedChatResponse2=DDr.serialization.union("type",{"message-start":LDr.ChatMessageStartEvent,"content-start":FDr.ChatContentStartEvent,"content-delta":kDr.ChatContentDeltaEvent,"content-end":$Dr.ChatContentEndEvent,"tool-plan-delta":BDr.ChatToolPlanDeltaEvent,"tool-call-start":qDr.ChatToolCallStartEvent,"tool-call-delta":UDr.ChatToolCallDeltaEvent,"tool-call-end":zDr.ChatToolCallEndEvent,"citation-start":HDr.CitationStartEvent,"citation-end":VDr.CitationEndEvent,"message-end":WDr.ChatMessageEndEvent}).transform({transform:t=>t,untransform:t=>t})});var kPe=v(At=>{"use strict";var KDr=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]}),Bt=At&&At.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KDr(e,t,r)};Object.defineProperty(At,"__esModule",{value:!0});Bt(AOe(),At);Bt(IOe(),At);Bt(B$(),At);Bt(MOe(),At);Bt(jOe(),At);Bt(DOe(),At);Bt(FOe(),At);Bt(Lte(),At);Bt($Oe(),At);Bt(BOe(),At);Bt(qOe(),At);Bt(SV(),At);Bt(UOe(),At);Bt(HOe(),At);Bt(VOe(),At);Bt(WOe(),At);Bt(GOe(),At);Bt(JOe(),At);Bt(YOe(),At);Bt(ZOe(),At);Bt(XOe(),At);Bt(QOe(),At);Bt(kte(),At);Bt(ePe(),At);Bt($te(),At);Bt(Bte(),At);Bt(tPe(),At);Bt(rPe(),At);Bt(nPe(),At);Bt(oPe(),At);Bt(qte(),At);Bt(jxt(),At);Bt(km(),At);Bt(iPe(),At);Bt(aPe(),At);Bt(sPe(),At);Bt(lPe(),At);Bt(cPe(),At);Bt(dPe(),At);Bt(fPe(),At);Bt(pPe(),At);Bt(mPe(),At);Bt(hPe(),At);Bt(gPe(),At);Bt(yPe(),At);Bt(_Pe(),At);Bt(vPe(),At);Bt(SPe(),At);Bt(CPe(),At);Bt(OPe(),At);Bt(PPe(),At);Bt(EPe(),At);Bt(TPe(),At);Bt(APe(),At);Bt(IPe(),At);Bt(MPe(),At);Bt(RPe(),At);Bt(jPe(),At);Bt(Yxt(),At)});var zte=v(sw=>{"use strict";var GDr=sw&&sw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JDr=sw&&sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YDr=sw&&sw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GDr(e,t,r);return JDr(e,t),e};Object.defineProperty(sw,"__esModule",{value:!0});sw.TextResponseFormat=void 0;var ZDr=YDr(G());sw.TextResponseFormat=ZDr.serialization.object({})});var $Pe=v(uw=>{"use strict";var XDr=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]}),QDr=uw&&uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eLr=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)&&XDr(e,t,r);return QDr(e,t),e};Object.defineProperty(uw,"__esModule",{value:!0});uw.JsonResponseFormat2=void 0;var OV=eLr(G());uw.JsonResponseFormat2=OV.serialization.object({jsonSchema:OV.serialization.property("json_schema",OV.serialization.record(OV.serialization.string(),OV.serialization.unknown()).optional())})});var Hte=v(lw=>{"use strict";var tLr=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]}),rLr=lw&&lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nLr=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)&&tLr(e,t,r);return rLr(e,t),e};Object.defineProperty(lw,"__esModule",{value:!0});lw.ResponseFormat2=void 0;var oLr=nLr(G()),iLr=zte(),aLr=$Pe();lw.ResponseFormat2=oLr.serialization.union("type",{text:iLr.TextResponseFormat,json_object:aLr.JsonResponseFormat2}).transform({transform:t=>t,untransform:t=>t})});var Zxt=v(cw=>{"use strict";var sLr=cw&&cw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uLr=cw&&cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lLr=cw&&cw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sLr(e,t,r);return uLr(e,t),e};Object.defineProperty(cw,"__esModule",{value:!0});cw.V2ChatStreamRequest=void 0;var Ws=lLr(G()),cLr=kte(),dLr=$te(),fLr=AOe(),pLr=Hte();cw.V2ChatStreamRequest=Ws.serialization.object({model:Ws.serialization.string(),messages:cLr.ChatMessages,tools:Ws.serialization.list(dLr.Tool2).optional(),citationMode:Ws.serialization.property("citation_mode",fLr.V2ChatStreamRequestCitationMode.optional()),responseFormat:Ws.serialization.property("response_format",pLr.ResponseFormat2.optional()),maxTokens:Ws.serialization.property("max_tokens",Ws.serialization.number().optional()),stopSequences:Ws.serialization.property("stop_sequences",Ws.serialization.list(Ws.serialization.string()).optional()),temperature:Ws.serialization.number().optional(),seed:Ws.serialization.number().optional(),frequencyPenalty:Ws.serialization.property("frequency_penalty",Ws.serialization.number().optional()),presencePenalty:Ws.serialization.property("presence_penalty",Ws.serialization.number().optional()),k:Ws.serialization.number().optional(),p:Ws.serialization.number().optional(),returnPrompt:Ws.serialization.property("return_prompt",Ws.serialization.boolean().optional())})});var Xxt=v(dw=>{"use strict";var mLr=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]}),hLr=dw&&dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gLr=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)&&mLr(e,t,r);return hLr(e,t),e};Object.defineProperty(dw,"__esModule",{value:!0});dw.V2ChatRequest=void 0;var Ks=gLr(G()),yLr=kte(),bLr=$te(),_Lr=IOe(),vLr=Hte();dw.V2ChatRequest=Ks.serialization.object({model:Ks.serialization.string(),messages:yLr.ChatMessages,tools:Ks.serialization.list(bLr.Tool2).optional(),citationMode:Ks.serialization.property("citation_mode",_Lr.V2ChatRequestCitationMode.optional()),responseFormat:Ks.serialization.property("response_format",vLr.ResponseFormat2.optional()),maxTokens:Ks.serialization.property("max_tokens",Ks.serialization.number().optional()),stopSequences:Ks.serialization.property("stop_sequences",Ks.serialization.list(Ks.serialization.string()).optional()),temperature:Ks.serialization.number().optional(),seed:Ks.serialization.number().optional(),frequencyPenalty:Ks.serialization.property("frequency_penalty",Ks.serialization.number().optional()),presencePenalty:Ks.serialization.property("presence_penalty",Ks.serialization.number().optional()),k:Ks.serialization.number().optional(),p:Ks.serialization.number().optional(),returnPrompt:Ks.serialization.property("return_prompt",Ks.serialization.boolean().optional())})});var BPe=v(H$=>{"use strict";Object.defineProperty(H$,"__esModule",{value:!0});H$.V2ChatRequest=H$.V2ChatStreamRequest=void 0;var wLr=Zxt();Object.defineProperty(H$,"V2ChatStreamRequest",{enumerable:!0,get:function(){return wLr.V2ChatStreamRequest}});var SLr=Xxt();Object.defineProperty(H$,"V2ChatRequest",{enumerable:!0,get:function(){return SLr.V2ChatRequest}})});var Qxt=v(gj=>{"use strict";var xLr=gj&&gj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CLr=gj&&gj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xLr(e,t,r)};Object.defineProperty(gj,"__esModule",{value:!0});CLr(BPe(),gj)});var tCt=v(bA=>{"use strict";var OLr=bA&&bA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eCt=bA&&bA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&OLr(e,t,r)};Object.defineProperty(bA,"__esModule",{value:!0});eCt(kPe(),bA);eCt(Qxt(),bA)});var qPe=v(fw=>{"use strict";var PLr=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]}),ELr=fw&&fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TLr=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)&&PLr(e,t,r);return ELr(e,t),e};Object.defineProperty(fw,"__esModule",{value:!0});fw.CreateEmbedJobRequestTruncate=void 0;var ALr=TLr(G());fw.CreateEmbedJobRequestTruncate=ALr.serialization.enum_(["START","END"])});var UPe=v(yj=>{"use strict";var ILr=yj&&yj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MLr=yj&&yj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ILr(e,t,r)};Object.defineProperty(yj,"__esModule",{value:!0});MLr(qPe(),yj)});var Vte=v(pw=>{"use strict";var RLr=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]}),jLr=pw&&pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NLr=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)&&RLr(e,t,r);return jLr(e,t),e};Object.defineProperty(pw,"__esModule",{value:!0});pw.EmbedInputType=void 0;var DLr=NLr(G());pw.EmbedInputType=DLr.serialization.enum_(["search_document","search_query","classification","clustering"])});var Wte=v(mw=>{"use strict";var LLr=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]}),FLr=mw&&mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kLr=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)&&LLr(e,t,r);return FLr(e,t),e};Object.defineProperty(mw,"__esModule",{value:!0});mw.EmbeddingType=void 0;var $Lr=kLr(G());mw.EmbeddingType=$Lr.serialization.enum_(["float","int8","uint8","binary","ubinary"])});var rCt=v(hw=>{"use strict";var BLr=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]}),qLr=hw&&hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ULr=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)&&BLr(e,t,r);return qLr(e,t),e};Object.defineProperty(hw,"__esModule",{value:!0});hw.CreateEmbedJobRequest=void 0;var _A=ULr(G()),zLr=Vte(),HLr=Wte(),VLr=qPe();hw.CreateEmbedJobRequest=_A.serialization.object({model:_A.serialization.string(),datasetId:_A.serialization.property("dataset_id",_A.serialization.string()),inputType:_A.serialization.property("input_type",zLr.EmbedInputType),name:_A.serialization.string().optional(),embeddingTypes:_A.serialization.property("embedding_types",_A.serialization.list(HLr.EmbeddingType).optional()),truncate:VLr.CreateEmbedJobRequestTruncate.optional()})});var zPe=v(Kte=>{"use strict";Object.defineProperty(Kte,"__esModule",{value:!0});Kte.CreateEmbedJobRequest=void 0;var WLr=rCt();Object.defineProperty(Kte,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return WLr.CreateEmbedJobRequest}})});var nCt=v(bj=>{"use strict";var KLr=bj&&bj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GLr=bj&&bj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KLr(e,t,r)};Object.defineProperty(bj,"__esModule",{value:!0});GLr(zPe(),bj)});var iCt=v(vA=>{"use strict";var JLr=vA&&vA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oCt=vA&&vA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&JLr(e,t,r)};Object.defineProperty(vA,"__esModule",{value:!0});oCt(UPe(),vA);oCt(nCt(),vA)});var HPe=v(gw=>{"use strict";var YLr=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]}),ZLr=gw&&gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XLr=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)&&YLr(e,t,r);return ZLr(e,t),e};Object.defineProperty(gw,"__esModule",{value:!0});gw.DatasetType=void 0;var QLr=XLr(G());gw.DatasetType=QLr.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 VPe=v(yw=>{"use strict";var eFr=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]}),tFr=yw&&yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rFr=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)&&eFr(e,t,r);return tFr(e,t),e};Object.defineProperty(yw,"__esModule",{value:!0});yw.DatasetValidationStatus=void 0;var nFr=rFr(G());yw.DatasetValidationStatus=nFr.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var WPe=v(bw=>{"use strict";var oFr=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]}),iFr=bw&&bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aFr=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)&&oFr(e,t,r);return iFr(e,t),e};Object.defineProperty(bw,"__esModule",{value:!0});bw.DatasetPart=void 0;var $m=aFr(G());bw.DatasetPart=$m.serialization.object({id:$m.serialization.string(),name:$m.serialization.string(),url:$m.serialization.string().optional(),index:$m.serialization.number().optional(),sizeBytes:$m.serialization.property("size_bytes",$m.serialization.number().optional()),numRows:$m.serialization.property("num_rows",$m.serialization.number().optional()),originalUrl:$m.serialization.property("original_url",$m.serialization.string().optional()),samples:$m.serialization.list($m.serialization.string()).optional()})});var Gte=v(_w=>{"use strict";var sFr=_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]}),uFr=_w&&_w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lFr=_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)&&sFr(e,t,r);return uFr(e,t),e};Object.defineProperty(_w,"__esModule",{value:!0});_w.Dataset=void 0;var Ka=lFr(G()),cFr=HPe(),dFr=VPe(),fFr=WPe();_w.Dataset=Ka.serialization.object({id:Ka.serialization.string(),name:Ka.serialization.string(),createdAt:Ka.serialization.property("created_at",Ka.serialization.date()),updatedAt:Ka.serialization.property("updated_at",Ka.serialization.date()),datasetType:Ka.serialization.property("dataset_type",cFr.DatasetType),validationStatus:Ka.serialization.property("validation_status",dFr.DatasetValidationStatus),validationError:Ka.serialization.property("validation_error",Ka.serialization.string().optional()),schema:Ka.serialization.string().optional(),requiredFields:Ka.serialization.property("required_fields",Ka.serialization.list(Ka.serialization.string()).optional()),preserveFields:Ka.serialization.property("preserve_fields",Ka.serialization.list(Ka.serialization.string()).optional()),datasetParts:Ka.serialization.property("dataset_parts",Ka.serialization.list(fFr.DatasetPart).optional()),validationWarnings:Ka.serialization.property("validation_warnings",Ka.serialization.list(Ka.serialization.string()).optional())})});var sCt=v(vw=>{"use strict";var pFr=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]}),mFr=vw&&vw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hFr=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)&&pFr(e,t,r);return mFr(e,t),e};Object.defineProperty(vw,"__esModule",{value:!0});vw.DatasetsListResponse=void 0;var aCt=hFr(G()),gFr=Gte();vw.DatasetsListResponse=aCt.serialization.object({datasets:aCt.serialization.list(gFr.Dataset).optional()})});var uCt=v(ww=>{"use strict";var yFr=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]}),bFr=ww&&ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Fr=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)&&yFr(e,t,r);return bFr(e,t),e};Object.defineProperty(ww,"__esModule",{value:!0});ww.DatasetsCreateResponseDatasetPartsItem=void 0;var wA=_Fr(G());ww.DatasetsCreateResponseDatasetPartsItem=wA.serialization.object({name:wA.serialization.string().optional(),numRows:wA.serialization.property("num_rows",wA.serialization.number().optional()),samples:wA.serialization.list(wA.serialization.string()).optional(),partKind:wA.serialization.property("part_kind",wA.serialization.string().optional())})});var cCt=v(Sw=>{"use strict";var vFr=Sw&&Sw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wFr=Sw&&Sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SFr=Sw&&Sw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vFr(e,t,r);return wFr(e,t),e};Object.defineProperty(Sw,"__esModule",{value:!0});Sw.DatasetsCreateResponse=void 0;var lCt=SFr(G());Sw.DatasetsCreateResponse=lCt.serialization.object({id:lCt.serialization.string().optional()})});var dCt=v(xw=>{"use strict";var xFr=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]}),CFr=xw&&xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OFr=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)&&xFr(e,t,r);return CFr(e,t),e};Object.defineProperty(xw,"__esModule",{value:!0});xw.DatasetsGetUsageResponse=void 0;var KPe=OFr(G());xw.DatasetsGetUsageResponse=KPe.serialization.object({organizationUsage:KPe.serialization.property("organization_usage",KPe.serialization.number().optional())})});var fCt=v(Cw=>{"use strict";var PFr=Cw&&Cw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EFr=Cw&&Cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TFr=Cw&&Cw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PFr(e,t,r);return EFr(e,t),e};Object.defineProperty(Cw,"__esModule",{value:!0});Cw.DatasetsGetResponse=void 0;var AFr=TFr(G()),IFr=Gte();Cw.DatasetsGetResponse=AFr.serialization.object({dataset:IFr.Dataset})});var GPe=v(By=>{"use strict";var MFr=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]}),PV=By&&By.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&MFr(e,t,r)};Object.defineProperty(By,"__esModule",{value:!0});PV(sCt(),By);PV(uCt(),By);PV(cCt(),By);PV(dCt(),By);PV(fCt(),By)});var pCt=v(Ow=>{"use strict";var RFr=Ow&&Ow.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jFr=Ow&&Ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NFr=Ow&&Ow.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RFr(e,t,r);return jFr(e,t),e};Object.defineProperty(Ow,"__esModule",{value:!0});Ow.Response=void 0;var JPe=NFr(G());Ow.Response=JPe.serialization.record(JPe.serialization.string(),JPe.serialization.unknown())});var mCt=v(Pw=>{"use strict";var DFr=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]}),LFr=Pw&&Pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FFr=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)&&DFr(e,t,r);return LFr(e,t),e};Object.defineProperty(Pw,"__esModule",{value:!0});Pw.delete=void 0;Pw.delete=FFr(pCt())});var gCt=v(SA=>{"use strict";var kFr=SA&&SA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hCt=SA&&SA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kFr(e,t,r)};Object.defineProperty(SA,"__esModule",{value:!0});hCt(GPe(),SA);hCt(mCt(),SA)});var YPe=v(Ew=>{"use strict";var $Fr=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]}),BFr=Ew&&Ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qFr=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)&&$Fr(e,t,r);return BFr(e,t),e};Object.defineProperty(Ew,"__esModule",{value:!0});Ew.BaseType=void 0;var UFr=qFr(G());Ew.BaseType=UFr.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var ZPe=v(Tw=>{"use strict";var zFr=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]}),HFr=Tw&&Tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VFr=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)&&zFr(e,t,r);return HFr(e,t),e};Object.defineProperty(Tw,"__esModule",{value:!0});Tw.Strategy=void 0;var WFr=VFr(G());Tw.Strategy=WFr.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var XPe=v(Aw=>{"use strict";var KFr=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]}),GFr=Aw&&Aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JFr=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)&&KFr(e,t,r);return GFr(e,t),e};Object.defineProperty(Aw,"__esModule",{value:!0});Aw.BaseModel=void 0;var Jte=JFr(G()),YFr=YPe(),ZFr=ZPe();Aw.BaseModel=Jte.serialization.object({name:Jte.serialization.string().optional(),version:Jte.serialization.string().optional(),baseType:Jte.serialization.property("base_type",YFr.BaseType),strategy:ZFr.Strategy.optional()})});var QPe=v(Iw=>{"use strict";var XFr=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]}),QFr=Iw&&Iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ekr=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)&&XFr(e,t,r);return QFr(e,t),e};Object.defineProperty(Iw,"__esModule",{value:!0});Iw.Hyperparameters=void 0;var qy=ekr(G());Iw.Hyperparameters=qy.serialization.object({earlyStoppingPatience:qy.serialization.property("early_stopping_patience",qy.serialization.number().optional()),earlyStoppingThreshold:qy.serialization.property("early_stopping_threshold",qy.serialization.number().optional()),trainBatchSize:qy.serialization.property("train_batch_size",qy.serialization.number().optional()),trainEpochs:qy.serialization.property("train_epochs",qy.serialization.number().optional()),learningRate:qy.serialization.property("learning_rate",qy.serialization.number().optional())})});var eEe=v(Mw=>{"use strict";var tkr=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]}),rkr=Mw&&Mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nkr=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)&&tkr(e,t,r);return rkr(e,t),e};Object.defineProperty(Mw,"__esModule",{value:!0});Mw.WandbConfig=void 0;var EV=nkr(G());Mw.WandbConfig=EV.serialization.object({project:EV.serialization.string(),apiKey:EV.serialization.property("api_key",EV.serialization.string()),entity:EV.serialization.string().optional()})});var Yte=v(Rw=>{"use strict";var okr=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]}),ikr=Rw&&Rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),akr=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)&&okr(e,t,r);return ikr(e,t),e};Object.defineProperty(Rw,"__esModule",{value:!0});Rw.Settings=void 0;var V$=akr(G()),skr=XPe(),ukr=QPe(),lkr=eEe();Rw.Settings=V$.serialization.object({baseModel:V$.serialization.property("base_model",skr.BaseModel),datasetId:V$.serialization.property("dataset_id",V$.serialization.string()),hyperparameters:ukr.Hyperparameters.optional(),multiLabel:V$.serialization.property("multi_label",V$.serialization.boolean().optional()),wandb:lkr.WandbConfig.optional()})});var TV=v(jw=>{"use strict";var ckr=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]}),dkr=jw&&jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fkr=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)&&ckr(e,t,r);return dkr(e,t),e};Object.defineProperty(jw,"__esModule",{value:!0});jw.Status=void 0;var pkr=fkr(G());jw.Status=pkr.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var W$=v(Nw=>{"use strict";var mkr=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]}),hkr=Nw&&Nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gkr=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)&&mkr(e,t,r);return hkr(e,t),e};Object.defineProperty(Nw,"__esModule",{value:!0});Nw.FinetunedModel=void 0;var Gf=gkr(G()),ykr=Yte(),bkr=TV();Nw.FinetunedModel=Gf.serialization.object({id:Gf.serialization.string().optional(),name:Gf.serialization.string(),creatorId:Gf.serialization.property("creator_id",Gf.serialization.string().optional()),organizationId:Gf.serialization.property("organization_id",Gf.serialization.string().optional()),settings:ykr.Settings,status:bkr.Status.optional(),createdAt:Gf.serialization.property("created_at",Gf.serialization.date().optional()),updatedAt:Gf.serialization.property("updated_at",Gf.serialization.date().optional()),completedAt:Gf.serialization.property("completed_at",Gf.serialization.date().optional()),lastUsed:Gf.serialization.property("last_used",Gf.serialization.date().optional())})});var yCt=v(Dw=>{"use strict";var _kr=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]}),vkr=Dw&&Dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wkr=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)&&_kr(e,t,r);return vkr(e,t),e};Object.defineProperty(Dw,"__esModule",{value:!0});Dw.ListFinetunedModelsResponse=void 0;var _j=wkr(G()),Skr=W$();Dw.ListFinetunedModelsResponse=_j.serialization.object({finetunedModels:_j.serialization.property("finetuned_models",_j.serialization.list(Skr.FinetunedModel).optional()),nextPageToken:_j.serialization.property("next_page_token",_j.serialization.string().optional()),totalSize:_j.serialization.property("total_size",_j.serialization.number().optional())})});var _Ct=v(Lw=>{"use strict";var xkr=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]}),Ckr=Lw&&Lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Okr=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)&&xkr(e,t,r);return Ckr(e,t),e};Object.defineProperty(Lw,"__esModule",{value:!0});Lw.CreateFinetunedModelResponse=void 0;var bCt=Okr(G()),Pkr=W$();Lw.CreateFinetunedModelResponse=bCt.serialization.object({finetunedModel:bCt.serialization.property("finetuned_model",Pkr.FinetunedModel.optional())})});var wCt=v(Fw=>{"use strict";var Ekr=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]}),Tkr=Fw&&Fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Akr=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)&&Ekr(e,t,r);return Tkr(e,t),e};Object.defineProperty(Fw,"__esModule",{value:!0});Fw.GetFinetunedModelResponse=void 0;var vCt=Akr(G()),Ikr=W$();Fw.GetFinetunedModelResponse=vCt.serialization.object({finetunedModel:vCt.serialization.property("finetuned_model",Ikr.FinetunedModel.optional())})});var SCt=v(kw=>{"use strict";var Mkr=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]}),Rkr=kw&&kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jkr=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)&&Mkr(e,t,r);return Rkr(e,t),e};Object.defineProperty(kw,"__esModule",{value:!0});kw.DeleteFinetunedModelResponse=void 0;var tEe=jkr(G());kw.DeleteFinetunedModelResponse=tEe.serialization.record(tEe.serialization.string(),tEe.serialization.unknown())});var CCt=v($w=>{"use strict";var Nkr=$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]}),Dkr=$w&&$w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lkr=$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)&&Nkr(e,t,r);return Dkr(e,t),e};Object.defineProperty($w,"__esModule",{value:!0});$w.UpdateFinetunedModelResponse=void 0;var xCt=Lkr(G()),Fkr=W$();$w.UpdateFinetunedModelResponse=xCt.serialization.object({finetunedModel:xCt.serialization.property("finetuned_model",Fkr.FinetunedModel.optional())})});var rEe=v(Bw=>{"use strict";var kkr=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]}),$kr=Bw&&Bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bkr=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)&&kkr(e,t,r);return $kr(e,t),e};Object.defineProperty(Bw,"__esModule",{value:!0});Bw.Event=void 0;var AV=Bkr(G()),qkr=TV();Bw.Event=AV.serialization.object({userId:AV.serialization.property("user_id",AV.serialization.string().optional()),status:qkr.Status.optional(),createdAt:AV.serialization.property("created_at",AV.serialization.date().optional())})});var OCt=v(qw=>{"use strict";var Ukr=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]}),zkr=qw&&qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hkr=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)&&Ukr(e,t,r);return zkr(e,t),e};Object.defineProperty(qw,"__esModule",{value:!0});qw.ListEventsResponse=void 0;var K$=Hkr(G()),Vkr=rEe();qw.ListEventsResponse=K$.serialization.object({events:K$.serialization.list(Vkr.Event).optional(),nextPageToken:K$.serialization.property("next_page_token",K$.serialization.string().optional()),totalSize:K$.serialization.property("total_size",K$.serialization.number().optional())})});var nEe=v(Uw=>{"use strict";var Wkr=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]}),Kkr=Uw&&Uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gkr=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)&&Wkr(e,t,r);return Kkr(e,t),e};Object.defineProperty(Uw,"__esModule",{value:!0});Uw.TrainingStepMetrics=void 0;var xA=Gkr(G());Uw.TrainingStepMetrics=xA.serialization.object({createdAt:xA.serialization.property("created_at",xA.serialization.date().optional()),stepNumber:xA.serialization.property("step_number",xA.serialization.number().optional()),metrics:xA.serialization.record(xA.serialization.string(),xA.serialization.number()).optional()})});var PCt=v(zw=>{"use strict";var Jkr=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]}),Ykr=zw&&zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zkr=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)&&Jkr(e,t,r);return Ykr(e,t),e};Object.defineProperty(zw,"__esModule",{value:!0});zw.ListTrainingStepMetricsResponse=void 0;var IV=Zkr(G()),Xkr=nEe();zw.ListTrainingStepMetricsResponse=IV.serialization.object({stepMetrics:IV.serialization.property("step_metrics",IV.serialization.list(Xkr.TrainingStepMetrics).optional()),nextPageToken:IV.serialization.property("next_page_token",IV.serialization.string().optional())})});var oEe=v(Ga=>{"use strict";var Qkr=Ga&&Ga.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hc=Ga&&Ga.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Qkr(e,t,r)};Object.defineProperty(Ga,"__esModule",{value:!0});Hc(YPe(),Ga);Hc(ZPe(),Ga);Hc(XPe(),Ga);Hc(QPe(),Ga);Hc(eEe(),Ga);Hc(Yte(),Ga);Hc(TV(),Ga);Hc(W$(),Ga);Hc(yCt(),Ga);Hc(_Ct(),Ga);Hc(wCt(),Ga);Hc(SCt(),Ga);Hc(CCt(),Ga);Hc(rEe(),Ga);Hc(OCt(),Ga);Hc(nEe(),Ga);Hc(PCt(),Ga)});var ECt=v(vj=>{"use strict";var e$r=vj&&vj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t$r=vj&&vj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&e$r(e,t,r)};Object.defineProperty(vj,"__esModule",{value:!0});t$r(oEe(),vj)});var ACt=v(Bm=>{"use strict";var TCt=Bm&&Bm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r$r=Bm&&Bm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n$r=Bm&&Bm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TCt(e,t,r);return r$r(e,t),e},o$r=Bm&&Bm.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&TCt(e,t,r)};Object.defineProperty(Bm,"__esModule",{value:!0});Bm.finetuning=void 0;Bm.finetuning=n$r(ECt());o$r(oEe(),Bm)});var ICt=v(Hw=>{"use strict";var i$r=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]}),a$r=Hw&&Hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s$r=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)&&i$r(e,t,r);return a$r(e,t),e};Object.defineProperty(Hw,"__esModule",{value:!0});Hw.FinetuningUpdateFinetunedModelRequest=void 0;var Lp=s$r(G()),u$r=Yte(),l$r=TV();Hw.FinetuningUpdateFinetunedModelRequest=Lp.serialization.object({name:Lp.serialization.string(),creatorId:Lp.serialization.property("creator_id",Lp.serialization.string().optional()),organizationId:Lp.serialization.property("organization_id",Lp.serialization.string().optional()),settings:u$r.Settings,status:l$r.Status.optional(),createdAt:Lp.serialization.property("created_at",Lp.serialization.date().optional()),updatedAt:Lp.serialization.property("updated_at",Lp.serialization.date().optional()),completedAt:Lp.serialization.property("completed_at",Lp.serialization.date().optional()),lastUsed:Lp.serialization.property("last_used",Lp.serialization.date().optional())})});var iEe=v(Zte=>{"use strict";Object.defineProperty(Zte,"__esModule",{value:!0});Zte.FinetuningUpdateFinetunedModelRequest=void 0;var c$r=ICt();Object.defineProperty(Zte,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return c$r.FinetuningUpdateFinetunedModelRequest}})});var MCt=v(wj=>{"use strict";var d$r=wj&&wj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f$r=wj&&wj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&d$r(e,t,r)};Object.defineProperty(wj,"__esModule",{value:!0});f$r(iEe(),wj)});var jCt=v(CA=>{"use strict";var p$r=CA&&CA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RCt=CA&&CA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&p$r(e,t,r)};Object.defineProperty(CA,"__esModule",{value:!0});RCt(ACt(),CA);RCt(MCt(),CA)});var Xte=v(Ww=>{"use strict";var m$r=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]}),h$r=Ww&&Ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g$r=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)&&m$r(e,t,r);return h$r(e,t),e};Object.defineProperty(Ww,"__esModule",{value:!0});Ww.CreateConnectorOAuth=void 0;var Vw=g$r(G());Ww.CreateConnectorOAuth=Vw.serialization.object({clientId:Vw.serialization.property("client_id",Vw.serialization.string().optional()),clientSecret:Vw.serialization.property("client_secret",Vw.serialization.string().optional()),authorizeUrl:Vw.serialization.property("authorize_url",Vw.serialization.string().optional()),tokenUrl:Vw.serialization.property("token_url",Vw.serialization.string().optional()),scope:Vw.serialization.string().optional()})});var aEe=v(Kw=>{"use strict";var y$r=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]}),b$r=Kw&&Kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_$r=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)&&y$r(e,t,r);return b$r(e,t),e};Object.defineProperty(Kw,"__esModule",{value:!0});Kw.AuthTokenType=void 0;var v$r=_$r(G());Kw.AuthTokenType=v$r.serialization.enum_(["bearer","basic","noscheme"])});var Qte=v(Gw=>{"use strict";var w$r=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]}),S$r=Gw&&Gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x$r=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)&&w$r(e,t,r);return S$r(e,t),e};Object.defineProperty(Gw,"__esModule",{value:!0});Gw.CreateConnectorServiceAuth=void 0;var NCt=x$r(G()),C$r=aEe();Gw.CreateConnectorServiceAuth=NCt.serialization.object({type:C$r.AuthTokenType,token:NCt.serialization.string()})});var DCt=v(Yw=>{"use strict";var O$r=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]}),P$r=Yw&&Yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E$r=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)&&O$r(e,t,r);return P$r(e,t),e};Object.defineProperty(Yw,"__esModule",{value:!0});Yw.CreateConnectorRequest=void 0;var Jw=E$r(G()),T$r=Xte(),A$r=Qte();Yw.CreateConnectorRequest=Jw.serialization.object({name:Jw.serialization.string(),description:Jw.serialization.string().optional(),url:Jw.serialization.string(),excludes:Jw.serialization.list(Jw.serialization.string()).optional(),oauth:T$r.CreateConnectorOAuth.optional(),active:Jw.serialization.boolean().optional(),continueOnFailure:Jw.serialization.property("continue_on_failure",Jw.serialization.boolean().optional()),serviceAuth:Jw.serialization.property("service_auth",A$r.CreateConnectorServiceAuth.optional())})});var LCt=v(Zw=>{"use strict";var I$r=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]}),M$r=Zw&&Zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R$r=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)&&I$r(e,t,r);return M$r(e,t),e};Object.defineProperty(Zw,"__esModule",{value:!0});Zw.UpdateConnectorRequest=void 0;var IO=R$r(G()),j$r=Xte(),N$r=Qte();Zw.UpdateConnectorRequest=IO.serialization.object({name:IO.serialization.string().optional(),url:IO.serialization.string().optional(),excludes:IO.serialization.list(IO.serialization.string()).optional(),oauth:j$r.CreateConnectorOAuth.optional(),active:IO.serialization.boolean().optional(),continueOnFailure:IO.serialization.property("continue_on_failure",IO.serialization.boolean().optional()),serviceAuth:IO.serialization.property("service_auth",N$r.CreateConnectorServiceAuth.optional())})});var sEe=v(G$=>{"use strict";Object.defineProperty(G$,"__esModule",{value:!0});G$.UpdateConnectorRequest=G$.CreateConnectorRequest=void 0;var D$r=DCt();Object.defineProperty(G$,"CreateConnectorRequest",{enumerable:!0,get:function(){return D$r.CreateConnectorRequest}});var L$r=LCt();Object.defineProperty(G$,"UpdateConnectorRequest",{enumerable:!0,get:function(){return L$r.UpdateConnectorRequest}})});var FCt=v(Sj=>{"use strict";var F$r=Sj&&Sj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),k$r=Sj&&Sj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&F$r(e,t,r)};Object.defineProperty(Sj,"__esModule",{value:!0});k$r(sEe(),Sj)});var kCt=v(xj=>{"use strict";var $$r=xj&&xj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B$r=xj&&xj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$$r(e,t,r)};Object.defineProperty(xj,"__esModule",{value:!0});B$r(FCt(),xj)});var BCt=v(Di=>{"use strict";var $Ct=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]}),q$r=Di&&Di.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MV=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)&&$Ct(e,t,r);return q$r(e,t),e},Cj=Di&&Di.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$Ct(e,t,r)};Object.defineProperty(Di,"__esModule",{value:!0});Di.connectors=Di.finetuning=Di.datasets=Di.embedJobs=Di.v2=void 0;Di.v2=MV(tCt());Cj(kPe(),Di);Di.embedJobs=MV(iCt());Cj(UPe(),Di);Di.datasets=MV(gCt());Cj(GPe(),Di);Di.finetuning=MV(jCt());Cj(BPe(),Di);Cj(zPe(),Di);Di.connectors=MV(kCt());Cj(sEe(),Di);Cj(iEe(),Di)});var uEe=v(Xw=>{"use strict";var U$r=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]}),z$r=Xw&&Xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H$r=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)&&U$r(e,t,r);return z$r(e,t),e};Object.defineProperty(Xw,"__esModule",{value:!0});Xw.ChatStreamRequestPromptTruncation=void 0;var V$r=H$r(G());Xw.ChatStreamRequestPromptTruncation=V$r.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var lEe=v(Qw=>{"use strict";var W$r=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]}),K$r=Qw&&Qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G$r=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)&&W$r(e,t,r);return K$r(e,t),e};Object.defineProperty(Qw,"__esModule",{value:!0});Qw.ChatStreamRequestCitationQuality=void 0;var J$r=G$r(G());Qw.ChatStreamRequestCitationQuality=J$r.serialization.enum_(["fast","accurate","off"])});var UCt=v(e0=>{"use strict";var Y$r=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]}),Z$r=e0&&e0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X$r=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)&&Y$r(e,t,r);return Z$r(e,t),e};Object.defineProperty(e0,"__esModule",{value:!0});e0.ChatStreamRequestConnectorsSearchOptions=void 0;var qCt=X$r(G());e0.ChatStreamRequestConnectorsSearchOptions=qCt.serialization.object({seed:qCt.serialization.number().optional()})});var cEe=v(t0=>{"use strict";var Q$r=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]}),eBr=t0&&t0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tBr=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)&&Q$r(e,t,r);return eBr(e,t),e};Object.defineProperty(t0,"__esModule",{value:!0});t0.ChatStreamRequestSafetyMode=void 0;var rBr=tBr(G());t0.ChatStreamRequestSafetyMode=rBr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var HCt=v(r0=>{"use strict";var nBr=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]}),oBr=r0&&r0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iBr=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)&&nBr(e,t,r);return oBr(e,t),e};Object.defineProperty(r0,"__esModule",{value:!0});r0.UnprocessableEntityErrorBody=void 0;var zCt=iBr(G());r0.UnprocessableEntityErrorBody=zCt.serialization.object({data:zCt.serialization.string().optional()})});var WCt=v(n0=>{"use strict";var aBr=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]}),sBr=n0&&n0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uBr=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)&&aBr(e,t,r);return sBr(e,t),e};Object.defineProperty(n0,"__esModule",{value:!0});n0.TooManyRequestsErrorBody=void 0;var VCt=uBr(G());n0.TooManyRequestsErrorBody=VCt.serialization.object({data:VCt.serialization.string().optional()})});var GCt=v(o0=>{"use strict";var lBr=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]}),cBr=o0&&o0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dBr=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)&&lBr(e,t,r);return cBr(e,t),e};Object.defineProperty(o0,"__esModule",{value:!0});o0.ClientClosedRequestErrorBody=void 0;var KCt=dBr(G());o0.ClientClosedRequestErrorBody=KCt.serialization.object({data:KCt.serialization.string().optional()})});var YCt=v(i0=>{"use strict";var fBr=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]}),pBr=i0&&i0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mBr=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)&&fBr(e,t,r);return pBr(e,t),e};Object.defineProperty(i0,"__esModule",{value:!0});i0.NotImplementedErrorBody=void 0;var JCt=mBr(G());i0.NotImplementedErrorBody=JCt.serialization.object({data:JCt.serialization.string().optional()})});var XCt=v(a0=>{"use strict";var hBr=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]}),gBr=a0&&a0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yBr=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)&&hBr(e,t,r);return gBr(e,t),e};Object.defineProperty(a0,"__esModule",{value:!0});a0.GatewayTimeoutErrorBody=void 0;var ZCt=yBr(G());a0.GatewayTimeoutErrorBody=ZCt.serialization.object({data:ZCt.serialization.string().optional()})});var dEe=v(s0=>{"use strict";var bBr=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]}),_Br=s0&&s0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vBr=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)&&bBr(e,t,r);return _Br(e,t),e};Object.defineProperty(s0,"__esModule",{value:!0});s0.ChatRequestPromptTruncation=void 0;var wBr=vBr(G());s0.ChatRequestPromptTruncation=wBr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var fEe=v(u0=>{"use strict";var SBr=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]}),xBr=u0&&u0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CBr=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)&&SBr(e,t,r);return xBr(e,t),e};Object.defineProperty(u0,"__esModule",{value:!0});u0.ChatRequestCitationQuality=void 0;var OBr=CBr(G());u0.ChatRequestCitationQuality=OBr.serialization.enum_(["fast","accurate","off"])});var eOt=v(l0=>{"use strict";var PBr=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]}),EBr=l0&&l0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TBr=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)&&PBr(e,t,r);return EBr(e,t),e};Object.defineProperty(l0,"__esModule",{value:!0});l0.ChatRequestConnectorsSearchOptions=void 0;var QCt=TBr(G());l0.ChatRequestConnectorsSearchOptions=QCt.serialization.object({seed:QCt.serialization.number().optional()})});var pEe=v(c0=>{"use strict";var ABr=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]}),IBr=c0&&c0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MBr=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)&&ABr(e,t,r);return IBr(e,t),e};Object.defineProperty(c0,"__esModule",{value:!0});c0.ChatRequestSafetyMode=void 0;var RBr=MBr(G());c0.ChatRequestSafetyMode=RBr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var mEe=v(d0=>{"use strict";var jBr=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]}),NBr=d0&&d0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DBr=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)&&jBr(e,t,r);return NBr(e,t),e};Object.defineProperty(d0,"__esModule",{value:!0});d0.GenerateStreamRequestTruncate=void 0;var LBr=DBr(G());d0.GenerateStreamRequestTruncate=LBr.serialization.enum_(["NONE","START","END"])});var hEe=v(f0=>{"use strict";var FBr=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]}),kBr=f0&&f0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Br=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)&&FBr(e,t,r);return kBr(e,t),e};Object.defineProperty(f0,"__esModule",{value:!0});f0.GenerateStreamRequestReturnLikelihoods=void 0;var BBr=$Br(G());f0.GenerateStreamRequestReturnLikelihoods=BBr.serialization.enum_(["GENERATION","ALL","NONE"])});var gEe=v(p0=>{"use strict";var qBr=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]}),UBr=p0&&p0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zBr=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)&&qBr(e,t,r);return UBr(e,t),e};Object.defineProperty(p0,"__esModule",{value:!0});p0.GenerateRequestTruncate=void 0;var HBr=zBr(G());p0.GenerateRequestTruncate=HBr.serialization.enum_(["NONE","START","END"])});var yEe=v(m0=>{"use strict";var VBr=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]}),WBr=m0&&m0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KBr=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)&&VBr(e,t,r);return WBr(e,t),e};Object.defineProperty(m0,"__esModule",{value:!0});m0.GenerateRequestReturnLikelihoods=void 0;var GBr=KBr(G());m0.GenerateRequestReturnLikelihoods=GBr.serialization.enum_(["GENERATION","ALL","NONE"])});var bEe=v(h0=>{"use strict";var JBr=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]}),YBr=h0&&h0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZBr=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)&&JBr(e,t,r);return YBr(e,t),e};Object.defineProperty(h0,"__esModule",{value:!0});h0.EmbedRequestTruncate=void 0;var XBr=ZBr(G());h0.EmbedRequestTruncate=XBr.serialization.enum_(["NONE","START","END"])});var _Ee=v(g0=>{"use strict";var QBr=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]}),eqr=g0&&g0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tqr=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)&&QBr(e,t,r);return eqr(e,t),e};Object.defineProperty(g0,"__esModule",{value:!0});g0.ApiMetaApiVersion=void 0;var J$=tqr(G());g0.ApiMetaApiVersion=J$.serialization.object({version:J$.serialization.string(),isDeprecated:J$.serialization.property("is_deprecated",J$.serialization.boolean().optional()),isExperimental:J$.serialization.property("is_experimental",J$.serialization.boolean().optional())})});var vEe=v(y0=>{"use strict";var rqr=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]}),nqr=y0&&y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oqr=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)&&rqr(e,t,r);return nqr(e,t),e};Object.defineProperty(y0,"__esModule",{value:!0});y0.ApiMetaBilledUnits=void 0;var OA=oqr(G());y0.ApiMetaBilledUnits=OA.serialization.object({inputTokens:OA.serialization.property("input_tokens",OA.serialization.number().optional()),outputTokens:OA.serialization.property("output_tokens",OA.serialization.number().optional()),searchUnits:OA.serialization.property("search_units",OA.serialization.number().optional()),classifications:OA.serialization.number().optional()})});var wEe=v(b0=>{"use strict";var iqr=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]}),aqr=b0&&b0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sqr=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)&&iqr(e,t,r);return aqr(e,t),e};Object.defineProperty(b0,"__esModule",{value:!0});b0.ApiMetaTokens=void 0;var RV=sqr(G());b0.ApiMetaTokens=RV.serialization.object({inputTokens:RV.serialization.property("input_tokens",RV.serialization.number().optional()),outputTokens:RV.serialization.property("output_tokens",RV.serialization.number().optional())})});var qm=v(_0=>{"use strict";var uqr=_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]}),lqr=_0&&_0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cqr=_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)&&uqr(e,t,r);return lqr(e,t),e};Object.defineProperty(_0,"__esModule",{value:!0});_0.ApiMeta=void 0;var jV=cqr(G()),dqr=_Ee(),fqr=vEe(),pqr=wEe();_0.ApiMeta=jV.serialization.object({apiVersion:jV.serialization.property("api_version",dqr.ApiMetaApiVersion.optional()),billedUnits:jV.serialization.property("billed_units",fqr.ApiMetaBilledUnits.optional()),tokens:pqr.ApiMetaTokens.optional(),warnings:jV.serialization.list(jV.serialization.string()).optional()})});var SEe=v(v0=>{"use strict";var mqr=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]}),hqr=v0&&v0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gqr=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)&&mqr(e,t,r);return hqr(e,t),e};Object.defineProperty(v0,"__esModule",{value:!0});v0.EmbedFloatsResponse=void 0;var Oj=gqr(G()),yqr=qm();v0.EmbedFloatsResponse=Oj.serialization.object({id:Oj.serialization.string(),embeddings:Oj.serialization.list(Oj.serialization.list(Oj.serialization.number())),texts:Oj.serialization.list(Oj.serialization.string()),meta:yqr.ApiMeta.optional()})});var xEe=v(w0=>{"use strict";var bqr=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]}),_qr=w0&&w0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vqr=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)&&bqr(e,t,r);return _qr(e,t),e};Object.defineProperty(w0,"__esModule",{value:!0});w0.EmbedByTypeResponseEmbeddings=void 0;var Xd=vqr(G());w0.EmbedByTypeResponseEmbeddings=Xd.serialization.object({float:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional(),int8:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional(),uint8:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional(),binary:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional(),ubinary:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional()})});var CEe=v(S0=>{"use strict";var wqr=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]}),Sqr=S0&&S0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xqr=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)&&wqr(e,t,r);return Sqr(e,t),e};Object.defineProperty(S0,"__esModule",{value:!0});S0.EmbedByTypeResponse=void 0;var ere=xqr(G()),Cqr=xEe(),Oqr=qm();S0.EmbedByTypeResponse=ere.serialization.object({id:ere.serialization.string(),embeddings:Cqr.EmbedByTypeResponseEmbeddings,texts:ere.serialization.list(ere.serialization.string()),meta:Oqr.ApiMeta.optional()})});var rOt=v(x0=>{"use strict";var Pqr=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]}),Eqr=x0&&x0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tqr=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)&&Pqr(e,t,r);return Eqr(e,t),e};Object.defineProperty(x0,"__esModule",{value:!0});x0.EmbedResponse=void 0;var tOt=Tqr(G()),Aqr=SEe(),Iqr=CEe();x0.EmbedResponse=tOt.serialization.union(tOt.serialization.discriminant("responseType","response_type"),{embeddings_floats:Aqr.EmbedFloatsResponse,embeddings_by_type:Iqr.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var PEe=v(C0=>{"use strict";var Mqr=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]}),Rqr=C0&&C0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jqr=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)&&Mqr(e,t,r);return Rqr(e,t),e};Object.defineProperty(C0,"__esModule",{value:!0});C0.RerankDocument=void 0;var OEe=jqr(G());C0.RerankDocument=OEe.serialization.record(OEe.serialization.string(),OEe.serialization.string())});var EEe=v(O0=>{"use strict";var Nqr=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]}),Dqr=O0&&O0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lqr=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)&&Nqr(e,t,r);return Dqr(e,t),e};Object.defineProperty(O0,"__esModule",{value:!0});O0.RerankRequestDocumentsItem=void 0;var nOt=Lqr(G()),Fqr=PEe();O0.RerankRequestDocumentsItem=nOt.serialization.undiscriminatedUnion([nOt.serialization.string(),Fqr.RerankDocument])});var TEe=v(P0=>{"use strict";var kqr=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]}),$qr=P0&&P0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bqr=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)&&kqr(e,t,r);return $qr(e,t),e};Object.defineProperty(P0,"__esModule",{value:!0});P0.RerankResponseResultsItemDocument=void 0;var oOt=Bqr(G());P0.RerankResponseResultsItemDocument=oOt.serialization.object({text:oOt.serialization.string()})});var AEe=v(E0=>{"use strict";var qqr=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]}),Uqr=E0&&E0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zqr=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)&&qqr(e,t,r);return Uqr(e,t),e};Object.defineProperty(E0,"__esModule",{value:!0});E0.RerankResponseResultsItem=void 0;var tre=zqr(G()),Hqr=TEe();E0.RerankResponseResultsItem=tre.serialization.object({document:Hqr.RerankResponseResultsItemDocument.optional(),index:tre.serialization.number(),relevanceScore:tre.serialization.property("relevance_score",tre.serialization.number())})});var iOt=v(T0=>{"use strict";var Vqr=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]}),Wqr=T0&&T0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kqr=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)&&Vqr(e,t,r);return Wqr(e,t),e};Object.defineProperty(T0,"__esModule",{value:!0});T0.RerankResponse=void 0;var IEe=Kqr(G()),Gqr=AEe(),Jqr=qm();T0.RerankResponse=IEe.serialization.object({id:IEe.serialization.string().optional(),results:IEe.serialization.list(Gqr.RerankResponseResultsItem),meta:Jqr.ApiMeta.optional()})});var MEe=v(A0=>{"use strict";var Yqr=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]}),Zqr=A0&&A0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xqr=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)&&Yqr(e,t,r);return Zqr(e,t),e};Object.defineProperty(A0,"__esModule",{value:!0});A0.ClassifyRequestTruncate=void 0;var Qqr=Xqr(G());A0.ClassifyRequestTruncate=Qqr.serialization.enum_(["NONE","START","END"])});var REe=v(I0=>{"use strict";var eUr=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]}),tUr=I0&&I0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rUr=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)&&eUr(e,t,r);return tUr(e,t),e};Object.defineProperty(I0,"__esModule",{value:!0});I0.ClassifyResponseClassificationsItemLabelsValue=void 0;var aOt=rUr(G());I0.ClassifyResponseClassificationsItemLabelsValue=aOt.serialization.object({confidence:aOt.serialization.number().optional()})});var jEe=v(M0=>{"use strict";var nUr=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]}),oUr=M0&&M0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iUr=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)&&nUr(e,t,r);return oUr(e,t),e};Object.defineProperty(M0,"__esModule",{value:!0});M0.ClassifyResponseClassificationsItemClassificationType=void 0;var aUr=iUr(G());M0.ClassifyResponseClassificationsItemClassificationType=aUr.serialization.enum_(["single-label","multi-label"])});var NEe=v(R0=>{"use strict";var sUr=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]}),uUr=R0&&R0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lUr=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)&&sUr(e,t,r);return uUr(e,t),e};Object.defineProperty(R0,"__esModule",{value:!0});R0.ClassifyResponseClassificationsItem=void 0;var lg=lUr(G()),cUr=REe(),dUr=jEe();R0.ClassifyResponseClassificationsItem=lg.serialization.object({id:lg.serialization.string(),input:lg.serialization.string().optional(),prediction:lg.serialization.string().optional(),predictions:lg.serialization.list(lg.serialization.string()),confidence:lg.serialization.number().optional(),confidences:lg.serialization.list(lg.serialization.number()),labels:lg.serialization.record(lg.serialization.string(),cUr.ClassifyResponseClassificationsItemLabelsValue),classificationType:lg.serialization.property("classification_type",dUr.ClassifyResponseClassificationsItemClassificationType)})});var sOt=v(j0=>{"use strict";var fUr=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]}),pUr=j0&&j0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mUr=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)&&fUr(e,t,r);return pUr(e,t),e};Object.defineProperty(j0,"__esModule",{value:!0});j0.ClassifyResponse=void 0;var DEe=mUr(G()),hUr=NEe(),gUr=qm();j0.ClassifyResponse=DEe.serialization.object({id:DEe.serialization.string(),classifications:DEe.serialization.list(hUr.ClassifyResponseClassificationsItem),meta:gUr.ApiMeta.optional()})});var LEe=v(N0=>{"use strict";var yUr=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]}),bUr=N0&&N0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Ur=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)&&yUr(e,t,r);return bUr(e,t),e};Object.defineProperty(N0,"__esModule",{value:!0});N0.SummarizeRequestLength=void 0;var vUr=_Ur(G());N0.SummarizeRequestLength=vUr.serialization.enum_(["short","medium","long"])});var FEe=v(D0=>{"use strict";var wUr=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]}),SUr=D0&&D0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xUr=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)&&wUr(e,t,r);return SUr(e,t),e};Object.defineProperty(D0,"__esModule",{value:!0});D0.SummarizeRequestFormat=void 0;var CUr=xUr(G());D0.SummarizeRequestFormat=CUr.serialization.enum_(["paragraph","bullets"])});var kEe=v(L0=>{"use strict";var OUr=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]}),PUr=L0&&L0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EUr=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)&&OUr(e,t,r);return PUr(e,t),e};Object.defineProperty(L0,"__esModule",{value:!0});L0.SummarizeRequestExtractiveness=void 0;var TUr=EUr(G());L0.SummarizeRequestExtractiveness=TUr.serialization.enum_(["low","medium","high"])});var uOt=v(F0=>{"use strict";var AUr=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]}),IUr=F0&&F0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MUr=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)&&AUr(e,t,r);return IUr(e,t),e};Object.defineProperty(F0,"__esModule",{value:!0});F0.SummarizeResponse=void 0;var $Ee=MUr(G()),RUr=qm();F0.SummarizeResponse=$Ee.serialization.object({id:$Ee.serialization.string().optional(),summary:$Ee.serialization.string().optional(),meta:RUr.ApiMeta.optional()})});var lOt=v(k0=>{"use strict";var jUr=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]}),NUr=k0&&k0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DUr=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)&&jUr(e,t,r);return NUr(e,t),e};Object.defineProperty(k0,"__esModule",{value:!0});k0.TokenizeResponse=void 0;var Y$=DUr(G()),LUr=qm();k0.TokenizeResponse=Y$.serialization.object({tokens:Y$.serialization.list(Y$.serialization.number()),tokenStrings:Y$.serialization.property("token_strings",Y$.serialization.list(Y$.serialization.string())),meta:LUr.ApiMeta.optional()})});var dOt=v($0=>{"use strict";var FUr=$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]}),kUr=$0&&$0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Ur=$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)&&FUr(e,t,r);return kUr(e,t),e};Object.defineProperty($0,"__esModule",{value:!0});$0.DetokenizeResponse=void 0;var cOt=$Ur(G()),BUr=qm();$0.DetokenizeResponse=cOt.serialization.object({text:cOt.serialization.string(),meta:BUr.ApiMeta.optional()})});var fOt=v(B0=>{"use strict";var qUr=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]}),UUr=B0&&B0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zUr=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)&&qUr(e,t,r);return UUr(e,t),e};Object.defineProperty(B0,"__esModule",{value:!0});B0.CheckApiKeyResponse=void 0;var Z$=zUr(G());B0.CheckApiKeyResponse=Z$.serialization.object({valid:Z$.serialization.boolean(),organizationId:Z$.serialization.property("organization_id",Z$.serialization.string().optional()),ownerId:Z$.serialization.property("owner_id",Z$.serialization.string().optional())})});var X$=v(q0=>{"use strict";var HUr=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]}),VUr=q0&&q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WUr=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)&&HUr(e,t,r);return VUr(e,t),e};Object.defineProperty(q0,"__esModule",{value:!0});q0.ToolCall=void 0;var NV=WUr(G());q0.ToolCall=NV.serialization.object({name:NV.serialization.string(),parameters:NV.serialization.record(NV.serialization.string(),NV.serialization.unknown())})});var BEe=v(U0=>{"use strict";var KUr=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]}),GUr=U0&&U0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JUr=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)&&KUr(e,t,r);return GUr(e,t),e};Object.defineProperty(U0,"__esModule",{value:!0});U0.ChatMessage=void 0;var rre=JUr(G()),YUr=X$();U0.ChatMessage=rre.serialization.object({message:rre.serialization.string(),toolCalls:rre.serialization.property("tool_calls",rre.serialization.list(YUr.ToolCall).optional())})});var LV=v(z0=>{"use strict";var ZUr=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]}),XUr=z0&&z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QUr=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)&&ZUr(e,t,r);return XUr(e,t),e};Object.defineProperty(z0,"__esModule",{value:!0});z0.ToolResult=void 0;var DV=QUr(G()),ezr=X$();z0.ToolResult=DV.serialization.object({call:ezr.ToolCall,outputs:DV.serialization.list(DV.serialization.record(DV.serialization.string(),DV.serialization.unknown()))})});var UEe=v(H0=>{"use strict";var tzr=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]}),rzr=H0&&H0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nzr=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)&&tzr(e,t,r);return rzr(e,t),e};Object.defineProperty(H0,"__esModule",{value:!0});H0.ToolMessage=void 0;var qEe=nzr(G()),ozr=LV();H0.ToolMessage=qEe.serialization.object({toolResults:qEe.serialization.property("tool_results",qEe.serialization.list(ozr.ToolResult).optional())})});var FV=v(V0=>{"use strict";var izr=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]}),azr=V0&&V0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),szr=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)&&izr(e,t,r);return azr(e,t),e};Object.defineProperty(V0,"__esModule",{value:!0});V0.Message=void 0;var uzr=szr(G()),zEe=BEe(),lzr=UEe();V0.Message=uzr.serialization.union("role",{CHATBOT:zEe.ChatMessage,SYSTEM:zEe.ChatMessage,USER:zEe.ChatMessage,TOOL:lzr.ToolMessage}).transform({transform:t=>t,untransform:t=>t})});var nre=v(W0=>{"use strict";var czr=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]}),dzr=W0&&W0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fzr=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)&&czr(e,t,r);return dzr(e,t),e};Object.defineProperty(W0,"__esModule",{value:!0});W0.ChatConnector=void 0;var MO=fzr(G());W0.ChatConnector=MO.serialization.object({id:MO.serialization.string(),userAccessToken:MO.serialization.property("user_access_token",MO.serialization.string().optional()),continueOnFailure:MO.serialization.property("continue_on_failure",MO.serialization.boolean().optional()),options:MO.serialization.record(MO.serialization.string(),MO.serialization.unknown()).optional()})});var HEe=v(K0=>{"use strict";var pzr=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]}),mzr=K0&&K0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hzr=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)&&pzr(e,t,r);return mzr(e,t),e};Object.defineProperty(K0,"__esModule",{value:!0});K0.ToolParameterDefinitionsValue=void 0;var ore=hzr(G());K0.ToolParameterDefinitionsValue=ore.serialization.object({description:ore.serialization.string().optional(),type:ore.serialization.string(),required:ore.serialization.boolean().optional()})});var ire=v(G0=>{"use strict";var gzr=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]}),yzr=G0&&G0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bzr=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)&&gzr(e,t,r);return yzr(e,t),e};Object.defineProperty(G0,"__esModule",{value:!0});G0.Tool=void 0;var Q$=bzr(G()),_zr=HEe();G0.Tool=Q$.serialization.object({name:Q$.serialization.string(),description:Q$.serialization.string(),parameterDefinitions:Q$.serialization.property("parameter_definitions",Q$.serialization.record(Q$.serialization.string(),_zr.ToolParameterDefinitionsValue).optional())})});var VEe=v(J0=>{"use strict";var vzr=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]}),wzr=J0&&J0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Szr=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)&&vzr(e,t,r);return wzr(e,t),e};Object.defineProperty(J0,"__esModule",{value:!0});J0.JsonResponseFormat=void 0;var are=Szr(G());J0.JsonResponseFormat=are.serialization.object({schema:are.serialization.record(are.serialization.string(),are.serialization.unknown()).optional()})});var sre=v(Y0=>{"use strict";var xzr=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]}),Czr=Y0&&Y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ozr=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)&&xzr(e,t,r);return Czr(e,t),e};Object.defineProperty(Y0,"__esModule",{value:!0});Y0.ResponseFormat=void 0;var Pzr=Ozr(G()),Ezr=zte(),Tzr=VEe();Y0.ResponseFormat=Pzr.serialization.union("type",{text:Ezr.TextResponseFormat,json_object:Tzr.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var ure=v(Z0=>{"use strict";var Azr=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]}),Izr=Z0&&Z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mzr=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)&&Azr(e,t,r);return Izr(e,t),e};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.ChatCitation=void 0;var Pj=Mzr(G());Z0.ChatCitation=Pj.serialization.object({start:Pj.serialization.number(),end:Pj.serialization.number(),text:Pj.serialization.string(),documentIds:Pj.serialization.property("document_ids",Pj.serialization.list(Pj.serialization.string()))})});var kV=v(X0=>{"use strict";var Rzr=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]}),jzr=X0&&X0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nzr=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)&&Rzr(e,t,r);return jzr(e,t),e};Object.defineProperty(X0,"__esModule",{value:!0});X0.ChatSearchQuery=void 0;var lre=Nzr(G());X0.ChatSearchQuery=lre.serialization.object({text:lre.serialization.string(),generationId:lre.serialization.property("generation_id",lre.serialization.string())})});var WEe=v(Q0=>{"use strict";var Dzr=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]}),Lzr=Q0&&Q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fzr=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)&&Dzr(e,t,r);return Lzr(e,t),e};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.ChatSearchResultConnector=void 0;var pOt=Fzr(G());Q0.ChatSearchResultConnector=pOt.serialization.object({id:pOt.serialization.string()})});var cre=v(eS=>{"use strict";var kzr=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]}),$zr=eS&&eS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bzr=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)&&kzr(e,t,r);return $zr(e,t),e};Object.defineProperty(eS,"__esModule",{value:!0});eS.ChatSearchResult=void 0;var RO=Bzr(G()),qzr=kV(),Uzr=WEe();eS.ChatSearchResult=RO.serialization.object({searchQuery:RO.serialization.property("search_query",qzr.ChatSearchQuery.optional()),connector:Uzr.ChatSearchResultConnector,documentIds:RO.serialization.property("document_ids",RO.serialization.list(RO.serialization.string())),errorMessage:RO.serialization.property("error_message",RO.serialization.string().optional()),continueOnFailure:RO.serialization.property("continue_on_failure",RO.serialization.boolean().optional())})});var eB=v(tS=>{"use strict";var zzr=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]}),Hzr=tS&&tS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vzr=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)&&zzr(e,t,r);return Hzr(e,t),e};Object.defineProperty(tS,"__esModule",{value:!0});tS.FinishReason=void 0;var Wzr=Vzr(G());tS.FinishReason=Wzr.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var KEe=v(rS=>{"use strict";var Kzr=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]}),Gzr=rS&&rS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jzr=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)&&Kzr(e,t,r);return Gzr(e,t),e};Object.defineProperty(rS,"__esModule",{value:!0});rS.NonStreamedChatResponse=void 0;var ec=Jzr(G()),Yzr=ure(),Zzr=hj(),Xzr=kV(),Qzr=cre(),e2r=eB(),t2r=X$(),r2r=FV(),n2r=qm();rS.NonStreamedChatResponse=ec.serialization.object({text:ec.serialization.string(),generationId:ec.serialization.property("generation_id",ec.serialization.string().optional()),citations:ec.serialization.list(Yzr.ChatCitation).optional(),documents:ec.serialization.list(Zzr.ChatDocument).optional(),isSearchRequired:ec.serialization.property("is_search_required",ec.serialization.boolean().optional()),searchQueries:ec.serialization.property("search_queries",ec.serialization.list(Xzr.ChatSearchQuery).optional()),searchResults:ec.serialization.property("search_results",ec.serialization.list(Qzr.ChatSearchResult).optional()),finishReason:ec.serialization.property("finish_reason",e2r.FinishReason.optional()),toolCalls:ec.serialization.property("tool_calls",ec.serialization.list(t2r.ToolCall).optional()),chatHistory:ec.serialization.property("chat_history",ec.serialization.list(r2r.Message).optional()),prompt:ec.serialization.string().optional(),meta:n2r.ApiMeta.optional()})});var oS=v(nS=>{"use strict";var o2r=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]}),i2r=nS&&nS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a2r=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)&&o2r(e,t,r);return i2r(e,t),e};Object.defineProperty(nS,"__esModule",{value:!0});nS.ChatStreamEvent=void 0;var s2r=a2r(G());nS.ChatStreamEvent=s2r.serialization.object({})});var JEe=v(iS=>{"use strict";var u2r=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]}),l2r=iS&&iS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c2r=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)&&u2r(e,t,r);return l2r(e,t),e};Object.defineProperty(iS,"__esModule",{value:!0});iS.ChatStreamStartEvent=void 0;var GEe=c2r(G()),d2r=oS();iS.ChatStreamStartEvent=GEe.serialization.object({generationId:GEe.serialization.property("generation_id",GEe.serialization.string())}).extend(d2r.ChatStreamEvent)});var ZEe=v(aS=>{"use strict";var f2r=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]}),p2r=aS&&aS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m2r=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)&&f2r(e,t,r);return p2r(e,t),e};Object.defineProperty(aS,"__esModule",{value:!0});aS.ChatSearchQueriesGenerationEvent=void 0;var YEe=m2r(G()),h2r=kV(),g2r=oS();aS.ChatSearchQueriesGenerationEvent=YEe.serialization.object({searchQueries:YEe.serialization.property("search_queries",YEe.serialization.list(h2r.ChatSearchQuery))}).extend(g2r.ChatStreamEvent)});var XEe=v(sS=>{"use strict";var y2r=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]}),b2r=sS&&sS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_2r=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)&&y2r(e,t,r);return b2r(e,t),e};Object.defineProperty(sS,"__esModule",{value:!0});sS.ChatSearchResultsEvent=void 0;var dre=_2r(G()),v2r=cre(),w2r=hj(),S2r=oS();sS.ChatSearchResultsEvent=dre.serialization.object({searchResults:dre.serialization.property("search_results",dre.serialization.list(v2r.ChatSearchResult).optional()),documents:dre.serialization.list(w2r.ChatDocument).optional()}).extend(S2r.ChatStreamEvent)});var QEe=v(uS=>{"use strict";var x2r=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]}),C2r=uS&&uS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O2r=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)&&x2r(e,t,r);return C2r(e,t),e};Object.defineProperty(uS,"__esModule",{value:!0});uS.ChatTextGenerationEvent=void 0;var mOt=O2r(G()),P2r=oS();uS.ChatTextGenerationEvent=mOt.serialization.object({text:mOt.serialization.string()}).extend(P2r.ChatStreamEvent)});var eTe=v(lS=>{"use strict";var E2r=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]}),T2r=lS&&lS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A2r=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)&&E2r(e,t,r);return T2r(e,t),e};Object.defineProperty(lS,"__esModule",{value:!0});lS.ChatCitationGenerationEvent=void 0;var hOt=A2r(G()),I2r=ure(),M2r=oS();lS.ChatCitationGenerationEvent=hOt.serialization.object({citations:hOt.serialization.list(I2r.ChatCitation)}).extend(M2r.ChatStreamEvent)});var tTe=v(cS=>{"use strict";var R2r=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]}),j2r=cS&&cS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N2r=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)&&R2r(e,t,r);return j2r(e,t),e};Object.defineProperty(cS,"__esModule",{value:!0});cS.ChatToolCallsGenerationEvent=void 0;var fre=N2r(G()),D2r=X$(),L2r=oS();cS.ChatToolCallsGenerationEvent=fre.serialization.object({text:fre.serialization.string().optional(),toolCalls:fre.serialization.property("tool_calls",fre.serialization.list(D2r.ToolCall))}).extend(L2r.ChatStreamEvent)});var rTe=v(dS=>{"use strict";var F2r=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]}),k2r=dS&&dS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$2r=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)&&F2r(e,t,r);return k2r(e,t),e};Object.defineProperty(dS,"__esModule",{value:!0});dS.ChatStreamEndEventFinishReason=void 0;var B2r=$2r(G());dS.ChatStreamEndEventFinishReason=B2r.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var nTe=v(fS=>{"use strict";var q2r=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]}),U2r=fS&&fS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z2r=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)&&q2r(e,t,r);return U2r(e,t),e};Object.defineProperty(fS,"__esModule",{value:!0});fS.ChatStreamEndEvent=void 0;var gOt=z2r(G()),H2r=rTe(),V2r=KEe(),W2r=oS();fS.ChatStreamEndEvent=gOt.serialization.object({finishReason:gOt.serialization.property("finish_reason",H2r.ChatStreamEndEventFinishReason),response:V2r.NonStreamedChatResponse}).extend(W2r.ChatStreamEvent)});var oTe=v(pS=>{"use strict";var K2r=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]}),G2r=pS&&pS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J2r=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)&&K2r(e,t,r);return G2r(e,t),e};Object.defineProperty(pS,"__esModule",{value:!0});pS.ToolCallDelta=void 0;var $V=J2r(G());pS.ToolCallDelta=$V.serialization.object({name:$V.serialization.string().optional(),index:$V.serialization.number().optional(),parameters:$V.serialization.string().optional(),text:$V.serialization.string().optional()})});var iTe=v(mS=>{"use strict";var Y2r=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]}),Z2r=mS&&mS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X2r=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)&&Y2r(e,t,r);return Z2r(e,t),e};Object.defineProperty(mS,"__esModule",{value:!0});mS.ChatToolCallsChunkEvent=void 0;var yOt=X2r(G()),Q2r=oTe(),e4r=oS();mS.ChatToolCallsChunkEvent=yOt.serialization.object({toolCallDelta:yOt.serialization.property("tool_call_delta",Q2r.ToolCallDelta)}).extend(e4r.ChatStreamEvent)});var _Ot=v(hS=>{"use strict";var t4r=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]}),r4r=hS&&hS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n4r=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)&&t4r(e,t,r);return r4r(e,t),e};Object.defineProperty(hS,"__esModule",{value:!0});hS.StreamedChatResponse=void 0;var bOt=n4r(G()),o4r=JEe(),i4r=ZEe(),a4r=XEe(),s4r=QEe(),u4r=eTe(),l4r=tTe(),c4r=nTe(),d4r=iTe();hS.StreamedChatResponse=bOt.serialization.union(bOt.serialization.discriminant("eventType","event_type"),{"stream-start":o4r.ChatStreamStartEvent,"search-queries-generation":i4r.ChatSearchQueriesGenerationEvent,"search-results":a4r.ChatSearchResultsEvent,"text-generation":s4r.ChatTextGenerationEvent,"citation-generation":u4r.ChatCitationGenerationEvent,"tool-calls-generation":l4r.ChatToolCallsGenerationEvent,"stream-end":c4r.ChatStreamEndEvent,"tool-calls-chunk":d4r.ChatToolCallsChunkEvent}).transform({transform:t=>t,untransform:t=>t})});var sTe=v(gS=>{"use strict";var f4r=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]}),p4r=gS&&gS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m4r=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)&&f4r(e,t,r);return p4r(e,t),e};Object.defineProperty(gS,"__esModule",{value:!0});gS.SingleGenerationTokenLikelihoodsItem=void 0;var aTe=m4r(G());gS.SingleGenerationTokenLikelihoodsItem=aTe.serialization.object({token:aTe.serialization.string(),likelihood:aTe.serialization.number()})});var uTe=v(yS=>{"use strict";var h4r=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]}),g4r=yS&&yS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y4r=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)&&h4r(e,t,r);return g4r(e,t),e};Object.defineProperty(yS,"__esModule",{value:!0});yS.SingleGeneration=void 0;var Ej=y4r(G()),b4r=sTe();yS.SingleGeneration=Ej.serialization.object({id:Ej.serialization.string(),text:Ej.serialization.string(),index:Ej.serialization.number().optional(),likelihood:Ej.serialization.number().optional(),tokenLikelihoods:Ej.serialization.property("token_likelihoods",Ej.serialization.list(b4r.SingleGenerationTokenLikelihoodsItem).optional())})});var vOt=v(bS=>{"use strict";var _4r=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]}),v4r=bS&&bS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w4r=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)&&_4r(e,t,r);return v4r(e,t),e};Object.defineProperty(bS,"__esModule",{value:!0});bS.Generation=void 0;var pre=w4r(G()),S4r=uTe(),x4r=qm();bS.Generation=pre.serialization.object({id:pre.serialization.string(),prompt:pre.serialization.string().optional(),generations:pre.serialization.list(S4r.SingleGeneration),meta:x4r.ApiMeta.optional()})});var BV=v(_S=>{"use strict";var C4r=_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]}),O4r=_S&&_S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P4r=_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)&&C4r(e,t,r);return O4r(e,t),e};Object.defineProperty(_S,"__esModule",{value:!0});_S.GenerateStreamEvent=void 0;var E4r=P4r(G());_S.GenerateStreamEvent=E4r.serialization.object({})});var lTe=v(vS=>{"use strict";var T4r=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]}),A4r=vS&&vS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I4r=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)&&T4r(e,t,r);return A4r(e,t),e};Object.defineProperty(vS,"__esModule",{value:!0});vS.GenerateStreamText=void 0;var qV=I4r(G()),M4r=BV();vS.GenerateStreamText=qV.serialization.object({text:qV.serialization.string(),index:qV.serialization.number().optional(),isFinished:qV.serialization.property("is_finished",qV.serialization.boolean())}).extend(M4r.GenerateStreamEvent)});var cTe=v(wS=>{"use strict";var R4r=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]}),j4r=wS&&wS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N4r=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)&&R4r(e,t,r);return j4r(e,t),e};Object.defineProperty(wS,"__esModule",{value:!0});wS.SingleGenerationInStream=void 0;var UV=N4r(G()),D4r=eB();wS.SingleGenerationInStream=UV.serialization.object({id:UV.serialization.string(),text:UV.serialization.string(),index:UV.serialization.number().optional(),finishReason:UV.serialization.property("finish_reason",D4r.FinishReason)})});var dTe=v(SS=>{"use strict";var L4r=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]}),F4r=SS&&SS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k4r=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)&&L4r(e,t,r);return F4r(e,t),e};Object.defineProperty(SS,"__esModule",{value:!0});SS.GenerateStreamEndResponse=void 0;var mre=k4r(G()),$4r=cTe();SS.GenerateStreamEndResponse=mre.serialization.object({id:mre.serialization.string(),prompt:mre.serialization.string().optional(),generations:mre.serialization.list($4r.SingleGenerationInStream).optional()})});var fTe=v(xS=>{"use strict";var B4r=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]}),q4r=xS&&xS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U4r=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)&&B4r(e,t,r);return q4r(e,t),e};Object.defineProperty(xS,"__esModule",{value:!0});xS.GenerateStreamEnd=void 0;var hre=U4r(G()),z4r=eB(),H4r=dTe(),V4r=BV();xS.GenerateStreamEnd=hre.serialization.object({isFinished:hre.serialization.property("is_finished",hre.serialization.boolean()),finishReason:hre.serialization.property("finish_reason",z4r.FinishReason.optional()),response:H4r.GenerateStreamEndResponse}).extend(V4r.GenerateStreamEvent)});var pTe=v(CS=>{"use strict";var W4r=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]}),K4r=CS&&CS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G4r=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)&&W4r(e,t,r);return K4r(e,t),e};Object.defineProperty(CS,"__esModule",{value:!0});CS.GenerateStreamError=void 0;var tB=G4r(G()),J4r=eB(),Y4r=BV();CS.GenerateStreamError=tB.serialization.object({index:tB.serialization.number().optional(),isFinished:tB.serialization.property("is_finished",tB.serialization.boolean()),finishReason:tB.serialization.property("finish_reason",J4r.FinishReason),err:tB.serialization.string()}).extend(Y4r.GenerateStreamEvent)});var SOt=v(OS=>{"use strict";var Z4r=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]}),X4r=OS&&OS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q4r=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)&&Z4r(e,t,r);return X4r(e,t),e};Object.defineProperty(OS,"__esModule",{value:!0});OS.GenerateStreamedResponse=void 0;var wOt=Q4r(G()),e3r=lTe(),t3r=fTe(),r3r=pTe();OS.GenerateStreamedResponse=wOt.serialization.union(wOt.serialization.discriminant("eventType","event_type"),{"text-generation":e3r.GenerateStreamText,"stream-end":t3r.GenerateStreamEnd,"stream-error":r3r.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var mTe=v(PS=>{"use strict";var n3r=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]}),o3r=PS&&PS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i3r=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)&&n3r(e,t,r);return o3r(e,t),e};Object.defineProperty(PS,"__esModule",{value:!0});PS.EmbedJobStatus=void 0;var a3r=i3r(G());PS.EmbedJobStatus=a3r.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var hTe=v(ES=>{"use strict";var s3r=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]}),u3r=ES&&ES.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l3r=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)&&s3r(e,t,r);return u3r(e,t),e};Object.defineProperty(ES,"__esModule",{value:!0});ES.EmbedJobTruncate=void 0;var c3r=l3r(G());ES.EmbedJobTruncate=c3r.serialization.enum_(["START","END"])});var gTe=v(TS=>{"use strict";var d3r=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]}),f3r=TS&&TS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p3r=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)&&d3r(e,t,r);return f3r(e,t),e};Object.defineProperty(TS,"__esModule",{value:!0});TS.EmbedJob=void 0;var Uy=p3r(G()),m3r=mTe(),h3r=hTe(),g3r=qm();TS.EmbedJob=Uy.serialization.object({jobId:Uy.serialization.property("job_id",Uy.serialization.string()),name:Uy.serialization.string().optional(),status:m3r.EmbedJobStatus,createdAt:Uy.serialization.property("created_at",Uy.serialization.date()),inputDatasetId:Uy.serialization.property("input_dataset_id",Uy.serialization.string()),outputDatasetId:Uy.serialization.property("output_dataset_id",Uy.serialization.string().optional()),model:Uy.serialization.string(),truncate:h3r.EmbedJobTruncate,meta:g3r.ApiMeta.optional()})});var xOt=v(AS=>{"use strict";var y3r=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]}),b3r=AS&&AS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_3r=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)&&y3r(e,t,r);return b3r(e,t),e};Object.defineProperty(AS,"__esModule",{value:!0});AS.ListEmbedJobResponse=void 0;var yTe=_3r(G()),v3r=gTe();AS.ListEmbedJobResponse=yTe.serialization.object({embedJobs:yTe.serialization.property("embed_jobs",yTe.serialization.list(v3r.EmbedJob).optional())})});var COt=v(IS=>{"use strict";var w3r=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]}),S3r=IS&&IS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x3r=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)&&w3r(e,t,r);return S3r(e,t),e};Object.defineProperty(IS,"__esModule",{value:!0});IS.CreateEmbedJobResponse=void 0;var bTe=x3r(G()),C3r=qm();IS.CreateEmbedJobResponse=bTe.serialization.object({jobId:bTe.serialization.property("job_id",bTe.serialization.string()),meta:C3r.ApiMeta.optional()})});var vTe=v(MS=>{"use strict";var O3r=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]}),P3r=MS&&MS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E3r=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)&&O3r(e,t,r);return P3r(e,t),e};Object.defineProperty(MS,"__esModule",{value:!0});MS.ClassifyExample=void 0;var _Te=E3r(G());MS.ClassifyExample=_Te.serialization.object({text:_Te.serialization.string().optional(),label:_Te.serialization.string().optional()})});var OOt=v(RS=>{"use strict";var T3r=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]}),A3r=RS&&RS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I3r=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)&&T3r(e,t,r);return A3r(e,t),e};Object.defineProperty(RS,"__esModule",{value:!0});RS.ParseInfo=void 0;var wTe=I3r(G());RS.ParseInfo=wTe.serialization.object({separator:wTe.serialization.string().optional(),delimiter:wTe.serialization.string().optional()})});var POt=v(jS=>{"use strict";var M3r=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]}),R3r=jS&&jS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j3r=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)&&M3r(e,t,r);return R3r(e,t),e};Object.defineProperty(jS,"__esModule",{value:!0});jS.RerankerDataMetrics=void 0;var Um=j3r(G());jS.RerankerDataMetrics=Um.serialization.object({numTrainQueries:Um.serialization.property("num_train_queries",Um.serialization.number().optional()),numTrainRelevantPassages:Um.serialization.property("num_train_relevant_passages",Um.serialization.number().optional()),numTrainHardNegatives:Um.serialization.property("num_train_hard_negatives",Um.serialization.number().optional()),numEvalQueries:Um.serialization.property("num_eval_queries",Um.serialization.number().optional()),numEvalRelevantPassages:Um.serialization.property("num_eval_relevant_passages",Um.serialization.number().optional()),numEvalHardNegatives:Um.serialization.property("num_eval_hard_negatives",Um.serialization.number().optional())})});var EOt=v(NS=>{"use strict";var N3r=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]}),D3r=NS&&NS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L3r=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)&&N3r(e,t,r);return D3r(e,t),e};Object.defineProperty(NS,"__esModule",{value:!0});NS.ChatDataMetrics=void 0;var rB=L3r(G());NS.ChatDataMetrics=rB.serialization.object({numTrainTurns:rB.serialization.property("num_train_turns",rB.serialization.number().optional()),numEvalTurns:rB.serialization.property("num_eval_turns",rB.serialization.number().optional()),preamble:rB.serialization.string().optional()})});var STe=v(DS=>{"use strict";var F3r=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]}),k3r=DS&&DS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$3r=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)&&F3r(e,t,r);return k3r(e,t),e};Object.defineProperty(DS,"__esModule",{value:!0});DS.LabelMetric=void 0;var nB=$3r(G());DS.LabelMetric=nB.serialization.object({totalExamples:nB.serialization.property("total_examples",nB.serialization.number().optional()),label:nB.serialization.string().optional(),samples:nB.serialization.list(nB.serialization.string()).optional()})});var TOt=v(LS=>{"use strict";var B3r=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]}),q3r=LS&&LS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U3r=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)&&B3r(e,t,r);return q3r(e,t),e};Object.defineProperty(LS,"__esModule",{value:!0});LS.ClassifyDataMetrics=void 0;var xTe=U3r(G()),z3r=STe();LS.ClassifyDataMetrics=xTe.serialization.object({labelMetrics:xTe.serialization.property("label_metrics",xTe.serialization.list(z3r.LabelMetric).optional())})});var CTe=v(FS=>{"use strict";var H3r=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]}),V3r=FS&&FS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W3r=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)&&H3r(e,t,r);return V3r(e,t),e};Object.defineProperty(FS,"__esModule",{value:!0});FS.FinetuneDatasetMetrics=void 0;var zm=W3r(G());FS.FinetuneDatasetMetrics=zm.serialization.object({trainableTokenCount:zm.serialization.property("trainable_token_count",zm.serialization.number().optional()),totalExamples:zm.serialization.property("total_examples",zm.serialization.number().optional()),trainExamples:zm.serialization.property("train_examples",zm.serialization.number().optional()),trainSizeBytes:zm.serialization.property("train_size_bytes",zm.serialization.number().optional()),evalExamples:zm.serialization.property("eval_examples",zm.serialization.number().optional()),evalSizeBytes:zm.serialization.property("eval_size_bytes",zm.serialization.number().optional())})});var PTe=v(kS=>{"use strict";var K3r=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]}),G3r=kS&&kS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J3r=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)&&K3r(e,t,r);return G3r(e,t),e};Object.defineProperty(kS,"__esModule",{value:!0});kS.MetricsEmbedDataFieldsItem=void 0;var OTe=J3r(G());kS.MetricsEmbedDataFieldsItem=OTe.serialization.object({name:OTe.serialization.string().optional(),count:OTe.serialization.number().optional()})});var ETe=v($S=>{"use strict";var Y3r=$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]}),Z3r=$S&&$S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X3r=$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)&&Y3r(e,t,r);return Z3r(e,t),e};Object.defineProperty($S,"__esModule",{value:!0});$S.MetricsEmbedData=void 0;var AOt=X3r(G()),Q3r=PTe();$S.MetricsEmbedData=AOt.serialization.object({fields:AOt.serialization.list(Q3r.MetricsEmbedDataFieldsItem).optional()})});var IOt=v(BS=>{"use strict";var eHr=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]}),tHr=BS&&BS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rHr=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)&&eHr(e,t,r);return tHr(e,t),e};Object.defineProperty(BS,"__esModule",{value:!0});BS.Metrics=void 0;var TTe=rHr(G()),nHr=CTe(),oHr=ETe();BS.Metrics=TTe.serialization.object({finetuneDatasetMetrics:TTe.serialization.property("finetune_dataset_metrics",nHr.FinetuneDatasetMetrics.optional()),embedData:TTe.serialization.property("embed_data",oHr.MetricsEmbedData.optional())})});var ATe=v(US=>{"use strict";var iHr=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]}),aHr=US&&US.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sHr=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)&&iHr(e,t,r);return aHr(e,t),e};Object.defineProperty(US,"__esModule",{value:!0});US.ConnectorOAuth=void 0;var qS=sHr(G());US.ConnectorOAuth=qS.serialization.object({clientId:qS.serialization.property("client_id",qS.serialization.string().optional()),clientSecret:qS.serialization.property("client_secret",qS.serialization.string().optional()),authorizeUrl:qS.serialization.property("authorize_url",qS.serialization.string()),tokenUrl:qS.serialization.property("token_url",qS.serialization.string()),scope:qS.serialization.string().optional()})});var ITe=v(zS=>{"use strict";var uHr=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]}),lHr=zS&&zS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cHr=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)&&uHr(e,t,r);return lHr(e,t),e};Object.defineProperty(zS,"__esModule",{value:!0});zS.ConnectorAuthStatus=void 0;var dHr=cHr(G());zS.ConnectorAuthStatus=dHr.serialization.enum_(["valid","expired"])});var oB=v(HS=>{"use strict";var fHr=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]}),pHr=HS&&HS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mHr=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)&&fHr(e,t,r);return pHr(e,t),e};Object.defineProperty(HS,"__esModule",{value:!0});HS.Connector=void 0;var Rl=mHr(G()),hHr=ATe(),gHr=ITe();HS.Connector=Rl.serialization.object({id:Rl.serialization.string(),organizationId:Rl.serialization.property("organization_id",Rl.serialization.string().optional()),name:Rl.serialization.string(),description:Rl.serialization.string().optional(),url:Rl.serialization.string().optional(),createdAt:Rl.serialization.property("created_at",Rl.serialization.date()),updatedAt:Rl.serialization.property("updated_at",Rl.serialization.date()),excludes:Rl.serialization.list(Rl.serialization.string()).optional(),authType:Rl.serialization.property("auth_type",Rl.serialization.string().optional()),oauth:hHr.ConnectorOAuth.optional(),authStatus:Rl.serialization.property("auth_status",gHr.ConnectorAuthStatus.optional()),active:Rl.serialization.boolean().optional(),continueOnFailure:Rl.serialization.property("continue_on_failure",Rl.serialization.boolean().optional())})});var MOt=v(VS=>{"use strict";var yHr=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]}),bHr=VS&&VS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Hr=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)&&yHr(e,t,r);return bHr(e,t),e};Object.defineProperty(VS,"__esModule",{value:!0});VS.ListConnectorsResponse=void 0;var gre=_Hr(G()),vHr=oB();VS.ListConnectorsResponse=gre.serialization.object({connectors:gre.serialization.list(vHr.Connector),totalCount:gre.serialization.property("total_count",gre.serialization.number().optional())})});var ROt=v(WS=>{"use strict";var wHr=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]}),SHr=WS&&WS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xHr=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)&&wHr(e,t,r);return SHr(e,t),e};Object.defineProperty(WS,"__esModule",{value:!0});WS.CreateConnectorResponse=void 0;var CHr=xHr(G()),OHr=oB();WS.CreateConnectorResponse=CHr.serialization.object({connector:OHr.Connector})});var jOt=v(KS=>{"use strict";var PHr=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]}),EHr=KS&&KS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),THr=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)&&PHr(e,t,r);return EHr(e,t),e};Object.defineProperty(KS,"__esModule",{value:!0});KS.GetConnectorResponse=void 0;var AHr=THr(G()),IHr=oB();KS.GetConnectorResponse=AHr.serialization.object({connector:IHr.Connector})});var NOt=v(GS=>{"use strict";var MHr=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]}),RHr=GS&&GS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jHr=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)&&MHr(e,t,r);return RHr(e,t),e};Object.defineProperty(GS,"__esModule",{value:!0});GS.DeleteConnectorResponse=void 0;var MTe=jHr(G());GS.DeleteConnectorResponse=MTe.serialization.record(MTe.serialization.string(),MTe.serialization.unknown())});var DOt=v(JS=>{"use strict";var NHr=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]}),DHr=JS&&JS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LHr=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)&&NHr(e,t,r);return DHr(e,t),e};Object.defineProperty(JS,"__esModule",{value:!0});JS.UpdateConnectorResponse=void 0;var FHr=LHr(G()),kHr=oB();JS.UpdateConnectorResponse=FHr.serialization.object({connector:kHr.Connector})});var LOt=v(YS=>{"use strict";var $Hr=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]}),BHr=YS&&YS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qHr=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)&&$Hr(e,t,r);return BHr(e,t),e};Object.defineProperty(YS,"__esModule",{value:!0});YS.OAuthAuthorizeResponse=void 0;var RTe=qHr(G());YS.OAuthAuthorizeResponse=RTe.serialization.object({redirectUrl:RTe.serialization.property("redirect_url",RTe.serialization.string().optional())})});var jTe=v(ZS=>{"use strict";var UHr=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]}),zHr=ZS&&ZS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HHr=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)&&UHr(e,t,r);return zHr(e,t),e};Object.defineProperty(ZS,"__esModule",{value:!0});ZS.CompatibleEndpoint=void 0;var VHr=HHr(G());ZS.CompatibleEndpoint=VHr.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var NTe=v(QS=>{"use strict";var WHr=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]}),KHr=QS&&QS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GHr=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)&&WHr(e,t,r);return KHr(e,t),e};Object.defineProperty(QS,"__esModule",{value:!0});QS.GetModelResponse=void 0;var XS=GHr(G()),FOt=jTe();QS.GetModelResponse=XS.serialization.object({name:XS.serialization.string().optional(),endpoints:XS.serialization.list(FOt.CompatibleEndpoint).optional(),finetuned:XS.serialization.boolean().optional(),contextLength:XS.serialization.property("context_length",XS.serialization.number().optional()),tokenizerUrl:XS.serialization.property("tokenizer_url",XS.serialization.string().optional()),defaultEndpoints:XS.serialization.property("default_endpoints",XS.serialization.list(FOt.CompatibleEndpoint).optional())})});var kOt=v(ex=>{"use strict";var JHr=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]}),YHr=ex&&ex.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZHr=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)&&JHr(e,t,r);return YHr(e,t),e};Object.defineProperty(ex,"__esModule",{value:!0});ex.ListModelsResponse=void 0;var yre=ZHr(G()),XHr=NTe();ex.ListModelsResponse=yre.serialization.object({models:yre.serialization.list(XHr.GetModelResponse),nextPageToken:yre.serialization.property("next_page_token",yre.serialization.string().optional())})});var $Ot=v(me=>{"use strict";var QHr=me&&me.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xe=me&&me.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&QHr(e,t,r)};Object.defineProperty(me,"__esModule",{value:!0});xe(uEe(),me);xe(lEe(),me);xe(UCt(),me);xe(cEe(),me);xe(HCt(),me);xe(WCt(),me);xe(GCt(),me);xe(YCt(),me);xe(XCt(),me);xe(dEe(),me);xe(fEe(),me);xe(eOt(),me);xe(pEe(),me);xe(mEe(),me);xe(hEe(),me);xe(gEe(),me);xe(yEe(),me);xe(bEe(),me);xe(rOt(),me);xe(EEe(),me);xe(TEe(),me);xe(AEe(),me);xe(iOt(),me);xe(MEe(),me);xe(REe(),me);xe(jEe(),me);xe(NEe(),me);xe(sOt(),me);xe(LEe(),me);xe(FEe(),me);xe(kEe(),me);xe(uOt(),me);xe(lOt(),me);xe(dOt(),me);xe(fOt(),me);xe(X$(),me);xe(BEe(),me);xe(LV(),me);xe(UEe(),me);xe(FV(),me);xe(nre(),me);xe(hj(),me);xe(HEe(),me);xe(ire(),me);xe(zte(),me);xe(VEe(),me);xe(sre(),me);xe(ure(),me);xe(kV(),me);xe(WEe(),me);xe(cre(),me);xe(eB(),me);xe(_Ee(),me);xe(vEe(),me);xe(wEe(),me);xe(qm(),me);xe(KEe(),me);xe(oS(),me);xe(JEe(),me);xe(ZEe(),me);xe(XEe(),me);xe(QEe(),me);xe(eTe(),me);xe(tTe(),me);xe(rTe(),me);xe(nTe(),me);xe(oTe(),me);xe(iTe(),me);xe(_Ot(),me);xe($Pe(),me);xe(Hte(),me);xe(NPe(),me);xe(DPe(),me);xe(LPe(),me);xe(FPe(),me);xe(sTe(),me);xe(uTe(),me);xe(vOt(),me);xe(BV(),me);xe(lTe(),me);xe(cTe(),me);xe(dTe(),me);xe(fTe(),me);xe(pTe(),me);xe(SOt(),me);xe(Vte(),me);xe(Wte(),me);xe(SEe(),me);xe(xEe(),me);xe(CEe(),me);xe(mTe(),me);xe(hTe(),me);xe(gTe(),me);xe(xOt(),me);xe(COt(),me);xe(PEe(),me);xe(vTe(),me);xe(VPe(),me);xe(HPe(),me);xe(WPe(),me);xe(OOt(),me);xe(POt(),me);xe(EOt(),me);xe(STe(),me);xe(TOt(),me);xe(CTe(),me);xe(PTe(),me);xe(ETe(),me);xe(IOt(),me);xe(Gte(),me);xe(ATe(),me);xe(ITe(),me);xe(oB(),me);xe(MOt(),me);xe(Xte(),me);xe(aEe(),me);xe(Qte(),me);xe(ROt(),me);xe(jOt(),me);xe(NOt(),me);xe(DOt(),me);xe(LOt(),me);xe(jTe(),me);xe(NTe(),me);xe(kOt(),me)});var BOt=v(tx=>{"use strict";var eVr=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]}),tVr=tx&&tx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rVr=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)&&eVr(e,t,r);return tVr(e,t),e};Object.defineProperty(tx,"__esModule",{value:!0});tx.ChatStreamRequest=void 0;var dn=rVr(G()),nVr=FV(),oVr=uEe(),iVr=nre(),aVr=hj(),sVr=lEe(),uVr=ire(),lVr=LV(),cVr=sre(),dVr=cEe();tx.ChatStreamRequest=dn.serialization.object({message:dn.serialization.string(),model:dn.serialization.string().optional(),preamble:dn.serialization.string().optional(),chatHistory:dn.serialization.property("chat_history",dn.serialization.list(nVr.Message).optional()),conversationId:dn.serialization.property("conversation_id",dn.serialization.string().optional()),promptTruncation:dn.serialization.property("prompt_truncation",oVr.ChatStreamRequestPromptTruncation.optional()),connectors:dn.serialization.list(iVr.ChatConnector).optional(),searchQueriesOnly:dn.serialization.property("search_queries_only",dn.serialization.boolean().optional()),documents:dn.serialization.list(aVr.ChatDocument).optional(),citationQuality:dn.serialization.property("citation_quality",sVr.ChatStreamRequestCitationQuality.optional()),temperature:dn.serialization.number().optional(),maxTokens:dn.serialization.property("max_tokens",dn.serialization.number().optional()),maxInputTokens:dn.serialization.property("max_input_tokens",dn.serialization.number().optional()),k:dn.serialization.number().optional(),p:dn.serialization.number().optional(),seed:dn.serialization.number().optional(),stopSequences:dn.serialization.property("stop_sequences",dn.serialization.list(dn.serialization.string()).optional()),frequencyPenalty:dn.serialization.property("frequency_penalty",dn.serialization.number().optional()),presencePenalty:dn.serialization.property("presence_penalty",dn.serialization.number().optional()),rawPrompting:dn.serialization.property("raw_prompting",dn.serialization.boolean().optional()),returnPrompt:dn.serialization.property("return_prompt",dn.serialization.boolean().optional()),tools:dn.serialization.list(uVr.Tool).optional(),toolResults:dn.serialization.property("tool_results",dn.serialization.list(lVr.ToolResult).optional()),forceSingleStep:dn.serialization.property("force_single_step",dn.serialization.boolean().optional()),responseFormat:dn.serialization.property("response_format",cVr.ResponseFormat.optional()),safetyMode:dn.serialization.property("safety_mode",dVr.ChatStreamRequestSafetyMode.optional())})});var qOt=v(rx=>{"use strict";var fVr=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]}),pVr=rx&&rx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mVr=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)&&fVr(e,t,r);return pVr(e,t),e};Object.defineProperty(rx,"__esModule",{value:!0});rx.ChatRequest=void 0;var fn=mVr(G()),hVr=FV(),gVr=dEe(),yVr=nre(),bVr=hj(),_Vr=fEe(),vVr=ire(),wVr=LV(),SVr=sre(),xVr=pEe();rx.ChatRequest=fn.serialization.object({message:fn.serialization.string(),model:fn.serialization.string().optional(),preamble:fn.serialization.string().optional(),chatHistory:fn.serialization.property("chat_history",fn.serialization.list(hVr.Message).optional()),conversationId:fn.serialization.property("conversation_id",fn.serialization.string().optional()),promptTruncation:fn.serialization.property("prompt_truncation",gVr.ChatRequestPromptTruncation.optional()),connectors:fn.serialization.list(yVr.ChatConnector).optional(),searchQueriesOnly:fn.serialization.property("search_queries_only",fn.serialization.boolean().optional()),documents:fn.serialization.list(bVr.ChatDocument).optional(),citationQuality:fn.serialization.property("citation_quality",_Vr.ChatRequestCitationQuality.optional()),temperature:fn.serialization.number().optional(),maxTokens:fn.serialization.property("max_tokens",fn.serialization.number().optional()),maxInputTokens:fn.serialization.property("max_input_tokens",fn.serialization.number().optional()),k:fn.serialization.number().optional(),p:fn.serialization.number().optional(),seed:fn.serialization.number().optional(),stopSequences:fn.serialization.property("stop_sequences",fn.serialization.list(fn.serialization.string()).optional()),frequencyPenalty:fn.serialization.property("frequency_penalty",fn.serialization.number().optional()),presencePenalty:fn.serialization.property("presence_penalty",fn.serialization.number().optional()),rawPrompting:fn.serialization.property("raw_prompting",fn.serialization.boolean().optional()),returnPrompt:fn.serialization.property("return_prompt",fn.serialization.boolean().optional()),tools:fn.serialization.list(vVr.Tool).optional(),toolResults:fn.serialization.property("tool_results",fn.serialization.list(wVr.ToolResult).optional()),forceSingleStep:fn.serialization.property("force_single_step",fn.serialization.boolean().optional()),responseFormat:fn.serialization.property("response_format",SVr.ResponseFormat.optional()),safetyMode:fn.serialization.property("safety_mode",xVr.ChatRequestSafetyMode.optional())})});var UOt=v(nx=>{"use strict";var CVr=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]}),OVr=nx&&nx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PVr=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)&&CVr(e,t,r);return OVr(e,t),e};Object.defineProperty(nx,"__esModule",{value:!0});nx.GenerateStreamRequest=void 0;var ca=PVr(G()),EVr=mEe(),TVr=hEe();nx.GenerateStreamRequest=ca.serialization.object({prompt:ca.serialization.string(),model:ca.serialization.string().optional(),numGenerations:ca.serialization.property("num_generations",ca.serialization.number().optional()),maxTokens:ca.serialization.property("max_tokens",ca.serialization.number().optional()),truncate:EVr.GenerateStreamRequestTruncate.optional(),temperature:ca.serialization.number().optional(),seed:ca.serialization.number().optional(),preset:ca.serialization.string().optional(),endSequences:ca.serialization.property("end_sequences",ca.serialization.list(ca.serialization.string()).optional()),stopSequences:ca.serialization.property("stop_sequences",ca.serialization.list(ca.serialization.string()).optional()),k:ca.serialization.number().optional(),p:ca.serialization.number().optional(),frequencyPenalty:ca.serialization.property("frequency_penalty",ca.serialization.number().optional()),presencePenalty:ca.serialization.property("presence_penalty",ca.serialization.number().optional()),returnLikelihoods:ca.serialization.property("return_likelihoods",TVr.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:ca.serialization.property("raw_prompting",ca.serialization.boolean().optional())})});var zOt=v(ox=>{"use strict";var AVr=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]}),IVr=ox&&ox.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MVr=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)&&AVr(e,t,r);return IVr(e,t),e};Object.defineProperty(ox,"__esModule",{value:!0});ox.GenerateRequest=void 0;var da=MVr(G()),RVr=gEe(),jVr=yEe();ox.GenerateRequest=da.serialization.object({prompt:da.serialization.string(),model:da.serialization.string().optional(),numGenerations:da.serialization.property("num_generations",da.serialization.number().optional()),maxTokens:da.serialization.property("max_tokens",da.serialization.number().optional()),truncate:RVr.GenerateRequestTruncate.optional(),temperature:da.serialization.number().optional(),seed:da.serialization.number().optional(),preset:da.serialization.string().optional(),endSequences:da.serialization.property("end_sequences",da.serialization.list(da.serialization.string()).optional()),stopSequences:da.serialization.property("stop_sequences",da.serialization.list(da.serialization.string()).optional()),k:da.serialization.number().optional(),p:da.serialization.number().optional(),frequencyPenalty:da.serialization.property("frequency_penalty",da.serialization.number().optional()),presencePenalty:da.serialization.property("presence_penalty",da.serialization.number().optional()),returnLikelihoods:da.serialization.property("return_likelihoods",jVr.GenerateRequestReturnLikelihoods.optional()),rawPrompting:da.serialization.property("raw_prompting",da.serialization.boolean().optional())})});var HOt=v(ix=>{"use strict";var NVr=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]}),DVr=ix&&ix.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LVr=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)&&NVr(e,t,r);return DVr(e,t),e};Object.defineProperty(ix,"__esModule",{value:!0});ix.EmbedRequest=void 0;var Tj=LVr(G()),FVr=Vte(),kVr=Wte(),$Vr=bEe();ix.EmbedRequest=Tj.serialization.object({texts:Tj.serialization.list(Tj.serialization.string()),model:Tj.serialization.string().optional(),inputType:Tj.serialization.property("input_type",FVr.EmbedInputType.optional()),embeddingTypes:Tj.serialization.property("embedding_types",Tj.serialization.list(kVr.EmbeddingType).optional()),truncate:$Vr.EmbedRequestTruncate.optional()})});var VOt=v(ax=>{"use strict";var BVr=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]}),qVr=ax&&ax.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UVr=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)&&BVr(e,t,r);return qVr(e,t),e};Object.defineProperty(ax,"__esModule",{value:!0});ax.RerankRequest=void 0;var Hm=UVr(G()),zVr=EEe();ax.RerankRequest=Hm.serialization.object({model:Hm.serialization.string().optional(),query:Hm.serialization.string(),documents:Hm.serialization.list(zVr.RerankRequestDocumentsItem),topN:Hm.serialization.property("top_n",Hm.serialization.number().optional()),rankFields:Hm.serialization.property("rank_fields",Hm.serialization.list(Hm.serialization.string()).optional()),returnDocuments:Hm.serialization.property("return_documents",Hm.serialization.boolean().optional()),maxChunksPerDoc:Hm.serialization.property("max_chunks_per_doc",Hm.serialization.number().optional())})});var WOt=v(sx=>{"use strict";var HVr=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]}),VVr=sx&&sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WVr=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)&&HVr(e,t,r);return VVr(e,t),e};Object.defineProperty(sx,"__esModule",{value:!0});sx.ClassifyRequest=void 0;var iB=WVr(G()),KVr=vTe(),GVr=MEe();sx.ClassifyRequest=iB.serialization.object({inputs:iB.serialization.list(iB.serialization.string()),examples:iB.serialization.list(KVr.ClassifyExample).optional(),model:iB.serialization.string().optional(),preset:iB.serialization.string().optional(),truncate:GVr.ClassifyRequestTruncate.optional()})});var KOt=v(ux=>{"use strict";var JVr=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]}),YVr=ux&&ux.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZVr=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)&&JVr(e,t,r);return YVr(e,t),e};Object.defineProperty(ux,"__esModule",{value:!0});ux.SummarizeRequest=void 0;var aB=ZVr(G()),XVr=LEe(),QVr=FEe(),e8r=kEe();ux.SummarizeRequest=aB.serialization.object({text:aB.serialization.string(),length:XVr.SummarizeRequestLength.optional(),format:QVr.SummarizeRequestFormat.optional(),model:aB.serialization.string().optional(),extractiveness:e8r.SummarizeRequestExtractiveness.optional(),temperature:aB.serialization.number().optional(),additionalCommand:aB.serialization.property("additional_command",aB.serialization.string().optional())})});var GOt=v(lx=>{"use strict";var t8r=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]}),r8r=lx&&lx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n8r=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)&&t8r(e,t,r);return r8r(e,t),e};Object.defineProperty(lx,"__esModule",{value:!0});lx.TokenizeRequest=void 0;var DTe=n8r(G());lx.TokenizeRequest=DTe.serialization.object({text:DTe.serialization.string(),model:DTe.serialization.string()})});var JOt=v(cx=>{"use strict";var o8r=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]}),i8r=cx&&cx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a8r=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)&&o8r(e,t,r);return i8r(e,t),e};Object.defineProperty(cx,"__esModule",{value:!0});cx.DetokenizeRequest=void 0;var bre=a8r(G());cx.DetokenizeRequest=bre.serialization.object({tokens:bre.serialization.list(bre.serialization.number()),model:bre.serialization.string()})});var YOt=v(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.DetokenizeRequest=ps.TokenizeRequest=ps.SummarizeRequest=ps.ClassifyRequest=ps.RerankRequest=ps.EmbedRequest=ps.GenerateRequest=ps.GenerateStreamRequest=ps.ChatRequest=ps.ChatStreamRequest=void 0;var s8r=BOt();Object.defineProperty(ps,"ChatStreamRequest",{enumerable:!0,get:function(){return s8r.ChatStreamRequest}});var u8r=qOt();Object.defineProperty(ps,"ChatRequest",{enumerable:!0,get:function(){return u8r.ChatRequest}});var l8r=UOt();Object.defineProperty(ps,"GenerateStreamRequest",{enumerable:!0,get:function(){return l8r.GenerateStreamRequest}});var c8r=zOt();Object.defineProperty(ps,"GenerateRequest",{enumerable:!0,get:function(){return c8r.GenerateRequest}});var d8r=HOt();Object.defineProperty(ps,"EmbedRequest",{enumerable:!0,get:function(){return d8r.EmbedRequest}});var f8r=VOt();Object.defineProperty(ps,"RerankRequest",{enumerable:!0,get:function(){return f8r.RerankRequest}});var p8r=WOt();Object.defineProperty(ps,"ClassifyRequest",{enumerable:!0,get:function(){return p8r.ClassifyRequest}});var m8r=KOt();Object.defineProperty(ps,"SummarizeRequest",{enumerable:!0,get:function(){return m8r.SummarizeRequest}});var h8r=GOt();Object.defineProperty(ps,"TokenizeRequest",{enumerable:!0,get:function(){return h8r.TokenizeRequest}});var g8r=JOt();Object.defineProperty(ps,"DetokenizeRequest",{enumerable:!0,get:function(){return g8r.DetokenizeRequest}})});var ZOt=v(Aj=>{"use strict";var y8r=Aj&&Aj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),b8r=Aj&&Aj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&y8r(e,t,r)};Object.defineProperty(Aj,"__esModule",{value:!0});b8r(YOt(),Aj)});var NO=v(jO=>{"use strict";var _8r=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]}),LTe=jO&&jO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_8r(e,t,r)};Object.defineProperty(jO,"__esModule",{value:!0});LTe(BCt(),jO);LTe($Ot(),jO);LTe(ZOt(),jO)});var FTe=v(ni=>{"use strict";var v8r=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]}),w8r=ni&&ni.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S8r=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)&&v8r(e,t,r);return w8r(e,t),e},_re=ni&&ni.__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())})},x8r=ni&&ni.__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(ni,"__esModule",{value:!0});ni.fetchOverride=ni.parseAWSEvent=ni.getEndpointFromUrl=ni.getAuthHeaders=ni.getUrl=ni.mapResponseFromBedrock=void 0;var C8r=x_e(),O8r=(zpt(),zl(Upt)),P8r=Jht(),E8r=cyt(),T8r=JH(),A8r=G(),I8r=XCe(),M8r=Txt(),zV=S8r(NO()),R8r=(t,e)=>_re(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),j8r={chat:zV.StreamedChatResponse,generate:zV.GenerateStreamedResponse},N8r={chat:zV.NonStreamedChatResponse,embed:zV.EmbedResponse,generate:zV.Generation},D8r=(t,e,r)=>_re(void 0,void 0,void 0,function*(){let n=t?j8r[e]:N8r[e],o={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},i=yield n.parseOrThrow(r,o);return n.jsonOrThrow(i,o)});ni.mapResponseFromBedrock=D8r;var L8r=(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]};ni.getUrl=L8r;var F8r=(t,e,r,n,o,i)=>_re(void 0,void 0,void 0,function*(){let a=(0,O8r.fromNodeProviderChain)(),s=yield R8r(()=>{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 E8r.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:C8r.Sha256});delete r.connection,r.host=t.hostname;let l=new P8r.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});ni.getAuthHeaders=F8r;var k8r=(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}`)};ni.getEndpointFromUrl=k8r;var $8r=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}}};ni.parseAWSEvent=$8r;var B8r=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>_re(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,ni.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,ni.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,A8r.fetcher)(i);if(!p.ok)return p;try{if(c){let b=(0,I8r.readableStreamAsyncIterable)(p.body),g=new M8r.LineDecoder,y=new T8r.PassThrough;try{for(var m=x8r(b),h;h=yield m.next(),!h.done;){let S=h.value;for(let x of g.decode(S)){let O=(0,ni.parseAWSEvent)(x);if(O){let P=yield(0,ni.mapResponseFromBedrock)(c,u,O);y.push(JSON.stringify(P)+` +`:e),nAr=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function bSt(t){if(nAr(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function _St(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var oAr=t=>new Proxy(t,{get:(e,r)=>_St(e,r),has:(e,r)=>_St(e,r)!==void 0}),CSt=t=>!!(t&&TO(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&TO(t.append)&&TO(t.getAll)&&TO(t.entries)&&TO(t[Symbol.iterator])),vSt=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),pj=t=>!!(t&&typeof t=="object"&&TO(t.constructor)&&t[Symbol.toStringTag]==="File"&&TO(t.stream)&&t.name!=null),iAr={enableAdditionalHeaders:!1},Gee={writable:!1,configurable:!1},dA,lV,Jee,cV,fj,dV,fV,Yee,Zee,sOe,oOe,OSt,aAr=class{constructor(t,e,r){if(Y_(this,Zee),Y_(this,oOe),Y_(this,dA,`\r +`),Y_(this,lV,void 0),Y_(this,Jee,void 0),Y_(this,cV,"-".repeat(2)),Y_(this,fj,new TextEncoder),Y_(this,dV,void 0),Y_(this,fV,void 0),Y_(this,Yee,void 0),!CSt(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(bSt(e)?r=e:n=e,n||(n=rAr()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!bSt(r))throw new TypeError("Expected options argument to be an object.");uV(this,fV,Array.from(t.entries())),uV(this,Yee,{...iAr,...r}),uV(this,lV,fs(this,fj).encode(fs(this,dA))),uV(this,Jee,fs(this,lV).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,uV(this,dV,fs(this,fj).encode(`${fs(this,cV)}${this.boundary}${fs(this,cV)}${fs(this,dA).repeat(2)}`));let o={"Content-Type":this.contentType},i=nOe(this,oOe,OSt).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=oAr(Object.freeze(o)),Object.defineProperties(this,{boundary:Gee,contentType:Gee,contentLength:Gee,headers:Gee})}*values(){for(let[t,e]of fs(this,fV)){let r=pj(e)?e:fs(this,fj).encode(xSt(e));yield nOe(this,Zee,sOe).call(this,t,r),yield r,yield fs(this,lV)}yield fs(this,dV)}async*encode(){for(let t of this.values())pj(t)?yield*tAr(t.stream()):yield*SSt(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};dA=new WeakMap;lV=new WeakMap;Jee=new WeakMap;cV=new WeakMap;fj=new WeakMap;dV=new WeakMap;fV=new WeakMap;Yee=new WeakMap;Zee=new WeakSet;sOe=function(t,e){let r="";if(r+=`${fs(this,cV)}${this.boundary}${fs(this,dA)}`,r+=`Content-Disposition: form-data; name="${vSt(t)}"`,pj(e)&&(r+=`; filename="${vSt(e.name)}"${fs(this,dA)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),fs(this,Yee).enableAdditionalHeaders===!0){let n=pj(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${fs(this,dA)}Content-Length: ${n}`)}return fs(this,fj).encode(`${r}${fs(this,dA).repeat(2)}`)};oOe=new WeakSet;OSt=function(){let t=0;for(let[e,r]of fs(this,fV)){let n=pj(r)?r:fs(this,fj).encode(xSt(r)),o=pj(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=nOe(this,Zee,sOe).call(this,e,n).byteLength,t+=o,t+=fs(this,Jee)}return String(t+fs(this,dV).byteLength)}});var ASt=v((Hwo,TSt)=>{TSt.exports=typeof self=="object"?self.FormData:window.FormData});var ISt=v(Ql=>{"use strict";var sAr=Ql&&Ql.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uAr=Ql&&Ql.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M$=Ql&&Ql.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sAr(e,t,r);return uAr(e,t),e},fA=Ql&&Ql.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ql,"__esModule",{value:!0});Ql.WebFormData=Ql.Node16FormData=Ql.Node18FormData=Ql.newFormData=void 0;var Xee=v$();function uOe(t){return typeof t=="object"&&t!=null&&"name"in t}function lAr(){return fA(this,void 0,void 0,function*(){let t;return Xee.RUNTIME.type==="node"&&Xee.RUNTIME.parsedVersion!=null&&Xee.RUNTIME.parsedVersion>=18?t=new Qee:Xee.RUNTIME.type==="node"?t=new ete:t=new tte,yield t.setup(),t})}Ql.newFormData=lAr;var Qee=class{setup(){return fA(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>M$(mSt()))).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 fA(this,void 0,void 0,function*(){n==null&&uOe(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>M$(YH()))).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 fA(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>M$(ESt()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>M$(YH()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};Ql.Node18FormData=Qee;var ete=class{setup(){return fA(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>M$(ASt()))).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 fA(this,void 0,void 0,function*(){n==null&&uOe(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>M$(YH()))).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():{}}}};Ql.Node16FormData=ete;var tte=class{setup(){return fA(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 fA(this,void 0,void 0,function*(){n==null&&uOe(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};Ql.WebFormData=tte});var MSt=v(mj=>{"use strict";var cAr=mj&&mj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dAr=mj&&mj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cAr(e,t,r)};Object.defineProperty(mj,"__esModule",{value:!0});dAr(ISt(),mj)});var Uc=v(rte=>{"use strict";Object.defineProperty(rte,"__esModule",{value:!0});rte.SchemaType=void 0;rte.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 Dp=v(nte=>{"use strict";Object.defineProperty(nte,"__esModule",{value:!0});nte.getErrorMessageForIncorrectType=void 0;function fAr(t,e){return`Expected ${e}. Received ${pAr(t)}.`}nte.getErrorMessageForIncorrectType=fAr;function pAr(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 AO=v(ote=>{"use strict";Object.defineProperty(ote,"__esModule",{value:!0});ote.maybeSkipValidation=void 0;function mAr(t){return Object.assign(Object.assign({},t),{json:RSt(t.json),parse:RSt(t.parse)})}ote.maybeSkipValidation=mAr;function RSt(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 lOe=v(ite=>{"use strict";Object.defineProperty(ite,"__esModule",{value:!0});ite.stringifyValidationError=void 0;function hAr(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}ite.stringifyValidationError=hAr});var dOe=v(ate=>{"use strict";Object.defineProperty(ate,"__esModule",{value:!0});ate.JsonError=void 0;var gAr=lOe(),cOe=class t extends Error{constructor(e){super(e.map(gAr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};ate.JsonError=cOe});var pOe=v(ste=>{"use strict";Object.defineProperty(ste,"__esModule",{value:!0});ste.ParseError=void 0;var yAr=lOe(),fOe=class t extends Error{constructor(e){super(e.map(yAr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};ste.ParseError=fOe});var DSt=v(pA=>{"use strict";Object.defineProperty(pA,"__esModule",{value:!0});pA.transform=pA.optional=pA.getSchemaUtils=void 0;var bAr=Uc(),_Ar=dOe(),vAr=pOe();function mOe(t){return{optional:()=>jSt(t),transform:e=>NSt(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new vAr.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new _Ar.JsonError(n.errors)}}}pA.getSchemaUtils=mOe;function jSt(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:()=>bAr.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),mOe(e))}pA.optional=jSt;function NSt(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),mOe(r))}pA.transform=NSt});var Lm=v(ag=>{"use strict";Object.defineProperty(ag,"__esModule",{value:!0});ag.ParseError=ag.JsonError=ag.transform=ag.optional=ag.getSchemaUtils=void 0;var hOe=DSt();Object.defineProperty(ag,"getSchemaUtils",{enumerable:!0,get:function(){return hOe.getSchemaUtils}});Object.defineProperty(ag,"optional",{enumerable:!0,get:function(){return hOe.optional}});Object.defineProperty(ag,"transform",{enumerable:!0,get:function(){return hOe.transform}});var wAr=dOe();Object.defineProperty(ag,"JsonError",{enumerable:!0,get:function(){return wAr.JsonError}});var SAr=pOe();Object.defineProperty(ag,"ParseError",{enumerable:!0,get:function(){return SAr.ParseError}})});var LSt=v(ute=>{"use strict";Object.defineProperty(ute,"__esModule",{value:!0});ute.date=void 0;var xAr=Uc(),gOe=Dp(),CAr=AO(),OAr=Lm(),PAr=/^([+-]?\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 EAr(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,gOe.getErrorMessageForIncorrectType)(e,"string")}]}:PAr.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,gOe.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,gOe.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>xAr.SchemaType.DATE};return Object.assign(Object.assign({},(0,CAr.maybeSkipValidation)(t)),(0,OAr.getSchemaUtils)(t))}ute.date=EAr});var FSt=v(lte=>{"use strict";Object.defineProperty(lte,"__esModule",{value:!0});lte.date=void 0;var TAr=LSt();Object.defineProperty(lte,"date",{enumerable:!0,get:function(){return TAr.date}})});var IO=v(cte=>{"use strict";Object.defineProperty(cte,"__esModule",{value:!0});cte.createIdentitySchemaCreator=void 0;var AAr=Lm(),IAr=AO();function MAr(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,IAr.maybeSkipValidation)(r)),(0,AAr.getSchemaUtils)(r))}}cte.createIdentitySchemaCreator=MAr});var $St=v(dte=>{"use strict";Object.defineProperty(dte,"__esModule",{value:!0});dte.enum_=void 0;var RAr=Uc(),jAr=IO(),kSt=Dp();function NAr(t){let e=new Set(t);return(0,jAr.createIdentitySchemaCreator)(RAr.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,kSt.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,kSt.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}dte.enum_=NAr});var yOe=v(fte=>{"use strict";Object.defineProperty(fte,"__esModule",{value:!0});fte.enum_=void 0;var DAr=$St();Object.defineProperty(fte,"enum_",{enumerable:!0,get:function(){return DAr.enum_}})});var bOe=v(mA=>{"use strict";Object.defineProperty(mA,"__esModule",{value:!0});mA.getMemoizedSchema=mA.constructLazyBaseSchema=mA.lazy=void 0;var LAr=Lm();function FAr(t){let e=BSt(t);return Object.assign(Object.assign({},e),(0,LAr.getSchemaUtils)(e))}mA.lazy=FAr;function BSt(t){return{parse:(e,r)=>pte(t).parse(e,r),json:(e,r)=>pte(t).json(e,r),getType:()=>pte(t).getType()}}mA.constructLazyBaseSchema=BSt;function pte(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}mA.getMemoizedSchema=pte});var _Oe=v(mte=>{"use strict";Object.defineProperty(mte,"__esModule",{value:!0});mte.entries=void 0;function kAr(t){return Object.entries(t)}mte.entries=kAr});var vOe=v(hte=>{"use strict";Object.defineProperty(hte,"__esModule",{value:!0});hte.filterObject=void 0;function $Ar(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}hte.filterObject=$Ar});var pV=v(gte=>{"use strict";Object.defineProperty(gte,"__esModule",{value:!0});gte.isPlainObject=void 0;function BAr(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}gte.isPlainObject=BAr});var wOe=v(yte=>{"use strict";Object.defineProperty(yte,"__esModule",{value:!0});yte.keys=void 0;function qAr(t){return Object.keys(t)}yte.keys=qAr});var qSt=v(bte=>{"use strict";Object.defineProperty(bte,"__esModule",{value:!0});bte.partition=void 0;function UAr(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}bte.partition=UAr});var HSt=v(R$=>{"use strict";Object.defineProperty(R$,"__esModule",{value:!0});R$.withParsedProperties=R$.getObjectLikeUtils=void 0;var zAr=vOe(),HAr=Dp(),VAr=pV(),WAr=Lm();function USt(t){return{withParsedProperties:e=>zSt(t,e)}}R$.getObjectLikeUtils=USt;function zSt(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,VAr.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,HAr.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,zAr.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,WAr.getSchemaUtils)(r)),USt(r))}R$.withParsedProperties=zSt});var mV=v(j$=>{"use strict";Object.defineProperty(j$,"__esModule",{value:!0});j$.withParsedProperties=j$.getObjectLikeUtils=void 0;var VSt=HSt();Object.defineProperty(j$,"getObjectLikeUtils",{enumerable:!0,get:function(){return VSt.getObjectLikeUtils}});Object.defineProperty(j$,"withParsedProperties",{enumerable:!0,get:function(){return VSt.withParsedProperties}})});var SOe=v(N$=>{"use strict";Object.defineProperty(N$,"__esModule",{value:!0});N$.isProperty=N$.property=void 0;function KAr(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}N$.property=KAr;function GAr(t){return t.isProperty}N$.isProperty=GAr});var COe=v(D$=>{"use strict";Object.defineProperty(D$,"__esModule",{value:!0});D$.getObjectUtils=D$.object=void 0;var gV=Uc(),WSt=_Oe(),KSt=vOe(),JAr=Dp(),YAr=pV(),ZSt=wOe(),ZAr=AO(),XAr=qSt(),XSt=mV(),QSt=Lm(),hV=SOe();function QAr(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,hV.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,ZSt.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,WSt.entries)(t)){let u=(0,hV.isProperty)(s)?s.rawKey:a,l=(0,hV.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,YSt(l)&&i.push(u)}return GSt({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,WSt.entries)(t)){let s=(0,hV.isProperty)(a)?a.valueSchema:a;YSt(s)&&o.push(i)}return GSt({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,hV.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:()=>gV.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,ZAr.maybeSkipValidation)(e)),(0,QSt.getSchemaUtils)(e)),(0,XSt.getObjectLikeUtils)(e)),xOe(e))}D$.object=QAr;function GSt({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,YAr.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,JAr.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 xOe(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>JSt({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>JSt({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>gV.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,QSt.getSchemaUtils)(r)),(0,XSt.getObjectLikeUtils)(r)),xOe(r))}}}D$.getObjectUtils=xOe;function JSt({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,XAr.partition)((0,ZSt.keys)(e),l=>o.has(l)),s=r((0,KSt.filterObject)(e,a)),u=n((0,KSt.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 YSt(t){return!eIr(t)}function eIr(t){switch(t.getType()){case gV.SchemaType.ANY:case gV.SchemaType.UNKNOWN:case gV.SchemaType.OPTIONAL:return!0;default:return!1}}});var ext=v(_te=>{"use strict";Object.defineProperty(_te,"__esModule",{value:!0});_te.objectWithoutOptionalProperties=void 0;var tIr=COe();function rIr(t){return(0,tIr.object)(t)}_te.objectWithoutOptionalProperties=rIr});var OOe=v(sg=>{"use strict";Object.defineProperty(sg,"__esModule",{value:!0});sg.property=sg.isProperty=sg.objectWithoutOptionalProperties=sg.object=sg.getObjectUtils=void 0;var txt=COe();Object.defineProperty(sg,"getObjectUtils",{enumerable:!0,get:function(){return txt.getObjectUtils}});Object.defineProperty(sg,"object",{enumerable:!0,get:function(){return txt.object}});var nIr=ext();Object.defineProperty(sg,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return nIr.objectWithoutOptionalProperties}});var rxt=SOe();Object.defineProperty(sg,"isProperty",{enumerable:!0,get:function(){return rxt.isProperty}});Object.defineProperty(sg,"property",{enumerable:!0,get:function(){return rxt.property}})});var nxt=v(vte=>{"use strict";Object.defineProperty(vte,"__esModule",{value:!0});vte.lazyObject=void 0;var oIr=OOe(),iIr=mV(),aIr=Lm(),POe=bOe();function sIr(t){let e=Object.assign(Object.assign({},(0,POe.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,POe.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,POe.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,aIr.getSchemaUtils)(e)),(0,iIr.getObjectLikeUtils)(e)),(0,oIr.getObjectUtils)(e))}vte.lazyObject=sIr});var oxt=v(L$=>{"use strict";Object.defineProperty(L$,"__esModule",{value:!0});L$.lazyObject=L$.lazy=void 0;var uIr=bOe();Object.defineProperty(L$,"lazy",{enumerable:!0,get:function(){return uIr.lazy}});var lIr=nxt();Object.defineProperty(L$,"lazyObject",{enumerable:!0,get:function(){return lIr.lazyObject}})});var axt=v(wte=>{"use strict";Object.defineProperty(wte,"__esModule",{value:!0});wte.list=void 0;var cIr=Uc(),dIr=Dp(),fIr=AO(),pIr=Lm();function mIr(t){let e={parse:(r,n)=>ixt(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)=>ixt(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:()=>cIr.SchemaType.LIST};return Object.assign(Object.assign({},(0,fIr.maybeSkipValidation)(e)),(0,pIr.getSchemaUtils)(e))}wte.list=mIr;function ixt(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,dIr.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var EOe=v(Ste=>{"use strict";Object.defineProperty(Ste,"__esModule",{value:!0});Ste.list=void 0;var hIr=axt();Object.defineProperty(Ste,"list",{enumerable:!0,get:function(){return hIr.list}})});var sxt=v(xte=>{"use strict";Object.defineProperty(xte,"__esModule",{value:!0});xte.stringLiteral=void 0;var gIr=Uc(),yIr=IO(),bIr=Dp();function _Ir(t){return(0,yIr.createIdentitySchemaCreator)(gIr.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,bIr.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}xte.stringLiteral=_Ir});var uxt=v(Cte=>{"use strict";Object.defineProperty(Cte,"__esModule",{value:!0});Cte.booleanLiteral=void 0;var vIr=Uc(),wIr=IO(),SIr=Dp();function xIr(t){return(0,wIr.createIdentitySchemaCreator)(vIr.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,SIr.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}Cte.booleanLiteral=xIr});var lxt=v(F$=>{"use strict";Object.defineProperty(F$,"__esModule",{value:!0});F$.booleanLiteral=F$.stringLiteral=void 0;var CIr=sxt();Object.defineProperty(F$,"stringLiteral",{enumerable:!0,get:function(){return CIr.stringLiteral}});var OIr=uxt();Object.defineProperty(F$,"booleanLiteral",{enumerable:!0,get:function(){return OIr.booleanLiteral}})});var cxt=v(Ote=>{"use strict";Object.defineProperty(Ote,"__esModule",{value:!0});Ote.any=void 0;var PIr=Uc(),EIr=IO();Ote.any=(0,EIr.createIdentitySchemaCreator)(PIr.SchemaType.ANY,t=>({ok:!0,value:t}))});var dxt=v(Pte=>{"use strict";Object.defineProperty(Pte,"__esModule",{value:!0});Pte.boolean=void 0;var TIr=Uc(),AIr=IO(),IIr=Dp();Pte.boolean=(0,AIr.createIdentitySchemaCreator)(TIr.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,IIr.getErrorMessageForIncorrectType)(t,"boolean")}]})});var fxt=v(Ete=>{"use strict";Object.defineProperty(Ete,"__esModule",{value:!0});Ete.number=void 0;var MIr=Uc(),RIr=IO(),jIr=Dp();Ete.number=(0,RIr.createIdentitySchemaCreator)(MIr.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,jIr.getErrorMessageForIncorrectType)(t,"number")}]})});var pxt=v(Tte=>{"use strict";Object.defineProperty(Tte,"__esModule",{value:!0});Tte.string=void 0;var NIr=Uc(),DIr=IO(),LIr=Dp();Tte.string=(0,DIr.createIdentitySchemaCreator)(NIr.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,LIr.getErrorMessageForIncorrectType)(t,"string")}]})});var mxt=v(Ate=>{"use strict";Object.defineProperty(Ate,"__esModule",{value:!0});Ate.unknown=void 0;var FIr=Uc(),kIr=IO();Ate.unknown=(0,kIr.createIdentitySchemaCreator)(FIr.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var hxt=v(ug=>{"use strict";Object.defineProperty(ug,"__esModule",{value:!0});ug.unknown=ug.string=ug.number=ug.boolean=ug.any=void 0;var $Ir=cxt();Object.defineProperty(ug,"any",{enumerable:!0,get:function(){return $Ir.any}});var BIr=dxt();Object.defineProperty(ug,"boolean",{enumerable:!0,get:function(){return BIr.boolean}});var qIr=fxt();Object.defineProperty(ug,"number",{enumerable:!0,get:function(){return qIr.number}});var UIr=pxt();Object.defineProperty(ug,"string",{enumerable:!0,get:function(){return UIr.string}});var zIr=mxt();Object.defineProperty(ug,"unknown",{enumerable:!0,get:function(){return zIr.unknown}})});var yxt=v(Ite=>{"use strict";Object.defineProperty(Ite,"__esModule",{value:!0});Ite.record=void 0;var TOe=Uc(),HIr=_Oe(),VIr=Dp(),WIr=pV(),KIr=AO(),GIr=Lm();function JIr(t,e){let r={parse:(n,o)=>gxt({value:n,isKeyNumeric:t.getType()===TOe.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)=>gxt({value:n,isKeyNumeric:t.getType()===TOe.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:()=>TOe.SchemaType.RECORD};return Object.assign(Object.assign({},(0,KIr.maybeSkipValidation)(r)),(0,GIr.getSchemaUtils)(r))}Ite.record=JIr;function gxt({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,WIr.isPlainObject)(t)?(0,HIr.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,VIr.getErrorMessageForIncorrectType)(t,"object")}]}}});var bxt=v(Mte=>{"use strict";Object.defineProperty(Mte,"__esModule",{value:!0});Mte.record=void 0;var YIr=yxt();Object.defineProperty(Mte,"record",{enumerable:!0,get:function(){return YIr.record}})});var _xt=v(Rte=>{"use strict";Object.defineProperty(Rte,"__esModule",{value:!0});Rte.set=void 0;var ZIr=Uc(),XIr=Dp(),QIr=AO(),eMr=EOe(),tMr=Lm();function rMr(t){let e=(0,eMr.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,XIr.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>ZIr.SchemaType.SET};return Object.assign(Object.assign({},(0,QIr.maybeSkipValidation)(r)),(0,tMr.getSchemaUtils)(r))}Rte.set=rMr});var vxt=v(jte=>{"use strict";Object.defineProperty(jte,"__esModule",{value:!0});jte.set=void 0;var nMr=_xt();Object.defineProperty(jte,"set",{enumerable:!0,get:function(){return nMr.set}})});var Sxt=v(Nte=>{"use strict";Object.defineProperty(Nte,"__esModule",{value:!0});Nte.undiscriminatedUnion=void 0;var oMr=Uc(),iMr=AO(),aMr=Lm();function sMr(t){let e={parse:(r,n)=>wxt((o,i)=>o.parse(r,i),t,n),json:(r,n)=>wxt((o,i)=>o.json(r,i),t,n),getType:()=>oMr.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,iMr.maybeSkipValidation)(e)),(0,aMr.getSchemaUtils)(e))}Nte.undiscriminatedUnion=sMr;function wxt(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 xxt=v(Dte=>{"use strict";Object.defineProperty(Dte,"__esModule",{value:!0});Dte.undiscriminatedUnion=void 0;var uMr=Sxt();Object.defineProperty(Dte,"undiscriminatedUnion",{enumerable:!0,get:function(){return uMr.undiscriminatedUnion}})});var Cxt=v(Lte=>{"use strict";Object.defineProperty(Lte,"__esModule",{value:!0});Lte.discriminant=void 0;function lMr(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}Lte.discriminant=lMr});var Pxt=v(k$=>{"use strict";var cMr=k$&&k$.__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);oOxt({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)=>Oxt({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:()=>dMr.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,hMr.maybeSkipValidation)(i)),(0,bMr.getSchemaUtils)(i)),(0,yMr.getObjectLikeUtils)(i))}k$.union=_Mr;function Oxt({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,pMr.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,fMr.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=cMr(u,[typeof l=="symbol"?l:l+""]);if(c==null)return{ok:!1,errors:[{path:s,message:`Missing discriminant ("${e}")`}]};let f=n(c);if(!f.ok)return{ok:!1,errors:f.errors};let p=o(f.value);if(p==null)return i?{ok:!0,value:Object.assign({[r]:f.value},d)}:{ok:!1,errors:[{path:[...s,e],message:"Unexpected discriminant value"}]};let m=a(d,p);return m.ok?{ok:!0,value:Object.assign({[r]:c},m.value)}:m}});var Ext=v($$=>{"use strict";Object.defineProperty($$,"__esModule",{value:!0});$$.union=$$.discriminant=void 0;var vMr=Cxt();Object.defineProperty($$,"discriminant",{enumerable:!0,get:function(){return vMr.discriminant}});var wMr=Pxt();Object.defineProperty($$,"union",{enumerable:!0,get:function(){return wMr.union}})});var Txt=v(Ml=>{"use strict";var SMr=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]}),Fm=Ml&&Ml.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&SMr(e,t,r)};Object.defineProperty(Ml,"__esModule",{value:!0});Fm(FSt(),Ml);Fm(yOe(),Ml);Fm(oxt(),Ml);Fm(EOe(),Ml);Fm(lxt(),Ml);Fm(OOe(),Ml);Fm(mV(),Ml);Fm(hxt(),Ml);Fm(bxt(),Ml);Fm(Lm(),Ml);Fm(vxt(),Ml);Fm(xxt(),Ml);Fm(Ext(),Ml)});var Axt=v(hj=>{"use strict";var xMr=hj&&hj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CMr=hj&&hj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xMr(e,t,r)};Object.defineProperty(hj,"__esModule",{value:!0});CMr(Txt(),hj)});var G=v(zc=>{"use strict";var Ixt=zc&&zc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OMr=zc&&zc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yV=zc&&zc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ixt(e,t,r)},PMr=zc&&zc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ixt(e,t,r);return OMr(e,t),e};Object.defineProperty(zc,"__esModule",{value:!0});zc.serialization=void 0;yV(tSt(),zc);yV(aSt(),zc);yV(dSt(),zc);yV(v$(),zc);yV(MSt(),zc);zc.serialization=PMr(Axt())});var Rxt=v(Vs=>{"use strict";var bV=Vs&&Vs.__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())})},_V=Vs&&Vs.__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)}},Ta=Vs&&Vs.__await||function(t){return this instanceof Ta?(this.v=t,this):new Ta(t)},vV=Vs&&Vs.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof Ta?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(Vs,"__esModule",{value:!0});Vs.readableStreamAsyncIterable=Vs._decodeChunks=Vs.LineDecoder=Vs._iterSSEMessages=Vs.StreamUtils=void 0;var B$=As(),AOe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return vV(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=_V(Mxt(e,r)),c;c=yield Ta(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 B$.CohereError({message:`Error: ${f.error}`});yield yield Ta(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 B$.CohereError({message:`Error: ${f.message}, ${f.error}`});yield yield Ta({event:d.event,data:f})}}}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&(yield Ta(s.call(l)))}finally{if(a)throw a.error}}u=!0}catch(d){if(d instanceof Error&&d.name==="AbortError")return yield Ta(void 0);throw d}finally{u||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return vV(this,arguments,function*(){var s,u;let l=new hA,c=MOe(e);try{for(var d=_V(c),f;f=yield Ta(d.next()),!f.done;){let p=f.value;for(let m of l.decode(p))yield yield Ta(m)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(u=d.return)&&(yield Ta(u.call(d)))}finally{if(s)throw s.error}}for(let p of l.flush())yield yield Ta(p)})}function i(){return vV(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=_V(o()),d;d=yield Ta(c.next()),!d.done;){let f=d.value;l||f&&(yield yield Ta(JSON.parse(f)))}}catch(f){s={error:f}}finally{try{d&&!d.done&&(u=c.return)&&(yield Ta(u.call(c)))}finally{if(s)throw s.error}}l=!0}catch(f){if(f instanceof Error&&f.name==="AbortError")return yield Ta(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 bV(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return bV(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 bV(this,void 0,void 0,function*(){yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};Vs.StreamUtils=AOe;function Mxt(t,e){return vV(this,arguments,function*(){var n,o;if(!t.body)throw e?.abort(),new B$.CohereError({message:"Attempted to iterate over a response with no body"});let i=new IOe,a=new hA,s=MOe(t.body);try{for(var u=_V(EMr(s)),l;l=yield Ta(u.next()),!l.done;){let c=l.value;for(let d of a.decode(c)){let f=i.decode(d);f&&(yield yield Ta(f))}}}catch(c){n={error:c}}finally{try{l&&!l.done&&(o=u.return)&&(yield Ta(o.call(u)))}finally{if(n)throw n.error}}for(let c of a.flush()){let d=i.decode(c);d&&(yield yield Ta(d))}})}Vs._iterSSEMessages=Mxt;function EMr(t){return vV(this,arguments,function*(){var r,n;let o=new Uint8Array;try{for(var i=_V(t),a;a=yield Ta(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=TMr(o))!==-1;)yield yield Ta(o.slice(0,c)),o=o.slice(c)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&(yield Ta(n.call(i)))}finally{if(r)throw r.error}}o.length>0&&(yield yield Ta(o))})}function TMr(t){for(let n=0;n0&&(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 B$.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 B$.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new B$.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}};Vs.LineDecoder=hA;hA.NEWLINE_CHARS=new Set([` +`,"\r"]);hA.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function AMr(t){let e=new hA,r=[];for(let n of t)r.push(...e.decode(n));return r}Vs._decodeChunks=AMr;function IMr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function MOe(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return bV(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 bV(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}Vs.readableStreamAsyncIterable=MOe});var ROe=v(Z_=>{"use strict";var MMr=Z_&&Z_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RMr=Z_&&Z_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jMr=Z_&&Z_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MMr(e,t,r);return RMr(e,t),e};Object.defineProperty(Z_,"__esModule",{value:!0});Z_.V2ChatStreamRequestCitationMode=void 0;var NMr=jMr(G());Z_.V2ChatStreamRequestCitationMode=NMr.serialization.enum_(["FAST","ACCURATE","OFF"])});var jOe=v(X_=>{"use strict";var DMr=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]}),LMr=X_&&X_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FMr=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)&&DMr(e,t,r);return LMr(e,t),e};Object.defineProperty(X_,"__esModule",{value:!0});X_.V2ChatRequestCitationMode=void 0;var kMr=FMr(G());X_.V2ChatRequestCitationMode=kMr.serialization.enum_(["FAST","ACCURATE","OFF"])});var q$=v(Q_=>{"use strict";var $Mr=Q_&&Q_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BMr=Q_&&Q_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qMr=Q_&&Q_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Mr(e,t,r);return BMr(e,t),e};Object.defineProperty(Q_,"__esModule",{value:!0});Q_.TextContent=void 0;var jxt=qMr(G());Q_.TextContent=jxt.serialization.object({text:jxt.serialization.string()})});var NOe=v(ev=>{"use strict";var UMr=ev&&ev.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zMr=ev&&ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HMr=ev&&ev.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UMr(e,t,r);return zMr(e,t),e};Object.defineProperty(ev,"__esModule",{value:!0});ev.Content=void 0;var VMr=HMr(G()),WMr=q$();ev.Content=VMr.serialization.union("type",{text:WMr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var LOe=v(tv=>{"use strict";var KMr=tv&&tv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GMr=tv&&tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JMr=tv&&tv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KMr(e,t,r);return GMr(e,t),e};Object.defineProperty(tv,"__esModule",{value:!0});tv.UserMessageContent=void 0;var DOe=JMr(G()),YMr=NOe();tv.UserMessageContent=DOe.serialization.undiscriminatedUnion([DOe.serialization.string(),DOe.serialization.list(YMr.Content)])});var gj=v(rv=>{"use strict";var ZMr=rv&&rv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XMr=rv&&rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QMr=rv&&rv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZMr(e,t,r);return XMr(e,t),e};Object.defineProperty(rv,"__esModule",{value:!0});rv.ChatDocument=void 0;var FOe=QMr(G());rv.ChatDocument=FOe.serialization.record(FOe.serialization.string(),FOe.serialization.string())});var kOe=v(nv=>{"use strict";var eRr=nv&&nv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tRr=nv&&nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rRr=nv&&nv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eRr(e,t,r);return tRr(e,t),e};Object.defineProperty(nv,"__esModule",{value:!0});nv.UserMessage=void 0;var Nxt=rRr(G()),nRr=LOe(),oRr=gj();nv.UserMessage=Nxt.serialization.object({content:nRr.UserMessageContent,documents:Nxt.serialization.list(oRr.ChatDocument).optional()})});var BOe=v(ov=>{"use strict";var iRr=ov&&ov.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aRr=ov&&ov.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sRr=ov&&ov.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iRr(e,t,r);return aRr(e,t),e};Object.defineProperty(ov,"__esModule",{value:!0});ov.ToolCall2Function=void 0;var $Oe=sRr(G());ov.ToolCall2Function=$Oe.serialization.object({name:$Oe.serialization.string().optional(),arguments:$Oe.serialization.string().optional()})});var Fte=v(iv=>{"use strict";var uRr=iv&&iv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lRr=iv&&iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cRr=iv&&iv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uRr(e,t,r);return lRr(e,t),e};Object.defineProperty(iv,"__esModule",{value:!0});iv.ToolCall2=void 0;var qOe=cRr(G()),dRr=BOe();iv.ToolCall2=qOe.serialization.object({id:qOe.serialization.string().optional(),type:qOe.serialization.stringLiteral("function").optional(),function:dRr.ToolCall2Function.optional()})});var UOe=v(av=>{"use strict";var fRr=av&&av.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pRr=av&&av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mRr=av&&av.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fRr(e,t,r);return pRr(e,t),e};Object.defineProperty(av,"__esModule",{value:!0});av.ToolSource=void 0;var U$=mRr(G());av.ToolSource=U$.serialization.object({id:U$.serialization.string().optional(),toolOutput:U$.serialization.property("tool_output",U$.serialization.record(U$.serialization.string(),U$.serialization.unknown()).optional())})});var zOe=v(sv=>{"use strict";var hRr=sv&&sv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gRr=sv&&sv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yRr=sv&&sv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hRr(e,t,r);return gRr(e,t),e};Object.defineProperty(sv,"__esModule",{value:!0});sv.DocumentSource=void 0;var wV=yRr(G());sv.DocumentSource=wV.serialization.object({id:wV.serialization.string().optional(),document:wV.serialization.record(wV.serialization.string(),wV.serialization.unknown()).optional()})});var HOe=v(uv=>{"use strict";var bRr=uv&&uv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Rr=uv&&uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vRr=uv&&uv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bRr(e,t,r);return _Rr(e,t),e};Object.defineProperty(uv,"__esModule",{value:!0});uv.Source=void 0;var wRr=vRr(G()),SRr=UOe(),xRr=zOe();uv.Source=wRr.serialization.union("type",{tool:SRr.ToolSource,document:xRr.DocumentSource}).transform({transform:t=>t,untransform:t=>t})});var xV=v(lv=>{"use strict";var CRr=lv&&lv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ORr=lv&&lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PRr=lv&&lv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CRr(e,t,r);return ORr(e,t),e};Object.defineProperty(lv,"__esModule",{value:!0});lv.Citation=void 0;var SV=PRr(G()),ERr=HOe();lv.Citation=SV.serialization.object({start:SV.serialization.number().optional(),end:SV.serialization.number().optional(),text:SV.serialization.string().optional(),sources:SV.serialization.list(ERr.Source).optional()})});var VOe=v(cv=>{"use strict";var TRr=cv&&cv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ARr=cv&&cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IRr=cv&&cv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TRr(e,t,r);return ARr(e,t),e};Object.defineProperty(cv,"__esModule",{value:!0});cv.AssistantMessageContentItem=void 0;var MRr=IRr(G()),RRr=q$();cv.AssistantMessageContentItem=MRr.serialization.union("type",{text:RRr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var KOe=v(dv=>{"use strict";var jRr=dv&&dv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NRr=dv&&dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DRr=dv&&dv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jRr(e,t,r);return NRr(e,t),e};Object.defineProperty(dv,"__esModule",{value:!0});dv.AssistantMessageContent=void 0;var WOe=DRr(G()),LRr=VOe();dv.AssistantMessageContent=WOe.serialization.undiscriminatedUnion([WOe.serialization.string(),WOe.serialization.list(LRr.AssistantMessageContentItem)])});var GOe=v(fv=>{"use strict";var FRr=fv&&fv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kRr=fv&&fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Rr=fv&&fv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FRr(e,t,r);return kRr(e,t),e};Object.defineProperty(fv,"__esModule",{value:!0});fv.AssistantMessage=void 0;var z$=$Rr(G()),BRr=Fte(),qRr=KOe(),URr=xV();fv.AssistantMessage=z$.serialization.object({toolCalls:z$.serialization.property("tool_calls",z$.serialization.list(BRr.ToolCall2).optional()),toolPlan:z$.serialization.property("tool_plan",z$.serialization.string().optional()),content:qRr.AssistantMessageContent.optional(),citations:z$.serialization.list(URr.Citation).optional()})});var JOe=v(pv=>{"use strict";var zRr=pv&&pv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HRr=pv&&pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VRr=pv&&pv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zRr(e,t,r);return HRr(e,t),e};Object.defineProperty(pv,"__esModule",{value:!0});pv.SystemMessageContentItem=void 0;var WRr=VRr(G()),KRr=q$();pv.SystemMessageContentItem=WRr.serialization.union("type",{text:KRr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var ZOe=v(mv=>{"use strict";var GRr=mv&&mv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JRr=mv&&mv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YRr=mv&&mv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GRr(e,t,r);return JRr(e,t),e};Object.defineProperty(mv,"__esModule",{value:!0});mv.SystemMessageContent=void 0;var YOe=YRr(G()),ZRr=JOe();mv.SystemMessageContent=YOe.serialization.undiscriminatedUnion([YOe.serialization.string(),YOe.serialization.list(ZRr.SystemMessageContentItem)])});var XOe=v(hv=>{"use strict";var XRr=hv&&hv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QRr=hv&&hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e1r=hv&&hv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XRr(e,t,r);return QRr(e,t),e};Object.defineProperty(hv,"__esModule",{value:!0});hv.SystemMessage=void 0;var t1r=e1r(G()),r1r=ZOe();hv.SystemMessage=t1r.serialization.object({content:r1r.SystemMessageContent})});var QOe=v(gv=>{"use strict";var n1r=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]}),o1r=gv&&gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i1r=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)&&n1r(e,t,r);return o1r(e,t),e};Object.defineProperty(gv,"__esModule",{value:!0});gv.ToolContent=void 0;var kte=i1r(G());gv.ToolContent=kte.serialization.object({output:kte.serialization.record(kte.serialization.string(),kte.serialization.unknown())})});var ePe=v(yv=>{"use strict";var a1r=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]}),s1r=yv&&yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u1r=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)&&a1r(e,t,r);return s1r(e,t),e};Object.defineProperty(yv,"__esModule",{value:!0});yv.ToolMessage2ToolContentItem=void 0;var l1r=u1r(G()),c1r=QOe();yv.ToolMessage2ToolContentItem=l1r.serialization.union("type",{tool_result_object:c1r.ToolContent}).transform({transform:t=>t,untransform:t=>t})});var tPe=v(bv=>{"use strict";var d1r=bv&&bv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f1r=bv&&bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p1r=bv&&bv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&d1r(e,t,r);return f1r(e,t),e};Object.defineProperty(bv,"__esModule",{value:!0});bv.ToolMessage2=void 0;var CV=p1r(G()),m1r=ePe();bv.ToolMessage2=CV.serialization.object({toolCallId:CV.serialization.property("tool_call_id",CV.serialization.string()),toolContent:CV.serialization.property("tool_content",CV.serialization.list(m1r.ToolMessage2ToolContentItem))})});var rPe=v(_v=>{"use strict";var h1r=_v&&_v.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g1r=_v&&_v.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y1r=_v&&_v.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&h1r(e,t,r);return g1r(e,t),e};Object.defineProperty(_v,"__esModule",{value:!0});_v.ChatMessage2=void 0;var b1r=y1r(G()),_1r=kOe(),v1r=GOe(),w1r=XOe(),S1r=tPe();_v.ChatMessage2=b1r.serialization.union("role",{user:_1r.UserMessage,assistant:v1r.AssistantMessage,system:w1r.SystemMessage,tool:S1r.ToolMessage2}).transform({transform:t=>t,untransform:t=>t})});var $te=v(vv=>{"use strict";var x1r=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]}),C1r=vv&&vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O1r=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)&&x1r(e,t,r);return C1r(e,t),e};Object.defineProperty(vv,"__esModule",{value:!0});vv.ChatMessages=void 0;var P1r=O1r(G()),E1r=rPe();vv.ChatMessages=P1r.serialization.list(E1r.ChatMessage2)});var nPe=v(wv=>{"use strict";var T1r=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]}),A1r=wv&&wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I1r=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)&&T1r(e,t,r);return A1r(e,t),e};Object.defineProperty(wv,"__esModule",{value:!0});wv.Tool2Function=void 0;var H$=I1r(G());wv.Tool2Function=H$.serialization.object({name:H$.serialization.string().optional(),description:H$.serialization.string().optional(),parameters:H$.serialization.record(H$.serialization.string(),H$.serialization.unknown()).optional()})});var Bte=v(Sv=>{"use strict";var M1r=Sv&&Sv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R1r=Sv&&Sv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j1r=Sv&&Sv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&M1r(e,t,r);return R1r(e,t),e};Object.defineProperty(Sv,"__esModule",{value:!0});Sv.Tool2=void 0;var Dxt=j1r(G()),N1r=nPe();Sv.Tool2=Dxt.serialization.object({type:Dxt.serialization.stringLiteral("function").optional(),function:N1r.Tool2Function.optional()})});var qte=v(xv=>{"use strict";var D1r=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]}),L1r=xv&&xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F1r=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)&&D1r(e,t,r);return L1r(e,t),e};Object.defineProperty(xv,"__esModule",{value:!0});xv.ChatFinishReason=void 0;var k1r=F1r(G());xv.ChatFinishReason=k1r.serialization.enum_(["complete","stop_sequence","max_tokens","tool_call","error","content_blocked","error_limit"])});var oPe=v(Cv=>{"use strict";var $1r=Cv&&Cv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B1r=Cv&&Cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q1r=Cv&&Cv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$1r(e,t,r);return B1r(e,t),e};Object.defineProperty(Cv,"__esModule",{value:!0});Cv.AssistantMessageResponseContentItem=void 0;var U1r=q1r(G()),z1r=q$();Cv.AssistantMessageResponseContentItem=U1r.serialization.union("type",{text:z1r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var iPe=v(Ov=>{"use strict";var H1r=Ov&&Ov.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V1r=Ov&&Ov.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W1r=Ov&&Ov.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&H1r(e,t,r);return V1r(e,t),e};Object.defineProperty(Ov,"__esModule",{value:!0});Ov.AssistantMessageResponse=void 0;var gA=W1r(G()),K1r=Fte(),G1r=oPe(),J1r=xV();Ov.AssistantMessageResponse=gA.serialization.object({role:gA.serialization.stringLiteral("assistant"),toolCalls:gA.serialization.property("tool_calls",gA.serialization.list(K1r.ToolCall2).optional()),toolPlan:gA.serialization.property("tool_plan",gA.serialization.string().optional()),content:gA.serialization.list(G1r.AssistantMessageResponseContentItem).optional(),citations:gA.serialization.list(J1r.Citation).optional()})});var aPe=v(Pv=>{"use strict";var Y1r=Pv&&Pv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z1r=Pv&&Pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X1r=Pv&&Pv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Y1r(e,t,r);return Z1r(e,t),e};Object.defineProperty(Pv,"__esModule",{value:!0});Pv.UsageBilledUnits=void 0;var yA=X1r(G());Pv.UsageBilledUnits=yA.serialization.object({inputTokens:yA.serialization.property("input_tokens",yA.serialization.number().optional()),outputTokens:yA.serialization.property("output_tokens",yA.serialization.number().optional()),searchUnits:yA.serialization.property("search_units",yA.serialization.number().optional()),classifications:yA.serialization.number().optional()})});var sPe=v(Ev=>{"use strict";var Q1r=Ev&&Ev.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ejr=Ev&&Ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tjr=Ev&&Ev.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Q1r(e,t,r);return ejr(e,t),e};Object.defineProperty(Ev,"__esModule",{value:!0});Ev.UsageTokens=void 0;var OV=tjr(G());Ev.UsageTokens=OV.serialization.object({inputTokens:OV.serialization.property("input_tokens",OV.serialization.number().optional()),outputTokens:OV.serialization.property("output_tokens",OV.serialization.number().optional())})});var Ute=v(Tv=>{"use strict";var rjr=Tv&&Tv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),njr=Tv&&Tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ojr=Tv&&Tv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rjr(e,t,r);return njr(e,t),e};Object.defineProperty(Tv,"__esModule",{value:!0});Tv.Usage=void 0;var Lxt=ojr(G()),ijr=aPe(),ajr=sPe();Tv.Usage=Lxt.serialization.object({billedUnits:Lxt.serialization.property("billed_units",ijr.UsageBilledUnits.optional()),tokens:ajr.UsageTokens.optional()})});var Fxt=v(Av=>{"use strict";var sjr=Av&&Av.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ujr=Av&&Av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ljr=Av&&Av.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sjr(e,t,r);return ujr(e,t),e};Object.defineProperty(Av,"__esModule",{value:!0});Av.NonStreamedChatResponse2=void 0;var zte=ljr(G()),cjr=qte(),djr=iPe(),fjr=Ute();Av.NonStreamedChatResponse2=zte.serialization.object({id:zte.serialization.string(),finishReason:zte.serialization.property("finish_reason",cjr.ChatFinishReason),prompt:zte.serialization.string().optional(),message:djr.AssistantMessageResponse.optional(),usage:fjr.Usage.optional()})});var km=v(Iv=>{"use strict";var pjr=Iv&&Iv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mjr=Iv&&Iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hjr=Iv&&Iv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pjr(e,t,r);return mjr(e,t),e};Object.defineProperty(Iv,"__esModule",{value:!0});Iv.ChatStreamEventType=void 0;var gjr=hjr(G());Iv.ChatStreamEventType=gjr.serialization.object({})});var uPe=v(Mv=>{"use strict";var yjr=Mv&&Mv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bjr=Mv&&Mv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_jr=Mv&&Mv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yjr(e,t,r);return bjr(e,t),e};Object.defineProperty(Mv,"__esModule",{value:!0});Mv.ChatMessageStartEventDeltaMessage=void 0;var kxt=_jr(G());Mv.ChatMessageStartEventDeltaMessage=kxt.serialization.object({role:kxt.serialization.stringLiteral("assistant").optional()})});var lPe=v(Rv=>{"use strict";var vjr=Rv&&Rv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wjr=Rv&&Rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sjr=Rv&&Rv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vjr(e,t,r);return wjr(e,t),e};Object.defineProperty(Rv,"__esModule",{value:!0});Rv.ChatMessageStartEventDelta=void 0;var xjr=Sjr(G()),Cjr=uPe();Rv.ChatMessageStartEventDelta=xjr.serialization.object({message:Cjr.ChatMessageStartEventDeltaMessage.optional()})});var cPe=v(jv=>{"use strict";var Ojr=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]}),Pjr=jv&&jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ejr=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)&&Ojr(e,t,r);return Pjr(e,t),e};Object.defineProperty(jv,"__esModule",{value:!0});jv.ChatMessageStartEvent=void 0;var $xt=Ejr(G()),Tjr=lPe(),Ajr=km();jv.ChatMessageStartEvent=$xt.serialization.object({id:$xt.serialization.string().optional(),delta:Tjr.ChatMessageStartEventDelta.optional()}).extend(Ajr.ChatStreamEventType)});var fPe=v(Nv=>{"use strict";var Ijr=Nv&&Nv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mjr=Nv&&Nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rjr=Nv&&Nv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ijr(e,t,r);return Mjr(e,t),e};Object.defineProperty(Nv,"__esModule",{value:!0});Nv.ChatContentStartEventDeltaMessageContent=void 0;var dPe=Rjr(G());Nv.ChatContentStartEventDeltaMessageContent=dPe.serialization.object({text:dPe.serialization.string().optional(),type:dPe.serialization.stringLiteral("text").optional()})});var pPe=v(Dv=>{"use strict";var jjr=Dv&&Dv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Njr=Dv&&Dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Djr=Dv&&Dv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jjr(e,t,r);return Njr(e,t),e};Object.defineProperty(Dv,"__esModule",{value:!0});Dv.ChatContentStartEventDeltaMessage=void 0;var Ljr=Djr(G()),Fjr=fPe();Dv.ChatContentStartEventDeltaMessage=Ljr.serialization.object({content:Fjr.ChatContentStartEventDeltaMessageContent.optional()})});var mPe=v(Lv=>{"use strict";var kjr=Lv&&Lv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$jr=Lv&&Lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bjr=Lv&&Lv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kjr(e,t,r);return $jr(e,t),e};Object.defineProperty(Lv,"__esModule",{value:!0});Lv.ChatContentStartEventDelta=void 0;var qjr=Bjr(G()),Ujr=pPe();Lv.ChatContentStartEventDelta=qjr.serialization.object({message:Ujr.ChatContentStartEventDeltaMessage.optional()})});var hPe=v(Fv=>{"use strict";var zjr=Fv&&Fv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hjr=Fv&&Fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vjr=Fv&&Fv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zjr(e,t,r);return Hjr(e,t),e};Object.defineProperty(Fv,"__esModule",{value:!0});Fv.ChatContentStartEvent=void 0;var Bxt=Vjr(G()),Wjr=mPe(),Kjr=km();Fv.ChatContentStartEvent=Bxt.serialization.object({index:Bxt.serialization.number().optional(),delta:Wjr.ChatContentStartEventDelta.optional()}).extend(Kjr.ChatStreamEventType)});var gPe=v(kv=>{"use strict";var Gjr=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]}),Jjr=kv&&kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yjr=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)&&Gjr(e,t,r);return Jjr(e,t),e};Object.defineProperty(kv,"__esModule",{value:!0});kv.ChatContentDeltaEventDeltaMessageContent=void 0;var qxt=Yjr(G());kv.ChatContentDeltaEventDeltaMessageContent=qxt.serialization.object({text:qxt.serialization.string().optional()})});var yPe=v($v=>{"use strict";var Zjr=$v&&$v.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xjr=$v&&$v.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qjr=$v&&$v.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zjr(e,t,r);return Xjr(e,t),e};Object.defineProperty($v,"__esModule",{value:!0});$v.ChatContentDeltaEventDeltaMessage=void 0;var eNr=Qjr(G()),tNr=gPe();$v.ChatContentDeltaEventDeltaMessage=eNr.serialization.object({content:tNr.ChatContentDeltaEventDeltaMessageContent.optional()})});var bPe=v(Bv=>{"use strict";var rNr=Bv&&Bv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nNr=Bv&&Bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oNr=Bv&&Bv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rNr(e,t,r);return nNr(e,t),e};Object.defineProperty(Bv,"__esModule",{value:!0});Bv.ChatContentDeltaEventDelta=void 0;var iNr=oNr(G()),aNr=yPe();Bv.ChatContentDeltaEventDelta=iNr.serialization.object({message:aNr.ChatContentDeltaEventDeltaMessage.optional()})});var _Pe=v(qv=>{"use strict";var sNr=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]}),uNr=qv&&qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lNr=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)&&sNr(e,t,r);return uNr(e,t),e};Object.defineProperty(qv,"__esModule",{value:!0});qv.ChatContentDeltaEvent=void 0;var Uxt=lNr(G()),cNr=bPe(),dNr=km();qv.ChatContentDeltaEvent=Uxt.serialization.object({index:Uxt.serialization.number().optional(),delta:cNr.ChatContentDeltaEventDelta.optional()}).extend(dNr.ChatStreamEventType)});var vPe=v(Uv=>{"use strict";var fNr=Uv&&Uv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pNr=Uv&&Uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mNr=Uv&&Uv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fNr(e,t,r);return pNr(e,t),e};Object.defineProperty(Uv,"__esModule",{value:!0});Uv.ChatContentEndEvent=void 0;var zxt=mNr(G()),hNr=km();Uv.ChatContentEndEvent=zxt.serialization.object({index:zxt.serialization.number().optional()}).extend(hNr.ChatStreamEventType)});var SPe=v(zv=>{"use strict";var gNr=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]}),yNr=zv&&zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bNr=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)&&gNr(e,t,r);return yNr(e,t),e};Object.defineProperty(zv,"__esModule",{value:!0});zv.ChatToolPlanDeltaEventDelta=void 0;var wPe=bNr(G());zv.ChatToolPlanDeltaEventDelta=wPe.serialization.object({toolPlan:wPe.serialization.property("tool_plan",wPe.serialization.string().optional())})});var xPe=v(Hv=>{"use strict";var _Nr=Hv&&Hv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vNr=Hv&&Hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wNr=Hv&&Hv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Nr(e,t,r);return vNr(e,t),e};Object.defineProperty(Hv,"__esModule",{value:!0});Hv.ChatToolPlanDeltaEvent=void 0;var SNr=wNr(G()),xNr=SPe(),CNr=km();Hv.ChatToolPlanDeltaEvent=SNr.serialization.object({delta:xNr.ChatToolPlanDeltaEventDelta.optional()}).extend(CNr.ChatStreamEventType)});var OPe=v(Vv=>{"use strict";var ONr=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]}),PNr=Vv&&Vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ENr=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)&&ONr(e,t,r);return PNr(e,t),e};Object.defineProperty(Vv,"__esModule",{value:!0});Vv.ChatToolCallStartEventDeltaToolCallFunction=void 0;var CPe=ENr(G());Vv.ChatToolCallStartEventDeltaToolCallFunction=CPe.serialization.object({name:CPe.serialization.string().optional(),arguments:CPe.serialization.string().optional()})});var EPe=v(Wv=>{"use strict";var TNr=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]}),ANr=Wv&&Wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),INr=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)&&TNr(e,t,r);return ANr(e,t),e};Object.defineProperty(Wv,"__esModule",{value:!0});Wv.ChatToolCallStartEventDeltaToolCall=void 0;var PPe=INr(G()),MNr=OPe();Wv.ChatToolCallStartEventDeltaToolCall=PPe.serialization.object({id:PPe.serialization.string().optional(),type:PPe.serialization.stringLiteral("function").optional(),function:MNr.ChatToolCallStartEventDeltaToolCallFunction.optional()})});var TPe=v(Kv=>{"use strict";var RNr=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]}),jNr=Kv&&Kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NNr=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)&&RNr(e,t,r);return jNr(e,t),e};Object.defineProperty(Kv,"__esModule",{value:!0});Kv.ChatToolCallStartEventDelta=void 0;var Hxt=NNr(G()),DNr=EPe();Kv.ChatToolCallStartEventDelta=Hxt.serialization.object({toolCall:Hxt.serialization.property("tool_call",DNr.ChatToolCallStartEventDeltaToolCall.optional())})});var APe=v(Gv=>{"use strict";var LNr=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]}),FNr=Gv&&Gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kNr=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)&&LNr(e,t,r);return FNr(e,t),e};Object.defineProperty(Gv,"__esModule",{value:!0});Gv.ChatToolCallStartEvent=void 0;var Vxt=kNr(G()),$Nr=TPe(),BNr=km();Gv.ChatToolCallStartEvent=Vxt.serialization.object({index:Vxt.serialization.number().optional(),delta:$Nr.ChatToolCallStartEventDelta.optional()}).extend(BNr.ChatStreamEventType)});var IPe=v(Jv=>{"use strict";var qNr=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]}),UNr=Jv&&Jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zNr=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)&&qNr(e,t,r);return UNr(e,t),e};Object.defineProperty(Jv,"__esModule",{value:!0});Jv.ChatToolCallDeltaEventDeltaToolCallFunction=void 0;var Wxt=zNr(G());Jv.ChatToolCallDeltaEventDeltaToolCallFunction=Wxt.serialization.object({arguments:Wxt.serialization.string().optional()})});var MPe=v(Yv=>{"use strict";var HNr=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]}),VNr=Yv&&Yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WNr=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)&&HNr(e,t,r);return VNr(e,t),e};Object.defineProperty(Yv,"__esModule",{value:!0});Yv.ChatToolCallDeltaEventDeltaToolCall=void 0;var KNr=WNr(G()),GNr=IPe();Yv.ChatToolCallDeltaEventDeltaToolCall=KNr.serialization.object({function:GNr.ChatToolCallDeltaEventDeltaToolCallFunction.optional()})});var RPe=v(Zv=>{"use strict";var JNr=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]}),YNr=Zv&&Zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZNr=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)&&JNr(e,t,r);return YNr(e,t),e};Object.defineProperty(Zv,"__esModule",{value:!0});Zv.ChatToolCallDeltaEventDelta=void 0;var Kxt=ZNr(G()),XNr=MPe();Zv.ChatToolCallDeltaEventDelta=Kxt.serialization.object({toolCall:Kxt.serialization.property("tool_call",XNr.ChatToolCallDeltaEventDeltaToolCall.optional())})});var jPe=v(Xv=>{"use strict";var QNr=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]}),eDr=Xv&&Xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tDr=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)&&QNr(e,t,r);return eDr(e,t),e};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.ChatToolCallDeltaEvent=void 0;var Gxt=tDr(G()),rDr=RPe(),nDr=km();Xv.ChatToolCallDeltaEvent=Gxt.serialization.object({index:Gxt.serialization.number().optional(),delta:rDr.ChatToolCallDeltaEventDelta.optional()}).extend(nDr.ChatStreamEventType)});var NPe=v(Qv=>{"use strict";var oDr=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]}),iDr=Qv&&Qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aDr=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)&&oDr(e,t,r);return iDr(e,t),e};Object.defineProperty(Qv,"__esModule",{value:!0});Qv.ChatToolCallEndEvent=void 0;var Jxt=aDr(G()),sDr=km();Qv.ChatToolCallEndEvent=Jxt.serialization.object({index:Jxt.serialization.number().optional()}).extend(sDr.ChatStreamEventType)});var DPe=v(ew=>{"use strict";var uDr=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]}),lDr=ew&&ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cDr=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)&&uDr(e,t,r);return lDr(e,t),e};Object.defineProperty(ew,"__esModule",{value:!0});ew.ChatMessageEndEventDelta=void 0;var Yxt=cDr(G()),dDr=qte(),fDr=Ute();ew.ChatMessageEndEventDelta=Yxt.serialization.object({finishReason:Yxt.serialization.property("finish_reason",dDr.ChatFinishReason.optional()),usage:fDr.Usage.optional()})});var LPe=v(tw=>{"use strict";var pDr=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]}),mDr=tw&&tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hDr=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)&&pDr(e,t,r);return mDr(e,t),e};Object.defineProperty(tw,"__esModule",{value:!0});tw.ChatMessageEndEvent=void 0;var Zxt=hDr(G()),gDr=DPe(),yDr=km();tw.ChatMessageEndEvent=Zxt.serialization.object({id:Zxt.serialization.string().optional(),delta:gDr.ChatMessageEndEventDelta.optional()}).extend(yDr.ChatStreamEventType)});var FPe=v(rw=>{"use strict";var bDr=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]}),_Dr=rw&&rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vDr=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)&&bDr(e,t,r);return _Dr(e,t),e};Object.defineProperty(rw,"__esModule",{value:!0});rw.CitationStartEventDeltaMessage=void 0;var wDr=vDr(G()),SDr=xV();rw.CitationStartEventDeltaMessage=wDr.serialization.object({citations:SDr.Citation.optional()})});var kPe=v(nw=>{"use strict";var xDr=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]}),CDr=nw&&nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ODr=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)&&xDr(e,t,r);return CDr(e,t),e};Object.defineProperty(nw,"__esModule",{value:!0});nw.CitationStartEventDelta=void 0;var PDr=ODr(G()),EDr=FPe();nw.CitationStartEventDelta=PDr.serialization.object({message:EDr.CitationStartEventDeltaMessage.optional()})});var $Pe=v(ow=>{"use strict";var TDr=ow&&ow.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ADr=ow&&ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IDr=ow&&ow.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TDr(e,t,r);return ADr(e,t),e};Object.defineProperty(ow,"__esModule",{value:!0});ow.CitationStartEvent=void 0;var Xxt=IDr(G()),MDr=kPe(),RDr=km();ow.CitationStartEvent=Xxt.serialization.object({index:Xxt.serialization.number().optional(),delta:MDr.CitationStartEventDelta.optional()}).extend(RDr.ChatStreamEventType)});var BPe=v(iw=>{"use strict";var jDr=iw&&iw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NDr=iw&&iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DDr=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)&&jDr(e,t,r);return NDr(e,t),e};Object.defineProperty(iw,"__esModule",{value:!0});iw.CitationEndEvent=void 0;var Qxt=DDr(G()),LDr=km();iw.CitationEndEvent=Qxt.serialization.object({index:Qxt.serialization.number().optional()}).extend(LDr.ChatStreamEventType)});var eCt=v(aw=>{"use strict";var FDr=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]}),kDr=aw&&aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Dr=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)&&FDr(e,t,r);return kDr(e,t),e};Object.defineProperty(aw,"__esModule",{value:!0});aw.StreamedChatResponse2=void 0;var BDr=$Dr(G()),qDr=cPe(),UDr=hPe(),zDr=_Pe(),HDr=vPe(),VDr=xPe(),WDr=APe(),KDr=jPe(),GDr=NPe(),JDr=$Pe(),YDr=BPe(),ZDr=LPe();aw.StreamedChatResponse2=BDr.serialization.union("type",{"message-start":qDr.ChatMessageStartEvent,"content-start":UDr.ChatContentStartEvent,"content-delta":zDr.ChatContentDeltaEvent,"content-end":HDr.ChatContentEndEvent,"tool-plan-delta":VDr.ChatToolPlanDeltaEvent,"tool-call-start":WDr.ChatToolCallStartEvent,"tool-call-delta":KDr.ChatToolCallDeltaEvent,"tool-call-end":GDr.ChatToolCallEndEvent,"citation-start":JDr.CitationStartEvent,"citation-end":YDr.CitationEndEvent,"message-end":ZDr.ChatMessageEndEvent}).transform({transform:t=>t,untransform:t=>t})});var qPe=v(At=>{"use strict";var XDr=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]}),Bt=At&&At.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&XDr(e,t,r)};Object.defineProperty(At,"__esModule",{value:!0});Bt(ROe(),At);Bt(jOe(),At);Bt(q$(),At);Bt(NOe(),At);Bt(LOe(),At);Bt(kOe(),At);Bt(BOe(),At);Bt(Fte(),At);Bt(UOe(),At);Bt(zOe(),At);Bt(HOe(),At);Bt(xV(),At);Bt(VOe(),At);Bt(KOe(),At);Bt(GOe(),At);Bt(JOe(),At);Bt(ZOe(),At);Bt(XOe(),At);Bt(QOe(),At);Bt(ePe(),At);Bt(tPe(),At);Bt(rPe(),At);Bt($te(),At);Bt(nPe(),At);Bt(Bte(),At);Bt(qte(),At);Bt(oPe(),At);Bt(iPe(),At);Bt(aPe(),At);Bt(sPe(),At);Bt(Ute(),At);Bt(Fxt(),At);Bt(km(),At);Bt(uPe(),At);Bt(lPe(),At);Bt(cPe(),At);Bt(fPe(),At);Bt(pPe(),At);Bt(mPe(),At);Bt(hPe(),At);Bt(gPe(),At);Bt(yPe(),At);Bt(bPe(),At);Bt(_Pe(),At);Bt(vPe(),At);Bt(SPe(),At);Bt(xPe(),At);Bt(OPe(),At);Bt(EPe(),At);Bt(TPe(),At);Bt(APe(),At);Bt(IPe(),At);Bt(MPe(),At);Bt(RPe(),At);Bt(jPe(),At);Bt(NPe(),At);Bt(DPe(),At);Bt(LPe(),At);Bt(eCt(),At)});var Hte=v(sw=>{"use strict";var QDr=sw&&sw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eLr=sw&&sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tLr=sw&&sw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QDr(e,t,r);return eLr(e,t),e};Object.defineProperty(sw,"__esModule",{value:!0});sw.TextResponseFormat=void 0;var rLr=tLr(G());sw.TextResponseFormat=rLr.serialization.object({})});var UPe=v(uw=>{"use strict";var nLr=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]}),oLr=uw&&uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iLr=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)&&nLr(e,t,r);return oLr(e,t),e};Object.defineProperty(uw,"__esModule",{value:!0});uw.JsonResponseFormat2=void 0;var PV=iLr(G());uw.JsonResponseFormat2=PV.serialization.object({jsonSchema:PV.serialization.property("json_schema",PV.serialization.record(PV.serialization.string(),PV.serialization.unknown()).optional())})});var Vte=v(lw=>{"use strict";var aLr=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]}),sLr=lw&&lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uLr=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)&&aLr(e,t,r);return sLr(e,t),e};Object.defineProperty(lw,"__esModule",{value:!0});lw.ResponseFormat2=void 0;var lLr=uLr(G()),cLr=Hte(),dLr=UPe();lw.ResponseFormat2=lLr.serialization.union("type",{text:cLr.TextResponseFormat,json_object:dLr.JsonResponseFormat2}).transform({transform:t=>t,untransform:t=>t})});var tCt=v(cw=>{"use strict";var fLr=cw&&cw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pLr=cw&&cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mLr=cw&&cw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fLr(e,t,r);return pLr(e,t),e};Object.defineProperty(cw,"__esModule",{value:!0});cw.V2ChatStreamRequest=void 0;var Ws=mLr(G()),hLr=$te(),gLr=Bte(),yLr=ROe(),bLr=Vte();cw.V2ChatStreamRequest=Ws.serialization.object({model:Ws.serialization.string(),messages:hLr.ChatMessages,tools:Ws.serialization.list(gLr.Tool2).optional(),citationMode:Ws.serialization.property("citation_mode",yLr.V2ChatStreamRequestCitationMode.optional()),responseFormat:Ws.serialization.property("response_format",bLr.ResponseFormat2.optional()),maxTokens:Ws.serialization.property("max_tokens",Ws.serialization.number().optional()),stopSequences:Ws.serialization.property("stop_sequences",Ws.serialization.list(Ws.serialization.string()).optional()),temperature:Ws.serialization.number().optional(),seed:Ws.serialization.number().optional(),frequencyPenalty:Ws.serialization.property("frequency_penalty",Ws.serialization.number().optional()),presencePenalty:Ws.serialization.property("presence_penalty",Ws.serialization.number().optional()),k:Ws.serialization.number().optional(),p:Ws.serialization.number().optional(),returnPrompt:Ws.serialization.property("return_prompt",Ws.serialization.boolean().optional())})});var rCt=v(dw=>{"use strict";var _Lr=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]}),vLr=dw&&dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wLr=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)&&_Lr(e,t,r);return vLr(e,t),e};Object.defineProperty(dw,"__esModule",{value:!0});dw.V2ChatRequest=void 0;var Ks=wLr(G()),SLr=$te(),xLr=Bte(),CLr=jOe(),OLr=Vte();dw.V2ChatRequest=Ks.serialization.object({model:Ks.serialization.string(),messages:SLr.ChatMessages,tools:Ks.serialization.list(xLr.Tool2).optional(),citationMode:Ks.serialization.property("citation_mode",CLr.V2ChatRequestCitationMode.optional()),responseFormat:Ks.serialization.property("response_format",OLr.ResponseFormat2.optional()),maxTokens:Ks.serialization.property("max_tokens",Ks.serialization.number().optional()),stopSequences:Ks.serialization.property("stop_sequences",Ks.serialization.list(Ks.serialization.string()).optional()),temperature:Ks.serialization.number().optional(),seed:Ks.serialization.number().optional(),frequencyPenalty:Ks.serialization.property("frequency_penalty",Ks.serialization.number().optional()),presencePenalty:Ks.serialization.property("presence_penalty",Ks.serialization.number().optional()),k:Ks.serialization.number().optional(),p:Ks.serialization.number().optional(),returnPrompt:Ks.serialization.property("return_prompt",Ks.serialization.boolean().optional())})});var zPe=v(V$=>{"use strict";Object.defineProperty(V$,"__esModule",{value:!0});V$.V2ChatRequest=V$.V2ChatStreamRequest=void 0;var PLr=tCt();Object.defineProperty(V$,"V2ChatStreamRequest",{enumerable:!0,get:function(){return PLr.V2ChatStreamRequest}});var ELr=rCt();Object.defineProperty(V$,"V2ChatRequest",{enumerable:!0,get:function(){return ELr.V2ChatRequest}})});var nCt=v(yj=>{"use strict";var TLr=yj&&yj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ALr=yj&&yj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&TLr(e,t,r)};Object.defineProperty(yj,"__esModule",{value:!0});ALr(zPe(),yj)});var iCt=v(bA=>{"use strict";var ILr=bA&&bA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oCt=bA&&bA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ILr(e,t,r)};Object.defineProperty(bA,"__esModule",{value:!0});oCt(qPe(),bA);oCt(nCt(),bA)});var HPe=v(fw=>{"use strict";var MLr=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]}),RLr=fw&&fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jLr=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)&&MLr(e,t,r);return RLr(e,t),e};Object.defineProperty(fw,"__esModule",{value:!0});fw.CreateEmbedJobRequestTruncate=void 0;var NLr=jLr(G());fw.CreateEmbedJobRequestTruncate=NLr.serialization.enum_(["START","END"])});var VPe=v(bj=>{"use strict";var DLr=bj&&bj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LLr=bj&&bj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DLr(e,t,r)};Object.defineProperty(bj,"__esModule",{value:!0});LLr(HPe(),bj)});var Wte=v(pw=>{"use strict";var FLr=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]}),kLr=pw&&pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Lr=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)&&FLr(e,t,r);return kLr(e,t),e};Object.defineProperty(pw,"__esModule",{value:!0});pw.EmbedInputType=void 0;var BLr=$Lr(G());pw.EmbedInputType=BLr.serialization.enum_(["search_document","search_query","classification","clustering"])});var Kte=v(mw=>{"use strict";var qLr=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]}),ULr=mw&&mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zLr=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)&&qLr(e,t,r);return ULr(e,t),e};Object.defineProperty(mw,"__esModule",{value:!0});mw.EmbeddingType=void 0;var HLr=zLr(G());mw.EmbeddingType=HLr.serialization.enum_(["float","int8","uint8","binary","ubinary"])});var aCt=v(hw=>{"use strict";var VLr=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]}),WLr=hw&&hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KLr=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)&&VLr(e,t,r);return WLr(e,t),e};Object.defineProperty(hw,"__esModule",{value:!0});hw.CreateEmbedJobRequest=void 0;var _A=KLr(G()),GLr=Wte(),JLr=Kte(),YLr=HPe();hw.CreateEmbedJobRequest=_A.serialization.object({model:_A.serialization.string(),datasetId:_A.serialization.property("dataset_id",_A.serialization.string()),inputType:_A.serialization.property("input_type",GLr.EmbedInputType),name:_A.serialization.string().optional(),embeddingTypes:_A.serialization.property("embedding_types",_A.serialization.list(JLr.EmbeddingType).optional()),truncate:YLr.CreateEmbedJobRequestTruncate.optional()})});var WPe=v(Gte=>{"use strict";Object.defineProperty(Gte,"__esModule",{value:!0});Gte.CreateEmbedJobRequest=void 0;var ZLr=aCt();Object.defineProperty(Gte,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return ZLr.CreateEmbedJobRequest}})});var sCt=v(_j=>{"use strict";var XLr=_j&&_j.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QLr=_j&&_j.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&XLr(e,t,r)};Object.defineProperty(_j,"__esModule",{value:!0});QLr(WPe(),_j)});var lCt=v(vA=>{"use strict";var eFr=vA&&vA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uCt=vA&&vA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eFr(e,t,r)};Object.defineProperty(vA,"__esModule",{value:!0});uCt(VPe(),vA);uCt(sCt(),vA)});var KPe=v(gw=>{"use strict";var tFr=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]}),rFr=gw&&gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nFr=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)&&tFr(e,t,r);return rFr(e,t),e};Object.defineProperty(gw,"__esModule",{value:!0});gw.DatasetType=void 0;var oFr=nFr(G());gw.DatasetType=oFr.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 GPe=v(yw=>{"use strict";var iFr=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]}),aFr=yw&&yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sFr=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)&&iFr(e,t,r);return aFr(e,t),e};Object.defineProperty(yw,"__esModule",{value:!0});yw.DatasetValidationStatus=void 0;var uFr=sFr(G());yw.DatasetValidationStatus=uFr.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var JPe=v(bw=>{"use strict";var lFr=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]}),cFr=bw&&bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dFr=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)&&lFr(e,t,r);return cFr(e,t),e};Object.defineProperty(bw,"__esModule",{value:!0});bw.DatasetPart=void 0;var $m=dFr(G());bw.DatasetPart=$m.serialization.object({id:$m.serialization.string(),name:$m.serialization.string(),url:$m.serialization.string().optional(),index:$m.serialization.number().optional(),sizeBytes:$m.serialization.property("size_bytes",$m.serialization.number().optional()),numRows:$m.serialization.property("num_rows",$m.serialization.number().optional()),originalUrl:$m.serialization.property("original_url",$m.serialization.string().optional()),samples:$m.serialization.list($m.serialization.string()).optional()})});var Jte=v(_w=>{"use strict";var fFr=_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]}),pFr=_w&&_w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mFr=_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)&&fFr(e,t,r);return pFr(e,t),e};Object.defineProperty(_w,"__esModule",{value:!0});_w.Dataset=void 0;var Ka=mFr(G()),hFr=KPe(),gFr=GPe(),yFr=JPe();_w.Dataset=Ka.serialization.object({id:Ka.serialization.string(),name:Ka.serialization.string(),createdAt:Ka.serialization.property("created_at",Ka.serialization.date()),updatedAt:Ka.serialization.property("updated_at",Ka.serialization.date()),datasetType:Ka.serialization.property("dataset_type",hFr.DatasetType),validationStatus:Ka.serialization.property("validation_status",gFr.DatasetValidationStatus),validationError:Ka.serialization.property("validation_error",Ka.serialization.string().optional()),schema:Ka.serialization.string().optional(),requiredFields:Ka.serialization.property("required_fields",Ka.serialization.list(Ka.serialization.string()).optional()),preserveFields:Ka.serialization.property("preserve_fields",Ka.serialization.list(Ka.serialization.string()).optional()),datasetParts:Ka.serialization.property("dataset_parts",Ka.serialization.list(yFr.DatasetPart).optional()),validationWarnings:Ka.serialization.property("validation_warnings",Ka.serialization.list(Ka.serialization.string()).optional())})});var dCt=v(vw=>{"use strict";var bFr=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]}),_Fr=vw&&vw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vFr=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)&&bFr(e,t,r);return _Fr(e,t),e};Object.defineProperty(vw,"__esModule",{value:!0});vw.DatasetsListResponse=void 0;var cCt=vFr(G()),wFr=Jte();vw.DatasetsListResponse=cCt.serialization.object({datasets:cCt.serialization.list(wFr.Dataset).optional()})});var fCt=v(ww=>{"use strict";var SFr=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]}),xFr=ww&&ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CFr=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)&&SFr(e,t,r);return xFr(e,t),e};Object.defineProperty(ww,"__esModule",{value:!0});ww.DatasetsCreateResponseDatasetPartsItem=void 0;var wA=CFr(G());ww.DatasetsCreateResponseDatasetPartsItem=wA.serialization.object({name:wA.serialization.string().optional(),numRows:wA.serialization.property("num_rows",wA.serialization.number().optional()),samples:wA.serialization.list(wA.serialization.string()).optional(),partKind:wA.serialization.property("part_kind",wA.serialization.string().optional())})});var mCt=v(Sw=>{"use strict";var OFr=Sw&&Sw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PFr=Sw&&Sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EFr=Sw&&Sw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OFr(e,t,r);return PFr(e,t),e};Object.defineProperty(Sw,"__esModule",{value:!0});Sw.DatasetsCreateResponse=void 0;var pCt=EFr(G());Sw.DatasetsCreateResponse=pCt.serialization.object({id:pCt.serialization.string().optional()})});var hCt=v(xw=>{"use strict";var TFr=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]}),AFr=xw&&xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IFr=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)&&TFr(e,t,r);return AFr(e,t),e};Object.defineProperty(xw,"__esModule",{value:!0});xw.DatasetsGetUsageResponse=void 0;var YPe=IFr(G());xw.DatasetsGetUsageResponse=YPe.serialization.object({organizationUsage:YPe.serialization.property("organization_usage",YPe.serialization.number().optional())})});var gCt=v(Cw=>{"use strict";var MFr=Cw&&Cw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RFr=Cw&&Cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jFr=Cw&&Cw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MFr(e,t,r);return RFr(e,t),e};Object.defineProperty(Cw,"__esModule",{value:!0});Cw.DatasetsGetResponse=void 0;var NFr=jFr(G()),DFr=Jte();Cw.DatasetsGetResponse=NFr.serialization.object({dataset:DFr.Dataset})});var ZPe=v(By=>{"use strict";var LFr=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]}),EV=By&&By.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&LFr(e,t,r)};Object.defineProperty(By,"__esModule",{value:!0});EV(dCt(),By);EV(fCt(),By);EV(mCt(),By);EV(hCt(),By);EV(gCt(),By)});var yCt=v(Ow=>{"use strict";var FFr=Ow&&Ow.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kFr=Ow&&Ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Fr=Ow&&Ow.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FFr(e,t,r);return kFr(e,t),e};Object.defineProperty(Ow,"__esModule",{value:!0});Ow.Response=void 0;var XPe=$Fr(G());Ow.Response=XPe.serialization.record(XPe.serialization.string(),XPe.serialization.unknown())});var bCt=v(Pw=>{"use strict";var BFr=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]}),qFr=Pw&&Pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UFr=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)&&BFr(e,t,r);return qFr(e,t),e};Object.defineProperty(Pw,"__esModule",{value:!0});Pw.delete=void 0;Pw.delete=UFr(yCt())});var vCt=v(SA=>{"use strict";var zFr=SA&&SA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Ct=SA&&SA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zFr(e,t,r)};Object.defineProperty(SA,"__esModule",{value:!0});_Ct(ZPe(),SA);_Ct(bCt(),SA)});var QPe=v(Ew=>{"use strict";var HFr=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]}),VFr=Ew&&Ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WFr=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)&&HFr(e,t,r);return VFr(e,t),e};Object.defineProperty(Ew,"__esModule",{value:!0});Ew.BaseType=void 0;var KFr=WFr(G());Ew.BaseType=KFr.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var eEe=v(Tw=>{"use strict";var GFr=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]}),JFr=Tw&&Tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YFr=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)&&GFr(e,t,r);return JFr(e,t),e};Object.defineProperty(Tw,"__esModule",{value:!0});Tw.Strategy=void 0;var ZFr=YFr(G());Tw.Strategy=ZFr.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var tEe=v(Aw=>{"use strict";var XFr=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]}),QFr=Aw&&Aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ekr=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)&&XFr(e,t,r);return QFr(e,t),e};Object.defineProperty(Aw,"__esModule",{value:!0});Aw.BaseModel=void 0;var Yte=ekr(G()),tkr=QPe(),rkr=eEe();Aw.BaseModel=Yte.serialization.object({name:Yte.serialization.string().optional(),version:Yte.serialization.string().optional(),baseType:Yte.serialization.property("base_type",tkr.BaseType),strategy:rkr.Strategy.optional()})});var rEe=v(Iw=>{"use strict";var nkr=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]}),okr=Iw&&Iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ikr=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)&&nkr(e,t,r);return okr(e,t),e};Object.defineProperty(Iw,"__esModule",{value:!0});Iw.Hyperparameters=void 0;var qy=ikr(G());Iw.Hyperparameters=qy.serialization.object({earlyStoppingPatience:qy.serialization.property("early_stopping_patience",qy.serialization.number().optional()),earlyStoppingThreshold:qy.serialization.property("early_stopping_threshold",qy.serialization.number().optional()),trainBatchSize:qy.serialization.property("train_batch_size",qy.serialization.number().optional()),trainEpochs:qy.serialization.property("train_epochs",qy.serialization.number().optional()),learningRate:qy.serialization.property("learning_rate",qy.serialization.number().optional())})});var nEe=v(Mw=>{"use strict";var akr=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]}),skr=Mw&&Mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ukr=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)&&akr(e,t,r);return skr(e,t),e};Object.defineProperty(Mw,"__esModule",{value:!0});Mw.WandbConfig=void 0;var TV=ukr(G());Mw.WandbConfig=TV.serialization.object({project:TV.serialization.string(),apiKey:TV.serialization.property("api_key",TV.serialization.string()),entity:TV.serialization.string().optional()})});var Zte=v(Rw=>{"use strict";var lkr=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]}),ckr=Rw&&Rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dkr=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)&&lkr(e,t,r);return ckr(e,t),e};Object.defineProperty(Rw,"__esModule",{value:!0});Rw.Settings=void 0;var W$=dkr(G()),fkr=tEe(),pkr=rEe(),mkr=nEe();Rw.Settings=W$.serialization.object({baseModel:W$.serialization.property("base_model",fkr.BaseModel),datasetId:W$.serialization.property("dataset_id",W$.serialization.string()),hyperparameters:pkr.Hyperparameters.optional(),multiLabel:W$.serialization.property("multi_label",W$.serialization.boolean().optional()),wandb:mkr.WandbConfig.optional()})});var AV=v(jw=>{"use strict";var hkr=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]}),gkr=jw&&jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ykr=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)&&hkr(e,t,r);return gkr(e,t),e};Object.defineProperty(jw,"__esModule",{value:!0});jw.Status=void 0;var bkr=ykr(G());jw.Status=bkr.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var K$=v(Nw=>{"use strict";var _kr=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]}),vkr=Nw&&Nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wkr=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)&&_kr(e,t,r);return vkr(e,t),e};Object.defineProperty(Nw,"__esModule",{value:!0});Nw.FinetunedModel=void 0;var Gf=wkr(G()),Skr=Zte(),xkr=AV();Nw.FinetunedModel=Gf.serialization.object({id:Gf.serialization.string().optional(),name:Gf.serialization.string(),creatorId:Gf.serialization.property("creator_id",Gf.serialization.string().optional()),organizationId:Gf.serialization.property("organization_id",Gf.serialization.string().optional()),settings:Skr.Settings,status:xkr.Status.optional(),createdAt:Gf.serialization.property("created_at",Gf.serialization.date().optional()),updatedAt:Gf.serialization.property("updated_at",Gf.serialization.date().optional()),completedAt:Gf.serialization.property("completed_at",Gf.serialization.date().optional()),lastUsed:Gf.serialization.property("last_used",Gf.serialization.date().optional())})});var wCt=v(Dw=>{"use strict";var Ckr=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]}),Okr=Dw&&Dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pkr=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)&&Ckr(e,t,r);return Okr(e,t),e};Object.defineProperty(Dw,"__esModule",{value:!0});Dw.ListFinetunedModelsResponse=void 0;var vj=Pkr(G()),Ekr=K$();Dw.ListFinetunedModelsResponse=vj.serialization.object({finetunedModels:vj.serialization.property("finetuned_models",vj.serialization.list(Ekr.FinetunedModel).optional()),nextPageToken:vj.serialization.property("next_page_token",vj.serialization.string().optional()),totalSize:vj.serialization.property("total_size",vj.serialization.number().optional())})});var xCt=v(Lw=>{"use strict";var Tkr=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]}),Akr=Lw&&Lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ikr=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)&&Tkr(e,t,r);return Akr(e,t),e};Object.defineProperty(Lw,"__esModule",{value:!0});Lw.CreateFinetunedModelResponse=void 0;var SCt=Ikr(G()),Mkr=K$();Lw.CreateFinetunedModelResponse=SCt.serialization.object({finetunedModel:SCt.serialization.property("finetuned_model",Mkr.FinetunedModel.optional())})});var OCt=v(Fw=>{"use strict";var Rkr=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]}),jkr=Fw&&Fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nkr=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)&&Rkr(e,t,r);return jkr(e,t),e};Object.defineProperty(Fw,"__esModule",{value:!0});Fw.GetFinetunedModelResponse=void 0;var CCt=Nkr(G()),Dkr=K$();Fw.GetFinetunedModelResponse=CCt.serialization.object({finetunedModel:CCt.serialization.property("finetuned_model",Dkr.FinetunedModel.optional())})});var PCt=v(kw=>{"use strict";var Lkr=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]}),Fkr=kw&&kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kkr=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)&&Lkr(e,t,r);return Fkr(e,t),e};Object.defineProperty(kw,"__esModule",{value:!0});kw.DeleteFinetunedModelResponse=void 0;var oEe=kkr(G());kw.DeleteFinetunedModelResponse=oEe.serialization.record(oEe.serialization.string(),oEe.serialization.unknown())});var TCt=v($w=>{"use strict";var $kr=$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]}),Bkr=$w&&$w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qkr=$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)&&$kr(e,t,r);return Bkr(e,t),e};Object.defineProperty($w,"__esModule",{value:!0});$w.UpdateFinetunedModelResponse=void 0;var ECt=qkr(G()),Ukr=K$();$w.UpdateFinetunedModelResponse=ECt.serialization.object({finetunedModel:ECt.serialization.property("finetuned_model",Ukr.FinetunedModel.optional())})});var iEe=v(Bw=>{"use strict";var zkr=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]}),Hkr=Bw&&Bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vkr=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)&&zkr(e,t,r);return Hkr(e,t),e};Object.defineProperty(Bw,"__esModule",{value:!0});Bw.Event=void 0;var IV=Vkr(G()),Wkr=AV();Bw.Event=IV.serialization.object({userId:IV.serialization.property("user_id",IV.serialization.string().optional()),status:Wkr.Status.optional(),createdAt:IV.serialization.property("created_at",IV.serialization.date().optional())})});var ACt=v(qw=>{"use strict";var Kkr=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]}),Gkr=qw&&qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jkr=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)&&Kkr(e,t,r);return Gkr(e,t),e};Object.defineProperty(qw,"__esModule",{value:!0});qw.ListEventsResponse=void 0;var G$=Jkr(G()),Ykr=iEe();qw.ListEventsResponse=G$.serialization.object({events:G$.serialization.list(Ykr.Event).optional(),nextPageToken:G$.serialization.property("next_page_token",G$.serialization.string().optional()),totalSize:G$.serialization.property("total_size",G$.serialization.number().optional())})});var aEe=v(Uw=>{"use strict";var Zkr=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]}),Xkr=Uw&&Uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qkr=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)&&Zkr(e,t,r);return Xkr(e,t),e};Object.defineProperty(Uw,"__esModule",{value:!0});Uw.TrainingStepMetrics=void 0;var xA=Qkr(G());Uw.TrainingStepMetrics=xA.serialization.object({createdAt:xA.serialization.property("created_at",xA.serialization.date().optional()),stepNumber:xA.serialization.property("step_number",xA.serialization.number().optional()),metrics:xA.serialization.record(xA.serialization.string(),xA.serialization.number()).optional()})});var ICt=v(zw=>{"use strict";var e$r=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]}),t$r=zw&&zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r$r=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)&&e$r(e,t,r);return t$r(e,t),e};Object.defineProperty(zw,"__esModule",{value:!0});zw.ListTrainingStepMetricsResponse=void 0;var MV=r$r(G()),n$r=aEe();zw.ListTrainingStepMetricsResponse=MV.serialization.object({stepMetrics:MV.serialization.property("step_metrics",MV.serialization.list(n$r.TrainingStepMetrics).optional()),nextPageToken:MV.serialization.property("next_page_token",MV.serialization.string().optional())})});var sEe=v(Ga=>{"use strict";var o$r=Ga&&Ga.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hc=Ga&&Ga.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&o$r(e,t,r)};Object.defineProperty(Ga,"__esModule",{value:!0});Hc(QPe(),Ga);Hc(eEe(),Ga);Hc(tEe(),Ga);Hc(rEe(),Ga);Hc(nEe(),Ga);Hc(Zte(),Ga);Hc(AV(),Ga);Hc(K$(),Ga);Hc(wCt(),Ga);Hc(xCt(),Ga);Hc(OCt(),Ga);Hc(PCt(),Ga);Hc(TCt(),Ga);Hc(iEe(),Ga);Hc(ACt(),Ga);Hc(aEe(),Ga);Hc(ICt(),Ga)});var MCt=v(wj=>{"use strict";var i$r=wj&&wj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),a$r=wj&&wj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&i$r(e,t,r)};Object.defineProperty(wj,"__esModule",{value:!0});a$r(sEe(),wj)});var jCt=v(Bm=>{"use strict";var RCt=Bm&&Bm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s$r=Bm&&Bm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u$r=Bm&&Bm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RCt(e,t,r);return s$r(e,t),e},l$r=Bm&&Bm.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RCt(e,t,r)};Object.defineProperty(Bm,"__esModule",{value:!0});Bm.finetuning=void 0;Bm.finetuning=u$r(MCt());l$r(sEe(),Bm)});var NCt=v(Hw=>{"use strict";var c$r=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]}),d$r=Hw&&Hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f$r=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)&&c$r(e,t,r);return d$r(e,t),e};Object.defineProperty(Hw,"__esModule",{value:!0});Hw.FinetuningUpdateFinetunedModelRequest=void 0;var Lp=f$r(G()),p$r=Zte(),m$r=AV();Hw.FinetuningUpdateFinetunedModelRequest=Lp.serialization.object({name:Lp.serialization.string(),creatorId:Lp.serialization.property("creator_id",Lp.serialization.string().optional()),organizationId:Lp.serialization.property("organization_id",Lp.serialization.string().optional()),settings:p$r.Settings,status:m$r.Status.optional(),createdAt:Lp.serialization.property("created_at",Lp.serialization.date().optional()),updatedAt:Lp.serialization.property("updated_at",Lp.serialization.date().optional()),completedAt:Lp.serialization.property("completed_at",Lp.serialization.date().optional()),lastUsed:Lp.serialization.property("last_used",Lp.serialization.date().optional())})});var uEe=v(Xte=>{"use strict";Object.defineProperty(Xte,"__esModule",{value:!0});Xte.FinetuningUpdateFinetunedModelRequest=void 0;var h$r=NCt();Object.defineProperty(Xte,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return h$r.FinetuningUpdateFinetunedModelRequest}})});var DCt=v(Sj=>{"use strict";var g$r=Sj&&Sj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y$r=Sj&&Sj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&g$r(e,t,r)};Object.defineProperty(Sj,"__esModule",{value:!0});y$r(uEe(),Sj)});var FCt=v(CA=>{"use strict";var b$r=CA&&CA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LCt=CA&&CA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&b$r(e,t,r)};Object.defineProperty(CA,"__esModule",{value:!0});LCt(jCt(),CA);LCt(DCt(),CA)});var Qte=v(Ww=>{"use strict";var _$r=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]}),v$r=Ww&&Ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w$r=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)&&_$r(e,t,r);return v$r(e,t),e};Object.defineProperty(Ww,"__esModule",{value:!0});Ww.CreateConnectorOAuth=void 0;var Vw=w$r(G());Ww.CreateConnectorOAuth=Vw.serialization.object({clientId:Vw.serialization.property("client_id",Vw.serialization.string().optional()),clientSecret:Vw.serialization.property("client_secret",Vw.serialization.string().optional()),authorizeUrl:Vw.serialization.property("authorize_url",Vw.serialization.string().optional()),tokenUrl:Vw.serialization.property("token_url",Vw.serialization.string().optional()),scope:Vw.serialization.string().optional()})});var lEe=v(Kw=>{"use strict";var S$r=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]}),x$r=Kw&&Kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C$r=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)&&S$r(e,t,r);return x$r(e,t),e};Object.defineProperty(Kw,"__esModule",{value:!0});Kw.AuthTokenType=void 0;var O$r=C$r(G());Kw.AuthTokenType=O$r.serialization.enum_(["bearer","basic","noscheme"])});var ere=v(Gw=>{"use strict";var P$r=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]}),E$r=Gw&&Gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T$r=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)&&P$r(e,t,r);return E$r(e,t),e};Object.defineProperty(Gw,"__esModule",{value:!0});Gw.CreateConnectorServiceAuth=void 0;var kCt=T$r(G()),A$r=lEe();Gw.CreateConnectorServiceAuth=kCt.serialization.object({type:A$r.AuthTokenType,token:kCt.serialization.string()})});var $Ct=v(Yw=>{"use strict";var I$r=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]}),M$r=Yw&&Yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R$r=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)&&I$r(e,t,r);return M$r(e,t),e};Object.defineProperty(Yw,"__esModule",{value:!0});Yw.CreateConnectorRequest=void 0;var Jw=R$r(G()),j$r=Qte(),N$r=ere();Yw.CreateConnectorRequest=Jw.serialization.object({name:Jw.serialization.string(),description:Jw.serialization.string().optional(),url:Jw.serialization.string(),excludes:Jw.serialization.list(Jw.serialization.string()).optional(),oauth:j$r.CreateConnectorOAuth.optional(),active:Jw.serialization.boolean().optional(),continueOnFailure:Jw.serialization.property("continue_on_failure",Jw.serialization.boolean().optional()),serviceAuth:Jw.serialization.property("service_auth",N$r.CreateConnectorServiceAuth.optional())})});var BCt=v(Zw=>{"use strict";var D$r=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]}),L$r=Zw&&Zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F$r=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)&&D$r(e,t,r);return L$r(e,t),e};Object.defineProperty(Zw,"__esModule",{value:!0});Zw.UpdateConnectorRequest=void 0;var MO=F$r(G()),k$r=Qte(),$$r=ere();Zw.UpdateConnectorRequest=MO.serialization.object({name:MO.serialization.string().optional(),url:MO.serialization.string().optional(),excludes:MO.serialization.list(MO.serialization.string()).optional(),oauth:k$r.CreateConnectorOAuth.optional(),active:MO.serialization.boolean().optional(),continueOnFailure:MO.serialization.property("continue_on_failure",MO.serialization.boolean().optional()),serviceAuth:MO.serialization.property("service_auth",$$r.CreateConnectorServiceAuth.optional())})});var cEe=v(J$=>{"use strict";Object.defineProperty(J$,"__esModule",{value:!0});J$.UpdateConnectorRequest=J$.CreateConnectorRequest=void 0;var B$r=$Ct();Object.defineProperty(J$,"CreateConnectorRequest",{enumerable:!0,get:function(){return B$r.CreateConnectorRequest}});var q$r=BCt();Object.defineProperty(J$,"UpdateConnectorRequest",{enumerable:!0,get:function(){return q$r.UpdateConnectorRequest}})});var qCt=v(xj=>{"use strict";var U$r=xj&&xj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z$r=xj&&xj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&U$r(e,t,r)};Object.defineProperty(xj,"__esModule",{value:!0});z$r(cEe(),xj)});var UCt=v(Cj=>{"use strict";var H$r=Cj&&Cj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V$r=Cj&&Cj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&H$r(e,t,r)};Object.defineProperty(Cj,"__esModule",{value:!0});V$r(qCt(),Cj)});var HCt=v(Di=>{"use strict";var zCt=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]}),W$r=Di&&Di.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RV=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)&&zCt(e,t,r);return W$r(e,t),e},Oj=Di&&Di.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zCt(e,t,r)};Object.defineProperty(Di,"__esModule",{value:!0});Di.connectors=Di.finetuning=Di.datasets=Di.embedJobs=Di.v2=void 0;Di.v2=RV(iCt());Oj(qPe(),Di);Di.embedJobs=RV(lCt());Oj(VPe(),Di);Di.datasets=RV(vCt());Oj(ZPe(),Di);Di.finetuning=RV(FCt());Oj(zPe(),Di);Oj(WPe(),Di);Di.connectors=RV(UCt());Oj(cEe(),Di);Oj(uEe(),Di)});var dEe=v(Xw=>{"use strict";var K$r=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]}),G$r=Xw&&Xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J$r=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)&&K$r(e,t,r);return G$r(e,t),e};Object.defineProperty(Xw,"__esModule",{value:!0});Xw.ChatStreamRequestPromptTruncation=void 0;var Y$r=J$r(G());Xw.ChatStreamRequestPromptTruncation=Y$r.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var fEe=v(Qw=>{"use strict";var Z$r=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]}),X$r=Qw&&Qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q$r=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)&&Z$r(e,t,r);return X$r(e,t),e};Object.defineProperty(Qw,"__esModule",{value:!0});Qw.ChatStreamRequestCitationQuality=void 0;var eBr=Q$r(G());Qw.ChatStreamRequestCitationQuality=eBr.serialization.enum_(["fast","accurate","off"])});var WCt=v(e0=>{"use strict";var tBr=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]}),rBr=e0&&e0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nBr=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)&&tBr(e,t,r);return rBr(e,t),e};Object.defineProperty(e0,"__esModule",{value:!0});e0.ChatStreamRequestConnectorsSearchOptions=void 0;var VCt=nBr(G());e0.ChatStreamRequestConnectorsSearchOptions=VCt.serialization.object({seed:VCt.serialization.number().optional()})});var pEe=v(t0=>{"use strict";var oBr=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]}),iBr=t0&&t0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aBr=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)&&oBr(e,t,r);return iBr(e,t),e};Object.defineProperty(t0,"__esModule",{value:!0});t0.ChatStreamRequestSafetyMode=void 0;var sBr=aBr(G());t0.ChatStreamRequestSafetyMode=sBr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var GCt=v(r0=>{"use strict";var uBr=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]}),lBr=r0&&r0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cBr=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)&&uBr(e,t,r);return lBr(e,t),e};Object.defineProperty(r0,"__esModule",{value:!0});r0.UnprocessableEntityErrorBody=void 0;var KCt=cBr(G());r0.UnprocessableEntityErrorBody=KCt.serialization.object({data:KCt.serialization.string().optional()})});var YCt=v(n0=>{"use strict";var dBr=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]}),fBr=n0&&n0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pBr=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)&&dBr(e,t,r);return fBr(e,t),e};Object.defineProperty(n0,"__esModule",{value:!0});n0.TooManyRequestsErrorBody=void 0;var JCt=pBr(G());n0.TooManyRequestsErrorBody=JCt.serialization.object({data:JCt.serialization.string().optional()})});var XCt=v(o0=>{"use strict";var mBr=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]}),hBr=o0&&o0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gBr=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)&&mBr(e,t,r);return hBr(e,t),e};Object.defineProperty(o0,"__esModule",{value:!0});o0.ClientClosedRequestErrorBody=void 0;var ZCt=gBr(G());o0.ClientClosedRequestErrorBody=ZCt.serialization.object({data:ZCt.serialization.string().optional()})});var eOt=v(i0=>{"use strict";var yBr=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]}),bBr=i0&&i0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Br=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)&&yBr(e,t,r);return bBr(e,t),e};Object.defineProperty(i0,"__esModule",{value:!0});i0.NotImplementedErrorBody=void 0;var QCt=_Br(G());i0.NotImplementedErrorBody=QCt.serialization.object({data:QCt.serialization.string().optional()})});var rOt=v(a0=>{"use strict";var vBr=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]}),wBr=a0&&a0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SBr=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)&&vBr(e,t,r);return wBr(e,t),e};Object.defineProperty(a0,"__esModule",{value:!0});a0.GatewayTimeoutErrorBody=void 0;var tOt=SBr(G());a0.GatewayTimeoutErrorBody=tOt.serialization.object({data:tOt.serialization.string().optional()})});var mEe=v(s0=>{"use strict";var xBr=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]}),CBr=s0&&s0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OBr=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)&&xBr(e,t,r);return CBr(e,t),e};Object.defineProperty(s0,"__esModule",{value:!0});s0.ChatRequestPromptTruncation=void 0;var PBr=OBr(G());s0.ChatRequestPromptTruncation=PBr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var hEe=v(u0=>{"use strict";var EBr=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]}),TBr=u0&&u0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ABr=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)&&EBr(e,t,r);return TBr(e,t),e};Object.defineProperty(u0,"__esModule",{value:!0});u0.ChatRequestCitationQuality=void 0;var IBr=ABr(G());u0.ChatRequestCitationQuality=IBr.serialization.enum_(["fast","accurate","off"])});var oOt=v(l0=>{"use strict";var MBr=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]}),RBr=l0&&l0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jBr=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)&&MBr(e,t,r);return RBr(e,t),e};Object.defineProperty(l0,"__esModule",{value:!0});l0.ChatRequestConnectorsSearchOptions=void 0;var nOt=jBr(G());l0.ChatRequestConnectorsSearchOptions=nOt.serialization.object({seed:nOt.serialization.number().optional()})});var gEe=v(c0=>{"use strict";var NBr=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]}),DBr=c0&&c0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LBr=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)&&NBr(e,t,r);return DBr(e,t),e};Object.defineProperty(c0,"__esModule",{value:!0});c0.ChatRequestSafetyMode=void 0;var FBr=LBr(G());c0.ChatRequestSafetyMode=FBr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var yEe=v(d0=>{"use strict";var kBr=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]}),$Br=d0&&d0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BBr=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)&&kBr(e,t,r);return $Br(e,t),e};Object.defineProperty(d0,"__esModule",{value:!0});d0.GenerateStreamRequestTruncate=void 0;var qBr=BBr(G());d0.GenerateStreamRequestTruncate=qBr.serialization.enum_(["NONE","START","END"])});var bEe=v(f0=>{"use strict";var UBr=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]}),zBr=f0&&f0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HBr=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)&&UBr(e,t,r);return zBr(e,t),e};Object.defineProperty(f0,"__esModule",{value:!0});f0.GenerateStreamRequestReturnLikelihoods=void 0;var VBr=HBr(G());f0.GenerateStreamRequestReturnLikelihoods=VBr.serialization.enum_(["GENERATION","ALL","NONE"])});var _Ee=v(p0=>{"use strict";var WBr=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]}),KBr=p0&&p0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GBr=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)&&WBr(e,t,r);return KBr(e,t),e};Object.defineProperty(p0,"__esModule",{value:!0});p0.GenerateRequestTruncate=void 0;var JBr=GBr(G());p0.GenerateRequestTruncate=JBr.serialization.enum_(["NONE","START","END"])});var vEe=v(m0=>{"use strict";var YBr=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]}),ZBr=m0&&m0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XBr=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)&&YBr(e,t,r);return ZBr(e,t),e};Object.defineProperty(m0,"__esModule",{value:!0});m0.GenerateRequestReturnLikelihoods=void 0;var QBr=XBr(G());m0.GenerateRequestReturnLikelihoods=QBr.serialization.enum_(["GENERATION","ALL","NONE"])});var wEe=v(h0=>{"use strict";var eqr=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]}),tqr=h0&&h0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rqr=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)&&eqr(e,t,r);return tqr(e,t),e};Object.defineProperty(h0,"__esModule",{value:!0});h0.EmbedRequestTruncate=void 0;var nqr=rqr(G());h0.EmbedRequestTruncate=nqr.serialization.enum_(["NONE","START","END"])});var SEe=v(g0=>{"use strict";var oqr=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]}),iqr=g0&&g0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aqr=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)&&oqr(e,t,r);return iqr(e,t),e};Object.defineProperty(g0,"__esModule",{value:!0});g0.ApiMetaApiVersion=void 0;var Y$=aqr(G());g0.ApiMetaApiVersion=Y$.serialization.object({version:Y$.serialization.string(),isDeprecated:Y$.serialization.property("is_deprecated",Y$.serialization.boolean().optional()),isExperimental:Y$.serialization.property("is_experimental",Y$.serialization.boolean().optional())})});var xEe=v(y0=>{"use strict";var sqr=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]}),uqr=y0&&y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lqr=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)&&sqr(e,t,r);return uqr(e,t),e};Object.defineProperty(y0,"__esModule",{value:!0});y0.ApiMetaBilledUnits=void 0;var OA=lqr(G());y0.ApiMetaBilledUnits=OA.serialization.object({inputTokens:OA.serialization.property("input_tokens",OA.serialization.number().optional()),outputTokens:OA.serialization.property("output_tokens",OA.serialization.number().optional()),searchUnits:OA.serialization.property("search_units",OA.serialization.number().optional()),classifications:OA.serialization.number().optional()})});var CEe=v(b0=>{"use strict";var cqr=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]}),dqr=b0&&b0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fqr=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)&&cqr(e,t,r);return dqr(e,t),e};Object.defineProperty(b0,"__esModule",{value:!0});b0.ApiMetaTokens=void 0;var jV=fqr(G());b0.ApiMetaTokens=jV.serialization.object({inputTokens:jV.serialization.property("input_tokens",jV.serialization.number().optional()),outputTokens:jV.serialization.property("output_tokens",jV.serialization.number().optional())})});var qm=v(_0=>{"use strict";var pqr=_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]}),mqr=_0&&_0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hqr=_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)&&pqr(e,t,r);return mqr(e,t),e};Object.defineProperty(_0,"__esModule",{value:!0});_0.ApiMeta=void 0;var NV=hqr(G()),gqr=SEe(),yqr=xEe(),bqr=CEe();_0.ApiMeta=NV.serialization.object({apiVersion:NV.serialization.property("api_version",gqr.ApiMetaApiVersion.optional()),billedUnits:NV.serialization.property("billed_units",yqr.ApiMetaBilledUnits.optional()),tokens:bqr.ApiMetaTokens.optional(),warnings:NV.serialization.list(NV.serialization.string()).optional()})});var OEe=v(v0=>{"use strict";var _qr=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]}),vqr=v0&&v0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wqr=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)&&_qr(e,t,r);return vqr(e,t),e};Object.defineProperty(v0,"__esModule",{value:!0});v0.EmbedFloatsResponse=void 0;var Pj=wqr(G()),Sqr=qm();v0.EmbedFloatsResponse=Pj.serialization.object({id:Pj.serialization.string(),embeddings:Pj.serialization.list(Pj.serialization.list(Pj.serialization.number())),texts:Pj.serialization.list(Pj.serialization.string()),meta:Sqr.ApiMeta.optional()})});var PEe=v(w0=>{"use strict";var xqr=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]}),Cqr=w0&&w0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Oqr=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)&&xqr(e,t,r);return Cqr(e,t),e};Object.defineProperty(w0,"__esModule",{value:!0});w0.EmbedByTypeResponseEmbeddings=void 0;var Xd=Oqr(G());w0.EmbedByTypeResponseEmbeddings=Xd.serialization.object({float:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional(),int8:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional(),uint8:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional(),binary:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional(),ubinary:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional()})});var EEe=v(S0=>{"use strict";var Pqr=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]}),Eqr=S0&&S0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tqr=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)&&Pqr(e,t,r);return Eqr(e,t),e};Object.defineProperty(S0,"__esModule",{value:!0});S0.EmbedByTypeResponse=void 0;var tre=Tqr(G()),Aqr=PEe(),Iqr=qm();S0.EmbedByTypeResponse=tre.serialization.object({id:tre.serialization.string(),embeddings:Aqr.EmbedByTypeResponseEmbeddings,texts:tre.serialization.list(tre.serialization.string()),meta:Iqr.ApiMeta.optional()})});var aOt=v(x0=>{"use strict";var Mqr=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]}),Rqr=x0&&x0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jqr=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)&&Mqr(e,t,r);return Rqr(e,t),e};Object.defineProperty(x0,"__esModule",{value:!0});x0.EmbedResponse=void 0;var iOt=jqr(G()),Nqr=OEe(),Dqr=EEe();x0.EmbedResponse=iOt.serialization.union(iOt.serialization.discriminant("responseType","response_type"),{embeddings_floats:Nqr.EmbedFloatsResponse,embeddings_by_type:Dqr.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var AEe=v(C0=>{"use strict";var Lqr=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]}),Fqr=C0&&C0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kqr=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)&&Lqr(e,t,r);return Fqr(e,t),e};Object.defineProperty(C0,"__esModule",{value:!0});C0.RerankDocument=void 0;var TEe=kqr(G());C0.RerankDocument=TEe.serialization.record(TEe.serialization.string(),TEe.serialization.string())});var IEe=v(O0=>{"use strict";var $qr=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]}),Bqr=O0&&O0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qqr=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)&&$qr(e,t,r);return Bqr(e,t),e};Object.defineProperty(O0,"__esModule",{value:!0});O0.RerankRequestDocumentsItem=void 0;var sOt=qqr(G()),Uqr=AEe();O0.RerankRequestDocumentsItem=sOt.serialization.undiscriminatedUnion([sOt.serialization.string(),Uqr.RerankDocument])});var MEe=v(P0=>{"use strict";var zqr=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]}),Hqr=P0&&P0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vqr=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)&&zqr(e,t,r);return Hqr(e,t),e};Object.defineProperty(P0,"__esModule",{value:!0});P0.RerankResponseResultsItemDocument=void 0;var uOt=Vqr(G());P0.RerankResponseResultsItemDocument=uOt.serialization.object({text:uOt.serialization.string()})});var REe=v(E0=>{"use strict";var Wqr=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]}),Kqr=E0&&E0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gqr=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)&&Wqr(e,t,r);return Kqr(e,t),e};Object.defineProperty(E0,"__esModule",{value:!0});E0.RerankResponseResultsItem=void 0;var rre=Gqr(G()),Jqr=MEe();E0.RerankResponseResultsItem=rre.serialization.object({document:Jqr.RerankResponseResultsItemDocument.optional(),index:rre.serialization.number(),relevanceScore:rre.serialization.property("relevance_score",rre.serialization.number())})});var lOt=v(T0=>{"use strict";var Yqr=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]}),Zqr=T0&&T0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xqr=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)&&Yqr(e,t,r);return Zqr(e,t),e};Object.defineProperty(T0,"__esModule",{value:!0});T0.RerankResponse=void 0;var jEe=Xqr(G()),Qqr=REe(),eUr=qm();T0.RerankResponse=jEe.serialization.object({id:jEe.serialization.string().optional(),results:jEe.serialization.list(Qqr.RerankResponseResultsItem),meta:eUr.ApiMeta.optional()})});var NEe=v(A0=>{"use strict";var tUr=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]}),rUr=A0&&A0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nUr=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)&&tUr(e,t,r);return rUr(e,t),e};Object.defineProperty(A0,"__esModule",{value:!0});A0.ClassifyRequestTruncate=void 0;var oUr=nUr(G());A0.ClassifyRequestTruncate=oUr.serialization.enum_(["NONE","START","END"])});var DEe=v(I0=>{"use strict";var iUr=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]}),aUr=I0&&I0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sUr=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)&&iUr(e,t,r);return aUr(e,t),e};Object.defineProperty(I0,"__esModule",{value:!0});I0.ClassifyResponseClassificationsItemLabelsValue=void 0;var cOt=sUr(G());I0.ClassifyResponseClassificationsItemLabelsValue=cOt.serialization.object({confidence:cOt.serialization.number().optional()})});var LEe=v(M0=>{"use strict";var uUr=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]}),lUr=M0&&M0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cUr=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)&&uUr(e,t,r);return lUr(e,t),e};Object.defineProperty(M0,"__esModule",{value:!0});M0.ClassifyResponseClassificationsItemClassificationType=void 0;var dUr=cUr(G());M0.ClassifyResponseClassificationsItemClassificationType=dUr.serialization.enum_(["single-label","multi-label"])});var FEe=v(R0=>{"use strict";var fUr=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]}),pUr=R0&&R0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mUr=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)&&fUr(e,t,r);return pUr(e,t),e};Object.defineProperty(R0,"__esModule",{value:!0});R0.ClassifyResponseClassificationsItem=void 0;var lg=mUr(G()),hUr=DEe(),gUr=LEe();R0.ClassifyResponseClassificationsItem=lg.serialization.object({id:lg.serialization.string(),input:lg.serialization.string().optional(),prediction:lg.serialization.string().optional(),predictions:lg.serialization.list(lg.serialization.string()),confidence:lg.serialization.number().optional(),confidences:lg.serialization.list(lg.serialization.number()),labels:lg.serialization.record(lg.serialization.string(),hUr.ClassifyResponseClassificationsItemLabelsValue),classificationType:lg.serialization.property("classification_type",gUr.ClassifyResponseClassificationsItemClassificationType)})});var dOt=v(j0=>{"use strict";var yUr=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]}),bUr=j0&&j0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Ur=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)&&yUr(e,t,r);return bUr(e,t),e};Object.defineProperty(j0,"__esModule",{value:!0});j0.ClassifyResponse=void 0;var kEe=_Ur(G()),vUr=FEe(),wUr=qm();j0.ClassifyResponse=kEe.serialization.object({id:kEe.serialization.string(),classifications:kEe.serialization.list(vUr.ClassifyResponseClassificationsItem),meta:wUr.ApiMeta.optional()})});var $Ee=v(N0=>{"use strict";var SUr=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]}),xUr=N0&&N0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CUr=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)&&SUr(e,t,r);return xUr(e,t),e};Object.defineProperty(N0,"__esModule",{value:!0});N0.SummarizeRequestLength=void 0;var OUr=CUr(G());N0.SummarizeRequestLength=OUr.serialization.enum_(["short","medium","long"])});var BEe=v(D0=>{"use strict";var PUr=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]}),EUr=D0&&D0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TUr=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)&&PUr(e,t,r);return EUr(e,t),e};Object.defineProperty(D0,"__esModule",{value:!0});D0.SummarizeRequestFormat=void 0;var AUr=TUr(G());D0.SummarizeRequestFormat=AUr.serialization.enum_(["paragraph","bullets"])});var qEe=v(L0=>{"use strict";var IUr=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]}),MUr=L0&&L0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RUr=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)&&IUr(e,t,r);return MUr(e,t),e};Object.defineProperty(L0,"__esModule",{value:!0});L0.SummarizeRequestExtractiveness=void 0;var jUr=RUr(G());L0.SummarizeRequestExtractiveness=jUr.serialization.enum_(["low","medium","high"])});var fOt=v(F0=>{"use strict";var NUr=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]}),DUr=F0&&F0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LUr=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)&&NUr(e,t,r);return DUr(e,t),e};Object.defineProperty(F0,"__esModule",{value:!0});F0.SummarizeResponse=void 0;var UEe=LUr(G()),FUr=qm();F0.SummarizeResponse=UEe.serialization.object({id:UEe.serialization.string().optional(),summary:UEe.serialization.string().optional(),meta:FUr.ApiMeta.optional()})});var pOt=v(k0=>{"use strict";var kUr=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]}),$Ur=k0&&k0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BUr=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)&&kUr(e,t,r);return $Ur(e,t),e};Object.defineProperty(k0,"__esModule",{value:!0});k0.TokenizeResponse=void 0;var Z$=BUr(G()),qUr=qm();k0.TokenizeResponse=Z$.serialization.object({tokens:Z$.serialization.list(Z$.serialization.number()),tokenStrings:Z$.serialization.property("token_strings",Z$.serialization.list(Z$.serialization.string())),meta:qUr.ApiMeta.optional()})});var hOt=v($0=>{"use strict";var UUr=$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]}),zUr=$0&&$0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HUr=$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)&&UUr(e,t,r);return zUr(e,t),e};Object.defineProperty($0,"__esModule",{value:!0});$0.DetokenizeResponse=void 0;var mOt=HUr(G()),VUr=qm();$0.DetokenizeResponse=mOt.serialization.object({text:mOt.serialization.string(),meta:VUr.ApiMeta.optional()})});var gOt=v(B0=>{"use strict";var WUr=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]}),KUr=B0&&B0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GUr=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)&&WUr(e,t,r);return KUr(e,t),e};Object.defineProperty(B0,"__esModule",{value:!0});B0.CheckApiKeyResponse=void 0;var X$=GUr(G());B0.CheckApiKeyResponse=X$.serialization.object({valid:X$.serialization.boolean(),organizationId:X$.serialization.property("organization_id",X$.serialization.string().optional()),ownerId:X$.serialization.property("owner_id",X$.serialization.string().optional())})});var Q$=v(q0=>{"use strict";var JUr=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]}),YUr=q0&&q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZUr=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)&&JUr(e,t,r);return YUr(e,t),e};Object.defineProperty(q0,"__esModule",{value:!0});q0.ToolCall=void 0;var DV=ZUr(G());q0.ToolCall=DV.serialization.object({name:DV.serialization.string(),parameters:DV.serialization.record(DV.serialization.string(),DV.serialization.unknown())})});var zEe=v(U0=>{"use strict";var XUr=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]}),QUr=U0&&U0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ezr=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)&&XUr(e,t,r);return QUr(e,t),e};Object.defineProperty(U0,"__esModule",{value:!0});U0.ChatMessage=void 0;var nre=ezr(G()),tzr=Q$();U0.ChatMessage=nre.serialization.object({message:nre.serialization.string(),toolCalls:nre.serialization.property("tool_calls",nre.serialization.list(tzr.ToolCall).optional())})});var FV=v(z0=>{"use strict";var rzr=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]}),nzr=z0&&z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ozr=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)&&rzr(e,t,r);return nzr(e,t),e};Object.defineProperty(z0,"__esModule",{value:!0});z0.ToolResult=void 0;var LV=ozr(G()),izr=Q$();z0.ToolResult=LV.serialization.object({call:izr.ToolCall,outputs:LV.serialization.list(LV.serialization.record(LV.serialization.string(),LV.serialization.unknown()))})});var VEe=v(H0=>{"use strict";var azr=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]}),szr=H0&&H0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uzr=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)&&azr(e,t,r);return szr(e,t),e};Object.defineProperty(H0,"__esModule",{value:!0});H0.ToolMessage=void 0;var HEe=uzr(G()),lzr=FV();H0.ToolMessage=HEe.serialization.object({toolResults:HEe.serialization.property("tool_results",HEe.serialization.list(lzr.ToolResult).optional())})});var kV=v(V0=>{"use strict";var czr=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]}),dzr=V0&&V0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fzr=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)&&czr(e,t,r);return dzr(e,t),e};Object.defineProperty(V0,"__esModule",{value:!0});V0.Message=void 0;var pzr=fzr(G()),WEe=zEe(),mzr=VEe();V0.Message=pzr.serialization.union("role",{CHATBOT:WEe.ChatMessage,SYSTEM:WEe.ChatMessage,USER:WEe.ChatMessage,TOOL:mzr.ToolMessage}).transform({transform:t=>t,untransform:t=>t})});var ore=v(W0=>{"use strict";var hzr=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]}),gzr=W0&&W0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yzr=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)&&hzr(e,t,r);return gzr(e,t),e};Object.defineProperty(W0,"__esModule",{value:!0});W0.ChatConnector=void 0;var RO=yzr(G());W0.ChatConnector=RO.serialization.object({id:RO.serialization.string(),userAccessToken:RO.serialization.property("user_access_token",RO.serialization.string().optional()),continueOnFailure:RO.serialization.property("continue_on_failure",RO.serialization.boolean().optional()),options:RO.serialization.record(RO.serialization.string(),RO.serialization.unknown()).optional()})});var KEe=v(K0=>{"use strict";var bzr=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]}),_zr=K0&&K0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vzr=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)&&bzr(e,t,r);return _zr(e,t),e};Object.defineProperty(K0,"__esModule",{value:!0});K0.ToolParameterDefinitionsValue=void 0;var ire=vzr(G());K0.ToolParameterDefinitionsValue=ire.serialization.object({description:ire.serialization.string().optional(),type:ire.serialization.string(),required:ire.serialization.boolean().optional()})});var are=v(G0=>{"use strict";var wzr=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]}),Szr=G0&&G0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xzr=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)&&wzr(e,t,r);return Szr(e,t),e};Object.defineProperty(G0,"__esModule",{value:!0});G0.Tool=void 0;var eB=xzr(G()),Czr=KEe();G0.Tool=eB.serialization.object({name:eB.serialization.string(),description:eB.serialization.string(),parameterDefinitions:eB.serialization.property("parameter_definitions",eB.serialization.record(eB.serialization.string(),Czr.ToolParameterDefinitionsValue).optional())})});var GEe=v(J0=>{"use strict";var Ozr=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]}),Pzr=J0&&J0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ezr=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)&&Ozr(e,t,r);return Pzr(e,t),e};Object.defineProperty(J0,"__esModule",{value:!0});J0.JsonResponseFormat=void 0;var sre=Ezr(G());J0.JsonResponseFormat=sre.serialization.object({schema:sre.serialization.record(sre.serialization.string(),sre.serialization.unknown()).optional()})});var ure=v(Y0=>{"use strict";var Tzr=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]}),Azr=Y0&&Y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Izr=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)&&Tzr(e,t,r);return Azr(e,t),e};Object.defineProperty(Y0,"__esModule",{value:!0});Y0.ResponseFormat=void 0;var Mzr=Izr(G()),Rzr=Hte(),jzr=GEe();Y0.ResponseFormat=Mzr.serialization.union("type",{text:Rzr.TextResponseFormat,json_object:jzr.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var lre=v(Z0=>{"use strict";var Nzr=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]}),Dzr=Z0&&Z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lzr=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)&&Nzr(e,t,r);return Dzr(e,t),e};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.ChatCitation=void 0;var Ej=Lzr(G());Z0.ChatCitation=Ej.serialization.object({start:Ej.serialization.number(),end:Ej.serialization.number(),text:Ej.serialization.string(),documentIds:Ej.serialization.property("document_ids",Ej.serialization.list(Ej.serialization.string()))})});var $V=v(X0=>{"use strict";var Fzr=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]}),kzr=X0&&X0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$zr=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)&&Fzr(e,t,r);return kzr(e,t),e};Object.defineProperty(X0,"__esModule",{value:!0});X0.ChatSearchQuery=void 0;var cre=$zr(G());X0.ChatSearchQuery=cre.serialization.object({text:cre.serialization.string(),generationId:cre.serialization.property("generation_id",cre.serialization.string())})});var JEe=v(Q0=>{"use strict";var Bzr=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]}),qzr=Q0&&Q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uzr=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)&&Bzr(e,t,r);return qzr(e,t),e};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.ChatSearchResultConnector=void 0;var yOt=Uzr(G());Q0.ChatSearchResultConnector=yOt.serialization.object({id:yOt.serialization.string()})});var dre=v(eS=>{"use strict";var zzr=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]}),Hzr=eS&&eS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vzr=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)&&zzr(e,t,r);return Hzr(e,t),e};Object.defineProperty(eS,"__esModule",{value:!0});eS.ChatSearchResult=void 0;var jO=Vzr(G()),Wzr=$V(),Kzr=JEe();eS.ChatSearchResult=jO.serialization.object({searchQuery:jO.serialization.property("search_query",Wzr.ChatSearchQuery.optional()),connector:Kzr.ChatSearchResultConnector,documentIds:jO.serialization.property("document_ids",jO.serialization.list(jO.serialization.string())),errorMessage:jO.serialization.property("error_message",jO.serialization.string().optional()),continueOnFailure:jO.serialization.property("continue_on_failure",jO.serialization.boolean().optional())})});var tB=v(tS=>{"use strict";var Gzr=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]}),Jzr=tS&&tS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yzr=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)&&Gzr(e,t,r);return Jzr(e,t),e};Object.defineProperty(tS,"__esModule",{value:!0});tS.FinishReason=void 0;var Zzr=Yzr(G());tS.FinishReason=Zzr.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var YEe=v(rS=>{"use strict";var Xzr=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]}),Qzr=rS&&rS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e2r=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)&&Xzr(e,t,r);return Qzr(e,t),e};Object.defineProperty(rS,"__esModule",{value:!0});rS.NonStreamedChatResponse=void 0;var ec=e2r(G()),t2r=lre(),r2r=gj(),n2r=$V(),o2r=dre(),i2r=tB(),a2r=Q$(),s2r=kV(),u2r=qm();rS.NonStreamedChatResponse=ec.serialization.object({text:ec.serialization.string(),generationId:ec.serialization.property("generation_id",ec.serialization.string().optional()),citations:ec.serialization.list(t2r.ChatCitation).optional(),documents:ec.serialization.list(r2r.ChatDocument).optional(),isSearchRequired:ec.serialization.property("is_search_required",ec.serialization.boolean().optional()),searchQueries:ec.serialization.property("search_queries",ec.serialization.list(n2r.ChatSearchQuery).optional()),searchResults:ec.serialization.property("search_results",ec.serialization.list(o2r.ChatSearchResult).optional()),finishReason:ec.serialization.property("finish_reason",i2r.FinishReason.optional()),toolCalls:ec.serialization.property("tool_calls",ec.serialization.list(a2r.ToolCall).optional()),chatHistory:ec.serialization.property("chat_history",ec.serialization.list(s2r.Message).optional()),prompt:ec.serialization.string().optional(),meta:u2r.ApiMeta.optional()})});var oS=v(nS=>{"use strict";var l2r=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]}),c2r=nS&&nS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d2r=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)&&l2r(e,t,r);return c2r(e,t),e};Object.defineProperty(nS,"__esModule",{value:!0});nS.ChatStreamEvent=void 0;var f2r=d2r(G());nS.ChatStreamEvent=f2r.serialization.object({})});var XEe=v(iS=>{"use strict";var p2r=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]}),m2r=iS&&iS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h2r=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)&&p2r(e,t,r);return m2r(e,t),e};Object.defineProperty(iS,"__esModule",{value:!0});iS.ChatStreamStartEvent=void 0;var ZEe=h2r(G()),g2r=oS();iS.ChatStreamStartEvent=ZEe.serialization.object({generationId:ZEe.serialization.property("generation_id",ZEe.serialization.string())}).extend(g2r.ChatStreamEvent)});var eTe=v(aS=>{"use strict";var y2r=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]}),b2r=aS&&aS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_2r=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)&&y2r(e,t,r);return b2r(e,t),e};Object.defineProperty(aS,"__esModule",{value:!0});aS.ChatSearchQueriesGenerationEvent=void 0;var QEe=_2r(G()),v2r=$V(),w2r=oS();aS.ChatSearchQueriesGenerationEvent=QEe.serialization.object({searchQueries:QEe.serialization.property("search_queries",QEe.serialization.list(v2r.ChatSearchQuery))}).extend(w2r.ChatStreamEvent)});var tTe=v(sS=>{"use strict";var S2r=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]}),x2r=sS&&sS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C2r=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)&&S2r(e,t,r);return x2r(e,t),e};Object.defineProperty(sS,"__esModule",{value:!0});sS.ChatSearchResultsEvent=void 0;var fre=C2r(G()),O2r=dre(),P2r=gj(),E2r=oS();sS.ChatSearchResultsEvent=fre.serialization.object({searchResults:fre.serialization.property("search_results",fre.serialization.list(O2r.ChatSearchResult).optional()),documents:fre.serialization.list(P2r.ChatDocument).optional()}).extend(E2r.ChatStreamEvent)});var rTe=v(uS=>{"use strict";var T2r=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]}),A2r=uS&&uS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I2r=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)&&T2r(e,t,r);return A2r(e,t),e};Object.defineProperty(uS,"__esModule",{value:!0});uS.ChatTextGenerationEvent=void 0;var bOt=I2r(G()),M2r=oS();uS.ChatTextGenerationEvent=bOt.serialization.object({text:bOt.serialization.string()}).extend(M2r.ChatStreamEvent)});var nTe=v(lS=>{"use strict";var R2r=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]}),j2r=lS&&lS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N2r=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)&&R2r(e,t,r);return j2r(e,t),e};Object.defineProperty(lS,"__esModule",{value:!0});lS.ChatCitationGenerationEvent=void 0;var _Ot=N2r(G()),D2r=lre(),L2r=oS();lS.ChatCitationGenerationEvent=_Ot.serialization.object({citations:_Ot.serialization.list(D2r.ChatCitation)}).extend(L2r.ChatStreamEvent)});var oTe=v(cS=>{"use strict";var F2r=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]}),k2r=cS&&cS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$2r=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)&&F2r(e,t,r);return k2r(e,t),e};Object.defineProperty(cS,"__esModule",{value:!0});cS.ChatToolCallsGenerationEvent=void 0;var pre=$2r(G()),B2r=Q$(),q2r=oS();cS.ChatToolCallsGenerationEvent=pre.serialization.object({text:pre.serialization.string().optional(),toolCalls:pre.serialization.property("tool_calls",pre.serialization.list(B2r.ToolCall))}).extend(q2r.ChatStreamEvent)});var iTe=v(dS=>{"use strict";var U2r=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]}),z2r=dS&&dS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H2r=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)&&U2r(e,t,r);return z2r(e,t),e};Object.defineProperty(dS,"__esModule",{value:!0});dS.ChatStreamEndEventFinishReason=void 0;var V2r=H2r(G());dS.ChatStreamEndEventFinishReason=V2r.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var aTe=v(fS=>{"use strict";var W2r=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]}),K2r=fS&&fS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G2r=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)&&W2r(e,t,r);return K2r(e,t),e};Object.defineProperty(fS,"__esModule",{value:!0});fS.ChatStreamEndEvent=void 0;var vOt=G2r(G()),J2r=iTe(),Y2r=YEe(),Z2r=oS();fS.ChatStreamEndEvent=vOt.serialization.object({finishReason:vOt.serialization.property("finish_reason",J2r.ChatStreamEndEventFinishReason),response:Y2r.NonStreamedChatResponse}).extend(Z2r.ChatStreamEvent)});var sTe=v(pS=>{"use strict";var X2r=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]}),Q2r=pS&&pS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e4r=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)&&X2r(e,t,r);return Q2r(e,t),e};Object.defineProperty(pS,"__esModule",{value:!0});pS.ToolCallDelta=void 0;var BV=e4r(G());pS.ToolCallDelta=BV.serialization.object({name:BV.serialization.string().optional(),index:BV.serialization.number().optional(),parameters:BV.serialization.string().optional(),text:BV.serialization.string().optional()})});var uTe=v(mS=>{"use strict";var t4r=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]}),r4r=mS&&mS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n4r=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)&&t4r(e,t,r);return r4r(e,t),e};Object.defineProperty(mS,"__esModule",{value:!0});mS.ChatToolCallsChunkEvent=void 0;var wOt=n4r(G()),o4r=sTe(),i4r=oS();mS.ChatToolCallsChunkEvent=wOt.serialization.object({toolCallDelta:wOt.serialization.property("tool_call_delta",o4r.ToolCallDelta)}).extend(i4r.ChatStreamEvent)});var xOt=v(hS=>{"use strict";var a4r=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]}),s4r=hS&&hS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u4r=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)&&a4r(e,t,r);return s4r(e,t),e};Object.defineProperty(hS,"__esModule",{value:!0});hS.StreamedChatResponse=void 0;var SOt=u4r(G()),l4r=XEe(),c4r=eTe(),d4r=tTe(),f4r=rTe(),p4r=nTe(),m4r=oTe(),h4r=aTe(),g4r=uTe();hS.StreamedChatResponse=SOt.serialization.union(SOt.serialization.discriminant("eventType","event_type"),{"stream-start":l4r.ChatStreamStartEvent,"search-queries-generation":c4r.ChatSearchQueriesGenerationEvent,"search-results":d4r.ChatSearchResultsEvent,"text-generation":f4r.ChatTextGenerationEvent,"citation-generation":p4r.ChatCitationGenerationEvent,"tool-calls-generation":m4r.ChatToolCallsGenerationEvent,"stream-end":h4r.ChatStreamEndEvent,"tool-calls-chunk":g4r.ChatToolCallsChunkEvent}).transform({transform:t=>t,untransform:t=>t})});var cTe=v(gS=>{"use strict";var y4r=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]}),b4r=gS&&gS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_4r=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)&&y4r(e,t,r);return b4r(e,t),e};Object.defineProperty(gS,"__esModule",{value:!0});gS.SingleGenerationTokenLikelihoodsItem=void 0;var lTe=_4r(G());gS.SingleGenerationTokenLikelihoodsItem=lTe.serialization.object({token:lTe.serialization.string(),likelihood:lTe.serialization.number()})});var dTe=v(yS=>{"use strict";var v4r=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]}),w4r=yS&&yS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S4r=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)&&v4r(e,t,r);return w4r(e,t),e};Object.defineProperty(yS,"__esModule",{value:!0});yS.SingleGeneration=void 0;var Tj=S4r(G()),x4r=cTe();yS.SingleGeneration=Tj.serialization.object({id:Tj.serialization.string(),text:Tj.serialization.string(),index:Tj.serialization.number().optional(),likelihood:Tj.serialization.number().optional(),tokenLikelihoods:Tj.serialization.property("token_likelihoods",Tj.serialization.list(x4r.SingleGenerationTokenLikelihoodsItem).optional())})});var COt=v(bS=>{"use strict";var C4r=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]}),O4r=bS&&bS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P4r=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)&&C4r(e,t,r);return O4r(e,t),e};Object.defineProperty(bS,"__esModule",{value:!0});bS.Generation=void 0;var mre=P4r(G()),E4r=dTe(),T4r=qm();bS.Generation=mre.serialization.object({id:mre.serialization.string(),prompt:mre.serialization.string().optional(),generations:mre.serialization.list(E4r.SingleGeneration),meta:T4r.ApiMeta.optional()})});var qV=v(_S=>{"use strict";var A4r=_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]}),I4r=_S&&_S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M4r=_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)&&A4r(e,t,r);return I4r(e,t),e};Object.defineProperty(_S,"__esModule",{value:!0});_S.GenerateStreamEvent=void 0;var R4r=M4r(G());_S.GenerateStreamEvent=R4r.serialization.object({})});var fTe=v(vS=>{"use strict";var j4r=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]}),N4r=vS&&vS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D4r=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)&&j4r(e,t,r);return N4r(e,t),e};Object.defineProperty(vS,"__esModule",{value:!0});vS.GenerateStreamText=void 0;var UV=D4r(G()),L4r=qV();vS.GenerateStreamText=UV.serialization.object({text:UV.serialization.string(),index:UV.serialization.number().optional(),isFinished:UV.serialization.property("is_finished",UV.serialization.boolean())}).extend(L4r.GenerateStreamEvent)});var pTe=v(wS=>{"use strict";var F4r=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]}),k4r=wS&&wS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$4r=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)&&F4r(e,t,r);return k4r(e,t),e};Object.defineProperty(wS,"__esModule",{value:!0});wS.SingleGenerationInStream=void 0;var zV=$4r(G()),B4r=tB();wS.SingleGenerationInStream=zV.serialization.object({id:zV.serialization.string(),text:zV.serialization.string(),index:zV.serialization.number().optional(),finishReason:zV.serialization.property("finish_reason",B4r.FinishReason)})});var mTe=v(SS=>{"use strict";var q4r=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]}),U4r=SS&&SS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z4r=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)&&q4r(e,t,r);return U4r(e,t),e};Object.defineProperty(SS,"__esModule",{value:!0});SS.GenerateStreamEndResponse=void 0;var hre=z4r(G()),H4r=pTe();SS.GenerateStreamEndResponse=hre.serialization.object({id:hre.serialization.string(),prompt:hre.serialization.string().optional(),generations:hre.serialization.list(H4r.SingleGenerationInStream).optional()})});var hTe=v(xS=>{"use strict";var V4r=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]}),W4r=xS&&xS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K4r=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)&&V4r(e,t,r);return W4r(e,t),e};Object.defineProperty(xS,"__esModule",{value:!0});xS.GenerateStreamEnd=void 0;var gre=K4r(G()),G4r=tB(),J4r=mTe(),Y4r=qV();xS.GenerateStreamEnd=gre.serialization.object({isFinished:gre.serialization.property("is_finished",gre.serialization.boolean()),finishReason:gre.serialization.property("finish_reason",G4r.FinishReason.optional()),response:J4r.GenerateStreamEndResponse}).extend(Y4r.GenerateStreamEvent)});var gTe=v(CS=>{"use strict";var Z4r=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]}),X4r=CS&&CS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q4r=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)&&Z4r(e,t,r);return X4r(e,t),e};Object.defineProperty(CS,"__esModule",{value:!0});CS.GenerateStreamError=void 0;var rB=Q4r(G()),e3r=tB(),t3r=qV();CS.GenerateStreamError=rB.serialization.object({index:rB.serialization.number().optional(),isFinished:rB.serialization.property("is_finished",rB.serialization.boolean()),finishReason:rB.serialization.property("finish_reason",e3r.FinishReason),err:rB.serialization.string()}).extend(t3r.GenerateStreamEvent)});var POt=v(OS=>{"use strict";var r3r=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]}),n3r=OS&&OS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o3r=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)&&r3r(e,t,r);return n3r(e,t),e};Object.defineProperty(OS,"__esModule",{value:!0});OS.GenerateStreamedResponse=void 0;var OOt=o3r(G()),i3r=fTe(),a3r=hTe(),s3r=gTe();OS.GenerateStreamedResponse=OOt.serialization.union(OOt.serialization.discriminant("eventType","event_type"),{"text-generation":i3r.GenerateStreamText,"stream-end":a3r.GenerateStreamEnd,"stream-error":s3r.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var yTe=v(PS=>{"use strict";var u3r=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]}),l3r=PS&&PS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c3r=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)&&u3r(e,t,r);return l3r(e,t),e};Object.defineProperty(PS,"__esModule",{value:!0});PS.EmbedJobStatus=void 0;var d3r=c3r(G());PS.EmbedJobStatus=d3r.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var bTe=v(ES=>{"use strict";var f3r=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]}),p3r=ES&&ES.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m3r=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)&&f3r(e,t,r);return p3r(e,t),e};Object.defineProperty(ES,"__esModule",{value:!0});ES.EmbedJobTruncate=void 0;var h3r=m3r(G());ES.EmbedJobTruncate=h3r.serialization.enum_(["START","END"])});var _Te=v(TS=>{"use strict";var g3r=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]}),y3r=TS&&TS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b3r=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)&&g3r(e,t,r);return y3r(e,t),e};Object.defineProperty(TS,"__esModule",{value:!0});TS.EmbedJob=void 0;var Uy=b3r(G()),_3r=yTe(),v3r=bTe(),w3r=qm();TS.EmbedJob=Uy.serialization.object({jobId:Uy.serialization.property("job_id",Uy.serialization.string()),name:Uy.serialization.string().optional(),status:_3r.EmbedJobStatus,createdAt:Uy.serialization.property("created_at",Uy.serialization.date()),inputDatasetId:Uy.serialization.property("input_dataset_id",Uy.serialization.string()),outputDatasetId:Uy.serialization.property("output_dataset_id",Uy.serialization.string().optional()),model:Uy.serialization.string(),truncate:v3r.EmbedJobTruncate,meta:w3r.ApiMeta.optional()})});var EOt=v(AS=>{"use strict";var S3r=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]}),x3r=AS&&AS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C3r=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)&&S3r(e,t,r);return x3r(e,t),e};Object.defineProperty(AS,"__esModule",{value:!0});AS.ListEmbedJobResponse=void 0;var vTe=C3r(G()),O3r=_Te();AS.ListEmbedJobResponse=vTe.serialization.object({embedJobs:vTe.serialization.property("embed_jobs",vTe.serialization.list(O3r.EmbedJob).optional())})});var TOt=v(IS=>{"use strict";var P3r=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]}),E3r=IS&&IS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T3r=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)&&P3r(e,t,r);return E3r(e,t),e};Object.defineProperty(IS,"__esModule",{value:!0});IS.CreateEmbedJobResponse=void 0;var wTe=T3r(G()),A3r=qm();IS.CreateEmbedJobResponse=wTe.serialization.object({jobId:wTe.serialization.property("job_id",wTe.serialization.string()),meta:A3r.ApiMeta.optional()})});var xTe=v(MS=>{"use strict";var I3r=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]}),M3r=MS&&MS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R3r=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)&&I3r(e,t,r);return M3r(e,t),e};Object.defineProperty(MS,"__esModule",{value:!0});MS.ClassifyExample=void 0;var STe=R3r(G());MS.ClassifyExample=STe.serialization.object({text:STe.serialization.string().optional(),label:STe.serialization.string().optional()})});var AOt=v(RS=>{"use strict";var j3r=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]}),N3r=RS&&RS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D3r=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)&&j3r(e,t,r);return N3r(e,t),e};Object.defineProperty(RS,"__esModule",{value:!0});RS.ParseInfo=void 0;var CTe=D3r(G());RS.ParseInfo=CTe.serialization.object({separator:CTe.serialization.string().optional(),delimiter:CTe.serialization.string().optional()})});var IOt=v(jS=>{"use strict";var L3r=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]}),F3r=jS&&jS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k3r=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)&&L3r(e,t,r);return F3r(e,t),e};Object.defineProperty(jS,"__esModule",{value:!0});jS.RerankerDataMetrics=void 0;var Um=k3r(G());jS.RerankerDataMetrics=Um.serialization.object({numTrainQueries:Um.serialization.property("num_train_queries",Um.serialization.number().optional()),numTrainRelevantPassages:Um.serialization.property("num_train_relevant_passages",Um.serialization.number().optional()),numTrainHardNegatives:Um.serialization.property("num_train_hard_negatives",Um.serialization.number().optional()),numEvalQueries:Um.serialization.property("num_eval_queries",Um.serialization.number().optional()),numEvalRelevantPassages:Um.serialization.property("num_eval_relevant_passages",Um.serialization.number().optional()),numEvalHardNegatives:Um.serialization.property("num_eval_hard_negatives",Um.serialization.number().optional())})});var MOt=v(NS=>{"use strict";var $3r=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]}),B3r=NS&&NS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q3r=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)&&$3r(e,t,r);return B3r(e,t),e};Object.defineProperty(NS,"__esModule",{value:!0});NS.ChatDataMetrics=void 0;var nB=q3r(G());NS.ChatDataMetrics=nB.serialization.object({numTrainTurns:nB.serialization.property("num_train_turns",nB.serialization.number().optional()),numEvalTurns:nB.serialization.property("num_eval_turns",nB.serialization.number().optional()),preamble:nB.serialization.string().optional()})});var OTe=v(DS=>{"use strict";var U3r=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]}),z3r=DS&&DS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H3r=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)&&U3r(e,t,r);return z3r(e,t),e};Object.defineProperty(DS,"__esModule",{value:!0});DS.LabelMetric=void 0;var oB=H3r(G());DS.LabelMetric=oB.serialization.object({totalExamples:oB.serialization.property("total_examples",oB.serialization.number().optional()),label:oB.serialization.string().optional(),samples:oB.serialization.list(oB.serialization.string()).optional()})});var ROt=v(LS=>{"use strict";var V3r=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]}),W3r=LS&&LS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K3r=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)&&V3r(e,t,r);return W3r(e,t),e};Object.defineProperty(LS,"__esModule",{value:!0});LS.ClassifyDataMetrics=void 0;var PTe=K3r(G()),G3r=OTe();LS.ClassifyDataMetrics=PTe.serialization.object({labelMetrics:PTe.serialization.property("label_metrics",PTe.serialization.list(G3r.LabelMetric).optional())})});var ETe=v(FS=>{"use strict";var J3r=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]}),Y3r=FS&&FS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z3r=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)&&J3r(e,t,r);return Y3r(e,t),e};Object.defineProperty(FS,"__esModule",{value:!0});FS.FinetuneDatasetMetrics=void 0;var zm=Z3r(G());FS.FinetuneDatasetMetrics=zm.serialization.object({trainableTokenCount:zm.serialization.property("trainable_token_count",zm.serialization.number().optional()),totalExamples:zm.serialization.property("total_examples",zm.serialization.number().optional()),trainExamples:zm.serialization.property("train_examples",zm.serialization.number().optional()),trainSizeBytes:zm.serialization.property("train_size_bytes",zm.serialization.number().optional()),evalExamples:zm.serialization.property("eval_examples",zm.serialization.number().optional()),evalSizeBytes:zm.serialization.property("eval_size_bytes",zm.serialization.number().optional())})});var ATe=v(kS=>{"use strict";var X3r=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]}),Q3r=kS&&kS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eHr=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)&&X3r(e,t,r);return Q3r(e,t),e};Object.defineProperty(kS,"__esModule",{value:!0});kS.MetricsEmbedDataFieldsItem=void 0;var TTe=eHr(G());kS.MetricsEmbedDataFieldsItem=TTe.serialization.object({name:TTe.serialization.string().optional(),count:TTe.serialization.number().optional()})});var ITe=v($S=>{"use strict";var tHr=$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]}),rHr=$S&&$S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nHr=$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)&&tHr(e,t,r);return rHr(e,t),e};Object.defineProperty($S,"__esModule",{value:!0});$S.MetricsEmbedData=void 0;var jOt=nHr(G()),oHr=ATe();$S.MetricsEmbedData=jOt.serialization.object({fields:jOt.serialization.list(oHr.MetricsEmbedDataFieldsItem).optional()})});var NOt=v(BS=>{"use strict";var iHr=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]}),aHr=BS&&BS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sHr=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)&&iHr(e,t,r);return aHr(e,t),e};Object.defineProperty(BS,"__esModule",{value:!0});BS.Metrics=void 0;var MTe=sHr(G()),uHr=ETe(),lHr=ITe();BS.Metrics=MTe.serialization.object({finetuneDatasetMetrics:MTe.serialization.property("finetune_dataset_metrics",uHr.FinetuneDatasetMetrics.optional()),embedData:MTe.serialization.property("embed_data",lHr.MetricsEmbedData.optional())})});var RTe=v(US=>{"use strict";var cHr=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]}),dHr=US&&US.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fHr=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)&&cHr(e,t,r);return dHr(e,t),e};Object.defineProperty(US,"__esModule",{value:!0});US.ConnectorOAuth=void 0;var qS=fHr(G());US.ConnectorOAuth=qS.serialization.object({clientId:qS.serialization.property("client_id",qS.serialization.string().optional()),clientSecret:qS.serialization.property("client_secret",qS.serialization.string().optional()),authorizeUrl:qS.serialization.property("authorize_url",qS.serialization.string()),tokenUrl:qS.serialization.property("token_url",qS.serialization.string()),scope:qS.serialization.string().optional()})});var jTe=v(zS=>{"use strict";var pHr=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]}),mHr=zS&&zS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hHr=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)&&pHr(e,t,r);return mHr(e,t),e};Object.defineProperty(zS,"__esModule",{value:!0});zS.ConnectorAuthStatus=void 0;var gHr=hHr(G());zS.ConnectorAuthStatus=gHr.serialization.enum_(["valid","expired"])});var iB=v(HS=>{"use strict";var yHr=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]}),bHr=HS&&HS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Hr=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)&&yHr(e,t,r);return bHr(e,t),e};Object.defineProperty(HS,"__esModule",{value:!0});HS.Connector=void 0;var Rl=_Hr(G()),vHr=RTe(),wHr=jTe();HS.Connector=Rl.serialization.object({id:Rl.serialization.string(),organizationId:Rl.serialization.property("organization_id",Rl.serialization.string().optional()),name:Rl.serialization.string(),description:Rl.serialization.string().optional(),url:Rl.serialization.string().optional(),createdAt:Rl.serialization.property("created_at",Rl.serialization.date()),updatedAt:Rl.serialization.property("updated_at",Rl.serialization.date()),excludes:Rl.serialization.list(Rl.serialization.string()).optional(),authType:Rl.serialization.property("auth_type",Rl.serialization.string().optional()),oauth:vHr.ConnectorOAuth.optional(),authStatus:Rl.serialization.property("auth_status",wHr.ConnectorAuthStatus.optional()),active:Rl.serialization.boolean().optional(),continueOnFailure:Rl.serialization.property("continue_on_failure",Rl.serialization.boolean().optional())})});var DOt=v(VS=>{"use strict";var SHr=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]}),xHr=VS&&VS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CHr=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)&&SHr(e,t,r);return xHr(e,t),e};Object.defineProperty(VS,"__esModule",{value:!0});VS.ListConnectorsResponse=void 0;var yre=CHr(G()),OHr=iB();VS.ListConnectorsResponse=yre.serialization.object({connectors:yre.serialization.list(OHr.Connector),totalCount:yre.serialization.property("total_count",yre.serialization.number().optional())})});var LOt=v(WS=>{"use strict";var PHr=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]}),EHr=WS&&WS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),THr=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)&&PHr(e,t,r);return EHr(e,t),e};Object.defineProperty(WS,"__esModule",{value:!0});WS.CreateConnectorResponse=void 0;var AHr=THr(G()),IHr=iB();WS.CreateConnectorResponse=AHr.serialization.object({connector:IHr.Connector})});var FOt=v(KS=>{"use strict";var MHr=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]}),RHr=KS&&KS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jHr=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)&&MHr(e,t,r);return RHr(e,t),e};Object.defineProperty(KS,"__esModule",{value:!0});KS.GetConnectorResponse=void 0;var NHr=jHr(G()),DHr=iB();KS.GetConnectorResponse=NHr.serialization.object({connector:DHr.Connector})});var kOt=v(GS=>{"use strict";var LHr=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]}),FHr=GS&&GS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kHr=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)&&LHr(e,t,r);return FHr(e,t),e};Object.defineProperty(GS,"__esModule",{value:!0});GS.DeleteConnectorResponse=void 0;var NTe=kHr(G());GS.DeleteConnectorResponse=NTe.serialization.record(NTe.serialization.string(),NTe.serialization.unknown())});var $Ot=v(JS=>{"use strict";var $Hr=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]}),BHr=JS&&JS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qHr=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)&&$Hr(e,t,r);return BHr(e,t),e};Object.defineProperty(JS,"__esModule",{value:!0});JS.UpdateConnectorResponse=void 0;var UHr=qHr(G()),zHr=iB();JS.UpdateConnectorResponse=UHr.serialization.object({connector:zHr.Connector})});var BOt=v(YS=>{"use strict";var HHr=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]}),VHr=YS&&YS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WHr=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)&&HHr(e,t,r);return VHr(e,t),e};Object.defineProperty(YS,"__esModule",{value:!0});YS.OAuthAuthorizeResponse=void 0;var DTe=WHr(G());YS.OAuthAuthorizeResponse=DTe.serialization.object({redirectUrl:DTe.serialization.property("redirect_url",DTe.serialization.string().optional())})});var LTe=v(ZS=>{"use strict";var KHr=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]}),GHr=ZS&&ZS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JHr=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)&&KHr(e,t,r);return GHr(e,t),e};Object.defineProperty(ZS,"__esModule",{value:!0});ZS.CompatibleEndpoint=void 0;var YHr=JHr(G());ZS.CompatibleEndpoint=YHr.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var FTe=v(QS=>{"use strict";var ZHr=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]}),XHr=QS&&QS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QHr=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)&&ZHr(e,t,r);return XHr(e,t),e};Object.defineProperty(QS,"__esModule",{value:!0});QS.GetModelResponse=void 0;var XS=QHr(G()),qOt=LTe();QS.GetModelResponse=XS.serialization.object({name:XS.serialization.string().optional(),endpoints:XS.serialization.list(qOt.CompatibleEndpoint).optional(),finetuned:XS.serialization.boolean().optional(),contextLength:XS.serialization.property("context_length",XS.serialization.number().optional()),tokenizerUrl:XS.serialization.property("tokenizer_url",XS.serialization.string().optional()),defaultEndpoints:XS.serialization.property("default_endpoints",XS.serialization.list(qOt.CompatibleEndpoint).optional())})});var UOt=v(ex=>{"use strict";var eVr=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]}),tVr=ex&&ex.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rVr=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)&&eVr(e,t,r);return tVr(e,t),e};Object.defineProperty(ex,"__esModule",{value:!0});ex.ListModelsResponse=void 0;var bre=rVr(G()),nVr=FTe();ex.ListModelsResponse=bre.serialization.object({models:bre.serialization.list(nVr.GetModelResponse),nextPageToken:bre.serialization.property("next_page_token",bre.serialization.string().optional())})});var zOt=v(me=>{"use strict";var oVr=me&&me.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xe=me&&me.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oVr(e,t,r)};Object.defineProperty(me,"__esModule",{value:!0});xe(dEe(),me);xe(fEe(),me);xe(WCt(),me);xe(pEe(),me);xe(GCt(),me);xe(YCt(),me);xe(XCt(),me);xe(eOt(),me);xe(rOt(),me);xe(mEe(),me);xe(hEe(),me);xe(oOt(),me);xe(gEe(),me);xe(yEe(),me);xe(bEe(),me);xe(_Ee(),me);xe(vEe(),me);xe(wEe(),me);xe(aOt(),me);xe(IEe(),me);xe(MEe(),me);xe(REe(),me);xe(lOt(),me);xe(NEe(),me);xe(DEe(),me);xe(LEe(),me);xe(FEe(),me);xe(dOt(),me);xe($Ee(),me);xe(BEe(),me);xe(qEe(),me);xe(fOt(),me);xe(pOt(),me);xe(hOt(),me);xe(gOt(),me);xe(Q$(),me);xe(zEe(),me);xe(FV(),me);xe(VEe(),me);xe(kV(),me);xe(ore(),me);xe(gj(),me);xe(KEe(),me);xe(are(),me);xe(Hte(),me);xe(GEe(),me);xe(ure(),me);xe(lre(),me);xe($V(),me);xe(JEe(),me);xe(dre(),me);xe(tB(),me);xe(SEe(),me);xe(xEe(),me);xe(CEe(),me);xe(qm(),me);xe(YEe(),me);xe(oS(),me);xe(XEe(),me);xe(eTe(),me);xe(tTe(),me);xe(rTe(),me);xe(nTe(),me);xe(oTe(),me);xe(iTe(),me);xe(aTe(),me);xe(sTe(),me);xe(uTe(),me);xe(xOt(),me);xe(UPe(),me);xe(Vte(),me);xe(FPe(),me);xe(kPe(),me);xe($Pe(),me);xe(BPe(),me);xe(cTe(),me);xe(dTe(),me);xe(COt(),me);xe(qV(),me);xe(fTe(),me);xe(pTe(),me);xe(mTe(),me);xe(hTe(),me);xe(gTe(),me);xe(POt(),me);xe(Wte(),me);xe(Kte(),me);xe(OEe(),me);xe(PEe(),me);xe(EEe(),me);xe(yTe(),me);xe(bTe(),me);xe(_Te(),me);xe(EOt(),me);xe(TOt(),me);xe(AEe(),me);xe(xTe(),me);xe(GPe(),me);xe(KPe(),me);xe(JPe(),me);xe(AOt(),me);xe(IOt(),me);xe(MOt(),me);xe(OTe(),me);xe(ROt(),me);xe(ETe(),me);xe(ATe(),me);xe(ITe(),me);xe(NOt(),me);xe(Jte(),me);xe(RTe(),me);xe(jTe(),me);xe(iB(),me);xe(DOt(),me);xe(Qte(),me);xe(lEe(),me);xe(ere(),me);xe(LOt(),me);xe(FOt(),me);xe(kOt(),me);xe($Ot(),me);xe(BOt(),me);xe(LTe(),me);xe(FTe(),me);xe(UOt(),me)});var HOt=v(tx=>{"use strict";var iVr=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]}),aVr=tx&&tx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sVr=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)&&iVr(e,t,r);return aVr(e,t),e};Object.defineProperty(tx,"__esModule",{value:!0});tx.ChatStreamRequest=void 0;var dn=sVr(G()),uVr=kV(),lVr=dEe(),cVr=ore(),dVr=gj(),fVr=fEe(),pVr=are(),mVr=FV(),hVr=ure(),gVr=pEe();tx.ChatStreamRequest=dn.serialization.object({message:dn.serialization.string(),model:dn.serialization.string().optional(),preamble:dn.serialization.string().optional(),chatHistory:dn.serialization.property("chat_history",dn.serialization.list(uVr.Message).optional()),conversationId:dn.serialization.property("conversation_id",dn.serialization.string().optional()),promptTruncation:dn.serialization.property("prompt_truncation",lVr.ChatStreamRequestPromptTruncation.optional()),connectors:dn.serialization.list(cVr.ChatConnector).optional(),searchQueriesOnly:dn.serialization.property("search_queries_only",dn.serialization.boolean().optional()),documents:dn.serialization.list(dVr.ChatDocument).optional(),citationQuality:dn.serialization.property("citation_quality",fVr.ChatStreamRequestCitationQuality.optional()),temperature:dn.serialization.number().optional(),maxTokens:dn.serialization.property("max_tokens",dn.serialization.number().optional()),maxInputTokens:dn.serialization.property("max_input_tokens",dn.serialization.number().optional()),k:dn.serialization.number().optional(),p:dn.serialization.number().optional(),seed:dn.serialization.number().optional(),stopSequences:dn.serialization.property("stop_sequences",dn.serialization.list(dn.serialization.string()).optional()),frequencyPenalty:dn.serialization.property("frequency_penalty",dn.serialization.number().optional()),presencePenalty:dn.serialization.property("presence_penalty",dn.serialization.number().optional()),rawPrompting:dn.serialization.property("raw_prompting",dn.serialization.boolean().optional()),returnPrompt:dn.serialization.property("return_prompt",dn.serialization.boolean().optional()),tools:dn.serialization.list(pVr.Tool).optional(),toolResults:dn.serialization.property("tool_results",dn.serialization.list(mVr.ToolResult).optional()),forceSingleStep:dn.serialization.property("force_single_step",dn.serialization.boolean().optional()),responseFormat:dn.serialization.property("response_format",hVr.ResponseFormat.optional()),safetyMode:dn.serialization.property("safety_mode",gVr.ChatStreamRequestSafetyMode.optional())})});var VOt=v(rx=>{"use strict";var yVr=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]}),bVr=rx&&rx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Vr=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)&&yVr(e,t,r);return bVr(e,t),e};Object.defineProperty(rx,"__esModule",{value:!0});rx.ChatRequest=void 0;var fn=_Vr(G()),vVr=kV(),wVr=mEe(),SVr=ore(),xVr=gj(),CVr=hEe(),OVr=are(),PVr=FV(),EVr=ure(),TVr=gEe();rx.ChatRequest=fn.serialization.object({message:fn.serialization.string(),model:fn.serialization.string().optional(),preamble:fn.serialization.string().optional(),chatHistory:fn.serialization.property("chat_history",fn.serialization.list(vVr.Message).optional()),conversationId:fn.serialization.property("conversation_id",fn.serialization.string().optional()),promptTruncation:fn.serialization.property("prompt_truncation",wVr.ChatRequestPromptTruncation.optional()),connectors:fn.serialization.list(SVr.ChatConnector).optional(),searchQueriesOnly:fn.serialization.property("search_queries_only",fn.serialization.boolean().optional()),documents:fn.serialization.list(xVr.ChatDocument).optional(),citationQuality:fn.serialization.property("citation_quality",CVr.ChatRequestCitationQuality.optional()),temperature:fn.serialization.number().optional(),maxTokens:fn.serialization.property("max_tokens",fn.serialization.number().optional()),maxInputTokens:fn.serialization.property("max_input_tokens",fn.serialization.number().optional()),k:fn.serialization.number().optional(),p:fn.serialization.number().optional(),seed:fn.serialization.number().optional(),stopSequences:fn.serialization.property("stop_sequences",fn.serialization.list(fn.serialization.string()).optional()),frequencyPenalty:fn.serialization.property("frequency_penalty",fn.serialization.number().optional()),presencePenalty:fn.serialization.property("presence_penalty",fn.serialization.number().optional()),rawPrompting:fn.serialization.property("raw_prompting",fn.serialization.boolean().optional()),returnPrompt:fn.serialization.property("return_prompt",fn.serialization.boolean().optional()),tools:fn.serialization.list(OVr.Tool).optional(),toolResults:fn.serialization.property("tool_results",fn.serialization.list(PVr.ToolResult).optional()),forceSingleStep:fn.serialization.property("force_single_step",fn.serialization.boolean().optional()),responseFormat:fn.serialization.property("response_format",EVr.ResponseFormat.optional()),safetyMode:fn.serialization.property("safety_mode",TVr.ChatRequestSafetyMode.optional())})});var WOt=v(nx=>{"use strict";var AVr=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]}),IVr=nx&&nx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MVr=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)&&AVr(e,t,r);return IVr(e,t),e};Object.defineProperty(nx,"__esModule",{value:!0});nx.GenerateStreamRequest=void 0;var ca=MVr(G()),RVr=yEe(),jVr=bEe();nx.GenerateStreamRequest=ca.serialization.object({prompt:ca.serialization.string(),model:ca.serialization.string().optional(),numGenerations:ca.serialization.property("num_generations",ca.serialization.number().optional()),maxTokens:ca.serialization.property("max_tokens",ca.serialization.number().optional()),truncate:RVr.GenerateStreamRequestTruncate.optional(),temperature:ca.serialization.number().optional(),seed:ca.serialization.number().optional(),preset:ca.serialization.string().optional(),endSequences:ca.serialization.property("end_sequences",ca.serialization.list(ca.serialization.string()).optional()),stopSequences:ca.serialization.property("stop_sequences",ca.serialization.list(ca.serialization.string()).optional()),k:ca.serialization.number().optional(),p:ca.serialization.number().optional(),frequencyPenalty:ca.serialization.property("frequency_penalty",ca.serialization.number().optional()),presencePenalty:ca.serialization.property("presence_penalty",ca.serialization.number().optional()),returnLikelihoods:ca.serialization.property("return_likelihoods",jVr.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:ca.serialization.property("raw_prompting",ca.serialization.boolean().optional())})});var KOt=v(ox=>{"use strict";var NVr=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]}),DVr=ox&&ox.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LVr=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)&&NVr(e,t,r);return DVr(e,t),e};Object.defineProperty(ox,"__esModule",{value:!0});ox.GenerateRequest=void 0;var da=LVr(G()),FVr=_Ee(),kVr=vEe();ox.GenerateRequest=da.serialization.object({prompt:da.serialization.string(),model:da.serialization.string().optional(),numGenerations:da.serialization.property("num_generations",da.serialization.number().optional()),maxTokens:da.serialization.property("max_tokens",da.serialization.number().optional()),truncate:FVr.GenerateRequestTruncate.optional(),temperature:da.serialization.number().optional(),seed:da.serialization.number().optional(),preset:da.serialization.string().optional(),endSequences:da.serialization.property("end_sequences",da.serialization.list(da.serialization.string()).optional()),stopSequences:da.serialization.property("stop_sequences",da.serialization.list(da.serialization.string()).optional()),k:da.serialization.number().optional(),p:da.serialization.number().optional(),frequencyPenalty:da.serialization.property("frequency_penalty",da.serialization.number().optional()),presencePenalty:da.serialization.property("presence_penalty",da.serialization.number().optional()),returnLikelihoods:da.serialization.property("return_likelihoods",kVr.GenerateRequestReturnLikelihoods.optional()),rawPrompting:da.serialization.property("raw_prompting",da.serialization.boolean().optional())})});var GOt=v(ix=>{"use strict";var $Vr=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]}),BVr=ix&&ix.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qVr=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)&&$Vr(e,t,r);return BVr(e,t),e};Object.defineProperty(ix,"__esModule",{value:!0});ix.EmbedRequest=void 0;var Aj=qVr(G()),UVr=Wte(),zVr=Kte(),HVr=wEe();ix.EmbedRequest=Aj.serialization.object({texts:Aj.serialization.list(Aj.serialization.string()),model:Aj.serialization.string().optional(),inputType:Aj.serialization.property("input_type",UVr.EmbedInputType.optional()),embeddingTypes:Aj.serialization.property("embedding_types",Aj.serialization.list(zVr.EmbeddingType).optional()),truncate:HVr.EmbedRequestTruncate.optional()})});var JOt=v(ax=>{"use strict";var VVr=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]}),WVr=ax&&ax.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KVr=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)&&VVr(e,t,r);return WVr(e,t),e};Object.defineProperty(ax,"__esModule",{value:!0});ax.RerankRequest=void 0;var Hm=KVr(G()),GVr=IEe();ax.RerankRequest=Hm.serialization.object({model:Hm.serialization.string().optional(),query:Hm.serialization.string(),documents:Hm.serialization.list(GVr.RerankRequestDocumentsItem),topN:Hm.serialization.property("top_n",Hm.serialization.number().optional()),rankFields:Hm.serialization.property("rank_fields",Hm.serialization.list(Hm.serialization.string()).optional()),returnDocuments:Hm.serialization.property("return_documents",Hm.serialization.boolean().optional()),maxChunksPerDoc:Hm.serialization.property("max_chunks_per_doc",Hm.serialization.number().optional())})});var YOt=v(sx=>{"use strict";var JVr=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]}),YVr=sx&&sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZVr=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)&&JVr(e,t,r);return YVr(e,t),e};Object.defineProperty(sx,"__esModule",{value:!0});sx.ClassifyRequest=void 0;var aB=ZVr(G()),XVr=xTe(),QVr=NEe();sx.ClassifyRequest=aB.serialization.object({inputs:aB.serialization.list(aB.serialization.string()),examples:aB.serialization.list(XVr.ClassifyExample).optional(),model:aB.serialization.string().optional(),preset:aB.serialization.string().optional(),truncate:QVr.ClassifyRequestTruncate.optional()})});var ZOt=v(ux=>{"use strict";var e8r=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]}),t8r=ux&&ux.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r8r=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)&&e8r(e,t,r);return t8r(e,t),e};Object.defineProperty(ux,"__esModule",{value:!0});ux.SummarizeRequest=void 0;var sB=r8r(G()),n8r=$Ee(),o8r=BEe(),i8r=qEe();ux.SummarizeRequest=sB.serialization.object({text:sB.serialization.string(),length:n8r.SummarizeRequestLength.optional(),format:o8r.SummarizeRequestFormat.optional(),model:sB.serialization.string().optional(),extractiveness:i8r.SummarizeRequestExtractiveness.optional(),temperature:sB.serialization.number().optional(),additionalCommand:sB.serialization.property("additional_command",sB.serialization.string().optional())})});var XOt=v(lx=>{"use strict";var a8r=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]}),s8r=lx&&lx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u8r=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)&&a8r(e,t,r);return s8r(e,t),e};Object.defineProperty(lx,"__esModule",{value:!0});lx.TokenizeRequest=void 0;var kTe=u8r(G());lx.TokenizeRequest=kTe.serialization.object({text:kTe.serialization.string(),model:kTe.serialization.string()})});var QOt=v(cx=>{"use strict";var l8r=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]}),c8r=cx&&cx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d8r=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)&&l8r(e,t,r);return c8r(e,t),e};Object.defineProperty(cx,"__esModule",{value:!0});cx.DetokenizeRequest=void 0;var _re=d8r(G());cx.DetokenizeRequest=_re.serialization.object({tokens:_re.serialization.list(_re.serialization.number()),model:_re.serialization.string()})});var ePt=v(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.DetokenizeRequest=ps.TokenizeRequest=ps.SummarizeRequest=ps.ClassifyRequest=ps.RerankRequest=ps.EmbedRequest=ps.GenerateRequest=ps.GenerateStreamRequest=ps.ChatRequest=ps.ChatStreamRequest=void 0;var f8r=HOt();Object.defineProperty(ps,"ChatStreamRequest",{enumerable:!0,get:function(){return f8r.ChatStreamRequest}});var p8r=VOt();Object.defineProperty(ps,"ChatRequest",{enumerable:!0,get:function(){return p8r.ChatRequest}});var m8r=WOt();Object.defineProperty(ps,"GenerateStreamRequest",{enumerable:!0,get:function(){return m8r.GenerateStreamRequest}});var h8r=KOt();Object.defineProperty(ps,"GenerateRequest",{enumerable:!0,get:function(){return h8r.GenerateRequest}});var g8r=GOt();Object.defineProperty(ps,"EmbedRequest",{enumerable:!0,get:function(){return g8r.EmbedRequest}});var y8r=JOt();Object.defineProperty(ps,"RerankRequest",{enumerable:!0,get:function(){return y8r.RerankRequest}});var b8r=YOt();Object.defineProperty(ps,"ClassifyRequest",{enumerable:!0,get:function(){return b8r.ClassifyRequest}});var _8r=ZOt();Object.defineProperty(ps,"SummarizeRequest",{enumerable:!0,get:function(){return _8r.SummarizeRequest}});var v8r=XOt();Object.defineProperty(ps,"TokenizeRequest",{enumerable:!0,get:function(){return v8r.TokenizeRequest}});var w8r=QOt();Object.defineProperty(ps,"DetokenizeRequest",{enumerable:!0,get:function(){return w8r.DetokenizeRequest}})});var tPt=v(Ij=>{"use strict";var S8r=Ij&&Ij.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x8r=Ij&&Ij.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&S8r(e,t,r)};Object.defineProperty(Ij,"__esModule",{value:!0});x8r(ePt(),Ij)});var DO=v(NO=>{"use strict";var C8r=NO&&NO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Te=NO&&NO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&C8r(e,t,r)};Object.defineProperty(NO,"__esModule",{value:!0});$Te(HCt(),NO);$Te(zOt(),NO);$Te(tPt(),NO)});var BTe=v(ni=>{"use strict";var O8r=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]}),P8r=ni&&ni.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E8r=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)&&O8r(e,t,r);return P8r(e,t),e},vre=ni&&ni.__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())})},T8r=ni&&ni.__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(ni,"__esModule",{value:!0});ni.fetchOverride=ni.parseAWSEvent=ni.getEndpointFromUrl=ni.getAuthHeaders=ni.getUrl=ni.mapResponseFromBedrock=void 0;var A8r=P_e(),I8r=(Kpt(),zl(Wpt)),M8r=Qht(),R8r=myt(),j8r=YH(),N8r=G(),D8r=tOe(),L8r=Rxt(),HV=E8r(DO()),F8r=(t,e)=>vre(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),k8r={chat:HV.StreamedChatResponse,generate:HV.GenerateStreamedResponse},$8r={chat:HV.NonStreamedChatResponse,embed:HV.EmbedResponse,generate:HV.Generation},B8r=(t,e,r)=>vre(void 0,void 0,void 0,function*(){let n=t?k8r[e]:$8r[e],o={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},i=yield n.parseOrThrow(r,o);return n.jsonOrThrow(i,o)});ni.mapResponseFromBedrock=B8r;var q8r=(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]};ni.getUrl=q8r;var U8r=(t,e,r,n,o,i)=>vre(void 0,void 0,void 0,function*(){let a=(0,I8r.fromNodeProviderChain)(),s=yield F8r(()=>{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 R8r.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:A8r.Sha256});delete r.connection,r.host=t.hostname;let l=new M8r.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});ni.getAuthHeaders=U8r;var z8r=(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}`)};ni.getEndpointFromUrl=z8r;var H8r=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}}};ni.parseAWSEvent=H8r;var V8r=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>vre(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,ni.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,ni.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,N8r.fetcher)(i);if(!p.ok)return p;try{if(c){let b=(0,D8r.readableStreamAsyncIterable)(p.body),g=new L8r.LineDecoder,y=new j8r.PassThrough;try{for(var m=T8r(b),h;h=yield m.next(),!h.done;){let S=h.value;for(let x of g.decode(S)){let O=(0,ni.parseAWSEvent)(x);if(O){let P=yield(0,ni.mapResponseFromBedrock)(c,u,O);y.push(JSON.stringify(P)+` `)}}}}catch(S){a={error:S}}finally{try{h&&!h.done&&(s=m.return)&&(yield s.call(m))}finally{if(a)throw a.error}}for(let S of g.flush()){let x=(0,ni.parseAWSEvent)(S);if(x){let O=yield(0,ni.mapResponseFromBedrock)(c,u,x);y.push(JSON.stringify(O)+` -`)}}return y.end(),{ok:!0,body:y}}else{let b=yield p.body;return{ok:!0,body:yield(0,ni.mapResponseFromBedrock)(c,u,b)}}}catch(b){throw b}});ni.fetchOverride=B8r});var DO=v(vre=>{"use strict";Object.defineProperty(vre,"__esModule",{value:!0});vre.CohereEnvironment=void 0;vre.CohereEnvironment={Production:"https://api.cohere.com"}});var PA=v((XOt,wre)=>{(function(t,e,r){typeof wre<"u"&&wre.exports?wre.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",XOt,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;o0&&(i=i.replace(/^[\/]+/,"")),o0?"?":"")+s.join("&"),a}return function(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),t(e)}})});var $Te=v($p=>{"use strict";var q8r=$p&&$p.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U8r=$p&&$p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HV=$p&&$p.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q8r(e,t,r);return U8r(e,t),e},Sre=$p&&$p.__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())})},z8r=$p&&$p.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($p,"__esModule",{value:!0});$p.V2=void 0;var QOt=HV(DO()),Fp=HV(G()),ms=HV(iO()),kp=HV(NO()),ePt=z8r(PA()),LO=HV(As()),kTe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return Sre(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Fp.fetcher)({url:(0,ePt.default)((o=yield Fp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:QOt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Fp.Supplier.get(this._options.clientName))!=null?yield Fp.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":Fp.RUNTIME.type,"X-Fern-Runtime-Version":Fp.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},kp.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 Fp.Stream({stream:i.body,parse:a=>Sre(this,void 0,void 0,function*(){return kp.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 ms.BadRequestError(i.error.body);case 401:throw new ms.UnauthorizedError(i.error.body);case 403:throw new ms.ForbiddenError(i.error.body);case 404:throw new ms.NotFoundError(i.error.body);case 422:throw new ms.UnprocessableEntityError(kp.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ms.TooManyRequestsError(kp.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ms.ClientClosedRequestError(kp.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ms.InternalServerError(i.error.body);case 501:throw new ms.NotImplementedError(kp.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ms.ServiceUnavailableError(i.error.body);case 504:throw new ms.GatewayTimeoutError(kp.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new LO.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new LO.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new LO.CohereTimeoutError;case"unknown":throw new LO.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return Sre(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Fp.fetcher)({url:(0,ePt.default)((o=yield Fp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:QOt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Fp.Supplier.get(this._options.clientName))!=null?yield Fp.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":Fp.RUNTIME.type,"X-Fern-Runtime-Version":Fp.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},kp.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 kp.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 ms.BadRequestError(i.error.body);case 401:throw new ms.UnauthorizedError(i.error.body);case 403:throw new ms.ForbiddenError(i.error.body);case 404:throw new ms.NotFoundError(i.error.body);case 422:throw new ms.UnprocessableEntityError(kp.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ms.TooManyRequestsError(kp.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ms.ClientClosedRequestError(kp.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ms.InternalServerError(i.error.body);case 501:throw new ms.NotImplementedError(kp.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ms.ServiceUnavailableError(i.error.body);case 504:throw new ms.GatewayTimeoutError(kp.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new LO.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new LO.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new LO.CohereTimeoutError;case"unknown":throw new LO.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return Sre(this,void 0,void 0,function*(){let r=(e=yield Fp.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new LO.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};$p.V2=kTe});var tPt=v(Bp=>{"use strict";var H8r=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]}),V8r=Bp&&Bp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WV=Bp&&Bp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&H8r(e,t,r);return V8r(e,t),e},VV=Bp&&Bp.__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())})},W8r=Bp&&Bp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Bp,"__esModule",{value:!0});Bp.EmbedJobs=void 0;var xre=WV(DO()),fa=WV(G()),Dr=WV(iO()),Cre=W8r(PA()),Aa=WV(NO()),Vc=WV(As()),BTe=class{constructor(e={}){this._options=e}list(e){var r,n;return VV(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:fa.fetcher)({url:(0,Cre.default)((n=yield fa.Supplier.get(this._options.environment))!==null&&n!==void 0?n:xre.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fa.Supplier.get(this._options.clientName))!=null?yield fa.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":fa.RUNTIME.type,"X-Fern-Runtime-Version":fa.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 Aa.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 Dr.BadRequestError(o.error.body);case 401:throw new Dr.UnauthorizedError(o.error.body);case 403:throw new Dr.ForbiddenError(o.error.body);case 404:throw new Dr.NotFoundError(o.error.body);case 422:throw new Dr.UnprocessableEntityError(Aa.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Dr.TooManyRequestsError(Aa.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Dr.ClientClosedRequestError(Aa.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Dr.InternalServerError(o.error.body);case 501:throw new Dr.NotImplementedError(Aa.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Dr.ServiceUnavailableError(o.error.body);case 504:throw new Dr.GatewayTimeoutError(Aa.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vc.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Vc.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Vc.CohereTimeoutError;case"unknown":throw new Vc.CohereError({message:o.error.errorMessage})}})}create(e,r){var n,o;return VV(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:fa.fetcher)({url:(0,Cre.default)((o=yield fa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xre.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fa.Supplier.get(this._options.clientName))!=null?yield fa.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":fa.RUNTIME.type,"X-Fern-Runtime-Version":fa.RUNTIME.version},contentType:"application/json",requestType:"json",body:Aa.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 Aa.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 Dr.BadRequestError(i.error.body);case 401:throw new Dr.UnauthorizedError(i.error.body);case 403:throw new Dr.ForbiddenError(i.error.body);case 404:throw new Dr.NotFoundError(i.error.body);case 422:throw new Dr.UnprocessableEntityError(Aa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Dr.TooManyRequestsError(Aa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Dr.ClientClosedRequestError(Aa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Dr.InternalServerError(i.error.body);case 501:throw new Dr.NotImplementedError(Aa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Dr.ServiceUnavailableError(i.error.body);case 504:throw new Dr.GatewayTimeoutError(Aa.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vc.CohereTimeoutError;case"unknown":throw new Vc.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return VV(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:fa.fetcher)({url:(0,Cre.default)((o=yield fa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xre.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fa.Supplier.get(this._options.clientName))!=null?yield fa.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":fa.RUNTIME.type,"X-Fern-Runtime-Version":fa.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 Aa.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 Dr.BadRequestError(i.error.body);case 401:throw new Dr.UnauthorizedError(i.error.body);case 403:throw new Dr.ForbiddenError(i.error.body);case 404:throw new Dr.NotFoundError(i.error.body);case 422:throw new Dr.UnprocessableEntityError(Aa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Dr.TooManyRequestsError(Aa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Dr.ClientClosedRequestError(Aa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Dr.InternalServerError(i.error.body);case 501:throw new Dr.NotImplementedError(Aa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Dr.ServiceUnavailableError(i.error.body);case 504:throw new Dr.GatewayTimeoutError(Aa.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vc.CohereTimeoutError;case"unknown":throw new Vc.CohereError({message:i.error.errorMessage})}})}cancel(e,r){var n,o;return VV(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:fa.fetcher)({url:(0,Cre.default)((o=yield fa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xre.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fa.Supplier.get(this._options.clientName))!=null?yield fa.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":fa.RUNTIME.type,"X-Fern-Runtime-Version":fa.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 Dr.BadRequestError(i.error.body);case 401:throw new Dr.UnauthorizedError(i.error.body);case 403:throw new Dr.ForbiddenError(i.error.body);case 404:throw new Dr.NotFoundError(i.error.body);case 422:throw new Dr.UnprocessableEntityError(Aa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Dr.TooManyRequestsError(Aa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Dr.ClientClosedRequestError(Aa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Dr.InternalServerError(i.error.body);case 501:throw new Dr.NotImplementedError(Aa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Dr.ServiceUnavailableError(i.error.body);case 504:throw new Dr.GatewayTimeoutError(Aa.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vc.CohereTimeoutError;case"unknown":throw new Vc.CohereError({message:i.error.errorMessage})}}})}_getAuthorizationHeader(){var e;return VV(this,void 0,void 0,function*(){let r=(e=yield fa.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Vc.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Bp.EmbedJobs=BTe});var rPt=v(qp=>{"use strict";var K8r=qp&&qp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),G8r=qp&&qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JV=qp&&qp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K8r(e,t,r);return G8r(e,t),e},sB=qp&&qp.__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())})},J8r=qp&&qp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qp,"__esModule",{value:!0});qp.Datasets=void 0;var KV=JV(DO()),Oo=JV(G()),rr=JV(iO()),GV=J8r(PA()),fi=JV(NO()),Ns=JV(As()),qTe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return sB(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:Oo.fetcher)({url:(0,GV.default)((o=yield Oo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:KV.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(f.error.body);case 401:throw new rr.UnauthorizedError(f.error.body);case 403:throw new rr.ForbiddenError(f.error.body);case 404:throw new rr.NotFoundError(f.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(f.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(f.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:f.error.statusCode,body:f.error.body})}switch(f.error.reason){case"non-json":throw new Ns.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:f.error.errorMessage})}})}create(e,r,n,o){var i,a;return sB(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 Oo.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:Oo.fetcher)({url:(0,GV.default)((a=yield Oo.Supplier.get(this._options.environment))!==null&&a!==void 0?a:KV.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(c.error.body);case 401:throw new rr.UnauthorizedError(c.error.body);case 403:throw new rr.ForbiddenError(c.error.body);case 404:throw new rr.NotFoundError(c.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(c.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(c.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new Ns.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:c.error.errorMessage})}})}getUsage(e){var r,n;return sB(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Oo.fetcher)({url:(0,GV.default)((n=yield Oo.Supplier.get(this._options.environment))!==null&&n!==void 0?n:KV.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(o.error.body);case 401:throw new rr.UnauthorizedError(o.error.body);case 403:throw new rr.ForbiddenError(o.error.body);case 404:throw new rr.NotFoundError(o.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(o.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(o.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Ns.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:o.error.errorMessage})}})}get(e,r){var n,o;return sB(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Oo.fetcher)({url:(0,GV.default)((o=yield Oo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:KV.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(i.error.body);case 401:throw new rr.UnauthorizedError(i.error.body);case 403:throw new rr.ForbiddenError(i.error.body);case 404:throw new rr.NotFoundError(i.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(i.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(i.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ns.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return sB(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Oo.fetcher)({url:(0,GV.default)((o=yield Oo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:KV.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(i.error.body);case 401:throw new rr.UnauthorizedError(i.error.body);case 403:throw new rr.ForbiddenError(i.error.body);case 404:throw new rr.NotFoundError(i.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(i.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(i.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ns.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return sB(this,void 0,void 0,function*(){let r=(e=yield Oo.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Ns.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};qp.Datasets=qTe});var nPt=v(Up=>{"use strict";var Y8r=Up&&Up.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z8r=Up&&Up.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YV=Up&&Up.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Y8r(e,t,r);return Z8r(e,t),e},Ij=Up&&Up.__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())})},X8r=Up&&Up.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Up,"__esModule",{value:!0});Up.Connectors=void 0;var uB=YV(DO()),An=YV(G()),Pt=YV(iO()),lB=X8r(PA()),On=YV(NO()),pa=YV(As()),UTe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return Ij(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:An.fetcher)({url:(0,lB.default)((o=yield An.Supplier.get(this._options.environment))!==null&&o!==void 0?o:uB.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.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 On.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 Pt.BadRequestError(u.error.body);case 401:throw new Pt.UnauthorizedError(u.error.body);case 403:throw new Pt.ForbiddenError(u.error.body);case 404:throw new Pt.NotFoundError(u.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(u.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(u.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new pa.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:u.error.errorMessage})}})}create(e,r){var n,o;return Ij(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:An.fetcher)({url:(0,lB.default)((o=yield An.Supplier.get(this._options.environment))!==null&&o!==void 0?o:uB.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.RUNTIME.version},contentType:"application/json",requestType:"json",body:On.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 On.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 Pt.BadRequestError(i.error.body);case 401:throw new Pt.UnauthorizedError(i.error.body);case 403:throw new Pt.ForbiddenError(i.error.body);case 404:throw new Pt.NotFoundError(i.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(i.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(i.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return Ij(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:An.fetcher)({url:(0,lB.default)((o=yield An.Supplier.get(this._options.environment))!==null&&o!==void 0?o:uB.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.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 On.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 Pt.BadRequestError(i.error.body);case 401:throw new Pt.UnauthorizedError(i.error.body);case 403:throw new Pt.ForbiddenError(i.error.body);case 404:throw new Pt.NotFoundError(i.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(i.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(i.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return Ij(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:An.fetcher)({url:(0,lB.default)((o=yield An.Supplier.get(this._options.environment))!==null&&o!==void 0?o:uB.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.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 On.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 Pt.BadRequestError(i.error.body);case 401:throw new Pt.UnauthorizedError(i.error.body);case 403:throw new Pt.ForbiddenError(i.error.body);case 404:throw new Pt.NotFoundError(i.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(i.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(i.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:i.error.errorMessage})}})}update(e,r={},n){var o,i;return Ij(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:An.fetcher)({url:(0,lB.default)((i=yield An.Supplier.get(this._options.environment))!==null&&i!==void 0?i:uB.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.RUNTIME.version},contentType:"application/json",requestType:"json",body:On.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 On.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 Pt.BadRequestError(a.error.body);case 401:throw new Pt.UnauthorizedError(a.error.body);case 403:throw new Pt.ForbiddenError(a.error.body);case 404:throw new Pt.NotFoundError(a.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(a.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(a.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new pa.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:a.error.errorMessage})}})}oAuthAuthorize(e,r={},n){var o,i;return Ij(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:An.fetcher)({url:(0,lB.default)((i=yield An.Supplier.get(this._options.environment))!==null&&i!==void 0?i:uB.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}/oauth/authorize`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.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 On.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 Pt.BadRequestError(u.error.body);case 401:throw new Pt.UnauthorizedError(u.error.body);case 403:throw new Pt.ForbiddenError(u.error.body);case 404:throw new Pt.NotFoundError(u.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(u.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(u.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new pa.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:u.error.errorMessage})}})}_getAuthorizationHeader(){var e;return Ij(this,void 0,void 0,function*(){let r=(e=yield An.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new pa.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Up.Connectors=UTe});var aPt=v(zp=>{"use strict";var Q8r=zp&&zp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e6r=zp&&zp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZV=zp&&zp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Q8r(e,t,r);return e6r(e,t),e},zTe=zp&&zp.__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())})},t6r=zp&&zp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zp,"__esModule",{value:!0});zp.Models=void 0;var oPt=ZV(DO()),Vm=ZV(G()),hs=ZV(iO()),iPt=t6r(PA()),cg=ZV(NO()),FO=ZV(As()),HTe=class{constructor(e={}){this._options=e}get(e,r){var n,o;return zTe(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Vm.fetcher)({url:(0,iPt.default)((o=yield Vm.Supplier.get(this._options.environment))!==null&&o!==void 0?o:oPt.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vm.Supplier.get(this._options.clientName))!=null?yield Vm.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":Vm.RUNTIME.type,"X-Fern-Runtime-Version":Vm.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 cg.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 hs.BadRequestError(i.error.body);case 401:throw new hs.UnauthorizedError(i.error.body);case 403:throw new hs.ForbiddenError(i.error.body);case 404:throw new hs.NotFoundError(i.error.body);case 422:throw new hs.UnprocessableEntityError(cg.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new hs.TooManyRequestsError(cg.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new hs.ClientClosedRequestError(cg.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new hs.InternalServerError(i.error.body);case 501:throw new hs.NotImplementedError(cg.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new hs.ServiceUnavailableError(i.error.body);case 504:throw new hs.GatewayTimeoutError(cg.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new FO.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new FO.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new FO.CohereTimeoutError;case"unknown":throw new FO.CohereError({message:i.error.errorMessage})}})}list(e={},r){var n,o;return zTe(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:Vm.fetcher)({url:(0,iPt.default)((o=yield Vm.Supplier.get(this._options.environment))!==null&&o!==void 0?o:oPt.CohereEnvironment.Production,"v1/models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vm.Supplier.get(this._options.clientName))!=null?yield Vm.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":Vm.RUNTIME.type,"X-Fern-Runtime-Version":Vm.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 cg.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 hs.BadRequestError(c.error.body);case 401:throw new hs.UnauthorizedError(c.error.body);case 403:throw new hs.ForbiddenError(c.error.body);case 404:throw new hs.NotFoundError(c.error.body);case 422:throw new hs.UnprocessableEntityError(cg.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new hs.TooManyRequestsError(cg.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new hs.ClientClosedRequestError(cg.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new hs.InternalServerError(c.error.body);case 501:throw new hs.NotImplementedError(cg.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new hs.ServiceUnavailableError(c.error.body);case 504:throw new hs.GatewayTimeoutError(cg.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new FO.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new FO.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new FO.CohereTimeoutError;case"unknown":throw new FO.CohereError({message:c.error.errorMessage})}})}_getAuthorizationHeader(){var e;return zTe(this,void 0,void 0,function*(){let r=(e=yield Vm.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new FO.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};zp.Models=HTe});var sPt=v(Hp=>{"use strict";var r6r=Hp&&Hp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n6r=Hp&&Hp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XV=Hp&&Hp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&r6r(e,t,r);return n6r(e,t),e},EA=Hp&&Hp.__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())})},o6r=Hp&&Hp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Hp,"__esModule",{value:!0});Hp.Finetuning=void 0;var Mj=XV(DO()),qr=XV(G()),Gr=XV(iO()),Rj=o6r(PA()),kO=XV(NO()),vi=XV(As()),VTe=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){var n,o;return EA(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:qr.fetcher)({url:(0,Rj.default)((o=yield qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Mj.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 kO.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 Gr.BadRequestError(l.error.body);case 401:throw new Gr.UnauthorizedError(l.error.body);case 403:throw new Gr.ForbiddenError(l.error.body);case 404:throw new Gr.NotFoundError(l.error.body);case 500:throw new Gr.InternalServerError(l.error.body);case 503:throw new Gr.ServiceUnavailableError(l.error.body);default:throw new vi.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new vi.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:l.error.errorMessage})}})}createFinetunedModel(e,r){var n,o;return EA(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qr.fetcher)({url:(0,Rj.default)((o=yield qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Mj.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.RUNTIME.version},contentType:"application/json",requestType:"json",body:kO.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 kO.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 Gr.BadRequestError(i.error.body);case 401:throw new Gr.UnauthorizedError(i.error.body);case 403:throw new Gr.ForbiddenError(i.error.body);case 404:throw new Gr.NotFoundError(i.error.body);case 500:throw new Gr.InternalServerError(i.error.body);case 503:throw new Gr.ServiceUnavailableError(i.error.body);default:throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:i.error.errorMessage})}})}getFinetunedModel(e,r){var n,o;return EA(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qr.fetcher)({url:(0,Rj.default)((o=yield qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Mj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 kO.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 Gr.BadRequestError(i.error.body);case 401:throw new Gr.UnauthorizedError(i.error.body);case 403:throw new Gr.ForbiddenError(i.error.body);case 404:throw new Gr.NotFoundError(i.error.body);case 500:throw new Gr.InternalServerError(i.error.body);case 503:throw new Gr.ServiceUnavailableError(i.error.body);default:throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:i.error.errorMessage})}})}deleteFinetunedModel(e,r){var n,o;return EA(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qr.fetcher)({url:(0,Rj.default)((o=yield qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Mj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 kO.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 Gr.BadRequestError(i.error.body);case 401:throw new Gr.UnauthorizedError(i.error.body);case 403:throw new Gr.ForbiddenError(i.error.body);case 404:throw new Gr.NotFoundError(i.error.body);case 500:throw new Gr.InternalServerError(i.error.body);case 503:throw new Gr.ServiceUnavailableError(i.error.body);default:throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:i.error.errorMessage})}})}updateFinetunedModel(e,r,n){var o,i;return EA(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:qr.fetcher)({url:(0,Rj.default)((i=yield qr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Mj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.RUNTIME.version},contentType:"application/json",requestType:"json",body:kO.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 kO.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 Gr.BadRequestError(a.error.body);case 401:throw new Gr.UnauthorizedError(a.error.body);case 403:throw new Gr.ForbiddenError(a.error.body);case 404:throw new Gr.NotFoundError(a.error.body);case 500:throw new Gr.InternalServerError(a.error.body);case 503:throw new Gr.ServiceUnavailableError(a.error.body);default:throw new vi.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new vi.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:a.error.errorMessage})}})}listEvents(e,r={},n){var o,i;return EA(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:qr.fetcher)({url:(0,Rj.default)((i=yield qr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Mj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/events`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 kO.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 Gr.BadRequestError(c.error.body);case 401:throw new Gr.UnauthorizedError(c.error.body);case 403:throw new Gr.ForbiddenError(c.error.body);case 404:throw new Gr.NotFoundError(c.error.body);case 500:throw new Gr.InternalServerError(c.error.body);case 503:throw new Gr.ServiceUnavailableError(c.error.body);default:throw new vi.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new vi.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:c.error.errorMessage})}})}listTrainingStepMetrics(e,r={},n){var o,i;return EA(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:qr.fetcher)({url:(0,Rj.default)((i=yield qr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Mj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/training-step-metrics`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 kO.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 Gr.BadRequestError(l.error.body);case 401:throw new Gr.UnauthorizedError(l.error.body);case 403:throw new Gr.ForbiddenError(l.error.body);case 404:throw new Gr.NotFoundError(l.error.body);case 500:throw new Gr.InternalServerError(l.error.body);case 503:throw new Gr.ServiceUnavailableError(l.error.body);default:throw new vi.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new vi.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:l.error.errorMessage})}})}_getAuthorizationHeader(){var e;return EA(this,void 0,void 0,function*(){let r=(e=yield qr.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new vi.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Hp.Finetuning=VTe});var Ore=v(Wp=>{"use strict";var i6r=Wp&&Wp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),a6r=Wp&&Wp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QV=Wp&&Wp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&i6r(e,t,r);return a6r(e,t),e},Vp=Wp&&Wp.__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())})},s6r=Wp&&Wp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Wp,"__esModule",{value:!0});Wp.CohereClient=void 0;var zy=QV(DO()),_t=QV(G()),Ee=QV(iO()),st=QV(NO()),Hy=s6r(PA()),jr=QV(As()),u6r=$Te(),l6r=tPt(),c6r=rPt(),d6r=nPt(),f6r=aPt(),p6r=sPt(),WTe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},st.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 _t.Stream({stream:i.body,parse:a=>Vp(this,void 0,void 0,function*(){return st.StreamedChatResponse.parseOrThrow(a,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"json",messageTerminator:` +`)}}return y.end(),{ok:!0,body:y}}else{let b=yield p.body;return{ok:!0,body:yield(0,ni.mapResponseFromBedrock)(c,u,b)}}}catch(b){throw b}});ni.fetchOverride=V8r});var LO=v(wre=>{"use strict";Object.defineProperty(wre,"__esModule",{value:!0});wre.CohereEnvironment=void 0;wre.CohereEnvironment={Production:"https://api.cohere.com"}});var PA=v((rPt,Sre)=>{(function(t,e,r){typeof Sre<"u"&&Sre.exports?Sre.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",rPt,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;o0&&(i=i.replace(/^[\/]+/,"")),o0?"?":"")+s.join("&"),a}return function(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),t(e)}})});var UTe=v($p=>{"use strict";var W8r=$p&&$p.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K8r=$p&&$p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VV=$p&&$p.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&W8r(e,t,r);return K8r(e,t),e},xre=$p&&$p.__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())})},G8r=$p&&$p.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($p,"__esModule",{value:!0});$p.V2=void 0;var nPt=VV(LO()),Fp=VV(G()),ms=VV(aO()),kp=VV(DO()),oPt=G8r(PA()),FO=VV(As()),qTe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return xre(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Fp.fetcher)({url:(0,oPt.default)((o=yield Fp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:nPt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Fp.Supplier.get(this._options.clientName))!=null?yield Fp.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":Fp.RUNTIME.type,"X-Fern-Runtime-Version":Fp.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},kp.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 Fp.Stream({stream:i.body,parse:a=>xre(this,void 0,void 0,function*(){return kp.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 ms.BadRequestError(i.error.body);case 401:throw new ms.UnauthorizedError(i.error.body);case 403:throw new ms.ForbiddenError(i.error.body);case 404:throw new ms.NotFoundError(i.error.body);case 422:throw new ms.UnprocessableEntityError(kp.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ms.TooManyRequestsError(kp.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ms.ClientClosedRequestError(kp.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ms.InternalServerError(i.error.body);case 501:throw new ms.NotImplementedError(kp.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ms.ServiceUnavailableError(i.error.body);case 504:throw new ms.GatewayTimeoutError(kp.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new FO.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new FO.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new FO.CohereTimeoutError;case"unknown":throw new FO.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return xre(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Fp.fetcher)({url:(0,oPt.default)((o=yield Fp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:nPt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Fp.Supplier.get(this._options.clientName))!=null?yield Fp.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":Fp.RUNTIME.type,"X-Fern-Runtime-Version":Fp.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},kp.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 kp.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 ms.BadRequestError(i.error.body);case 401:throw new ms.UnauthorizedError(i.error.body);case 403:throw new ms.ForbiddenError(i.error.body);case 404:throw new ms.NotFoundError(i.error.body);case 422:throw new ms.UnprocessableEntityError(kp.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ms.TooManyRequestsError(kp.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ms.ClientClosedRequestError(kp.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ms.InternalServerError(i.error.body);case 501:throw new ms.NotImplementedError(kp.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ms.ServiceUnavailableError(i.error.body);case 504:throw new ms.GatewayTimeoutError(kp.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new FO.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new FO.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new FO.CohereTimeoutError;case"unknown":throw new FO.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return xre(this,void 0,void 0,function*(){let r=(e=yield Fp.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new FO.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};$p.V2=qTe});var iPt=v(Bp=>{"use strict";var J8r=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]}),Y8r=Bp&&Bp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KV=Bp&&Bp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&J8r(e,t,r);return Y8r(e,t),e},WV=Bp&&Bp.__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())})},Z8r=Bp&&Bp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Bp,"__esModule",{value:!0});Bp.EmbedJobs=void 0;var Cre=KV(LO()),fa=KV(G()),Dr=KV(aO()),Ore=Z8r(PA()),Aa=KV(DO()),Vc=KV(As()),zTe=class{constructor(e={}){this._options=e}list(e){var r,n;return WV(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:fa.fetcher)({url:(0,Ore.default)((n=yield fa.Supplier.get(this._options.environment))!==null&&n!==void 0?n:Cre.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fa.Supplier.get(this._options.clientName))!=null?yield fa.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":fa.RUNTIME.type,"X-Fern-Runtime-Version":fa.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 Aa.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 Dr.BadRequestError(o.error.body);case 401:throw new Dr.UnauthorizedError(o.error.body);case 403:throw new Dr.ForbiddenError(o.error.body);case 404:throw new Dr.NotFoundError(o.error.body);case 422:throw new Dr.UnprocessableEntityError(Aa.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Dr.TooManyRequestsError(Aa.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Dr.ClientClosedRequestError(Aa.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Dr.InternalServerError(o.error.body);case 501:throw new Dr.NotImplementedError(Aa.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Dr.ServiceUnavailableError(o.error.body);case 504:throw new Dr.GatewayTimeoutError(Aa.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vc.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Vc.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Vc.CohereTimeoutError;case"unknown":throw new Vc.CohereError({message:o.error.errorMessage})}})}create(e,r){var n,o;return WV(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:fa.fetcher)({url:(0,Ore.default)((o=yield fa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Cre.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fa.Supplier.get(this._options.clientName))!=null?yield fa.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":fa.RUNTIME.type,"X-Fern-Runtime-Version":fa.RUNTIME.version},contentType:"application/json",requestType:"json",body:Aa.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 Aa.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 Dr.BadRequestError(i.error.body);case 401:throw new Dr.UnauthorizedError(i.error.body);case 403:throw new Dr.ForbiddenError(i.error.body);case 404:throw new Dr.NotFoundError(i.error.body);case 422:throw new Dr.UnprocessableEntityError(Aa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Dr.TooManyRequestsError(Aa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Dr.ClientClosedRequestError(Aa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Dr.InternalServerError(i.error.body);case 501:throw new Dr.NotImplementedError(Aa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Dr.ServiceUnavailableError(i.error.body);case 504:throw new Dr.GatewayTimeoutError(Aa.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vc.CohereTimeoutError;case"unknown":throw new Vc.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return WV(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:fa.fetcher)({url:(0,Ore.default)((o=yield fa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Cre.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fa.Supplier.get(this._options.clientName))!=null?yield fa.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":fa.RUNTIME.type,"X-Fern-Runtime-Version":fa.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 Aa.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 Dr.BadRequestError(i.error.body);case 401:throw new Dr.UnauthorizedError(i.error.body);case 403:throw new Dr.ForbiddenError(i.error.body);case 404:throw new Dr.NotFoundError(i.error.body);case 422:throw new Dr.UnprocessableEntityError(Aa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Dr.TooManyRequestsError(Aa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Dr.ClientClosedRequestError(Aa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Dr.InternalServerError(i.error.body);case 501:throw new Dr.NotImplementedError(Aa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Dr.ServiceUnavailableError(i.error.body);case 504:throw new Dr.GatewayTimeoutError(Aa.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vc.CohereTimeoutError;case"unknown":throw new Vc.CohereError({message:i.error.errorMessage})}})}cancel(e,r){var n,o;return WV(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:fa.fetcher)({url:(0,Ore.default)((o=yield fa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Cre.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fa.Supplier.get(this._options.clientName))!=null?yield fa.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":fa.RUNTIME.type,"X-Fern-Runtime-Version":fa.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 Dr.BadRequestError(i.error.body);case 401:throw new Dr.UnauthorizedError(i.error.body);case 403:throw new Dr.ForbiddenError(i.error.body);case 404:throw new Dr.NotFoundError(i.error.body);case 422:throw new Dr.UnprocessableEntityError(Aa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Dr.TooManyRequestsError(Aa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Dr.ClientClosedRequestError(Aa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Dr.InternalServerError(i.error.body);case 501:throw new Dr.NotImplementedError(Aa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Dr.ServiceUnavailableError(i.error.body);case 504:throw new Dr.GatewayTimeoutError(Aa.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vc.CohereTimeoutError;case"unknown":throw new Vc.CohereError({message:i.error.errorMessage})}}})}_getAuthorizationHeader(){var e;return WV(this,void 0,void 0,function*(){let r=(e=yield fa.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Vc.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Bp.EmbedJobs=zTe});var aPt=v(qp=>{"use strict";var X8r=qp&&qp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q8r=qp&&qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YV=qp&&qp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&X8r(e,t,r);return Q8r(e,t),e},uB=qp&&qp.__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())})},e6r=qp&&qp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qp,"__esModule",{value:!0});qp.Datasets=void 0;var GV=YV(LO()),Oo=YV(G()),rr=YV(aO()),JV=e6r(PA()),fi=YV(DO()),Ns=YV(As()),HTe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return uB(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:Oo.fetcher)({url:(0,JV.default)((o=yield Oo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:GV.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(f.error.body);case 401:throw new rr.UnauthorizedError(f.error.body);case 403:throw new rr.ForbiddenError(f.error.body);case 404:throw new rr.NotFoundError(f.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(f.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(f.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:f.error.statusCode,body:f.error.body})}switch(f.error.reason){case"non-json":throw new Ns.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:f.error.errorMessage})}})}create(e,r,n,o){var i,a;return uB(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 Oo.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:Oo.fetcher)({url:(0,JV.default)((a=yield Oo.Supplier.get(this._options.environment))!==null&&a!==void 0?a:GV.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(c.error.body);case 401:throw new rr.UnauthorizedError(c.error.body);case 403:throw new rr.ForbiddenError(c.error.body);case 404:throw new rr.NotFoundError(c.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(c.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(c.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new Ns.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:c.error.errorMessage})}})}getUsage(e){var r,n;return uB(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Oo.fetcher)({url:(0,JV.default)((n=yield Oo.Supplier.get(this._options.environment))!==null&&n!==void 0?n:GV.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(o.error.body);case 401:throw new rr.UnauthorizedError(o.error.body);case 403:throw new rr.ForbiddenError(o.error.body);case 404:throw new rr.NotFoundError(o.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(o.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(o.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Ns.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:o.error.errorMessage})}})}get(e,r){var n,o;return uB(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Oo.fetcher)({url:(0,JV.default)((o=yield Oo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:GV.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(i.error.body);case 401:throw new rr.UnauthorizedError(i.error.body);case 403:throw new rr.ForbiddenError(i.error.body);case 404:throw new rr.NotFoundError(i.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(i.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(i.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ns.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return uB(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Oo.fetcher)({url:(0,JV.default)((o=yield Oo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:GV.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(i.error.body);case 401:throw new rr.UnauthorizedError(i.error.body);case 403:throw new rr.ForbiddenError(i.error.body);case 404:throw new rr.NotFoundError(i.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(i.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(i.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ns.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return uB(this,void 0,void 0,function*(){let r=(e=yield Oo.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Ns.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};qp.Datasets=HTe});var sPt=v(Up=>{"use strict";var t6r=Up&&Up.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r6r=Up&&Up.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZV=Up&&Up.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&t6r(e,t,r);return r6r(e,t),e},Mj=Up&&Up.__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())})},n6r=Up&&Up.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Up,"__esModule",{value:!0});Up.Connectors=void 0;var lB=ZV(LO()),An=ZV(G()),Pt=ZV(aO()),cB=n6r(PA()),On=ZV(DO()),pa=ZV(As()),VTe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return Mj(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:An.fetcher)({url:(0,cB.default)((o=yield An.Supplier.get(this._options.environment))!==null&&o!==void 0?o:lB.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.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 On.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 Pt.BadRequestError(u.error.body);case 401:throw new Pt.UnauthorizedError(u.error.body);case 403:throw new Pt.ForbiddenError(u.error.body);case 404:throw new Pt.NotFoundError(u.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(u.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(u.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new pa.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:u.error.errorMessage})}})}create(e,r){var n,o;return Mj(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:An.fetcher)({url:(0,cB.default)((o=yield An.Supplier.get(this._options.environment))!==null&&o!==void 0?o:lB.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.RUNTIME.version},contentType:"application/json",requestType:"json",body:On.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 On.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 Pt.BadRequestError(i.error.body);case 401:throw new Pt.UnauthorizedError(i.error.body);case 403:throw new Pt.ForbiddenError(i.error.body);case 404:throw new Pt.NotFoundError(i.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(i.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(i.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return Mj(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:An.fetcher)({url:(0,cB.default)((o=yield An.Supplier.get(this._options.environment))!==null&&o!==void 0?o:lB.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.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 On.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 Pt.BadRequestError(i.error.body);case 401:throw new Pt.UnauthorizedError(i.error.body);case 403:throw new Pt.ForbiddenError(i.error.body);case 404:throw new Pt.NotFoundError(i.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(i.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(i.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return Mj(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:An.fetcher)({url:(0,cB.default)((o=yield An.Supplier.get(this._options.environment))!==null&&o!==void 0?o:lB.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.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 On.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 Pt.BadRequestError(i.error.body);case 401:throw new Pt.UnauthorizedError(i.error.body);case 403:throw new Pt.ForbiddenError(i.error.body);case 404:throw new Pt.NotFoundError(i.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(i.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(i.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:i.error.errorMessage})}})}update(e,r={},n){var o,i;return Mj(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:An.fetcher)({url:(0,cB.default)((i=yield An.Supplier.get(this._options.environment))!==null&&i!==void 0?i:lB.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.RUNTIME.version},contentType:"application/json",requestType:"json",body:On.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 On.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 Pt.BadRequestError(a.error.body);case 401:throw new Pt.UnauthorizedError(a.error.body);case 403:throw new Pt.ForbiddenError(a.error.body);case 404:throw new Pt.NotFoundError(a.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(a.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(a.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new pa.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:a.error.errorMessage})}})}oAuthAuthorize(e,r={},n){var o,i;return Mj(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:An.fetcher)({url:(0,cB.default)((i=yield An.Supplier.get(this._options.environment))!==null&&i!==void 0?i:lB.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}/oauth/authorize`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.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 On.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 Pt.BadRequestError(u.error.body);case 401:throw new Pt.UnauthorizedError(u.error.body);case 403:throw new Pt.ForbiddenError(u.error.body);case 404:throw new Pt.NotFoundError(u.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(u.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(u.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new pa.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:u.error.errorMessage})}})}_getAuthorizationHeader(){var e;return Mj(this,void 0,void 0,function*(){let r=(e=yield An.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new pa.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Up.Connectors=VTe});var cPt=v(zp=>{"use strict";var o6r=zp&&zp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i6r=zp&&zp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XV=zp&&zp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o6r(e,t,r);return i6r(e,t),e},WTe=zp&&zp.__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())})},a6r=zp&&zp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zp,"__esModule",{value:!0});zp.Models=void 0;var uPt=XV(LO()),Vm=XV(G()),hs=XV(aO()),lPt=a6r(PA()),cg=XV(DO()),kO=XV(As()),KTe=class{constructor(e={}){this._options=e}get(e,r){var n,o;return WTe(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Vm.fetcher)({url:(0,lPt.default)((o=yield Vm.Supplier.get(this._options.environment))!==null&&o!==void 0?o:uPt.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vm.Supplier.get(this._options.clientName))!=null?yield Vm.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":Vm.RUNTIME.type,"X-Fern-Runtime-Version":Vm.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 cg.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 hs.BadRequestError(i.error.body);case 401:throw new hs.UnauthorizedError(i.error.body);case 403:throw new hs.ForbiddenError(i.error.body);case 404:throw new hs.NotFoundError(i.error.body);case 422:throw new hs.UnprocessableEntityError(cg.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new hs.TooManyRequestsError(cg.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new hs.ClientClosedRequestError(cg.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new hs.InternalServerError(i.error.body);case 501:throw new hs.NotImplementedError(cg.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new hs.ServiceUnavailableError(i.error.body);case 504:throw new hs.GatewayTimeoutError(cg.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new kO.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new kO.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new kO.CohereTimeoutError;case"unknown":throw new kO.CohereError({message:i.error.errorMessage})}})}list(e={},r){var n,o;return WTe(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:Vm.fetcher)({url:(0,lPt.default)((o=yield Vm.Supplier.get(this._options.environment))!==null&&o!==void 0?o:uPt.CohereEnvironment.Production,"v1/models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vm.Supplier.get(this._options.clientName))!=null?yield Vm.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":Vm.RUNTIME.type,"X-Fern-Runtime-Version":Vm.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 cg.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 hs.BadRequestError(c.error.body);case 401:throw new hs.UnauthorizedError(c.error.body);case 403:throw new hs.ForbiddenError(c.error.body);case 404:throw new hs.NotFoundError(c.error.body);case 422:throw new hs.UnprocessableEntityError(cg.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new hs.TooManyRequestsError(cg.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new hs.ClientClosedRequestError(cg.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new hs.InternalServerError(c.error.body);case 501:throw new hs.NotImplementedError(cg.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new hs.ServiceUnavailableError(c.error.body);case 504:throw new hs.GatewayTimeoutError(cg.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new kO.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new kO.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new kO.CohereTimeoutError;case"unknown":throw new kO.CohereError({message:c.error.errorMessage})}})}_getAuthorizationHeader(){var e;return WTe(this,void 0,void 0,function*(){let r=(e=yield Vm.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new kO.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};zp.Models=KTe});var dPt=v(Hp=>{"use strict";var s6r=Hp&&Hp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u6r=Hp&&Hp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QV=Hp&&Hp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s6r(e,t,r);return u6r(e,t),e},EA=Hp&&Hp.__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())})},l6r=Hp&&Hp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Hp,"__esModule",{value:!0});Hp.Finetuning=void 0;var Rj=QV(LO()),qr=QV(G()),Gr=QV(aO()),jj=l6r(PA()),$O=QV(DO()),vi=QV(As()),GTe=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){var n,o;return EA(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:qr.fetcher)({url:(0,jj.default)((o=yield qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rj.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 $O.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 Gr.BadRequestError(l.error.body);case 401:throw new Gr.UnauthorizedError(l.error.body);case 403:throw new Gr.ForbiddenError(l.error.body);case 404:throw new Gr.NotFoundError(l.error.body);case 500:throw new Gr.InternalServerError(l.error.body);case 503:throw new Gr.ServiceUnavailableError(l.error.body);default:throw new vi.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new vi.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:l.error.errorMessage})}})}createFinetunedModel(e,r){var n,o;return EA(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qr.fetcher)({url:(0,jj.default)((o=yield qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rj.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.RUNTIME.version},contentType:"application/json",requestType:"json",body:$O.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 $O.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 Gr.BadRequestError(i.error.body);case 401:throw new Gr.UnauthorizedError(i.error.body);case 403:throw new Gr.ForbiddenError(i.error.body);case 404:throw new Gr.NotFoundError(i.error.body);case 500:throw new Gr.InternalServerError(i.error.body);case 503:throw new Gr.ServiceUnavailableError(i.error.body);default:throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:i.error.errorMessage})}})}getFinetunedModel(e,r){var n,o;return EA(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qr.fetcher)({url:(0,jj.default)((o=yield qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return $O.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 Gr.BadRequestError(i.error.body);case 401:throw new Gr.UnauthorizedError(i.error.body);case 403:throw new Gr.ForbiddenError(i.error.body);case 404:throw new Gr.NotFoundError(i.error.body);case 500:throw new Gr.InternalServerError(i.error.body);case 503:throw new Gr.ServiceUnavailableError(i.error.body);default:throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:i.error.errorMessage})}})}deleteFinetunedModel(e,r){var n,o;return EA(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qr.fetcher)({url:(0,jj.default)((o=yield qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return $O.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 Gr.BadRequestError(i.error.body);case 401:throw new Gr.UnauthorizedError(i.error.body);case 403:throw new Gr.ForbiddenError(i.error.body);case 404:throw new Gr.NotFoundError(i.error.body);case 500:throw new Gr.InternalServerError(i.error.body);case 503:throw new Gr.ServiceUnavailableError(i.error.body);default:throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:i.error.errorMessage})}})}updateFinetunedModel(e,r,n){var o,i;return EA(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:qr.fetcher)({url:(0,jj.default)((i=yield qr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Rj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.RUNTIME.version},contentType:"application/json",requestType:"json",body:$O.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 $O.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 Gr.BadRequestError(a.error.body);case 401:throw new Gr.UnauthorizedError(a.error.body);case 403:throw new Gr.ForbiddenError(a.error.body);case 404:throw new Gr.NotFoundError(a.error.body);case 500:throw new Gr.InternalServerError(a.error.body);case 503:throw new Gr.ServiceUnavailableError(a.error.body);default:throw new vi.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new vi.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:a.error.errorMessage})}})}listEvents(e,r={},n){var o,i;return EA(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:qr.fetcher)({url:(0,jj.default)((i=yield qr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Rj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/events`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 $O.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 Gr.BadRequestError(c.error.body);case 401:throw new Gr.UnauthorizedError(c.error.body);case 403:throw new Gr.ForbiddenError(c.error.body);case 404:throw new Gr.NotFoundError(c.error.body);case 500:throw new Gr.InternalServerError(c.error.body);case 503:throw new Gr.ServiceUnavailableError(c.error.body);default:throw new vi.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new vi.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:c.error.errorMessage})}})}listTrainingStepMetrics(e,r={},n){var o,i;return EA(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:qr.fetcher)({url:(0,jj.default)((i=yield qr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Rj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/training-step-metrics`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 $O.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 Gr.BadRequestError(l.error.body);case 401:throw new Gr.UnauthorizedError(l.error.body);case 403:throw new Gr.ForbiddenError(l.error.body);case 404:throw new Gr.NotFoundError(l.error.body);case 500:throw new Gr.InternalServerError(l.error.body);case 503:throw new Gr.ServiceUnavailableError(l.error.body);default:throw new vi.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new vi.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:l.error.errorMessage})}})}_getAuthorizationHeader(){var e;return EA(this,void 0,void 0,function*(){let r=(e=yield qr.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new vi.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Hp.Finetuning=GTe});var Pre=v(Wp=>{"use strict";var c6r=Wp&&Wp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d6r=Wp&&Wp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e8=Wp&&Wp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&c6r(e,t,r);return d6r(e,t),e},Vp=Wp&&Wp.__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())})},f6r=Wp&&Wp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Wp,"__esModule",{value:!0});Wp.CohereClient=void 0;var zy=e8(LO()),_t=e8(G()),Ee=e8(aO()),st=e8(DO()),Hy=f6r(PA()),jr=e8(As()),p6r=UTe(),m6r=iPt(),h6r=aPt(),g6r=sPt(),y6r=cPt(),b6r=dPt(),JTe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},st.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 _t.Stream({stream:i.body,parse:a=>Vp(this,void 0,void 0,function*(){return st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}generateStream(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},st.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 _t.Stream({stream:i.body,parse:a=>Vp(this,void 0,void 0,function*(){return st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}generate(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}embed(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}rerank(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}classify(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}summarize(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}tokenize(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}detokenize(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}checkApiKey(e){var r,n;return Vp(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:_t.fetcher)({url:(0,Hy.default)((n=yield _t.Supplier.get(this._options.environment))!==null&&n!==void 0?n:zy.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.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 st.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 Ee.BadRequestError(o.error.body);case 401:throw new Ee.UnauthorizedError(o.error.body);case 403:throw new Ee.ForbiddenError(o.error.body);case 404:throw new Ee.NotFoundError(o.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(o.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(o.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new jr.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:o.error.errorMessage})}})}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new u6r.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new l6r.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new c6r.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new d6r.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new f6r.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new p6r.Finetuning(this._options)}_getAuthorizationHeader(){var e;return Vp(this,void 0,void 0,function*(){let r=(e=yield _t.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new jr.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Wp.CohereClient=WTe});var GTe=v(Pre=>{"use strict";Object.defineProperty(Pre,"__esModule",{value:!0});Pre.AwsClient=void 0;var m6r=Ore(),KTe=class extends m6r.CohereClient{constructor(e){e.token="n/a",super(e)}};Pre.AwsClient=KTe});var uPt=v(Ere=>{"use strict";Object.defineProperty(Ere,"__esModule",{value:!0});Ere.BedrockClient=void 0;var h6r=FTe(),g6r=GTe(),JTe=class extends g6r.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,h6r.fetchOverride)("bedrock",e)}))}};Ere.BedrockClient=JTe});var lPt=v(Tre=>{"use strict";Object.defineProperty(Tre,"__esModule",{value:!0});Tre.CohereClientV2=void 0;var y6r=$Te(),b6r=Ore(),YTe=class{constructor(e){this._options=e,this.client=new b6r.CohereClient(this._options),this.clientV2=new y6r.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}};Tre.CohereClientV2=YTe});var cPt=v(Are=>{"use strict";Object.defineProperty(Are,"__esModule",{value:!0});Are.CustomClient=void 0;var _6r=Ore(),ZTe=class extends _6r.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}};Are.CustomClient=ZTe});var dPt=v(Ire=>{"use strict";Object.defineProperty(Ire,"__esModule",{value:!0});Ire.SagemakerClient=void 0;var v6r=GTe(),w6r=FTe(),XTe=class extends v6r.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,w6r.fetchOverride)("sagemaker",e)}))}};Ire.SagemakerClient=XTe});var e8=v(Ia=>{"use strict";var S6r=Ia&&Ia.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x6r=Ia&&Ia.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C6r=Ia&&Ia.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&S6r(e,t,r);return x6r(e,t),e};Object.defineProperty(Ia,"__esModule",{value:!0});Ia.SagemakerClient=Ia.CohereTimeoutError=Ia.CohereError=Ia.CohereEnvironment=Ia.CohereClient=Ia.CohereClientV2=Ia.BedrockClient=Ia.Cohere=void 0;Ia.Cohere=C6r(iO());var O6r=uPt();Object.defineProperty(Ia,"BedrockClient",{enumerable:!0,get:function(){return O6r.BedrockClient}});var P6r=lPt();Object.defineProperty(Ia,"CohereClientV2",{enumerable:!0,get:function(){return P6r.CohereClientV2}});var E6r=cPt();Object.defineProperty(Ia,"CohereClient",{enumerable:!0,get:function(){return E6r.CustomClient}});var T6r=DO();Object.defineProperty(Ia,"CohereEnvironment",{enumerable:!0,get:function(){return T6r.CohereEnvironment}});var fPt=As();Object.defineProperty(Ia,"CohereError",{enumerable:!0,get:function(){return fPt.CohereError}});Object.defineProperty(Ia,"CohereTimeoutError",{enumerable:!0,get:function(){return fPt.CohereTimeoutError}});var A6r=dPt();Object.defineProperty(Ia,"SagemakerClient",{enumerable:!0,get:function(){return A6r.SagemakerClient}})});var gs=w(()=>{OR()});function Wy(t){t?(tc[0]=tc[16]=tc[1]=tc[2]=tc[3]=tc[4]=tc[5]=tc[6]=tc[7]=tc[8]=tc[9]=tc[10]=tc[11]=tc[12]=tc[13]=tc[14]=tc[15]=0,this.blocks=tc):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 I6r,pn,M6r,Vy,tc,QTe,pPt=w(()=>{"use strict";I6r=typeof window=="object"?window:{},pn="0123456789abcdef".split(""),M6r=[-2147483648,8388608,32768,128],Vy=[24,16,8,0],tc=[];Wy.prototype.update=function(t){if(!this.finalized){var e=typeof t!="string";e&&t.constructor===I6r.ArrayBuffer&&(t=new Uint8Array(t));for(var r,n=0,o,i=t.length||0,a=this.blocks;n>2]|=t[n]<>2]|=r<>2]|=(192|r>>6)<>2]|=(128|r&63)<=57344?(a[o>>2]|=(224|r>>12)<>2]|=(128|r>>6&63)<>2]|=(128|r&63)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|r&63)<=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}};Wy.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=M6r[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()}};Wy.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};Wy.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return pn[t>>28&15]+pn[t>>24&15]+pn[t>>20&15]+pn[t>>16&15]+pn[t>>12&15]+pn[t>>8&15]+pn[t>>4&15]+pn[t&15]+pn[e>>28&15]+pn[e>>24&15]+pn[e>>20&15]+pn[e>>16&15]+pn[e>>12&15]+pn[e>>8&15]+pn[e>>4&15]+pn[e&15]+pn[r>>28&15]+pn[r>>24&15]+pn[r>>20&15]+pn[r>>16&15]+pn[r>>12&15]+pn[r>>8&15]+pn[r>>4&15]+pn[r&15]+pn[n>>28&15]+pn[n>>24&15]+pn[n>>20&15]+pn[n>>16&15]+pn[n>>12&15]+pn[n>>8&15]+pn[n>>4&15]+pn[n&15]+pn[o>>28&15]+pn[o>>24&15]+pn[o>>20&15]+pn[o>>16&15]+pn[o>>12&15]+pn[o>>8&15]+pn[o>>4&15]+pn[o&15]};Wy.prototype.toString=Wy.prototype.hex;Wy.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]};Wy.prototype.array=Wy.prototype.digest;Wy.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};QTe=t=>new Wy(!0).update(t).hex()});var mPt=w(()=>{pPt()});var hPt,eAe,R6r,Mre,gPt=w(()=>{mPt();NE();hPt=(...t)=>QTe(t.join("_")),eAe=class{},R6r=new Map,Mre=class t extends eAe{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(hPt(e,r))??null)}async update(e,r,n){this.cache.set(hPt(e,r),n)}static global(){return new t(R6r)}}});function L6r(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;oe.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function k6r(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function rAe(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 yPt,j6r,N6r,D6r,tAe,Rre,bPt=w(()=>{yPt=F(sge(),1),j6r=Object.defineProperty,N6r=(t,e,r)=>e in t?j6r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D6r=(t,e,r)=>(N6r(t,typeof e!="symbol"?e+"":e,r),r);tAe=class{constructor(t,e){Cc(this,"specialTokens");Cc(this,"inverseSpecialTokens");Cc(this,"patStr");Cc(this,"textEncoder",new TextEncoder);Cc(this,"textDecoder",new TextDecoder("utf-8"));Cc(this,"rankMap",new Map);Cc(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=yPt.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=tAe.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=tAe.specialTokenRegex([...s]),c=t.match(l);if(c!=null)throw new Error(`The text contains a special token that is not allowed: ${c[0]}`)}let u=0;for(;;){let l=null,c=u;for(;o.lastIndex=c,l=o.exec(t),!(l==null||a.has(l[0]));)c=l.index+1;let d=l?.index??t.length;for(let p of t.substring(u,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(...F6r(m,this.rankMap))}if(l==null)break;let f=this.specialTokens[l[0]];i.push(f),u=l.index+l[0].length}return i}decode(t){let e=[],r=0;for(let i=0;inew RegExp(t.map(e=>k6r(e)).join("|"),"g"))});var _Pt=w(()=>{bPt()});async function vPt(t){return t in jre||(jre[t]=$6r.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new Rre(e)).catch(e=>{throw delete jre[t],e})),await jre[t]}async function wPt(t){return vPt(rAe(t))}var jre,$6r,nAe=w(()=>{_Pt();XL();jre={},$6r=new _m({})});function Wc(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 B6r,q6r,cB,dB,t8=w(()=>{gPt();W2();NE();XL();nAe();Df();B6r=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;q6r=()=>!1,cB=class extends xn{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??q6r(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}},dB=class extends cB{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=Mre.global():this.cache=void 0,this.caller=new _m(n??{})}async getNumTokens(e){if(typeof e!="string")return 0;let r=Math.ceil(e.length/4);if(!this._encoding)try{this._encoding=await wPt("modelName"in this?B6r(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(e).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(e){return typeof e=="string"?new tF(e):Array.isArray(e)?new rF(e.map(fy)):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 Wm=w(()=>{t8()});function Gs(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return e._def||Object.values(Wr.ZodFirstPartyTypeKind).includes(e.constructor?.name??"NOT_INCLUDED")?!0:typeof e.parse=="function"&&typeof e.parseAsync=="function"&&typeof e.safeParse=="function"&&typeof e.safeParseAsync=="function"}var fB=w(()=>{Td()});function oAe(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function iAe(t){return t!==void 0&&xn.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function aAe(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(Gs(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 rc(t){return aAe(t)||iAe(t)||oAe(t)}var Nre=w(()=>{Df();fB()});function SPt(t){return Gs(t)?So(t):t}function r8(t){if(!t||typeof t!="object"||Object.keys(t).length===0||Array.isArray(t))return!1;if("type"in t)return typeof t.type=="string"?t.type==="string":Array.isArray(t.type)?t.type.every(e=>e==="string"):!1;if("enum"in t)return Array.isArray(t.enum)&&t.enum.length>0&&t.enum.every(e=>typeof e=="string");if("const"in t)return typeof t.const=="string";if("allOf"in t&&Array.isArray(t.allOf))return t.allOf.some(e=>r8(e));if("anyOf"in t&&Array.isArray(t.anyOf)||"oneOf"in t&&Array.isArray(t.oneOf)){let e="anyOf"in t?t.anyOf:t.oneOf;return e.length>0&&e.every(r=>r8(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=RC(t);return r[e]?r8(r[e]):!1}return!1}var sAe=w(()=>{Ec();H2();fB();H2()});function TA(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:SPt(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function dx(t,e){let r=typeof e=="number"?void 0:e,n;return rc(t)?n={type:"function",function:TA(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var xPt=w(()=>{Nre();sAe();Nre()});var Km=w(()=>{xPt()});function uAe(t){let e=[];for(let r of t){let n=r;if(Array.isArray(r.content))for(let o=0;o{Ec();OR();ZL();t8();LE();Df();Wb();BG();fB();T2();Js=class t extends dB{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 Bs.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(),[uAe(o)],i.runId,void 0,l,void 0,void 0,i.runName),d,f;try{for await(let p of this._streamResponseChunks(o,a,c?.[0])){if(p.message.id==null){let m=c?.at(0)?.runId;m!=null&&p.message._updateId(`run-${m}`)}p.message.response_metadata={...p.generationInfo,...p.message.response_metadata},yield p.message,d?d=d.concat(p):d=p,lme(p.message)&&p.message.usage_metadata!==void 0&&(f={tokenUsage:{promptTokens:p.message.usage_metadata.input_tokens,completionTokens:p.message.usage_metadata.output_tokens,totalTokens:p.message.usage_metadata.total_tokens}})}}catch(p){throw await Promise.all((c??[]).map(m=>m?.handleLLMError(p))),p}await Promise.all((c??[]).map(p=>p?.handleLLMEnd({generations:[[d]],llmOutput:f})))}}getLsParams(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(d=>d.map(fy)),a;if(o!==void 0&&o.length===i.length)a=o;else{let d={...n.metadata,...this.getLsParams(r)},f=await Bs.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(uAe),n.runId,void 0,p,void 0,void 0,n.runName)}let s=[],u=[];if(!!a?.[0].handlers.find(tme)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==t.prototype._streamResponseChunks)try{let d=await this._streamResponseChunks(i[0],r,a?.[0]),f,p;for await(let m of d){if(m.message.id==null){let h=a?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}f===void 0?f=m:f=Hl(f,m),lme(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}if(f===void 0)throw new Error("Received empty response from chat model call.");s.push([f]),await a?.[0].handleLLMEnd({generations:s,llmOutput:p})}catch(d){throw await a?.[0].handleLLMError(d),d}else{let d=await Promise.allSettled(i.map((f,p)=>this._generate(f,{...r,promptIndex:p},a?.[p])));await Promise.all(d.map(async(f,p)=>{if(f.status==="fulfilled"){let m=f.value;for(let h of m.generations){if(h.message.id==null){let b=a?.at(0)?.runId;b!=null&&h.message._updateId(`run-${b}`)}h.message.response_metadata={...h.generationInfo,...h.message.response_metadata}}return m.generations.length===1&&(m.generations[0].message.response_metadata={...m.llmOutput,...m.generations[0].message.response_metadata}),s[p]=m.generations,u[p]=m.llmOutput,a?.[p]?.handleLLMEnd({generations:[m.generations],llmOutput:m.llmOutput})}else return await a?.[p]?.handleLLMError(f.reason),Promise.reject(f.reason)}))}let c={generations:s,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(c,k2,{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(b=>b.map(fy)),s={...i.metadata,...this.getLsParams(o)},u=await Bs.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(uAe),i.runId,void 0,l,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(a.map(async(b,g)=>{let y=t._convertInputToPromptValue(b).toString(),S=await r.lookup(y,n);return S==null&&d.push(g),S}))).map((b,g)=>({result:b,runManager:c?.[g]})).filter(({result:b})=>b.status==="fulfilled"&&b.value!=null||b.status==="rejected"),m=[];await Promise.all(p.map(async({result:b,runManager:g},y)=>{if(b.status==="fulfilled"){let S=b.value;return m[y]=S.map(x=>("message"in x&&Ph(x.message)&&Oi(x.message)&&(x.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0}),x.generationInfo={...x.generationInfo,tokenUsage:{}},x)),S.length&&await g?.handleLLMNewToken(S[0].text),g?.handleLLMEnd({generations:[S]},void 0,void 0,void 0,{cached:!0})}else return await g?.handleLLMError(b.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(b.reason)}));let h={generations:m,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(h,k2,{value:c?{runIds:c?.map(b=>b.runId)}:void 0,configurable:!0}),h}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(m=>m.map(fy)),[a,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(a.callbacks=a.callbacks??n,!this.cache)return this._generateUncached(i,s,a);let{cache:u}=this,l=this._getSerializedCacheKeyParametersForCall(s),{generations:c,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:u,llmStringKey:l,parsedOptions:s,handledOptions:a}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>i[h]),s,a,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,b)=>{let g=d[b];c[g]=h;let y=t._convertInputToPromptValue(i[g]).toString();return u.update(y,l,h)})),p=m.llmOutput??{}}return{generations:c,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}serialize(){return{...this.invocationParams(),_type:this._llmType(),_model:this._modelType()}}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}async call(e,r,n){return(await this.generate([e.map(fy)],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 Os(e),i=await this.call([o],r,n);if(typeof i.content!="string")throw new Error("Cannot use predict when output is not a string.");return i.content}withStructuredOutput(e,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let n=e,o=r?.name,i=n.description??"A function available to call.",a=r?.method,s=r?.includeRaw;if(a==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let u=o??"extract",l;Gs(n)?l=[{type:"function",function:{name:u,description:i,parameters:So(n)}}]:("name"in n&&(u=n.name),l=[{type:"function",function:{name:u,description:i,parameters:n}}]);let c=this.bindTools(l),d=Nf.from(h=>{if(!h.tool_calls||h.tool_calls.length===0)throw new Error("No tool calls found in the response.");let b=h.tool_calls.find(g=>g.name===u);if(!b)throw new Error(`No tool call found with name ${u}.`);return b.args});if(!s)return c.pipe(d).withConfig({runName:"StructuredOutput"});let f=go.assign({parsed:(h,b)=>d.invoke(h.raw,b)}),p=go.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return bi.from([{raw:c},m]).withConfig({runName:"StructuredOutputRunnable"})}}});var fx=w(()=>{CPt()});var Qd=w(()=>{ZL()});var Dn=w(()=>{bR()});function OPt(t,e=0){return(Kc[t[e+0]]+Kc[t[e+1]]+Kc[t[e+2]]+Kc[t[e+3]]+"-"+Kc[t[e+4]]+Kc[t[e+5]]+"-"+Kc[t[e+6]]+Kc[t[e+7]]+"-"+Kc[t[e+8]]+Kc[t[e+9]]+"-"+Kc[t[e+10]]+Kc[t[e+11]]+Kc[t[e+12]]+Kc[t[e+13]]+Kc[t[e+14]]+Kc[t[e+15]]).toLowerCase()}var Kc,Dre,PPt=w(()=>{Kc=[];for(Dre=0;Dre<256;++Dre)Kc.push((Dre+256).toString(16).slice(1))});function lAe(){if(!Lre&&(Lre=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Lre))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Lre(U6r)}var Lre,U6r,EPt=w(()=>{U6r=new Uint8Array(16)});var z6r,cAe,TPt=w(()=>{z6r=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),cAe={randomUUID:z6r}});function H6r(t,e,r){if(cAe.randomUUID&&!e&&!t)return cAe.randomUUID();t=t||{};var n=t.random||(t.rng||lAe)();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 OPt(n)}var dAe,APt=w(()=>{TPt();EPt();PPt();dAe=H6r});var IPt=w(()=>{APt()});function MPt(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 Fre(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=>Oi(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 W6r(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function RPt(t){return t._getType()==="tool"}function jPt(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 K6r(t){if(t){if(t.every(W6r))return t;if(t.every(Wc))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:jPt(e.function.parameters)}));if(t.every(rc))return t.map(e=>{let r=So(e.schema);return{name:e.name,description:e.description??"",parameterDefinitions:jPt(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var NPt,kre,DPt=w(()=>{NPt=F(e8(),1);Ec();gs();Wm();Km();fx();Qd();gs();Dn();IPt();kre=class extends Js{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??ot("COHERE_API_KEY");if(!r)throw new Error("No API key provided for ChatCohere.");this.client=new NPt.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:K6r(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=0;l-=1){let c=e[l];if(c._getType().toLowerCase()==="human"&&c.content){a=c.content.toString();break}}}else{for(let l=0;l0?"":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(RPt(o)){let i=o,a=n.filter(s=>Oi(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:MPt(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!RPt(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>Oi(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:MPt(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:dAe().substring(0,32),function:{name:n.name,arguments:n.parameters},type:"function"});return r}_convertCohereToolCallToLangchain(e){return e.map(r=>({name:r.function.name,args:r.function.arguments,id:r.id,type:"tool_call"}))}async _generate(e,r,n){let o={},i=this._getChatRequest(e,r);if(this.streaming){let c=this._streamResponseChunks(e,r,n),d={};for await(let p of c){let m=p.generationInfo?.completion??0;d[m]===void 0?d[m]=p:d[m]=d[m].concat(p)}return{generations:Object.entries(d).sort(([p],[m])=>parseInt(p,10)-parseInt(m,10)).map(([p,m])=>m),llmOutput:{estimatedTokenUsage:o}}}let a=await this.caller.callWithOptions({signal:r.signal},async()=>{let c;try{c=await this.client.chat(i)}catch(d){throw d.status=d.status??d.statusCode,d}return c});if(a.meta?.tokens){let{inputTokens:c,outputTokens:d}=a.meta.tokens;d&&(o.completionTokens=(o.completionTokens??0)+d),c&&(o.promptTokens=(o.promptTokens??0)+c),o.totalTokens=(o.totalTokens??0)+(o.promptTokens??0)+(o.completionTokens??0)}let s={...a};delete s.text,a.toolCalls&&a.toolCalls.length>0&&(s.toolCalls=this._formatCohereToolCalls(a.toolCalls));let u=[];return"toolCalls"in s&&(u=this._convertCohereToolCallToLangchain(s.toolCalls)),{generations:[{text:a.text,message:new gn({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 qn({text:a.text,message:new dr({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new qn({text:"",message:new dr({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 qn({text:"",message:new dr({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 LPt=w(()=>{OR();ZL();LE();t8();Wb();T2()});var jj=w(()=>{LPt()});var G6r,kPt=w(()=>{G6r=F(e8(),1);Dn();jj()});var Jf,$Pt=w(()=>{XL();Jf=class{constructor(e){Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.caller=new _m(e??{})}}});var $O=w(()=>{$Pt()});var Yf,BPt=w(()=>{Yf=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[])});var dg=w(()=>{BPt()});var qPt,$re,UPt=w(()=>{qPt=F(e8(),1);Dn();$O();dg();$re=class extends Jf{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||ot("COHERE_API_KEY");if(!n)throw new Error("Cohere API key not found");if(this.client=new qPt.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=Yf(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{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 zPt=w(()=>{});var HPt=w(()=>{zPt()});var J6r,VPt=w(()=>{HPt();Dn();J6r=F(e8(),1)});var WPt=w(()=>{DPt();kPt();UPt();VPt()});var fAe=w(()=>{WPt()});function e5r(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${Q6r}/${X6r}`),e.join(" ")}async function t5r(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",e5r(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 px(`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 px(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new px(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function r5r(t,e,r,n,o,i){let a=new pAe(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},a5r(i)),{method:"POST",headers:await t5r(a),body:o})}}async function a8(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await r5r(t,e,r,n,o,i);return n5r(s,u,a)}async function n5r(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){o5r(o,t)}return n.ok||await i5r(n,t),n}function o5r(t,e){let r=t;throw t instanceof qre||t instanceof px||(r=new ef(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function i5r(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 qre(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function a5r(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 hAe(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.`),Bre(t.candidates[0]))throw new AA(`${IA(t)}`,t);return s5r(t)}else if(t.promptFeedback)throw new AA(`Text not available. ${IA(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.`),Bre(t.candidates[0]))throw new AA(`${IA(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),tEt(t)[0]}else if(t.promptFeedback)throw new AA(`Function call not available. ${IA(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.`),Bre(t.candidates[0]))throw new AA(`${IA(t)}`,t);return tEt(t)}else if(t.promptFeedback)throw new AA(`Function call not available. ${IA(t)}`,t)},t}function s5r(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 tEt(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 Bre(t){return!!t.finishReason&&u5r.includes(t.finishReason)}function IA(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];Bre(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function o8(t){return this instanceof o8?(this.v=t,this):new o8(t)}function l5r(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof o8?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 c5r(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=p5r(e),[n,o]=r.tee();return{stream:f5r(n),response:d5r(o)}}async function d5r(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return hAe(m5r(e));e.push(o)}}function f5r(t){return l5r(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield o8(r.read());if(o)break;yield yield o8(hAe(n))}})}function p5r(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 ef("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(rEt),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new ef(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(rEt)}return i()})}}})}function m5r(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 aEt(t,e,r,n){let o=await a8(e,Fj.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return c5r(o)}async function sEt(t,e,r,n){let i=await(await a8(e,Fj.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:hAe(i)}}function uEt(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 i8(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 h5r(e)}function h5r(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 ef("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 ef("No content is provided for sending chat message.");return n?e:r}function g5r(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 px("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=i8(t);n.contents=[i]}return{generateContentRequest:n}}function nEt(t){let e;return t.contents?e=t:e={contents:[i8(t)]},t.systemInstruction&&(e.systemInstruction=uEt(t.systemInstruction)),e}function y5r(t){return typeof t=="string"||Array.isArray(t)?{content:i8(t)}:t}function _5r(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new ef(`First content should be with role 'user', got ${n}`);if(!YPt.includes(n))throw new ef(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(YPt)}`);if(!Array.isArray(o))throw new ef("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new ef("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 oEt)u in s&&(i[u]+=1);let a=b5r[n];for(let s of oEt)if(!a.includes(s)&&i[s]>0)throw new ef(`Content with role '${n}' can't contain '${s}' part`);e=!0}}async function v5r(t,e,r,n){return(await a8(e,Fj.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function w5r(t,e,r,n){return(await a8(e,Fj.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function S5r(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await a8(e,Fj.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var KPt,GPt,JPt,YPt,Nj,Dj,ZPt,XPt,n8,QPt,Lj,eEt,ef,AA,qre,px,Y6r,Z6r,X6r,Q6r,Fj,pAe,u5r,rEt,oEt,b5r,iEt,mAe,Ure,kj,s8=w(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(KPt||(KPt={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(GPt||(GPt={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(JPt||(JPt={}));YPt=["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"})(Nj||(Nj={}));(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"})(Dj||(Dj={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(ZPt||(ZPt={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(XPt||(XPt={}));(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"})(n8||(n8={}));(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"})(QPt||(QPt={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(Lj||(Lj={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(eEt||(eEt={}));ef=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},AA=class extends ef{constructor(e,r){super(e),this.response=r}},qre=class extends ef{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},px=class extends ef{};Y6r="https://generativelanguage.googleapis.com",Z6r="v1beta",X6r="0.21.0",Q6r="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"})(Fj||(Fj={}));pAe=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)||Z6r,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||Y6r}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};u5r=[n8.RECITATION,n8.SAFETY,n8.LANGUAGE];rEt=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;oEt=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],b5r={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};iEt="SILENT_ERROR",mAe=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&&(_5r(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=i8(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(()=>sEt(this._apiKey,this.model,c,d)).then(p=>{var m;if(p.response.candidates&&p.response.candidates.length>0){this._history.push(l);let h=Object.assign({parts:[],role:"model"},(m=p.response.candidates)===null||m===void 0?void 0:m[0].content);this._history.push(h)}else{let h=IA(p.response);h&&console.warn(`sendMessage() was unsuccessful. ${h}. Inspect response object for details.`)}f=p}),await this._sendPromise,f}async sendMessageStream(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=i8(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=aEt(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(iEt)}).then(p=>p.response).then(p=>{if(p.candidates&&p.candidates.length>0){this._history.push(l);let m=Object.assign({},p.candidates[0].content);m.role||(m.role="model"),this._history.push(m)}else{let m=IA(p);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(p=>{p.message!==iEt&&console.error(p)}),f}};Ure=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=uEt(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=nEt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return sEt(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=nEt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return aEt(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 mAe(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=g5r(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 v5r(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=y5r(e),o=Object.assign(Object.assign({},this._requestOptions),r);return w5r(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return S5r(this.apiKey,this.model,e,n)}};kj=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new ef("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new Ure(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new px("Cached content must contain a `name` field.");if(!e.model)throw new px("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 px(`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 Ure(this.apiKey,i,n)}}});var lEt=w(()=>{fB()});var pB=w(()=>{lEt()});function mB(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(mB):typeof e[r]=="object"&&e[r]!==null&&(e[r]=mB(e[r])));return e}return t}function zre(t){let e=mB(So(t)),{$schema:r,...n}=e;return n}function cEt(t){let e=mB(t),{$schema:r,...n}=e;return n}var Hre=w(()=>{Ec()});function x5r(t){let e=t._getType();return Cs.isInstance(t)?t.role:e==="tool"?e:t.name??e}function C5r(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 O5r(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};throw new Error("Invalid media content")}function P5r(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 O5r(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 gAe(t,e,r=!1){return t.reduce((n,o,i)=>{if(!Ph(o))throw new Error("Unsupported message input");let a=x5r(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=C5r(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=P5r(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 dEt(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 gn({content:a,tool_calls:r?.map(l=>({...l,type:"tool_call"})),additional_kwargs:{...i},usage_metadata:e?.usageMetadata}),generationInfo:i}]}}function fEt(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 qn({text:s,message:new dr({content:a||"",name:o?o.role:void 0,tool_call_chunks:u,additional_kwargs:{},usage_metadata:e.usageMetadata}),generationInfo:i})}function pEt(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(rc(e)){let r=zre(e.schema);return{name:e.name,description:e.description,parameters:r}}return Wc(e)?{name:e.function.name,description:e.function.description??"A function available to call.",parameters:cEt(e.function.parameters)}:e})}]}var yAe=w(()=>{gs();Qd();Km();Wm();Hre()});var u8,mEt=w(()=>{gy();u8=class extends PR{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 vm(`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 bAe(t,e){let r=E5r(t),n=A5r(r,e);return{tools:r,toolConfig:n}}function E5r(t){let e=[],r=[];return t.forEach(o=>{if(rc(o)){let[i]=pEt([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if(Wc(o)){let{functionDeclarations:i}=T5r(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 T5r(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:mB(t.function.parameters)}]}}function A5r(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:Lj.ANY,auto:Lj.AUTO,none:Lj.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:Lj.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var hEt=w(()=>{s8();Km();Wm();yAe();Hre()});var Vre,gEt=w(()=>{s8();Dn();fx();Sm();pB();Hre();yAe();mEt();hEt();Vre=class extends Js{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??ot("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 kj(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 kj(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:bAe(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?bAe(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=gAe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[c]=o;this.client.systemInstruction=c,i=o.slice(1)}let a=this.invocationParams(r);if(this.streaming){let c={},d=this._streamResponseChunks(e,r,n),f={};for await(let m of d){let h=m.generationInfo?.completion??0;f[h]===void 0?f[h]=m:f[h]=f[h].concat(m)}return{generations:Object.entries(f).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),llmOutput:{estimatedTokenUsage:c}}}let s=await this.completionWithRetry({...a,contents:i}),u;if("usageMetadata"in s.response){let c=s.response.usageMetadata;u={input_tokens:c.promptTokenCount??0,output_tokens:c.candidatesTokenCount??0,total_tokens:c.totalTokenCount??0}}let l=dEt(s.response,{usageMetadata:u});return await n?.handleLLMNewToken(l.generations[0].text??""),l}async*_streamResponseChunks(e,r,n){let o=gAe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[d]=o;this.client.systemInstruction=d,i=o.slice(1)}let s={...this.invocationParams(r),contents:i},u=await this.caller.callWithOptions({signal:r?.signal},async()=>{let{stream:d}=await this.client.generateContentStream(s);return d}),l,c=0;for await(let d of u){if("usageMetadata"in d&&this.streamUsage!==!1&&r.streamUsage!==!1){let p=d.usageMetadata;if(!l)l={input_tokens:p.promptTokenCount,output_tokens:p.candidatesTokenCount,total_tokens:p.totalTokenCount};else{let m=p.candidatesTokenCount-l.output_tokens;l={input_tokens:0,output_tokens:m,total_tokens:m}}}let f=fEt(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(Gs(n)){let m=zre(n);l=[{functionDeclarations:[{name:s,description:m.description??"A function available to call.",parameters:m}]}],u=new u8({returnSingle:!0,keyName:s,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(m=n,s=n.name):m={name:s,description:n.description??"",parameters:n},l=[{functionDeclarations:[m]}],u=new u8({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:s});if(!a)return c.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let d=go.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=go.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return bi.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}}});var Wre,yEt=w(()=>{s8();Dn();$O();dg();Wre=class extends Jf{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??ot("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 kj(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=Yf(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 bEt=w(()=>{gEt();yEt()});var _Ae=w(()=>{bEt()});function I5r(t){return t&&DataView.prototype.isPrototypeOf(t)}function hB(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 wAe(t){return typeof t!="string"&&(t=String(t)),t}function SAe(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return Zf.iterable&&(e[Symbol.iterator]=function(){return e}),e}function jl(t){this.map={},t instanceof jl?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 vAe(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function SEt(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function M5r(t){var e=new FileReader,r=SEt(e);return e.readAsArrayBuffer(t),r}function R5r(t){var e=new FileReader,r=SEt(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function j5r(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?e:t}function Bj(t,e){if(!(this instanceof Bj))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 Bj){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new jl(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 jl(e.headers)),this.method=D5r(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in Gc){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 L5r(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 F5r(t){var e=new jl,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 mx(t,e){if(!(this instanceof mx))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 jl(e.headers),this.url=e.url||"",this._initBody(t)}function CEt(t,e){return new Promise(function(r,n){var o=new Bj(t,e);if(o.signal&&o.signal.aborted)return n(new $j("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:F5r(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 mx(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 $j("Aborted","AbortError"))},0)};function s(l){try{return l===""&&Gc.location.href?Gc.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&&(Zf.blob?i.responseType="blob":Zf.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof jl||Gc.Headers&&e.headers instanceof Gc.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(hB(l)),i.setRequestHeader(l,wAe(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 Gc,Zf,_Et,wEt,N5r,k5r,$j,OEt=w(()=>{Gc=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},Zf={searchParams:"URLSearchParams"in Gc,iterable:"Symbol"in Gc&&"iterator"in Symbol,blob:"FileReader"in Gc&&"Blob"in Gc&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in Gc,arrayBuffer:"ArrayBuffer"in Gc};Zf.arrayBuffer&&(_Et=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],wEt=ArrayBuffer.isView||function(t){return t&&_Et.indexOf(Object.prototype.toString.call(t))>-1});jl.prototype.append=function(t,e){t=hB(t),e=wAe(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};jl.prototype.delete=function(t){delete this.map[hB(t)]};jl.prototype.get=function(t){return t=hB(t),this.has(t)?this.map[t]:null};jl.prototype.has=function(t){return this.map.hasOwnProperty(hB(t))};jl.prototype.set=function(t,e){this.map[hB(t)]=wAe(e)};jl.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};jl.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),SAe(t)};jl.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),SAe(t)};jl.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),SAe(t)};Zf.iterable&&(jl.prototype[Symbol.iterator]=jl.prototype.entries);N5r=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];Bj.prototype.clone=function(){return new Bj(this,{body:this._bodyInit})};xEt.call(Bj.prototype);xEt.call(mx.prototype);mx.prototype.clone=function(){return new mx(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new jl(this.headers),url:this.url})};mx.error=function(){var t=new mx(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};k5r=[301,302,303,307,308];mx.redirect=function(t,e){if(k5r.indexOf(e)===-1)throw new RangeError("Invalid status code");return new mx(null,{status:e,headers:{location:t}})};$j=Gc.DOMException;try{new $j}catch{$j=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},$j.prototype=Object.create(Error.prototype),$j.prototype.constructor=$j}CEt.polyfill=!0;Gc.fetch||(Gc.fetch=CEt,Gc.Headers=jl,Gc.Request=Bj,Gc.Response=mx)});function U5r(){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 z5r(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 $5r,EEt,TEt,B5r,q5r,xAe,OAe,PAe,EAe,TAe,PEt,gB,H5r,V5r,W5r,K5r,G5r,CAe,yB,AAo,Kre=w(()=>{OEt();$5r="0.5.14",EEt="11434",TEt=`http://127.0.0.1:${EEt}`,B5r=Object.defineProperty,q5r=(t,e,r)=>e in t?B5r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xAe=(t,e,r)=>(q5r(t,typeof e!="symbol"?e+"":e,r),r),OAe=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)}},PAe=class{constructor(e,r,n){xAe(this,"abortController"),xAe(this,"itr"),xAe(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.")}},EAe=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 OAe(e,t.status)};TAe=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${$5r} (${U5r()})`};r.headers=z5r(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)},PEt=async(t,e,r)=>{let n=await TAe(t,e,{headers:r?.headers});return await EAe(n),n},gB=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await TAe(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await EAe(a),a},H5r=async(t,e,r,n)=>{let o=await TAe(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await EAe(o),o},V5r=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(` +`}});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}generate(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}embed(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}rerank(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}classify(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}summarize(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}tokenize(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}detokenize(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}checkApiKey(e){var r,n;return Vp(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:_t.fetcher)({url:(0,Hy.default)((n=yield _t.Supplier.get(this._options.environment))!==null&&n!==void 0?n:zy.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.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 st.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 Ee.BadRequestError(o.error.body);case 401:throw new Ee.UnauthorizedError(o.error.body);case 403:throw new Ee.ForbiddenError(o.error.body);case 404:throw new Ee.NotFoundError(o.error.body);case 422:throw new Ee.UnprocessableEntityError(st.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(o.error.body);case 501:throw new Ee.NotImplementedError(st.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(o.error.body);case 504:throw new Ee.GatewayTimeoutError(st.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new jr.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:o.error.errorMessage})}})}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new p6r.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new m6r.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new h6r.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new g6r.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new y6r.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new b6r.Finetuning(this._options)}_getAuthorizationHeader(){var e;return Vp(this,void 0,void 0,function*(){let r=(e=yield _t.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new jr.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Wp.CohereClient=JTe});var ZTe=v(Ere=>{"use strict";Object.defineProperty(Ere,"__esModule",{value:!0});Ere.AwsClient=void 0;var _6r=Pre(),YTe=class extends _6r.CohereClient{constructor(e){e.token="n/a",super(e)}};Ere.AwsClient=YTe});var fPt=v(Tre=>{"use strict";Object.defineProperty(Tre,"__esModule",{value:!0});Tre.BedrockClient=void 0;var v6r=BTe(),w6r=ZTe(),XTe=class extends w6r.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,v6r.fetchOverride)("bedrock",e)}))}};Tre.BedrockClient=XTe});var pPt=v(Are=>{"use strict";Object.defineProperty(Are,"__esModule",{value:!0});Are.CohereClientV2=void 0;var S6r=UTe(),x6r=Pre(),QTe=class{constructor(e){this._options=e,this.client=new x6r.CohereClient(this._options),this.clientV2=new S6r.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}};Are.CohereClientV2=QTe});var mPt=v(Ire=>{"use strict";Object.defineProperty(Ire,"__esModule",{value:!0});Ire.CustomClient=void 0;var C6r=Pre(),eAe=class extends C6r.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}};Ire.CustomClient=eAe});var hPt=v(Mre=>{"use strict";Object.defineProperty(Mre,"__esModule",{value:!0});Mre.SagemakerClient=void 0;var O6r=ZTe(),P6r=BTe(),tAe=class extends O6r.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,P6r.fetchOverride)("sagemaker",e)}))}};Mre.SagemakerClient=tAe});var t8=v(Ia=>{"use strict";var E6r=Ia&&Ia.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T6r=Ia&&Ia.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A6r=Ia&&Ia.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&E6r(e,t,r);return T6r(e,t),e};Object.defineProperty(Ia,"__esModule",{value:!0});Ia.SagemakerClient=Ia.CohereTimeoutError=Ia.CohereError=Ia.CohereEnvironment=Ia.CohereClient=Ia.CohereClientV2=Ia.BedrockClient=Ia.Cohere=void 0;Ia.Cohere=A6r(aO());var I6r=fPt();Object.defineProperty(Ia,"BedrockClient",{enumerable:!0,get:function(){return I6r.BedrockClient}});var M6r=pPt();Object.defineProperty(Ia,"CohereClientV2",{enumerable:!0,get:function(){return M6r.CohereClientV2}});var R6r=mPt();Object.defineProperty(Ia,"CohereClient",{enumerable:!0,get:function(){return R6r.CustomClient}});var j6r=LO();Object.defineProperty(Ia,"CohereEnvironment",{enumerable:!0,get:function(){return j6r.CohereEnvironment}});var gPt=As();Object.defineProperty(Ia,"CohereError",{enumerable:!0,get:function(){return gPt.CohereError}});Object.defineProperty(Ia,"CohereTimeoutError",{enumerable:!0,get:function(){return gPt.CohereTimeoutError}});var N6r=hPt();Object.defineProperty(Ia,"SagemakerClient",{enumerable:!0,get:function(){return N6r.SagemakerClient}})});var gs=w(()=>{OR()});function Wy(t){t?(tc[0]=tc[16]=tc[1]=tc[2]=tc[3]=tc[4]=tc[5]=tc[6]=tc[7]=tc[8]=tc[9]=tc[10]=tc[11]=tc[12]=tc[13]=tc[14]=tc[15]=0,this.blocks=tc):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 D6r,pn,L6r,Vy,tc,rAe,yPt=w(()=>{"use strict";D6r=typeof window=="object"?window:{},pn="0123456789abcdef".split(""),L6r=[-2147483648,8388608,32768,128],Vy=[24,16,8,0],tc=[];Wy.prototype.update=function(t){if(!this.finalized){var e=typeof t!="string";e&&t.constructor===D6r.ArrayBuffer&&(t=new Uint8Array(t));for(var r,n=0,o,i=t.length||0,a=this.blocks;n>2]|=t[n]<>2]|=r<>2]|=(192|r>>6)<>2]|=(128|r&63)<=57344?(a[o>>2]|=(224|r>>12)<>2]|=(128|r>>6&63)<>2]|=(128|r&63)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|r&63)<=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}};Wy.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=L6r[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()}};Wy.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};Wy.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return pn[t>>28&15]+pn[t>>24&15]+pn[t>>20&15]+pn[t>>16&15]+pn[t>>12&15]+pn[t>>8&15]+pn[t>>4&15]+pn[t&15]+pn[e>>28&15]+pn[e>>24&15]+pn[e>>20&15]+pn[e>>16&15]+pn[e>>12&15]+pn[e>>8&15]+pn[e>>4&15]+pn[e&15]+pn[r>>28&15]+pn[r>>24&15]+pn[r>>20&15]+pn[r>>16&15]+pn[r>>12&15]+pn[r>>8&15]+pn[r>>4&15]+pn[r&15]+pn[n>>28&15]+pn[n>>24&15]+pn[n>>20&15]+pn[n>>16&15]+pn[n>>12&15]+pn[n>>8&15]+pn[n>>4&15]+pn[n&15]+pn[o>>28&15]+pn[o>>24&15]+pn[o>>20&15]+pn[o>>16&15]+pn[o>>12&15]+pn[o>>8&15]+pn[o>>4&15]+pn[o&15]};Wy.prototype.toString=Wy.prototype.hex;Wy.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]};Wy.prototype.array=Wy.prototype.digest;Wy.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};rAe=t=>new Wy(!0).update(t).hex()});var bPt=w(()=>{yPt()});var _Pt,nAe,F6r,Rre,vPt=w(()=>{bPt();NE();_Pt=(...t)=>rAe(t.join("_")),nAe=class{},F6r=new Map,Rre=class t extends nAe{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(_Pt(e,r))??null)}async update(e,r,n){this.cache.set(_Pt(e,r),n)}static global(){return new t(F6r)}}});function q6r(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;oe.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function z6r(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function iAe(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 wPt,k6r,$6r,B6r,oAe,jre,SPt=w(()=>{wPt=F(cge(),1),k6r=Object.defineProperty,$6r=(t,e,r)=>e in t?k6r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,B6r=(t,e,r)=>($6r(t,typeof e!="symbol"?e+"":e,r),r);oAe=class{constructor(t,e){Cc(this,"specialTokens");Cc(this,"inverseSpecialTokens");Cc(this,"patStr");Cc(this,"textEncoder",new TextEncoder);Cc(this,"textDecoder",new TextDecoder("utf-8"));Cc(this,"rankMap",new Map);Cc(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=wPt.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=oAe.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=oAe.specialTokenRegex([...s]),c=t.match(l);if(c!=null)throw new Error(`The text contains a special token that is not allowed: ${c[0]}`)}let u=0;for(;;){let l=null,c=u;for(;o.lastIndex=c,l=o.exec(t),!(l==null||a.has(l[0]));)c=l.index+1;let d=l?.index??t.length;for(let p of t.substring(u,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(...U6r(m,this.rankMap))}if(l==null)break;let f=this.specialTokens[l[0]];i.push(f),u=l.index+l[0].length}return i}decode(t){let e=[],r=0;for(let i=0;inew RegExp(t.map(e=>z6r(e)).join("|"),"g"))});var xPt=w(()=>{SPt()});async function CPt(t){return t in Nre||(Nre[t]=H6r.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new jre(e)).catch(e=>{throw delete Nre[t],e})),await Nre[t]}async function OPt(t){return CPt(iAe(t))}var Nre,H6r,aAe=w(()=>{xPt();QL();Nre={},H6r=new _m({})});function Wc(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 V6r,W6r,dB,fB,r8=w(()=>{vPt();K2();NE();QL();aAe();Df();V6r=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;W6r=()=>!1,dB=class extends Cn{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??W6r(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}},fB=class extends dB{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=Rre.global():this.cache=void 0,this.caller=new _m(n??{})}async getNumTokens(e){if(typeof e!="string")return 0;let r=Math.ceil(e.length/4);if(!this._encoding)try{this._encoding=await OPt("modelName"in this?V6r(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(e).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(e){return typeof e=="string"?new rF(e):Array.isArray(e)?new nF(e.map(fy)):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 Wm=w(()=>{r8()});function Gs(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return e._def||Object.values(Wr.ZodFirstPartyTypeKind).includes(e.constructor?.name??"NOT_INCLUDED")?!0:typeof e.parse=="function"&&typeof e.parseAsync=="function"&&typeof e.safeParse=="function"&&typeof e.safeParseAsync=="function"}var pB=w(()=>{Td()});function sAe(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function uAe(t){return t!==void 0&&Cn.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function lAe(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(Gs(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 rc(t){return lAe(t)||uAe(t)||sAe(t)}var Dre=w(()=>{Df();pB()});function PPt(t){return Gs(t)?So(t):t}function n8(t){if(!t||typeof t!="object"||Object.keys(t).length===0||Array.isArray(t))return!1;if("type"in t)return typeof t.type=="string"?t.type==="string":Array.isArray(t.type)?t.type.every(e=>e==="string"):!1;if("enum"in t)return Array.isArray(t.enum)&&t.enum.length>0&&t.enum.every(e=>typeof e=="string");if("const"in t)return typeof t.const=="string";if("allOf"in t&&Array.isArray(t.allOf))return t.allOf.some(e=>n8(e));if("anyOf"in t&&Array.isArray(t.anyOf)||"oneOf"in t&&Array.isArray(t.oneOf)){let e="anyOf"in t?t.anyOf:t.oneOf;return e.length>0&&e.every(r=>n8(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=jC(t);return r[e]?n8(r[e]):!1}return!1}var cAe=w(()=>{Ec();V2();pB();V2()});function TA(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:PPt(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function dx(t,e){let r=typeof e=="number"?void 0:e,n;return rc(t)?n={type:"function",function:TA(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var EPt=w(()=>{Dre();cAe();Dre()});var Km=w(()=>{EPt()});function dAe(t){let e=[];for(let r of t){let n=r;if(Array.isArray(r.content))for(let o=0;o{Ec();OR();XL();r8();LE();Df();Wb();qG();pB();A2();Js=class t extends fB{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 Bs.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(),[dAe(o)],i.runId,void 0,l,void 0,void 0,i.runName),d,f;try{for await(let p of this._streamResponseChunks(o,a,c?.[0])){if(p.message.id==null){let m=c?.at(0)?.runId;m!=null&&p.message._updateId(`run-${m}`)}p.message.response_metadata={...p.generationInfo,...p.message.response_metadata},yield p.message,d?d=d.concat(p):d=p,fme(p.message)&&p.message.usage_metadata!==void 0&&(f={tokenUsage:{promptTokens:p.message.usage_metadata.input_tokens,completionTokens:p.message.usage_metadata.output_tokens,totalTokens:p.message.usage_metadata.total_tokens}})}}catch(p){throw await Promise.all((c??[]).map(m=>m?.handleLLMError(p))),p}await Promise.all((c??[]).map(p=>p?.handleLLMEnd({generations:[[d]],llmOutput:f})))}}getLsParams(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(d=>d.map(fy)),a;if(o!==void 0&&o.length===i.length)a=o;else{let d={...n.metadata,...this.getLsParams(r)},f=await Bs.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(dAe),n.runId,void 0,p,void 0,void 0,n.runName)}let s=[],u=[];if(!!a?.[0].handlers.find(ome)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==t.prototype._streamResponseChunks)try{let d=await this._streamResponseChunks(i[0],r,a?.[0]),f,p;for await(let m of d){if(m.message.id==null){let h=a?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}f===void 0?f=m:f=Hl(f,m),fme(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}if(f===void 0)throw new Error("Received empty response from chat model call.");s.push([f]),await a?.[0].handleLLMEnd({generations:s,llmOutput:p})}catch(d){throw await a?.[0].handleLLMError(d),d}else{let d=await Promise.allSettled(i.map((f,p)=>this._generate(f,{...r,promptIndex:p},a?.[p])));await Promise.all(d.map(async(f,p)=>{if(f.status==="fulfilled"){let m=f.value;for(let h of m.generations){if(h.message.id==null){let b=a?.at(0)?.runId;b!=null&&h.message._updateId(`run-${b}`)}h.message.response_metadata={...h.generationInfo,...h.message.response_metadata}}return m.generations.length===1&&(m.generations[0].message.response_metadata={...m.llmOutput,...m.generations[0].message.response_metadata}),s[p]=m.generations,u[p]=m.llmOutput,a?.[p]?.handleLLMEnd({generations:[m.generations],llmOutput:m.llmOutput})}else return await a?.[p]?.handleLLMError(f.reason),Promise.reject(f.reason)}))}let c={generations:s,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(c,$2,{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(b=>b.map(fy)),s={...i.metadata,...this.getLsParams(o)},u=await Bs.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(dAe),i.runId,void 0,l,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(a.map(async(b,g)=>{let y=t._convertInputToPromptValue(b).toString(),S=await r.lookup(y,n);return S==null&&d.push(g),S}))).map((b,g)=>({result:b,runManager:c?.[g]})).filter(({result:b})=>b.status==="fulfilled"&&b.value!=null||b.status==="rejected"),m=[];await Promise.all(p.map(async({result:b,runManager:g},y)=>{if(b.status==="fulfilled"){let S=b.value;return m[y]=S.map(x=>("message"in x&&Ph(x.message)&&Oi(x.message)&&(x.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0}),x.generationInfo={...x.generationInfo,tokenUsage:{}},x)),S.length&&await g?.handleLLMNewToken(S[0].text),g?.handleLLMEnd({generations:[S]},void 0,void 0,void 0,{cached:!0})}else return await g?.handleLLMError(b.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(b.reason)}));let h={generations:m,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(h,$2,{value:c?{runIds:c?.map(b=>b.runId)}:void 0,configurable:!0}),h}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(m=>m.map(fy)),[a,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(a.callbacks=a.callbacks??n,!this.cache)return this._generateUncached(i,s,a);let{cache:u}=this,l=this._getSerializedCacheKeyParametersForCall(s),{generations:c,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:u,llmStringKey:l,parsedOptions:s,handledOptions:a}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>i[h]),s,a,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,b)=>{let g=d[b];c[g]=h;let y=t._convertInputToPromptValue(i[g]).toString();return u.update(y,l,h)})),p=m.llmOutput??{}}return{generations:c,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}serialize(){return{...this.invocationParams(),_type:this._llmType(),_model:this._modelType()}}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}async call(e,r,n){return(await this.generate([e.map(fy)],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 Os(e),i=await this.call([o],r,n);if(typeof i.content!="string")throw new Error("Cannot use predict when output is not a string.");return i.content}withStructuredOutput(e,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let n=e,o=r?.name,i=n.description??"A function available to call.",a=r?.method,s=r?.includeRaw;if(a==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let u=o??"extract",l;Gs(n)?l=[{type:"function",function:{name:u,description:i,parameters:So(n)}}]:("name"in n&&(u=n.name),l=[{type:"function",function:{name:u,description:i,parameters:n}}]);let c=this.bindTools(l),d=Nf.from(h=>{if(!h.tool_calls||h.tool_calls.length===0)throw new Error("No tool calls found in the response.");let b=h.tool_calls.find(g=>g.name===u);if(!b)throw new Error(`No tool call found with name ${u}.`);return b.args});if(!s)return c.pipe(d).withConfig({runName:"StructuredOutput"});let f=go.assign({parsed:(h,b)=>d.invoke(h.raw,b)}),p=go.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return bi.from([{raw:c},m]).withConfig({runName:"StructuredOutputRunnable"})}}});var fx=w(()=>{TPt()});var Qd=w(()=>{XL()});var Dn=w(()=>{bR()});function APt(t,e=0){return(Kc[t[e+0]]+Kc[t[e+1]]+Kc[t[e+2]]+Kc[t[e+3]]+"-"+Kc[t[e+4]]+Kc[t[e+5]]+"-"+Kc[t[e+6]]+Kc[t[e+7]]+"-"+Kc[t[e+8]]+Kc[t[e+9]]+"-"+Kc[t[e+10]]+Kc[t[e+11]]+Kc[t[e+12]]+Kc[t[e+13]]+Kc[t[e+14]]+Kc[t[e+15]]).toLowerCase()}var Kc,Lre,IPt=w(()=>{Kc=[];for(Lre=0;Lre<256;++Lre)Kc.push((Lre+256).toString(16).slice(1))});function fAe(){if(!Fre&&(Fre=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Fre))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Fre(K6r)}var Fre,K6r,MPt=w(()=>{K6r=new Uint8Array(16)});var G6r,pAe,RPt=w(()=>{G6r=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),pAe={randomUUID:G6r}});function J6r(t,e,r){if(pAe.randomUUID&&!e&&!t)return pAe.randomUUID();t=t||{};var n=t.random||(t.rng||fAe)();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 APt(n)}var mAe,jPt=w(()=>{RPt();MPt();IPt();mAe=J6r});var NPt=w(()=>{jPt()});function DPt(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 kre(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=>Oi(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 Z6r(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function LPt(t){return t._getType()==="tool"}function FPt(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 X6r(t){if(t){if(t.every(Z6r))return t;if(t.every(Wc))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:FPt(e.function.parameters)}));if(t.every(rc))return t.map(e=>{let r=So(e.schema);return{name:e.name,description:e.description??"",parameterDefinitions:FPt(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var kPt,$re,$Pt=w(()=>{kPt=F(t8(),1);Ec();gs();Wm();Km();fx();Qd();gs();Dn();NPt();$re=class extends Js{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??ot("COHERE_API_KEY");if(!r)throw new Error("No API key provided for ChatCohere.");this.client=new kPt.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:X6r(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=0;l-=1){let c=e[l];if(c._getType().toLowerCase()==="human"&&c.content){a=c.content.toString();break}}}else{for(let l=0;l0?"":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(LPt(o)){let i=o,a=n.filter(s=>Oi(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:DPt(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!LPt(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>Oi(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:DPt(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:mAe().substring(0,32),function:{name:n.name,arguments:n.parameters},type:"function"});return r}_convertCohereToolCallToLangchain(e){return e.map(r=>({name:r.function.name,args:r.function.arguments,id:r.id,type:"tool_call"}))}async _generate(e,r,n){let o={},i=this._getChatRequest(e,r);if(this.streaming){let c=this._streamResponseChunks(e,r,n),d={};for await(let p of c){let m=p.generationInfo?.completion??0;d[m]===void 0?d[m]=p:d[m]=d[m].concat(p)}return{generations:Object.entries(d).sort(([p],[m])=>parseInt(p,10)-parseInt(m,10)).map(([p,m])=>m),llmOutput:{estimatedTokenUsage:o}}}let a=await this.caller.callWithOptions({signal:r.signal},async()=>{let c;try{c=await this.client.chat(i)}catch(d){throw d.status=d.status??d.statusCode,d}return c});if(a.meta?.tokens){let{inputTokens:c,outputTokens:d}=a.meta.tokens;d&&(o.completionTokens=(o.completionTokens??0)+d),c&&(o.promptTokens=(o.promptTokens??0)+c),o.totalTokens=(o.totalTokens??0)+(o.promptTokens??0)+(o.completionTokens??0)}let s={...a};delete s.text,a.toolCalls&&a.toolCalls.length>0&&(s.toolCalls=this._formatCohereToolCalls(a.toolCalls));let u=[];return"toolCalls"in s&&(u=this._convertCohereToolCallToLangchain(s.toolCalls)),{generations:[{text:a.text,message:new gn({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 qn({text:a.text,message:new dr({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new qn({text:"",message:new dr({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 qn({text:"",message:new dr({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 BPt=w(()=>{OR();XL();LE();r8();Wb();A2()});var Nj=w(()=>{BPt()});var Q6r,UPt=w(()=>{Q6r=F(t8(),1);Dn();Nj()});var Jf,zPt=w(()=>{QL();Jf=class{constructor(e){Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.caller=new _m(e??{})}}});var BO=w(()=>{zPt()});var Yf,HPt=w(()=>{Yf=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[])});var dg=w(()=>{HPt()});var VPt,Bre,WPt=w(()=>{VPt=F(t8(),1);Dn();BO();dg();Bre=class extends Jf{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||ot("COHERE_API_KEY");if(!n)throw new Error("Cohere API key not found");if(this.client=new VPt.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=Yf(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{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 KPt=w(()=>{});var GPt=w(()=>{KPt()});var e5r,JPt=w(()=>{GPt();Dn();e5r=F(t8(),1)});var YPt=w(()=>{$Pt();UPt();WPt();JPt()});var hAe=w(()=>{YPt()});function i5r(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${o5r}/${n5r}`),e.join(" ")}async function a5r(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",i5r(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 px(`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 px(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new px(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function s5r(t,e,r,n,o,i){let a=new gAe(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},d5r(i)),{method:"POST",headers:await a5r(a),body:o})}}async function s8(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await s5r(t,e,r,n,o,i);return u5r(s,u,a)}async function u5r(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){l5r(o,t)}return n.ok||await c5r(n,t),n}function l5r(t,e){let r=t;throw t instanceof Ure||t instanceof px||(r=new ef(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function c5r(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 Ure(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function d5r(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 bAe(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.`),qre(t.candidates[0]))throw new AA(`${IA(t)}`,t);return f5r(t)}else if(t.promptFeedback)throw new AA(`Text not available. ${IA(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.`),qre(t.candidates[0]))throw new AA(`${IA(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),iEt(t)[0]}else if(t.promptFeedback)throw new AA(`Function call not available. ${IA(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.`),qre(t.candidates[0]))throw new AA(`${IA(t)}`,t);return iEt(t)}else if(t.promptFeedback)throw new AA(`Function call not available. ${IA(t)}`,t)},t}function f5r(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 iEt(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 qre(t){return!!t.finishReason&&p5r.includes(t.finishReason)}function IA(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];qre(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function i8(t){return this instanceof i8?(this.v=t,this):new i8(t)}function m5r(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof i8?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 h5r(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=b5r(e),[n,o]=r.tee();return{stream:y5r(n),response:g5r(o)}}async function g5r(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return bAe(_5r(e));e.push(o)}}function y5r(t){return m5r(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield i8(r.read());if(o)break;yield yield i8(bAe(n))}})}function b5r(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 ef("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(aEt),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new ef(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(aEt)}return i()})}}})}function _5r(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 cEt(t,e,r,n){let o=await s8(e,kj.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return h5r(o)}async function dEt(t,e,r,n){let i=await(await s8(e,kj.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:bAe(i)}}function fEt(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 a8(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 v5r(e)}function v5r(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 ef("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 ef("No content is provided for sending chat message.");return n?e:r}function w5r(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 px("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=a8(t);n.contents=[i]}return{generateContentRequest:n}}function sEt(t){let e;return t.contents?e=t:e={contents:[a8(t)]},t.systemInstruction&&(e.systemInstruction=fEt(t.systemInstruction)),e}function S5r(t){return typeof t=="string"||Array.isArray(t)?{content:a8(t)}:t}function C5r(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new ef(`First content should be with role 'user', got ${n}`);if(!eEt.includes(n))throw new ef(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(eEt)}`);if(!Array.isArray(o))throw new ef("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new ef("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 uEt)u in s&&(i[u]+=1);let a=x5r[n];for(let s of uEt)if(!a.includes(s)&&i[s]>0)throw new ef(`Content with role '${n}' can't contain '${s}' part`);e=!0}}async function O5r(t,e,r,n){return(await s8(e,kj.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function P5r(t,e,r,n){return(await s8(e,kj.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function E5r(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await s8(e,kj.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var ZPt,XPt,QPt,eEt,Dj,Lj,tEt,rEt,o8,nEt,Fj,oEt,ef,AA,Ure,px,t5r,r5r,n5r,o5r,kj,gAe,p5r,aEt,uEt,x5r,lEt,yAe,zre,$j,u8=w(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(ZPt||(ZPt={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(XPt||(XPt={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(QPt||(QPt={}));eEt=["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"})(Dj||(Dj={}));(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"})(Lj||(Lj={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(tEt||(tEt={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(rEt||(rEt={}));(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"})(o8||(o8={}));(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"})(nEt||(nEt={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(Fj||(Fj={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(oEt||(oEt={}));ef=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},AA=class extends ef{constructor(e,r){super(e),this.response=r}},Ure=class extends ef{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},px=class extends ef{};t5r="https://generativelanguage.googleapis.com",r5r="v1beta",n5r="0.21.0",o5r="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"})(kj||(kj={}));gAe=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)||r5r,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||t5r}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};p5r=[o8.RECITATION,o8.SAFETY,o8.LANGUAGE];aEt=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;uEt=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],x5r={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};lEt="SILENT_ERROR",yAe=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&&(C5r(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=a8(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(()=>dEt(this._apiKey,this.model,c,d)).then(p=>{var m;if(p.response.candidates&&p.response.candidates.length>0){this._history.push(l);let h=Object.assign({parts:[],role:"model"},(m=p.response.candidates)===null||m===void 0?void 0:m[0].content);this._history.push(h)}else{let h=IA(p.response);h&&console.warn(`sendMessage() was unsuccessful. ${h}. Inspect response object for details.`)}f=p}),await this._sendPromise,f}async sendMessageStream(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=a8(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=cEt(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(lEt)}).then(p=>p.response).then(p=>{if(p.candidates&&p.candidates.length>0){this._history.push(l);let m=Object.assign({},p.candidates[0].content);m.role||(m.role="model"),this._history.push(m)}else{let m=IA(p);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(p=>{p.message!==lEt&&console.error(p)}),f}};zre=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=fEt(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=sEt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return dEt(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=sEt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return cEt(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 yAe(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=w5r(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 O5r(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=S5r(e),o=Object.assign(Object.assign({},this._requestOptions),r);return P5r(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return E5r(this.apiKey,this.model,e,n)}};$j=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new ef("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new zre(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new px("Cached content must contain a `name` field.");if(!e.model)throw new px("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 px(`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 zre(this.apiKey,i,n)}}});var pEt=w(()=>{pB()});var mB=w(()=>{pEt()});function hB(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(hB):typeof e[r]=="object"&&e[r]!==null&&(e[r]=hB(e[r])));return e}return t}function Hre(t){let e=hB(So(t)),{$schema:r,...n}=e;return n}function mEt(t){let e=hB(t),{$schema:r,...n}=e;return n}var Vre=w(()=>{Ec()});function T5r(t){let e=t._getType();return Cs.isInstance(t)?t.role:e==="tool"?e:t.name??e}function A5r(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 I5r(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};throw new Error("Invalid media content")}function M5r(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 I5r(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 _Ae(t,e,r=!1){return t.reduce((n,o,i)=>{if(!Ph(o))throw new Error("Unsupported message input");let a=T5r(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=A5r(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=M5r(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 hEt(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 gn({content:a,tool_calls:r?.map(l=>({...l,type:"tool_call"})),additional_kwargs:{...i},usage_metadata:e?.usageMetadata}),generationInfo:i}]}}function gEt(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 qn({text:s,message:new dr({content:a||"",name:o?o.role:void 0,tool_call_chunks:u,additional_kwargs:{},usage_metadata:e.usageMetadata}),generationInfo:i})}function yEt(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(rc(e)){let r=Hre(e.schema);return{name:e.name,description:e.description,parameters:r}}return Wc(e)?{name:e.function.name,description:e.function.description??"A function available to call.",parameters:mEt(e.function.parameters)}:e})}]}var vAe=w(()=>{gs();Qd();Km();Wm();Vre()});var l8,bEt=w(()=>{gy();l8=class extends PR{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 vm(`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 wAe(t,e){let r=R5r(t),n=N5r(r,e);return{tools:r,toolConfig:n}}function R5r(t){let e=[],r=[];return t.forEach(o=>{if(rc(o)){let[i]=yEt([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if(Wc(o)){let{functionDeclarations:i}=j5r(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 j5r(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:hB(t.function.parameters)}]}}function N5r(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:Fj.ANY,auto:Fj.AUTO,none:Fj.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:Fj.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var _Et=w(()=>{u8();Km();Wm();vAe();Vre()});var Wre,vEt=w(()=>{u8();Dn();fx();Sm();mB();Vre();vAe();bEt();_Et();Wre=class extends Js{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??ot("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 $j(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 $j(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:wAe(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?wAe(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=_Ae(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[c]=o;this.client.systemInstruction=c,i=o.slice(1)}let a=this.invocationParams(r);if(this.streaming){let c={},d=this._streamResponseChunks(e,r,n),f={};for await(let m of d){let h=m.generationInfo?.completion??0;f[h]===void 0?f[h]=m:f[h]=f[h].concat(m)}return{generations:Object.entries(f).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),llmOutput:{estimatedTokenUsage:c}}}let s=await this.completionWithRetry({...a,contents:i}),u;if("usageMetadata"in s.response){let c=s.response.usageMetadata;u={input_tokens:c.promptTokenCount??0,output_tokens:c.candidatesTokenCount??0,total_tokens:c.totalTokenCount??0}}let l=hEt(s.response,{usageMetadata:u});return await n?.handleLLMNewToken(l.generations[0].text??""),l}async*_streamResponseChunks(e,r,n){let o=_Ae(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[d]=o;this.client.systemInstruction=d,i=o.slice(1)}let s={...this.invocationParams(r),contents:i},u=await this.caller.callWithOptions({signal:r?.signal},async()=>{let{stream:d}=await this.client.generateContentStream(s);return d}),l,c=0;for await(let d of u){if("usageMetadata"in d&&this.streamUsage!==!1&&r.streamUsage!==!1){let p=d.usageMetadata;if(!l)l={input_tokens:p.promptTokenCount,output_tokens:p.candidatesTokenCount,total_tokens:p.totalTokenCount};else{let m=p.candidatesTokenCount-l.output_tokens;l={input_tokens:0,output_tokens:m,total_tokens:m}}}let f=gEt(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(Gs(n)){let m=Hre(n);l=[{functionDeclarations:[{name:s,description:m.description??"A function available to call.",parameters:m}]}],u=new l8({returnSingle:!0,keyName:s,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(m=n,s=n.name):m={name:s,description:n.description??"",parameters:n},l=[{functionDeclarations:[m]}],u=new l8({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:s});if(!a)return c.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let d=go.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=go.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return bi.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}}});var Kre,wEt=w(()=>{u8();Dn();BO();dg();Kre=class extends Jf{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??ot("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 $j(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=Yf(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 SEt=w(()=>{vEt();wEt()});var SAe=w(()=>{SEt()});function D5r(t){return t&&DataView.prototype.isPrototypeOf(t)}function gB(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 CAe(t){return typeof t!="string"&&(t=String(t)),t}function OAe(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return Zf.iterable&&(e[Symbol.iterator]=function(){return e}),e}function jl(t){this.map={},t instanceof jl?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 xAe(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function PEt(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function L5r(t){var e=new FileReader,r=PEt(e);return e.readAsArrayBuffer(t),r}function F5r(t){var e=new FileReader,r=PEt(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function k5r(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?e:t}function qj(t,e){if(!(this instanceof qj))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 qj){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new jl(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 jl(e.headers)),this.method=B5r(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in Gc){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 q5r(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 U5r(t){var e=new jl,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 mx(t,e){if(!(this instanceof mx))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 jl(e.headers),this.url=e.url||"",this._initBody(t)}function TEt(t,e){return new Promise(function(r,n){var o=new qj(t,e);if(o.signal&&o.signal.aborted)return n(new Bj("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:U5r(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 mx(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 Bj("Aborted","AbortError"))},0)};function s(l){try{return l===""&&Gc.location.href?Gc.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&&(Zf.blob?i.responseType="blob":Zf.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof jl||Gc.Headers&&e.headers instanceof Gc.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(gB(l)),i.setRequestHeader(l,CAe(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 Gc,Zf,xEt,OEt,$5r,z5r,Bj,AEt=w(()=>{Gc=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},Zf={searchParams:"URLSearchParams"in Gc,iterable:"Symbol"in Gc&&"iterator"in Symbol,blob:"FileReader"in Gc&&"Blob"in Gc&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in Gc,arrayBuffer:"ArrayBuffer"in Gc};Zf.arrayBuffer&&(xEt=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],OEt=ArrayBuffer.isView||function(t){return t&&xEt.indexOf(Object.prototype.toString.call(t))>-1});jl.prototype.append=function(t,e){t=gB(t),e=CAe(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};jl.prototype.delete=function(t){delete this.map[gB(t)]};jl.prototype.get=function(t){return t=gB(t),this.has(t)?this.map[t]:null};jl.prototype.has=function(t){return this.map.hasOwnProperty(gB(t))};jl.prototype.set=function(t,e){this.map[gB(t)]=CAe(e)};jl.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};jl.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),OAe(t)};jl.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),OAe(t)};jl.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),OAe(t)};Zf.iterable&&(jl.prototype[Symbol.iterator]=jl.prototype.entries);$5r=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];qj.prototype.clone=function(){return new qj(this,{body:this._bodyInit})};EEt.call(qj.prototype);EEt.call(mx.prototype);mx.prototype.clone=function(){return new mx(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new jl(this.headers),url:this.url})};mx.error=function(){var t=new mx(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};z5r=[301,302,303,307,308];mx.redirect=function(t,e){if(z5r.indexOf(e)===-1)throw new RangeError("Invalid status code");return new mx(null,{status:e,headers:{location:t}})};Bj=Gc.DOMException;try{new Bj}catch{Bj=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},Bj.prototype=Object.create(Error.prototype),Bj.prototype.constructor=Bj}TEt.polyfill=!0;Gc.fetch||(Gc.fetch=TEt,Gc.Headers=jl,Gc.Request=qj,Gc.Response=mx)});function K5r(){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 G5r(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 H5r,MEt,REt,V5r,W5r,PAe,TAe,AAe,IAe,MAe,IEt,yB,J5r,Y5r,Z5r,X5r,Q5r,EAe,bB,NAo,Gre=w(()=>{AEt();H5r="0.5.14",MEt="11434",REt=`http://127.0.0.1:${MEt}`,V5r=Object.defineProperty,W5r=(t,e,r)=>e in t?V5r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,PAe=(t,e,r)=>(W5r(t,typeof e!="symbol"?e+"":e,r),r),TAe=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)}},AAe=class{constructor(e,r,n){PAe(this,"abortController"),PAe(this,"itr"),PAe(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.")}},IAe=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 TAe(e,t.status)};MAe=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${H5r} (${K5r()})`};r.headers=G5r(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)},IEt=async(t,e,r)=>{let n=await MAe(t,e,{headers:r?.headers});return await IAe(n),n},yB=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await MAe(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await IAe(a),a},J5r=async(t,e,r,n)=>{let o=await MAe(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await IAe(o),o},Y5r=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)}},W5r=t=>{if(!t)return TEt;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=EEt);let o=`${r.protocol}//${r.hostname}:${n}${r.pathname}`;return o.endsWith("/")&&(o=o.slice(0,-1)),o},K5r=Object.defineProperty,G5r=(t,e,r)=>e in t?K5r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,CAe=(t,e,r)=>(G5r(t,typeof e!="symbol"?e+"":e,r),r),yB=class{constructor(e){CAe(this,"config"),CAe(this,"fetch"),CAe(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=W5r(e?.host??TEt)),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 gB(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=V5r(a.body),u=new PAe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await gB(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{Wb()});function IEt(t,e=0){return(Jc[t[e+0]]+Jc[t[e+1]]+Jc[t[e+2]]+Jc[t[e+3]]+"-"+Jc[t[e+4]]+Jc[t[e+5]]+"-"+Jc[t[e+6]]+Jc[t[e+7]]+"-"+Jc[t[e+8]]+Jc[t[e+9]]+"-"+Jc[t[e+10]]+Jc[t[e+11]]+Jc[t[e+12]]+Jc[t[e+13]]+Jc[t[e+14]]+Jc[t[e+15]]).toLowerCase()}var Jc,Gre,MEt=w(()=>{Jc=[];for(Gre=0;Gre<256;++Gre)Jc.push((Gre+256).toString(16).slice(1))});function AAe(){if(!Jre&&(Jre=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Jre))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Jre(J5r)}var Jre,J5r,REt=w(()=>{J5r=new Uint8Array(16)});var Y5r,IAe,jEt=w(()=>{Y5r=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),IAe={randomUUID:Y5r}});function Z5r(t,e,r){if(IAe.randomUUID&&!e&&!t)return IAe.randomUUID();t=t||{};var n=t.random||(t.rng||AAe)();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 IEt(n)}var MAe,NEt=w(()=>{jEt();REt();MEt();MAe=Z5r});var DEt=w(()=>{NEt()});function RAe(t,e){return new dr({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:MAe()})),response_metadata:e?.responseMetadata,usage_metadata:e?.usageMetadata})}function LEt(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function X5r(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 Q5r(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:[LEt(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[LEt(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function eWr(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 tWr(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function FEt(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return Q5r(e);if(e._getType()==="ai")return X5r(e);if(e._getType()==="system")return eWr(e);if(e._getType()==="tool")return tWr(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var kEt=w(()=>{gs();DEt()});var Yre,$Et=w(()=>{gs();fx();Kre();Qd();gs();Sm();Km();AEt();gy();pB();Ec();kEt();Yre=class extends Js{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 yB({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=>dx(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=>dx(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=Hl(o,a.message):o=a.message;let i=new gn({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=FEt(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 qn({text:c.content,message:RAe(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 qn({text:c.content??"",message:RAe(c)}),await n?.handleLLMNewToken(c.content??"")}yield new qn({text:"",message:new dr({content:"",response_metadata:u,usage_metadata:a})})}withStructuredOutput(e,r){if(r?.method===void 0||r?.method==="jsonSchema"){let n=Gs(e),o=n?So(e):e,i=this.bind({format:o}),a=n?Tc.fromZodSchema(e):new Ac;if(!r?.includeRaw)return i.pipe(a);let s=go.assign({parsed:(c,d)=>a.invoke(c.raw,d)}),u=go.assign({parsed:()=>null}),l=s.withFallbacks({fallbacks:[u]});return bi.from([{raw:i},l])}else return super.withStructuredOutput(e,r)}}});var Zre,BEt=w(()=>{$O();Kre();Zre=class extends Jf{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 yB({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 qEt=w(()=>{});var UEt=w(()=>{Qd();jj();Kre()});var zEt=w(()=>{$Et();BEt();qEt();UEt()});var jAe=w(()=>{zEt()});var Xre,Qre,HEt,NAe=w(()=>{Xre="RFC3986",Qre={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},HEt="RFC1738"});function WEt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function LAe(t,e){if(rWr(t)){let r=[];for(let n=0;n{NAe();rWr=Array.isArray,hx=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),DAe=1024,VEt=(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=DAe?i.slice(s,s+DAe):i,l=[];for(let c=0;c=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===HEt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=hx[d];continue}if(d<2048){l[l.length]=hx[192|d>>6]+hx[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=hx[224|d>>12]+hx[128|d>>6&63]+hx[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=hx[240|d>>18]+hx[128|d>>12&63]+hx[128|d>>6&63]+hx[128|d&63]}a+=l.join("")}return a}});function aWr(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function YEt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,b,g){let y=t,S=g,x=0,O=!1;for(;(S=S.get(FAe))!==void 0&&!O;){let R=S.get(t);if(x+=1,typeof R<"u"){if(R===x)throw new RangeError("Cyclic object value");O=!0}typeof S.get(FAe)>"u"&&(x=0)}if(typeof l=="function"?y=l(e,y):y instanceof Date?y=f?.(y):r==="comma"&&gx(y)&&(y=LAe(y,function(R){return R instanceof Date?f?.(R):R})),y===null){if(i)return u&&!h?u(e,Nl.encoder,b,"key",p):e;y=""}if(aWr(y)||WEt(y)){if(u){let R=h?e:u(e,Nl.encoder,b,"key",p);return[m?.(R)+"="+m?.(u(y,Nl.encoder,b,"value",p))]}return[m?.(e)+"="+m?.(String(y))]}let P=[];if(typeof y>"u")return P;let E;if(r==="comma"&&gx(y))h&&u&&(y=LAe(y,u)),E=[{value:y.length>0?y.join(",")||null:void 0}];else if(gx(l))E=l;else{let R=Object.keys(y);E=c?R.sort(c):R}let A=s?String(e).replace(/\./g,"%2E"):String(e),I=n&&gx(y)&&y.length===1?A+"[]":A;if(o&&gx(y)&&y.length===0)return I+"[]";for(let R=0;R"u"?t.encodeDotInKeys?!0:Nl.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Nl.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Nl.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Nl.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Nl.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Nl.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Nl.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Nl.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Nl.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Nl.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Nl.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Nl.strictNullHandling}}function kAe(t,e={}){let r=t,n=sWr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):gx(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=GEt[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;f0?d+c:""}var nWr,GEt,gx,oWr,JEt,iWr,Nl,FAe,ZEt=w(()=>{KEt();NAe();nWr=Object.prototype.hasOwnProperty,GEt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},gx=Array.isArray,oWr=Array.prototype.push,JEt=function(t,e){oWr.apply(t,gx(e)?e:[e])},iWr=Date.prototype.toISOString,Nl={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:VEt,encodeValuesOnly:!1,format:Xre,formatter:Qre[Xre],indices:!1,serializeDate(t){return iWr.call(t)},skipNulls:!1,strictNullHandling:!1};FAe={}});var XEt=w(()=>{ZEt()});var qj,QEt=w(()=>{qj="4.95.1"});function tTt(t,e={auto:!1}){if(eTt)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(Uj)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${Uj}'\``);eTt=e.auto,Uj=t.kind,$Ae=t.fetch,lWr=t.Request,cWr=t.Response,dWr=t.Headers,BAe=t.FormData,fWr=t.Blob,ene=t.File,qAe=t.ReadableStream,UAe=t.getMultipartRequestOptions,zAe=t.getDefaultAgent,tne=t.fileFromPath,HAe=t.isFsReadStream}var eTt,Uj,$Ae,lWr,cWr,dWr,BAe,fWr,ene,qAe,UAe,zAe,tne,HAe,VAe=w(()=>{eTt=!1});var rne,rTt=w(()=>{rne=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function nTt({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 rne(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 oTt=w(()=>{rTt()});var iTt=w(()=>{oTt()});var WAe,l8=w(()=>{VAe();iTt();VAe();WAe=()=>{Uj||tTt(nTt(),{auto:!0})};WAe()});var vt,Ys,Li,BO,Xf,bB,_B,vB,wB,SB,xB,CB,OB,PB,EB,Kp=w(()=>{Vn();vt=class extends Error{},Ys=class t extends vt{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 BO({message:n,cause:nne(r)});let i=r?.error;return e===400?new bB(e,i,n,o):e===401?new _B(e,i,n,o):e===403?new vB(e,i,n,o):e===404?new wB(e,i,n,o):e===409?new SB(e,i,n,o):e===422?new xB(e,i,n,o):e===429?new CB(e,i,n,o):e>=500?new OB(e,i,n,o):new t(e,i,n,o)}},Li=class extends Ys{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},BO=class extends Ys{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Xf=class extends BO{constructor({message:e}={}){super({message:e??"Request timed out."})}},bB=class extends Ys{},_B=class extends Ys{},vB=class extends Ys{},wB=class extends Ys{},SB=class extends Ys{},xB=class extends Ys{},CB=class extends Ys{},OB=class extends Ys{},PB=class extends vt{constructor(){super("Could not parse response content as the length limit was reached")}},EB=class extends vt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}});function gWr(t,e){for(let o=e??0;o{Kp();one=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},zj=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)},Hj=class{constructor(){Gm.set(this,void 0),this.buffer=new Uint8Array,one(this,Gm,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=gWr(this.buffer,zj(this,Gm,"f")))!=null;){if(i.carriage&&zj(this,Gm,"f")==null){one(this,Gm,i.index,"f");continue}if(zj(this,Gm,"f")!=null&&(i.index!==zj(this,Gm,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,zj(this,Gm,"f")-1))),this.buffer=this.buffer.slice(zj(this,Gm,"f")),one(this,Gm,null,"f");continue}let a=zj(this,Gm,"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),one(this,Gm,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 vt(`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 vt(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new vt("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(` -`):[]}};Gm=new WeakMap;Hj.NEWLINE_CHARS=new Set([` -`,"\r"]);Hj.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function KAe(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 uTt=w(()=>{});async function*yWr(t,e){if(!t.body)throw e.abort(),new vt("Attempted to iterate over a response with no body");let r=new GAe,n=new Hj,o=KAe(t.body);for await(let i of bWr(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*bWr(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=aTt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function _Wr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var yx,GAe,ine=w(()=>{l8();Kp();sTt();uTt();Vn();Kp();yx=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 yWr(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 Ys(void 0,s.error,void 0,JAe(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 Ys(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 Hj,s=KAe(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 qAe({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?.()}})}};GAe=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]=_Wr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function XAe(t,e,r){if(t=await t,cTt(t))return t;if(lTt(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=c8(o)?[await o.arrayBuffer()]:[o];return new ene(i,e,r)}let n=await wWr(t);if(e||(e=xWr(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new ene(n,e,r)}async function wWr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(c8(t))e.push(await t.arrayBuffer());else if(CWr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${SWr(t)}`);return e}function SWr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function xWr(t){return YAe(t.name)||YAe(t.filename)||YAe(t.path)?.split(/[\\/]/).pop()}var lTt,cTt,c8,vWr,YAe,CWr,QAe,fg,dTt,ZAe,ane=w(()=>{l8();l8();lTt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",cTt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&c8(t),c8=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",vWr=t=>cTt(t)||lTt(t)||HAe(t);YAe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},CWr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",QAe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",fg=async t=>{let e=await dTt(t.body);return UAe(e,t)},dTt=async t=>{let e=new BAe;return await Promise.all(Object.entries(t||{}).map(([r,n])=>ZAe(e,r,n))),e},ZAe=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(vWr(r)){let n=await XAe(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>ZAe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>ZAe(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 yTt(t){let{response:e}=t;if(t.options.stream)return qO("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):yx.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 qO("response",e.status,e.url,e.headers,a),bTt(a,e)}let i=await e.text();return qO("response",e.status,e.url,e.headers,i),i}function bTt(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 IWr(){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 _Tt(t){if(!t)return!0;for(let e in t)return!1;return!0}function vTt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function hTt(t,e){for(let r in e){if(!vTt(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 qO(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)gTt.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)gTt.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}function TB(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var PWr,EWr,sne,lne,cne,d8,tIe,JAe,TWr,Jr,AWr,fTt,pTt,mTt,MWr,RWr,jWr,NWr,UO,eIe,nne,MA,gTt,DWr,wTt,LWr,une,STt,Vn=w(()=>{QEt();ine();Kp();l8();ane();ane();PWr=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},EWr=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)};WAe();lne=class t extends Promise{constructor(e,r=yTt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>bTt(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)}},cne=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=eIe("maxRetries",r),this.timeout=eIe("timeout",n),this.httpAgent=o,this.fetch=i??$Ae}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...MWr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${DWr()}`}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&&c8(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:QAe(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&&eIe("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??zAe(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 hTt(i,a),hTt(i,r),QAe(e.body)&&Uj!=="node"&&delete i["content-type"],une(a,"x-stainless-retry-count")===void 0&&une(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),une(a,"x-stainless-timeout")===void 0&&une(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 Ys.generate(e,r,n,o)}request(e,r=null){return new lne(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}),qO("request",a,n,i.headers),n.signal?.aborted)throw new Li;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(nne);if(l instanceof Error){if(n.signal?.aborted)throw new Li;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new Xf:new BO({cause:l})}let c=JAe(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let b=`retrying, ${r} attempts remaining`;return qO(`response (error; ${b})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(b=>nne(b).message),f=RWr(d),p=f?void 0:d;throw qO(`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 tIe(this,n,e)}buildURL(e,r){let n=NWr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return _Tt(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 vt(`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 UO(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 ${qj}`}},d8=class{constructor(e,r,n,o){sne.set(this,void 0),PWr(this,sne,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 vt("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 EWr(this,sne,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(sne=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},tIe=class extends lne{constructor(e,r,n){super(r,async o=>new n(e,o.response,await yTt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},JAe=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),TWr={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},Jr=t=>typeof t=="object"&&t!==null&&!_Tt(t)&&Object.keys(t).every(e=>vTt(TWr,e)),AWr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":qj,"X-Stainless-OS":pTt(Deno.build.os),"X-Stainless-Arch":fTt(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":qj,"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":qj,"X-Stainless-OS":pTt(process.platform),"X-Stainless-Arch":fTt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=IWr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":qj,"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":qj,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};fTt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",pTt=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"),MWr=()=>mTt??(mTt=AWr()),RWr=t=>{try{return JSON.parse(t)}catch{return}},jWr=/^[a-z][a-z0-9+.-]*:/i,NWr=t=>jWr.test(t),UO=t=>new Promise(e=>setTimeout(e,t)),eIe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new vt(`${t} must be an integer`);if(e<0)throw new vt(`${t} must be a positive integer`);return e},nne=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)},MA=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};gTt=new Set(["authorization","api-key"]);DWr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),wTt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",LWr=t=>typeof t?.get=="function",une=(t,e)=>{let r=e.toLowerCase();if(LWr(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},STt=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{Vn();bx=class extends d8{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}},no=class extends d8{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 tt,nn=w(()=>{tt=class{constructor(e){this._client=e}}});var AB,rIe=w(()=>{nn();Vn();f8();AB=class extends tt{list(e,r={},n){return Jr(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,dne,{query:r,...n})}}});var jA,NA,dne,f8=w(()=>{nn();Vn();rIe();rIe();nc();jA=class extends tt{constructor(){super(...arguments),this.messages=new AB(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 Jr(e)?this.list({},e):this._client.getAPIList("/chat/completions",NA,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},NA=class extends no{},dne=class extends no{};jA.ChatCompletionsPage=NA;jA.Messages=AB});var zO,nIe=w(()=>{nn();f8();f8();zO=class extends tt{constructor(){super(...arguments),this.completions=new jA(this._client)}};zO.Completions=jA;zO.ChatCompletionsPage=NA});var xTt=w(()=>{nIe()});var CTt=w(()=>{});var IB,oIe=w(()=>{nn();IB=class extends tt{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var MB,iIe=w(()=>{nn();Vn();MB=class extends tt{create(e,r){return this._client.post("/audio/transcriptions",fg({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}}});var RB,aIe=w(()=>{nn();Vn();RB=class extends tt{create(e,r){return this._client.post("/audio/translations",fg({body:e,...r,__metadata:{model:e.model}}))}}});var _x,sIe=w(()=>{nn();oIe();oIe();iIe();iIe();aIe();aIe();_x=class extends tt{constructor(){super(...arguments),this.transcriptions=new MB(this._client),this.translations=new RB(this._client),this.speech=new IB(this._client)}};_x.Transcriptions=MB;_x.Translations=RB;_x.Speech=IB});var DA,Vj,uIe=w(()=>{nn();Vn();nc();DA=class extends tt{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 Jr(e)?this.list({},e):this._client.getAPIList("/batches",Vj,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},Vj=class extends no{};DA.BatchesPage=Vj});var Wj,jB,lIe=w(()=>{nn();Vn();nc();Wj=class extends tt{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 Jr(e)?this.list({},e):this._client.getAPIList("/assistants",jB,{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}})}},jB=class extends no{};Wj.AssistantsPage=jB});function cIe(t){return typeof t.parse=="function"}var OTt=w(()=>{});var LA,dIe,fIe,pIe=w(()=>{LA=t=>t?.role==="assistant",dIe=t=>t?.role==="function",fIe=t=>t?.role==="tool"});var Ky,Ja,mIe,fne,pne,p8,m8,mne,h8,HO,g8,hne,gne,NB,PTt,FA,yne=w(()=>{Kp();Ky=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},Ja=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)},FA=class{constructor(){mIe.add(this),this.controller=new AbortController,fne.set(this,void 0),pne.set(this,()=>{}),p8.set(this,()=>{}),m8.set(this,void 0),mne.set(this,()=>{}),h8.set(this,()=>{}),HO.set(this,{}),g8.set(this,!1),hne.set(this,!1),gne.set(this,!1),NB.set(this,!1),Ky(this,fne,new Promise((e,r)=>{Ky(this,pne,e,"f"),Ky(this,p8,r,"f")}),"f"),Ky(this,m8,new Promise((e,r)=>{Ky(this,mne,e,"f"),Ky(this,h8,r,"f")}),"f"),Ja(this,fne,"f").catch(()=>{}),Ja(this,m8,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},Ja(this,mIe,"m",PTt).bind(this))},0)}_connected(){this.ended||(Ja(this,pne,"f").call(this),this._emit("connect"))}get ended(){return Ja(this,g8,"f")}get errored(){return Ja(this,hne,"f")}get aborted(){return Ja(this,gne,"f")}abort(){this.controller.abort()}on(e,r){return(Ja(this,HO,"f")[e]||(Ja(this,HO,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Ja(this,HO,"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(Ja(this,HO,"f")[e]||(Ja(this,HO,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Ky(this,NB,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Ky(this,NB,!0,"f"),await Ja(this,m8,"f")}_emit(e,...r){if(Ja(this,g8,"f"))return;e==="end"&&(Ky(this,g8,!0,"f"),Ja(this,mne,"f").call(this));let n=Ja(this,HO,"f")[e];if(n&&(Ja(this,HO,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Ja(this,NB,"f")&&!n?.length&&Promise.reject(o),Ja(this,p8,"f").call(this,o),Ja(this,h8,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Ja(this,NB,"f")&&!n?.length&&Promise.reject(o),Ja(this,p8,"f").call(this,o),Ja(this,h8,"f").call(this,o),this._emit("end")}}_emitFinal(){}};fne=new WeakMap,pne=new WeakMap,p8=new WeakMap,m8=new WeakMap,mne=new WeakMap,h8=new WeakMap,HO=new WeakMap,g8=new WeakMap,hne=new WeakMap,gne=new WeakMap,NB=new WeakMap,mIe=new WeakSet,PTt=function(e){if(Ky(this,hne,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Li),e instanceof Li)return Ky(this,gne,!0,"f"),this._emit("abort",e);if(e instanceof vt)return this._emit("error",e);if(e instanceof Error){let r=new vt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new vt(String(e)))}});function ETt(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function y8(t){return t?.$brand==="auto-parseable-response-format"}function TTt(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 Kj(t){return t?.$brand==="auto-parseable-tool"}function ATt(t,e){return!e||!hIe(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}}))}:b8(t,e)}function b8(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new PB;if(n.finish_reason==="content_filter")throw new EB;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>HWr(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?zWr(e,n.message.content):null}}});return{...t,choices:r}}function zWr(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 HWr(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:Kj(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function ITt(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return Kj(r)||r?.function.strict||!1}function hIe(t){return y8(t.response_format)?!0:t.tools?.some(e=>Kj(e)||e.type==="function"&&e.function.strict===!0)??!1}function MTt(t){for(let e of t??[]){if(e.type!=="function")throw new vt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new vt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var DB=w(()=>{Kp()});var Gp,tf,gIe,bne,yIe,bIe,_Ie,jTt,vIe,RTt,LB,wIe=w(()=>{Kp();OTt();pIe();yne();DB();Gp=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)},RTt=10,LB=class extends FA{constructor(){super(...arguments),tf.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),(dIe(e)||fIe(e))&&e.content)this._emit("functionCallResult",e.content);else if(LA(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(LA(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 vt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),Gp(this,tf,"m",gIe).call(this)}async finalMessage(){return await this.done(),Gp(this,tf,"m",bne).call(this)}async finalFunctionCall(){return await this.done(),Gp(this,tf,"m",yIe).call(this)}async finalFunctionCallResult(){return await this.done(),Gp(this,tf,"m",bIe).call(this)}async totalUsage(){return await this.done(),Gp(this,tf,"m",_Ie).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=Gp(this,tf,"m",bne).call(this);r&&this._emit("finalMessage",r);let n=Gp(this,tf,"m",gIe).call(this);n&&this._emit("finalContent",n);let o=Gp(this,tf,"m",yIe).call(this);o&&this._emit("finalFunctionCall",o);let i=Gp(this,tf,"m",bIe).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",Gp(this,tf,"m",_Ie).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Gp(this,tf,"m",jTt).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(b8(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=RTt}=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;fJSON.stringify(P.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:h,content:O});continue}let y;try{y=cIe(g)?await g.parse(b):b}catch(O){this._addMessage({role:o,name:h,content:O instanceof Error?O.message:String(O)});continue}let S=await g.function(y,this),x=Gp(this,tf,"m",vIe).call(this,S);if(this._addMessage({role:o,name:h,content:x}),u)return}}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i?.function?.name,{maxChatCompletions:l=RTt}=n||{},c=r.tools.map(p=>{if(Kj(p)){if(!p.$callback)throw new vt("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;pJSON.stringify(I)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:A});continue}let O;try{O=cIe(x)?await x.parse(S):S}catch(A){let I=A instanceof Error?A.message:String(A);this._addMessage({role:o,tool_call_id:g,content:I});continue}let P=await x.function(O,this),E=Gp(this,tf,"m",vIe).call(this,P);if(this._addMessage({role:o,tool_call_id:g,content:E}),u)return}}}};tf=new WeakSet,gIe=function(){return Gp(this,tf,"m",bne).call(this).content??null},bne=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(LA(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 vt("stream ended without producing a ChatCompletionMessage with role=assistant")},yIe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(LA(r)&&r?.function_call)return r.function_call;if(LA(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},bIe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(dIe(r)&&r.content!=null||fIe(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}},_Ie=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},jTt=function(e){if(e.n!=null&&e.n>1)throw new vt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},vIe=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var _8,NTt=w(()=>{wIe();pIe();_8=class t extends LB{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),LA(e)&&e.content&&this._emit("content",e.content)}}});function VWr(t,e=oc.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return WWr(t.trim(),e)}var oc,SIe,xIe,WWr,CIe,DTt=w(()=>{oc={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},SIe=class extends Error{},xIe=class extends Error{};WWr=(t,e)=>{let r=t.length,n=0,o=f=>{throw new SIe(`${f} at position ${n}`)},i=f=>{throw new xIe(`${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"||oc.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||oc.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||oc.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||oc.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||oc.MINUS_INFINITY&e&&1{let f=n,p=!1;for(n++;n{n++,d();let f={};try{for(;t[n]!=="}";){if(d(),n>=r&&oc.OBJ&e)return f;let p=s();d(),n++;try{let m=a();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(oc.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(oc.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(oc.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&oc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(oc.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&&!(oc.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&oc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;nVWr(t,oc.ALL^oc.NUM)});function KWr(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 vt(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:b,...g}=l,y=l.role;if(!y)throw new vt(`missing role for choice ${d}`);if(h){let{arguments:S,name:x}=h;if(S==null)throw new vt(`missing function_call.arguments for choice ${d}`);if(!x)throw new vt(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:S,name:x},role:y,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return b?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:y,content:m,refusal:l.refusal??null,tool_calls:b.map((S,x)=>{let{function:O,type:P,id:E,...A}=S,{arguments:I,name:R,...N}=O||{};if(E==null)throw new vt(`missing choices[${d}].tool_calls[${x}].id -${wne(t)}`);if(P==null)throw new vt(`missing choices[${d}].tool_calls[${x}].type -${wne(t)}`);if(R==null)throw new vt(`missing choices[${d}].tool_calls[${x}].function.name -${wne(t)}`);if(I==null)throw new vt(`missing choices[${d}].tool_calls[${x}].function.arguments -${wne(t)}`);return{...A,id:E,type:P,function:{...N,name:R,arguments:I}}})}}:{...p,message:{...g,content:m,role:y,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return ATt(u,e)}function wne(t){return JSON.stringify(t)}var FB,Ti,Dl,VO,kB,kA,OIe,_ne,PIe,EIe,TIe,vne,AIe,LTt,$B,IIe=w(()=>{Kp();wIe();ine();DB();DTt();FB=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},Ti=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)},$B=class t extends LB{constructor(e){super(),Dl.add(this),VO.set(this,void 0),kB.set(this,void 0),kA.set(this,void 0),FB(this,VO,e,"f"),FB(this,kB,[],"f")}get currentChatCompletionSnapshot(){return Ti(this,kA,"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())),Ti(this,Dl,"m",OIe).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)Ti(this,Dl,"m",PIe).call(this,a);if(i.controller.signal?.aborted)throw new Li;return this._addChatCompletion(Ti(this,Dl,"m",vne).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Ti(this,Dl,"m",OIe).call(this),this._connected();let o=yx.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(Ti(this,Dl,"m",vne).call(this)),Ti(this,Dl,"m",PIe).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Li;return this._addChatCompletion(Ti(this,Dl,"m",vne).call(this))}[(VO=new WeakMap,kB=new WeakMap,kA=new WeakMap,Dl=new WeakSet,OIe=function(){this.ended||FB(this,kA,void 0,"f")},_ne=function(r){let n=Ti(this,kB,"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},Ti(this,kB,"f")[r.index]=n,n)},PIe=function(r){if(this.ended)return;let n=Ti(this,Dl,"m",LTt).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=Ti(this,Dl,"m",_ne).call(this,i);i.finish_reason&&(Ti(this,Dl,"m",TIe).call(this,i),a.current_tool_call_index!=null&&Ti(this,Dl,"m",EIe).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(Ti(this,Dl,"m",TIe).call(this,i),a.current_tool_call_index!=null&&Ti(this,Dl,"m",EIe).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))}}},EIe=function(r,n){if(Ti(this,Dl,"m",_ne).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=Ti(this,VO,"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:Kj(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},TIe=function(r){let n=Ti(this,Dl,"m",_ne).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=Ti(this,Dl,"m",AIe).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}))},vne=function(){if(this.ended)throw new vt("stream has ended, this shouldn't happen");let r=Ti(this,kA,"f");if(!r)throw new vt("request ended without sending any chunks");return FB(this,kA,void 0,"f"),FB(this,kB,[],"f"),KWr(r,Ti(this,VO,"f"))},AIe=function(){let r=Ti(this,VO,"f")?.response_format;return y8(r)?r:null},LTt=function(r){var n,o,i,a;let s=Ti(this,kA,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=FB(this,kA,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=s.choices[f];if(h||(h=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:P,refusal:E,...A}=p;Object.assign(h.logprobs,A),P&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...P)),E&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...E))}if(d&&(h.finish_reason=d,Ti(this,VO,"f")&&hIe(Ti(this,VO,"f")))){if(d==="length")throw new PB;if(d==="content_filter")throw new EB}if(Object.assign(h,m),!c)continue;let{content:b,refusal:g,function_call:y,role:S,tool_calls:x,...O}=c;if(Object.assign(h.message,O),g&&(h.message.refusal=(h.message.refusal||"")+g),S&&(h.message.role=S),y&&(h.message.function_call?(y.name&&(h.message.function_call.name=y.name),y.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=y.arguments)):h.message.function_call=y),b&&(h.message.content=(h.message.content||"")+b,!h.message.refusal&&Ti(this,Dl,"m",AIe).call(this)&&(h.message.parsed=CIe(h.message.content))),x){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:P,id:E,type:A,function:I,...R}of x){let N=(a=h.message.tool_calls)[P]??(a[P]={});Object.assign(N,R),E&&(N.id=E),A&&(N.type=A),I&&(N.function??(N.function={name:I.name??"",arguments:""})),I?.name&&(N.function.name=I.name),I?.arguments&&(N.function.arguments+=I.arguments,ITt(Ti(this,VO,"f"),N)&&(N.function.parsed_arguments=CIe(N.function.arguments)))}}}return s},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new yx(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var v8,FTt=w(()=>{IIe();v8=class t extends $B{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 w8,kTt=w(()=>{nn();NTt();FTt();IIe();DB();w8=class extends tt{parse(e,r){return MTt(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>b8(n,e))}runFunctions(e,r){return e.stream?v8.runFunctions(this._client,e,r):_8.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?v8.runTools(this._client,e,r):_8.runTools(this._client,e,r)}stream(e,r){return $B.createChatCompletion(this._client,e,r)}}});var BB,$Tt=w(()=>{nn();kTt();BB=class extends tt{constructor(){super(...arguments),this.completions=new w8(this._client)}};(function(t){t.Completions=w8})(BB||(BB={}))});var qB,MIe=w(()=>{nn();qB=class extends tt{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var UB,RIe=w(()=>{nn();UB=class extends tt{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var $A,jIe=w(()=>{nn();MIe();MIe();RIe();RIe();$A=class extends tt{constructor(){super(...arguments),this.sessions=new qB(this._client),this.transcriptionSessions=new UB(this._client)}};$A.Sessions=qB;$A.TranscriptionSessions=UB});var Gt,Jm,Yc,NIe,vx,Sne,Gy,Jj,zB,Gj,One,Ym,xne,Cne,C8,S8,x8,BTt,qTt,UTt,zTt,HTt,VTt,WTt,wx,DIe=w(()=>{Vn();ine();Kp();yne();Gt=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)},Jm=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},wx=class t extends FA{constructor(){super(...arguments),Yc.add(this),NIe.set(this,[]),vx.set(this,{}),Sne.set(this,{}),Gy.set(this,void 0),Jj.set(this,void 0),zB.set(this,void 0),Gj.set(this,void 0),One.set(this,void 0),Ym.set(this,void 0),xne.set(this,void 0),Cne.set(this,void 0),C8.set(this,void 0)}[(NIe=new WeakMap,vx=new WeakMap,Sne=new WeakMap,Gy=new WeakMap,Jj=new WeakMap,zB=new WeakMap,Gj=new WeakMap,One=new WeakMap,Ym=new WeakMap,xne=new WeakMap,Cne=new WeakMap,C8=new WeakMap,Yc=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=yx.fromReadableStream(e,this.controller);for await(let i of o)Gt(this,Yc,"m",S8).call(this,i);if(o.controller.signal?.aborted)throw new Li;return this._addRun(Gt(this,Yc,"m",x8).call(this))}toReadableStream(){return new yx(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)Gt(this,Yc,"m",S8).call(this,l);if(u.controller.signal?.aborted)throw new Li;return this._addRun(Gt(this,Yc,"m",x8).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 Gt(this,xne,"f")}currentRun(){return Gt(this,Cne,"f")}currentMessageSnapshot(){return Gt(this,Gy,"f")}currentRunStepSnapshot(){return Gt(this,C8,"f")}async finalRunSteps(){return await this.done(),Object.values(Gt(this,vx,"f"))}async finalMessages(){return await this.done(),Object.values(Gt(this,Sne,"f"))}async finalRun(){if(await this.done(),!Gt(this,Jj,"f"))throw Error("Final run was not received.");return Gt(this,Jj,"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)Gt(this,Yc,"m",S8).call(this,s);if(a.controller.signal?.aborted)throw new Li;return this._addRun(Gt(this,Yc,"m",x8).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)Gt(this,Yc,"m",S8).call(this,u);if(s.controller.signal?.aborted)throw new Li;return this._addRun(Gt(this,Yc,"m",x8).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(TB(i)&&TB(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(!TB(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)}};S8=function(e){if(!this.ended)switch(Jm(this,xne,e,"f"),Gt(this,Yc,"m",UTt).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":Gt(this,Yc,"m",WTt).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":Gt(this,Yc,"m",qTt).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":Gt(this,Yc,"m",BTt).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},x8=function(){if(this.ended)throw new vt("stream has ended, this shouldn't happen");if(!Gt(this,Jj,"f"))throw Error("Final run has not been received");return Gt(this,Jj,"f")},BTt=function(e){let[r,n]=Gt(this,Yc,"m",HTt).call(this,e,Gt(this,Gy,"f"));Jm(this,Gy,r,"f"),Gt(this,Sne,"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!=Gt(this,zB,"f")){if(Gt(this,Gj,"f"))switch(Gt(this,Gj,"f").type){case"text":this._emit("textDone",Gt(this,Gj,"f").text,Gt(this,Gy,"f"));break;case"image_file":this._emit("imageFileDone",Gt(this,Gj,"f").image_file,Gt(this,Gy,"f"));break}Jm(this,zB,o.index,"f")}Jm(this,Gj,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(Gt(this,zB,"f")!==void 0){let o=e.data.content[Gt(this,zB,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,Gt(this,Gy,"f"));break;case"text":this._emit("textDone",o.text,Gt(this,Gy,"f"));break}}Gt(this,Gy,"f")&&this._emit("messageDone",e.data),Jm(this,Gy,void 0,"f")}},qTt=function(e){let r=Gt(this,Yc,"m",zTt).call(this,e);switch(Jm(this,C8,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==Gt(this,One,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(Gt(this,Ym,"f")&&this._emit("toolCallDone",Gt(this,Ym,"f")),Jm(this,One,i.index,"f"),Jm(this,Ym,r.step_details.tool_calls[i.index],"f"),Gt(this,Ym,"f")&&this._emit("toolCallCreated",Gt(this,Ym,"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":Jm(this,C8,void 0,"f"),e.data.step_details.type=="tool_calls"&&Gt(this,Ym,"f")&&(this._emit("toolCallDone",Gt(this,Ym,"f")),Jm(this,Ym,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},UTt=function(e){Gt(this,NIe,"f").push(e),this._emit("event",e)},zTt=function(e){switch(e.event){case"thread.run.step.created":return Gt(this,vx,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=Gt(this,vx,"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=wx.accumulateDelta(r,n.delta);Gt(this,vx,"f")[e.data.id]=o}return Gt(this,vx,"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":Gt(this,vx,"f")[e.data.id]=e.data;break}if(Gt(this,vx,"f")[e.data.id])return Gt(this,vx,"f")[e.data.id];throw new Error("No snapshot available")},HTt=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]=Gt(this,Yc,"m",VTt).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")},VTt=function(e,r){return wx.accumulateDelta(r,e)},WTt=function(e){switch(Jm(this,Cne,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":Jm(this,Jj,e.data,"f"),Gt(this,Ym,"f")&&(this._emit("toolCallDone",Gt(this,Ym,"f")),Jm(this,Ym,void 0,"f"));break;case"thread.run.cancelling":break}}});var Yj,HB,LIe=w(()=>{nn();Vn();nc();Yj=class extends tt{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 Jr(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,HB,{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}})}},HB=class extends no{};Yj.MessagesPage=HB});var Zj,VB,FIe=w(()=>{nn();Vn();nc();Zj=class extends tt{retrieve(e,r,n,o={},i){return Jr(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 Jr(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,VB,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},VB=class extends no{};Zj.RunStepsPage=VB});var WO,WB,kIe=w(()=>{nn();Vn();DIe();Vn();FIe();FIe();nc();WO=class extends tt{constructor(){super(...arguments),this.steps=new Zj(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 Jr(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,WB,{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 wx.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 UO(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return wx.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 wx.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},WB=class extends no{};WO.RunsPage=WB;WO.Steps=Zj;WO.RunStepsPage=VB});var Sx,$Ie=w(()=>{nn();Vn();DIe();LIe();LIe();kIe();kIe();Sx=class extends tt{constructor(){super(...arguments),this.runs=new WO(this._client),this.messages=new Yj(this._client)}create(e={},r){return Jr(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 wx.createThreadAssistantStream(e,this._client.beta.threads,r)}};Sx.Runs=WO;Sx.RunsPage=WB;Sx.Messages=Yj;Sx.MessagesPage=HB});var Jy,BIe=w(()=>{nn();lIe();$Tt();lIe();jIe();jIe();$Ie();$Ie();Jy=class extends tt{constructor(){super(...arguments),this.realtime=new $A(this._client),this.chat=new BB(this._client),this.assistants=new Wj(this._client),this.threads=new Sx(this._client)}};Jy.Realtime=$A;Jy.Assistants=Wj;Jy.AssistantsPage=jB;Jy.Threads=Sx});var Xj,qIe=w(()=>{nn();Xj=class extends tt{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var Qj,UIe=w(()=>{nn();Vn();Qj=class extends tt{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&qO("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(qO("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=STt(u)}),a)))}}});var eN,KB,zIe=w(()=>{nn();Vn();nc();eN=class extends tt{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return Jr(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,KB,{query:n,...o})}},KB=class extends no{};eN.OutputItemListResponsesPage=KB});var KO,GB,HIe=w(()=>{nn();Vn();zIe();zIe();nc();KO=class extends tt{constructor(){super(...arguments),this.outputItems=new eN(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 Jr(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,GB,{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)}},GB=class extends no{};KO.RunListResponsesPage=GB;KO.OutputItems=eN;KO.OutputItemListResponsesPage=KB});var xx,tN,VIe=w(()=>{nn();Vn();HIe();HIe();nc();xx=class extends tt{constructor(){super(...arguments),this.runs=new KO(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 Jr(e)?this.list({},e):this._client.getAPIList("/evals",tN,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},tN=class extends no{};xx.EvalListResponsesPage=tN;xx.Runs=KO;xx.RunListResponsesPage=GB});var BA,rN,WIe=w(()=>{nn();Vn();Vn();Kp();Vn();nc();BA=class extends tt{create(e,r){return this._client.post("/files",fg({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return Jr(e)?this.list({},e):this._client.getAPIList("/files",rN,{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 UO(r),a=await this.retrieve(e),Date.now()-i>n)throw new Xf({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},rN=class extends no{};BA.FileObjectsPage=rN});var nN,JB,KIe=w(()=>{nn();Vn();nc();nN=class extends tt{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,JB,{body:r,method:"post",...n})}retrieve(e,r={},n){return Jr(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)}},JB=class extends bx{};nN.PermissionCreateResponsesPage=JB});var qA,GIe=w(()=>{nn();KIe();KIe();qA=class extends tt{constructor(){super(...arguments),this.permissions=new nN(this._client)}};qA.Permissions=nN;qA.PermissionCreateResponsesPage=JB});var oN,YB,JIe=w(()=>{nn();Vn();nc();oN=class extends tt{list(e,r={},n){return Jr(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,YB,{query:r,...n})}},YB=class extends no{};oN.FineTuningJobCheckpointsPage=YB});var Cx,ZB,XB,YIe=w(()=>{nn();Vn();JIe();JIe();nc();Cx=class extends tt{constructor(){super(...arguments),this.checkpoints=new oN(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 Jr(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",ZB,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return Jr(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,XB,{query:r,...n})}},ZB=class extends no{},XB=class extends no{};Cx.FineTuningJobsPage=ZB;Cx.FineTuningJobEventsPage=XB;Cx.Checkpoints=oN;Cx.FineTuningJobCheckpointsPage=YB});var Yy,ZIe=w(()=>{nn();GIe();GIe();YIe();YIe();Yy=class extends tt{constructor(){super(...arguments),this.jobs=new Cx(this._client),this.checkpoints=new qA(this._client)}};Yy.Jobs=Cx;Yy.FineTuningJobsPage=ZB;Yy.FineTuningJobEventsPage=XB;Yy.Checkpoints=qA});var iN,XIe=w(()=>{nn();Vn();iN=class extends tt{createVariation(e,r){return this._client.post("/images/variations",fg({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",fg({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}}});var UA,aN,QIe=w(()=>{nn();nc();UA=class extends tt{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",aN,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},aN=class extends bx{};UA.ModelsPage=aN});var sN,eMe=w(()=>{nn();sN=class extends tt{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function KTt(t,e){return!e||!c9r(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)}:tMe(t,e)}function tMe(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:p9r(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:l9r(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||rMe(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 l9r(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function c9r(t){return!!y8(t.text?.format)}function d9r(t){return t?.$brand==="auto-parseable-tool"}function f9r(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function p9r(t,e){let r=f9r(t.tools??[],e.name);return{...e,...e,parsed_arguments:d9r(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function rMe(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 nMe=w(()=>{DB()});var QB,oMe=w(()=>{nn();Vn();Ene();QB=class extends tt{list(e,r={},n){return Jr(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,Pne,{query:r,...n})}}});function h9r(t,e){return KTt(t,e)}var eq,zA,tq,Tne,HA,Ane,GTt,JTt,YTt,ZTt,Ine,XTt=w(()=>{Kp();yne();nMe();eq=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},zA=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)},Ine=class t extends FA{constructor(e){super(),tq.add(this),Tne.set(this,void 0),HA.set(this,void 0),Ane.set(this,void 0),eq(this,Tne,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())),zA(this,tq,"m",GTt).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)zA(this,tq,"m",JTt).call(this,a);if(i.controller.signal?.aborted)throw new Li;return zA(this,tq,"m",YTt).call(this)}[(Tne=new WeakMap,HA=new WeakMap,Ane=new WeakMap,tq=new WeakSet,GTt=function(){this.ended||eq(this,HA,void 0,"f")},JTt=function(r){if(this.ended)return;let n=zA(this,tq,"m",ZTt).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 vt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new vt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new vt(`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 vt(`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}},YTt=function(){if(this.ended)throw new vt("stream has ended, this shouldn't happen");let r=zA(this,HA,"f");if(!r)throw new vt("request ended without sending any events");eq(this,HA,void 0,"f");let n=h9r(r,zA(this,Tne,"f"));return eq(this,Ane,n,"f"),n},ZTt=function(r){let n=zA(this,HA,"f");if(!n){if(r.type!=="response.created")throw new vt(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=eq(this,HA,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 vt(`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 vt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new vt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new vt(`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 vt(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{eq(this,HA,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=zA(this,Ane,"f");if(!e)throw new vt("stream ended without producing a ChatCompletion");return e}}});var VA,Pne,Ene=w(()=>{nMe();Vn();nn();oMe();oMe();XTt();nc();VA=class extends tt{constructor(){super(...arguments),this.inputItems=new QB(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"&&rMe(n),n))}retrieve(e,r={},n){return Jr(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=>tMe(n,e))}stream(e,r){return Ine.createResponse(this._client,e,r)}},Pne=class extends no{};VA.InputItems=QB});var rq,iMe=w(()=>{nn();Vn();rq=class extends tt{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,fg({body:r,...n}))}}});var WA,aMe=w(()=>{nn();iMe();iMe();WA=class extends tt{constructor(){super(...arguments),this.parts=new rq(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})}};WA.Parts=rq});var QTt,eAt=w(()=>{QTt=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 KA,GA,nq,Mne=w(()=>{nn();Vn();nc();KA=class extends tt{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 Jr(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,GA,{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 UO(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`,nq,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},GA=class extends no{},nq=class extends bx{};KA.VectorStoreFilesPage=GA;KA.FileContentResponsesPage=nq});var oq,sMe=w(()=>{nn();Vn();Vn();eAt();Mne();oq=class extends tt{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 Jr(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,GA,{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 UO(s);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,a=Math.min(i,r.length),s=this._client,u=r.values(),l=[...n];async function c(f){for(let p of f){let m=await s.files.create({file:p,purpose:"assistants"},o);l.push(m.id)}}let d=Array(a).fill(u).map(c);return await QTt(d),await this.createAndPoll(e,{file_ids:l})}}});var Zm,uN,lN,uMe=w(()=>{nn();Vn();sMe();sMe();Mne();Mne();nc();Zm=class extends tt{constructor(){super(...arguments),this.files=new KA(this._client),this.fileBatches=new oq(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 Jr(e)?this.list({},e):this._client.getAPIList("/vector_stores",uN,{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`,lN,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},uN=class extends no{},lN=class extends bx{};Zm.VectorStoresPage=uN;Zm.VectorStoreSearchResponsesPage=lN;Zm.Files=KA;Zm.VectorStoreFilesPage=GA;Zm.FileContentResponsesPage=nq;Zm.FileBatches=oq});var tAt=w(()=>{xTt();CTt();sIe();uIe();BIe();qIe();UIe();VIe();WIe();ZIe();XIe();QIe();eMe();Ene();aMe();uMe()});var nAt,Wt,Rne,v9r,rAt,pg=w(()=>{XEt();Vn();Kp();ane();tAt();uIe();qIe();UIe();WIe();XIe();QIe();eMe();sIe();BIe();nIe();VIe();ZIe();Ene();aMe();uMe();f8();Kp();Wt=class extends cne{constructor({baseURL:e=MA("OPENAI_BASE_URL"),apiKey:r=MA("OPENAI_API_KEY"),organization:n=MA("OPENAI_ORG_ID")??null,project:o=MA("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new vt("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&&wTt())throw new vt(`It looks like you're running in a browser-like environment. +`).filter(i=>i!==""))try{yield JSON.parse(o)}catch{console.warn("invalid json: ",o)}},Z5r=t=>{if(!t)return REt;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=MEt);let o=`${r.protocol}//${r.hostname}:${n}${r.pathname}`;return o.endsWith("/")&&(o=o.slice(0,-1)),o},X5r=Object.defineProperty,Q5r=(t,e,r)=>e in t?X5r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,EAe=(t,e,r)=>(Q5r(t,typeof e!="symbol"?e+"":e,r),r),bB=class{constructor(e){EAe(this,"config"),EAe(this,"fetch"),EAe(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=Z5r(e?.host??REt)),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 yB(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=Y5r(a.body),u=new AAe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await yB(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{Wb()});function NEt(t,e=0){return(Jc[t[e+0]]+Jc[t[e+1]]+Jc[t[e+2]]+Jc[t[e+3]]+"-"+Jc[t[e+4]]+Jc[t[e+5]]+"-"+Jc[t[e+6]]+Jc[t[e+7]]+"-"+Jc[t[e+8]]+Jc[t[e+9]]+"-"+Jc[t[e+10]]+Jc[t[e+11]]+Jc[t[e+12]]+Jc[t[e+13]]+Jc[t[e+14]]+Jc[t[e+15]]).toLowerCase()}var Jc,Jre,DEt=w(()=>{Jc=[];for(Jre=0;Jre<256;++Jre)Jc.push((Jre+256).toString(16).slice(1))});function RAe(){if(!Yre&&(Yre=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Yre))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Yre(eWr)}var Yre,eWr,LEt=w(()=>{eWr=new Uint8Array(16)});var tWr,jAe,FEt=w(()=>{tWr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),jAe={randomUUID:tWr}});function rWr(t,e,r){if(jAe.randomUUID&&!e&&!t)return jAe.randomUUID();t=t||{};var n=t.random||(t.rng||RAe)();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 NEt(n)}var NAe,kEt=w(()=>{FEt();LEt();DEt();NAe=rWr});var $Et=w(()=>{kEt()});function DAe(t,e){return new dr({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:NAe()})),response_metadata:e?.responseMetadata,usage_metadata:e?.usageMetadata})}function BEt(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function nWr(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 oWr(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:[BEt(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[BEt(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function iWr(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 aWr(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function qEt(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return oWr(e);if(e._getType()==="ai")return nWr(e);if(e._getType()==="system")return iWr(e);if(e._getType()==="tool")return aWr(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var UEt=w(()=>{gs();$Et()});var Zre,zEt=w(()=>{gs();fx();Gre();Qd();gs();Sm();Km();jEt();gy();mB();Ec();UEt();Zre=class extends Js{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 bB({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=>dx(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=>dx(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=Hl(o,a.message):o=a.message;let i=new gn({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=qEt(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 qn({text:c.content,message:DAe(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 qn({text:c.content??"",message:DAe(c)}),await n?.handleLLMNewToken(c.content??"")}yield new qn({text:"",message:new dr({content:"",response_metadata:u,usage_metadata:a})})}withStructuredOutput(e,r){if(r?.method===void 0||r?.method==="jsonSchema"){let n=Gs(e),o=n?So(e):e,i=this.bind({format:o}),a=n?Tc.fromZodSchema(e):new Ac;if(!r?.includeRaw)return i.pipe(a);let s=go.assign({parsed:(c,d)=>a.invoke(c.raw,d)}),u=go.assign({parsed:()=>null}),l=s.withFallbacks({fallbacks:[u]});return bi.from([{raw:i},l])}else return super.withStructuredOutput(e,r)}}});var Xre,HEt=w(()=>{BO();Gre();Xre=class extends Jf{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 bB({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 VEt=w(()=>{});var WEt=w(()=>{Qd();Nj();Gre()});var KEt=w(()=>{zEt();HEt();VEt();WEt()});var LAe=w(()=>{KEt()});var Qre,ene,GEt,FAe=w(()=>{Qre="RFC3986",ene={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},GEt="RFC1738"});function YEt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function $Ae(t,e){if(sWr(t)){let r=[];for(let n=0;n{FAe();sWr=Array.isArray,hx=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),kAe=1024,JEt=(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=kAe?i.slice(s,s+kAe):i,l=[];for(let c=0;c=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===GEt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=hx[d];continue}if(d<2048){l[l.length]=hx[192|d>>6]+hx[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=hx[224|d>>12]+hx[128|d>>6&63]+hx[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=hx[240|d>>18]+hx[128|d>>12&63]+hx[128|d>>6&63]+hx[128|d&63]}a+=l.join("")}return a}});function dWr(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function eTt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,b,g){let y=t,S=g,x=0,O=!1;for(;(S=S.get(BAe))!==void 0&&!O;){let R=S.get(t);if(x+=1,typeof R<"u"){if(R===x)throw new RangeError("Cyclic object value");O=!0}typeof S.get(BAe)>"u"&&(x=0)}if(typeof l=="function"?y=l(e,y):y instanceof Date?y=f?.(y):r==="comma"&&gx(y)&&(y=$Ae(y,function(R){return R instanceof Date?f?.(R):R})),y===null){if(i)return u&&!h?u(e,Nl.encoder,b,"key",p):e;y=""}if(dWr(y)||YEt(y)){if(u){let R=h?e:u(e,Nl.encoder,b,"key",p);return[m?.(R)+"="+m?.(u(y,Nl.encoder,b,"value",p))]}return[m?.(e)+"="+m?.(String(y))]}let P=[];if(typeof y>"u")return P;let E;if(r==="comma"&&gx(y))h&&u&&(y=$Ae(y,u)),E=[{value:y.length>0?y.join(",")||null:void 0}];else if(gx(l))E=l;else{let R=Object.keys(y);E=c?R.sort(c):R}let A=s?String(e).replace(/\./g,"%2E"):String(e),I=n&&gx(y)&&y.length===1?A+"[]":A;if(o&&gx(y)&&y.length===0)return I+"[]";for(let R=0;R"u"?t.encodeDotInKeys?!0:Nl.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Nl.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Nl.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Nl.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Nl.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Nl.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Nl.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Nl.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Nl.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Nl.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Nl.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Nl.strictNullHandling}}function qAe(t,e={}){let r=t,n=fWr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):gx(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=XEt[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;f0?d+c:""}var uWr,XEt,gx,lWr,QEt,cWr,Nl,BAe,tTt=w(()=>{ZEt();FAe();uWr=Object.prototype.hasOwnProperty,XEt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},gx=Array.isArray,lWr=Array.prototype.push,QEt=function(t,e){lWr.apply(t,gx(e)?e:[e])},cWr=Date.prototype.toISOString,Nl={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:JEt,encodeValuesOnly:!1,format:Qre,formatter:ene[Qre],indices:!1,serializeDate(t){return cWr.call(t)},skipNulls:!1,strictNullHandling:!1};BAe={}});var rTt=w(()=>{tTt()});var Uj,nTt=w(()=>{Uj="4.95.1"});function iTt(t,e={auto:!1}){if(oTt)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(zj)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${zj}'\``);oTt=e.auto,zj=t.kind,UAe=t.fetch,mWr=t.Request,hWr=t.Response,gWr=t.Headers,zAe=t.FormData,yWr=t.Blob,tne=t.File,HAe=t.ReadableStream,VAe=t.getMultipartRequestOptions,WAe=t.getDefaultAgent,rne=t.fileFromPath,KAe=t.isFsReadStream}var oTt,zj,UAe,mWr,hWr,gWr,zAe,yWr,tne,HAe,VAe,WAe,rne,KAe,GAe=w(()=>{oTt=!1});var nne,aTt=w(()=>{nne=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function sTt({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 nne(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 uTt=w(()=>{aTt()});var lTt=w(()=>{uTt()});var JAe,c8=w(()=>{GAe();lTt();GAe();JAe=()=>{zj||iTt(sTt(),{auto:!0})};JAe()});var vt,Ys,Li,qO,Xf,_B,vB,wB,SB,xB,CB,OB,PB,EB,TB,Kp=w(()=>{Vn();vt=class extends Error{},Ys=class t extends vt{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 qO({message:n,cause:one(r)});let i=r?.error;return e===400?new _B(e,i,n,o):e===401?new vB(e,i,n,o):e===403?new wB(e,i,n,o):e===404?new SB(e,i,n,o):e===409?new xB(e,i,n,o):e===422?new CB(e,i,n,o):e===429?new OB(e,i,n,o):e>=500?new PB(e,i,n,o):new t(e,i,n,o)}},Li=class extends Ys{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},qO=class extends Ys{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Xf=class extends qO{constructor({message:e}={}){super({message:e??"Request timed out."})}},_B=class extends Ys{},vB=class extends Ys{},wB=class extends Ys{},SB=class extends Ys{},xB=class extends Ys{},CB=class extends Ys{},OB=class extends Ys{},PB=class extends Ys{},EB=class extends vt{constructor(){super("Could not parse response content as the length limit was reached")}},TB=class extends vt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}});function wWr(t,e){for(let o=e??0;o{Kp();ine=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},Hj=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)},Vj=class{constructor(){Gm.set(this,void 0),this.buffer=new Uint8Array,ine(this,Gm,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=wWr(this.buffer,Hj(this,Gm,"f")))!=null;){if(i.carriage&&Hj(this,Gm,"f")==null){ine(this,Gm,i.index,"f");continue}if(Hj(this,Gm,"f")!=null&&(i.index!==Hj(this,Gm,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,Hj(this,Gm,"f")-1))),this.buffer=this.buffer.slice(Hj(this,Gm,"f")),ine(this,Gm,null,"f");continue}let a=Hj(this,Gm,"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),ine(this,Gm,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 vt(`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 vt(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new vt("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(` +`):[]}};Gm=new WeakMap;Vj.NEWLINE_CHARS=new Set([` +`,"\r"]);Vj.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function YAe(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 fTt=w(()=>{});async function*SWr(t,e){if(!t.body)throw e.abort(),new vt("Attempted to iterate over a response with no body");let r=new ZAe,n=new Vj,o=YAe(t.body);for await(let i of xWr(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*xWr(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=cTt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function CWr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var yx,ZAe,ane=w(()=>{c8();Kp();dTt();fTt();Vn();Kp();yx=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 SWr(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 Ys(void 0,s.error,void 0,XAe(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 Ys(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 Vj,s=YAe(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 HAe({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?.()}})}};ZAe=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]=CWr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function tIe(t,e,r){if(t=await t,mTt(t))return t;if(pTt(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=d8(o)?[await o.arrayBuffer()]:[o];return new tne(i,e,r)}let n=await PWr(t);if(e||(e=TWr(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new tne(n,e,r)}async function PWr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(d8(t))e.push(await t.arrayBuffer());else if(AWr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${EWr(t)}`);return e}function EWr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function TWr(t){return QAe(t.name)||QAe(t.filename)||QAe(t.path)?.split(/[\\/]/).pop()}var pTt,mTt,d8,OWr,QAe,AWr,rIe,fg,hTt,eIe,sne=w(()=>{c8();c8();pTt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",mTt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&d8(t),d8=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",OWr=t=>mTt(t)||pTt(t)||KAe(t);QAe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},AWr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",rIe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",fg=async t=>{let e=await hTt(t.body);return VAe(e,t)},hTt=async t=>{let e=new zAe;return await Promise.all(Object.entries(t||{}).map(([r,n])=>eIe(e,r,n))),e},eIe=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(OWr(r)){let n=await tIe(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>eIe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>eIe(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 wTt(t){let{response:e}=t;if(t.options.stream)return UO("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):yx.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 UO("response",e.status,e.url,e.headers,a),STt(a,e)}let i=await e.text();return UO("response",e.status,e.url,e.headers,i),i}function STt(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 DWr(){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 xTt(t){if(!t)return!0;for(let e in t)return!1;return!0}function CTt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _Tt(t,e){for(let r in e){if(!CTt(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 UO(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)vTt.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)vTt.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}function AB(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var MWr,RWr,une,cne,dne,f8,oIe,XAe,jWr,Jr,NWr,gTt,yTt,bTt,LWr,FWr,kWr,$Wr,zO,nIe,one,MA,vTt,BWr,OTt,qWr,lne,PTt,Vn=w(()=>{nTt();ane();Kp();c8();sne();sne();MWr=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},RWr=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)};JAe();cne=class t extends Promise{constructor(e,r=wTt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>STt(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)}},dne=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=nIe("maxRetries",r),this.timeout=nIe("timeout",n),this.httpAgent=o,this.fetch=i??UAe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...LWr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${BWr()}`}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&&d8(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:rIe(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&&nIe("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??WAe(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 _Tt(i,a),_Tt(i,r),rIe(e.body)&&zj!=="node"&&delete i["content-type"],lne(a,"x-stainless-retry-count")===void 0&&lne(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),lne(a,"x-stainless-timeout")===void 0&&lne(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 Ys.generate(e,r,n,o)}request(e,r=null){return new cne(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}),UO("request",a,n,i.headers),n.signal?.aborted)throw new Li;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(one);if(l instanceof Error){if(n.signal?.aborted)throw new Li;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new Xf:new qO({cause:l})}let c=XAe(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let b=`retrying, ${r} attempts remaining`;return UO(`response (error; ${b})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(b=>one(b).message),f=FWr(d),p=f?void 0:d;throw UO(`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 oIe(this,n,e)}buildURL(e,r){let n=$Wr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return xTt(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 vt(`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 zO(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 ${Uj}`}},f8=class{constructor(e,r,n,o){une.set(this,void 0),MWr(this,une,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 vt("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 RWr(this,une,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(une=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},oIe=class extends cne{constructor(e,r,n){super(r,async o=>new n(e,o.response,await wTt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},XAe=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),jWr={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},Jr=t=>typeof t=="object"&&t!==null&&!xTt(t)&&Object.keys(t).every(e=>CTt(jWr,e)),NWr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Uj,"X-Stainless-OS":yTt(Deno.build.os),"X-Stainless-Arch":gTt(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":Uj,"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":Uj,"X-Stainless-OS":yTt(process.platform),"X-Stainless-Arch":gTt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=DWr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Uj,"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":Uj,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};gTt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",yTt=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"),LWr=()=>bTt??(bTt=NWr()),FWr=t=>{try{return JSON.parse(t)}catch{return}},kWr=/^[a-z][a-z0-9+.-]*:/i,$Wr=t=>kWr.test(t),zO=t=>new Promise(e=>setTimeout(e,t)),nIe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new vt(`${t} must be an integer`);if(e<0)throw new vt(`${t} must be a positive integer`);return e},one=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)},MA=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};vTt=new Set(["authorization","api-key"]);BWr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),OTt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",qWr=t=>typeof t?.get=="function",lne=(t,e)=>{let r=e.toLowerCase();if(qWr(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},PTt=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{Vn();bx=class extends f8{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}},no=class extends f8{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 tt,nn=w(()=>{tt=class{constructor(e){this._client=e}}});var IB,iIe=w(()=>{nn();Vn();p8();IB=class extends tt{list(e,r={},n){return Jr(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,fne,{query:r,...n})}}});var jA,NA,fne,p8=w(()=>{nn();Vn();iIe();iIe();nc();jA=class extends tt{constructor(){super(...arguments),this.messages=new IB(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 Jr(e)?this.list({},e):this._client.getAPIList("/chat/completions",NA,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},NA=class extends no{},fne=class extends no{};jA.ChatCompletionsPage=NA;jA.Messages=IB});var HO,aIe=w(()=>{nn();p8();p8();HO=class extends tt{constructor(){super(...arguments),this.completions=new jA(this._client)}};HO.Completions=jA;HO.ChatCompletionsPage=NA});var ETt=w(()=>{aIe()});var TTt=w(()=>{});var MB,sIe=w(()=>{nn();MB=class extends tt{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var RB,uIe=w(()=>{nn();Vn();RB=class extends tt{create(e,r){return this._client.post("/audio/transcriptions",fg({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}}});var jB,lIe=w(()=>{nn();Vn();jB=class extends tt{create(e,r){return this._client.post("/audio/translations",fg({body:e,...r,__metadata:{model:e.model}}))}}});var _x,cIe=w(()=>{nn();sIe();sIe();uIe();uIe();lIe();lIe();_x=class extends tt{constructor(){super(...arguments),this.transcriptions=new RB(this._client),this.translations=new jB(this._client),this.speech=new MB(this._client)}};_x.Transcriptions=RB;_x.Translations=jB;_x.Speech=MB});var DA,Wj,dIe=w(()=>{nn();Vn();nc();DA=class extends tt{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 Jr(e)?this.list({},e):this._client.getAPIList("/batches",Wj,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},Wj=class extends no{};DA.BatchesPage=Wj});var Kj,NB,fIe=w(()=>{nn();Vn();nc();Kj=class extends tt{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 Jr(e)?this.list({},e):this._client.getAPIList("/assistants",NB,{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}})}},NB=class extends no{};Kj.AssistantsPage=NB});function pIe(t){return typeof t.parse=="function"}var ATt=w(()=>{});var LA,mIe,hIe,gIe=w(()=>{LA=t=>t?.role==="assistant",mIe=t=>t?.role==="function",hIe=t=>t?.role==="tool"});var Ky,Ja,yIe,pne,mne,m8,h8,hne,g8,VO,y8,gne,yne,DB,ITt,FA,bne=w(()=>{Kp();Ky=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},Ja=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)},FA=class{constructor(){yIe.add(this),this.controller=new AbortController,pne.set(this,void 0),mne.set(this,()=>{}),m8.set(this,()=>{}),h8.set(this,void 0),hne.set(this,()=>{}),g8.set(this,()=>{}),VO.set(this,{}),y8.set(this,!1),gne.set(this,!1),yne.set(this,!1),DB.set(this,!1),Ky(this,pne,new Promise((e,r)=>{Ky(this,mne,e,"f"),Ky(this,m8,r,"f")}),"f"),Ky(this,h8,new Promise((e,r)=>{Ky(this,hne,e,"f"),Ky(this,g8,r,"f")}),"f"),Ja(this,pne,"f").catch(()=>{}),Ja(this,h8,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},Ja(this,yIe,"m",ITt).bind(this))},0)}_connected(){this.ended||(Ja(this,mne,"f").call(this),this._emit("connect"))}get ended(){return Ja(this,y8,"f")}get errored(){return Ja(this,gne,"f")}get aborted(){return Ja(this,yne,"f")}abort(){this.controller.abort()}on(e,r){return(Ja(this,VO,"f")[e]||(Ja(this,VO,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Ja(this,VO,"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(Ja(this,VO,"f")[e]||(Ja(this,VO,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Ky(this,DB,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Ky(this,DB,!0,"f"),await Ja(this,h8,"f")}_emit(e,...r){if(Ja(this,y8,"f"))return;e==="end"&&(Ky(this,y8,!0,"f"),Ja(this,hne,"f").call(this));let n=Ja(this,VO,"f")[e];if(n&&(Ja(this,VO,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Ja(this,DB,"f")&&!n?.length&&Promise.reject(o),Ja(this,m8,"f").call(this,o),Ja(this,g8,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Ja(this,DB,"f")&&!n?.length&&Promise.reject(o),Ja(this,m8,"f").call(this,o),Ja(this,g8,"f").call(this,o),this._emit("end")}}_emitFinal(){}};pne=new WeakMap,mne=new WeakMap,m8=new WeakMap,h8=new WeakMap,hne=new WeakMap,g8=new WeakMap,VO=new WeakMap,y8=new WeakMap,gne=new WeakMap,yne=new WeakMap,DB=new WeakMap,yIe=new WeakSet,ITt=function(e){if(Ky(this,gne,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Li),e instanceof Li)return Ky(this,yne,!0,"f"),this._emit("abort",e);if(e instanceof vt)return this._emit("error",e);if(e instanceof Error){let r=new vt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new vt(String(e)))}});function MTt(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function b8(t){return t?.$brand==="auto-parseable-response-format"}function RTt(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 Gj(t){return t?.$brand==="auto-parseable-tool"}function jTt(t,e){return!e||!bIe(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}}))}:_8(t,e)}function _8(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new EB;if(n.finish_reason==="content_filter")throw new TB;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>JWr(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?GWr(e,n.message.content):null}}});return{...t,choices:r}}function GWr(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 JWr(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:Gj(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function NTt(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return Gj(r)||r?.function.strict||!1}function bIe(t){return b8(t.response_format)?!0:t.tools?.some(e=>Gj(e)||e.type==="function"&&e.function.strict===!0)??!1}function DTt(t){for(let e of t??[]){if(e.type!=="function")throw new vt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new vt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var LB=w(()=>{Kp()});var Gp,tf,_Ie,_ne,vIe,wIe,SIe,FTt,xIe,LTt,FB,CIe=w(()=>{Kp();ATt();gIe();bne();LB();Gp=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)},LTt=10,FB=class extends FA{constructor(){super(...arguments),tf.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),(mIe(e)||hIe(e))&&e.content)this._emit("functionCallResult",e.content);else if(LA(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(LA(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 vt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),Gp(this,tf,"m",_Ie).call(this)}async finalMessage(){return await this.done(),Gp(this,tf,"m",_ne).call(this)}async finalFunctionCall(){return await this.done(),Gp(this,tf,"m",vIe).call(this)}async finalFunctionCallResult(){return await this.done(),Gp(this,tf,"m",wIe).call(this)}async totalUsage(){return await this.done(),Gp(this,tf,"m",SIe).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=Gp(this,tf,"m",_ne).call(this);r&&this._emit("finalMessage",r);let n=Gp(this,tf,"m",_Ie).call(this);n&&this._emit("finalContent",n);let o=Gp(this,tf,"m",vIe).call(this);o&&this._emit("finalFunctionCall",o);let i=Gp(this,tf,"m",wIe).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",Gp(this,tf,"m",SIe).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Gp(this,tf,"m",FTt).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(_8(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=LTt}=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;fJSON.stringify(P.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:h,content:O});continue}let y;try{y=pIe(g)?await g.parse(b):b}catch(O){this._addMessage({role:o,name:h,content:O instanceof Error?O.message:String(O)});continue}let S=await g.function(y,this),x=Gp(this,tf,"m",xIe).call(this,S);if(this._addMessage({role:o,name:h,content:x}),u)return}}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i?.function?.name,{maxChatCompletions:l=LTt}=n||{},c=r.tools.map(p=>{if(Gj(p)){if(!p.$callback)throw new vt("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;pJSON.stringify(I)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:A});continue}let O;try{O=pIe(x)?await x.parse(S):S}catch(A){let I=A instanceof Error?A.message:String(A);this._addMessage({role:o,tool_call_id:g,content:I});continue}let P=await x.function(O,this),E=Gp(this,tf,"m",xIe).call(this,P);if(this._addMessage({role:o,tool_call_id:g,content:E}),u)return}}}};tf=new WeakSet,_Ie=function(){return Gp(this,tf,"m",_ne).call(this).content??null},_ne=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(LA(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 vt("stream ended without producing a ChatCompletionMessage with role=assistant")},vIe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(LA(r)&&r?.function_call)return r.function_call;if(LA(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},wIe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(mIe(r)&&r.content!=null||hIe(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}},SIe=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},FTt=function(e){if(e.n!=null&&e.n>1)throw new vt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},xIe=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var v8,kTt=w(()=>{CIe();gIe();v8=class t extends FB{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),LA(e)&&e.content&&this._emit("content",e.content)}}});function YWr(t,e=oc.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return ZWr(t.trim(),e)}var oc,OIe,PIe,ZWr,EIe,$Tt=w(()=>{oc={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},OIe=class extends Error{},PIe=class extends Error{};ZWr=(t,e)=>{let r=t.length,n=0,o=f=>{throw new OIe(`${f} at position ${n}`)},i=f=>{throw new PIe(`${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"||oc.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||oc.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||oc.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||oc.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||oc.MINUS_INFINITY&e&&1{let f=n,p=!1;for(n++;n{n++,d();let f={};try{for(;t[n]!=="}";){if(d(),n>=r&&oc.OBJ&e)return f;let p=s();d(),n++;try{let m=a();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(oc.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(oc.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(oc.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&oc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(oc.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&&!(oc.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&oc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;nYWr(t,oc.ALL^oc.NUM)});function XWr(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 vt(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:b,...g}=l,y=l.role;if(!y)throw new vt(`missing role for choice ${d}`);if(h){let{arguments:S,name:x}=h;if(S==null)throw new vt(`missing function_call.arguments for choice ${d}`);if(!x)throw new vt(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:S,name:x},role:y,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return b?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:y,content:m,refusal:l.refusal??null,tool_calls:b.map((S,x)=>{let{function:O,type:P,id:E,...A}=S,{arguments:I,name:R,...N}=O||{};if(E==null)throw new vt(`missing choices[${d}].tool_calls[${x}].id +${Sne(t)}`);if(P==null)throw new vt(`missing choices[${d}].tool_calls[${x}].type +${Sne(t)}`);if(R==null)throw new vt(`missing choices[${d}].tool_calls[${x}].function.name +${Sne(t)}`);if(I==null)throw new vt(`missing choices[${d}].tool_calls[${x}].function.arguments +${Sne(t)}`);return{...A,id:E,type:P,function:{...N,name:R,arguments:I}}})}}:{...p,message:{...g,content:m,role:y,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return jTt(u,e)}function Sne(t){return JSON.stringify(t)}var kB,Ti,Dl,WO,$B,kA,TIe,vne,AIe,IIe,MIe,wne,RIe,BTt,BB,jIe=w(()=>{Kp();CIe();ane();LB();$Tt();kB=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},Ti=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)},BB=class t extends FB{constructor(e){super(),Dl.add(this),WO.set(this,void 0),$B.set(this,void 0),kA.set(this,void 0),kB(this,WO,e,"f"),kB(this,$B,[],"f")}get currentChatCompletionSnapshot(){return Ti(this,kA,"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())),Ti(this,Dl,"m",TIe).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)Ti(this,Dl,"m",AIe).call(this,a);if(i.controller.signal?.aborted)throw new Li;return this._addChatCompletion(Ti(this,Dl,"m",wne).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Ti(this,Dl,"m",TIe).call(this),this._connected();let o=yx.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(Ti(this,Dl,"m",wne).call(this)),Ti(this,Dl,"m",AIe).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Li;return this._addChatCompletion(Ti(this,Dl,"m",wne).call(this))}[(WO=new WeakMap,$B=new WeakMap,kA=new WeakMap,Dl=new WeakSet,TIe=function(){this.ended||kB(this,kA,void 0,"f")},vne=function(r){let n=Ti(this,$B,"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},Ti(this,$B,"f")[r.index]=n,n)},AIe=function(r){if(this.ended)return;let n=Ti(this,Dl,"m",BTt).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=Ti(this,Dl,"m",vne).call(this,i);i.finish_reason&&(Ti(this,Dl,"m",MIe).call(this,i),a.current_tool_call_index!=null&&Ti(this,Dl,"m",IIe).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(Ti(this,Dl,"m",MIe).call(this,i),a.current_tool_call_index!=null&&Ti(this,Dl,"m",IIe).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))}}},IIe=function(r,n){if(Ti(this,Dl,"m",vne).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=Ti(this,WO,"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:Gj(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},MIe=function(r){let n=Ti(this,Dl,"m",vne).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=Ti(this,Dl,"m",RIe).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}))},wne=function(){if(this.ended)throw new vt("stream has ended, this shouldn't happen");let r=Ti(this,kA,"f");if(!r)throw new vt("request ended without sending any chunks");return kB(this,kA,void 0,"f"),kB(this,$B,[],"f"),XWr(r,Ti(this,WO,"f"))},RIe=function(){let r=Ti(this,WO,"f")?.response_format;return b8(r)?r:null},BTt=function(r){var n,o,i,a;let s=Ti(this,kA,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=kB(this,kA,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=s.choices[f];if(h||(h=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:P,refusal:E,...A}=p;Object.assign(h.logprobs,A),P&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...P)),E&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...E))}if(d&&(h.finish_reason=d,Ti(this,WO,"f")&&bIe(Ti(this,WO,"f")))){if(d==="length")throw new EB;if(d==="content_filter")throw new TB}if(Object.assign(h,m),!c)continue;let{content:b,refusal:g,function_call:y,role:S,tool_calls:x,...O}=c;if(Object.assign(h.message,O),g&&(h.message.refusal=(h.message.refusal||"")+g),S&&(h.message.role=S),y&&(h.message.function_call?(y.name&&(h.message.function_call.name=y.name),y.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=y.arguments)):h.message.function_call=y),b&&(h.message.content=(h.message.content||"")+b,!h.message.refusal&&Ti(this,Dl,"m",RIe).call(this)&&(h.message.parsed=EIe(h.message.content))),x){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:P,id:E,type:A,function:I,...R}of x){let N=(a=h.message.tool_calls)[P]??(a[P]={});Object.assign(N,R),E&&(N.id=E),A&&(N.type=A),I&&(N.function??(N.function={name:I.name??"",arguments:""})),I?.name&&(N.function.name=I.name),I?.arguments&&(N.function.arguments+=I.arguments,NTt(Ti(this,WO,"f"),N)&&(N.function.parsed_arguments=EIe(N.function.arguments)))}}}return s},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new yx(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var w8,qTt=w(()=>{jIe();w8=class t extends BB{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 S8,UTt=w(()=>{nn();kTt();qTt();jIe();LB();S8=class extends tt{parse(e,r){return DTt(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>_8(n,e))}runFunctions(e,r){return e.stream?w8.runFunctions(this._client,e,r):v8.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?w8.runTools(this._client,e,r):v8.runTools(this._client,e,r)}stream(e,r){return BB.createChatCompletion(this._client,e,r)}}});var qB,zTt=w(()=>{nn();UTt();qB=class extends tt{constructor(){super(...arguments),this.completions=new S8(this._client)}};(function(t){t.Completions=S8})(qB||(qB={}))});var UB,NIe=w(()=>{nn();UB=class extends tt{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var zB,DIe=w(()=>{nn();zB=class extends tt{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var $A,LIe=w(()=>{nn();NIe();NIe();DIe();DIe();$A=class extends tt{constructor(){super(...arguments),this.sessions=new UB(this._client),this.transcriptionSessions=new zB(this._client)}};$A.Sessions=UB;$A.TranscriptionSessions=zB});var Gt,Jm,Yc,FIe,vx,xne,Gy,Yj,HB,Jj,Pne,Ym,Cne,One,O8,x8,C8,HTt,VTt,WTt,KTt,GTt,JTt,YTt,wx,kIe=w(()=>{Vn();ane();Kp();bne();Gt=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)},Jm=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},wx=class t extends FA{constructor(){super(...arguments),Yc.add(this),FIe.set(this,[]),vx.set(this,{}),xne.set(this,{}),Gy.set(this,void 0),Yj.set(this,void 0),HB.set(this,void 0),Jj.set(this,void 0),Pne.set(this,void 0),Ym.set(this,void 0),Cne.set(this,void 0),One.set(this,void 0),O8.set(this,void 0)}[(FIe=new WeakMap,vx=new WeakMap,xne=new WeakMap,Gy=new WeakMap,Yj=new WeakMap,HB=new WeakMap,Jj=new WeakMap,Pne=new WeakMap,Ym=new WeakMap,Cne=new WeakMap,One=new WeakMap,O8=new WeakMap,Yc=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=yx.fromReadableStream(e,this.controller);for await(let i of o)Gt(this,Yc,"m",x8).call(this,i);if(o.controller.signal?.aborted)throw new Li;return this._addRun(Gt(this,Yc,"m",C8).call(this))}toReadableStream(){return new yx(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)Gt(this,Yc,"m",x8).call(this,l);if(u.controller.signal?.aborted)throw new Li;return this._addRun(Gt(this,Yc,"m",C8).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 Gt(this,Cne,"f")}currentRun(){return Gt(this,One,"f")}currentMessageSnapshot(){return Gt(this,Gy,"f")}currentRunStepSnapshot(){return Gt(this,O8,"f")}async finalRunSteps(){return await this.done(),Object.values(Gt(this,vx,"f"))}async finalMessages(){return await this.done(),Object.values(Gt(this,xne,"f"))}async finalRun(){if(await this.done(),!Gt(this,Yj,"f"))throw Error("Final run was not received.");return Gt(this,Yj,"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)Gt(this,Yc,"m",x8).call(this,s);if(a.controller.signal?.aborted)throw new Li;return this._addRun(Gt(this,Yc,"m",C8).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)Gt(this,Yc,"m",x8).call(this,u);if(s.controller.signal?.aborted)throw new Li;return this._addRun(Gt(this,Yc,"m",C8).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(AB(i)&&AB(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(!AB(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)}};x8=function(e){if(!this.ended)switch(Jm(this,Cne,e,"f"),Gt(this,Yc,"m",WTt).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":Gt(this,Yc,"m",YTt).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":Gt(this,Yc,"m",VTt).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":Gt(this,Yc,"m",HTt).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},C8=function(){if(this.ended)throw new vt("stream has ended, this shouldn't happen");if(!Gt(this,Yj,"f"))throw Error("Final run has not been received");return Gt(this,Yj,"f")},HTt=function(e){let[r,n]=Gt(this,Yc,"m",GTt).call(this,e,Gt(this,Gy,"f"));Jm(this,Gy,r,"f"),Gt(this,xne,"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!=Gt(this,HB,"f")){if(Gt(this,Jj,"f"))switch(Gt(this,Jj,"f").type){case"text":this._emit("textDone",Gt(this,Jj,"f").text,Gt(this,Gy,"f"));break;case"image_file":this._emit("imageFileDone",Gt(this,Jj,"f").image_file,Gt(this,Gy,"f"));break}Jm(this,HB,o.index,"f")}Jm(this,Jj,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(Gt(this,HB,"f")!==void 0){let o=e.data.content[Gt(this,HB,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,Gt(this,Gy,"f"));break;case"text":this._emit("textDone",o.text,Gt(this,Gy,"f"));break}}Gt(this,Gy,"f")&&this._emit("messageDone",e.data),Jm(this,Gy,void 0,"f")}},VTt=function(e){let r=Gt(this,Yc,"m",KTt).call(this,e);switch(Jm(this,O8,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==Gt(this,Pne,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(Gt(this,Ym,"f")&&this._emit("toolCallDone",Gt(this,Ym,"f")),Jm(this,Pne,i.index,"f"),Jm(this,Ym,r.step_details.tool_calls[i.index],"f"),Gt(this,Ym,"f")&&this._emit("toolCallCreated",Gt(this,Ym,"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":Jm(this,O8,void 0,"f"),e.data.step_details.type=="tool_calls"&&Gt(this,Ym,"f")&&(this._emit("toolCallDone",Gt(this,Ym,"f")),Jm(this,Ym,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},WTt=function(e){Gt(this,FIe,"f").push(e),this._emit("event",e)},KTt=function(e){switch(e.event){case"thread.run.step.created":return Gt(this,vx,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=Gt(this,vx,"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=wx.accumulateDelta(r,n.delta);Gt(this,vx,"f")[e.data.id]=o}return Gt(this,vx,"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":Gt(this,vx,"f")[e.data.id]=e.data;break}if(Gt(this,vx,"f")[e.data.id])return Gt(this,vx,"f")[e.data.id];throw new Error("No snapshot available")},GTt=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]=Gt(this,Yc,"m",JTt).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")},JTt=function(e,r){return wx.accumulateDelta(r,e)},YTt=function(e){switch(Jm(this,One,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":Jm(this,Yj,e.data,"f"),Gt(this,Ym,"f")&&(this._emit("toolCallDone",Gt(this,Ym,"f")),Jm(this,Ym,void 0,"f"));break;case"thread.run.cancelling":break}}});var Zj,VB,$Ie=w(()=>{nn();Vn();nc();Zj=class extends tt{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 Jr(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,VB,{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}})}},VB=class extends no{};Zj.MessagesPage=VB});var Xj,WB,BIe=w(()=>{nn();Vn();nc();Xj=class extends tt{retrieve(e,r,n,o={},i){return Jr(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 Jr(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,WB,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},WB=class extends no{};Xj.RunStepsPage=WB});var KO,KB,qIe=w(()=>{nn();Vn();kIe();Vn();BIe();BIe();nc();KO=class extends tt{constructor(){super(...arguments),this.steps=new Xj(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 Jr(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,KB,{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 wx.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 zO(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return wx.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 wx.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},KB=class extends no{};KO.RunsPage=KB;KO.Steps=Xj;KO.RunStepsPage=WB});var Sx,UIe=w(()=>{nn();Vn();kIe();$Ie();$Ie();qIe();qIe();Sx=class extends tt{constructor(){super(...arguments),this.runs=new KO(this._client),this.messages=new Zj(this._client)}create(e={},r){return Jr(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 wx.createThreadAssistantStream(e,this._client.beta.threads,r)}};Sx.Runs=KO;Sx.RunsPage=KB;Sx.Messages=Zj;Sx.MessagesPage=VB});var Jy,zIe=w(()=>{nn();fIe();zTt();fIe();LIe();LIe();UIe();UIe();Jy=class extends tt{constructor(){super(...arguments),this.realtime=new $A(this._client),this.chat=new qB(this._client),this.assistants=new Kj(this._client),this.threads=new Sx(this._client)}};Jy.Realtime=$A;Jy.Assistants=Kj;Jy.AssistantsPage=NB;Jy.Threads=Sx});var Qj,HIe=w(()=>{nn();Qj=class extends tt{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var eN,VIe=w(()=>{nn();Vn();eN=class extends tt{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&UO("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(UO("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=PTt(u)}),a)))}}});var tN,GB,WIe=w(()=>{nn();Vn();nc();tN=class extends tt{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return Jr(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,GB,{query:n,...o})}},GB=class extends no{};tN.OutputItemListResponsesPage=GB});var GO,JB,KIe=w(()=>{nn();Vn();WIe();WIe();nc();GO=class extends tt{constructor(){super(...arguments),this.outputItems=new tN(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 Jr(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,JB,{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)}},JB=class extends no{};GO.RunListResponsesPage=JB;GO.OutputItems=tN;GO.OutputItemListResponsesPage=GB});var xx,rN,GIe=w(()=>{nn();Vn();KIe();KIe();nc();xx=class extends tt{constructor(){super(...arguments),this.runs=new GO(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 Jr(e)?this.list({},e):this._client.getAPIList("/evals",rN,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},rN=class extends no{};xx.EvalListResponsesPage=rN;xx.Runs=GO;xx.RunListResponsesPage=JB});var BA,nN,JIe=w(()=>{nn();Vn();Vn();Kp();Vn();nc();BA=class extends tt{create(e,r){return this._client.post("/files",fg({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return Jr(e)?this.list({},e):this._client.getAPIList("/files",nN,{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 zO(r),a=await this.retrieve(e),Date.now()-i>n)throw new Xf({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},nN=class extends no{};BA.FileObjectsPage=nN});var oN,YB,YIe=w(()=>{nn();Vn();nc();oN=class extends tt{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,YB,{body:r,method:"post",...n})}retrieve(e,r={},n){return Jr(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)}},YB=class extends bx{};oN.PermissionCreateResponsesPage=YB});var qA,ZIe=w(()=>{nn();YIe();YIe();qA=class extends tt{constructor(){super(...arguments),this.permissions=new oN(this._client)}};qA.Permissions=oN;qA.PermissionCreateResponsesPage=YB});var iN,ZB,XIe=w(()=>{nn();Vn();nc();iN=class extends tt{list(e,r={},n){return Jr(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,ZB,{query:r,...n})}},ZB=class extends no{};iN.FineTuningJobCheckpointsPage=ZB});var Cx,XB,QB,QIe=w(()=>{nn();Vn();XIe();XIe();nc();Cx=class extends tt{constructor(){super(...arguments),this.checkpoints=new iN(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 Jr(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",XB,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return Jr(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,QB,{query:r,...n})}},XB=class extends no{},QB=class extends no{};Cx.FineTuningJobsPage=XB;Cx.FineTuningJobEventsPage=QB;Cx.Checkpoints=iN;Cx.FineTuningJobCheckpointsPage=ZB});var Yy,eMe=w(()=>{nn();ZIe();ZIe();QIe();QIe();Yy=class extends tt{constructor(){super(...arguments),this.jobs=new Cx(this._client),this.checkpoints=new qA(this._client)}};Yy.Jobs=Cx;Yy.FineTuningJobsPage=XB;Yy.FineTuningJobEventsPage=QB;Yy.Checkpoints=qA});var aN,tMe=w(()=>{nn();Vn();aN=class extends tt{createVariation(e,r){return this._client.post("/images/variations",fg({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",fg({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}}});var UA,sN,rMe=w(()=>{nn();nc();UA=class extends tt{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",sN,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},sN=class extends bx{};UA.ModelsPage=sN});var uN,nMe=w(()=>{nn();uN=class extends tt{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function ZTt(t,e){return!e||!h9r(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)}:oMe(t,e)}function oMe(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:b9r(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:m9r(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||iMe(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 m9r(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function h9r(t){return!!b8(t.text?.format)}function g9r(t){return t?.$brand==="auto-parseable-tool"}function y9r(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function b9r(t,e){let r=y9r(t.tools??[],e.name);return{...e,...e,parsed_arguments:g9r(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function iMe(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 aMe=w(()=>{LB()});var eq,sMe=w(()=>{nn();Vn();Tne();eq=class extends tt{list(e,r={},n){return Jr(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,Ene,{query:r,...n})}}});function v9r(t,e){return ZTt(t,e)}var tq,zA,rq,Ane,HA,Ine,XTt,QTt,eAt,tAt,Mne,rAt=w(()=>{Kp();bne();aMe();tq=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},zA=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)},Mne=class t extends FA{constructor(e){super(),rq.add(this),Ane.set(this,void 0),HA.set(this,void 0),Ine.set(this,void 0),tq(this,Ane,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())),zA(this,rq,"m",XTt).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)zA(this,rq,"m",QTt).call(this,a);if(i.controller.signal?.aborted)throw new Li;return zA(this,rq,"m",eAt).call(this)}[(Ane=new WeakMap,HA=new WeakMap,Ine=new WeakMap,rq=new WeakSet,XTt=function(){this.ended||tq(this,HA,void 0,"f")},QTt=function(r){if(this.ended)return;let n=zA(this,rq,"m",tAt).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 vt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new vt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new vt(`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 vt(`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}},eAt=function(){if(this.ended)throw new vt("stream has ended, this shouldn't happen");let r=zA(this,HA,"f");if(!r)throw new vt("request ended without sending any events");tq(this,HA,void 0,"f");let n=v9r(r,zA(this,Ane,"f"));return tq(this,Ine,n,"f"),n},tAt=function(r){let n=zA(this,HA,"f");if(!n){if(r.type!=="response.created")throw new vt(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=tq(this,HA,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 vt(`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 vt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new vt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new vt(`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 vt(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{tq(this,HA,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=zA(this,Ine,"f");if(!e)throw new vt("stream ended without producing a ChatCompletion");return e}}});var VA,Ene,Tne=w(()=>{aMe();Vn();nn();sMe();sMe();rAt();nc();VA=class extends tt{constructor(){super(...arguments),this.inputItems=new eq(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"&&iMe(n),n))}retrieve(e,r={},n){return Jr(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=>oMe(n,e))}stream(e,r){return Mne.createResponse(this._client,e,r)}},Ene=class extends no{};VA.InputItems=eq});var nq,uMe=w(()=>{nn();Vn();nq=class extends tt{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,fg({body:r,...n}))}}});var WA,lMe=w(()=>{nn();uMe();uMe();WA=class extends tt{constructor(){super(...arguments),this.parts=new nq(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})}};WA.Parts=nq});var nAt,oAt=w(()=>{nAt=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 KA,GA,oq,Rne=w(()=>{nn();Vn();nc();KA=class extends tt{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 Jr(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,GA,{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 zO(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`,oq,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},GA=class extends no{},oq=class extends bx{};KA.VectorStoreFilesPage=GA;KA.FileContentResponsesPage=oq});var iq,cMe=w(()=>{nn();Vn();Vn();oAt();Rne();iq=class extends tt{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 Jr(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,GA,{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 zO(s);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,a=Math.min(i,r.length),s=this._client,u=r.values(),l=[...n];async function c(f){for(let p of f){let m=await s.files.create({file:p,purpose:"assistants"},o);l.push(m.id)}}let d=Array(a).fill(u).map(c);return await nAt(d),await this.createAndPoll(e,{file_ids:l})}}});var Zm,lN,cN,dMe=w(()=>{nn();Vn();cMe();cMe();Rne();Rne();nc();Zm=class extends tt{constructor(){super(...arguments),this.files=new KA(this._client),this.fileBatches=new iq(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 Jr(e)?this.list({},e):this._client.getAPIList("/vector_stores",lN,{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`,cN,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},lN=class extends no{},cN=class extends bx{};Zm.VectorStoresPage=lN;Zm.VectorStoreSearchResponsesPage=cN;Zm.Files=KA;Zm.VectorStoreFilesPage=GA;Zm.FileContentResponsesPage=oq;Zm.FileBatches=iq});var iAt=w(()=>{ETt();TTt();cIe();dIe();zIe();HIe();VIe();GIe();JIe();eMe();tMe();rMe();nMe();Tne();lMe();dMe()});var sAt,Wt,jne,O9r,aAt,pg=w(()=>{rTt();Vn();Kp();sne();iAt();dIe();HIe();VIe();JIe();tMe();rMe();nMe();cIe();zIe();aIe();GIe();eMe();Tne();lMe();dMe();p8();Kp();Wt=class extends dne{constructor({baseURL:e=MA("OPENAI_BASE_URL"),apiKey:r=MA("OPENAI_API_KEY"),organization:n=MA("OPENAI_ORG_ID")??null,project:o=MA("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new vt("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&&OTt())throw new vt(`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, @@ -291,36 +291,36 @@ 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 Xj(this),this.chat=new zO(this),this.embeddings=new Qj(this),this.files=new BA(this),this.images=new iN(this),this.audio=new _x(this),this.moderations=new sN(this),this.models=new UA(this),this.fineTuning=new Yy(this),this.vectorStores=new Zm(this),this.beta=new Jy(this),this.batches=new DA(this),this.uploads=new WA(this),this.responses=new VA(this),this.evals=new xx(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 kAe(e,{arrayFormat:"brackets"})}};nAt=Wt;Wt.OpenAI=nAt;Wt.DEFAULT_TIMEOUT=6e5;Wt.OpenAIError=vt;Wt.APIError=Ys;Wt.APIConnectionError=BO;Wt.APIConnectionTimeoutError=Xf;Wt.APIUserAbortError=Li;Wt.NotFoundError=wB;Wt.ConflictError=SB;Wt.RateLimitError=CB;Wt.BadRequestError=bB;Wt.AuthenticationError=_B;Wt.InternalServerError=OB;Wt.PermissionDeniedError=vB;Wt.UnprocessableEntityError=xB;Wt.toFile=XAe;Wt.fileFromPath=tne;Wt.Completions=Xj;Wt.Chat=zO;Wt.ChatCompletionsPage=NA;Wt.Embeddings=Qj;Wt.Files=BA;Wt.FileObjectsPage=rN;Wt.Images=iN;Wt.Audio=_x;Wt.Moderations=sN;Wt.Models=UA;Wt.ModelsPage=aN;Wt.FineTuning=Yy;Wt.VectorStores=Zm;Wt.VectorStoresPage=uN;Wt.VectorStoreSearchResponsesPage=lN;Wt.Beta=Jy;Wt.Batches=DA;Wt.BatchesPage=Vj;Wt.Uploads=WA;Wt.Responses=VA;Wt.Evals=xx;Wt.EvalListResponsesPage=tN;Rne=class extends Wt{constructor({baseURL:e=MA("OPENAI_BASE_URL"),apiKey:r=MA("AZURE_OPENAI_API_KEY"),apiVersion:n=MA("OPENAI_API_VERSION"),endpoint:o,deployment:i,azureADTokenProvider:a,dangerouslyAllowBrowser:s,...u}={}){if(!n)throw new vt("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 vt("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(a&&r)throw new vt("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(r??(r=rAt),u.defaultQuery={...u.defaultQuery,"api-version":n},e){if(o)throw new vt("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new vt("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");e=`${o}/openai`}super({apiKey:r,baseURL:e,...u,...s!==void 0?{dangerouslyAllowBrowser:s}:{}}),this.apiVersion="",this._azureADTokenProvider=a,this.apiVersion=n,this.deploymentName=i}buildRequest(e,r={}){if(v9r.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!TB(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 vt(`Expected 'azureADTokenProvider' argument to return a string but it returned ${e}`);return e}}authHeaders(e){return{}}async prepareOptions(e){if(e.headers?.["api-key"])return super.prepareOptions(e);let r=await this._getAzureADToken();if(e.headers??(e.headers={}),r)e.headers.Authorization=`Bearer ${r}`;else if(this.apiKey!==rAt)e.headers["api-key"]=this.apiKey;else throw new vt("Unable to handle auth");return super.prepareOptions(e)}},v9r=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations"]),rAt=""});function Jp(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=WL(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new vm([`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 Ox(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 Xm(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var lMe,Zc,oAt=w(()=>{eF();hhe();$E();SR();lMe=class extends AR{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(Oi(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=>Jp(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}},Zc=class extends lMe{static lc_name(){return"JsonOutputKeyToolsParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","openai_tools"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;let r=await this.zodSchema.safeParseAsync(e);if(r.success)return r.data;throw new vm(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error.errors)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let n=(await super.parsePartialResult(e)).filter(i=>i.type===this.keyName),o=n;if(n.length)return this.returnId||(o=n.map(i=>i.args)),this.returnSingle?o[0]:o}async parseResult(e){let n=(await super.parsePartialResult(e,!1)).filter(a=>a.type===this.keyName),o=n;return n.length?(this.returnId||(o=n.map(a=>a.args)),this.returnSingle?this._validateResult(o[0]):await Promise.all(o.map(a=>this._validateResult(a)))):void 0}}});var iAt=w(()=>{oAt()});var iq=w(()=>{iAt()});var sAt,aAt,uAt,jne=w(()=>{sAt=Symbol("Let zodToJsonSchema decide on which parser to use"),aAt={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"},uAt=t=>typeof t=="string"?{...aAt,basePath:["#"],definitions:{},name:t}:{...aAt,basePath:["#"],definitions:{},...t}});function lAt(t){if(!t)return!0;for(let e in t)return!1;return!0}var O8,cMe=w(()=>{O8=t=>"_def"in t?t._def:t});var cAt,dMe=w(()=>{jne();cMe();cAt=t=>{let e=uAt(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])=>[O8(o),{def:O8(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function fMe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Wn(t,e,r,n,o){t[e]=r,fMe(t,e,n,o)}var JA=w(()=>{});function dAt(){return{}}var pMe=w(()=>{});function fAt(t,e){let r={type:"array"};return t.type?._def?.typeName!==de.ZodAny&&(r.items=pr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Wn(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Wn(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Wn(r,"minItems",t.exactLength.value,t.exactLength.message,e),Wn(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var mMe=w(()=>{Td();JA();Zs()});function pAt(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?Wn(r,"minimum",n.value,n.message,e):Wn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Wn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Wn(r,"maximum",n.value,n.message,e):Wn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Wn(r,"maximum",n.value,n.message,e));break;case"multipleOf":Wn(r,"multipleOf",n.value,n.message,e);break}return r}var hMe=w(()=>{JA()});function mAt(){return{type:"boolean"}}var gMe=w(()=>{});function hAt(t,e){return pr(t.type._def,e)}var yMe=w(()=>{Zs()});var gAt,bMe=w(()=>{Zs();gAt=(t,e)=>pr(t.innerType._def,e)});function _Me(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>_Me(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 w9r(t,e)}}var w9r,vMe=w(()=>{JA();w9r=(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":Wn(r,"minimum",n.value,n.message,e);break;case"max":Wn(r,"maximum",n.value,n.message,e);break}return r}});function yAt(t,e){return{...pr(t.innerType._def,e),default:t.defaultValue()}}var wMe=w(()=>{Zs()});function bAt(t,e,r){return e.effectStrategy==="input"?pr(t.schema._def,e,r):{}}var SMe=w(()=>{Zs()});function _At(t){return{type:"string",enum:[...t.values]}}var xMe=w(()=>{});function vAt(t,e){let r=[pr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),pr(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(S9r(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 S9r,CMe=w(()=>{Zs();S9r=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function wAt(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 OMe=w(()=>{});function Nne(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?x9r(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":Wn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":Wn(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":Zy(r,"email",o.message,e);break;case"format:idn-email":Zy(r,"idn-email",o.message,e);break;case"pattern:zod":Xy(r,cN.email,o.message,e);break}break;case"url":Zy(r,"uri",o.message,e);break;case"uuid":Zy(r,"uuid",o.message,e);break;case"regex":Xy(r,o.regex,o.message,e);break;case"cuid":Xy(r,cN.cuid,o.message,e);break;case"cuid2":Xy(r,cN.cuid2,o.message,e);break;case"startsWith":Xy(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":Xy(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":Zy(r,"date-time",o.message,e);break;case"date":Zy(r,"date",o.message,e);break;case"time":Zy(r,"time",o.message,e);break;case"duration":Zy(r,"duration",o.message,e);break;case"length":Wn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),Wn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{Xy(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&Zy(r,"ipv4",o.message,e),o.version!=="v4"&&Zy(r,"ipv6",o.message,e);break}case"emoji":Xy(r,cN.emoji,o.message,e);break;case"ulid":{Xy(r,cN.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Zy(r,"binary",o.message,e);break}case"contentEncoding:base64":{Wn(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{Xy(r,cN.base64,o.message,e);break}}break}case"nanoid":Xy(r,cN.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var PMe,cN,x9r,Zy,Xy,SAt,Dne=w(()=>{JA();cN={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:()=>(PMe===void 0&&(PMe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),PMe),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}$/};x9r=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),Zy=(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}}})):Wn(t,"format",e,r,n)},Xy=(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:SAt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Wn(t,"pattern",SAt(e,n),r,n)},SAt=(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{tF();bhe();$E();SR();fMe=class extends AR{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(Oi(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=>Jp(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}},Zc=class extends fMe{static lc_name(){return"JsonOutputKeyToolsParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","openai_tools"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;let r=await this.zodSchema.safeParseAsync(e);if(r.success)return r.data;throw new vm(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error.errors)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let n=(await super.parsePartialResult(e)).filter(i=>i.type===this.keyName),o=n;if(n.length)return this.returnId||(o=n.map(i=>i.args)),this.returnSingle?o[0]:o}async parseResult(e){let n=(await super.parsePartialResult(e,!1)).filter(a=>a.type===this.keyName),o=n;return n.length?(this.returnId||(o=n.map(a=>a.args)),this.returnSingle?this._validateResult(o[0]):await Promise.all(o.map(a=>this._validateResult(a)))):void 0}}});var lAt=w(()=>{uAt()});var aq=w(()=>{lAt()});var dAt,cAt,fAt,Nne=w(()=>{dAt=Symbol("Let zodToJsonSchema decide on which parser to use"),cAt={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"},fAt=t=>typeof t=="string"?{...cAt,basePath:["#"],definitions:{},name:t}:{...cAt,basePath:["#"],definitions:{},...t}});function pAt(t){if(!t)return!0;for(let e in t)return!1;return!0}var P8,pMe=w(()=>{P8=t=>"_def"in t?t._def:t});var mAt,mMe=w(()=>{Nne();pMe();mAt=t=>{let e=fAt(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])=>[P8(o),{def:P8(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function hMe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Wn(t,e,r,n,o){t[e]=r,hMe(t,e,n,o)}var JA=w(()=>{});function hAt(){return{}}var gMe=w(()=>{});function gAt(t,e){let r={type:"array"};return t.type?._def?.typeName!==de.ZodAny&&(r.items=pr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Wn(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Wn(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Wn(r,"minItems",t.exactLength.value,t.exactLength.message,e),Wn(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var yMe=w(()=>{Td();JA();Zs()});function yAt(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?Wn(r,"minimum",n.value,n.message,e):Wn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Wn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Wn(r,"maximum",n.value,n.message,e):Wn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Wn(r,"maximum",n.value,n.message,e));break;case"multipleOf":Wn(r,"multipleOf",n.value,n.message,e);break}return r}var bMe=w(()=>{JA()});function bAt(){return{type:"boolean"}}var _Me=w(()=>{});function _At(t,e){return pr(t.type._def,e)}var vMe=w(()=>{Zs()});var vAt,wMe=w(()=>{Zs();vAt=(t,e)=>pr(t.innerType._def,e)});function SMe(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>SMe(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 P9r(t,e)}}var P9r,xMe=w(()=>{JA();P9r=(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":Wn(r,"minimum",n.value,n.message,e);break;case"max":Wn(r,"maximum",n.value,n.message,e);break}return r}});function wAt(t,e){return{...pr(t.innerType._def,e),default:t.defaultValue()}}var CMe=w(()=>{Zs()});function SAt(t,e,r){return e.effectStrategy==="input"?pr(t.schema._def,e,r):{}}var OMe=w(()=>{Zs()});function xAt(t){return{type:"string",enum:[...t.values]}}var PMe=w(()=>{});function CAt(t,e){let r=[pr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),pr(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(E9r(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 E9r,EMe=w(()=>{Zs();E9r=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function OAt(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 TMe=w(()=>{});function Dne(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?T9r(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":Wn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":Wn(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":Zy(r,"email",o.message,e);break;case"format:idn-email":Zy(r,"idn-email",o.message,e);break;case"pattern:zod":Xy(r,dN.email,o.message,e);break}break;case"url":Zy(r,"uri",o.message,e);break;case"uuid":Zy(r,"uuid",o.message,e);break;case"regex":Xy(r,o.regex,o.message,e);break;case"cuid":Xy(r,dN.cuid,o.message,e);break;case"cuid2":Xy(r,dN.cuid2,o.message,e);break;case"startsWith":Xy(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":Xy(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":Zy(r,"date-time",o.message,e);break;case"date":Zy(r,"date",o.message,e);break;case"time":Zy(r,"time",o.message,e);break;case"duration":Zy(r,"duration",o.message,e);break;case"length":Wn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),Wn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{Xy(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&Zy(r,"ipv4",o.message,e),o.version!=="v4"&&Zy(r,"ipv6",o.message,e);break}case"emoji":Xy(r,dN.emoji,o.message,e);break;case"ulid":{Xy(r,dN.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Zy(r,"binary",o.message,e);break}case"contentEncoding:base64":{Wn(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{Xy(r,dN.base64,o.message,e);break}}break}case"nanoid":Xy(r,dN.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var AMe,dN,T9r,Zy,Xy,PAt,Lne=w(()=>{JA();dN={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:()=>(AMe===void 0&&(AMe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),AMe),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}$/};T9r=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),Zy=(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}}})):Wn(t,"format",e,r,n)},Xy=(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:PAt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Wn(t,"pattern",PAt(e,n),r,n)},PAt=(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({...n,[o]:pr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:pr(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===de.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(Nne(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===de.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}var Fne=w(()=>{Td();Zs();Dne()});function xAt(t,e){if(e.mapStrategy==="record")return Lne(t,e);let r=pr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=pr(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 EMe=w(()=>{Zs();Fne()});function CAt(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 TMe=w(()=>{});function OAt(){return{not:{}}}var AMe=w(()=>{});function PAt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var IMe=w(()=>{});function TAt(t,e){if(e.target==="openApi3")return EAt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in P8&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=P8[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 EAt(t,e)}var P8,EAt,kne=w(()=>{Zs();P8={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};EAt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>pr(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 AAt(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:P8[t.innerType._def.typeName],nullable:!0}:{type:[P8[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=pr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=pr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var MMe=w(()=>{Zs();kne()});function IAt(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",fMe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Wn(r,"minimum",n.value,n.message,e):Wn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Wn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Wn(r,"maximum",n.value,n.message,e):Wn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Wn(r,"maximum",n.value,n.message,e));break;case"multipleOf":Wn(r,"multipleOf",n.value,n.message,e);break}return r}var RMe=w(()=>{JA()});function C9r(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":pr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":pr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function MAt(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=pr(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:C9r(t,e)};return r.required.length||delete r.required,r}var jMe=w(()=>{Zs()});var RAt,NMe=w(()=>{Zs();RAt=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return pr(t.innerType._def,e);let r=pr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var jAt,DMe=w(()=>{Zs();jAt=(t,e)=>{if(e.pipeStrategy==="input")return pr(t.in._def,e);if(e.pipeStrategy==="output")return pr(t.out._def,e);let r=pr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=pr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function NAt(t,e){return pr(t.type._def,e)}var LMe=w(()=>{Zs()});function DAt(t,e){let n={type:"array",uniqueItems:!0,items:pr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Wn(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Wn(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var FMe=w(()=>{JA();Zs()});function LAt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>pr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:pr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>pr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var kMe=w(()=>{Zs()});function FAt(){return{not:{}}}var $Me=w(()=>{});function kAt(){return{}}var BMe=w(()=>{});var $At,qMe=w(()=>{Zs();$At=(t,e)=>pr(t.innerType._def,e)});function pr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==sAt)return a}if(n&&!r){let a=O9r(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=E9r(t,t.typeName,e,r);return i&&T9r(t,e,i),o.jsonSchema=i,i}var O9r,P9r,E9r,T9r,Zs=w(()=>{Td();pMe();mMe();hMe();gMe();yMe();bMe();vMe();wMe();SMe();xMe();CMe();OMe();EMe();TMe();AMe();IMe();MMe();RMe();jMe();NMe();DMe();LMe();Fne();FMe();Dne();kMe();$Me();kne();BMe();qMe();jne();O9r=(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:P9r(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[o]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},P9r=(t,e)=>{let r=0;for(;r{switch(e){case de.ZodString:return Nne(t,r);case de.ZodNumber:return IAt(t,r);case de.ZodObject:return MAt(t,r);case de.ZodBigInt:return pAt(t,r);case de.ZodBoolean:return mAt();case de.ZodDate:return _Me(t,r);case de.ZodUndefined:return FAt();case de.ZodNull:return PAt(r);case de.ZodArray:return fAt(t,r);case de.ZodUnion:case de.ZodDiscriminatedUnion:return TAt(t,r);case de.ZodIntersection:return vAt(t,r);case de.ZodTuple:return LAt(t,r);case de.ZodRecord:return Lne(t,r);case de.ZodLiteral:return wAt(t,r);case de.ZodEnum:return _At(t);case de.ZodNativeEnum:return CAt(t);case de.ZodNullable:return AAt(t,r);case de.ZodOptional:return RAt(t,r);case de.ZodMap:return xAt(t,r);case de.ZodSet:return DAt(t,r);case de.ZodLazy:return pr(t.getter()._def,r);case de.ZodPromise:return NAt(t,r);case de.ZodNaN:case de.ZodNever:return OAt();case de.ZodEffects:return bAt(t,r,n);case de.ZodAny:return dAt();case de.ZodUnknown:return kAt();case de.ZodDefault:return yAt(t,r);case de.ZodBranded:return hAt(t,r);case de.ZodReadonly:return $At(t,r);case de.ZodCatch:return gAt(t,r);case de.ZodPipeline:return jAt(t,r);case de.ZodFunction:case de.ZodVoid:case de.ZodSymbol:return;default:return(o=>{})(e)}},T9r=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var BAt,qAt=w(()=>{Zs();dMe();cMe();BAt=(t,e)=>{let r=cAt(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=pr(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(lAt(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]=pr(O8(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 UAt=w(()=>{jne();dMe();JA();Zs();pMe();mMe();hMe();gMe();yMe();bMe();vMe();wMe();SMe();xMe();CMe();OMe();EMe();TMe();AMe();IMe();MMe();RMe();jMe();NMe();DMe();LMe();qMe();Fne();FMe();Dne();kMe();$Me();kne();BMe();qAt()});function zAt(t,e){return BAt(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function aq(t,e,r){return ETt({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:zAt(t,{name:e})}},n=>t.parse(JSON.parse(n)))}function $ne(t){return TTt({type:"function",function:{name:t.name,parameters:zAt(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 sq=w(()=>{DB();UAt()});function GO(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 YA=w(()=>{});function E8(t,e){return t.lc_error_code=e,t.message=`${t.message} +]`;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 Fne(t,e){if(e.target==="openApi3"&&t.keyType?._def.typeName===de.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:pr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:pr(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===de.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(Dne(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===de.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}var kne=w(()=>{Td();Zs();Lne()});function EAt(t,e){if(e.mapStrategy==="record")return Fne(t,e);let r=pr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=pr(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 IMe=w(()=>{Zs();kne()});function TAt(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 MMe=w(()=>{});function AAt(){return{not:{}}}var RMe=w(()=>{});function IAt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var jMe=w(()=>{});function RAt(t,e){if(e.target==="openApi3")return MAt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in E8&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=E8[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 MAt(t,e)}var E8,MAt,$ne=w(()=>{Zs();E8={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};MAt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>pr(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 jAt(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:E8[t.innerType._def.typeName],nullable:!0}:{type:[E8[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=pr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=pr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var NMe=w(()=>{Zs();$ne()});function NAt(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",hMe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Wn(r,"minimum",n.value,n.message,e):Wn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Wn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Wn(r,"maximum",n.value,n.message,e):Wn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Wn(r,"maximum",n.value,n.message,e));break;case"multipleOf":Wn(r,"multipleOf",n.value,n.message,e);break}return r}var DMe=w(()=>{JA()});function A9r(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":pr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":pr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function DAt(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=pr(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:A9r(t,e)};return r.required.length||delete r.required,r}var LMe=w(()=>{Zs()});var LAt,FMe=w(()=>{Zs();LAt=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return pr(t.innerType._def,e);let r=pr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var FAt,kMe=w(()=>{Zs();FAt=(t,e)=>{if(e.pipeStrategy==="input")return pr(t.in._def,e);if(e.pipeStrategy==="output")return pr(t.out._def,e);let r=pr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=pr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function kAt(t,e){return pr(t.type._def,e)}var $Me=w(()=>{Zs()});function $At(t,e){let n={type:"array",uniqueItems:!0,items:pr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Wn(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Wn(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var BMe=w(()=>{JA();Zs()});function BAt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>pr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:pr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>pr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var qMe=w(()=>{Zs()});function qAt(){return{not:{}}}var UMe=w(()=>{});function UAt(){return{}}var zMe=w(()=>{});var zAt,HMe=w(()=>{Zs();zAt=(t,e)=>pr(t.innerType._def,e)});function pr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==dAt)return a}if(n&&!r){let a=I9r(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=R9r(t,t.typeName,e,r);return i&&j9r(t,e,i),o.jsonSchema=i,i}var I9r,M9r,R9r,j9r,Zs=w(()=>{Td();gMe();yMe();bMe();_Me();vMe();wMe();xMe();CMe();OMe();PMe();EMe();TMe();IMe();MMe();RMe();jMe();NMe();DMe();LMe();FMe();kMe();$Me();kne();BMe();Lne();qMe();UMe();$ne();zMe();HMe();Nne();I9r=(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:M9r(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[o]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},M9r=(t,e)=>{let r=0;for(;r{switch(e){case de.ZodString:return Dne(t,r);case de.ZodNumber:return NAt(t,r);case de.ZodObject:return DAt(t,r);case de.ZodBigInt:return yAt(t,r);case de.ZodBoolean:return bAt();case de.ZodDate:return SMe(t,r);case de.ZodUndefined:return qAt();case de.ZodNull:return IAt(r);case de.ZodArray:return gAt(t,r);case de.ZodUnion:case de.ZodDiscriminatedUnion:return RAt(t,r);case de.ZodIntersection:return CAt(t,r);case de.ZodTuple:return BAt(t,r);case de.ZodRecord:return Fne(t,r);case de.ZodLiteral:return OAt(t,r);case de.ZodEnum:return xAt(t);case de.ZodNativeEnum:return TAt(t);case de.ZodNullable:return jAt(t,r);case de.ZodOptional:return LAt(t,r);case de.ZodMap:return EAt(t,r);case de.ZodSet:return $At(t,r);case de.ZodLazy:return pr(t.getter()._def,r);case de.ZodPromise:return kAt(t,r);case de.ZodNaN:case de.ZodNever:return AAt();case de.ZodEffects:return SAt(t,r,n);case de.ZodAny:return hAt();case de.ZodUnknown:return UAt();case de.ZodDefault:return wAt(t,r);case de.ZodBranded:return _At(t,r);case de.ZodReadonly:return zAt(t,r);case de.ZodCatch:return vAt(t,r);case de.ZodPipeline:return FAt(t,r);case de.ZodFunction:case de.ZodVoid:case de.ZodSymbol:return;default:return(o=>{})(e)}},j9r=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var HAt,VAt=w(()=>{Zs();mMe();pMe();HAt=(t,e)=>{let r=mAt(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=pr(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(pAt(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]=pr(P8(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 WAt=w(()=>{Nne();mMe();JA();Zs();gMe();yMe();bMe();_Me();vMe();wMe();xMe();CMe();OMe();PMe();EMe();TMe();IMe();MMe();RMe();jMe();NMe();DMe();LMe();FMe();kMe();$Me();HMe();kne();BMe();Lne();qMe();UMe();$ne();zMe();VAt()});function KAt(t,e){return HAt(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function sq(t,e,r){return MTt({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:KAt(t,{name:e})}},n=>t.parse(JSON.parse(n)))}function Bne(t){return RTt({type:"function",function:{name:t.name,parameters:KAt(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 uq=w(()=>{LB();WAt()});function JO(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 YA=w(()=>{});function T8(t,e){return t.lc_error_code=e,t.message=`${t.message} Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/ -`,t}var HAt=w(()=>{});function JO(t){let e;return t.constructor.name===Xf.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Li.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=E8(t,"INVALID_TOOL_RESULTS"):t.status===401?e=E8(t,"MODEL_AUTHENTICATION"):t.status===429?e=E8(t,"MODEL_RATE_LIMIT"):t.status===404?e=E8(t,"MODEL_NOT_FOUND"):e=t,e}function UMe(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 dN=w(()=>{pg();Km();Ec();pB();HAt()});function A9r(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function VAt(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(WAt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(` -`)}function WAt(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}: ${Bne(o,e)},`):r.push(`${n}?: ${Bne(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(` -`)}function Bne(t,e){if(A9r(t))return t.anyOf.map(r=>Bne(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["{",WAt(t,e+2),"}"].join(` -`);case"array":return t.items?`${Bne(t.items,e)}[]`:"any[]";default:return""}}var KAt=w(()=>{});function GAt(t,e){let r;return rc(t)?r=dx(t):r=t,e?.strict!==void 0&&(r.function.strict=e.strict),r}var JAt=w(()=>{Km();dN()});function I9r(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 VMe(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(!Cs.isInstance(t))throw new Error("Invalid generic chat message");return I9r(t)}default:throw new Error(`Unknown message type: ${e}`)}}function HMe(t,e){return t.flatMap(r=>{let n=VMe(r);n==="system"&&WMe(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=""),Oi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(Ox),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 YAt(t,e){return t.flatMap(r=>{let n=VMe(r);if(n==="system"&&WMe(e)&&(n="developer"),n==="function")throw new Error("Function messages are not supported in Responses API");if(n==="tool"){let i=r;return i.additional_kwargs?.type==="computer_call_output"?{type:"computer_call_output",output:(()=>{if(typeof i.content=="string")return{type:"computer_screenshot",image_url:i.content};if(Array.isArray(i.content)){let s=i.content.find(l=>l.type==="computer_screenshot");if(s)return s;let u=i.content.find(l=>l.type==="image_url");if(u)return{type:"computer_screenshot",image_url:typeof u.image_url=="string"?u.image_url:u.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:i.tool_call_id}:{type:"function_call_output",call_id:i.tool_call_id,id:i.id,output:typeof i.content!="string"?JSON.stringify(i.content):i.content}}if(n==="assistant"){let i=[];r.additional_kwargs.reasoning!=null&&(c=>typeof c=="object"&&c!=null&&"type"in c&&c.type==="reasoning")(r.additional_kwargs.reasoning)&&i.push(r.additional_kwargs.reasoning);let{content:a}=r;r.additional_kwargs.refusal!=null&&(typeof a=="string"&&(a=[{type:"output_text",text:a,annotations:[]}]),a=[...a,{type:"refusal",refusal:r.additional_kwargs.refusal}]),i.push({type:"message",role:"assistant",content:typeof a=="string"?a:a.flatMap(l=>l.type==="text"?{type:"output_text",text:l.text,annotations:l.annotations??[]}:l.type==="output_text"||l.type==="refusal"?l:[])});let s=r.additional_kwargs[uq];Oi(r)&&r.tool_calls?.length?i.push(...r.tool_calls.map(l=>({type:"function_call",name:l.name,arguments:JSON.stringify(l.args),call_id:l.id,id:s?.[l.id]}))):r.additional_kwargs.tool_calls!=null&&i.push(...r.additional_kwargs.tool_calls.map(l=>({type:"function_call",name:l.function.name,call_id:l.id,id:s?.[l.id],arguments:l.function.arguments})));let u=r.response_metadata.output?.length?r.response_metadata.output:r.additional_kwargs.tool_outputs;if(u!=null){let l=u,c=l?.filter(f=>f.type==="reasoning"),d=l?.filter(f=>f.type==="computer_call");c.length>0&&d.length>0&&i.push(...c),d.length>0&&i.push(...d)}return i}let o=typeof r.content=="string"?r.content:r.content.flatMap(i=>{if(i.type==="text")return{type:"input_text",text:i.text};if(i.type==="image_url"){let a=typeof i.image_url=="string"?i.image_url:i.image_url.url,s=typeof i.image_url=="string"?"auto":i.image_url.detail;return{type:"input_image",image_url:a,detail:s}}return i.type==="input_text"||i.type==="input_image"||i.type==="input_file"?i:[]});return n==="user"||n==="system"||n==="developer"?{type:"message",role:n,content:o}:(console.warn(`Unsupported role found when converting to OpenAI Responses API: ${n}`),[])})}function XAt(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(Jp(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Xm(s,l))}i[uq]??(i[uq]={}),a.id&&(i[uq][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 gn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function M9r(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[uq]={[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=XAt(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 qn({text:e.map(u=>u.text).join(""),message:new dr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function zMe(t){return"type"in t&&t.type!=="function"}function R9r(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function ZAt(t,e){return Wc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:GAt(t,e)}function WMe(t){return t?.startsWith("o1")||t?.startsWith("o3")||t?.startsWith("o4")}function qne(t){return typeof t?.parse=="function"}function j9r(t){return t!==void 0&&typeof t.schema=="object"}var uq,Px,Une=w(()=>{pg();gs();Qd();Dn();fx();Wm();Sm();gy();iq();Ec();sq();YA();dN();KAt();JAt();uq="__openai_function_call_ids__";Px=class extends Js{static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning_effort"]}get lc_secrets(){return{openAIApiKey:"OPENAI_API_KEY",apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{modelName:"model",openAIApiKey:"openai_api_key",apiKey:"openai_api_key"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","reasoningEffort","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","modelName","model","modelKwargs","stop","stopSequences","timeout","openAIApiKey","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming"]}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logitBias",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gpt-3.5-turbo"}),Object.defineProperty(this,"modelKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topLogprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"openAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__includeRawResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportsStrictToolCalling",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modalities",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reasoningEffort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useResponsesApi",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.openAIApiKey=e?.apiKey??e?.openAIApiKey??e?.configuration?.apiKey??ot("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ot("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelName=this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoningEffort=e?.reasoningEffort,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.useResponsesApi=e?.useResponsesApi??this.useResponsesApi,this.disableStreaming=e?.disableStreaming??this.disableStreaming,this.model==="o1"&&(this.disableStreaming=!0),this.streaming=e?.streaming??!1,this.disableStreaming&&(this.streaming=!1),this.streamUsage=e?.streamUsage??this.streamUsage,this.disableStreaming&&(this.streamUsage=!1),this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling)}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.bind({tools:e.map(o=>zMe(o)?o:ZAt(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&qne(e.json_schema.schema)?aq(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=>zMe(l)?l:Wc(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:R9r(e?.tool_choice)?e?.tool_choice:(()=>{let l=UMe(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=>ZAt(s,{strict:n})):void 0,tool_choice:UMe(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),WMe(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(Jp(u,{returnId:!0}))}catch(l){i.push(Xm(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 gn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Cs(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 Mf({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 dr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Rd({content:i,response_metadata:s}):o==="developer"?new Rd({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new ym({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Th({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new If({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:YAt(e,this.model),stream:!0},r);for await(let c of l){let d=M9r(c);d!=null&&(yield d)}return}let o=HMe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new qn({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new qn({message:new dr({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=YAt(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:XAt(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(zMe),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=HMe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let b={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};b.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},Oi(b.message)&&(b.message.usage_metadata=o),b.message=new gn(Object.fromEntries(Object.entries(b.message).filter(([g])=>!g.startsWith("lc_")))),p.push(b)}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=VAt(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(VMe(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 JO(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 JO(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 JO(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=GO(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Wt(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;j9r(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"}}),qne(n)?u=Tc.fromZodSchema(n):u=new Ac;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}}}),qne(n)){let f=Tc.fromZodSchema(n);u=Nf.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Ac;else{let f=o??"extract";if(qne(n)){let p=So(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 Zc({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 Zc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=go.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=go.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return bi.from([{raw:s},d])}}});var QAt=w(()=>{Dn();Une();YA()});var KMe=w(()=>{Wm();Qd();Dn();jj();dg();YA();dN()});var rIt=w(()=>{Dn();KMe();YA()});var YO,GMe=w(()=>{pg();Dn();$O();dg();YA();dN();YO=class extends Jf{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??ot("OPENAI_API_KEY");this.organization=r?.configuration?.organization??ot("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=Yf(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{try{return await this.client.embeddings.create(e,r)}catch(n){throw JO(n)}})}}});var zne,nIt=w(()=>{pg();Dn();GMe();YA();dN();zne=class extends YO{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??ot("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??ot("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??ot("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??ot("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(ot("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||ot("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=GO(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(i.apiKey=n.azureOpenAIApiKey),i.baseURL||delete i.baseURL,i.defaultHeaders={...i.defaultHeaders,"User-Agent":i.defaultHeaders?.["User-Agent"]?`${i.defaultHeaders["User-Agent"]}: langchainjs-azure-openai-v2`:"langchainjs-azure-openai-v2"},this.client=new Rne({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 JO(n)}})}}});var oIt=w(()=>{});function Qm(t,e){let r=e.schema&&Gs(e.schema)&&(!("shape"in e.schema)||!e.schema.shape),n=r8(e.schema);if(!e.schema||r||n)return new JMe({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(a,s,u)=>new Promise((l,c)=>{let d=us(u,{callbacks:s?.getChild()});jd.runWithConfig(bm(d),async()=>{try{l(t(a,d))}catch(f){c(f)}})})});let o=e.schema,i=e.description??e.schema.description??`${e.name} tool`;return new YMe({...e,description:i,schema:o,func:async(a,s,u)=>new Promise((l,c)=>{let d=us(u,{callbacks:s?.getChild()});jd.runWithConfig(bm(d),async()=>{try{l(t(a,d))}catch(f){c(f)}})})})}function N9r(t){let{content:e,artifact:r,toolCallId:n}=t;return n&&!G4e(e)?typeof e=="string"||Array.isArray(e)&&e.every(o=>typeof o=="object")?new PC({content:e,artifact:r,tool_call_id:n,name:t.name}):new PC({content:D9r(e),artifact:r,tool_call_id:n,name:t.name}):e}function D9r(t){try{return JSON.stringify(t,null,2)}catch{return`${t}`}}var Hne,ZO,JMe,YMe,iIt=w(()=>{Td();H2();LE();t8();Hb();KL();YL();pG();fB();sAe();Nre();Hne=class extends cB{get lc_namespace(){return["langchain","tools"]}constructor(e){super(e??{}),Object.defineProperty(this,"returnDirect",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"verboseParsingErrors",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"responseFormat",{enumerable:!0,configurable:!0,writable:!0,value:"content"}),this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat}async invoke(e,r){let n,o=un(r);return RE(e)?(n=e.args,o={...o,toolCall:e}):n=e,this.call(n,o)}async call(e,r,n){let o=RE(e)?e.args:e,i;if(Gs(this.schema))try{i=await this.schema.parseAsync(o)}catch(m){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h} +`,t}var GAt=w(()=>{});function YO(t){let e;return t.constructor.name===Xf.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Li.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=T8(t,"INVALID_TOOL_RESULTS"):t.status===401?e=T8(t,"MODEL_AUTHENTICATION"):t.status===429?e=T8(t,"MODEL_RATE_LIMIT"):t.status===404?e=T8(t,"MODEL_NOT_FOUND"):e=t,e}function VMe(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 fN=w(()=>{pg();Km();Ec();mB();GAt()});function N9r(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function JAt(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(YAt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(` +`)}function YAt(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}: ${qne(o,e)},`):r.push(`${n}?: ${qne(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(` +`)}function qne(t,e){if(N9r(t))return t.anyOf.map(r=>qne(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["{",YAt(t,e+2),"}"].join(` +`);case"array":return t.items?`${qne(t.items,e)}[]`:"any[]";default:return""}}var ZAt=w(()=>{});function XAt(t,e){let r;return rc(t)?r=dx(t):r=t,e?.strict!==void 0&&(r.function.strict=e.strict),r}var QAt=w(()=>{Km();fN()});function D9r(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 GMe(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(!Cs.isInstance(t))throw new Error("Invalid generic chat message");return D9r(t)}default:throw new Error(`Unknown message type: ${e}`)}}function KMe(t,e){return t.flatMap(r=>{let n=GMe(r);n==="system"&&JMe(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=""),Oi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(Ox),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 eIt(t,e){return t.flatMap(r=>{let n=GMe(r);if(n==="system"&&JMe(e)&&(n="developer"),n==="function")throw new Error("Function messages are not supported in Responses API");if(n==="tool"){let i=r;return i.additional_kwargs?.type==="computer_call_output"?{type:"computer_call_output",output:(()=>{if(typeof i.content=="string")return{type:"computer_screenshot",image_url:i.content};if(Array.isArray(i.content)){let s=i.content.find(l=>l.type==="computer_screenshot");if(s)return s;let u=i.content.find(l=>l.type==="image_url");if(u)return{type:"computer_screenshot",image_url:typeof u.image_url=="string"?u.image_url:u.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:i.tool_call_id}:{type:"function_call_output",call_id:i.tool_call_id,id:i.id,output:typeof i.content!="string"?JSON.stringify(i.content):i.content}}if(n==="assistant"){let i=[];r.additional_kwargs.reasoning!=null&&(c=>typeof c=="object"&&c!=null&&"type"in c&&c.type==="reasoning")(r.additional_kwargs.reasoning)&&i.push(r.additional_kwargs.reasoning);let{content:a}=r;r.additional_kwargs.refusal!=null&&(typeof a=="string"&&(a=[{type:"output_text",text:a,annotations:[]}]),a=[...a,{type:"refusal",refusal:r.additional_kwargs.refusal}]),i.push({type:"message",role:"assistant",content:typeof a=="string"?a:a.flatMap(l=>l.type==="text"?{type:"output_text",text:l.text,annotations:l.annotations??[]}:l.type==="output_text"||l.type==="refusal"?l:[])});let s=r.additional_kwargs[lq];Oi(r)&&r.tool_calls?.length?i.push(...r.tool_calls.map(l=>({type:"function_call",name:l.name,arguments:JSON.stringify(l.args),call_id:l.id,id:s?.[l.id]}))):r.additional_kwargs.tool_calls!=null&&i.push(...r.additional_kwargs.tool_calls.map(l=>({type:"function_call",name:l.function.name,call_id:l.id,id:s?.[l.id],arguments:l.function.arguments})));let u=r.response_metadata.output?.length?r.response_metadata.output:r.additional_kwargs.tool_outputs;if(u!=null){let l=u,c=l?.filter(f=>f.type==="reasoning"),d=l?.filter(f=>f.type==="computer_call");c.length>0&&d.length>0&&i.push(...c),d.length>0&&i.push(...d)}return i}let o=typeof r.content=="string"?r.content:r.content.flatMap(i=>{if(i.type==="text")return{type:"input_text",text:i.text};if(i.type==="image_url"){let a=typeof i.image_url=="string"?i.image_url:i.image_url.url,s=typeof i.image_url=="string"?"auto":i.image_url.detail;return{type:"input_image",image_url:a,detail:s}}return i.type==="input_text"||i.type==="input_image"||i.type==="input_file"?i:[]});return n==="user"||n==="system"||n==="developer"?{type:"message",role:n,content:o}:(console.warn(`Unsupported role found when converting to OpenAI Responses API: ${n}`),[])})}function rIt(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(Jp(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Xm(s,l))}i[lq]??(i[lq]={}),a.id&&(i[lq][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 gn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function L9r(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[lq]={[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=rIt(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 qn({text:e.map(u=>u.text).join(""),message:new dr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function WMe(t){return"type"in t&&t.type!=="function"}function F9r(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function tIt(t,e){return Wc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:XAt(t,e)}function JMe(t){return t?.startsWith("o1")||t?.startsWith("o3")||t?.startsWith("o4")}function Une(t){return typeof t?.parse=="function"}function k9r(t){return t!==void 0&&typeof t.schema=="object"}var lq,Px,zne=w(()=>{pg();gs();Qd();Dn();fx();Wm();Sm();gy();aq();Ec();uq();YA();fN();ZAt();QAt();lq="__openai_function_call_ids__";Px=class extends Js{static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning_effort"]}get lc_secrets(){return{openAIApiKey:"OPENAI_API_KEY",apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{modelName:"model",openAIApiKey:"openai_api_key",apiKey:"openai_api_key"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","reasoningEffort","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","modelName","model","modelKwargs","stop","stopSequences","timeout","openAIApiKey","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming"]}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logitBias",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gpt-3.5-turbo"}),Object.defineProperty(this,"modelKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topLogprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"openAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__includeRawResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportsStrictToolCalling",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modalities",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reasoningEffort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useResponsesApi",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.openAIApiKey=e?.apiKey??e?.openAIApiKey??e?.configuration?.apiKey??ot("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ot("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelName=this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoningEffort=e?.reasoningEffort,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.useResponsesApi=e?.useResponsesApi??this.useResponsesApi,this.disableStreaming=e?.disableStreaming??this.disableStreaming,this.model==="o1"&&(this.disableStreaming=!0),this.streaming=e?.streaming??!1,this.disableStreaming&&(this.streaming=!1),this.streamUsage=e?.streamUsage??this.streamUsage,this.disableStreaming&&(this.streamUsage=!1),this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling)}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.bind({tools:e.map(o=>WMe(o)?o:tIt(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&Une(e.json_schema.schema)?sq(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=>WMe(l)?l:Wc(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:F9r(e?.tool_choice)?e?.tool_choice:(()=>{let l=VMe(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=>tIt(s,{strict:n})):void 0,tool_choice:VMe(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),JMe(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(Jp(u,{returnId:!0}))}catch(l){i.push(Xm(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 gn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Cs(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 Mf({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 dr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Rd({content:i,response_metadata:s}):o==="developer"?new Rd({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new ym({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Th({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new If({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:eIt(e,this.model),stream:!0},r);for await(let c of l){let d=L9r(c);d!=null&&(yield d)}return}let o=KMe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new qn({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new qn({message:new dr({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=eIt(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:rIt(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(WMe),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=KMe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let b={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};b.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},Oi(b.message)&&(b.message.usage_metadata=o),b.message=new gn(Object.fromEntries(Object.entries(b.message).filter(([g])=>!g.startsWith("lc_")))),p.push(b)}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=JAt(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(GMe(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 YO(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 YO(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 YO(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=JO(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Wt(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;k9r(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"}}),Une(n)?u=Tc.fromZodSchema(n):u=new Ac;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}}}),Une(n)){let f=Tc.fromZodSchema(n);u=Nf.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Ac;else{let f=o??"extract";if(Une(n)){let p=So(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 Zc({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 Zc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=go.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=go.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return bi.from([{raw:s},d])}}});var nIt=w(()=>{Dn();zne();YA()});var YMe=w(()=>{Wm();Qd();Dn();Nj();dg();YA();fN()});var aIt=w(()=>{Dn();YMe();YA()});var Ex,ZMe=w(()=>{pg();Dn();BO();dg();YA();fN();Ex=class extends Jf{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??ot("OPENAI_API_KEY");this.organization=r?.configuration?.organization??ot("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=Yf(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{try{return await this.client.embeddings.create(e,r)}catch(n){throw YO(n)}})}}});var Hne,sIt=w(()=>{pg();Dn();ZMe();YA();fN();Hne=class extends Ex{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??ot("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??ot("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??ot("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??ot("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(ot("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||ot("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=JO(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(i.apiKey=n.azureOpenAIApiKey),i.baseURL||delete i.baseURL,i.defaultHeaders={...i.defaultHeaders,"User-Agent":i.defaultHeaders?.["User-Agent"]?`${i.defaultHeaders["User-Agent"]}: langchainjs-azure-openai-v2`:"langchainjs-azure-openai-v2"},this.client=new jne({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 YO(n)}})}}});var uIt=w(()=>{});function Qm(t,e){let r=e.schema&&Gs(e.schema)&&(!("shape"in e.schema)||!e.schema.shape),n=n8(e.schema);if(!e.schema||r||n)return new XMe({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(a,s,u)=>new Promise((l,c)=>{let d=us(u,{callbacks:s?.getChild()});jd.runWithConfig(bm(d),async()=>{try{l(t(a,d))}catch(f){c(f)}})})});let o=e.schema,i=e.description??e.schema.description??`${e.name} tool`;return new QMe({...e,description:i,schema:o,func:async(a,s,u)=>new Promise((l,c)=>{let d=us(u,{callbacks:s?.getChild()});jd.runWithConfig(bm(d),async()=>{try{l(t(a,d))}catch(f){c(f)}})})})}function $9r(t){let{content:e,artifact:r,toolCallId:n}=t;return n&&!Y4e(e)?typeof e=="string"||Array.isArray(e)&&e.every(o=>typeof o=="object")?new EC({content:e,artifact:r,tool_call_id:n,name:t.name}):new EC({content:B9r(e),artifact:r,tool_call_id:n,name:t.name}):e}function B9r(t){try{return JSON.stringify(t,null,2)}catch{return`${t}`}}var Vne,ZO,XMe,QMe,lIt=w(()=>{Td();V2();LE();r8();Hb();GL();ZL();mG();pB();cAe();Dre();Vne=class extends dB{get lc_namespace(){return["langchain","tools"]}constructor(e){super(e??{}),Object.defineProperty(this,"returnDirect",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"verboseParsingErrors",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"responseFormat",{enumerable:!0,configurable:!0,writable:!0,value:"content"}),this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat}async invoke(e,r){let n,o=un(r);return RE(e)?(n=e.args,o={...o,toolCall:e}):n=e,this.call(n,o)}async call(e,r,n){let o=RE(e)?e.args:e,i;if(Gs(this.schema))try{i=await this.schema.parseAsync(o)}catch(m){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h} Details: ${m.message}`),new wR(h,JSON.stringify(e))}else{let m=oa(o,this.schema);if(!m.valid){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h} Details: ${m.errors.map(b=>`${b.keywordLocation}: ${b.error}`).join(` `)}`),new wR(h,JSON.stringify(e))}i=o}let a=CR(r),u=await Bs.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(m){throw await u?.handleToolError(m),m}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;RE(e)&&(f=e.id),!f&&B4e(a)&&(f=a.toolCall.id);let p=N9r({content:c,artifact:d,toolCallId:f,name:this.name});return await u?.handleToolEnd(p),p}},ZO=class extends Hne{constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:Wr.object({input:Wr.string().optional()}).transform(r=>r.input)})}call(e,r){let n=typeof e=="string"||e==null?{input:e}:e;return super.call(n,r)}},JMe=class extends ZO{static lc_name(){return"DynamicTool"}constructor(e){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect}async call(e,r){let n=CR(r);return n.runName===void 0&&(n.runName=this.name),super.call(e,n)}async _call(e,r,n){return this.func(e,r,n)}},YMe=class extends Hne{static lc_name(){return"DynamicStructuredTool"}constructor(e){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect,this.schema=e.schema}async call(e,r,n){let o=CR(r);return o.runName===void 0&&(o.runName=this.name),super.call(e,o,n)}_call(e,r,n){return this.func(e,r,n)}}});var ZA=w(()=>{iIt()});var ZMe,aIt=w(()=>{Dn();pg();ZA();ZMe=class extends ZO{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??ot("OPENAI_API_KEY"),n=e?.organization??ot("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseURL:e?.baseUrl};this.client=new Wt(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(ZMe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var sIt=w(()=>{aIt()});var uIt=w(()=>{Une()});var lIt=w(()=>{Une();QAt();KMe();rIt();nIt();GMe();oIt();dN();YA();sIt();uIt()});var XMe=w(()=>{lIt()});var Vne,cIt=w(()=>{$O();dg();Dn();Vne=class extends Jf{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||ot("JINA_API_KEY")||ot("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=Yf(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;ao)}}});var dIt=w(()=>{cIt()});var Wne,fIt=w(()=>{dIt();Wne=class extends Vne{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}}});var Kne,L9r,Xs,fN=w(()=>{$r();BR();wT();nr();mg();Cn();fAe();_Ae();jAe();XMe();Kne=require("obsidian");fIt();L9r={"copilot-plus":YO,"copilot-plus-jina":Wne,openai:YO,cohereai:$re,google:Wre,"azure openai":zne,ollama:Zre,"lm-studio":YO,"3rd party (openai-format)":YO},Xs=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>ue().plusLicenseKey,"copilot-plus-jina":()=>ue().plusLicenseKey,openai:()=>ue().openAIApiKey,cohereai:()=>ue().cohereApiKey,google:()=>ue().googleApiKey,"azure openai":()=>ue().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key"};this.initialize(),xa(()=>this.initialize())}initialize(){let e=ue().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=L9r[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(HE).contains(n.provider)){console.warn(`Unknown provider: ${n.provider} for embedding model: ${n.name}`);return}let o=this.getProviderConstructor(n),i=n.apiKey||this.providerApiKeyMap[n.provider](),a=kr(n);r[a]={hasApiKey:!!i,EmbeddingConstructor:o,vendor:n.provider}}})}static getModelName(e){let r=e;if("model"in r&&r.model)return r.model;if("modelName"in r&&r.modelName)return r.modelName;throw new Error(`Embeddings instance missing model or modelName properties: ${e}`)}getCustomModel(e){return this.activeEmbeddingModels.filter(r=>{let n=kr(r);return e===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:e}=ue();if(!t.modelMap.hasOwnProperty(e))throw new Rr(`No embedding model found for: ${e}`);let r=this.getCustomModel(e);if(r.plusExclusive&&!ue().isPlusUser)throw new Kne.Notice("Plus-only model, please consider upgrading to Plus to access it."),new Rr("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await Fi.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new Kne.Notice("Believer-only model, please consider upgrading to Believer to access it."),new Rr("Believer-only model selected but user is not on Believer plan")}let n=t.modelMap[e];if(!n.hasApiKey)throw new Rr(`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 Rr(`Error creating embedding model: ${e}. ${i.message}`)}}async getEmbeddingConfig(e){let r=ue(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await eo(r.plusLicenseKey),timeout:1e4,batchSize:ue().embeddingBatchSize,configuration:{baseURL:VE,fetch:e.enableCors?Us:void 0}},"copilot-plus-jina":{model:n,apiKey:await eo(r.plusLicenseKey),timeout:1e4,batchSize:ue().embeddingBatchSize,dimensions:e.dimensions,baseUrl:VE+"/embeddings",configuration:{fetch:e.enableCors?Us:void 0}},openai:{modelName:n,apiKey:await eo(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:ue().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Us:void 0}},cohereai:{model:n,apiKey:await eo(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await eo(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await eo(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 eo(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await eo(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?Us:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await eo(e.apiKey||""),batchSize:ue().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Us: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 Kne.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=` +Result: ${JSON.stringify(l)}`);else c=l;let f;RE(e)&&(f=e.id),!f&&U4e(a)&&(f=a.toolCall.id);let p=$9r({content:c,artifact:d,toolCallId:f,name:this.name});return await u?.handleToolEnd(p),p}},ZO=class extends Vne{constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:Wr.object({input:Wr.string().optional()}).transform(r=>r.input)})}call(e,r){let n=typeof e=="string"||e==null?{input:e}:e;return super.call(n,r)}},XMe=class extends ZO{static lc_name(){return"DynamicTool"}constructor(e){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect}async call(e,r){let n=CR(r);return n.runName===void 0&&(n.runName=this.name),super.call(e,n)}async _call(e,r,n){return this.func(e,r,n)}},QMe=class extends Vne{static lc_name(){return"DynamicStructuredTool"}constructor(e){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect,this.schema=e.schema}async call(e,r,n){let o=CR(r);return o.runName===void 0&&(o.runName=this.name),super.call(e,o,n)}_call(e,r,n){return this.func(e,r,n)}}});var ZA=w(()=>{lIt()});var eRe,cIt=w(()=>{Dn();pg();ZA();eRe=class extends ZO{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??ot("OPENAI_API_KEY"),n=e?.organization??ot("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseURL:e?.baseUrl};this.client=new Wt(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(eRe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var dIt=w(()=>{cIt()});var fIt=w(()=>{zne()});var pIt=w(()=>{zne();nIt();YMe();aIt();sIt();ZMe();uIt();fN();YA();dIt();fIt()});var Wne=w(()=>{pIt()});var Kne,mIt=w(()=>{BO();dg();Dn();Kne=class extends Jf{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||ot("JINA_API_KEY")||ot("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=Yf(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;ao)}}});var hIt=w(()=>{mIt()});var Gne,gIt=w(()=>{hIt();Gne=class extends Kne{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}}});var Jne,yIt=w(()=>{Wne();Jne=class extends Ex{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 Yne,q9r,Xs,pN=w(()=>{$r();qR();wT();nr();mg();yn();hAe();SAe();LAe();Wne();Yne=require("obsidian");gIt();yIt();q9r={"copilot-plus":Jne,"copilot-plus-jina":Gne,openai:Ex,cohereai:Bre,google:Kre,"azure openai":Hne,ollama:Xre,"lm-studio":Ex,"3rd party (openai-format)":Ex},Xs=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>ue().plusLicenseKey,"copilot-plus-jina":()=>ue().plusLicenseKey,openai:()=>ue().openAIApiKey,cohereai:()=>ue().cohereApiKey,google:()=>ue().googleApiKey,"azure openai":()=>ue().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key"};this.initialize(),xa(()=>this.initialize())}initialize(){let e=ue().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=q9r[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(HE).contains(n.provider)){console.warn(`Unknown provider: ${n.provider} for embedding model: ${n.name}`);return}let o=this.getProviderConstructor(n),i=n.apiKey||this.providerApiKeyMap[n.provider](),a=kr(n);r[a]={hasApiKey:!!i,EmbeddingConstructor:o,vendor:n.provider}}})}static getModelName(e){let r=e;if("model"in r&&r.model)return r.model;if("modelName"in r&&r.modelName)return r.modelName;throw new Error(`Embeddings instance missing model or modelName properties: ${e}`)}getCustomModel(e){return this.activeEmbeddingModels.filter(r=>{let n=kr(r);return e===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:e}=ue();if(!t.modelMap.hasOwnProperty(e))throw new Rr(`No embedding model found for: ${e}`);let r=this.getCustomModel(e);if(r.plusExclusive&&!ue().isPlusUser)throw new Yne.Notice("Plus-only model, please consider upgrading to Plus to access it."),new Rr("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await Fi.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new Yne.Notice("Believer-only model, please consider upgrading to Believer to access it."),new Rr("Believer-only model selected but user is not on Believer plan")}let n=t.modelMap[e];if(!n.hasApiKey)throw new Rr(`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 Rr(`Error creating embedding model: ${e}. ${i.message}`)}}async getEmbeddingConfig(e){let r=ue(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await eo(r.plusLicenseKey),timeout:1e4,batchSize:ue().embeddingBatchSize,configuration:{baseURL:VE,fetch:e.enableCors?Us:void 0}},"copilot-plus-jina":{model:n,apiKey:await eo(r.plusLicenseKey),timeout:1e4,batchSize:ue().embeddingBatchSize,dimensions:e.dimensions,baseUrl:VE+"/embeddings",configuration:{fetch:e.enableCors?Us:void 0}},openai:{modelName:n,apiKey:await eo(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:ue().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Us:void 0}},cohereai:{model:n,apiKey:await eo(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await eo(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await eo(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 eo(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await eo(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?Us:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await eo(e.apiKey||""),batchSize:ue().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Us: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 Yne.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: `+ei(n)+` -with CORS Error: `+ei(o);throw new Error(i)}}}}});function hIt(t){return t!==void 0&&T8.includes(t)?pIt[t]:void 0}var pIt,mIt,T8,Gne=w(()=>{pIt={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"},mIt={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},T8=Object.keys(pIt)});function ki(t,e){if(e.length\d+)\$)?(?-?\d*\.?\d*)(?[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 $9r(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function B9r(){return typeof process<"u"&&process.release&&process.release.name==="node"}function _It(){return BigInt(Math.floor(performance.now()*1e6))}function pN(t){return typeof t=="number"&&(t=BigInt(t)),t{let n=e.get(r);return n!==void 0&&e.set(r,0),n===t.length})}function Jne(t,e){let r={},n=e.length;for(let o=0;o({...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 Qs(t){return t?.constructor?.name==="AsyncFunction"}var F9r,k9r,gIt,yIt,bIt,QMe,q9r,Ds=w(()=>{ic();F9r=Date.now().toString().slice(5),k9r=0,gIt=BigInt(1e3),yIt=BigInt(1e6),bIt=BigInt(1e9),QMe=65535;q9r={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344}});function qt(t,...e){let r=new Error(vIt(z9r[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}var U9r,z9r,ic=w(()=>{Gne();Ds();U9r=T8.join(` - - `),z9r={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. +with CORS Error: `+ei(o);throw new Error(i)}}}}});function vIt(t){return t!==void 0&&A8.includes(t)?bIt[t]:void 0}var bIt,_It,A8,Zne=w(()=>{bIt={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"},_It={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},A8=Object.keys(bIt)});function ki(t,e){if(e.length\d+)\$)?(?-?\d*\.?\d*)(?[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 H9r(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function V9r(){return typeof process<"u"&&process.release&&process.release.name==="node"}function CIt(){return BigInt(Math.floor(performance.now()*1e6))}function mN(t){return typeof t=="number"&&(t=BigInt(t)),t{let n=e.get(r);return n!==void 0&&e.set(r,0),n===t.length})}function Xne(t,e){let r={},n=e.length;for(let o=0;o({...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 Qs(t){return t?.constructor?.name==="AsyncFunction"}var U9r,z9r,wIt,SIt,xIt,tRe,W9r,Ds=w(()=>{ic();U9r=Date.now().toString().slice(5),z9r=0,wIt=BigInt(1e3),SIt=BigInt(1e6),xIt=BigInt(1e9),tRe=65535;W9r={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344}});function qt(t,...e){let r=new Error(OIt(G9r[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}var K9r,G9r,ic=w(()=>{Zne();Ds();K9r=A8.join(` + - `),G9r={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: - - ${U9r}`,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. + - ${K9r}`,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 SIt(t){return{raw:Number(t),formatted:pN(t)}}function xIt(t){if(t.id){if(typeof t.id!="string")throw qt("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return A8()}function tRe(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{ic();Ds();Ds();H9r={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},V9r={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"}});function OIt(){return{idToInternalId:new Map,internalIdToId:[],save:W9r,load:K9r}}function W9r(t){return{internalIdToId:t.internalIdToId}}function K9r(t,e){let{internalIdToId:r}=e;t.internalDocumentIDStore.idToInternalId.clear(),t.internalDocumentIDStore.internalIdToId=[];let n=r.length;for(let o=0;ot.internalIdToId.length?wi(t,e.toString()):e}function hg(t,e){if(t.internalIdToId.length{});function J9r(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function Y9r(t,e){let r=wi(t.sharedInternalDocumentStore,e);return t.docs[r]}function Z9r(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o"u"?!1:(delete t.docs[r],t.count--,!0)}function tKr(t){return t.count}function rKr(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function nKr(t){return{docs:t.docs,count:t.count}}function PIt(){return{create:J9r,get:Y9r,getMultiple:Z9r,getAll:X9r,store:Q9r,remove:eKr,count:tKr,load:rKr,save:nKr}}var oRe=w(()=>{gg()});function TIt(t,e){let r=[],n=t.plugins?.length;if(!n)return r;for(let o=0;o{ic();EIt=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"]});function eb(t,e,r,n){if(t.some(Qs))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function mN(t,e,r){if(t.some(Qs))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function pq(t,e,r,n,o){if(t.some(Qs))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function mq(t,e,r,n){if(t.some(Qs))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function MIt(t,e){if(t.some(Qs))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}var IIt,iRe,XA=w(()=>{Ds();IIt=["tokenizer","index","documentsStore","sorter"],iRe=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"]});function aRe(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(yg(t.l),yg(t.r))+1,e.h=Math.max(yg(e.l),yg(e.r))+1,e}function sRe(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(yg(t.l),yg(t.r))+1,e.h=Math.max(yg(e.l),yg(e.r))+1,e}function jIt(t,e,r){let n=[];function o(i){i!==null&&(e=e&&i.k<=r&&ki(n,i.v),r>i.k&&o(i.r))}return o(t.root),n}function uRe(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&&ki(n,i.v),!r&&i.k>e&&ki(n,i.v),o.push(i.r),o.push(i.l))}return n}function lRe(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&&ki(n,i.v),!r&&i.kt.k)t=t.r;else return t;return null}function DIt(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}function LIt(t,e,r,n=500){function o(i,a,s){if(i===null)return RIt++,{k:a,v:s,l:null,r:null,h:0};if(ai.k)i.r=o(i.r,a,s);else return i.v.push(...s),i;return RIt%n===0?iKr(i,a):i}t.root=o(t.root,e,r)}function iKr(t,e){t.h=1+Math.max(yg(t.l),yg(t.r));let r=yg(t.l)-yg(t.r);return r>1&&et.r.k?aRe(t):r>1&&e>t.l.k?(t.l=aRe(t.l),sRe(t)):r<-1&&e{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 kIt(t,e,r){let n=NIt(t.root,r);if(n){if(n.v.length===1){aKr(t,r);return}n.v.splice(n.v.indexOf(e),1)}}var RIt,$It=w(()=>{Ds();RIt=0});function BIt(){return{numberToDocumentId:new Map}}function qIt(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function UIt(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 zIt(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&&ki(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&&ki(i,u)}return i}}throw new Error("Invalid operation")}function HIt(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 cq(i)}}throw new Error("Invalid operation")}var VIt=w(()=>{Ds()});function sKr(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 cRe(t,e,r){let n=sKr(t,e,r);return{distance:n,isBounded:n>=0}}var dRe=w(()=>{});function hq(t,e){t.w=e.w+t.s}function Zne(t,e){t.d.push(e)}function uKr(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function pRe(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(lq(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&cRe(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),lq(e,i)!=null&&a.length>0){let s=new Set(e[i]),u=a.length;for(let l=0;l0)){let u=new Set(i[a]),l=s.length;for(let c=0;c=e.length)){e[r]in t.c&&M8(t.c[e[r]],e,r+1,n,o,i),M8(t,e,r+1,n-1,o,i);for(let a in t.c)M8(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&M8(t.c[a],e,r+1,n-1,o,i)}}}function mRe(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,M8(t,e,0,n||0,n,o),o}else{let o=e.length;for(let a=0;a{dRe();Ds();fRe=class{constructor(e,r,n){Cc(this,"k");Cc(this,"s");Cc(this,"c",{});Cc(this,"d",[]);Cc(this,"e");Cc(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 YIt(){return{root:null}}function ZIt(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-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.lon0;){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 eMt(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=cKr(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=lKr(e);if(n){let u=o?rMt:tMt;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 lKr(t){let e=0,r=0,n=0,o=t.length;for(let a=0,s=o-1;ao!=d>o&&n<(c-u)*(o-l)/(d-l)+u&&(r=!r)}return r}function tMt(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 rMt(t,e){let n=.0033528106647474805,o=(1-n)*6378137,i=Math.PI/180,a=t.lat*i,s=e.lat*i,u=(e.lon-t.lon)*i,l=Math.atan((1-n)*Math.tan(a)),c=Math.atan((1-n)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(c),m=Math.cos(c),h=u,b,g=1e3,y,S,x,O,P;do{let j=Math.sin(h),$=Math.cos(h);x=Math.sqrt(m*j*(m*j)+(f*p-d*m*$)*(f*p-d*m*$)),O=d*p+f*m*$,P=Math.atan2(x,O),y=f*m*j/x,S=1-y*y;let k=O-2*d*p/S,z=n/16*S*(4+n*(4-3*S));b=h,h=u+(1-z)*n*y*(P+z*x*(k+z*O*(-1+2*k*k)))}while(Math.abs(h-b)>1e-12&&--g>0);let E=S*(6378137*6378137-o*o)/(o*o),A=1+E/16384*(4096+E*(-768+E*(320-175*E))),I=E/1024*(256+E*(-128+E*(74-47*E))),R=I*x*(O-2*d*p/S+I/4*(O*(-1+2*x*x)-I/6*P*(-3+4*x*x)*(-3+4*P*P)));return o*A*(P-R)}var nMt=w(()=>{});function Xne(t,e,r=0,n){if(e===0)throw qt("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let h=0;hb[1]-h[1]);if(r===1)return s;let u=s.length,l=[];for(let h of o.entries())l.push([h[0],h[1][0],h[1][1]]);let c=l.sort((h,b)=>h[2]>b[2]?-1:h[2]b[1]?-1:h[1]"u"){if(r===0)return[];d=0}let f=c.length,p=new Array(f);for(let h=0;h{ic()});function gRe(t,e){let r=0;for(let n=0;n=n&&i.push([a,c])}return i.sort((a,s)=>s[1]-a[1])}var eoe=w(()=>{});function dKr(t,e,r,n,o){let i=wi(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 fKr(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=wi(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 pKr(t,e,r,n){let o=wi(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 mKr(t,e,r){t.tokenOccurrences[e][r]--}function hKr(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{let l=wi(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;LIt(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),KIt(d,p,l);break}case"Flat":{qIt(d,u,l);break}case"BKD":{ZIt(d,u,[l]);break}}}}function yKr(t,e,r,n,o,i,a,s,u,l){if(XO(i))return bKr(e,r,o,n);let c=gKr(t,e,r,n,a,s,u,l);if(!fq(i))return c(o);let d=o,f=d.length;for(let p=0;p({[a]:[],...i}),{});for(let i of n){let a=r[i];if(typeof e.indexes[i]>"u")throw qt("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=e.indexes[i];if(u==="Bool"){let f=s[a.toString()];ki(o[i],f);continue}if(u==="BKD"){let d;if("radius"in a)d="radius";else if("polygon"in a)d="polygon";else throw new Error(`Invalid operation ${a}`);if(d==="radius"){let{value:f,coordinates:p,unit:m="m",inside:h=!0,highPrecision:b=!1}=a[d],g=eRe(f,m),y=QIt(s.root,p,g,h,void 0,b);ki(o[i],y.flatMap(({docIDs:S})=>S))}else{let{coordinates:f,inside:p=!0,highPrecision:m=!1}=a[d],h=eMt(s.root,f,p,void 0,m);ki(o[i],h.flatMap(({docIDs:b})=>b))}continue}if(u==="Radix"&&(typeof a=="string"||Array.isArray(a))){for(let d of[a].flat()){let f=t.tokenizer.tokenize(d,t.language,i);for(let p of f){let m=mRe(s,{term:p,exact:!0});ki(o[i],Object.values(m).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw qt("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?HIt:zIt;ki(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=uRe(s,f,!1);break}case"gte":{p=uRe(s,f,!0);break}case"lt":{p=lRe(s,f,!1);break}case"lte":{p=lRe(s,f,!0);break}case"eq":{p=FIt(s,f)??[];break}case"between":{let[m,h]=f;p=jIt(s,m,h);break}}ki(o[i],p)}}return cq(Object.values(o))}function SKr(t){return t.searchableProperties}function xKr(t){return t.searchablePropertiesWithTypes}function aMt(t){let e=hN(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]=aMt(t.c[r]);return e}function CKr(t){return{numberToDocumentId:new Map(t)}}function OKr(t){return Array.from(t.numberToDocumentId.entries())}function PKr(t,e){let{indexes:r,vectorIndexes:n,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}=e,c={},d={};for(let f of Object.keys(r)){let{node:p,type:m,isArray:h}=r[f];switch(m){case"Radix":c[f]={type:"Radix",node:aMt(p),isArray:h};break;case"Flat":c[f]={type:"Flat",node:CKr(p),isArray:h};break;default:c[f]=r[f]}}for(let f of Object.keys(n)){let p=n[f].vectors;for(let m in p)p[m]=[p[m][0],new Float32Array(p[m][1])];d[f]={size:n[f].size,vectors:p}}return{sharedInternalDocumentStore:t,indexes:c,vectorIndexes:d,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}}function EKr(t){let{indexes:e,vectorIndexes:r,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}=t,l={};for(let d of Object.keys(r)){let f=r[d].vectors;for(let p in f)f[p]=[f[p][0],Array.from(f[p][1])];l[d]={size:r[d].size,vectors:f}}let c={};for(let d of Object.keys(e)){let{type:f,node:p,isArray:m}=e[d];if(f!=="Flat"){c[d]=e[d];continue}c[d]={type:"Flat",node:OKr(p),isArray:m}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function sMt(){return{create:iMt,insert:yKr,remove:_Kr,insertDocumentScoreParameters:dKr,insertTokenScoreParameters:fKr,removeDocumentScoreParameters:pKr,removeTokenScoreParameters:mKr,calculateResultScores:hKr,search:vKr,searchByWhereClause:wKr,getSearchableProperties:SKr,getSearchablePropertiesWithTypes:xKr,load:PKr,save:EKr}}var yRe=w(()=>{ic();$It();VIt();JIt();nMt();Ds();R8();eoe();I8();gg()});function uMt(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=uMt(t,e,s,n,u);ki(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!XO(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 qt("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function AKr(t,e,r,n){return n?.enabled!==!1?uMt(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function IKr(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=wi(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&bRe(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function lMt(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)NKr(t,r);t.isSorted=!0}function MKr(t,e,r){return e[1].localeCompare(r[1],hIt(t))}function RKr(t,e){return t[1]-e[1]}function jKr(t,e){return e[1]?-1:1}function NKr(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=MKr.bind(null,t.language);break;case"number":n=RKr.bind(null);break;case"boolean":n=jKr.bind(null);break}r.orderedDocs.sort(n);let o=r.orderedDocs.length;for(let i=0;i!r.orderedDocsToRemove.has(n[0])),r.orderedDocsToRemove.clear())}function LKr(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=wi(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function FKr(t,e,r){if(!t.enabled)throw qt("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw qt("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return bRe(t,n),lMt(t),e.sort((a,s)=>{let u=i.docs.get(wi(t.sharedInternalDocumentStore,a[0])),l=i.docs.get(wi(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 kKr(t){return t.enabled?t.sortableProperties:[]}function $Kr(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function BKr(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 qKr(t){if(!t.enabled)return{enabled:!1};DKr(t),lMt(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 cMt(){return{create:AKr,insert:IKr,remove:LKr,save:qKr,load:BKr,sortBy:FKr,getSortableProperties:kKr,getSortablePropertiesWithTypes:$Kr}}var _Re=w(()=>{ic();I8();gg();Ds();Gne()});function HKr(t){return t<192||t>383?t:zKr[t-192]||t}function dMt(t){let e=[];for(let r=0;r{zKr=[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 mMt(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(vRe),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(pMt),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+Ex+roe+"[^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(pMt),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(vRe),e&&n.test(e)&&(t=e+VKr[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(vRe),e&&n.test(e)&&(t=e+WKr[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(toe),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(toe),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(toe),o=new RegExp(GKr),i=new RegExp("^"+Ex+roe+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(toe),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}var VKr,WKr,KKr,roe,Ex,j8,vRe,GKr,toe,pMt,hMt=w(()=>{VKr={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"},WKr={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},KKr="[^aeiou]",roe="[aeiouy]",Ex=KKr+"[^aeiouy]*",j8=roe+"[aeiou]*",vRe="^("+Ex+")?"+j8+Ex,GKr="^("+Ex+")?"+j8+Ex+"("+j8+")?$",toe="^("+Ex+")?"+j8+Ex+j8+Ex,pMt="^("+Ex+")?"+roe});function wRe(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=dMt(e),this.normalizationCache.set(r,e),e)}function JKr(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function gMt(t,e,r){if(e&&e!==this.language)throw qt("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=mIt[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=JKr(n);return this.allowDuplicates?o:Array.from(new Set(o))}function SRe(t={}){if(!t.language)t.language="english";else if(!T8.includes(t.language))throw qt("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw qt("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=mMt;else throw qt("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 qt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw qt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw qt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:gMt,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:wRe,normalizationCache:new Map};return n.tokenize=gMt.bind(n),n.normalizeToken=wRe,n}var noe=w(()=>{ic();fMt();Gne();hMt()});function ZKr(t){let e={formatElapsedTime:SIt,getDocumentIndexId:xIt,getDocumentProperties:Jne,validateSchema:tRe};for(let r of iRe){let n=r;if(t[n]){if(typeof t[n]!="function")throw qt("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!IIt.includes(r)&&!iRe.includes(r))throw qt("UNSUPPORTED_COMPONENT",r)}function gq({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=A8());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=SRe(a):a=SRe({language:r??"english"}),n.tokenizer&&r)throw qt("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=OIt();s||(s=sMt()),l||(l=cMt()),u||(u=PIt()),ZKr(n);let{getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,formatElapsedTime:m}=n,h={data:{},caches:{},schema:t,tokenizer:a,index:s,sorter:l,documentsStore:u,internalDocumentIDStore:c,getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],afterUpdateMultiple:[],beforeUpdateMultiple:[],afterCreate:[],formatElapsedTime:m,id:o,plugins:i,version:XKr()};h.data={index:h.index.create(h,c,t),docs:h.documentsStore.create(h,c),sorting:h.sorter.create(h,c,t,e)};for(let g of EIt)h[g]=(h[g]??[]).concat(TIt(h,g));let b=h.afterCreate;return b&&MIt(b,h),h}function XKr(){return"{{VERSION}}"}var yMt=w(()=>{I8();oRe();AIt();XA();yRe();gg();_Re();noe();ic();Ds()});var bMt=w(()=>{});var xRe=w(()=>{I8();oRe();yRe();noe();_Re();gg()});var ooe,CRe,ORe,PRe=w(()=>{ooe="fulltext",CRe="hybrid",ORe="vector"});var QA,eI,ERe=w(()=>{PRe();QA=Symbol("orama.insertions"),eI=Symbol("orama.removals")});function TRe(t){typeof t[QA]!="number"&&(queueMicrotask(()=>{t[QA]=void 0}),t[QA]=0),t[QA]>1e3?(_Mt("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[QA]=-1):t[QA]>=0&&t[QA]++}function ARe(t){typeof t[eI]!="number"&&(queueMicrotask(()=>{t[eI]=void 0}),t[eI]=0),t[eI]>1e3?(_Mt("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[eI]=-1):t[eI]>=0&&t[eI]++}var _Mt,IRe=w(()=>{ERe();_Mt=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)}});function N8(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw qt("SCHEMA_VALIDATION_FAILURE",i);return Qs(t.index.beforeInsert)||Qs(t.index.insert)||Qs(t.index.afterInsert)?rGr(t,e,r,n,o):nGr(t,e,r,n,o)}async function rGr(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw qt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw qt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await eb(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=c[f];vMt(m,h,f,p)}return await oGr(t,s,l,d,u,r,e,o),n||await eb(t.afterInsert,t,s,e),TRe(t),s}function nGr(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw qt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw qt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||eb(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=c[f];vMt(m,h,f,p)}return iGr(t,s,l,d,u,r,e,o),n||eb(t.afterInsert,t,s,e),TRe(t),s}function vMt(t,e,r,n){if(!(CIt(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(XO(e)&&Array.isArray(n))&&!(fq(e)&&Array.isArray(n))&&!(eGr.has(e)&&tGr.has(t))&&t!==e)throw qt("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function oGr(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 iGr(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 eGr,tGr,MRe=w(()=>{xRe();Ds();XA();IRe();ic();eGr=new Set(["enum","enum[]"]),tGr=new Set(["string","number"])});function gN(t,e,r,n){return Qs(t.index.beforeRemove)||Qs(t.index.remove)||Qs(t.index.afterRemove)?aGr(t,e,r,n):sGr(t,e,r,n)}async function aGr(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=hg(t.internalDocumentIDStore,wi(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await eb(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let b=f[h];if(typeof b>"u")continue;let g=d[h];await t.index.beforeRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l),await t.index.remove(t.index,t.data.index,h,e,b,g,r,t.tokenizer,l)||(o=!1),await t.index.afterRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l)}let p=await t.sorter.getSortableProperties(t.data.sorting),m=await t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||await eb(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),ARe(t),o}function sGr(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=hg(t.internalDocumentIDStore,wi(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||eb(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let b=f[h];if(typeof b>"u")continue;let g=d[h];t.index.beforeRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l),t.index.remove(t.index,t.data.index,h,e,b,g,r,t.tokenizer,l)||(o=!1),t.index.afterRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l)}let p=t.sorter.getSortableProperties(t.data.sorting),m=t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||eb(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),ARe(t),o}function D8(t,e,r,n,o){return Qs(t.index.beforeRemove)||Qs(t.index.remove)||Qs(t.index.afterRemove)||Qs(t.beforeRemoveMultiple)||Qs(t.afterRemoveMultiple)?uGr(t,e,r,n,o):lGr(t,e,r,n,o)}async function uGr(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>hg(t.internalDocumentIDStore,wi(t.internalDocumentIDStore,s)));return o||await mN(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 gN(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await mN(t.afterRemoveMultiple,t,a),i}function lGr(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>hg(t.internalDocumentIDStore,wi(t.internalDocumentIDStore,l)));o||mN(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)gN(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||mN(t.afterRemoveMultiple,t,a),i}var RRe=w(()=>{XA();gg();IRe();Ds()});function cGr(t,e){return t[1]-e[1]}function dGr(t,e){return e[1]-t[1]}function fGr(t="desc"){return t.toLowerCase()==="asc"?cGr:dGr}function yq(t,e,r){let n={},o=e.map(([l])=>l),i=t.documentsStore.getMultiple(t.data.docs,o),a=Object.keys(r),s=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let l of a){let c;if(s[l]==="number"){let{ranges:d}=r[l],f=d.length,p=Array.from({length:f});for(let m=0;m{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 SMt(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 ioe=w(()=>{ic();Ds()});function bq(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 aoe=w(()=>{});function _q(t,e,r){let n=r.properties,o=n.length,i=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let g=0;g"u")throw qt("UNKNOWN_GROUP_BY_PROPERTY",y);if(!xMt.includes(i[y]))throw qt("INVALID_GROUP_BY_PROPERTY",y,xMt.join(", "),i[y])}let a=e.map(([g])=>hg(t.internalDocumentIDStore,g)),s=t.documentsStore.getMultiple(t.data.docs,a),u=s.length,l=r.maxResult||Number.MAX_SAFE_INTEGER,c=[],d={};for(let g=0;g"u")continue;let A=typeof E!="boolean"?E:""+E,I=S.perValue[A]??{indexes:[],count:0};I.count>=l||(I.indexes.push(O),I.count++,S.perValue[A]=I,x.add(E))}c.push(Array.from(x)),d[y]=S}let f=CMt(c),p=f.length,m=[];for(let g=0;gP-E),x.indexes.length!==0&&m.push(x)}let h=m.length,b=Array.from({length:h});for(let g=0;g({id:a[A],score:e[A][1],document:s[A]})),O=S.reducer.bind(null,y.values),P=S.getInitialValue(y.indexes.length),E=x.reduce(O,P);b[g]={values:y.values,result:E}}return b}function CMt(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=CMt(t,e+1),o=[];for(let i of r)for(let a of n){let s=[i];ki(s,a),o.push(s)}return o}var pGr,xMt,soe=w(()=>{ic();Ds();gg();pGr={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},xMt=["string","number","boolean"]});function OMt(t,e,r){let n=Qy(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(uoe,e.relevance??{});let s=Object.keys(t.data.index.vectorIndexes),u=e.facets&&Object.keys(e.facets).length>0,{limit:l=10,offset:c=0,term:d,properties:f,threshold:p=0,distinctOn:m,includeVectors:h=!1}=e,b=e.preflight===!0,{index:g,docs:y}=t.data,S=t.tokenizer.tokenize(d??"",r),x=t.caches.propertiesToSearch;if(!x){let j=t.index.getSearchablePropertiesWithTypes(g);x=t.index.getSearchableProperties(g),x=x.filter($=>j[$].startsWith("string")),t.caches.propertiesToSearch=x}if(f&&f!=="*"){for(let j of f)if(!x.includes(j))throw qt("UNKNOWN_INDEX",j,x.join(", "));x=x.filter(j=>f.includes(j))}let O=yN(t.tokenizer,t.index,t.documentsStore,r,e,x,S,t.documentsStore.count(y),n),P=Object.keys(e.where??{}).length>0,E=[];P&&(E=t.index.searchByWhereClause(O,g,e.where));let A=S.length;if(A||f?.length){let j=x.length;for(let $=0;$[j,0]));let I=Object.entries(O.uniqueDocsIDs).map(([j,$])=>[+j,$]);if(P&&(I=bq(E,I)),e.sortBy)if(typeof e.sortBy=="function"){let j=I.map(([z])=>z),k=t.documentsStore.getMultiple(t.data.docs,j).map((z,V)=>[I[V][0],I[V][1],z]);k.sort(e.sortBy),I=k.map(([z,V])=>[z,V])}else I=t.sorter.sortBy(t.data.sorting,I,e.sortBy).map(([j,$])=>[wi(t.internalDocumentIDStore,j),$]);else I=I.sort(wIt);let R;b||(R=m?EMt(t,I,c,l,m):loe(t,I,c,l));let N={elapsed:{formatted:"",raw:0},hits:[],count:I.length};if(typeof R<"u"&&(N.hits=R.filter(Boolean),h||Yne(N,s)),u){let j=yq(t,I,e.facets);N.facets=j}return e.groupBy&&(N.groups=_q(t,I,e.groupBy)),N.elapsed=t.formatElapsedTime(Qy()-O.timeStart),N}async function a(){t.beforeSearch&&await mq(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await pq(t.afterSearch,t,e,r,s),s}return o?a():i()}var PMt=w(()=>{R8();ioe();aoe();soe();XA();gg();ic();Ds();bN()});function jRe(t,e,r="english"){let n=Qy(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw qt("INVALID_VECTOR_INPUT",Object.keys(s).join(", "));let{limit:u=10,offset:l=0,includeVectors:c=!1}=e,d=t.data.index.vectorIndexes[s.property],f=d.size,p=d.vectors,m=e.facets&&Object.keys(e.facets).length>0,h=Object.keys(e.where??{}).length>0,{index:b,docs:g}=t.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?qt("INVALID_INPUT_VECTOR","undefined",f,"undefined"):qt("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let y=Qne(s.value,p,f,e.similarity).map(([j,$])=>[wi(t.internalDocumentIDStore,j),$]),S=t.caches.propertiesToSearch;if(!S){let j=t.index.getSearchablePropertiesWithTypes(b);S=t.index.getSearchableProperties(b),S=S.filter($=>j[$].startsWith("string")),t.caches.propertiesToSearch=S}let x=[],O=yN(t.tokenizer,t.index,t.documentsStore,r,e,S,x,t.documentsStore.count(g),n),P=[];h&&(P=t.index.searchByWhereClause(O,b,e.where),y=bq(P,y));let E=[];m&&(E=yq(t,y,e.facets));let A=Array.from({length:u});for(let j=0;j{bN();Ds();ioe();ic();eoe();aoe();soe();gg();XA()});function AMt(t,e,r){let n=Qy(),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=mGr(t,e,r),f=hGr(t,e),{index:p,docs:m}=t.data,h=e.hybridWeights,b=yGr(d,f,e.term??"",h),g=t.tokenizer.tokenize(e.term??"",r),y=t.caches.propertiesToSearch;if(!y){let N=t.index.getSearchablePropertiesWithTypes(p);y=t.index.getSearchableProperties(p),y=y.filter(j=>N[j].startsWith("string")),t.caches.propertiesToSearch=y}if(e.properties&&e.properties!=="*"){for(let N of e.properties)if(!y.includes(N))throw qt("UNKNOWN_INDEX",N,y.join(", "));y=y.filter(N=>e.properties.includes(N))}let S=yN(t.tokenizer,t.index,t.documentsStore,r,e,y,g,t.documentsStore.count(m),n),x=Object.keys(e.where??{}).length>0,O=[];x&&(O=t.index.searchByWhereClause(S,p,e.where),b=bq(O,b));let P;c&&(P=yq(t,b,e.facets));let E;e.groupBy&&(E=_q(t,b,e.groupBy));let A=loe(t,b,s,u).filter(Boolean),I=Qy(),R={count:b.length,elapsed:{raw:Number(I-n),formatted:pN(I-n)},hits:A,...P?{facets:P}:{},...E?{groups:E}:{}};if(!l){let N=Object.keys(t.data.index.vectorIndexes);Yne(R,N)}return R}async function a(){t.beforeSearch&&await mq(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await pq(t.afterSearch,t,e,r,s),s}return o?a():i()}function mGr(t,e,r){let n=Qy();e.relevance=Object.assign(uoe,e.relevance??{});let{term:o="",properties:i,threshold:a=0}=e,{index:s,docs:u}=t.data,l=t.tokenizer.tokenize(o,r),c=t.caches.propertiesToSearch;if(!c){let m=t.index.getSearchablePropertiesWithTypes(s);c=t.index.getSearchableProperties(s),c=c.filter(h=>m[h].startsWith("string")),t.caches.propertiesToSearch=c}if(i&&i!=="*"){let m=new Set(c),h=new Set(i);for(let b of i)if(!m.has(b))throw qt("UNKNOWN_INDEX",b,c.join(", "));c=c.filter(b=>h.has(b))}let d=yN(t.tokenizer,t.index,t.documentsStore,r,e,c,l,t.documentsStore.count(u),n),f=l.length;if(f||i&&i.length>0){let m=c.length;for(let h=0;h[m,0]));let p=Object.entries(d.uniqueDocsIDs).map(([m,h])=>[+m,h]).sort((m,h)=>h[1]-m[1]);return IMt(p)}function hGr(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 qt("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw qt("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=Qne(r.value,i,o,e.similarity).map(([s,u])=>[wi(t.internalDocumentIDStore,s),u]);return IMt(a)}function DRe([,t]){return t}function IMt(t){let e=Math.max.apply(Math,t.map(DRe));return t.map(([r,n])=>[r,n/e])}function TMt(t,e){return t/e}function gGr(t,e){return(r,n)=>r*t+n*e}function yGr(t,e,r,n){let o=Math.max.apply(Math,t.map(DRe)),i=Math.max.apply(Math,e.map(DRe)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:bGr(r),l=new Map,c=t.length,d=gGr(s,u);for(let p=0;pm[1]-p[1])}function bGr(t){return{text:.5,vector:.5}}var MMt=w(()=>{Ds();aoe();R8();ic();bN();ioe();soe();eoe();gg();bN();XA()});function yN(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 Xc(t,e,r){let n=e.mode??ooe;if(n===ooe)return OMt(t,e,r);if(n===ORe)return jRe(t,e);if(n===CRe)return AMt(t,e);throw qt("INVALID_SEARCH_MODE",n)}function EMt(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"u")continue;let[p,m]=f;if(u.has(p))continue;let h=t.documentsStore.get(i,p),b=dq(h,o);if(!(typeof b>"u"||a.has(b))&&(a.set(b,!0),c++,!(c<=r)&&(s.push({id:hg(t.internalDocumentIDStore,p),score:m,document:h}),u.add(p),c>=r+n)))break}return s}function loe(t,e,r,n){let o=t.data.docs,i=Array.from({length:n}),a=new Set;for(let s=r;s"u")break;let[l,c]=u;if(!a.has(l)){let d=t.documentsStore.get(o,l);i[s]={id:hg(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}var uoe,bN=w(()=>{gg();ic();Ds();PRe();PMt();NRe();MMt();uoe={k:1.2,b:.75,d:.5}});function coe(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 LRe(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 RMt=w(()=>{});var jMt=w(()=>{XA();ic();MRe();RRe();Ds()});var NMt=w(()=>{ic();bN()});var DMt=w(()=>{dRe();Ds();R8();noe()});var L8=w(()=>{yMt();bMt();MRe();RRe();bN();NRe();RMt();jMt();NMt();ERe();xRe();DMt()});function SGr(t,e){let r=LMt(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function LMt(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var Bqo,qqo,vGr,wGr,FRe,xGr,doe,FMt=w(()=>{Bqo=new Error("timeout while waiting for mutex to become available"),qqo=new Error("mutex already locked"),vGr=new Error("request for lock canceled"),wGr=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())})},FRe=class{constructor(e,r=vGr){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=LMt(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return wGr(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]=[]),SGr(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].prioritye(),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 kMt=v(()=>{});var Ln=v((foe,$Mt)=>{(function(t,e){typeof foe=="object"?$Mt.exports=foe=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(foe,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=kMt()}catch{}var o=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function g(){}return function(y){var S;return g.prototype=y,S=new g,g.prototype=null,S}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(g){var y=i(this);return g&&y.mixIn(g),(!y.hasOwnProperty("init")||this.init===y.init)&&(y.init=function(){y.$super.init.apply(this,arguments)}),y.init.prototype=y,y.$super=this,y},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var y in g)g.hasOwnProperty(y)&&(this[y]=g[y]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(g,y){g=this.words=g||[],y!=r?this.sigBytes=y:this.sigBytes=g.length*4},toString:function(g){return(g||d).stringify(this)},concat:function(g){var y=this.words,S=g.words,x=this.sigBytes,O=g.sigBytes;if(this.clamp(),x%4)for(var P=0;P>>2]>>>24-P%4*8&255;y[x+P>>>2]|=E<<24-(x+P)%4*8}else for(var A=0;A>>2]=S[A>>>2];return this.sigBytes+=O,this},clamp:function(){var g=this.words,y=this.sigBytes;g[y>>>2]&=4294967295<<32-y%4*8,g.length=e.ceil(y/4)},clone:function(){var g=u.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var y=[],S=0;S>>2]>>>24-O%4*8&255;x.push((P>>>4).toString(16)),x.push((P&15).toString(16))}return x.join("")},parse:function(g){for(var y=g.length,S=[],x=0;x>>3]|=parseInt(g.substr(x,2),16)<<24-x%8*4;return new l.init(S,y/2)}},f=c.Latin1={stringify:function(g){for(var y=g.words,S=g.sigBytes,x=[],O=0;O>>2]>>>24-O%4*8&255;x.push(String.fromCharCode(P))}return x.join("")},parse:function(g){for(var y=g.length,S=[],x=0;x>>2]|=(g.charCodeAt(x)&255)<<24-x%4*8;return new l.init(S,y)}},p=c.Utf8={stringify:function(g){try{return decodeURIComponent(escape(f.stringify(g)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(g){return f.parse(unescape(encodeURIComponent(g)))}},m=s.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(g){typeof g=="string"&&(g=p.parse(g)),this._data.concat(g),this._nDataBytes+=g.sigBytes},_process:function(g){var y,S=this._data,x=S.words,O=S.sigBytes,P=this.blockSize,E=P*4,A=O/E;g?A=e.ceil(A):A=e.max((A|0)-this._minBufferSize,0);var I=A*P,R=e.min(I*4,O);if(I){for(var N=0;N{(function(t,e){typeof poe=="object"?BMt.exports=poe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(poe,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{(function(t,e){typeof moe=="object"?qMt.exports=moe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(moe,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>>2]|=a[l]<<24-l%4*8;o.call(this,u,s)}else o.apply(this,arguments)};i.prototype=n}}(),t.lib.WordArray})});var HMt=v((hoe,zMt)=>{(function(t,e){typeof hoe=="object"?zMt.exports=hoe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(hoe,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>>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>>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>>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>>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 tI=v((goe,VMt)=>{(function(t,e){typeof goe=="object"?VMt.exports=goe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(goe,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>>2]>>>24-f%4*8&255,m=u[f+1>>>2]>>>24-(f+1)%4*8&255,h=u[f+2>>>2]>>>24-(f+2)%4*8&255,b=p<<16|m<<8|h,g=0;g<4&&f+g*.75>>6*(3-g)&63));var y=c.charAt(64);if(y)for(;d.length%4;)d.push(y);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>>6-f%4*2,h=p|m;c[d>>>2]|=h<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64})});var KMt=v((yoe,WMt)=>{(function(t,e){typeof yoe=="object"?WMt.exports=yoe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(yoe,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>>2]>>>24-p%4*8&255,h=l[p+1>>>2]>>>24-(p+1)%4*8&255,b=l[p+2>>>2]>>>24-(p+2)%4*8&255,g=m<<16|h<<8|b,y=0;y<4&&p+y*.75>>6*(3-y)&63));var S=d.charAt(64);if(S)for(;f.length%4;)f.push(S);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>>6-f%4*2,h=p|m;c[d>>>2]|=h<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64url})});var rI=v((boe,GMt)=>{(function(t,e){typeof boe=="object"?GMt.exports=boe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(boe,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[];(function(){for(var p=0;p<64;p++)s[p]=e.abs(e.sin(p+1))*4294967296|0})();var u=a.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,m){for(var h=0;h<16;h++){var b=m+h,g=p[b];p[b]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var y=this._hash.words,S=p[m+0],x=p[m+1],O=p[m+2],P=p[m+3],E=p[m+4],A=p[m+5],I=p[m+6],R=p[m+7],N=p[m+8],j=p[m+9],$=p[m+10],k=p[m+11],z=p[m+12],V=p[m+13],Q=p[m+14],J=p[m+15],D=y[0],B=y[1],q=y[2],K=y[3];D=l(D,B,q,K,S,7,s[0]),K=l(K,D,B,q,x,12,s[1]),q=l(q,K,D,B,O,17,s[2]),B=l(B,q,K,D,P,22,s[3]),D=l(D,B,q,K,E,7,s[4]),K=l(K,D,B,q,A,12,s[5]),q=l(q,K,D,B,I,17,s[6]),B=l(B,q,K,D,R,22,s[7]),D=l(D,B,q,K,N,7,s[8]),K=l(K,D,B,q,j,12,s[9]),q=l(q,K,D,B,$,17,s[10]),B=l(B,q,K,D,k,22,s[11]),D=l(D,B,q,K,z,7,s[12]),K=l(K,D,B,q,V,12,s[13]),q=l(q,K,D,B,Q,17,s[14]),B=l(B,q,K,D,J,22,s[15]),D=c(D,B,q,K,x,5,s[16]),K=c(K,D,B,q,I,9,s[17]),q=c(q,K,D,B,k,14,s[18]),B=c(B,q,K,D,S,20,s[19]),D=c(D,B,q,K,A,5,s[20]),K=c(K,D,B,q,$,9,s[21]),q=c(q,K,D,B,J,14,s[22]),B=c(B,q,K,D,E,20,s[23]),D=c(D,B,q,K,j,5,s[24]),K=c(K,D,B,q,Q,9,s[25]),q=c(q,K,D,B,P,14,s[26]),B=c(B,q,K,D,N,20,s[27]),D=c(D,B,q,K,V,5,s[28]),K=c(K,D,B,q,O,9,s[29]),q=c(q,K,D,B,R,14,s[30]),B=c(B,q,K,D,z,20,s[31]),D=d(D,B,q,K,A,4,s[32]),K=d(K,D,B,q,N,11,s[33]),q=d(q,K,D,B,k,16,s[34]),B=d(B,q,K,D,Q,23,s[35]),D=d(D,B,q,K,x,4,s[36]),K=d(K,D,B,q,E,11,s[37]),q=d(q,K,D,B,R,16,s[38]),B=d(B,q,K,D,$,23,s[39]),D=d(D,B,q,K,V,4,s[40]),K=d(K,D,B,q,S,11,s[41]),q=d(q,K,D,B,P,16,s[42]),B=d(B,q,K,D,I,23,s[43]),D=d(D,B,q,K,j,4,s[44]),K=d(K,D,B,q,z,11,s[45]),q=d(q,K,D,B,J,16,s[46]),B=d(B,q,K,D,O,23,s[47]),D=f(D,B,q,K,S,6,s[48]),K=f(K,D,B,q,R,10,s[49]),q=f(q,K,D,B,Q,15,s[50]),B=f(B,q,K,D,A,21,s[51]),D=f(D,B,q,K,z,6,s[52]),K=f(K,D,B,q,P,10,s[53]),q=f(q,K,D,B,$,15,s[54]),B=f(B,q,K,D,x,21,s[55]),D=f(D,B,q,K,N,6,s[56]),K=f(K,D,B,q,J,10,s[57]),q=f(q,K,D,B,I,15,s[58]),B=f(B,q,K,D,V,21,s[59]),D=f(D,B,q,K,E,6,s[60]),K=f(K,D,B,q,k,10,s[61]),q=f(q,K,D,B,O,15,s[62]),B=f(B,q,K,D,j,21,s[63]),y[0]=y[0]+D|0,y[1]=y[1]+B|0,y[2]=y[2]+q|0,y[3]=y[3]+K|0},_doFinalize:function(){var p=this._data,m=p.words,h=this._nDataBytes*8,b=p.sigBytes*8;m[b>>>5]|=128<<24-b%32;var g=e.floor(h/4294967296),y=h;m[(b+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,m[(b+64>>>9<<4)+14]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,p.sigBytes=(m.length+1)*4,this._process();for(var S=this._hash,x=S.words,O=0;O<4;O++){var P=x[O];x[O]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360}return S},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,m,h,b,g,y,S){var x=p+(m&h|~m&b)+g+S;return(x<>>32-y)+m}function c(p,m,h,b,g,y,S){var x=p+(m&b|h&~b)+g+S;return(x<>>32-y)+m}function d(p,m,h,b,g,y,S){var x=p+(m^h^b)+g+S;return(x<>>32-y)+m}function f(p,m,h,b,g,y,S){var x=p+(h^(m|~b))+g+S;return(x<>>32-y)+m}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var kRe=v((_oe,JMt)=>{(function(t,e){typeof _oe=="object"?JMt.exports=_oe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(_oe,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.Hasher,i=e.algo,a=[],s=i.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,l){for(var c=this._hash.words,d=c[0],f=c[1],p=c[2],m=c[3],h=c[4],b=0;b<80;b++){if(b<16)a[b]=u[l+b]|0;else{var g=a[b-3]^a[b-8]^a[b-14]^a[b-16];a[b]=g<<1|g>>>31}var y=(d<<5|d>>>27)+h+a[b];b<20?y+=(f&p|~f&m)+1518500249:b<40?y+=(f^p^m)+1859775393:b<60?y+=(f&p|f&m|p&m)-1894007588:y+=(f^p^m)-899497514,h=m,m=p,p=f<<30|f>>>2,f=d,d=y}c[0]=c[0]+d|0,c[1]=c[1]+f|0,c[2]=c[2]+p|0,c[3]=c[3]+m|0,c[4]=c[4]+h|0},_doFinalize:function(){var u=this._data,l=u.words,c=this._nDataBytes*8,d=u.sigBytes*8;return l[d>>>5]|=128<<24-d%32,l[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),l[(d+64>>>9<<4)+15]=c,u.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var u=o.clone.call(this);return u._hash=this._hash.clone(),u}});e.SHA1=o._createHelper(s),e.HmacSHA1=o._createHmacHelper(s)}(),t.SHA1})});var woe=v((voe,YMt)=>{(function(t,e){typeof voe=="object"?YMt.exports=voe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(voe,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[],u=[];(function(){function d(h){for(var b=e.sqrt(h),g=2;g<=b;g++)if(!(h%g))return!1;return!0}function f(h){return(h-(h|0))*4294967296|0}for(var p=2,m=0;m<64;)d(p)&&(m<8&&(s[m]=f(e.pow(p,1/2))),u[m]=f(e.pow(p,1/3)),m++),p++})();var l=[],c=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(d,f){for(var p=this._hash.words,m=p[0],h=p[1],b=p[2],g=p[3],y=p[4],S=p[5],x=p[6],O=p[7],P=0;P<64;P++){if(P<16)l[P]=d[f+P]|0;else{var E=l[P-15],A=(E<<25|E>>>7)^(E<<14|E>>>18)^E>>>3,I=l[P-2],R=(I<<15|I>>>17)^(I<<13|I>>>19)^I>>>10;l[P]=A+l[P-7]+R+l[P-16]}var N=y&S^~y&x,j=m&h^m&b^h&b,$=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),k=(y<<26|y>>>6)^(y<<21|y>>>11)^(y<<7|y>>>25),z=O+k+N+u[P]+l[P],V=$+j;O=x,x=S,S=y,y=g+z|0,g=b,b=h,h=m,m=z+V|0}p[0]=p[0]+m|0,p[1]=p[1]+h|0,p[2]=p[2]+b|0,p[3]=p[3]+g|0,p[4]=p[4]+y|0,p[5]=p[5]+S|0,p[6]=p[6]+x|0,p[7]=p[7]+O|0},_doFinalize:function(){var d=this._data,f=d.words,p=this._nDataBytes*8,m=d.sigBytes*8;return f[m>>>5]|=128<<24-m%32,f[(m+64>>>9<<4)+14]=e.floor(p/4294967296),f[(m+64>>>9<<4)+15]=p,d.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var d=i.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA256=i._createHelper(c),r.HmacSHA256=i._createHmacHelper(c)}(Math),t.SHA256})});var XMt=v((Soe,ZMt)=>{(function(t,e,r){typeof Soe=="object"?ZMt.exports=Soe=e(Ln(),woe()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(Soe,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 $Re=v((xoe,QMt)=>{(function(t,e,r){typeof xoe=="object"?QMt.exports=xoe=e(Ln(),F8()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(xoe,function(t){return function(){var e=t,r=e.lib,n=r.Hasher,o=e.x64,i=o.Word,a=o.WordArray,s=e.algo;function u(){return i.create.apply(i,arguments)}var l=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],c=[];(function(){for(var f=0;f<80;f++)c[f]=u()})();var d=s.SHA512=n.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(f,p){for(var m=this._hash.words,h=m[0],b=m[1],g=m[2],y=m[3],S=m[4],x=m[5],O=m[6],P=m[7],E=h.high,A=h.low,I=b.high,R=b.low,N=g.high,j=g.low,$=y.high,k=y.low,z=S.high,V=S.low,Q=x.high,J=x.low,D=O.high,B=O.low,q=P.high,K=P.low,H=E,ee=A,U=I,W=R,Y=N,ae=j,Oe=$,le=k,Be=z,ze=V,rt=Q,cr=J,wn=D,Le=B,pt=q,mt=K,ht=0;ht<80;ht++){var te,et,Re=c[ht];if(ht<16)et=Re.high=f[p+ht*2]|0,te=Re.low=f[p+ht*2+1]|0;else{var Pe=c[ht-15],oe=Pe.high,se=Pe.low,ce=(oe>>>1|se<<31)^(oe>>>8|se<<24)^oe>>>7,Ce=(se>>>1|oe<<31)^(se>>>8|oe<<24)^(se>>>7|oe<<25),Je=c[ht-2],ir=Je.high,ea=Je.low,ta=(ir>>>19|ea<<13)^(ir<<3|ea>>>29)^ir>>>6,xc=(ea>>>19|ir<<13)^(ea<<3|ir>>>29)^(ea>>>6|ir<<26),Cd=c[ht-7],qi=Cd.high,lp=Cd.low,yf=c[ht-16],bf=yf.high,Sn=yf.low;te=Ce+lp,et=ce+qi+(te>>>0>>0?1:0),te=te+xc,et=et+ta+(te>>>0>>0?1:0),te=te+Sn,et=et+bf+(te>>>0>>0?1:0),Re.high=et,Re.low=te}var _f=Be&rt^~Be&wn,sC=ze&cr^~ze&Le,kb=H&U^H&Y^U&Y,is=ee&W^ee&ae^W&ae,$s=(H>>>28|ee<<4)^(H<<30|ee>>>2)^(H<<25|ee>>>7),La=(ee>>>28|H<<4)^(ee<<30|H>>>2)^(ee<<25|H>>>7),vf=(Be>>>14|ze<<18)^(Be>>>18|ze<<14)^(Be<<23|ze>>>9),Od=(ze>>>14|Be<<18)^(ze>>>18|Be<<14)^(ze<<23|Be>>>9),ws=l[ht],cp=ws.high,wf=ws.low,In=mt+Od,Ye=pt+vf+(In>>>0>>0?1:0),In=In+sC,Ye=Ye+_f+(In>>>0>>0?1:0),In=In+wf,Ye=Ye+cp+(In>>>0>>0?1:0),In=In+te,Ye=Ye+et+(In>>>0>>0?1:0),Sf=La+is,mm=$s+kb+(Sf>>>0>>0?1:0);pt=wn,mt=Le,wn=rt,Le=cr,rt=Be,cr=ze,ze=le+In|0,Be=Oe+Ye+(ze>>>0>>0?1:0)|0,Oe=Y,le=ae,Y=U,ae=W,U=H,W=ee,ee=In+Sf|0,H=Ye+mm+(ee>>>0>>0?1:0)|0}A=h.low=A+ee,h.high=E+H+(A>>>0>>0?1:0),R=b.low=R+W,b.high=I+U+(R>>>0>>0?1:0),j=g.low=j+ae,g.high=N+Y+(j>>>0>>0?1:0),k=y.low=k+le,y.high=$+Oe+(k>>>0>>0?1:0),V=S.low=V+ze,S.high=z+Be+(V>>>0>>0?1:0),J=x.low=J+cr,x.high=Q+rt+(J>>>0>>0?1:0),B=O.low=B+Le,O.high=D+wn+(B>>>0>>0?1:0),K=P.low=K+mt,P.high=q+pt+(K>>>0>>0?1:0)},_doFinalize:function(){var f=this._data,p=f.words,m=this._nDataBytes*8,h=f.sigBytes*8;p[h>>>5]|=128<<24-h%32,p[(h+128>>>10<<5)+30]=Math.floor(m/4294967296),p[(h+128>>>10<<5)+31]=m,f.sigBytes=p.length*4,this._process();var b=this._hash.toX32();return b},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 tRt=v((Coe,eRt)=>{(function(t,e,r){typeof Coe=="object"?eRt.exports=Coe=e(Ln(),F8(),$Re()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(Coe,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 nRt=v((Ooe,rRt)=>{(function(t,e,r){typeof Ooe=="object"?rRt.exports=Ooe=e(Ln(),F8()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Ooe,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.x64,s=a.Word,u=r.algo,l=[],c=[],d=[];(function(){for(var m=1,h=0,b=0;b<24;b++){l[m+5*h]=(b+1)*(b+2)/2%64;var g=h%5,y=(2*m+3*h)%5;m=g,h=y}for(var m=0;m<5;m++)for(var h=0;h<5;h++)c[m+5*h]=h+(2*m+3*h)%5*5;for(var S=1,x=0;x<24;x++){for(var O=0,P=0,E=0;E<7;E++){if(S&1){var A=(1<>>24)&16711935|(S<<24|S>>>8)&4278255360,x=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360;var O=b[y];O.high^=x,O.low^=S}for(var P=0;P<24;P++){for(var E=0;E<5;E++){for(var A=0,I=0,R=0;R<5;R++){var O=b[E+5*R];A^=O.high,I^=O.low}var N=f[E];N.high=A,N.low=I}for(var E=0;E<5;E++)for(var j=f[(E+4)%5],$=f[(E+1)%5],k=$.high,z=$.low,A=j.high^(k<<1|z>>>31),I=j.low^(z<<1|k>>>31),R=0;R<5;R++){var O=b[E+5*R];O.high^=A,O.low^=I}for(var V=1;V<25;V++){var A,I,O=b[V],Q=O.high,J=O.low,D=l[V];D<32?(A=Q<>>32-D,I=J<>>32-D):(A=J<>>64-D,I=Q<>>64-D);var B=f[c[V]];B.high=A,B.low=I}var q=f[0],K=b[0];q.high=K.high,q.low=K.low;for(var E=0;E<5;E++)for(var R=0;R<5;R++){var V=E+5*R,O=b[V],H=f[V],ee=f[(E+1)%5+5*R],U=f[(E+2)%5+5*R];O.high=H.high^~ee.high&U.high,O.low=H.low^~ee.low&U.low}var O=b[0],W=d[P];O.high^=W.high,O.low^=W.low}},_doFinalize:function(){var m=this._data,h=m.words,b=this._nDataBytes*8,g=m.sigBytes*8,y=this.blockSize*32;h[g>>>5]|=1<<24-g%32,h[(e.ceil((g+1)/y)*y>>>5)-1]|=128,m.sigBytes=h.length*4,this._process();for(var S=this._state,x=this.cfg.outputLength/8,O=x/8,P=[],E=0;E>>24)&16711935|(I<<24|I>>>8)&4278255360,R=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,P.push(R),P.push(I)}return new o.init(P,x)},clone:function(){for(var m=i.clone.call(this),h=m._state=this._state.slice(0),b=0;b<25;b++)h[b]=h[b].clone();return m}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})});var iRt=v((Poe,oRt)=>{(function(t,e){typeof Poe=="object"?oRt.exports=Poe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Poe,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=o.create([0,1518500249,1859775393,2400959708,2840853838]),f=o.create([1352829926,1548603684,1836072691,2053994217,0]),p=a.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(x,O){for(var P=0;P<16;P++){var E=O+P,A=x[E];x[E]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var I=this._hash.words,R=d.words,N=f.words,j=s.words,$=u.words,k=l.words,z=c.words,V,Q,J,D,B,q,K,H,ee,U;q=V=I[0],K=Q=I[1],H=J=I[2],ee=D=I[3],U=B=I[4];for(var W,P=0;P<80;P+=1)W=V+x[O+j[P]]|0,P<16?W+=m(Q,J,D)+R[0]:P<32?W+=h(Q,J,D)+R[1]:P<48?W+=b(Q,J,D)+R[2]:P<64?W+=g(Q,J,D)+R[3]:W+=y(Q,J,D)+R[4],W=W|0,W=S(W,k[P]),W=W+B|0,V=B,B=D,D=S(J,10),J=Q,Q=W,W=q+x[O+$[P]]|0,P<16?W+=y(K,H,ee)+N[0]:P<32?W+=g(K,H,ee)+N[1]:P<48?W+=b(K,H,ee)+N[2]:P<64?W+=h(K,H,ee)+N[3]:W+=m(K,H,ee)+N[4],W=W|0,W=S(W,z[P]),W=W+U|0,q=U,U=ee,ee=S(H,10),H=K,K=W;W=I[1]+J+ee|0,I[1]=I[2]+D+U|0,I[2]=I[3]+B+q|0,I[3]=I[4]+V+K|0,I[4]=I[0]+Q+H|0,I[0]=W},_doFinalize:function(){var x=this._data,O=x.words,P=this._nDataBytes*8,E=x.sigBytes*8;O[E>>>5]|=128<<24-E%32,O[(E+64>>>9<<4)+14]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,x.sigBytes=(O.length+1)*4,this._process();for(var A=this._hash,I=A.words,R=0;R<5;R++){var N=I[R];I[R]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360}return A},clone:function(){var x=i.clone.call(this);return x._hash=this._hash.clone(),x}});function m(x,O,P){return x^O^P}function h(x,O,P){return x&O|~x&P}function b(x,O,P){return(x|~O)^P}function g(x,O,P){return x&P|O&~P}function y(x,O,P){return x^(O|~P)}function S(x,O){return x<>>32-O}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),t.RIPEMD160})});var Toe=v((Eoe,aRt)=>{(function(t,e){typeof Eoe=="object"?aRt.exports=Eoe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Eoe,function(t){(function(){var e=t,r=e.lib,n=r.Base,o=e.enc,i=o.Utf8,a=e.algo,s=a.HMAC=n.extend({init:function(u,l){u=this._hasher=new u.init,typeof l=="string"&&(l=i.parse(l));var c=u.blockSize,d=c*4;l.sigBytes>d&&(l=u.finalize(l)),l.clamp();for(var f=this._oKey=l.clone(),p=this._iKey=l.clone(),m=f.words,h=p.words,b=0;b{(function(t,e,r){typeof Aoe=="object"?sRt.exports=Aoe=e(Ln(),woe(),Toe()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(Aoe,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.SHA256,s=i.HMAC,u=i.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:25e4}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,c){for(var d=this.cfg,f=s.create(d.hasher,l),p=o.create(),m=o.create([1]),h=p.words,b=m.words,g=d.keySize,y=d.iterations;h.length{(function(t,e,r){typeof Ioe=="object"?lRt.exports=Ioe=e(Ln(),kRe(),Toe()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(Ioe,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.MD5,s=i.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:1}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,l){for(var c,d=this.cfg,f=d.hasher.create(),p=o.create(),m=p.words,h=d.keySize,b=d.iterations;m.length{(function(t,e,r){typeof Moe=="object"?cRt.exports=Moe=e(Ln(),QO()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(Moe,function(t){t.lib.Cipher||function(e){var r=t,n=r.lib,o=n.Base,i=n.WordArray,a=n.BufferedBlockAlgorithm,s=r.enc,u=s.Utf8,l=s.Base64,c=r.algo,d=c.EvpKDF,f=n.Cipher=a.extend({cfg:o.extend(),createEncryptor:function(N,j){return this.create(this._ENC_XFORM_MODE,N,j)},createDecryptor:function(N,j){return this.create(this._DEC_XFORM_MODE,N,j)},init:function(N,j,$){this.cfg=this.cfg.extend($),this._xformMode=N,this._key=j,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(N){return this._append(N),this._process()},finalize:function(N){N&&this._append(N);var j=this._doFinalize();return j},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function N(j){return typeof j=="string"?R:E}return function(j){return{encrypt:function($,k,z){return N(k).encrypt(j,$,k,z)},decrypt:function($,k,z){return N(k).decrypt(j,$,k,z)}}}}()}),p=n.StreamCipher=f.extend({_doFinalize:function(){var N=this._process(!0);return N},blockSize:1}),m=r.mode={},h=n.BlockCipherMode=o.extend({createEncryptor:function(N,j){return this.Encryptor.create(N,j)},createDecryptor:function(N,j){return this.Decryptor.create(N,j)},init:function(N,j){this._cipher=N,this._iv=j}}),b=m.CBC=function(){var N=h.extend();N.Encryptor=N.extend({processBlock:function($,k){var z=this._cipher,V=z.blockSize;j.call(this,$,k,V),z.encryptBlock($,k),this._prevBlock=$.slice(k,k+V)}}),N.Decryptor=N.extend({processBlock:function($,k){var z=this._cipher,V=z.blockSize,Q=$.slice(k,k+V);z.decryptBlock($,k),j.call(this,$,k,V),this._prevBlock=Q}});function j($,k,z){var V,Q=this._iv;Q?(V=Q,this._iv=e):V=this._prevBlock;for(var J=0;J>>2]&255;N.sigBytes-=j}},S=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:b,padding:y}),reset:function(){var N;f.reset.call(this);var j=this.cfg,$=j.iv,k=j.mode;this._xformMode==this._ENC_XFORM_MODE?N=k.createEncryptor:(N=k.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==N?this._mode.init(this,$&&$.words):(this._mode=N.call(k,this,$&&$.words),this._mode.__creator=N)},_doProcessBlock:function(N,j){this._mode.processBlock(N,j)},_doFinalize:function(){var N,j=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(j.pad(this._data,this.blockSize),N=this._process(!0)):(N=this._process(!0),j.unpad(N)),N},blockSize:128/32}),x=n.CipherParams=o.extend({init:function(N){this.mixIn(N)},toString:function(N){return(N||this.formatter).stringify(this)}}),O=r.format={},P=O.OpenSSL={stringify:function(N){var j,$=N.ciphertext,k=N.salt;return k?j=i.create([1398893684,1701076831]).concat(k).concat($):j=$,j.toString(l)},parse:function(N){var j,$=l.parse(N),k=$.words;return k[0]==1398893684&&k[1]==1701076831&&(j=i.create(k.slice(2,4)),k.splice(0,4),$.sigBytes-=16),x.create({ciphertext:$,salt:j})}},E=n.SerializableCipher=o.extend({cfg:o.extend({format:P}),encrypt:function(N,j,$,k){k=this.cfg.extend(k);var z=N.createEncryptor($,k),V=z.finalize(j),Q=z.cfg;return x.create({ciphertext:V,key:$,iv:Q.iv,algorithm:N,mode:Q.mode,padding:Q.padding,blockSize:N.blockSize,formatter:k.format})},decrypt:function(N,j,$,k){k=this.cfg.extend(k),j=this._parse(j,k.format);var z=N.createDecryptor($,k).finalize(j.ciphertext);return z},_parse:function(N,j){return typeof N=="string"?j.parse(N,this):N}}),A=r.kdf={},I=A.OpenSSL={execute:function(N,j,$,k,z){if(k||(k=i.random(64/8)),z)var V=d.create({keySize:j+$,hasher:z}).compute(N,k);else var V=d.create({keySize:j+$}).compute(N,k);var Q=i.create(V.words.slice(j),$*4);return V.sigBytes=j*4,x.create({key:V,iv:Q,salt:k})}},R=n.PasswordBasedCipher=E.extend({cfg:E.cfg.extend({kdf:I}),encrypt:function(N,j,$,k){k=this.cfg.extend(k);var z=k.kdf.execute($,N.keySize,N.ivSize,k.salt,k.hasher);k.iv=z.iv;var V=E.encrypt.call(this,N,j,z.key,k);return V.mixIn(z),V},decrypt:function(N,j,$,k){k=this.cfg.extend(k),j=this._parse(j,k.format);var z=k.kdf.execute($,N.keySize,N.ivSize,j.salt,k.hasher);k.iv=z.iv;var V=E.decrypt.call(this,N,j,z.key,k);return V}})}()})});var fRt=v((Roe,dRt)=>{(function(t,e,r){typeof Roe=="object"?dRt.exports=Roe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Roe,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{(function(t,e,r){typeof joe=="object"?pRt.exports=joe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(joe,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{(function(t,e,r){typeof Noe=="object"?hRt.exports=Noe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Noe,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{(function(t,e,r){typeof Doe=="object"?yRt.exports=Doe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Doe,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{(function(t,e,r){typeof Loe=="object"?_Rt.exports=Loe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Loe,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 SRt=v((Foe,wRt)=>{(function(t,e,r){typeof Foe=="object"?wRt.exports=Foe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Foe,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 CRt=v((koe,xRt)=>{(function(t,e,r){typeof koe=="object"?xRt.exports=koe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(koe,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 PRt=v(($oe,ORt)=>{(function(t,e,r){typeof $oe=="object"?ORt.exports=$oe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})($oe,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 TRt=v((Boe,ERt)=>{(function(t,e,r){typeof Boe=="object"?ERt.exports=Boe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Boe,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 IRt=v((qoe,ARt)=>{(function(t,e,r){typeof qoe=="object"?ARt.exports=qoe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(qoe,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var RRt=v((Uoe,MRt)=>{(function(t,e,r){typeof Uoe=="object"?MRt.exports=Uoe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Uoe,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 NRt=v((zoe,jRt)=>{(function(t,e,r){typeof zoe=="object"?jRt.exports=zoe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(zoe,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo,i=[],a=[],s=[],u=[],l=[],c=[],d=[],f=[],p=[],m=[];(function(){for(var g=[],y=0;y<256;y++)y<128?g[y]=y<<1:g[y]=y<<1^283;for(var S=0,x=0,y=0;y<256;y++){var O=x^x<<1^x<<2^x<<3^x<<4;O=O>>>8^O&255^99,i[S]=O,a[O]=S;var P=g[S],E=g[P],A=g[E],I=g[O]*257^O*16843008;s[S]=I<<24|I>>>8,u[S]=I<<16|I>>>16,l[S]=I<<8|I>>>24,c[S]=I;var I=A*16843009^E*65537^P*257^S*16843008;d[O]=I<<24|I>>>8,f[O]=I<<16|I>>>16,p[O]=I<<8|I>>>24,m[O]=I,S?(S=P^g[g[g[A^P]]],x^=g[g[x]]):S=x=1}})();var h=[0,1,2,4,8,16,32,64,128,27,54],b=o.AES=n.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var y=this._keyPriorReset=this._key,S=y.words,x=y.sigBytes/4,O=this._nRounds=x+6,P=(O+1)*4,E=this._keySchedule=[],A=0;A6&&A%x==4&&(g=i[g>>>24]<<24|i[g>>>16&255]<<16|i[g>>>8&255]<<8|i[g&255]):(g=g<<8|g>>>24,g=i[g>>>24]<<24|i[g>>>16&255]<<16|i[g>>>8&255]<<8|i[g&255],g^=h[A/x|0]<<24),E[A]=E[A-x]^g);for(var I=this._invKeySchedule=[],R=0;R>>24]]^f[i[g>>>16&255]]^p[i[g>>>8&255]]^m[i[g&255]]}}},encryptBlock:function(g,y){this._doCryptBlock(g,y,this._keySchedule,s,u,l,c,i)},decryptBlock:function(g,y){var S=g[y+1];g[y+1]=g[y+3],g[y+3]=S,this._doCryptBlock(g,y,this._invKeySchedule,d,f,p,m,a);var S=g[y+1];g[y+1]=g[y+3],g[y+3]=S},_doCryptBlock:function(g,y,S,x,O,P,E,A){for(var I=this._nRounds,R=g[y]^S[0],N=g[y+1]^S[1],j=g[y+2]^S[2],$=g[y+3]^S[3],k=4,z=1;z>>24]^O[N>>>16&255]^P[j>>>8&255]^E[$&255]^S[k++],Q=x[N>>>24]^O[j>>>16&255]^P[$>>>8&255]^E[R&255]^S[k++],J=x[j>>>24]^O[$>>>16&255]^P[R>>>8&255]^E[N&255]^S[k++],D=x[$>>>24]^O[R>>>16&255]^P[N>>>8&255]^E[j&255]^S[k++];R=V,N=Q,j=J,$=D}var V=(A[R>>>24]<<24|A[N>>>16&255]<<16|A[j>>>8&255]<<8|A[$&255])^S[k++],Q=(A[N>>>24]<<24|A[j>>>16&255]<<16|A[$>>>8&255]<<8|A[R&255])^S[k++],J=(A[j>>>24]<<24|A[$>>>16&255]<<16|A[R>>>8&255]<<8|A[N&255])^S[k++],D=(A[$>>>24]<<24|A[R>>>16&255]<<16|A[N>>>8&255]<<8|A[j&255])^S[k++];g[y]=V,g[y+1]=Q,g[y+2]=J,g[y+3]=D},keySize:256/32});e.AES=n._createHelper(b)}(),t.AES})});var LRt=v((Hoe,DRt)=>{(function(t,e,r){typeof Hoe=="object"?DRt.exports=Hoe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Hoe,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.BlockCipher,i=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=i.DES=o.extend({_doReset:function(){for(var h=this._key,b=h.words,g=[],y=0;y<56;y++){var S=a[y]-1;g[y]=b[S>>>5]>>>31-S%32&1}for(var x=this._subKeys=[],O=0;O<16;O++){for(var P=x[O]=[],E=u[O],y=0;y<24;y++)P[y/6|0]|=g[(s[y]-1+E)%28]<<31-y%6,P[4+(y/6|0)]|=g[28+(s[y+24]-1+E)%28]<<31-y%6;P[0]=P[0]<<1|P[0]>>>31;for(var y=1;y<7;y++)P[y]=P[y]>>>(y-1)*4+3;P[7]=P[7]<<5|P[7]>>>27}for(var A=this._invSubKeys=[],y=0;y<16;y++)A[y]=x[15-y]},encryptBlock:function(h,b){this._doCryptBlock(h,b,this._subKeys)},decryptBlock:function(h,b){this._doCryptBlock(h,b,this._invSubKeys)},_doCryptBlock:function(h,b,g){this._lBlock=h[b],this._rBlock=h[b+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 y=0;y<16;y++){for(var S=g[y],x=this._lBlock,O=this._rBlock,P=0,E=0;E<8;E++)P|=l[E][((O^S[E])&c[E])>>>0];this._lBlock=O,this._rBlock=x^P}var A=this._lBlock;this._lBlock=this._rBlock,this._rBlock=A,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),h[b]=this._lBlock,h[b+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(h,b){var g=(this._lBlock>>>h^this._rBlock)&b;this._rBlock^=g,this._lBlock^=g<>>h^this._lBlock)&b;this._lBlock^=g,this._rBlock^=g<192.");var g=b.slice(0,2),y=b.length<4?b.slice(0,2):b.slice(2,4),S=b.length<6?b.slice(0,2):b.slice(4,6);this._des1=d.createEncryptor(n.create(g)),this._des2=d.createEncryptor(n.create(y)),this._des3=d.createEncryptor(n.create(S))},encryptBlock:function(h,b){this._des1.encryptBlock(h,b),this._des2.decryptBlock(h,b),this._des3.encryptBlock(h,b)},decryptBlock:function(h,b){this._des3.decryptBlock(h,b),this._des2.encryptBlock(h,b),this._des1.decryptBlock(h,b)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=o._createHelper(m)}(),t.TripleDES})});var kRt=v((Voe,FRt)=>{(function(t,e,r){typeof Voe=="object"?FRt.exports=Voe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Voe,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=o.RC4=n.extend({_doReset:function(){for(var u=this._key,l=u.words,c=u.sigBytes,d=this._S=[],f=0;f<256;f++)d[f]=f;for(var f=0,p=0;f<256;f++){var m=f%c,h=l[m>>>2]>>>24-m%4*8&255;p=(p+d[f]+h)%256;var b=d[f];d[f]=d[p],d[p]=b}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 BRt=v((Woe,$Rt)=>{(function(t,e,r){typeof Woe=="object"?$Rt.exports=Woe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Woe,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.Rabbit=n.extend({_doReset:function(){for(var c=this._key.words,d=this.cfg.iv,f=0;f<4;f++)c[f]=(c[f]<<8|c[f]>>>24)&16711935|(c[f]<<24|c[f]>>>8)&4278255360;var p=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],m=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var f=0;f<4;f++)l.call(this);for(var f=0;f<8;f++)m[f]^=p[f+4&7];if(d){var h=d.words,b=h[0],g=h[1],y=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,S=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=y>>>16|S&4294901760,O=S<<16|y&65535;m[0]^=y,m[1]^=x,m[2]^=S,m[3]^=O,m[4]^=y,m[5]^=x,m[6]^=S,m[7]^=O;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>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0>>0?1:0)|0,this._b=d[7]>>>0>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,b=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=b^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=n._createHelper(u)}(),t.Rabbit})});var URt=v((Koe,qRt)=>{(function(t,e,r){typeof Koe=="object"?qRt.exports=Koe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Koe,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.RabbitLegacy=n.extend({_doReset:function(){var c=this._key.words,d=this.cfg.iv,f=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],p=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var m=0;m<4;m++)l.call(this);for(var m=0;m<8;m++)p[m]^=f[m+4&7];if(d){var h=d.words,b=h[0],g=h[1],y=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,S=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=y>>>16|S&4294901760,O=S<<16|y&65535;p[0]^=y,p[1]^=x,p[2]^=S,p[3]^=O,p[4]^=y,p[5]^=x,p[6]^=S,p[7]^=O;for(var m=0;m<4;m++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0>>0?1:0)|0,this._b=d[7]>>>0>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,b=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=b^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=n._createHelper(u)}(),t.RabbitLegacy})});var HRt=v((Goe,zRt)=>{(function(t,e,r){typeof Goe=="object"?zRt.exports=Goe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Goe,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo;let i=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var u={pbox:[],sbox:[]};function l(m,h){let b=h>>24&255,g=h>>16&255,y=h>>8&255,S=h&255,x=m.sbox[0][b]+m.sbox[1][g];return x=x^m.sbox[2][y],x=x+m.sbox[3][S],x}function c(m,h,b){let g=h,y=b,S;for(let x=0;x1;--x)g=g^m.pbox[x],y=l(m,g)^y,S=g,g=y,y=S;return S=g,g=y,y=S,y=y^m.pbox[1],g=g^m.pbox[0],{left:g,right:y}}function f(m,h,b){for(let O=0;O<4;O++){m.sbox[O]=[];for(let P=0;P<256;P++)m.sbox[O][P]=s[O][P]}let g=0;for(let O=0;O=b&&(g=0);let y=0,S=0,x=0;for(let O=0;O{(function(t,e,r){typeof Joe=="object"?VRt.exports=Joe=e(Ln(),F8(),UMt(),HMt(),tI(),KMt(),rI(),kRe(),woe(),XMt(),$Re(),tRt(),nRt(),iRt(),Toe(),uRt(),QO(),Ll(),fRt(),mRt(),gRt(),bRt(),vRt(),SRt(),CRt(),PRt(),TRt(),IRt(),RRt(),NRt(),LRt(),kRt(),BRt(),URt(),HRt()):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)})(Joe,function(t){return t})});var BRe,CGr,Yoe,WRt=w(()=>{wT();nr();L8();BRe="copilot-index-chunk-",CGr=".json",Yoe=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${BRe}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${BRe}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${CGr}`}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{i+=a.length,ue().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),ue().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 LRe(e),n=ue().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(ue().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)),ue().debug&&console.log("Saved empty database state");return}let a=this.distributeDocumentsToPartitions(i,n),s={numPartitions:n,vectorLength:e.schema.embedding.match(/\d+/)[0],schema:e.schema,lastModified:Date.now(),documentPartitions:Object.fromEntries(i.map(l=>[l.id,this.assignDocumentToPartition(l.id,n)]))};await this.saveMetadata(s);let u={...r,docs:{docs:{},count:0},index:{...r.index,vectorIndexes:void 0}};for(let[l,c]of a.entries()){let d={index:{vectorIndexes:{embedding:{size:r.index.vectorIndexes.embedding.size,vectors:Object.fromEntries(Object.entries(r.index.vectorIndexes.embedding.vectors).filter(([m])=>c.some(h=>h.id===m)))}}},docs:{docs:Object.fromEntries(c.map((m,h)=>[(h+1).toString(),m])),count:c.length}},f=l===0?{...u,docs:d.docs,index:{...u.index,vectorIndexes:d.index.vectorIndexes}}:d,p=this.getChunkPath(l);await this.ensureDirectoryExists(p),await this.app.vault.adapter.write(p,JSON.stringify(f)),ue().debug&&console.log(`Saved partition ${l+1}/${n}`)}ue().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new Rr(`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 Rr("Invalid legacy database format");let l=await gq({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await coe(l,u),l}let r=await this.loadMetadata(),n=await gq({schema:r.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}}),o=null,i=[];for(let u=0;uObject.values(c.docs.docs)).find(c=>c.id===u);l?(a[s.toString()]=l,s++):ue().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 coe(n,o),n}catch(e){throw console.error("Error loading database:",e),new Rr(`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}/${BRe}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new Rr(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(ue().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 Rr("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new Rr("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))}}});async function GRt(t){if(!t)throw new Rr("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new Rr("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${Xs.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new Rr("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function JRt(t){let e="",{inclusions:r,exclusions:n}=rf(),o=t.vault.getMarkdownFiles().filter(i=>eu(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function bg(t){let e=[];return e.push(...t.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),e}function OGr(){return ue().qaExclusions?bg(ue().qaExclusions):[]}function PGr(){return ue().qaInclusions?bg(ue().qaInclusions):[]}function rf(t){let e=t?.inclusions?bg(t.inclusions):t?.isProject?[]:PGr(),r=t?.exclusions?bg(t.exclusions):t?.isProject?[]:OGr();return{inclusions:e.length>0?k8(e):null,exclusions:r.length>0?k8(r):null}}function eu(t,e,r){return!(r&&KRt(t.path,r)||e&&!KRt(t.path,e))}function k8(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 $8({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function EGr(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof qRe.TFile){let n=NR(r);if(e.some(o=>n.includes(fF(o))))return!0}return!1}function TGr(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 AGr(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 IGr(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof qRe.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function KRt(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return EGr(t,r??[])||TGr(t,n??[])||AGr(t,o??[])||IGr(t,i??[])}function Zoe(t){let e=[];try{let r=t.vault.getConfig("userIgnoreFilters");r&&Array.isArray(r)&&r.forEach(n=>{typeof n=="string"&&e.push(n.endsWith("/")?n.slice(0,-1):n)})}catch(r){console.warn("Error getting userIgnoreFilters from Obsidian config",r)}return e}function Xoe(t){return`#${t}`}function B8(t){return`[[${t.basename}]]`}function YRt(t){return`*.${t}`}var qRe,_g=w(()=>{wT();fN();nr();Cn();qRe=require("obsidian")});var ZRt,Tx,eP,Qoe=w(()=>{fN();wT();yo();nr();Cn();L8();FMt();ZRt=F(vq()),Tx=require("obsidian");WRt();_g();eP=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new doe;xa(async()=>{let r=ue();Tx.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):Tx.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await Xs.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(ie("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await Xs.getInstance().getEmbeddingsAPI()),ie("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new Rr("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new Yoe(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),Tx.Platform.isMobile&&ue().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new Rr("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),ie("Loaded existing chunked Orama database from disk."),this.oramaDb}catch(n){fe("Failed to load existing database, creating new one:",n)}let r=await this.createNewDb(e);return this.oramaDb=r,r}catch(r){fe("Error initializing Orama database:",r),new Tx.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(Tx.Platform.isMobile&&ue().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await Xs.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new Rr("Orama database not found.")}catch(e){throw fe("Failed to initialize database during save:",e),new Rr("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,ue().debug&&ie("Orama database saved successfully at:",this.dbPath)}catch(e){throw fe("Error saving Orama database:",e),e}}}async clearIndex(e){try{this.oramaDb||await this.initializeDB(e),await this.chunkedStorage?.clearStorage(),await new Promise(r=>setTimeout(r,100)),this.oramaDb=await this.createNewDb(e),await this.saveDB(),new Tx.Notice("Local Copilot index cleared successfully."),ie("Local Copilot index cleared successfully, new instance created.")}catch(r){throw fe("Error clearing the local Copilot index:",r),new Tx.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new Rr("Orama database not found.");try{let r=await Xc(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await D8(this.oramaDb,r.hits.map(n=>n.id),500),ue().debug&&ie(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(r){fe("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(ue().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),ie("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,ZRt.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new Rr("Embedding instance not found.");let r=await GRt(e);if(!r||r===0)throw new Rr("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await gq({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return ie(`Created new Orama database for ${this.dbPath}. Embedding model: ${Xs.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 Xc(e,{term:r,properties:["path"],exact:!0,includeVectors:!0})).hits:void 0}static async getDocsByEmbedding(e,r,n){return(await Xc(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 Xc(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return fe("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,ue().numPartitions),o=await Xc(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await gN(r,o.hits[0].id);try{return await N8(r,e),ie(`${o.hits.length>0?"Updated":"Inserted"} document ${e.id} in partition ${n}`),this.markUnsavedChanges(),e}catch(i){if(fe(`Failed to ${o.hits.length>0?"update":"insert"} document ${e.id}:`,i),o.hits.length>0)try{await N8(r,o.hits[0].document)}catch(a){fe("Failed to restore previous document version:",a)}return}}catch(n){fe(`Error upserting document ${e.id}:`,n);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await Xc(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return fe("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){ie("Embedding model change detected. Orama database not found. Initializing new database...");try{return await this.initializeDB(e),!0}catch(o){throw fe("Failed to initialize database:",o),new Rr("Failed to initialize Orama database. Please check your embedding model settings.")}}let r=await Xc(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=Xs.getModelName(e);if(!pVe(n,o))return new Tx.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),ie(`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 ie("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await Xc(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){ie("Orama database not found during garbage collection. Attempting to initialize...");try{let e=await Xs.getInstance().getEmbeddingsAPI();if(!e)throw new Rr("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new Rr("Failed to initialize database after attempt.")}catch(e){throw fe("Failed to initialize database during garbage collection:",e),new Rr("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:(ie("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(o.map(i=>i.path))).join(", ")),o.length===1?await gN(this.oramaDb,o[0].id):await D8(this.oramaDb,o.map(i=>i.id),500),await this.saveDB(),o.length)}catch(e){throw fe("Error garbage collecting the Copilot index:",e),new Rr("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new Rr("Orama database not found.");try{let e=await t.getAllDocuments(this.oramaDb),r=new Set;return e.forEach(n=>{r.add(n.path)}),Array.from(r).sort()}catch(e){throw fe("Error getting indexed files:",e),new Rr("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await Xc(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw fe("Error checking if database is empty:",e),new Rr("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 Rr("Orama database not found.");let r={};for(let n of e){let o=await t.getDocsByPath(this.oramaDb,n);o&&o.length>0&&(r[n]=o.map(i=>({id:i.document.id,title:i.document.title,path:i.document.path,content:i.document.content,metadata:i.document.metadata,embedding:i.document.embedding,embeddingModel:i.document.embeddingModel,tags:i.document.tags,extension:i.document.extension,nchars:i.document.nchars})))}return r}markFileMissingEmbeddings(e){this.filesWithoutEmbeddings.add(e)}clearFilesMissingEmbeddings(){this.filesWithoutEmbeddings.clear()}getFilesMissingEmbeddings(){return Array.from(this.filesWithoutEmbeddings)}isFileMissingEmbeddings(e){return this.filesWithoutEmbeddings.has(e)}async checkIndexIntegrity(){if(!this.oramaDb)throw new Rr("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?ie("Files missing embeddings after integrity check:",r.join(", ")):ie("Index integrity check completed. All documents have embeddings.")}catch(e){throw fe("Error checking index integrity:",e),new Rr("Failed to check index integrity.")}}}});var wq,MGr,eie,XRt=w(()=>{Cl();Fd();nr();wq=require("obsidian");_g();MGr=5e3,eie=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(wq.Platform.isMobile&&ue().disableIndexOnMobile||Fh()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof wq.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}=rf(),u=eu(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(()=>{ue().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},MGr)};this.handleFileDelete=async e=>{e instanceof wq.TFile&&await this.dbOps.removeDocs(e.path)};this.initializeEventListeners()}initializeEventListeners(){ue().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 q8,QRt=w(()=>{q8=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 tP,e1t=w(()=>{tP=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 tie,t1t=w(()=>{Df();tie=class extends xn{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 r1t=w(()=>{e1t();t1t()});var rie=w(()=>{r1t()});var n1t=w(()=>{nAe()});var URe,nie,o1t=w(()=>{rie();n1t();URe=class extends tie{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;lb){let O=this.numberOfNewLines(c,b,x);d-=O}s&&(h+=a)}let g=this.numberOfNewLines(m),y=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};y.lines={from:d,to:d+g};let S={...o[l],loc:y};h+=m,u.push(new tP({pageContent:h,metadata:S})),d+=g,f=m,p=b}}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}},nie=class t extends URe{static lc_name(){return"RecursiveCharacterTextSplitter"}constructor(e){super(e),Object.defineProperty(this,"separators",{enumerable:!0,configurable:!0,writable:!0,value:[` +`,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:"The last message in the session is not an assistant message. Cannot regenerate non-assistant messages."}});function EIt(t){return{raw:Number(t),formatted:mN(t)}}function TIt(t){if(t.id){if(typeof t.id!="string")throw qt("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return I8()}function nRe(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{ic();Ds();Ds();J9r={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},Y9r={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"}});function IIt(){return{idToInternalId:new Map,internalIdToId:[],save:Z9r,load:X9r}}function Z9r(t){return{internalIdToId:t.internalIdToId}}function X9r(t,e){let{internalIdToId:r}=e;t.internalDocumentIDStore.idToInternalId.clear(),t.internalDocumentIDStore.internalIdToId=[];let n=r.length;for(let o=0;ot.internalIdToId.length?wi(t,e.toString()):e}function hg(t,e){if(t.internalIdToId.length{});function eKr(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function tKr(t,e){let r=wi(t.sharedInternalDocumentStore,e);return t.docs[r]}function rKr(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o"u"?!1:(delete t.docs[r],t.count--,!0)}function aKr(t){return t.count}function sKr(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function uKr(t){return{docs:t.docs,count:t.count}}function MIt(){return{create:eKr,get:tKr,getMultiple:rKr,getAll:nKr,store:oKr,remove:iKr,count:aKr,load:sKr,save:uKr}}var aRe=w(()=>{gg()});function jIt(t,e){let r=[],n=t.plugins?.length;if(!n)return r;for(let o=0;o{ic();RIt=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"]});function eb(t,e,r,n){if(t.some(Qs))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function hN(t,e,r){if(t.some(Qs))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function mq(t,e,r,n,o){if(t.some(Qs))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function hq(t,e,r,n){if(t.some(Qs))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function LIt(t,e){if(t.some(Qs))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}var DIt,sRe,XA=w(()=>{Ds();DIt=["tokenizer","index","documentsStore","sorter"],sRe=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"]});function uRe(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(yg(t.l),yg(t.r))+1,e.h=Math.max(yg(e.l),yg(e.r))+1,e}function lRe(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(yg(t.l),yg(t.r))+1,e.h=Math.max(yg(e.l),yg(e.r))+1,e}function kIt(t,e,r){let n=[];function o(i){i!==null&&(e=e&&i.k<=r&&ki(n,i.v),r>i.k&&o(i.r))}return o(t.root),n}function cRe(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&&ki(n,i.v),!r&&i.k>e&&ki(n,i.v),o.push(i.r),o.push(i.l))}return n}function dRe(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&&ki(n,i.v),!r&&i.kt.k)t=t.r;else return t;return null}function BIt(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}function qIt(t,e,r,n=500){function o(i,a,s){if(i===null)return FIt++,{k:a,v:s,l:null,r:null,h:0};if(ai.k)i.r=o(i.r,a,s);else return i.v.push(...s),i;return FIt%n===0?cKr(i,a):i}t.root=o(t.root,e,r)}function cKr(t,e){t.h=1+Math.max(yg(t.l),yg(t.r));let r=yg(t.l)-yg(t.r);return r>1&&et.r.k?uRe(t):r>1&&e>t.l.k?(t.l=uRe(t.l),lRe(t)):r<-1&&e{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 zIt(t,e,r){let n=$It(t.root,r);if(n){if(n.v.length===1){dKr(t,r);return}n.v.splice(n.v.indexOf(e),1)}}var FIt,HIt=w(()=>{Ds();FIt=0});function VIt(){return{numberToDocumentId:new Map}}function WIt(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function KIt(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 GIt(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&&ki(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&&ki(i,u)}return i}}throw new Error("Invalid operation")}function JIt(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 dq(i)}}throw new Error("Invalid operation")}var YIt=w(()=>{Ds()});function fKr(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 fRe(t,e,r){let n=fKr(t,e,r);return{distance:n,isBounded:n>=0}}var pRe=w(()=>{});function gq(t,e){t.w=e.w+t.s}function eoe(t,e){t.d.push(e)}function pKr(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function hRe(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(cq(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&fRe(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),cq(e,i)!=null&&a.length>0){let s=new Set(e[i]),u=a.length;for(let l=0;l0)){let u=new Set(i[a]),l=s.length;for(let c=0;c=e.length)){e[r]in t.c&&R8(t.c[e[r]],e,r+1,n,o,i),R8(t,e,r+1,n-1,o,i);for(let a in t.c)R8(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&R8(t.c[a],e,r+1,n-1,o,i)}}}function gRe(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,R8(t,e,0,n||0,n,o),o}else{let o=e.length;for(let a=0;a{pRe();Ds();mRe=class{constructor(e,r,n){Cc(this,"k");Cc(this,"s");Cc(this,"c",{});Cc(this,"d",[]);Cc(this,"e");Cc(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 tMt(){return{root:null}}function rMt(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-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.lon0;){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 iMt(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=hKr(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=mKr(e);if(n){let u=o?sMt:aMt;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 mKr(t){let e=0,r=0,n=0,o=t.length;for(let a=0,s=o-1;ao!=d>o&&n<(c-u)*(o-l)/(d-l)+u&&(r=!r)}return r}function aMt(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 sMt(t,e){let n=.0033528106647474805,o=(1-n)*6378137,i=Math.PI/180,a=t.lat*i,s=e.lat*i,u=(e.lon-t.lon)*i,l=Math.atan((1-n)*Math.tan(a)),c=Math.atan((1-n)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(c),m=Math.cos(c),h=u,b,g=1e3,y,S,x,O,P;do{let j=Math.sin(h),$=Math.cos(h);x=Math.sqrt(m*j*(m*j)+(f*p-d*m*$)*(f*p-d*m*$)),O=d*p+f*m*$,P=Math.atan2(x,O),y=f*m*j/x,S=1-y*y;let k=O-2*d*p/S,z=n/16*S*(4+n*(4-3*S));b=h,h=u+(1-z)*n*y*(P+z*x*(k+z*O*(-1+2*k*k)))}while(Math.abs(h-b)>1e-12&&--g>0);let E=S*(6378137*6378137-o*o)/(o*o),A=1+E/16384*(4096+E*(-768+E*(320-175*E))),I=E/1024*(256+E*(-128+E*(74-47*E))),R=I*x*(O-2*d*p/S+I/4*(O*(-1+2*x*x)-I/6*P*(-3+4*x*x)*(-3+4*P*P)));return o*A*(P-R)}var uMt=w(()=>{});function toe(t,e,r=0,n){if(e===0)throw qt("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let h=0;hb[1]-h[1]);if(r===1)return s;let u=s.length,l=[];for(let h of o.entries())l.push([h[0],h[1][0],h[1][1]]);let c=l.sort((h,b)=>h[2]>b[2]?-1:h[2]b[1]?-1:h[1]"u"){if(r===0)return[];d=0}let f=c.length,p=new Array(f);for(let h=0;h{ic()});function bRe(t,e){let r=0;for(let n=0;n=n&&i.push([a,c])}return i.sort((a,s)=>s[1]-a[1])}var noe=w(()=>{});function gKr(t,e,r,n,o){let i=wi(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 yKr(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=wi(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 bKr(t,e,r,n){let o=wi(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 _Kr(t,e,r){t.tokenOccurrences[e][r]--}function vKr(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{let l=wi(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;qIt(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),XIt(d,p,l);break}case"Flat":{WIt(d,u,l);break}case"BKD":{rMt(d,u,[l]);break}}}}function SKr(t,e,r,n,o,i,a,s,u,l){if(XO(i))return xKr(e,r,o,n);let c=wKr(t,e,r,n,a,s,u,l);if(!pq(i))return c(o);let d=o,f=d.length;for(let p=0;p({[a]:[],...i}),{});for(let i of n){let a=r[i];if(typeof e.indexes[i]>"u")throw qt("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=e.indexes[i];if(u==="Bool"){let f=s[a.toString()];ki(o[i],f);continue}if(u==="BKD"){let d;if("radius"in a)d="radius";else if("polygon"in a)d="polygon";else throw new Error(`Invalid operation ${a}`);if(d==="radius"){let{value:f,coordinates:p,unit:m="m",inside:h=!0,highPrecision:b=!1}=a[d],g=rRe(f,m),y=oMt(s.root,p,g,h,void 0,b);ki(o[i],y.flatMap(({docIDs:S})=>S))}else{let{coordinates:f,inside:p=!0,highPrecision:m=!1}=a[d],h=iMt(s.root,f,p,void 0,m);ki(o[i],h.flatMap(({docIDs:b})=>b))}continue}if(u==="Radix"&&(typeof a=="string"||Array.isArray(a))){for(let d of[a].flat()){let f=t.tokenizer.tokenize(d,t.language,i);for(let p of f){let m=gRe(s,{term:p,exact:!0});ki(o[i],Object.values(m).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw qt("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?JIt:GIt;ki(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=cRe(s,f,!1);break}case"gte":{p=cRe(s,f,!0);break}case"lt":{p=dRe(s,f,!1);break}case"lte":{p=dRe(s,f,!0);break}case"eq":{p=UIt(s,f)??[];break}case"between":{let[m,h]=f;p=kIt(s,m,h);break}}ki(o[i],p)}}return dq(Object.values(o))}function EKr(t){return t.searchableProperties}function TKr(t){return t.searchablePropertiesWithTypes}function dMt(t){let e=gN(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]=dMt(t.c[r]);return e}function AKr(t){return{numberToDocumentId:new Map(t)}}function IKr(t){return Array.from(t.numberToDocumentId.entries())}function MKr(t,e){let{indexes:r,vectorIndexes:n,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}=e,c={},d={};for(let f of Object.keys(r)){let{node:p,type:m,isArray:h}=r[f];switch(m){case"Radix":c[f]={type:"Radix",node:dMt(p),isArray:h};break;case"Flat":c[f]={type:"Flat",node:AKr(p),isArray:h};break;default:c[f]=r[f]}}for(let f of Object.keys(n)){let p=n[f].vectors;for(let m in p)p[m]=[p[m][0],new Float32Array(p[m][1])];d[f]={size:n[f].size,vectors:p}}return{sharedInternalDocumentStore:t,indexes:c,vectorIndexes:d,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}}function RKr(t){let{indexes:e,vectorIndexes:r,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}=t,l={};for(let d of Object.keys(r)){let f=r[d].vectors;for(let p in f)f[p]=[f[p][0],Array.from(f[p][1])];l[d]={size:r[d].size,vectors:f}}let c={};for(let d of Object.keys(e)){let{type:f,node:p,isArray:m}=e[d];if(f!=="Flat"){c[d]=e[d];continue}c[d]={type:"Flat",node:IKr(p),isArray:m}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function fMt(){return{create:cMt,insert:SKr,remove:CKr,insertDocumentScoreParameters:gKr,insertTokenScoreParameters:yKr,removeDocumentScoreParameters:bKr,removeTokenScoreParameters:_Kr,calculateResultScores:vKr,search:OKr,searchByWhereClause:PKr,getSearchableProperties:EKr,getSearchablePropertiesWithTypes:TKr,load:MKr,save:RKr}}var _Re=w(()=>{ic();HIt();YIt();eMt();uMt();Ds();j8();noe();M8();gg()});function pMt(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=pMt(t,e,s,n,u);ki(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!XO(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 qt("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function NKr(t,e,r,n){return n?.enabled!==!1?pMt(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function DKr(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=wi(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&vRe(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function mMt(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)$Kr(t,r);t.isSorted=!0}function LKr(t,e,r){return e[1].localeCompare(r[1],vIt(t))}function FKr(t,e){return t[1]-e[1]}function kKr(t,e){return e[1]?-1:1}function $Kr(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=LKr.bind(null,t.language);break;case"number":n=FKr.bind(null);break;case"boolean":n=kKr.bind(null);break}r.orderedDocs.sort(n);let o=r.orderedDocs.length;for(let i=0;i!r.orderedDocsToRemove.has(n[0])),r.orderedDocsToRemove.clear())}function qKr(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=wi(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function UKr(t,e,r){if(!t.enabled)throw qt("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw qt("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return vRe(t,n),mMt(t),e.sort((a,s)=>{let u=i.docs.get(wi(t.sharedInternalDocumentStore,a[0])),l=i.docs.get(wi(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 zKr(t){return t.enabled?t.sortableProperties:[]}function HKr(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function VKr(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 WKr(t){if(!t.enabled)return{enabled:!1};BKr(t),mMt(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 hMt(){return{create:NKr,insert:DKr,remove:qKr,save:WKr,load:VKr,sortBy:UKr,getSortableProperties:zKr,getSortablePropertiesWithTypes:HKr}}var wRe=w(()=>{ic();M8();gg();Ds();Zne()});function JKr(t){return t<192||t>383?t:GKr[t-192]||t}function gMt(t){let e=[];for(let r=0;r{GKr=[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 _Mt(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(SRe),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(bMt),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+Tx+ioe+"[^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(bMt),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(SRe),e&&n.test(e)&&(t=e+YKr[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(SRe),e&&n.test(e)&&(t=e+ZKr[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(ooe),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(ooe),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(ooe),o=new RegExp(QKr),i=new RegExp("^"+Tx+ioe+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(ooe),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}var YKr,ZKr,XKr,ioe,Tx,N8,SRe,QKr,ooe,bMt,vMt=w(()=>{YKr={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"},ZKr={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},XKr="[^aeiou]",ioe="[aeiouy]",Tx=XKr+"[^aeiouy]*",N8=ioe+"[aeiou]*",SRe="^("+Tx+")?"+N8+Tx,QKr="^("+Tx+")?"+N8+Tx+"("+N8+")?$",ooe="^("+Tx+")?"+N8+Tx+N8+Tx,bMt="^("+Tx+")?"+ioe});function xRe(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=gMt(e),this.normalizationCache.set(r,e),e)}function eGr(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function wMt(t,e,r){if(e&&e!==this.language)throw qt("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=_It[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=eGr(n);return this.allowDuplicates?o:Array.from(new Set(o))}function CRe(t={}){if(!t.language)t.language="english";else if(!A8.includes(t.language))throw qt("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw qt("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=_Mt;else throw qt("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 qt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw qt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw qt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:wMt,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:xRe,normalizationCache:new Map};return n.tokenize=wMt.bind(n),n.normalizeToken=xRe,n}var aoe=w(()=>{ic();yMt();Zne();vMt()});function rGr(t){let e={formatElapsedTime:EIt,getDocumentIndexId:TIt,getDocumentProperties:Xne,validateSchema:nRe};for(let r of sRe){let n=r;if(t[n]){if(typeof t[n]!="function")throw qt("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!DIt.includes(r)&&!sRe.includes(r))throw qt("UNSUPPORTED_COMPONENT",r)}function yq({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=I8());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=CRe(a):a=CRe({language:r??"english"}),n.tokenizer&&r)throw qt("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=IIt();s||(s=fMt()),l||(l=hMt()),u||(u=MIt()),rGr(n);let{getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,formatElapsedTime:m}=n,h={data:{},caches:{},schema:t,tokenizer:a,index:s,sorter:l,documentsStore:u,internalDocumentIDStore:c,getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],afterUpdateMultiple:[],beforeUpdateMultiple:[],afterCreate:[],formatElapsedTime:m,id:o,plugins:i,version:nGr()};h.data={index:h.index.create(h,c,t),docs:h.documentsStore.create(h,c),sorting:h.sorter.create(h,c,t,e)};for(let g of RIt)h[g]=(h[g]??[]).concat(jIt(h,g));let b=h.afterCreate;return b&&LIt(b,h),h}function nGr(){return"{{VERSION}}"}var SMt=w(()=>{M8();aRe();NIt();XA();_Re();gg();wRe();aoe();ic();Ds()});var xMt=w(()=>{});var ORe=w(()=>{M8();aRe();_Re();aoe();wRe();gg()});var soe,PRe,ERe,TRe=w(()=>{soe="fulltext",PRe="hybrid",ERe="vector"});var QA,eI,ARe=w(()=>{TRe();QA=Symbol("orama.insertions"),eI=Symbol("orama.removals")});function IRe(t){typeof t[QA]!="number"&&(queueMicrotask(()=>{t[QA]=void 0}),t[QA]=0),t[QA]>1e3?(CMt("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[QA]=-1):t[QA]>=0&&t[QA]++}function MRe(t){typeof t[eI]!="number"&&(queueMicrotask(()=>{t[eI]=void 0}),t[eI]=0),t[eI]>1e3?(CMt("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[eI]=-1):t[eI]>=0&&t[eI]++}var CMt,RRe=w(()=>{ARe();CMt=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)}});function D8(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw qt("SCHEMA_VALIDATION_FAILURE",i);return Qs(t.index.beforeInsert)||Qs(t.index.insert)||Qs(t.index.afterInsert)?sGr(t,e,r,n,o):uGr(t,e,r,n,o)}async function sGr(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw qt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw qt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await eb(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=c[f];OMt(m,h,f,p)}return await lGr(t,s,l,d,u,r,e,o),n||await eb(t.afterInsert,t,s,e),IRe(t),s}function uGr(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw qt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw qt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||eb(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=c[f];OMt(m,h,f,p)}return cGr(t,s,l,d,u,r,e,o),n||eb(t.afterInsert,t,s,e),IRe(t),s}function OMt(t,e,r,n){if(!(AIt(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(XO(e)&&Array.isArray(n))&&!(pq(e)&&Array.isArray(n))&&!(iGr.has(e)&&aGr.has(t))&&t!==e)throw qt("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function lGr(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 cGr(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 iGr,aGr,jRe=w(()=>{ORe();Ds();XA();RRe();ic();iGr=new Set(["enum","enum[]"]),aGr=new Set(["string","number"])});function yN(t,e,r,n){return Qs(t.index.beforeRemove)||Qs(t.index.remove)||Qs(t.index.afterRemove)?dGr(t,e,r,n):fGr(t,e,r,n)}async function dGr(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=hg(t.internalDocumentIDStore,wi(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await eb(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let b=f[h];if(typeof b>"u")continue;let g=d[h];await t.index.beforeRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l),await t.index.remove(t.index,t.data.index,h,e,b,g,r,t.tokenizer,l)||(o=!1),await t.index.afterRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l)}let p=await t.sorter.getSortableProperties(t.data.sorting),m=await t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||await eb(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),MRe(t),o}function fGr(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=hg(t.internalDocumentIDStore,wi(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||eb(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let b=f[h];if(typeof b>"u")continue;let g=d[h];t.index.beforeRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l),t.index.remove(t.index,t.data.index,h,e,b,g,r,t.tokenizer,l)||(o=!1),t.index.afterRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l)}let p=t.sorter.getSortableProperties(t.data.sorting),m=t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||eb(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),MRe(t),o}function L8(t,e,r,n,o){return Qs(t.index.beforeRemove)||Qs(t.index.remove)||Qs(t.index.afterRemove)||Qs(t.beforeRemoveMultiple)||Qs(t.afterRemoveMultiple)?pGr(t,e,r,n,o):mGr(t,e,r,n,o)}async function pGr(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>hg(t.internalDocumentIDStore,wi(t.internalDocumentIDStore,s)));return o||await hN(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 yN(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await hN(t.afterRemoveMultiple,t,a),i}function mGr(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>hg(t.internalDocumentIDStore,wi(t.internalDocumentIDStore,l)));o||hN(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)yN(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||hN(t.afterRemoveMultiple,t,a),i}var NRe=w(()=>{XA();gg();RRe();Ds()});function hGr(t,e){return t[1]-e[1]}function gGr(t,e){return e[1]-t[1]}function yGr(t="desc"){return t.toLowerCase()==="asc"?hGr:gGr}function bq(t,e,r){let n={},o=e.map(([l])=>l),i=t.documentsStore.getMultiple(t.data.docs,o),a=Object.keys(r),s=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let l of a){let c;if(s[l]==="number"){let{ranges:d}=r[l],f=d.length,p=Array.from({length:f});for(let m=0;m{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 EMt(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 uoe=w(()=>{ic();Ds()});function _q(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 loe=w(()=>{});function vq(t,e,r){let n=r.properties,o=n.length,i=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let g=0;g"u")throw qt("UNKNOWN_GROUP_BY_PROPERTY",y);if(!TMt.includes(i[y]))throw qt("INVALID_GROUP_BY_PROPERTY",y,TMt.join(", "),i[y])}let a=e.map(([g])=>hg(t.internalDocumentIDStore,g)),s=t.documentsStore.getMultiple(t.data.docs,a),u=s.length,l=r.maxResult||Number.MAX_SAFE_INTEGER,c=[],d={};for(let g=0;g"u")continue;let A=typeof E!="boolean"?E:""+E,I=S.perValue[A]??{indexes:[],count:0};I.count>=l||(I.indexes.push(O),I.count++,S.perValue[A]=I,x.add(E))}c.push(Array.from(x)),d[y]=S}let f=AMt(c),p=f.length,m=[];for(let g=0;gP-E),x.indexes.length!==0&&m.push(x)}let h=m.length,b=Array.from({length:h});for(let g=0;g({id:a[A],score:e[A][1],document:s[A]})),O=S.reducer.bind(null,y.values),P=S.getInitialValue(y.indexes.length),E=x.reduce(O,P);b[g]={values:y.values,result:E}}return b}function AMt(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=AMt(t,e+1),o=[];for(let i of r)for(let a of n){let s=[i];ki(s,a),o.push(s)}return o}var bGr,TMt,coe=w(()=>{ic();Ds();gg();bGr={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},TMt=["string","number","boolean"]});function IMt(t,e,r){let n=Qy(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(doe,e.relevance??{});let s=Object.keys(t.data.index.vectorIndexes),u=e.facets&&Object.keys(e.facets).length>0,{limit:l=10,offset:c=0,term:d,properties:f,threshold:p=0,distinctOn:m,includeVectors:h=!1}=e,b=e.preflight===!0,{index:g,docs:y}=t.data,S=t.tokenizer.tokenize(d??"",r),x=t.caches.propertiesToSearch;if(!x){let j=t.index.getSearchablePropertiesWithTypes(g);x=t.index.getSearchableProperties(g),x=x.filter($=>j[$].startsWith("string")),t.caches.propertiesToSearch=x}if(f&&f!=="*"){for(let j of f)if(!x.includes(j))throw qt("UNKNOWN_INDEX",j,x.join(", "));x=x.filter(j=>f.includes(j))}let O=bN(t.tokenizer,t.index,t.documentsStore,r,e,x,S,t.documentsStore.count(y),n),P=Object.keys(e.where??{}).length>0,E=[];P&&(E=t.index.searchByWhereClause(O,g,e.where));let A=S.length;if(A||f?.length){let j=x.length;for(let $=0;$[j,0]));let I=Object.entries(O.uniqueDocsIDs).map(([j,$])=>[+j,$]);if(P&&(I=_q(E,I)),e.sortBy)if(typeof e.sortBy=="function"){let j=I.map(([z])=>z),k=t.documentsStore.getMultiple(t.data.docs,j).map((z,V)=>[I[V][0],I[V][1],z]);k.sort(e.sortBy),I=k.map(([z,V])=>[z,V])}else I=t.sorter.sortBy(t.data.sorting,I,e.sortBy).map(([j,$])=>[wi(t.internalDocumentIDStore,j),$]);else I=I.sort(PIt);let R;b||(R=m?RMt(t,I,c,l,m):foe(t,I,c,l));let N={elapsed:{formatted:"",raw:0},hits:[],count:I.length};if(typeof R<"u"&&(N.hits=R.filter(Boolean),h||Qne(N,s)),u){let j=bq(t,I,e.facets);N.facets=j}return e.groupBy&&(N.groups=vq(t,I,e.groupBy)),N.elapsed=t.formatElapsedTime(Qy()-O.timeStart),N}async function a(){t.beforeSearch&&await hq(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await mq(t.afterSearch,t,e,r,s),s}return o?a():i()}var MMt=w(()=>{j8();uoe();loe();coe();XA();gg();ic();Ds();_N()});function DRe(t,e,r="english"){let n=Qy(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw qt("INVALID_VECTOR_INPUT",Object.keys(s).join(", "));let{limit:u=10,offset:l=0,includeVectors:c=!1}=e,d=t.data.index.vectorIndexes[s.property],f=d.size,p=d.vectors,m=e.facets&&Object.keys(e.facets).length>0,h=Object.keys(e.where??{}).length>0,{index:b,docs:g}=t.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?qt("INVALID_INPUT_VECTOR","undefined",f,"undefined"):qt("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let y=roe(s.value,p,f,e.similarity).map(([j,$])=>[wi(t.internalDocumentIDStore,j),$]),S=t.caches.propertiesToSearch;if(!S){let j=t.index.getSearchablePropertiesWithTypes(b);S=t.index.getSearchableProperties(b),S=S.filter($=>j[$].startsWith("string")),t.caches.propertiesToSearch=S}let x=[],O=bN(t.tokenizer,t.index,t.documentsStore,r,e,S,x,t.documentsStore.count(g),n),P=[];h&&(P=t.index.searchByWhereClause(O,b,e.where),y=_q(P,y));let E=[];m&&(E=bq(t,y,e.facets));let A=Array.from({length:u});for(let j=0;j{_N();Ds();uoe();ic();noe();loe();coe();gg();XA()});function NMt(t,e,r){let n=Qy(),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=_Gr(t,e,r),f=vGr(t,e),{index:p,docs:m}=t.data,h=e.hybridWeights,b=SGr(d,f,e.term??"",h),g=t.tokenizer.tokenize(e.term??"",r),y=t.caches.propertiesToSearch;if(!y){let N=t.index.getSearchablePropertiesWithTypes(p);y=t.index.getSearchableProperties(p),y=y.filter(j=>N[j].startsWith("string")),t.caches.propertiesToSearch=y}if(e.properties&&e.properties!=="*"){for(let N of e.properties)if(!y.includes(N))throw qt("UNKNOWN_INDEX",N,y.join(", "));y=y.filter(N=>e.properties.includes(N))}let S=bN(t.tokenizer,t.index,t.documentsStore,r,e,y,g,t.documentsStore.count(m),n),x=Object.keys(e.where??{}).length>0,O=[];x&&(O=t.index.searchByWhereClause(S,p,e.where),b=_q(O,b));let P;c&&(P=bq(t,b,e.facets));let E;e.groupBy&&(E=vq(t,b,e.groupBy));let A=foe(t,b,s,u).filter(Boolean),I=Qy(),R={count:b.length,elapsed:{raw:Number(I-n),formatted:mN(I-n)},hits:A,...P?{facets:P}:{},...E?{groups:E}:{}};if(!l){let N=Object.keys(t.data.index.vectorIndexes);Qne(R,N)}return R}async function a(){t.beforeSearch&&await hq(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await mq(t.afterSearch,t,e,r,s),s}return o?a():i()}function _Gr(t,e,r){let n=Qy();e.relevance=Object.assign(doe,e.relevance??{});let{term:o="",properties:i,threshold:a=0}=e,{index:s,docs:u}=t.data,l=t.tokenizer.tokenize(o,r),c=t.caches.propertiesToSearch;if(!c){let m=t.index.getSearchablePropertiesWithTypes(s);c=t.index.getSearchableProperties(s),c=c.filter(h=>m[h].startsWith("string")),t.caches.propertiesToSearch=c}if(i&&i!=="*"){let m=new Set(c),h=new Set(i);for(let b of i)if(!m.has(b))throw qt("UNKNOWN_INDEX",b,c.join(", "));c=c.filter(b=>h.has(b))}let d=bN(t.tokenizer,t.index,t.documentsStore,r,e,c,l,t.documentsStore.count(u),n),f=l.length;if(f||i&&i.length>0){let m=c.length;for(let h=0;h[m,0]));let p=Object.entries(d.uniqueDocsIDs).map(([m,h])=>[+m,h]).sort((m,h)=>h[1]-m[1]);return DMt(p)}function vGr(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 qt("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw qt("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=roe(r.value,i,o,e.similarity).map(([s,u])=>[wi(t.internalDocumentIDStore,s),u]);return DMt(a)}function FRe([,t]){return t}function DMt(t){let e=Math.max.apply(Math,t.map(FRe));return t.map(([r,n])=>[r,n/e])}function jMt(t,e){return t/e}function wGr(t,e){return(r,n)=>r*t+n*e}function SGr(t,e,r,n){let o=Math.max.apply(Math,t.map(FRe)),i=Math.max.apply(Math,e.map(FRe)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:xGr(r),l=new Map,c=t.length,d=wGr(s,u);for(let p=0;pm[1]-p[1])}function xGr(t){return{text:.5,vector:.5}}var LMt=w(()=>{Ds();loe();j8();ic();_N();uoe();coe();noe();gg();_N();XA()});function bN(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 Xc(t,e,r){let n=e.mode??soe;if(n===soe)return IMt(t,e,r);if(n===ERe)return DRe(t,e);if(n===PRe)return NMt(t,e);throw qt("INVALID_SEARCH_MODE",n)}function RMt(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"u")continue;let[p,m]=f;if(u.has(p))continue;let h=t.documentsStore.get(i,p),b=fq(h,o);if(!(typeof b>"u"||a.has(b))&&(a.set(b,!0),c++,!(c<=r)&&(s.push({id:hg(t.internalDocumentIDStore,p),score:m,document:h}),u.add(p),c>=r+n)))break}return s}function foe(t,e,r,n){let o=t.data.docs,i=Array.from({length:n}),a=new Set;for(let s=r;s"u")break;let[l,c]=u;if(!a.has(l)){let d=t.documentsStore.get(o,l);i[s]={id:hg(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}var doe,_N=w(()=>{gg();ic();Ds();TRe();MMt();LRe();LMt();doe={k:1.2,b:.75,d:.5}});function poe(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 kRe(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 FMt=w(()=>{});var kMt=w(()=>{XA();ic();jRe();NRe();Ds()});var $Mt=w(()=>{ic();_N()});var BMt=w(()=>{pRe();Ds();j8();aoe()});var F8=w(()=>{SMt();xMt();jRe();NRe();_N();LRe();FMt();kMt();$Mt();ARe();ORe();BMt()});function EGr(t,e){let r=qMt(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function qMt(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var Gqo,Jqo,OGr,PGr,$Re,TGr,moe,UMt=w(()=>{Gqo=new Error("timeout while waiting for mutex to become available"),Jqo=new Error("mutex already locked"),OGr=new Error("request for lock canceled"),PGr=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())})},$Re=class{constructor(e,r=OGr){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=qMt(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return PGr(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]=[]),EGr(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].prioritye(),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 zMt=v(()=>{});var Ln=v((hoe,HMt)=>{(function(t,e){typeof hoe=="object"?HMt.exports=hoe=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(hoe,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=zMt()}catch{}var o=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function g(){}return function(y){var S;return g.prototype=y,S=new g,g.prototype=null,S}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(g){var y=i(this);return g&&y.mixIn(g),(!y.hasOwnProperty("init")||this.init===y.init)&&(y.init=function(){y.$super.init.apply(this,arguments)}),y.init.prototype=y,y.$super=this,y},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var y in g)g.hasOwnProperty(y)&&(this[y]=g[y]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(g,y){g=this.words=g||[],y!=r?this.sigBytes=y:this.sigBytes=g.length*4},toString:function(g){return(g||d).stringify(this)},concat:function(g){var y=this.words,S=g.words,x=this.sigBytes,O=g.sigBytes;if(this.clamp(),x%4)for(var P=0;P>>2]>>>24-P%4*8&255;y[x+P>>>2]|=E<<24-(x+P)%4*8}else for(var A=0;A>>2]=S[A>>>2];return this.sigBytes+=O,this},clamp:function(){var g=this.words,y=this.sigBytes;g[y>>>2]&=4294967295<<32-y%4*8,g.length=e.ceil(y/4)},clone:function(){var g=u.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var y=[],S=0;S>>2]>>>24-O%4*8&255;x.push((P>>>4).toString(16)),x.push((P&15).toString(16))}return x.join("")},parse:function(g){for(var y=g.length,S=[],x=0;x>>3]|=parseInt(g.substr(x,2),16)<<24-x%8*4;return new l.init(S,y/2)}},f=c.Latin1={stringify:function(g){for(var y=g.words,S=g.sigBytes,x=[],O=0;O>>2]>>>24-O%4*8&255;x.push(String.fromCharCode(P))}return x.join("")},parse:function(g){for(var y=g.length,S=[],x=0;x>>2]|=(g.charCodeAt(x)&255)<<24-x%4*8;return new l.init(S,y)}},p=c.Utf8={stringify:function(g){try{return decodeURIComponent(escape(f.stringify(g)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(g){return f.parse(unescape(encodeURIComponent(g)))}},m=s.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(g){typeof g=="string"&&(g=p.parse(g)),this._data.concat(g),this._nDataBytes+=g.sigBytes},_process:function(g){var y,S=this._data,x=S.words,O=S.sigBytes,P=this.blockSize,E=P*4,A=O/E;g?A=e.ceil(A):A=e.max((A|0)-this._minBufferSize,0);var I=A*P,R=e.min(I*4,O);if(I){for(var N=0;N{(function(t,e){typeof goe=="object"?VMt.exports=goe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(goe,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{(function(t,e){typeof yoe=="object"?WMt.exports=yoe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(yoe,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>>2]|=a[l]<<24-l%4*8;o.call(this,u,s)}else o.apply(this,arguments)};i.prototype=n}}(),t.lib.WordArray})});var JMt=v((boe,GMt)=>{(function(t,e){typeof boe=="object"?GMt.exports=boe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(boe,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>>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>>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>>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>>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 tI=v((_oe,YMt)=>{(function(t,e){typeof _oe=="object"?YMt.exports=_oe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(_oe,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>>2]>>>24-f%4*8&255,m=u[f+1>>>2]>>>24-(f+1)%4*8&255,h=u[f+2>>>2]>>>24-(f+2)%4*8&255,b=p<<16|m<<8|h,g=0;g<4&&f+g*.75>>6*(3-g)&63));var y=c.charAt(64);if(y)for(;d.length%4;)d.push(y);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>>6-f%4*2,h=p|m;c[d>>>2]|=h<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64})});var XMt=v((voe,ZMt)=>{(function(t,e){typeof voe=="object"?ZMt.exports=voe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(voe,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>>2]>>>24-p%4*8&255,h=l[p+1>>>2]>>>24-(p+1)%4*8&255,b=l[p+2>>>2]>>>24-(p+2)%4*8&255,g=m<<16|h<<8|b,y=0;y<4&&p+y*.75>>6*(3-y)&63));var S=d.charAt(64);if(S)for(;f.length%4;)f.push(S);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>>6-f%4*2,h=p|m;c[d>>>2]|=h<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64url})});var rI=v((woe,QMt)=>{(function(t,e){typeof woe=="object"?QMt.exports=woe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(woe,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[];(function(){for(var p=0;p<64;p++)s[p]=e.abs(e.sin(p+1))*4294967296|0})();var u=a.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,m){for(var h=0;h<16;h++){var b=m+h,g=p[b];p[b]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var y=this._hash.words,S=p[m+0],x=p[m+1],O=p[m+2],P=p[m+3],E=p[m+4],A=p[m+5],I=p[m+6],R=p[m+7],N=p[m+8],j=p[m+9],$=p[m+10],k=p[m+11],z=p[m+12],V=p[m+13],Q=p[m+14],J=p[m+15],D=y[0],B=y[1],q=y[2],K=y[3];D=l(D,B,q,K,S,7,s[0]),K=l(K,D,B,q,x,12,s[1]),q=l(q,K,D,B,O,17,s[2]),B=l(B,q,K,D,P,22,s[3]),D=l(D,B,q,K,E,7,s[4]),K=l(K,D,B,q,A,12,s[5]),q=l(q,K,D,B,I,17,s[6]),B=l(B,q,K,D,R,22,s[7]),D=l(D,B,q,K,N,7,s[8]),K=l(K,D,B,q,j,12,s[9]),q=l(q,K,D,B,$,17,s[10]),B=l(B,q,K,D,k,22,s[11]),D=l(D,B,q,K,z,7,s[12]),K=l(K,D,B,q,V,12,s[13]),q=l(q,K,D,B,Q,17,s[14]),B=l(B,q,K,D,J,22,s[15]),D=c(D,B,q,K,x,5,s[16]),K=c(K,D,B,q,I,9,s[17]),q=c(q,K,D,B,k,14,s[18]),B=c(B,q,K,D,S,20,s[19]),D=c(D,B,q,K,A,5,s[20]),K=c(K,D,B,q,$,9,s[21]),q=c(q,K,D,B,J,14,s[22]),B=c(B,q,K,D,E,20,s[23]),D=c(D,B,q,K,j,5,s[24]),K=c(K,D,B,q,Q,9,s[25]),q=c(q,K,D,B,P,14,s[26]),B=c(B,q,K,D,N,20,s[27]),D=c(D,B,q,K,V,5,s[28]),K=c(K,D,B,q,O,9,s[29]),q=c(q,K,D,B,R,14,s[30]),B=c(B,q,K,D,z,20,s[31]),D=d(D,B,q,K,A,4,s[32]),K=d(K,D,B,q,N,11,s[33]),q=d(q,K,D,B,k,16,s[34]),B=d(B,q,K,D,Q,23,s[35]),D=d(D,B,q,K,x,4,s[36]),K=d(K,D,B,q,E,11,s[37]),q=d(q,K,D,B,R,16,s[38]),B=d(B,q,K,D,$,23,s[39]),D=d(D,B,q,K,V,4,s[40]),K=d(K,D,B,q,S,11,s[41]),q=d(q,K,D,B,P,16,s[42]),B=d(B,q,K,D,I,23,s[43]),D=d(D,B,q,K,j,4,s[44]),K=d(K,D,B,q,z,11,s[45]),q=d(q,K,D,B,J,16,s[46]),B=d(B,q,K,D,O,23,s[47]),D=f(D,B,q,K,S,6,s[48]),K=f(K,D,B,q,R,10,s[49]),q=f(q,K,D,B,Q,15,s[50]),B=f(B,q,K,D,A,21,s[51]),D=f(D,B,q,K,z,6,s[52]),K=f(K,D,B,q,P,10,s[53]),q=f(q,K,D,B,$,15,s[54]),B=f(B,q,K,D,x,21,s[55]),D=f(D,B,q,K,N,6,s[56]),K=f(K,D,B,q,J,10,s[57]),q=f(q,K,D,B,I,15,s[58]),B=f(B,q,K,D,V,21,s[59]),D=f(D,B,q,K,E,6,s[60]),K=f(K,D,B,q,k,10,s[61]),q=f(q,K,D,B,O,15,s[62]),B=f(B,q,K,D,j,21,s[63]),y[0]=y[0]+D|0,y[1]=y[1]+B|0,y[2]=y[2]+q|0,y[3]=y[3]+K|0},_doFinalize:function(){var p=this._data,m=p.words,h=this._nDataBytes*8,b=p.sigBytes*8;m[b>>>5]|=128<<24-b%32;var g=e.floor(h/4294967296),y=h;m[(b+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,m[(b+64>>>9<<4)+14]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,p.sigBytes=(m.length+1)*4,this._process();for(var S=this._hash,x=S.words,O=0;O<4;O++){var P=x[O];x[O]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360}return S},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,m,h,b,g,y,S){var x=p+(m&h|~m&b)+g+S;return(x<>>32-y)+m}function c(p,m,h,b,g,y,S){var x=p+(m&b|h&~b)+g+S;return(x<>>32-y)+m}function d(p,m,h,b,g,y,S){var x=p+(m^h^b)+g+S;return(x<>>32-y)+m}function f(p,m,h,b,g,y,S){var x=p+(h^(m|~b))+g+S;return(x<>>32-y)+m}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var BRe=v((Soe,eRt)=>{(function(t,e){typeof Soe=="object"?eRt.exports=Soe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Soe,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.Hasher,i=e.algo,a=[],s=i.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,l){for(var c=this._hash.words,d=c[0],f=c[1],p=c[2],m=c[3],h=c[4],b=0;b<80;b++){if(b<16)a[b]=u[l+b]|0;else{var g=a[b-3]^a[b-8]^a[b-14]^a[b-16];a[b]=g<<1|g>>>31}var y=(d<<5|d>>>27)+h+a[b];b<20?y+=(f&p|~f&m)+1518500249:b<40?y+=(f^p^m)+1859775393:b<60?y+=(f&p|f&m|p&m)-1894007588:y+=(f^p^m)-899497514,h=m,m=p,p=f<<30|f>>>2,f=d,d=y}c[0]=c[0]+d|0,c[1]=c[1]+f|0,c[2]=c[2]+p|0,c[3]=c[3]+m|0,c[4]=c[4]+h|0},_doFinalize:function(){var u=this._data,l=u.words,c=this._nDataBytes*8,d=u.sigBytes*8;return l[d>>>5]|=128<<24-d%32,l[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),l[(d+64>>>9<<4)+15]=c,u.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var u=o.clone.call(this);return u._hash=this._hash.clone(),u}});e.SHA1=o._createHelper(s),e.HmacSHA1=o._createHmacHelper(s)}(),t.SHA1})});var Coe=v((xoe,tRt)=>{(function(t,e){typeof xoe=="object"?tRt.exports=xoe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(xoe,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[],u=[];(function(){function d(h){for(var b=e.sqrt(h),g=2;g<=b;g++)if(!(h%g))return!1;return!0}function f(h){return(h-(h|0))*4294967296|0}for(var p=2,m=0;m<64;)d(p)&&(m<8&&(s[m]=f(e.pow(p,1/2))),u[m]=f(e.pow(p,1/3)),m++),p++})();var l=[],c=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(d,f){for(var p=this._hash.words,m=p[0],h=p[1],b=p[2],g=p[3],y=p[4],S=p[5],x=p[6],O=p[7],P=0;P<64;P++){if(P<16)l[P]=d[f+P]|0;else{var E=l[P-15],A=(E<<25|E>>>7)^(E<<14|E>>>18)^E>>>3,I=l[P-2],R=(I<<15|I>>>17)^(I<<13|I>>>19)^I>>>10;l[P]=A+l[P-7]+R+l[P-16]}var N=y&S^~y&x,j=m&h^m&b^h&b,$=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),k=(y<<26|y>>>6)^(y<<21|y>>>11)^(y<<7|y>>>25),z=O+k+N+u[P]+l[P],V=$+j;O=x,x=S,S=y,y=g+z|0,g=b,b=h,h=m,m=z+V|0}p[0]=p[0]+m|0,p[1]=p[1]+h|0,p[2]=p[2]+b|0,p[3]=p[3]+g|0,p[4]=p[4]+y|0,p[5]=p[5]+S|0,p[6]=p[6]+x|0,p[7]=p[7]+O|0},_doFinalize:function(){var d=this._data,f=d.words,p=this._nDataBytes*8,m=d.sigBytes*8;return f[m>>>5]|=128<<24-m%32,f[(m+64>>>9<<4)+14]=e.floor(p/4294967296),f[(m+64>>>9<<4)+15]=p,d.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var d=i.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA256=i._createHelper(c),r.HmacSHA256=i._createHmacHelper(c)}(Math),t.SHA256})});var nRt=v((Ooe,rRt)=>{(function(t,e,r){typeof Ooe=="object"?rRt.exports=Ooe=e(Ln(),Coe()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(Ooe,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 qRe=v((Poe,oRt)=>{(function(t,e,r){typeof Poe=="object"?oRt.exports=Poe=e(Ln(),k8()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Poe,function(t){return function(){var e=t,r=e.lib,n=r.Hasher,o=e.x64,i=o.Word,a=o.WordArray,s=e.algo;function u(){return i.create.apply(i,arguments)}var l=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],c=[];(function(){for(var f=0;f<80;f++)c[f]=u()})();var d=s.SHA512=n.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(f,p){for(var m=this._hash.words,h=m[0],b=m[1],g=m[2],y=m[3],S=m[4],x=m[5],O=m[6],P=m[7],E=h.high,A=h.low,I=b.high,R=b.low,N=g.high,j=g.low,$=y.high,k=y.low,z=S.high,V=S.low,Q=x.high,J=x.low,D=O.high,B=O.low,q=P.high,K=P.low,H=E,ee=A,U=I,W=R,Y=N,ae=j,Oe=$,le=k,Be=z,ze=V,rt=Q,cr=J,Sn=D,je=B,mt=q,ht=K,ft=0;ft<80;ft++){var te,et,Re=c[ft];if(ft<16)et=Re.high=f[p+ft*2]|0,te=Re.low=f[p+ft*2+1]|0;else{var Pe=c[ft-15],oe=Pe.high,se=Pe.low,ce=(oe>>>1|se<<31)^(oe>>>8|se<<24)^oe>>>7,Ce=(se>>>1|oe<<31)^(se>>>8|oe<<24)^(se>>>7|oe<<25),Je=c[ft-2],ir=Je.high,ea=Je.low,ta=(ir>>>19|ea<<13)^(ir<<3|ea>>>29)^ir>>>6,xc=(ea>>>19|ir<<13)^(ea<<3|ir>>>29)^(ea>>>6|ir<<26),Cd=c[ft-7],qi=Cd.high,lp=Cd.low,yf=c[ft-16],bf=yf.high,xn=yf.low;te=Ce+lp,et=ce+qi+(te>>>0>>0?1:0),te=te+xc,et=et+ta+(te>>>0>>0?1:0),te=te+xn,et=et+bf+(te>>>0>>0?1:0),Re.high=et,Re.low=te}var _f=Be&rt^~Be&Sn,uC=ze&cr^~ze&je,kb=H&U^H&Y^U&Y,is=ee&W^ee&ae^W&ae,$s=(H>>>28|ee<<4)^(H<<30|ee>>>2)^(H<<25|ee>>>7),La=(ee>>>28|H<<4)^(ee<<30|H>>>2)^(ee<<25|H>>>7),vf=(Be>>>14|ze<<18)^(Be>>>18|ze<<14)^(Be<<23|ze>>>9),Od=(ze>>>14|Be<<18)^(ze>>>18|Be<<14)^(ze<<23|Be>>>9),ws=l[ft],cp=ws.high,wf=ws.low,In=ht+Od,Ye=mt+vf+(In>>>0>>0?1:0),In=In+uC,Ye=Ye+_f+(In>>>0>>0?1:0),In=In+wf,Ye=Ye+cp+(In>>>0>>0?1:0),In=In+te,Ye=Ye+et+(In>>>0>>0?1:0),Sf=La+is,mm=$s+kb+(Sf>>>0>>0?1:0);mt=Sn,ht=je,Sn=rt,je=cr,rt=Be,cr=ze,ze=le+In|0,Be=Oe+Ye+(ze>>>0>>0?1:0)|0,Oe=Y,le=ae,Y=U,ae=W,U=H,W=ee,ee=In+Sf|0,H=Ye+mm+(ee>>>0>>0?1:0)|0}A=h.low=A+ee,h.high=E+H+(A>>>0>>0?1:0),R=b.low=R+W,b.high=I+U+(R>>>0>>0?1:0),j=g.low=j+ae,g.high=N+Y+(j>>>0>>0?1:0),k=y.low=k+le,y.high=$+Oe+(k>>>0>>0?1:0),V=S.low=V+ze,S.high=z+Be+(V>>>0>>0?1:0),J=x.low=J+cr,x.high=Q+rt+(J>>>0>>0?1:0),B=O.low=B+je,O.high=D+Sn+(B>>>0>>0?1:0),K=P.low=K+ht,P.high=q+mt+(K>>>0>>0?1:0)},_doFinalize:function(){var f=this._data,p=f.words,m=this._nDataBytes*8,h=f.sigBytes*8;p[h>>>5]|=128<<24-h%32,p[(h+128>>>10<<5)+30]=Math.floor(m/4294967296),p[(h+128>>>10<<5)+31]=m,f.sigBytes=p.length*4,this._process();var b=this._hash.toX32();return b},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 aRt=v((Eoe,iRt)=>{(function(t,e,r){typeof Eoe=="object"?iRt.exports=Eoe=e(Ln(),k8(),qRe()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(Eoe,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 uRt=v((Toe,sRt)=>{(function(t,e,r){typeof Toe=="object"?sRt.exports=Toe=e(Ln(),k8()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Toe,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.x64,s=a.Word,u=r.algo,l=[],c=[],d=[];(function(){for(var m=1,h=0,b=0;b<24;b++){l[m+5*h]=(b+1)*(b+2)/2%64;var g=h%5,y=(2*m+3*h)%5;m=g,h=y}for(var m=0;m<5;m++)for(var h=0;h<5;h++)c[m+5*h]=h+(2*m+3*h)%5*5;for(var S=1,x=0;x<24;x++){for(var O=0,P=0,E=0;E<7;E++){if(S&1){var A=(1<>>24)&16711935|(S<<24|S>>>8)&4278255360,x=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360;var O=b[y];O.high^=x,O.low^=S}for(var P=0;P<24;P++){for(var E=0;E<5;E++){for(var A=0,I=0,R=0;R<5;R++){var O=b[E+5*R];A^=O.high,I^=O.low}var N=f[E];N.high=A,N.low=I}for(var E=0;E<5;E++)for(var j=f[(E+4)%5],$=f[(E+1)%5],k=$.high,z=$.low,A=j.high^(k<<1|z>>>31),I=j.low^(z<<1|k>>>31),R=0;R<5;R++){var O=b[E+5*R];O.high^=A,O.low^=I}for(var V=1;V<25;V++){var A,I,O=b[V],Q=O.high,J=O.low,D=l[V];D<32?(A=Q<>>32-D,I=J<>>32-D):(A=J<>>64-D,I=Q<>>64-D);var B=f[c[V]];B.high=A,B.low=I}var q=f[0],K=b[0];q.high=K.high,q.low=K.low;for(var E=0;E<5;E++)for(var R=0;R<5;R++){var V=E+5*R,O=b[V],H=f[V],ee=f[(E+1)%5+5*R],U=f[(E+2)%5+5*R];O.high=H.high^~ee.high&U.high,O.low=H.low^~ee.low&U.low}var O=b[0],W=d[P];O.high^=W.high,O.low^=W.low}},_doFinalize:function(){var m=this._data,h=m.words,b=this._nDataBytes*8,g=m.sigBytes*8,y=this.blockSize*32;h[g>>>5]|=1<<24-g%32,h[(e.ceil((g+1)/y)*y>>>5)-1]|=128,m.sigBytes=h.length*4,this._process();for(var S=this._state,x=this.cfg.outputLength/8,O=x/8,P=[],E=0;E>>24)&16711935|(I<<24|I>>>8)&4278255360,R=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,P.push(R),P.push(I)}return new o.init(P,x)},clone:function(){for(var m=i.clone.call(this),h=m._state=this._state.slice(0),b=0;b<25;b++)h[b]=h[b].clone();return m}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})});var cRt=v((Aoe,lRt)=>{(function(t,e){typeof Aoe=="object"?lRt.exports=Aoe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Aoe,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=o.create([0,1518500249,1859775393,2400959708,2840853838]),f=o.create([1352829926,1548603684,1836072691,2053994217,0]),p=a.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(x,O){for(var P=0;P<16;P++){var E=O+P,A=x[E];x[E]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var I=this._hash.words,R=d.words,N=f.words,j=s.words,$=u.words,k=l.words,z=c.words,V,Q,J,D,B,q,K,H,ee,U;q=V=I[0],K=Q=I[1],H=J=I[2],ee=D=I[3],U=B=I[4];for(var W,P=0;P<80;P+=1)W=V+x[O+j[P]]|0,P<16?W+=m(Q,J,D)+R[0]:P<32?W+=h(Q,J,D)+R[1]:P<48?W+=b(Q,J,D)+R[2]:P<64?W+=g(Q,J,D)+R[3]:W+=y(Q,J,D)+R[4],W=W|0,W=S(W,k[P]),W=W+B|0,V=B,B=D,D=S(J,10),J=Q,Q=W,W=q+x[O+$[P]]|0,P<16?W+=y(K,H,ee)+N[0]:P<32?W+=g(K,H,ee)+N[1]:P<48?W+=b(K,H,ee)+N[2]:P<64?W+=h(K,H,ee)+N[3]:W+=m(K,H,ee)+N[4],W=W|0,W=S(W,z[P]),W=W+U|0,q=U,U=ee,ee=S(H,10),H=K,K=W;W=I[1]+J+ee|0,I[1]=I[2]+D+U|0,I[2]=I[3]+B+q|0,I[3]=I[4]+V+K|0,I[4]=I[0]+Q+H|0,I[0]=W},_doFinalize:function(){var x=this._data,O=x.words,P=this._nDataBytes*8,E=x.sigBytes*8;O[E>>>5]|=128<<24-E%32,O[(E+64>>>9<<4)+14]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,x.sigBytes=(O.length+1)*4,this._process();for(var A=this._hash,I=A.words,R=0;R<5;R++){var N=I[R];I[R]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360}return A},clone:function(){var x=i.clone.call(this);return x._hash=this._hash.clone(),x}});function m(x,O,P){return x^O^P}function h(x,O,P){return x&O|~x&P}function b(x,O,P){return(x|~O)^P}function g(x,O,P){return x&P|O&~P}function y(x,O,P){return x^(O|~P)}function S(x,O){return x<>>32-O}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),t.RIPEMD160})});var Moe=v((Ioe,dRt)=>{(function(t,e){typeof Ioe=="object"?dRt.exports=Ioe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Ioe,function(t){(function(){var e=t,r=e.lib,n=r.Base,o=e.enc,i=o.Utf8,a=e.algo,s=a.HMAC=n.extend({init:function(u,l){u=this._hasher=new u.init,typeof l=="string"&&(l=i.parse(l));var c=u.blockSize,d=c*4;l.sigBytes>d&&(l=u.finalize(l)),l.clamp();for(var f=this._oKey=l.clone(),p=this._iKey=l.clone(),m=f.words,h=p.words,b=0;b{(function(t,e,r){typeof Roe=="object"?fRt.exports=Roe=e(Ln(),Coe(),Moe()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(Roe,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.SHA256,s=i.HMAC,u=i.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:25e4}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,c){for(var d=this.cfg,f=s.create(d.hasher,l),p=o.create(),m=o.create([1]),h=p.words,b=m.words,g=d.keySize,y=d.iterations;h.length{(function(t,e,r){typeof joe=="object"?mRt.exports=joe=e(Ln(),BRe(),Moe()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(joe,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.MD5,s=i.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:1}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,l){for(var c,d=this.cfg,f=d.hasher.create(),p=o.create(),m=p.words,h=d.keySize,b=d.iterations;m.length{(function(t,e,r){typeof Noe=="object"?hRt.exports=Noe=e(Ln(),QO()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(Noe,function(t){t.lib.Cipher||function(e){var r=t,n=r.lib,o=n.Base,i=n.WordArray,a=n.BufferedBlockAlgorithm,s=r.enc,u=s.Utf8,l=s.Base64,c=r.algo,d=c.EvpKDF,f=n.Cipher=a.extend({cfg:o.extend(),createEncryptor:function(N,j){return this.create(this._ENC_XFORM_MODE,N,j)},createDecryptor:function(N,j){return this.create(this._DEC_XFORM_MODE,N,j)},init:function(N,j,$){this.cfg=this.cfg.extend($),this._xformMode=N,this._key=j,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(N){return this._append(N),this._process()},finalize:function(N){N&&this._append(N);var j=this._doFinalize();return j},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function N(j){return typeof j=="string"?R:E}return function(j){return{encrypt:function($,k,z){return N(k).encrypt(j,$,k,z)},decrypt:function($,k,z){return N(k).decrypt(j,$,k,z)}}}}()}),p=n.StreamCipher=f.extend({_doFinalize:function(){var N=this._process(!0);return N},blockSize:1}),m=r.mode={},h=n.BlockCipherMode=o.extend({createEncryptor:function(N,j){return this.Encryptor.create(N,j)},createDecryptor:function(N,j){return this.Decryptor.create(N,j)},init:function(N,j){this._cipher=N,this._iv=j}}),b=m.CBC=function(){var N=h.extend();N.Encryptor=N.extend({processBlock:function($,k){var z=this._cipher,V=z.blockSize;j.call(this,$,k,V),z.encryptBlock($,k),this._prevBlock=$.slice(k,k+V)}}),N.Decryptor=N.extend({processBlock:function($,k){var z=this._cipher,V=z.blockSize,Q=$.slice(k,k+V);z.decryptBlock($,k),j.call(this,$,k,V),this._prevBlock=Q}});function j($,k,z){var V,Q=this._iv;Q?(V=Q,this._iv=e):V=this._prevBlock;for(var J=0;J>>2]&255;N.sigBytes-=j}},S=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:b,padding:y}),reset:function(){var N;f.reset.call(this);var j=this.cfg,$=j.iv,k=j.mode;this._xformMode==this._ENC_XFORM_MODE?N=k.createEncryptor:(N=k.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==N?this._mode.init(this,$&&$.words):(this._mode=N.call(k,this,$&&$.words),this._mode.__creator=N)},_doProcessBlock:function(N,j){this._mode.processBlock(N,j)},_doFinalize:function(){var N,j=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(j.pad(this._data,this.blockSize),N=this._process(!0)):(N=this._process(!0),j.unpad(N)),N},blockSize:128/32}),x=n.CipherParams=o.extend({init:function(N){this.mixIn(N)},toString:function(N){return(N||this.formatter).stringify(this)}}),O=r.format={},P=O.OpenSSL={stringify:function(N){var j,$=N.ciphertext,k=N.salt;return k?j=i.create([1398893684,1701076831]).concat(k).concat($):j=$,j.toString(l)},parse:function(N){var j,$=l.parse(N),k=$.words;return k[0]==1398893684&&k[1]==1701076831&&(j=i.create(k.slice(2,4)),k.splice(0,4),$.sigBytes-=16),x.create({ciphertext:$,salt:j})}},E=n.SerializableCipher=o.extend({cfg:o.extend({format:P}),encrypt:function(N,j,$,k){k=this.cfg.extend(k);var z=N.createEncryptor($,k),V=z.finalize(j),Q=z.cfg;return x.create({ciphertext:V,key:$,iv:Q.iv,algorithm:N,mode:Q.mode,padding:Q.padding,blockSize:N.blockSize,formatter:k.format})},decrypt:function(N,j,$,k){k=this.cfg.extend(k),j=this._parse(j,k.format);var z=N.createDecryptor($,k).finalize(j.ciphertext);return z},_parse:function(N,j){return typeof N=="string"?j.parse(N,this):N}}),A=r.kdf={},I=A.OpenSSL={execute:function(N,j,$,k,z){if(k||(k=i.random(64/8)),z)var V=d.create({keySize:j+$,hasher:z}).compute(N,k);else var V=d.create({keySize:j+$}).compute(N,k);var Q=i.create(V.words.slice(j),$*4);return V.sigBytes=j*4,x.create({key:V,iv:Q,salt:k})}},R=n.PasswordBasedCipher=E.extend({cfg:E.cfg.extend({kdf:I}),encrypt:function(N,j,$,k){k=this.cfg.extend(k);var z=k.kdf.execute($,N.keySize,N.ivSize,k.salt,k.hasher);k.iv=z.iv;var V=E.encrypt.call(this,N,j,z.key,k);return V.mixIn(z),V},decrypt:function(N,j,$,k){k=this.cfg.extend(k),j=this._parse(j,k.format);var z=k.kdf.execute($,N.keySize,N.ivSize,j.salt,k.hasher);k.iv=z.iv;var V=E.decrypt.call(this,N,j,z.key,k);return V}})}()})});var yRt=v((Doe,gRt)=>{(function(t,e,r){typeof Doe=="object"?gRt.exports=Doe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Doe,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{(function(t,e,r){typeof Loe=="object"?bRt.exports=Loe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Loe,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{(function(t,e,r){typeof Foe=="object"?vRt.exports=Foe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Foe,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{(function(t,e,r){typeof koe=="object"?SRt.exports=koe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(koe,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{(function(t,e,r){typeof $oe=="object"?CRt.exports=$oe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})($oe,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 ERt=v((Boe,PRt)=>{(function(t,e,r){typeof Boe=="object"?PRt.exports=Boe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Boe,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 ARt=v((qoe,TRt)=>{(function(t,e,r){typeof qoe=="object"?TRt.exports=qoe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(qoe,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 MRt=v((Uoe,IRt)=>{(function(t,e,r){typeof Uoe=="object"?IRt.exports=Uoe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Uoe,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 jRt=v((zoe,RRt)=>{(function(t,e,r){typeof zoe=="object"?RRt.exports=zoe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(zoe,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 DRt=v((Hoe,NRt)=>{(function(t,e,r){typeof Hoe=="object"?NRt.exports=Hoe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Hoe,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var FRt=v((Voe,LRt)=>{(function(t,e,r){typeof Voe=="object"?LRt.exports=Voe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Voe,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 $Rt=v((Woe,kRt)=>{(function(t,e,r){typeof Woe=="object"?kRt.exports=Woe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Woe,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo,i=[],a=[],s=[],u=[],l=[],c=[],d=[],f=[],p=[],m=[];(function(){for(var g=[],y=0;y<256;y++)y<128?g[y]=y<<1:g[y]=y<<1^283;for(var S=0,x=0,y=0;y<256;y++){var O=x^x<<1^x<<2^x<<3^x<<4;O=O>>>8^O&255^99,i[S]=O,a[O]=S;var P=g[S],E=g[P],A=g[E],I=g[O]*257^O*16843008;s[S]=I<<24|I>>>8,u[S]=I<<16|I>>>16,l[S]=I<<8|I>>>24,c[S]=I;var I=A*16843009^E*65537^P*257^S*16843008;d[O]=I<<24|I>>>8,f[O]=I<<16|I>>>16,p[O]=I<<8|I>>>24,m[O]=I,S?(S=P^g[g[g[A^P]]],x^=g[g[x]]):S=x=1}})();var h=[0,1,2,4,8,16,32,64,128,27,54],b=o.AES=n.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var y=this._keyPriorReset=this._key,S=y.words,x=y.sigBytes/4,O=this._nRounds=x+6,P=(O+1)*4,E=this._keySchedule=[],A=0;A6&&A%x==4&&(g=i[g>>>24]<<24|i[g>>>16&255]<<16|i[g>>>8&255]<<8|i[g&255]):(g=g<<8|g>>>24,g=i[g>>>24]<<24|i[g>>>16&255]<<16|i[g>>>8&255]<<8|i[g&255],g^=h[A/x|0]<<24),E[A]=E[A-x]^g);for(var I=this._invKeySchedule=[],R=0;R>>24]]^f[i[g>>>16&255]]^p[i[g>>>8&255]]^m[i[g&255]]}}},encryptBlock:function(g,y){this._doCryptBlock(g,y,this._keySchedule,s,u,l,c,i)},decryptBlock:function(g,y){var S=g[y+1];g[y+1]=g[y+3],g[y+3]=S,this._doCryptBlock(g,y,this._invKeySchedule,d,f,p,m,a);var S=g[y+1];g[y+1]=g[y+3],g[y+3]=S},_doCryptBlock:function(g,y,S,x,O,P,E,A){for(var I=this._nRounds,R=g[y]^S[0],N=g[y+1]^S[1],j=g[y+2]^S[2],$=g[y+3]^S[3],k=4,z=1;z>>24]^O[N>>>16&255]^P[j>>>8&255]^E[$&255]^S[k++],Q=x[N>>>24]^O[j>>>16&255]^P[$>>>8&255]^E[R&255]^S[k++],J=x[j>>>24]^O[$>>>16&255]^P[R>>>8&255]^E[N&255]^S[k++],D=x[$>>>24]^O[R>>>16&255]^P[N>>>8&255]^E[j&255]^S[k++];R=V,N=Q,j=J,$=D}var V=(A[R>>>24]<<24|A[N>>>16&255]<<16|A[j>>>8&255]<<8|A[$&255])^S[k++],Q=(A[N>>>24]<<24|A[j>>>16&255]<<16|A[$>>>8&255]<<8|A[R&255])^S[k++],J=(A[j>>>24]<<24|A[$>>>16&255]<<16|A[R>>>8&255]<<8|A[N&255])^S[k++],D=(A[$>>>24]<<24|A[R>>>16&255]<<16|A[N>>>8&255]<<8|A[j&255])^S[k++];g[y]=V,g[y+1]=Q,g[y+2]=J,g[y+3]=D},keySize:256/32});e.AES=n._createHelper(b)}(),t.AES})});var qRt=v((Koe,BRt)=>{(function(t,e,r){typeof Koe=="object"?BRt.exports=Koe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Koe,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.BlockCipher,i=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=i.DES=o.extend({_doReset:function(){for(var h=this._key,b=h.words,g=[],y=0;y<56;y++){var S=a[y]-1;g[y]=b[S>>>5]>>>31-S%32&1}for(var x=this._subKeys=[],O=0;O<16;O++){for(var P=x[O]=[],E=u[O],y=0;y<24;y++)P[y/6|0]|=g[(s[y]-1+E)%28]<<31-y%6,P[4+(y/6|0)]|=g[28+(s[y+24]-1+E)%28]<<31-y%6;P[0]=P[0]<<1|P[0]>>>31;for(var y=1;y<7;y++)P[y]=P[y]>>>(y-1)*4+3;P[7]=P[7]<<5|P[7]>>>27}for(var A=this._invSubKeys=[],y=0;y<16;y++)A[y]=x[15-y]},encryptBlock:function(h,b){this._doCryptBlock(h,b,this._subKeys)},decryptBlock:function(h,b){this._doCryptBlock(h,b,this._invSubKeys)},_doCryptBlock:function(h,b,g){this._lBlock=h[b],this._rBlock=h[b+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 y=0;y<16;y++){for(var S=g[y],x=this._lBlock,O=this._rBlock,P=0,E=0;E<8;E++)P|=l[E][((O^S[E])&c[E])>>>0];this._lBlock=O,this._rBlock=x^P}var A=this._lBlock;this._lBlock=this._rBlock,this._rBlock=A,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),h[b]=this._lBlock,h[b+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(h,b){var g=(this._lBlock>>>h^this._rBlock)&b;this._rBlock^=g,this._lBlock^=g<>>h^this._lBlock)&b;this._lBlock^=g,this._rBlock^=g<192.");var g=b.slice(0,2),y=b.length<4?b.slice(0,2):b.slice(2,4),S=b.length<6?b.slice(0,2):b.slice(4,6);this._des1=d.createEncryptor(n.create(g)),this._des2=d.createEncryptor(n.create(y)),this._des3=d.createEncryptor(n.create(S))},encryptBlock:function(h,b){this._des1.encryptBlock(h,b),this._des2.decryptBlock(h,b),this._des3.encryptBlock(h,b)},decryptBlock:function(h,b){this._des3.decryptBlock(h,b),this._des2.encryptBlock(h,b),this._des1.decryptBlock(h,b)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=o._createHelper(m)}(),t.TripleDES})});var zRt=v((Goe,URt)=>{(function(t,e,r){typeof Goe=="object"?URt.exports=Goe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Goe,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=o.RC4=n.extend({_doReset:function(){for(var u=this._key,l=u.words,c=u.sigBytes,d=this._S=[],f=0;f<256;f++)d[f]=f;for(var f=0,p=0;f<256;f++){var m=f%c,h=l[m>>>2]>>>24-m%4*8&255;p=(p+d[f]+h)%256;var b=d[f];d[f]=d[p],d[p]=b}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 VRt=v((Joe,HRt)=>{(function(t,e,r){typeof Joe=="object"?HRt.exports=Joe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Joe,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.Rabbit=n.extend({_doReset:function(){for(var c=this._key.words,d=this.cfg.iv,f=0;f<4;f++)c[f]=(c[f]<<8|c[f]>>>24)&16711935|(c[f]<<24|c[f]>>>8)&4278255360;var p=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],m=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var f=0;f<4;f++)l.call(this);for(var f=0;f<8;f++)m[f]^=p[f+4&7];if(d){var h=d.words,b=h[0],g=h[1],y=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,S=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=y>>>16|S&4294901760,O=S<<16|y&65535;m[0]^=y,m[1]^=x,m[2]^=S,m[3]^=O,m[4]^=y,m[5]^=x,m[6]^=S,m[7]^=O;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>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0>>0?1:0)|0,this._b=d[7]>>>0>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,b=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=b^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=n._createHelper(u)}(),t.Rabbit})});var KRt=v((Yoe,WRt)=>{(function(t,e,r){typeof Yoe=="object"?WRt.exports=Yoe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Yoe,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.RabbitLegacy=n.extend({_doReset:function(){var c=this._key.words,d=this.cfg.iv,f=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],p=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var m=0;m<4;m++)l.call(this);for(var m=0;m<8;m++)p[m]^=f[m+4&7];if(d){var h=d.words,b=h[0],g=h[1],y=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,S=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=y>>>16|S&4294901760,O=S<<16|y&65535;p[0]^=y,p[1]^=x,p[2]^=S,p[3]^=O,p[4]^=y,p[5]^=x,p[6]^=S,p[7]^=O;for(var m=0;m<4;m++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0>>0?1:0)|0,this._b=d[7]>>>0>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,b=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=b^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=n._createHelper(u)}(),t.RabbitLegacy})});var JRt=v((Zoe,GRt)=>{(function(t,e,r){typeof Zoe=="object"?GRt.exports=Zoe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Zoe,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo;let i=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var u={pbox:[],sbox:[]};function l(m,h){let b=h>>24&255,g=h>>16&255,y=h>>8&255,S=h&255,x=m.sbox[0][b]+m.sbox[1][g];return x=x^m.sbox[2][y],x=x+m.sbox[3][S],x}function c(m,h,b){let g=h,y=b,S;for(let x=0;x1;--x)g=g^m.pbox[x],y=l(m,g)^y,S=g,g=y,y=S;return S=g,g=y,y=S,y=y^m.pbox[1],g=g^m.pbox[0],{left:g,right:y}}function f(m,h,b){for(let O=0;O<4;O++){m.sbox[O]=[];for(let P=0;P<256;P++)m.sbox[O][P]=s[O][P]}let g=0;for(let O=0;O=b&&(g=0);let y=0,S=0,x=0;for(let O=0;O{(function(t,e,r){typeof Xoe=="object"?YRt.exports=Xoe=e(Ln(),k8(),KMt(),JMt(),tI(),XMt(),rI(),BRe(),Coe(),nRt(),qRe(),aRt(),uRt(),cRt(),Moe(),pRt(),QO(),Ll(),yRt(),_Rt(),wRt(),xRt(),ORt(),ERt(),ARt(),MRt(),jRt(),DRt(),FRt(),$Rt(),qRt(),zRt(),VRt(),KRt(),JRt()):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)})(Xoe,function(t){return t})});var URe,AGr,Qoe,ZRt=w(()=>{wT();nr();F8();URe="copilot-index-chunk-",AGr=".json",Qoe=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${URe}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${URe}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${AGr}`}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{i+=a.length,ue().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),ue().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 kRe(e),n=ue().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(ue().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)),ue().debug&&console.log("Saved empty database state");return}let a=this.distributeDocumentsToPartitions(i,n),s={numPartitions:n,vectorLength:e.schema.embedding.match(/\d+/)[0],schema:e.schema,lastModified:Date.now(),documentPartitions:Object.fromEntries(i.map(l=>[l.id,this.assignDocumentToPartition(l.id,n)]))};await this.saveMetadata(s);let u={...r,docs:{docs:{},count:0},index:{...r.index,vectorIndexes:void 0}};for(let[l,c]of a.entries()){let d={index:{vectorIndexes:{embedding:{size:r.index.vectorIndexes.embedding.size,vectors:Object.fromEntries(Object.entries(r.index.vectorIndexes.embedding.vectors).filter(([m])=>c.some(h=>h.id===m)))}}},docs:{docs:Object.fromEntries(c.map((m,h)=>[(h+1).toString(),m])),count:c.length}},f=l===0?{...u,docs:d.docs,index:{...u.index,vectorIndexes:d.index.vectorIndexes}}:d,p=this.getChunkPath(l);await this.ensureDirectoryExists(p),await this.app.vault.adapter.write(p,JSON.stringify(f)),ue().debug&&console.log(`Saved partition ${l+1}/${n}`)}ue().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new Rr(`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 Rr("Invalid legacy database format");let l=await yq({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await poe(l,u),l}let r=await this.loadMetadata(),n=await yq({schema:r.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}}),o=null,i=[];for(let u=0;uObject.values(c.docs.docs)).find(c=>c.id===u);l?(a[s.toString()]=l,s++):ue().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 poe(n,o),n}catch(e){throw console.error("Error loading database:",e),new Rr(`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}/${URe}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new Rr(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(ue().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 Rr("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new Rr("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))}}});async function QRt(t){if(!t)throw new Rr("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new Rr("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${Xs.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new Rr("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function e1t(t){let e="",{inclusions:r,exclusions:n}=rf(),o=t.vault.getMarkdownFiles().filter(i=>eu(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function bg(t){let e=[];return e.push(...t.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),e}function IGr(){return ue().qaExclusions?bg(ue().qaExclusions):[]}function MGr(){return ue().qaInclusions?bg(ue().qaInclusions):[]}function rf(t){let e=t?.inclusions?bg(t.inclusions):t?.isProject?[]:MGr(),r=t?.exclusions?bg(t.exclusions):t?.isProject?[]:IGr();return{inclusions:e.length>0?$8(e):null,exclusions:r.length>0?$8(r):null}}function eu(t,e,r){return!(r&&XRt(t.path,r)||e&&!XRt(t.path,e))}function $8(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 B8({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function RGr(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof zRe.TFile){let n=NR(r);if(e.some(o=>n.includes(pF(o))))return!0}return!1}function jGr(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 NGr(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 DGr(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof zRe.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function XRt(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return RGr(t,r??[])||jGr(t,n??[])||NGr(t,o??[])||DGr(t,i??[])}function eie(t){let e=[];try{let r=t.vault.getConfig("userIgnoreFilters");r&&Array.isArray(r)&&r.forEach(n=>{typeof n=="string"&&e.push(n.endsWith("/")?n.slice(0,-1):n)})}catch(r){console.warn("Error getting userIgnoreFilters from Obsidian config",r)}return e}function tie(t){return`#${t}`}function q8(t){return`[[${t.basename}]]`}function t1t(t){return`*.${t}`}var zRe,_g=w(()=>{wT();pN();nr();yn();zRe=require("obsidian")});var r1t,Ax,eP,rie=w(()=>{pN();wT();yo();nr();yn();F8();UMt();r1t=F(wq()),Ax=require("obsidian");ZRt();_g();eP=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new moe;xa(async()=>{let r=ue();Ax.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):Ax.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await Xs.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(ie("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await Xs.getInstance().getEmbeddingsAPI()),ie("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new Rr("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new Qoe(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),Ax.Platform.isMobile&&ue().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new Rr("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),ie("Loaded existing chunked Orama database from disk."),this.oramaDb}catch(n){fe("Failed to load existing database, creating new one:",n)}let r=await this.createNewDb(e);return this.oramaDb=r,r}catch(r){fe("Error initializing Orama database:",r),new Ax.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(Ax.Platform.isMobile&&ue().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await Xs.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new Rr("Orama database not found.")}catch(e){throw fe("Failed to initialize database during save:",e),new Rr("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,ue().debug&&ie("Orama database saved successfully at:",this.dbPath)}catch(e){throw fe("Error saving Orama database:",e),e}}}async clearIndex(e){try{this.oramaDb||await this.initializeDB(e),await this.chunkedStorage?.clearStorage(),await new Promise(r=>setTimeout(r,100)),this.oramaDb=await this.createNewDb(e),await this.saveDB(),new Ax.Notice("Local Copilot index cleared successfully."),ie("Local Copilot index cleared successfully, new instance created.")}catch(r){throw fe("Error clearing the local Copilot index:",r),new Ax.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new Rr("Orama database not found.");try{let r=await Xc(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await L8(this.oramaDb,r.hits.map(n=>n.id),500),ue().debug&&ie(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(r){fe("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(ue().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),ie("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,r1t.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new Rr("Embedding instance not found.");let r=await QRt(e);if(!r||r===0)throw new Rr("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await yq({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return ie(`Created new Orama database for ${this.dbPath}. Embedding model: ${Xs.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 Xc(e,{term:r,properties:["path"],exact:!0,includeVectors:!0})).hits:void 0}static async getDocsByEmbedding(e,r,n){return(await Xc(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 Xc(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return fe("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,ue().numPartitions),o=await Xc(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await yN(r,o.hits[0].id);try{return await D8(r,e),ie(`${o.hits.length>0?"Updated":"Inserted"} document ${e.id} in partition ${n}`),this.markUnsavedChanges(),e}catch(i){if(fe(`Failed to ${o.hits.length>0?"update":"insert"} document ${e.id}:`,i),o.hits.length>0)try{await D8(r,o.hits[0].document)}catch(a){fe("Failed to restore previous document version:",a)}return}}catch(n){fe(`Error upserting document ${e.id}:`,n);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await Xc(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return fe("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){ie("Embedding model change detected. Orama database not found. Initializing new database...");try{return await this.initializeDB(e),!0}catch(o){throw fe("Failed to initialize database:",o),new Rr("Failed to initialize Orama database. Please check your embedding model settings.")}}let r=await Xc(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=Xs.getModelName(e);if(!hVe(n,o))return new Ax.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),ie(`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 ie("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await Xc(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){ie("Orama database not found during garbage collection. Attempting to initialize...");try{let e=await Xs.getInstance().getEmbeddingsAPI();if(!e)throw new Rr("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new Rr("Failed to initialize database after attempt.")}catch(e){throw fe("Failed to initialize database during garbage collection:",e),new Rr("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:(ie("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(o.map(i=>i.path))).join(", ")),o.length===1?await yN(this.oramaDb,o[0].id):await L8(this.oramaDb,o.map(i=>i.id),500),await this.saveDB(),o.length)}catch(e){throw fe("Error garbage collecting the Copilot index:",e),new Rr("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new Rr("Orama database not found.");try{let e=await t.getAllDocuments(this.oramaDb),r=new Set;return e.forEach(n=>{r.add(n.path)}),Array.from(r).sort()}catch(e){throw fe("Error getting indexed files:",e),new Rr("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await Xc(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw fe("Error checking if database is empty:",e),new Rr("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 Rr("Orama database not found.");let r={};for(let n of e){let o=await t.getDocsByPath(this.oramaDb,n);o&&o.length>0&&(r[n]=o.map(i=>({id:i.document.id,title:i.document.title,path:i.document.path,content:i.document.content,metadata:i.document.metadata,embedding:i.document.embedding,embeddingModel:i.document.embeddingModel,tags:i.document.tags,extension:i.document.extension,nchars:i.document.nchars})))}return r}markFileMissingEmbeddings(e){this.filesWithoutEmbeddings.add(e)}clearFilesMissingEmbeddings(){this.filesWithoutEmbeddings.clear()}getFilesMissingEmbeddings(){return Array.from(this.filesWithoutEmbeddings)}isFileMissingEmbeddings(e){return this.filesWithoutEmbeddings.has(e)}async checkIndexIntegrity(){if(!this.oramaDb)throw new Rr("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?ie("Files missing embeddings after integrity check:",r.join(", ")):ie("Index integrity check completed. All documents have embeddings.")}catch(e){throw fe("Error checking index integrity:",e),new Rr("Failed to check index integrity.")}}}});var Sq,LGr,nie,n1t=w(()=>{Cl();Fd();nr();Sq=require("obsidian");_g();LGr=5e3,nie=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(Sq.Platform.isMobile&&ue().disableIndexOnMobile||Fh()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof Sq.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}=rf(),u=eu(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(()=>{ue().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},LGr)};this.handleFileDelete=async e=>{e instanceof Sq.TFile&&await this.dbOps.removeDocs(e.path)};this.initializeEventListeners()}initializeEventListeners(){ue().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 U8,o1t=w(()=>{U8=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 tP,i1t=w(()=>{tP=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 oie,a1t=w(()=>{Df();oie=class extends Cn{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 s1t=w(()=>{i1t();a1t()});var iie=w(()=>{s1t()});var u1t=w(()=>{aAe()});var HRe,aie,l1t=w(()=>{iie();u1t();HRe=class extends oie{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;lb){let O=this.numberOfNewLines(c,b,x);d-=O}s&&(h+=a)}let g=this.numberOfNewLines(m),y=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};y.lines={from:d,to:d+g};let S={...o[l],loc:y};h+=m,u.push(new tP({pageContent:h,metadata:S})),d+=g,f=m,p=b}}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}},aie=class t extends HRe{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{o1t()});var a1t=w(()=>{i1t()});var s1t=w(()=>{a1t()});var u1t=w(()=>{s1t()});var l1t,Ax,oie,c1t=w(()=>{$r();fN();yo();QRt();nr();Cn();l1t=F(vq());u1t();Ax=require("obsidian");_g();oie=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=ue();this.rateLimiter=new q8(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,xa(async()=>{let i=ue();this.rateLimiter=new q8(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 Ax.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 Ax.Notice("No valid content to index."),0;for(let s=0;sf.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;fc&&(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(()=>{ie("Copilot index final save completed."),this.dbOps.checkIndexIntegrity().catch(s=>{fe("Background integrity check failed:",s)})}).catch(s=>{fe("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=Xs.getModelName(r),o=nie.fromLanguage("markdown",{chunkSize:wVe}),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:Vl(new Date(a.stat.ctime)).display,modified:Vl(new Date(a.stat.mtime)).display}};(await o.createDocuments([s],[],{chunkHeader:` +`," ",""];throw new Error(`Language ${e} is not supported.`)}}});var c1t=w(()=>{l1t()});var d1t=w(()=>{c1t()});var f1t=w(()=>{d1t()});var p1t=w(()=>{f1t()});var m1t,Ix,sie,h1t=w(()=>{$r();pN();yo();o1t();nr();yn();m1t=F(wq());p1t();Ix=require("obsidian");_g();sie=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=ue();this.rateLimiter=new U8(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,xa(async()=>{let i=ue();this.rateLimiter=new U8(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 Ix.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 Ix.Notice("No valid content to index."),0;for(let s=0;sf.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;fc&&(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(()=>{ie("Copilot index final save completed."),this.dbOps.checkIndexIntegrity().catch(s=>{fe("Background integrity check failed:",s)})}).catch(s=>{fe("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=Xs.getModelName(r),o=aie.fromLanguage("markdown",{chunkSize:OVe}),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:Vl(new Date(a.stat.ctime)).display,modified:Vl(new Date(a.stat.mtime)).display}};(await o.createDocuments([s],[],{chunkHeader:` NOTE TITLE: [[${l.title}]] @@ -525,24 +525,24 @@ 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,l1t.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=rf(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>eu(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(!eu(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 ie([`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 Ax.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 Ax.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=ue(),o=bg(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...Zoe(this.app),...bg(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 Ax.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 Ax.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 Ax.Notice("Indexing cancelled");return}e.length>0?new Ax.Notice(`Indexing completed with ${e.length} errors. Check console for details.`):new Ax.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;asetTimeout(e,100)),this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide()}}});var d1t={};Cf(d1t,{default:()=>ma});var U8,ma,Ix=w(()=>{wT();fN();nr();U8=require("obsidian");Qoe();XRt();c1t();ma=class t{constructor(){this.embeddingsManager=Xs.getInstance(),this.dbOps=new eP(app),this.indexOps=new oie(app,this.dbOps,this.embeddingsManager),this.eventHandler=new eie(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={...ue()};let e=async()=>{let r=ue(),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())}};xa(()=>{this.initializationPromise=e()})}async initialize(){try{let e=3;for(;e>0;)try{await this.dbOps.initializeDB(await this.embeddingsManager.getEmbeddingsAPI());break}catch(r){if(r instanceof Rr&&r.message.includes("Vault adapter not available")&&(e--,e>0)){await new Promise(n=>setTimeout(n,100));continue}new U8.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(),U8.Platform.isMobile&&ue().disableIndexOnMobile?(new U8.Notice("Indexing is disabled on mobile devices"),0):this.indexOps.indexVaultToVectorStore(e)}async clearIndex(){await this.waitForInitialization(),await this.dbOps.clearIndex(await this.embeddingsManager.getEmbeddingsAPI())}async garbageCollectVectorStore(){return await this.waitForInitialization(),this.dbOps.garbageCollect()}async getIndexedFiles(){return await this.waitForInitialization(),this.dbOps.getIndexedFiles()}async isIndexEmpty(){return await this.waitForInitialization(),this.dbOps.isIndexEmpty()}async hasIndex(e){return await this.waitForInitialization(),this.dbOps.hasIndex(e)}onunload(){this.eventHandler.cleanup(),this.dbOps.onunload()}async getDbOps(){return await this.waitForInitialization(),this.dbOps}async getDb(){await this.waitForInitialization();let e=this.dbOps.getDb();if(!e)throw new Error("Database is not loaded. Please restart the plugin.");return e}async reindexFile(e){await this.waitForInitialization(),await this.indexOps.reindexFile(e)}}});function Hbe(t){return t.split("|")[1]==="copilot-plus"}function Sq(){return Rn().isPlusUser}async function iie(){return ue().plusLicenseKey?(await Fi.getInstance().validateLicenseKey()).isValid:(KRe(),!1)}function p1t(){let t=RGr,e=VRe,r=ue().embeddingModelKey;ie("applyPlusSettings: Changing embedding model",{from:r,to:e,changed:r!==e}),YVe(t),qR("copilot_plus"),zE({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e?(ie("applyPlusSettings: Embedding model changed, triggering indexing"),Promise.resolve().then(()=>(Ix(),d1t)).then(n=>{n.default.getInstance().indexVaultToVectorStore()}).catch(n=>{fe("Failed to trigger indexing after Plus settings applied:",n),new f1t.Notice("Failed to update Copilot index. Please try force reindexing from the command palette.")})):ie("applyPlusSettings: No embedding model change, skipping indexing")}function WRe(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function p1(t){window.open(WRe(t),"_blank")}function m1t(){dt("isPlusUser",!0)}function KRe(){let t=ue().isPlusUser;dt("isPlusUser",!1),t&&new q7(app).open()}var f1t,zRe,RGr,HRe,VRe,_zo,vzo,nO=w(()=>{Cl();Fd();cKe();$r();mg();yo();nr();f1t=require("obsidian"),zRe="copilot-plus-flash",RGr=zRe+"|"+"copilot-plus",HRe="copilot-plus-small",VRe=HRe+"|"+"copilot-plus",_zo=Ic.defaultModelKey,vzo=Ic.embeddingModelKey});var h1t,g1t,Fi,mg=w(()=>{$r();BR();yo();nO();nr();h1t=F(Pp()),g1t=require("obsidian"),Fi=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!ue().plusLicenseKey)throw new g1t.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=ue().userId;let a=new URL(`${VE}${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 eo(ue().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 ie(`==== ${e} request ====:`,u),{data:u}}async makeFormDataRequest(e,r,n=!1){n||this.checkLicenseKey(),r.append("user_id",ue().userId);let o=new URL(`${VE}${e}`);try{let i=await fetch(o.toString(),{method:"POST",headers:{Authorization:`Bearer ${await eo(ue().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 ie(`==== ${e} FormData request ====:`,a),{data:a}}catch(i){return{data:null,error:i instanceof Error?i:new Error(String(i))}}}async validateLicenseKey(){let{data:e,error:r}=await this.makeRequest("/license",{license_key:await eo(ue().plusLicenseKey)},"POST",!0,!0);return r?r.message==="Invalid license key"?(KRe(),{isValid:!1}):{isValid:void 0}:(m1t(),{isValid:!0,plan:e?.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=h1t.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 YRe=v((Izo,v1t)=>{var jGr="Expected a function",b1t=NaN,NGr="[object Symbol]",DGr=/^\s+|\s+$/g,LGr=/^[-+]0x[0-9a-f]+$/i,FGr=/^0b[01]+$/i,kGr=/^0o[0-7]+$/i,$Gr=parseInt,BGr=typeof window=="object"&&window&&window.Object===Object&&window,qGr=typeof self=="object"&&self&&self.Object===Object&&self,UGr=BGr||qGr||Function("return this")(),zGr=Object.prototype,HGr=zGr.toString,VGr=Math.max,WGr=Math.min,GRe=function(){return UGr.Date.now()};function KGr(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(jGr);e=_1t(e)||0,JRe(r)&&(c=!!r.leading,d="maxWait"in r,i=d?VGr(_1t(r.maxWait)||0,e):i,f="trailing"in r?!!r.trailing:f);function p(P){var E=n,A=o;return n=o=void 0,l=P,a=t.apply(A,E),a}function m(P){return l=P,s=setTimeout(g,e),c?p(P):a}function h(P){var E=P-u,A=P-l,I=e-E;return d?WGr(I,i-A):I}function b(P){var E=P-u,A=P-l;return u===void 0||E>=e||E<0||d&&A>=i}function g(){var P=GRe();if(b(P))return y(P);s=setTimeout(g,h(P))}function y(P){return s=void 0,f&&n?p(P):(n=o=void 0,a)}function S(){s!==void 0&&clearTimeout(s),l=0,n=u=o=s=void 0}function x(){return s===void 0?a:y(GRe())}function O(){var P=GRe(),E=b(P);if(n=arguments,o=this,u=P,E){if(s===void 0)return m(u);if(d)return s=setTimeout(g,e),p(u)}return s===void 0&&(s=setTimeout(g,e)),a}return O.cancel=S,O.flush=x,O}function JRe(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function GGr(t){return!!t&&typeof t=="object"}function JGr(t){return typeof t=="symbol"||GGr(t)&&HGr.call(t)==NGr}function _1t(t){if(typeof t=="number")return t;if(JGr(t))return b1t;if(JRe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=JRe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(DGr,"");var r=FGr.test(t);return r||kGr.test(t)?$Gr(t.slice(2),r?2:8):LGr.test(t)?b1t:+t}v1t.exports=KGr});var R1t=v((n1e,o1e)=>{(function(t,e){typeof n1e=="object"&&typeof o1e<"u"?o1e.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(n1e,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 iI=v((i1e,a1e)=>{(function(t,e){typeof i1e=="object"&&typeof a1e<"u"?a1e.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(i1e,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",l="month",c="quarter",d="year",f="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={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(j){var $=["th","st","nd","rd"],k=j%100;return"["+j+($[(k-20)%10]||$[k]||$[0])+"]"}},g=function(j,$,k){var z=String(j);return!z||z.length>=$?j:""+Array($+1-z.length).join(k)+j},y={s:g,z:function(j){var $=-j.utcOffset(),k=Math.abs($),z=Math.floor(k/60),V=k%60;return($<=0?"+":"-")+g(z,2,"0")+":"+g(V,2,"0")},m:function j($,k){if($.date()1)return j(J[0])}else{var D=$.name;x[D]=$,V=D}return!z&&V&&(S=V),V||!z&&S},A=function(j,$){if(P(j))return j.clone();var k=typeof $=="object"?$:{};return k.date=j,k.args=arguments,new R(k)},I=y;I.l=E,I.i=P,I.w=function(j,$){return A(j,{locale:$.$L,utc:$.$u,x:$.$x,$offset:$.$offset})};var R=function(){function j(k){this.$L=E(k.locale,null,!0),this.parse(k),this.$x=this.$x||k.x||{},this[O]=!0}var $=j.prototype;return $.parse=function(k){this.$d=function(z){var V=z.date,Q=z.utc;if(V===null)return new Date(NaN);if(I.u(V))return new Date;if(V instanceof Date)return new Date(V);if(typeof V=="string"&&!/Z$/i.test(V)){var J=V.match(m);if(J){var D=J[2]-1||0,B=(J[7]||"0").substring(0,3);return Q?new Date(Date.UTC(J[1],D,J[3]||1,J[4]||0,J[5]||0,J[6]||0,B)):new Date(J[1],D,J[3]||1,J[4]||0,J[5]||0,J[6]||0,B)}}return new Date(V)}(k),this.init()},$.init=function(){var k=this.$d;this.$y=k.getFullYear(),this.$M=k.getMonth(),this.$D=k.getDate(),this.$W=k.getDay(),this.$H=k.getHours(),this.$m=k.getMinutes(),this.$s=k.getSeconds(),this.$ms=k.getMilliseconds()},$.$utils=function(){return I},$.isValid=function(){return this.$d.toString()!==p},$.isSame=function(k,z){var V=A(k);return this.startOf(z)<=V&&V<=this.endOf(z)},$.isAfter=function(k,z){return A(k){"use strict";Object.defineProperty(Zje,"__esModule",{value:!0});Zje.pathToFunc=TXr;var EXr=Object.prototype.hasOwnProperty;function TXr(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!EXr.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 Dae=v(Ag=>{"use strict";Object.defineProperty(Ag,"__esModule",{value:!0});Ag.SDK_METADATA=Ag.ServerList=Ag.ServerEu=void 0;Ag.serverURLFromOptions=IXr;var AXr=To();Ag.ServerEu="eu";Ag.ServerList={[Ag.ServerEu]:"https://api.mistral.ai"};function IXr(t){let e=t.serverURL,r={};if(!e){let o=t.server??Ag.ServerEu;e=Ag.ServerList[o]||""}let n=(0,AXr.pathToFunc)(e)(r);return new URL(n)}Ag.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 Qje=v(Xje=>{"use strict";Object.defineProperty(Xje,"__esModule",{value:!0});Xje.readableStreamToArrayBuffer=MXr;async function MXr(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 HDt=v(Lae=>{"use strict";Object.defineProperty(Lae,"__esModule",{value:!0});Lae.CustomUserAgentHook=void 0;var RXr=Dae(),eNe=class{beforeRequest(e,r){let o=`mistral-client-typescript/${RXr.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};Lae.CustomUserAgentHook=eNe});var WDt=v(Fae=>{"use strict";Object.defineProperty(Fae,"__esModule",{value:!0});Fae.DeprecationWarningHook=void 0;var VDt="x-model-deprecation-timestamp",tNe=class{afterSuccess(e,r){return r.headers.has(VDt)&&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(VDt)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};Fae.DeprecationWarningHook=tNe});var KDt=v(rNe=>{"use strict";Object.defineProperty(rNe,"__esModule",{value:!0});rNe.initHooks=DXr;var jXr=HDt(),NXr=WDt();function DXr(t){let e=new jXr.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new NXr.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var GDt=v(kae=>{"use strict";Object.defineProperty(kae,"__esModule",{value:!0});kae.SDKHooks=void 0;var LXr=KDt(),nNe=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,LXr.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}}};kae.SDKHooks=nNe});var lNe=v(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});Zp.ConnectionError=Zp.RequestTimeoutError=Zp.RequestAbortedError=Zp.InvalidRequestError=Zp.UnexpectedClientError=Zp.HTTPClientError=void 0;var RI=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)}};Zp.HTTPClientError=RI;var oNe=class extends RI{constructor(){super(...arguments),this.name="UnexpectedClientError"}};Zp.UnexpectedClientError=oNe;var iNe=class extends RI{constructor(){super(...arguments),this.name="InvalidRequestError"}};Zp.InvalidRequestError=iNe;var aNe=class extends RI{constructor(){super(...arguments),this.name="RequestAbortedError"}};Zp.RequestAbortedError=aNe;var sNe=class extends RI{constructor(){super(...arguments),this.name="RequestTimeoutError"}};Zp.RequestTimeoutError=sNe;var uNe=class extends RI{constructor(){super(...arguments),this.name="ConnectionError"}};Zp.ConnectionError=uNe});var Ig=v(gU=>{"use strict";Object.defineProperty(gU,"__esModule",{value:!0});gU.OK=FXr;gU.ERR=kXr;gU.unwrap=$Xr;gU.unwrapAsync=BXr;function FXr(t){return{ok:!0,value:t}}function kXr(t){return{ok:!1,error:t}}function $Xr(t){if(!t.ok)throw t.error;return t.value}async function BXr(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var P5=v(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.getParsedType=Ki.ZodParsedType=Ki.objectUtil=Ki.util=void 0;var cNe;(function(t){t.assertEqual=o=>o;function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(cNe||(Ki.util=cNe={}));var JDt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(JDt||(Ki.objectUtil=JDt={}));Ki.ZodParsedType=cNe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var qXr=t=>{switch(typeof t){case"undefined":return Ki.ZodParsedType.undefined;case"string":return Ki.ZodParsedType.string;case"number":return isNaN(t)?Ki.ZodParsedType.nan:Ki.ZodParsedType.number;case"boolean":return Ki.ZodParsedType.boolean;case"function":return Ki.ZodParsedType.function;case"bigint":return Ki.ZodParsedType.bigint;case"symbol":return Ki.ZodParsedType.symbol;case"object":return Array.isArray(t)?Ki.ZodParsedType.array:t===null?Ki.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ki.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?Ki.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?Ki.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?Ki.ZodParsedType.date:Ki.ZodParsedType.object;default:return Ki.ZodParsedType.unknown}};Ki.getParsedType=qXr});var $ae=v(jI=>{"use strict";Object.defineProperty(jI,"__esModule",{value:!0});jI.ZodError=jI.quotelessJson=jI.ZodIssueCode=void 0;var YDt=P5();jI.ZodIssueCode=YDt.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 UXr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");jI.quotelessJson=UXr;var E5=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(;ur.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};jI.ZodError=E5;E5.create=t=>new E5(t)});var fNe=v(dNe=>{"use strict";Object.defineProperty(dNe,"__esModule",{value:!0});var KN=P5(),sf=$ae(),zXr=(t,e)=>{let r;switch(t.code){case sf.ZodIssueCode.invalid_type:t.received===KN.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case sf.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,KN.util.jsonStringifyReplacer)}`;break;case sf.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${KN.util.joinValues(t.keys,", ")}`;break;case sf.ZodIssueCode.invalid_union:r="Invalid input";break;case sf.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${KN.util.joinValues(t.options)}`;break;case sf.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${KN.util.joinValues(t.options)}, received '${t.received}'`;break;case sf.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case sf.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case sf.ZodIssueCode.invalid_date:r="Invalid date";break;case sf.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}"`:KN.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case sf.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case sf.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 sf.ZodIssueCode.custom:r="Invalid input";break;case sf.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case sf.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case sf.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,KN.util.assertNever(t)}return{message:r}};dNe.default=zXr});var Bae=v(Lx=>{"use strict";var HXr=Lx&&Lx.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Lx,"__esModule",{value:!0});Lx.getErrorMap=Lx.setErrorMap=Lx.defaultErrorMap=void 0;var ZDt=HXr(fNe());Lx.defaultErrorMap=ZDt.default;var XDt=ZDt.default;function VXr(t){XDt=t}Lx.setErrorMap=VXr;function WXr(){return XDt}Lx.getErrorMap=WXr});var mNe=v(hi=>{"use strict";var KXr=hi&&hi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hi,"__esModule",{value:!0});hi.isAsync=hi.isValid=hi.isDirty=hi.isAborted=hi.OK=hi.DIRTY=hi.INVALID=hi.ParseStatus=hi.addIssueToContext=hi.EMPTY_PATH=hi.makeIssue=void 0;var GXr=Bae(),QDt=KXr(fNe()),JXr=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}};hi.makeIssue=JXr;hi.EMPTY_PATH=[];function YXr(t,e){let r=(0,GXr.getErrorMap)(),n=(0,hi.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===QDt.default?void 0:QDt.default].filter(o=>!!o)});t.common.issues.push(n)}hi.addIssueToContext=YXr;var pNe=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 hi.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 hi.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}}};hi.ParseStatus=pNe;hi.INVALID=Object.freeze({status:"aborted"});var ZXr=t=>({status:"dirty",value:t});hi.DIRTY=ZXr;var XXr=t=>({status:"valid",value:t});hi.OK=XXr;var QXr=t=>t.status==="aborted";hi.isAborted=QXr;var eQr=t=>t.status==="dirty";hi.isDirty=eQr;var tQr=t=>t.status==="valid";hi.isValid=tQr;var rQr=t=>typeof Promise<"u"&&t instanceof Promise;hi.isAsync=rQr});var tLt=v(eLt=>{"use strict";Object.defineProperty(eLt,"__esModule",{value:!0})});var nLt=v(qae=>{"use strict";Object.defineProperty(qae,"__esModule",{value:!0});qae.errorUtil=void 0;var rLt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(rLt||(qae.errorUtil=rLt={}))});var gLt=v(re=>{"use strict";var zae=re&&re.__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)},aLt=re&&re.__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},T5,A5;Object.defineProperty(re,"__esModule",{value:!0});re.boolean=re.bigint=re.array=re.any=re.coerce=re.ZodFirstPartyTypeKind=re.late=re.ZodSchema=re.Schema=re.custom=re.ZodReadonly=re.ZodPipeline=re.ZodBranded=re.BRAND=re.ZodNaN=re.ZodCatch=re.ZodDefault=re.ZodNullable=re.ZodOptional=re.ZodTransformer=re.ZodEffects=re.ZodPromise=re.ZodNativeEnum=re.ZodEnum=re.ZodLiteral=re.ZodLazy=re.ZodFunction=re.ZodSet=re.ZodMap=re.ZodRecord=re.ZodTuple=re.ZodIntersection=re.ZodDiscriminatedUnion=re.ZodUnion=re.ZodObject=re.ZodArray=re.ZodVoid=re.ZodNever=re.ZodUnknown=re.ZodAny=re.ZodNull=re.ZodUndefined=re.ZodSymbol=re.ZodDate=re.ZodBoolean=re.ZodBigInt=re.ZodNumber=re.ZodString=re.datetimeRegex=re.ZodType=void 0;re.NEVER=re.void=re.unknown=re.union=re.undefined=re.tuple=re.transformer=re.symbol=re.string=re.strictObject=re.set=re.record=re.promise=re.preprocess=re.pipeline=re.ostring=re.optional=re.onumber=re.oboolean=re.object=re.number=re.nullable=re.null=re.never=re.nativeEnum=re.nan=re.map=re.literal=re.lazy=re.intersection=re.instanceof=re.function=re.enum=re.effect=re.discriminatedUnion=re.date=void 0;var Uae=Bae(),Ut=nLt(),ne=mNe(),nt=P5(),We=$ae(),Rg=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},oLt=(t,e)=>{if((0,ne.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 We.ZodError(t.common.issues);return this._error=r,this._error}}};function Zr(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{var u,l;let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(u=c??n)!==null&&u!==void 0?u:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(l=c??r)!==null&&l!==void 0?l:s.defaultError}},description:o}}var Xr=class{get description(){return this._def.description}_getType(e){return(0,nt.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,nt.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ne.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,nt.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,ne.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let o={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,nt.getParsedType)(e)},i=this._parseSync({data:e,path:o.path,parent:o});return oLt(o,i)}"~validate"(e){var r,n;let o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,nt.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:o});return(0,ne.isValid)(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((n=(r=i?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then(i=>(0,ne.isValid)(i)?{value:i.value}:{issues:o.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,nt.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,ne.isAsync)(o)?o:Promise.resolve(o));return oLt(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:We.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 oh({schema:this,typeName:gr.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 Mg.create(this,this._def)}nullable(){return kx.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hP.create(this)}promise(){return LI.create(this,this._def)}or(e){return eD.create([this,e],this._def)}and(e){return tD.create(this,e,this._def)}transform(e){return new oh({...Zr(this._def),schema:this,typeName:gr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new aD({...Zr(this._def),innerType:this,defaultValue:r,typeName:gr.ZodDefault})}brand(){return new I5({typeName:gr.ZodBranded,type:this,...Zr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new sD({...Zr(this._def),innerType:this,catchValue:r,typeName:gr.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return M5.create(this,e)}readonly(){return uD.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};re.ZodType=Xr;re.Schema=Xr;re.ZodSchema=Xr;var nQr=/^c[^\s-]{8,}$/i,oQr=/^[0-9a-z]+$/,iQr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,aQr=/^[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,sQr=/^[a-z0-9_-]{21}$/i,uQr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lQr=/^[-+]?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)?)??$/,cQr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dQr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",hNe,fQr=/^(?:(?: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])$/,pQr=/^(?:(?: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])$/,mQr=/^(([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]))$/,hQr=/^(([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])$/,gQr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yQr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,sLt="((\\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])))",bQr=new RegExp(`^${sLt}$`);function uLt(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function _Qr(t){return new RegExp(`^${uLt(t)}$`)}function lLt(t){let e=`${sLt}T${uLt(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}re.datetimeRegex=lLt;function vQr(t,e){return!!((e==="v4"||!e)&&fQr.test(t)||(e==="v6"||!e)&&mQr.test(t))}function wQr(t,e){if(!uQr.test(t))return!1;try{let[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||!o.typ||!o.alg||e&&o.alg!==e)}catch{return!1}}function SQr(t,e){return!!((e==="v4"||!e)&&pQr.test(t)||(e==="v6"||!e)&&hQr.test(t))}var NI=class t extends Xr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==nt.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(i,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.string,received:i.parsedType}),ne.INVALID}let n=new ne.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{code:We.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.lengthe.test(o),{validation:r,code:We.ZodIssueCode.invalid_string,...Ut.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ut.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ut.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ut.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ut.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ut.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ut.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ut.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ut.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ut.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ut.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ut.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ut.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ut.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...Ut.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,...Ut.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ut.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Ut.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Ut.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Ut.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Ut.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Ut.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Ut.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Ut.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,Ut.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{var e;return new NI({checks:[],typeName:gr.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Zr(t)})};function xQr(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=parseInt(t.toFixed(o).replace(".","")),a=parseInt(e.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}var GN=class t extends Xr{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)!==nt.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(i,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.number,received:i.parsedType}),ne.INVALID}let n,o=new ne.ParseStatus;for(let i of this._def.checks)i.kind==="int"?nt.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?xQr(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,ne.addIssueToContext)(n,{code:We.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,ne.addIssueToContext)(n,{code:We.ZodIssueCode.not_finite,message:i.message}),o.dirty()):nt.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Ut.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ut.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ut.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ut.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Ut.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ut.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ut.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ut.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ut.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ut.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ut.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Ut.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ut.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ut.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.valuee.kind==="int"||e.kind==="multipleOf"&&nt.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.valuenew GN({checks:[],typeName:gr.ZodNumber,coerce:t?.coerce||!1,...Zr(t)});var JN=class t extends Xr{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)!==nt.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new ne.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,ne.addIssueToContext)(n,{code:We.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,ne.addIssueToContext)(n,{code:We.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):nt.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.bigint,received:r.parsedType}),ne.INVALID}gte(e,r){return this.setLimit("min",e,!0,Ut.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ut.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ut.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ut.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Ut.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:Ut.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ut.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ut.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ut.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ut.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{var e;return new JN({checks:[],typeName:gr.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Zr(t)})};var YN=class extends Xr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==nt.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.boolean,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodBoolean=YN;YN.create=t=>new YN({typeName:gr.ZodBoolean,coerce:t?.coerce||!1,...Zr(t)});var ZN=class t extends Xr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==nt.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(i,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.date,received:i.parsedType}),ne.INVALID}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(i,{code:We.ZodIssueCode.invalid_date}),ne.INVALID}let n=new ne.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{code:We.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):nt.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:Ut.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Ut.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.valuenew ZN({checks:[],coerce:t?.coerce||!1,typeName:gr.ZodDate,...Zr(t)});var bU=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.symbol,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodSymbol=bU;bU.create=t=>new bU({typeName:gr.ZodSymbol,...Zr(t)});var XN=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.undefined,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodUndefined=XN;XN.create=t=>new XN({typeName:gr.ZodUndefined,...Zr(t)});var QN=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.null,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodNull=QN;QN.create=t=>new QN({typeName:gr.ZodNull,...Zr(t)});var DI=class extends Xr{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,ne.OK)(e.data)}};re.ZodAny=DI;DI.create=t=>new DI({typeName:gr.ZodAny,...Zr(t)});var mP=class extends Xr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,ne.OK)(e.data)}};re.ZodUnknown=mP;mP.create=t=>new mP({typeName:gr.ZodUnknown,...Zr(t)});var lb=class extends Xr{_parse(e){let r=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.never,received:r.parsedType}),ne.INVALID}};re.ZodNever=lb;lb.create=t=>new lb({typeName:gr.ZodNever,...Zr(t)});var _U=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.void,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodVoid=_U;_U.create=t=>new _U({typeName:gr.ZodVoid,...Zr(t)});var hP=class t extends Xr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==nt.ZodParsedType.array)return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.array,received:r.parsedType}),ne.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.lengtho.maxLength.value&&((0,ne.addIssueToContext)(r,{code:We.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 Rg(r,a,r.path,s)))).then(a=>ne.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Rg(r,a,r.path,s)));return ne.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Ut.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Ut.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Ut.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};re.ZodArray=hP;hP.create=(t,e)=>new hP({type:t,minLength:null,maxLength:null,exactLength:null,typeName:gr.ZodArray,...Zr(e)});function yU(t){if(t instanceof Xp){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Mg.create(yU(n))}return new Xp({...t._def,shape:()=>e})}else return t instanceof hP?new hP({...t._def,type:yU(t.element)}):t instanceof Mg?Mg.create(yU(t.unwrap())):t instanceof kx?kx.create(yU(t.unwrap())):t instanceof Fx?Fx.create(t.items.map(e=>yU(e))):t}var Xp=class t extends Xr{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=nt.util.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==nt.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(l,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.object,received:l.parsedType}),ne.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof lb&&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 Rg(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof lb){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,ne.addIssueToContext)(o,{code:We.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 Rg(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=>ne.ParseStatus.mergeObjectSync(n,l)):ne.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Ut.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i,a,s;let u=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=Ut.errorUtil.errToObj(e).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:gr.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return nt.util.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return nt.util.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return yU(this)}partial(e){let r={};return nt.util.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return nt.util.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Mg;)i=i._def.innerType;r[n]=i}}),new t({...this._def,shape:()=>r})}keyof(){return cLt(nt.util.objectKeys(this.shape))}};re.ZodObject=Xp;Xp.create=(t,e)=>new Xp({shape:()=>t,unknownKeys:"strip",catchall:lb.create(),typeName:gr.ZodObject,...Zr(e)});Xp.strictCreate=(t,e)=>new Xp({shape:()=>t,unknownKeys:"strict",catchall:lb.create(),typeName:gr.ZodObject,...Zr(e)});Xp.lazycreate=(t,e)=>new Xp({shape:t,unknownKeys:"strip",catchall:lb.create(),typeName:gr.ZodObject,...Zr(e)});var eD=class extends Xr{_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 We.ZodError(s.ctx.common.issues));return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_union,unionErrors:a}),ne.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 We.ZodError(u));return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_union,unionErrors:s}),ne.INVALID}}get options(){return this._def.options}};re.ZodUnion=eD;eD.create=(t,e)=>new eD({options:t,typeName:gr.ZodUnion,...Zr(e)});var pP=t=>t instanceof rD?pP(t.schema):t instanceof oh?pP(t.innerType()):t instanceof nD?[t.value]:t instanceof oD?t.options:t instanceof iD?nt.util.objectValues(t.enum):t instanceof aD?pP(t._def.innerType):t instanceof XN?[void 0]:t instanceof QN?[null]:t instanceof Mg?[void 0,...pP(t.unwrap())]:t instanceof kx?[null,...pP(t.unwrap())]:t instanceof I5||t instanceof uD?pP(t.unwrap()):t instanceof sD?pP(t._def.innerType):[],Hae=class t extends Xr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==nt.ZodParsedType.object)return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.object,received:r.parsedType}),ne.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,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ne.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=pP(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:gr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Zr(n)})}};re.ZodDiscriminatedUnion=Hae;function gNe(t,e){let r=(0,nt.getParsedType)(t),n=(0,nt.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===nt.ZodParsedType.object&&n===nt.ZodParsedType.object){let o=nt.util.objectKeys(e),i=nt.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=gNe(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===nt.ZodParsedType.array&&n===nt.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{if((0,ne.isAborted)(i)||(0,ne.isAborted)(a))return ne.INVALID;let s=gNe(i.value,a.value);return s.valid?(((0,ne.isDirty)(i)||(0,ne.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_intersection_types}),ne.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}))}};re.ZodIntersection=tD;tD.create=(t,e,r)=>new tD({left:t,right:e,typeName:gr.ZodIntersection,...Zr(r)});var Fx=class t extends Xr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==nt.ZodParsedType.array)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.array,received:n.parsedType}),ne.INVALID;if(n.data.lengththis._def.items.length&&((0,ne.addIssueToContext)(n,{code:We.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 Rg(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>ne.ParseStatus.mergeArray(r,a)):ne.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};re.ZodTuple=Fx;Fx.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fx({items:t,typeName:gr.ZodTuple,rest:null,...Zr(e)})};var Vae=class t extends Xr{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!==nt.ZodParsedType.object)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.object,received:n.parsedType}),ne.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Rg(n,s,n.path,s)),value:a._parse(new Rg(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?ne.ParseStatus.mergeObjectAsync(r,o):ne.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Xr?new t({keyType:e,valueType:r,typeName:gr.ZodRecord,...Zr(n)}):new t({keyType:NI.create(),valueType:e,typeName:gr.ZodRecord,...Zr(r)})}};re.ZodRecord=Vae;var vU=class extends Xr{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!==nt.ZodParsedType.map)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.map,received:n.parsedType}),ne.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Rg(n,s,n.path,[l,"key"])),value:i._parse(new Rg(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 ne.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 ne.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};re.ZodMap=vU;vU.create=(t,e,r)=>new vU({valueType:e,keyType:t,typeName:gr.ZodMap,...Zr(r)});var wU=class t extends Xr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==nt.ZodParsedType.set)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.set,received:n.parsedType}),ne.INVALID;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&((0,ne.addIssueToContext)(n,{code:We.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 ne.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 Rg(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:Ut.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Ut.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};re.ZodSet=wU;wU.create=(t,e)=>new wU({valueType:t,minSize:null,maxSize:null,typeName:gr.ZodSet,...Zr(e)});var Wae=class t extends Xr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==nt.ZodParsedType.function)return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.function,received:r.parsedType}),ne.INVALID;function n(s,u){return(0,ne.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Uae.getErrorMap)(),Uae.defaultErrorMap].filter(l=>!!l),issueData:{code:We.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,ne.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Uae.getErrorMap)(),Uae.defaultErrorMap].filter(l=>!!l),issueData:{code:We.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof LI){let s=this;return(0,ne.OK)(async function(...u){let l=new We.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,ne.OK)(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new We.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 We.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:Fx.create(e).rest(mP.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||Fx.create([]).rest(mP.create()),returns:r||mP.create(),typeName:gr.ZodFunction,...Zr(n)})}};re.ZodFunction=Wae;var rD=class extends Xr{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})}};re.ZodLazy=rD;rD.create=(t,e)=>new rD({getter:t,typeName:gr.ZodLazy,...Zr(e)});var nD=class extends Xr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(r,{received:r.data,code:We.ZodIssueCode.invalid_literal,expected:this._def.value}),ne.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};re.ZodLiteral=nD;nD.create=(t,e)=>new nD({value:t,typeName:gr.ZodLiteral,...Zr(e)});function cLt(t,e){return new oD({values:t,typeName:gr.ZodEnum,...Zr(e)})}var oD=class t extends Xr{constructor(){super(...arguments),T5.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ne.addIssueToContext)(r,{expected:nt.util.joinValues(n),received:r.parsedType,code:We.ZodIssueCode.invalid_type}),ne.INVALID}if(zae(this,T5,"f")||aLt(this,T5,new Set(this._def.values),"f"),!zae(this,T5,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ne.addIssueToContext)(r,{received:r.data,code:We.ZodIssueCode.invalid_enum_value,options:n}),ne.INVALID}return(0,ne.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})}};re.ZodEnum=oD;T5=new WeakMap;oD.create=cLt;var iD=class extends Xr{constructor(){super(...arguments),A5.set(this,void 0)}_parse(e){let r=nt.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==nt.ZodParsedType.string&&n.parsedType!==nt.ZodParsedType.number){let o=nt.util.objectValues(r);return(0,ne.addIssueToContext)(n,{expected:nt.util.joinValues(o),received:n.parsedType,code:We.ZodIssueCode.invalid_type}),ne.INVALID}if(zae(this,A5,"f")||aLt(this,A5,new Set(nt.util.getValidEnumValues(this._def.values)),"f"),!zae(this,A5,"f").has(e.data)){let o=nt.util.objectValues(r);return(0,ne.addIssueToContext)(n,{received:n.data,code:We.ZodIssueCode.invalid_enum_value,options:o}),ne.INVALID}return(0,ne.OK)(e.data)}get enum(){return this._def.values}};re.ZodNativeEnum=iD;A5=new WeakMap;iD.create=(t,e)=>new iD({values:t,typeName:gr.ZodNativeEnum,...Zr(e)});var LI=class extends Xr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==nt.ZodParsedType.promise&&r.common.async===!1)return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.promise,received:r.parsedType}),ne.INVALID;let n=r.parsedType===nt.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,ne.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};re.ZodPromise=LI;LI.create=(t,e)=>new LI({type:t,typeName:gr.ZodPromise,...Zr(e)});var oh=class extends Xr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===gr.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,ne.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 ne.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?ne.INVALID:u.status==="dirty"||r.value==="dirty"?(0,ne.DIRTY)(u.value):u});{if(r.value==="aborted")return ne.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?ne.INVALID:s.status==="dirty"||r.value==="dirty"?(0,ne.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"?ne.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"?ne.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,ne.isValid)(a))return a;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,ne.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);nt.util.assertNever(o)}};re.ZodEffects=oh;re.ZodTransformer=oh;oh.create=(t,e,r)=>new oh({schema:t,typeName:gr.ZodEffects,effect:e,...Zr(r)});oh.createWithPreprocess=(t,e,r)=>new oh({schema:e,effect:{type:"preprocess",transform:t},typeName:gr.ZodEffects,...Zr(r)});var Mg=class extends Xr{_parse(e){return this._getType(e)===nt.ZodParsedType.undefined?(0,ne.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};re.ZodOptional=Mg;Mg.create=(t,e)=>new Mg({innerType:t,typeName:gr.ZodOptional,...Zr(e)});var kx=class extends Xr{_parse(e){return this._getType(e)===nt.ZodParsedType.null?(0,ne.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};re.ZodNullable=kx;kx.create=(t,e)=>new kx({innerType:t,typeName:gr.ZodNullable,...Zr(e)});var aD=class extends Xr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===nt.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};re.ZodDefault=aD;aD.create=(t,e)=>new aD({innerType:t,typeName:gr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Zr(e)});var sD=class extends Xr{_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,ne.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new We.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new We.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};re.ZodCatch=sD;sD.create=(t,e)=>new sD({innerType:t,typeName:gr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Zr(e)});var SU=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.nan,received:n.parsedType}),ne.INVALID}return{status:"valid",value:e.data}}};re.ZodNaN=SU;SU.create=t=>new SU({typeName:gr.ZodNaN,...Zr(t)});re.BRAND=Symbol("zod_brand");var I5=class extends Xr{_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}};re.ZodBranded=I5;var M5=class t extends Xr{_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"?ne.INVALID:i.status==="dirty"?(r.dirty(),(0,ne.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"?ne.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:gr.ZodPipeline})}};re.ZodPipeline=M5;var uD=class extends Xr{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,ne.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,ne.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};re.ZodReadonly=uD;uD.create=(t,e)=>new uD({innerType:t,typeName:gr.ZodReadonly,...Zr(e)});function iLt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function dLt(t,e={},r){return t?DI.create().superRefine((n,o)=>{var i,a;let s=t(n);if(s instanceof Promise)return s.then(u=>{var l,c;if(!u){let d=iLt(e,n),f=(c=(l=d.fatal)!==null&&l!==void 0?l:r)!==null&&c!==void 0?c:!0;o.addIssue({code:"custom",...d,fatal:f})}});if(!s){let u=iLt(e,n),l=(a=(i=u.fatal)!==null&&i!==void 0?i:r)!==null&&a!==void 0?a:!0;o.addIssue({code:"custom",...u,fatal:l})}}):DI.create()}re.custom=dLt;re.late={object:Xp.lazycreate};var gr;(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"})(gr||(re.ZodFirstPartyTypeKind=gr={}));var CQr=(t,e={message:`Input not instance of ${t.name}`})=>dLt(r=>r instanceof t,e);re.instanceof=CQr;var fLt=NI.create;re.string=fLt;var pLt=GN.create;re.number=pLt;var OQr=SU.create;re.nan=OQr;var PQr=JN.create;re.bigint=PQr;var mLt=YN.create;re.boolean=mLt;var EQr=ZN.create;re.date=EQr;var TQr=bU.create;re.symbol=TQr;var AQr=XN.create;re.undefined=AQr;var IQr=QN.create;re.null=IQr;var MQr=DI.create;re.any=MQr;var RQr=mP.create;re.unknown=RQr;var jQr=lb.create;re.never=jQr;var NQr=_U.create;re.void=NQr;var DQr=hP.create;re.array=DQr;var LQr=Xp.create;re.object=LQr;var FQr=Xp.strictCreate;re.strictObject=FQr;var kQr=eD.create;re.union=kQr;var $Qr=Hae.create;re.discriminatedUnion=$Qr;var BQr=tD.create;re.intersection=BQr;var qQr=Fx.create;re.tuple=qQr;var UQr=Vae.create;re.record=UQr;var zQr=vU.create;re.map=zQr;var HQr=wU.create;re.set=HQr;var VQr=Wae.create;re.function=VQr;var WQr=rD.create;re.lazy=WQr;var KQr=nD.create;re.literal=KQr;var GQr=oD.create;re.enum=GQr;var JQr=iD.create;re.nativeEnum=JQr;var YQr=LI.create;re.promise=YQr;var hLt=oh.create;re.effect=hLt;re.transformer=hLt;var ZQr=Mg.create;re.optional=ZQr;var XQr=kx.create;re.nullable=XQr;var QQr=oh.createWithPreprocess;re.preprocess=QQr;var een=M5.create;re.pipeline=een;var ten=()=>fLt().optional();re.ostring=ten;var ren=()=>pLt().optional();re.onumber=ren;var nen=()=>mLt().optional();re.oboolean=nen;re.coerce={string:t=>NI.create({...t,coerce:!0}),number:t=>GN.create({...t,coerce:!0}),boolean:t=>YN.create({...t,coerce:!0}),bigint:t=>JN.create({...t,coerce:!0}),date:t=>ZN.create({...t,coerce:!0})};re.NEVER=ne.INVALID});var yNe=v(jg=>{"use strict";var oen=jg&&jg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xU=jg&&jg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oen(e,t,r)};Object.defineProperty(jg,"__esModule",{value:!0});xU(Bae(),jg);xU(mNe(),jg);xU(tLt(),jg);xU(P5(),jg);xU(gLt(),jg);xU($ae(),jg)});var Te=v(Qp=>{"use strict";var yLt=Qp&&Qp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ien=Qp&&Qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aen=Qp&&Qp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yLt(e,t,r);return ien(e,t),e},sen=Qp&&Qp.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yLt(e,t,r)};Object.defineProperty(Qp,"__esModule",{value:!0});Qp.z=void 0;var bLt=aen(yNe());Qp.z=bLt;sen(yNe(),Qp);Qp.default=bLt});var vNe=v(mc=>{"use strict";var uen=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]}),len=mc&&mc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cen=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)&&uen(e,t,r);return len(e,t),e};Object.defineProperty(mc,"__esModule",{value:!0});mc.zodInbound=mc.zodOutbound=void 0;mc.bytesToBase64=_Lt;mc.bytesFromBase64=bNe;mc.stringToBytes=_Ne;mc.stringFromBytes=vLt;mc.stringToBase64=den;mc.stringFromBase64=fen;var Kae=cen(Te());function _Lt(t){return btoa(String.fromCodePoint(...t))}function bNe(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function _Ne(t){return new TextEncoder().encode(t)}function vLt(t){return new TextDecoder().decode(t)}function den(t){return _Lt(_Ne(t))}function fen(t){return vLt(bNe(t))}mc.zodOutbound=Kae.instanceof(Uint8Array).or(Kae.string().transform(_Ne));mc.zodInbound=Kae.instanceof(Uint8Array).or(Kae.string().transform(bNe))});var SNe=v(wNe=>{"use strict";Object.defineProperty(wNe,"__esModule",{value:!0});wNe.isPlainObject=pen;function pen(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 ii=v(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.encodeDeepObjectQuery=ao.encodePipeDelimitedQuery=ao.encodeSpaceDelimitedQuery=ao.encodeFormQuery=ao.encodeJSONQuery=ao.encodeSimple=ao.encodePipeDelimited=ao.encodeSpaceDelimited=ao.encodeForm=ao.EncodingError=void 0;ao.encodeMatrix=men;ao.encodeLabel=hen;ao.encodeBodyForm=gen;ao.encodeDeepObject=SLt;ao.encodeDeepObjectObject=CNe;ao.encodeJSON=xLt;ao.queryJoin=CLt;ao.queryEncoder=OU;ao.appendForm=ben;var wLt=vNe(),cb=SNe(),R5=class extends Error{constructor(e){super(e),this.name="EncodingError"}};ao.EncodingError=R5;function men(t,e,r){let n="",o=r?.explode?j5(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(CU(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=N5(u,f=>`${a(f)}`)?.join(","):(0,cb.isPlainObject)(u)?c=Jae(Object.entries(u),([p,m])=>`,${i(p)},${a(m)}`)?.join("").slice(1):c=`${a(u)}`,c==null))return;let d=i(s);l=`${d}=${c}`,l===`${d}=`&&(l=l.slice(0,-1)),l&&(n+=`;${l}`)}),n}function hen(t,e,r){let n="",o=r?.explode?j5(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(CU(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=N5(u,c=>`${a(c)}`)?.join("."):(0,cb.isPlainObject)(u)?l=Jae(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,cb.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function xNe(t){return(e,r,n)=>{let o="",i=n?.explode?j5(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(CU(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=N5(c,p=>`${s(p)}`)?.join(u):(0,cb.isPlainObject)(c)?f=Jae(Object.entries(c),([p,m])=>`${a(p)}${u}${s(m)}`)?.join(u):f=`${s(c)}`,f!=null&&(d=`${a(l)}=${f}`,!(!d||d==="=")&&(o+=`&${d}`)))}),o.slice(1)}}ao.encodeForm=xNe(",");ao.encodeSpaceDelimited=xNe(" ");ao.encodePipeDelimited=xNe("|");function gen(t,e,r){let n="",o=r?.explode?j5(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(CU(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,cb.isPlainObject)(u)?c=JSON.stringify(u,Gae):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function SLt(t,e,r){if(e!=null){if(!(0,cb.isPlainObject)(e))throw new R5(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return CNe(t,e,r)}}function CNe(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,cb.isPlainObject)(e))throw new R5(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,cb.isPlainObject)(a)){let c=CNe(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=N5(u,c=>`${o(s)}=${o(CU(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function xLt(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,Gae));return r?.explode?o:`${n(t)}=${o}`}var yen=(t,e,r)=>{let n="",o=r?.explode?j5(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(CU(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=N5(u,c=>`${a(c)}`)?.join(","):(0,cb.isPlainObject)(u)?l=Jae(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,cb.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};ao.encodeSimple=yen;function j5(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,cb.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function CU(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,wLt.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,Gae):`${t}`}function Gae(t,e){return e instanceof Uint8Array?(0,wLt.bytesToBase64)(e):e}function N5(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 Jae(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 CLt(...t){return t.filter(Boolean).join("&")}function OU(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 CLt(...i)}}ao.encodeJSONQuery=OU(xLt);ao.encodeFormQuery=OU(ao.encodeForm);ao.encodeSpaceDelimitedQuery=OU(ao.encodeSpaceDelimited);ao.encodePipeDelimitedQuery=OU(ao.encodePipeDelimited);ao.encodeDeepObjectQuery=OU(SLt);function ben(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 OLt=v(ONe=>{"use strict";Object.defineProperty(ONe,"__esModule",{value:!0});ONe.dlv=_en;function _en(t,e,r,n,o){for(e=Array.isArray(e)?e:e.split("."),n=0;n{"use strict";var ven=ih&&ih.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=ih&&ih.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sen=ih&&ih.__importStar||function(t){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(ih,"__esModule",{value:!0});ih.envSchema=void 0;ih.env=xen;ih.resetEnv=Cen;var PLt=OLt(),PNe=Sen(Te());ih.envSchema=PNe.object({MISTRAL_API_KEY:PNe.string().optional(),MISTRAL_DEBUG:PNe.coerce.boolean().optional()});var D5;function xen(){return D5||(D5=ih.envSchema.parse((0,PLt.dlv)(globalThis,"process.env")??(0,PLt.dlv)(globalThis,"Deno.env")??{}),D5)}function Cen(){D5=void 0}});var L5=v($x=>{"use strict";Object.defineProperty($x,"__esModule",{value:!0});$x.HTTPClient=void 0;$x.matchContentType=TLt;$x.matchStatusCode=ALt;$x.matchResponse=Een;$x.isConnectionError=Ten;$x.isTimeoutError=Aen;$x.isAbortError=Ien;var Oen=(t,e)=>e==null?fetch(t):fetch(t,e),TNe=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||Oen}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}};$x.HTTPClient=TNe;var ELt=/\s*;\s*/g;function TLt(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(ELt),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(ELt),[s="",...u]=a,[l="",c=""]=s.split("/");if(!l||!c||o!=="*/*"&&s!==o&&`${l}/*`!==o&&`*/${c}`!==o||u.length{let i=`${o}`;if(i==="default")return!0;if(!Pen.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 Een(t,e,r){return ALt(t,e)&&TLt(t,r)}function Ten(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 Aen(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 Ien(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 MLt=v(cD=>{"use strict";Object.defineProperty(cD,"__esModule",{value:!0});cD.TemporaryError=cD.PermanentError=void 0;cD.retry=Ren;var ILt=L5(),Men={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},F5=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)}};cD.PermanentError=F5;var lD=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};cD.TemporaryError=lD;async function Ren(t,e){switch(e.config.strategy){case"backoff":return Len(jen(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??Men);default:return await t()}}function jen(t,e){return async()=>{try{let r=await t();if(Den(r,e.statusCodes))throw new lD("Response failed with retryable status code",r);return r}catch(r){throw r instanceof lD||e.retryConnectionErrors&&((0,ILt.isTimeoutError)(r)||(0,ILt.isConnectionError)(r))?r:new F5("Permanent error",{cause:r})}}}var Nen=new RegExp("^[0-9]xx$","i");function Den(t,e){let r=`${t.status}`;return e.some(n=>{if(!Nen.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 Len(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 F5)throw u.cause;if(Date.now()-a>r){if(u instanceof lD)return u.response;throw u}let c=0;u instanceof lD&&(c=Fen(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await ken(d),s++}}function Fen(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 ken(t){return new Promise(e=>setTimeout(e,t))}});var ah=v(kI=>{"use strict";var k5=kI&&kI.__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},Ng=kI&&kI.__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)},Zae,Bx,gP;Object.defineProperty(kI,"__esModule",{value:!0});kI.ClientSDK=void 0;var RLt=GDt(),PU=lNe(),FI=Ig(),$en=vNe(),jLt=Dae(),Ben=ii(),qen=ENe(),yP=L5(),Uen=MLt(),Yae=typeof globalThis>"u"?null:globalThis,zen=typeof Yae=="object"&&Yae!=null&&"importScripts"in Yae&&typeof Yae.importScripts=="function",Hen=zen||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",ANe=class{constructor(e={}){Zae.set(this,void 0),Bx.set(this,void 0),gP.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof RLt.SDKHooks?k5(this,Bx,r.hooks,"f"):k5(this,Bx,new RLt.SDKHooks,"f"),this._options={...e,hooks:Ng(this,Bx,"f")};let n=(0,jLt.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=Ng(this,Bx,"f").sdkInit({baseURL:n,client:e.httpClient||new yP.HTTPClient});this._baseURL=o,k5(this,Zae,i,"f"),k5(this,gP,e.debugLogger,"f"),!Ng(this,gP,"f")&&(0,qen.env)().MISTRAL_DEBUG&&k5(this,gP,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,FI.ERR)(new PU.InvalidRequestError("No base URL provided for operation"));let c=new URL(l),d=new URL(i,c);i&&(c.pathname+=c.pathname.endsWith("/")?"":"/",c.pathname+=d.pathname.replace(/^\/+/,""));let f=a||"",p=[];for(let[P,E]of Object.entries(u?.queryParams||{})){let A=(0,Ben.encodeForm)(P,E,{charEncoding:"percent"});typeof A<"u"&&p.push(A)}if(p.length&&(f+=`&${p.join("&")}`),f){let P=f.startsWith("&")?f.slice(1):f;c.search=`?${P}`}let m=new Headers(s),h=u?.basic.username,b=u?.basic.password;if(h!=null||b!=null){let P=(0,$en.stringToBase64)([h||"",b||""].join(":"));m.set("Authorization",`Basic ${P}`)}let g=new Headers(u?.headers||{});for(let[P,E]of g)m.set(P,E);let y=m.get("cookie")||"";for(let[P,E]of Object.entries(u?.cookies||{}))y+=`; ${P}=${E}`;y=y.startsWith("; ")?y.slice(2):y,m.set("cookie",y);let S=new Headers(n?.fetchOptions?.headers);for(let[P,E]of S)m.set(P,E);Hen||m.set(r.uaHeader??"user-agent",jLt.SDK_METADATA.userAgent);let x=n?.fetchOptions;if(!x?.signal&&r.timeoutMs&&r.timeoutMs>0){let P=AbortSignal.timeout(r.timeoutMs);x?x.signal=P:x={signal:P}}r.body instanceof ReadableStream&&(x?x.duplex="half":x={duplex:"half"});let O;try{O=Ng(this,Bx,"f").beforeCreateRequest(e,{url:c,options:{...x,body:r.body??null,headers:m,method:o}})}catch(P){return(0,FI.ERR)(new PU.UnexpectedClientError("Create request hook failed to execute",{cause:P}))}return(0,FI.OK)(new Request(O.url,O.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,Uen.retry)(async()=>{let i=await Ng(this,Bx,"f").beforeRequest(n,e.clone());await Ven(Ng(this,gP,"f"),i).catch(s=>Ng(this,gP,"f")?.log("Failed to log request:",s));let a=await Ng(this,Zae,"f").request(i);try{if((0,yP.matchStatusCode)(a,o)){let s=await Ng(this,Bx,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await Ng(this,Bx,"f").afterSuccess(n,a)}finally{await Wen(Ng(this,gP,"f"),a,i).catch(s=>Ng(this,gP,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,FI.OK)(i),i=>{switch(!0){case(0,yP.isAbortError)(i):return(0,FI.ERR)(new PU.RequestAbortedError("Request aborted by client",{cause:i}));case(0,yP.isTimeoutError)(i):return(0,FI.ERR)(new PU.RequestTimeoutError("Request timed out",{cause:i}));case(0,yP.isConnectionError)(i):return(0,FI.ERR)(new PU.ConnectionError("Unable to make request",{cause:i}));default:return(0,FI.ERR)(new PU.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};kI.ClientSDK=ANe;Zae=new WeakMap,Bx=new WeakMap,gP=new WeakMap;var NLt=/^application\/(?:.{0,100}\+)?json/;async function Ven(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 NLt.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?"":a;t.log(`${i}: ${s}`)}break}default:t.log(`<${r}>`);break}t.groupEnd(),t.groupEnd()}async function Wen(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,yP.matchContentType)(e,"application/json")||NLt.test(o)):t.log(await e.clone().json());break;case(0,yP.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,yP.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,yP.matchContentType)(e,"multipart/form-data"):{let i=await e.clone().formData();for(let[a,s]of i){let u=s instanceof Blob?"":s;t.log(`${a}: ${u}`)}break}default:t.log(`<${n}>`);break}t.groupEnd(),t.groupEnd()}});var MNe=v(Xae=>{"use strict";Object.defineProperty(Xae,"__esModule",{value:!0});Xae.SDKError=void 0;var INe=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"}};Xae.SDKError=INe});var U5=v(q5=>{"use strict";Object.defineProperty(q5,"__esModule",{value:!0});q5.EventStream=void 0;q5.discardSentinel=Jen;var $5=10,B5=13,DLt=new Set([$5,B5]),Ken=[new Uint8Array([B5,$5,B5,$5]),new Uint8Array([B5,B5]),new Uint8Array([$5,$5])],RNe=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;s0&&(r=r.slice(n),n=0)}if(r.length>0){let o=jNe(r,this.decoder);o!=null&&(yield o)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{e.releaseLock()}}};q5.EventStream=RNe;function LLt(t,e){let r=t[e],n=t[e+1];if(r==null||n==null||!DLt.has(r)||!DLt.has(n))return null;for(let o of Ken){let i=Gen(e,t,o);if(i!=null)return i}return null}function Gen(t,e,r){if(r.length>e.length-t)return null;for(let n=0;n0?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 Jen(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{"use strict";var Zen=db&&db.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xen=db&&db.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qen=db&&db.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zen(e,t,r);return Xen(e,t),e};Object.defineProperty(db,"__esModule",{value:!0});db.SDKValidationError=void 0;db.formatZodError=DNe;var etn=Qen(Te()),NNe=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 etn.ZodError?`${this.rawMessage} -${DNe(this.cause)}`:this.toString()}};db.SDKValidationError=NNe;function DNe(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?`.${u}`:"",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(`${DNe(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var ve=v(z5=>{"use strict";Object.defineProperty(z5,"__esModule",{value:!0});z5.parse=rtn;z5.safeParse=ntn;z5.collectExtraKeys=otn;var ttn=Te(),kLt=LNe(),FLt=Ig();function rtn(t,e,r){try{return e(t)}catch(n){throw n instanceof ttn.ZodError?new kLt.SDKValidationError(r,n,t):n}}function ntn(t,e,r){try{return(0,FLt.OK)(e(t))}catch(n){return(0,FLt.ERR)(new kLt.SDKValidationError(r,n,t))}}function otn(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 ai=v(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.jsonErr=stn;hc.json=utn;hc.textErr=ltn;hc.text=ctn;hc.bytesErr=dtn;hc.bytes=ftn;hc.streamErr=ptn;hc.stream=mtn;hc.sseErr=htn;hc.sse=gtn;hc.nilErr=ytn;hc.nil=btn;hc.fail=_tn;hc.match=vtn;hc.unpackHeaders=Qae;hc.discardResponseBody=zLt;var $Lt=MNe(),itn=U5(),BLt=L5(),qLt=SNe(),ULt=ve(),atn={json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function stn(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function utn(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function ltn(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function ctn(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function dtn(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function ftn(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function ptn(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function mtn(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function htn(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function gtn(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function ytn(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function btn(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function _tn(t){return{enc:"fail",codes:t}}function vtn(...t){return async function(r,n){let o,i;for(let l of t){let{codes:c}=l,d="ctype"in l?l.ctype:atn[l.enc];if(d&&(0,BLt.matchResponse)(r,c,d)){i=l;break}else if(!d&&(0,BLt.matchStatusCode)(r,c)){i=l;break}}if(!i){let l=await r.text();return[{ok:!1,error:new $Lt.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,itn.discardSentinel)(r.body,i.sseSentinel):r.body;break;case"nil":o=await zLt(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 $Lt.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:Qae(r.headers)}:null,...(0,qLt.isPlainObject)(o)?o:null}:s?u={...n?.extraFields,...i.hdrs?{Headers:Qae(r.headers)}:null,[s]:o}:i.hdrs?u={...n?.extraFields,...i.hdrs?{Headers:Qae(r.headers)}:null,...(0,qLt.isPlainObject)(o)?o:null}:u=o,"err"in i){let l=(0,ULt.safeParse)(u,c=>i.schema.parse(c),"Response validation failed");return[l.ok?{ok:!1,error:l.value}:l,o]}else return[(0,ULt.safeParse)(u,l=>i.schema.parse(l),"Response validation failed"),o]}}var wtn=/, */;function Qae(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(wtn);return e}async function zLt(t){let e=t.body?.getReader();if(e!=null)try{let r=!1;for(;!r;)r=(await e.read()).done}finally{e.releaseLock()}}});var Ue=v(dD=>{"use strict";Object.defineProperty(dD,"__esModule",{value:!0});dD.invariant=Stn;dD.remap=xtn;dD.combineSignals=Ctn;dD.abortSignalAny=HLt;dD.compactMap=Otn;var FNe=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function Stn(t,e){if(!t)throw new FNe(e)}function xtn(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 Ctn(...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):HLt(e)}}function HLt(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 Otn(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}});var si=v(bP=>{"use strict";Object.defineProperty(bP,"__esModule",{value:!0});bP.SecurityError=bP.SecurityErrorCode=void 0;bP.resolveSecurity=VLt;bP.resolveGlobalSecurity=Ttn;bP.extractSecurity=Atn;var Ptn=ENe(),tse;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(tse||(bP.SecurityErrorCode=tse={}));var rse=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(tse.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(tse.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};bP.SecurityError=rse;function VLt(...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":Etn(e,n);break;case"http:custom":break;case"http:bearer":ese(e,n);break;case"oauth2":ese(e,n);break;case"oauth2:password":ese(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":ese(e,n);break;default:throw rse.unrecognizedType(o)}}),e)}function Etn(t,e){e.value!=null&&(t.basic=e.value)}function ese(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 Ttn(t){return VLt([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,Ptn.env)().MISTRAL_API_KEY}])}async function Atn(t){if(t!=null)return typeof t=="function"?t():t}});var kNe=v(ru=>{"use strict";var Itn=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]}),Mtn=ru&&ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rtn=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)&&Itn(e,t,r);return Mtn(e,t),e};Object.defineProperty(ru,"__esModule",{value:!0});ru.ImageURL$=ru.ImageURL$outboundSchema=ru.ImageURL$inboundSchema=void 0;ru.imageURLToJSON=Ntn;ru.imageURLFromJSON=Dtn;var $I=Rtn(Te()),jtn=ve();ru.ImageURL$inboundSchema=$I.object({url:$I.string(),detail:$I.nullable($I.string()).optional()});ru.ImageURL$outboundSchema=$I.object({url:$I.string(),detail:$I.nullable($I.string()).optional()});var WLt;(function(t){t.inboundSchema=ru.ImageURL$inboundSchema,t.outboundSchema=ru.ImageURL$outboundSchema})(WLt||(ru.ImageURL$=WLt={}));function Ntn(t){return JSON.stringify(ru.ImageURL$outboundSchema.parse(t))}function Dtn(t){return(0,jtn.safeParse)(t,e=>ru.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var $Ne=v(Pr=>{"use strict";var Ltn=Pr&&Pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ftn=Pr&&Pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ktn=Pr&&Pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ltn(e,t,r);return Ftn(e,t),e};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.ImageURLChunk$=Pr.ImageURLChunk$outboundSchema=Pr.ImageURLChunk$inboundSchema=Pr.ImageURLChunkType$=Pr.ImageURLChunkType$outboundSchema=Pr.ImageURLChunkType$inboundSchema=Pr.ImageURLChunkImageURL$=Pr.ImageURLChunkImageURL$outboundSchema=Pr.ImageURLChunkImageURL$inboundSchema=Pr.ImageURLChunkType=void 0;Pr.imageURLChunkImageURLToJSON=$tn;Pr.imageURLChunkImageURLFromJSON=Btn;Pr.imageURLChunkToJSON=qtn;Pr.imageURLChunkFromJSON=Utn;var fb=ktn(Te()),YLt=Ue(),ZLt=ve(),nse=kNe();Pr.ImageURLChunkType={ImageUrl:"image_url"};Pr.ImageURLChunkImageURL$inboundSchema=fb.union([nse.ImageURL$inboundSchema,fb.string()]);Pr.ImageURLChunkImageURL$outboundSchema=fb.union([nse.ImageURL$outboundSchema,fb.string()]);var KLt;(function(t){t.inboundSchema=Pr.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=Pr.ImageURLChunkImageURL$outboundSchema})(KLt||(Pr.ImageURLChunkImageURL$=KLt={}));function $tn(t){return JSON.stringify(Pr.ImageURLChunkImageURL$outboundSchema.parse(t))}function Btn(t){return(0,ZLt.safeParse)(t,e=>Pr.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}Pr.ImageURLChunkType$inboundSchema=fb.nativeEnum(Pr.ImageURLChunkType);Pr.ImageURLChunkType$outboundSchema=Pr.ImageURLChunkType$inboundSchema;var GLt;(function(t){t.inboundSchema=Pr.ImageURLChunkType$inboundSchema,t.outboundSchema=Pr.ImageURLChunkType$outboundSchema})(GLt||(Pr.ImageURLChunkType$=GLt={}));Pr.ImageURLChunk$inboundSchema=fb.object({image_url:fb.union([nse.ImageURL$inboundSchema,fb.string()]),type:Pr.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,YLt.remap)(t,{image_url:"imageUrl"}));Pr.ImageURLChunk$outboundSchema=fb.object({imageUrl:fb.union([nse.ImageURL$outboundSchema,fb.string()]),type:Pr.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,YLt.remap)(t,{imageUrl:"image_url"}));var JLt;(function(t){t.inboundSchema=Pr.ImageURLChunk$inboundSchema,t.outboundSchema=Pr.ImageURLChunk$outboundSchema})(JLt||(Pr.ImageURLChunk$=JLt={}));function qtn(t){return JSON.stringify(Pr.ImageURLChunk$outboundSchema.parse(t))}function Utn(t){return(0,ZLt.safeParse)(t,e=>Pr.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var BNe=v(so=>{"use strict";var ztn=so&&so.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Htn=so&&so.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vtn=so&&so.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ztn(e,t,r);return Htn(e,t),e};Object.defineProperty(so,"__esModule",{value:!0});so.ReferenceChunk$=so.ReferenceChunk$outboundSchema=so.ReferenceChunk$inboundSchema=so.ReferenceChunkType$=so.ReferenceChunkType$outboundSchema=so.ReferenceChunkType$inboundSchema=so.ReferenceChunkType=void 0;so.referenceChunkToJSON=Ktn;so.referenceChunkFromJSON=Gtn;var fD=Vtn(Te()),eFt=Ue(),Wtn=ve();so.ReferenceChunkType={Reference:"reference"};so.ReferenceChunkType$inboundSchema=fD.nativeEnum(so.ReferenceChunkType);so.ReferenceChunkType$outboundSchema=so.ReferenceChunkType$inboundSchema;var XLt;(function(t){t.inboundSchema=so.ReferenceChunkType$inboundSchema,t.outboundSchema=so.ReferenceChunkType$outboundSchema})(XLt||(so.ReferenceChunkType$=XLt={}));so.ReferenceChunk$inboundSchema=fD.object({reference_ids:fD.array(fD.number().int()),type:so.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,eFt.remap)(t,{reference_ids:"referenceIds"}));so.ReferenceChunk$outboundSchema=fD.object({referenceIds:fD.array(fD.number().int()),type:so.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,eFt.remap)(t,{referenceIds:"reference_ids"}));var QLt;(function(t){t.inboundSchema=so.ReferenceChunk$inboundSchema,t.outboundSchema=so.ReferenceChunk$outboundSchema})(QLt||(so.ReferenceChunk$=QLt={}));function Ktn(t){return JSON.stringify(so.ReferenceChunk$outboundSchema.parse(t))}function Gtn(t){return(0,Wtn.safeParse)(t,e=>so.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var ose=v(uo=>{"use strict";var Jtn=uo&&uo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ytn=uo&&uo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ztn=uo&&uo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jtn(e,t,r);return Ytn(e,t),e};Object.defineProperty(uo,"__esModule",{value:!0});uo.TextChunk$=uo.TextChunk$outboundSchema=uo.TextChunk$inboundSchema=uo.TextChunkType$=uo.TextChunkType$outboundSchema=uo.TextChunkType$inboundSchema=uo.TextChunkType=void 0;uo.textChunkToJSON=Qtn;uo.textChunkFromJSON=ern;var H5=Ztn(Te()),Xtn=ve();uo.TextChunkType={Text:"text"};uo.TextChunkType$inboundSchema=H5.nativeEnum(uo.TextChunkType);uo.TextChunkType$outboundSchema=uo.TextChunkType$inboundSchema;var tFt;(function(t){t.inboundSchema=uo.TextChunkType$inboundSchema,t.outboundSchema=uo.TextChunkType$outboundSchema})(tFt||(uo.TextChunkType$=tFt={}));uo.TextChunk$inboundSchema=H5.object({text:H5.string(),type:uo.TextChunkType$inboundSchema.default("text")});uo.TextChunk$outboundSchema=H5.object({text:H5.string(),type:uo.TextChunkType$outboundSchema.default("text")});var rFt;(function(t){t.inboundSchema=uo.TextChunk$inboundSchema,t.outboundSchema=uo.TextChunk$outboundSchema})(rFt||(uo.TextChunk$=rFt={}));function Qtn(t){return JSON.stringify(uo.TextChunk$outboundSchema.parse(t))}function ern(t){return(0,Xtn.safeParse)(t,e=>uo.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var EU=v(nu=>{"use strict";var trn=nu&&nu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rrn=nu&&nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nrn=nu&&nu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&trn(e,t,r);return rrn(e,t),e};Object.defineProperty(nu,"__esModule",{value:!0});nu.ContentChunk$=nu.ContentChunk$outboundSchema=nu.ContentChunk$inboundSchema=void 0;nu.contentChunkToJSON=irn;nu.contentChunkFromJSON=arn;var em=nrn(Te()),orn=ve(),oFt=$Ne(),iFt=BNe(),aFt=ose();nu.ContentChunk$inboundSchema=em.union([oFt.ImageURLChunk$inboundSchema.and(em.object({type:em.literal("image_url")}).transform(t=>({type:t.type}))),aFt.TextChunk$inboundSchema.and(em.object({type:em.literal("text")}).transform(t=>({type:t.type}))),iFt.ReferenceChunk$inboundSchema.and(em.object({type:em.literal("reference")}).transform(t=>({type:t.type})))]);nu.ContentChunk$outboundSchema=em.union([oFt.ImageURLChunk$outboundSchema.and(em.object({type:em.literal("image_url")}).transform(t=>({type:t.type}))),aFt.TextChunk$outboundSchema.and(em.object({type:em.literal("text")}).transform(t=>({type:t.type}))),iFt.ReferenceChunk$outboundSchema.and(em.object({type:em.literal("reference")}).transform(t=>({type:t.type})))]);var nFt;(function(t){t.inboundSchema=nu.ContentChunk$inboundSchema,t.outboundSchema=nu.ContentChunk$outboundSchema})(nFt||(nu.ContentChunk$=nFt={}));function irn(t){return JSON.stringify(nu.ContentChunk$outboundSchema.parse(t))}function arn(t){return(0,orn.safeParse)(t,e=>nu.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var qNe=v(Ao=>{"use strict";var srn=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]}),urn=Ao&&Ao.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lrn=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)&&srn(e,t,r);return urn(e,t),e};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.FunctionCall$=Ao.FunctionCall$outboundSchema=Ao.FunctionCall$inboundSchema=Ao.Arguments$=Ao.Arguments$outboundSchema=Ao.Arguments$inboundSchema=void 0;Ao.argumentsToJSON=crn;Ao.argumentsFromJSON=drn;Ao.functionCallToJSON=frn;Ao.functionCallFromJSON=prn;var ou=lrn(Te()),lFt=ve();Ao.Arguments$inboundSchema=ou.union([ou.record(ou.any()),ou.string()]);Ao.Arguments$outboundSchema=ou.union([ou.record(ou.any()),ou.string()]);var sFt;(function(t){t.inboundSchema=Ao.Arguments$inboundSchema,t.outboundSchema=Ao.Arguments$outboundSchema})(sFt||(Ao.Arguments$=sFt={}));function crn(t){return JSON.stringify(Ao.Arguments$outboundSchema.parse(t))}function drn(t){return(0,lFt.safeParse)(t,e=>Ao.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}Ao.FunctionCall$inboundSchema=ou.object({name:ou.string(),arguments:ou.union([ou.record(ou.any()),ou.string()])});Ao.FunctionCall$outboundSchema=ou.object({name:ou.string(),arguments:ou.union([ou.record(ou.any()),ou.string()])});var uFt;(function(t){t.inboundSchema=Ao.FunctionCall$inboundSchema,t.outboundSchema=Ao.FunctionCall$outboundSchema})(uFt||(Ao.FunctionCall$=uFt={}));function frn(t){return JSON.stringify(Ao.FunctionCall$outboundSchema.parse(t))}function prn(t){return(0,lFt.safeParse)(t,e=>Ao.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var BI=v(UNe=>{"use strict";Object.defineProperty(UNe,"__esModule",{value:!0});UNe.catchUnrecognizedEnum=mrn;function mrn(t){return t}});var V5=v(iu=>{"use strict";var hrn=iu&&iu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),grn=iu&&iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yrn=iu&&iu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hrn(e,t,r);return grn(e,t),e};Object.defineProperty(iu,"__esModule",{value:!0});iu.ToolTypes$=iu.ToolTypes$outboundSchema=iu.ToolTypes$inboundSchema=iu.ToolTypes=void 0;var pD=yrn(Te()),brn=BI();iu.ToolTypes={Function:"function"};iu.ToolTypes$inboundSchema=pD.union([pD.nativeEnum(iu.ToolTypes),pD.string().transform(brn.catchUnrecognizedEnum)]);iu.ToolTypes$outboundSchema=pD.union([pD.nativeEnum(iu.ToolTypes),pD.string().and(pD.custom())]);var cFt;(function(t){t.inboundSchema=iu.ToolTypes$inboundSchema,t.outboundSchema=iu.ToolTypes$outboundSchema})(cFt||(iu.ToolTypes$=cFt={}))});var ise=v(au=>{"use strict";var _rn=au&&au.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vrn=au&&au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wrn=au&&au.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_rn(e,t,r);return vrn(e,t),e};Object.defineProperty(au,"__esModule",{value:!0});au.ToolCall$=au.ToolCall$outboundSchema=au.ToolCall$inboundSchema=void 0;au.toolCallToJSON=xrn;au.toolCallFromJSON=Crn;var TU=wrn(Te()),Srn=ve(),fFt=qNe(),pFt=V5();au.ToolCall$inboundSchema=TU.object({id:TU.string().default("null"),type:pFt.ToolTypes$inboundSchema.optional(),function:fFt.FunctionCall$inboundSchema,index:TU.number().int().default(0)});au.ToolCall$outboundSchema=TU.object({id:TU.string().default("null"),type:pFt.ToolTypes$outboundSchema.optional(),function:fFt.FunctionCall$outboundSchema,index:TU.number().int().default(0)});var dFt;(function(t){t.inboundSchema=au.ToolCall$inboundSchema,t.outboundSchema=au.ToolCall$outboundSchema})(dFt||(au.ToolCall$=dFt={}));function xrn(t){return JSON.stringify(au.ToolCall$outboundSchema.parse(t))}function Crn(t){return(0,Srn.safeParse)(t,e=>au.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var qI=v(Er=>{"use strict";var Orn=Er&&Er.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Prn=Er&&Er.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ern=Er&&Er.__importStar||function(t){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 Prn(e,t),e};Object.defineProperty(Er,"__esModule",{value:!0});Er.AssistantMessage$=Er.AssistantMessage$outboundSchema=Er.AssistantMessage$inboundSchema=Er.AssistantMessageRole$=Er.AssistantMessageRole$outboundSchema=Er.AssistantMessageRole$inboundSchema=Er.AssistantMessageContent$=Er.AssistantMessageContent$outboundSchema=Er.AssistantMessageContent$inboundSchema=Er.AssistantMessageRole=void 0;Er.assistantMessageContentToJSON=Trn;Er.assistantMessageContentFromJSON=Arn;Er.assistantMessageToJSON=Irn;Er.assistantMessageFromJSON=Mrn;var Xa=Ern(Te()),yFt=Ue(),bFt=ve(),ase=EU(),_Ft=ise();Er.AssistantMessageRole={Assistant:"assistant"};Er.AssistantMessageContent$inboundSchema=Xa.union([Xa.string(),Xa.array(ase.ContentChunk$inboundSchema)]);Er.AssistantMessageContent$outboundSchema=Xa.union([Xa.string(),Xa.array(ase.ContentChunk$outboundSchema)]);var mFt;(function(t){t.inboundSchema=Er.AssistantMessageContent$inboundSchema,t.outboundSchema=Er.AssistantMessageContent$outboundSchema})(mFt||(Er.AssistantMessageContent$=mFt={}));function Trn(t){return JSON.stringify(Er.AssistantMessageContent$outboundSchema.parse(t))}function Arn(t){return(0,bFt.safeParse)(t,e=>Er.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}Er.AssistantMessageRole$inboundSchema=Xa.nativeEnum(Er.AssistantMessageRole);Er.AssistantMessageRole$outboundSchema=Er.AssistantMessageRole$inboundSchema;var hFt;(function(t){t.inboundSchema=Er.AssistantMessageRole$inboundSchema,t.outboundSchema=Er.AssistantMessageRole$outboundSchema})(hFt||(Er.AssistantMessageRole$=hFt={}));Er.AssistantMessage$inboundSchema=Xa.object({content:Xa.nullable(Xa.union([Xa.string(),Xa.array(ase.ContentChunk$inboundSchema)])).optional(),tool_calls:Xa.nullable(Xa.array(_Ft.ToolCall$inboundSchema)).optional(),prefix:Xa.boolean().default(!1),role:Er.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,yFt.remap)(t,{tool_calls:"toolCalls"}));Er.AssistantMessage$outboundSchema=Xa.object({content:Xa.nullable(Xa.union([Xa.string(),Xa.array(ase.ContentChunk$outboundSchema)])).optional(),toolCalls:Xa.nullable(Xa.array(_Ft.ToolCall$outboundSchema)).optional(),prefix:Xa.boolean().default(!1),role:Er.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,yFt.remap)(t,{toolCalls:"tool_calls"}));var gFt;(function(t){t.inboundSchema=Er.AssistantMessage$inboundSchema,t.outboundSchema=Er.AssistantMessage$outboundSchema})(gFt||(Er.AssistantMessage$=gFt={}));function Irn(t){return JSON.stringify(Er.AssistantMessage$outboundSchema.parse(t))}function Mrn(t){return(0,bFt.safeParse)(t,e=>Er.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var AU=v(Io=>{"use strict";var Rrn=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]}),jrn=Io&&Io.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nrn=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)&&Rrn(e,t,r);return jrn(e,t),e};Object.defineProperty(Io,"__esModule",{value:!0});Io.Prediction$=Io.Prediction$outboundSchema=Io.Prediction$inboundSchema=Io.PredictionType$=Io.PredictionType$outboundSchema=Io.PredictionType$inboundSchema=Io.PredictionType=void 0;Io.predictionToJSON=Lrn;Io.predictionFromJSON=Frn;var mD=Nrn(Te()),Drn=ve();Io.PredictionType={Content:"content"};Io.PredictionType$inboundSchema=mD.nativeEnum(Io.PredictionType);Io.PredictionType$outboundSchema=Io.PredictionType$inboundSchema;var vFt;(function(t){t.inboundSchema=Io.PredictionType$inboundSchema,t.outboundSchema=Io.PredictionType$outboundSchema})(vFt||(Io.PredictionType$=vFt={}));Io.Prediction$inboundSchema=mD.object({type:mD.literal("content").default("content"),content:mD.string().default("")});Io.Prediction$outboundSchema=mD.object({type:mD.literal("content").default("content"),content:mD.string().default("")});var wFt;(function(t){t.inboundSchema=Io.Prediction$inboundSchema,t.outboundSchema=Io.Prediction$outboundSchema})(wFt||(Io.Prediction$=wFt={}));function Lrn(t){return JSON.stringify(Io.Prediction$outboundSchema.parse(t))}function Frn(t){return(0,Drn.safeParse)(t,e=>Io.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var zNe=v(su=>{"use strict";var krn=su&&su.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$rn=su&&su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Brn=su&&su.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&krn(e,t,r);return $rn(e,t),e};Object.defineProperty(su,"__esModule",{value:!0});su.JsonSchema$=su.JsonSchema$outboundSchema=su.JsonSchema$inboundSchema=void 0;su.jsonSchemaToJSON=Urn;su.jsonSchemaFromJSON=zrn;var tm=Brn(Te()),xFt=Ue(),qrn=ve();su.JsonSchema$inboundSchema=tm.object({name:tm.string(),description:tm.nullable(tm.string()).optional(),schema:tm.record(tm.any()),strict:tm.boolean().default(!1)}).transform(t=>(0,xFt.remap)(t,{schema:"schemaDefinition"}));su.JsonSchema$outboundSchema=tm.object({name:tm.string(),description:tm.nullable(tm.string()).optional(),schemaDefinition:tm.record(tm.any()),strict:tm.boolean().default(!1)}).transform(t=>(0,xFt.remap)(t,{schemaDefinition:"schema"}));var SFt;(function(t){t.inboundSchema=su.JsonSchema$inboundSchema,t.outboundSchema=su.JsonSchema$outboundSchema})(SFt||(su.JsonSchema$=SFt={}));function Urn(t){return JSON.stringify(su.JsonSchema$outboundSchema.parse(t))}function zrn(t){return(0,qrn.safeParse)(t,e=>su.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var HNe=v(uu=>{"use strict";var Hrn=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]}),Vrn=uu&&uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wrn=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)&&Hrn(e,t,r);return Vrn(e,t),e};Object.defineProperty(uu,"__esModule",{value:!0});uu.ResponseFormats$=uu.ResponseFormats$outboundSchema=uu.ResponseFormats$inboundSchema=uu.ResponseFormats=void 0;var Krn=Wrn(Te());uu.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};uu.ResponseFormats$inboundSchema=Krn.nativeEnum(uu.ResponseFormats);uu.ResponseFormats$outboundSchema=uu.ResponseFormats$inboundSchema;var CFt;(function(t){t.inboundSchema=uu.ResponseFormats$inboundSchema,t.outboundSchema=uu.ResponseFormats$outboundSchema})(CFt||(uu.ResponseFormats$=CFt={}))});var IU=v(lu=>{"use strict";var Grn=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]}),Jrn=lu&&lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yrn=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)&&Grn(e,t,r);return Jrn(e,t),e};Object.defineProperty(lu,"__esModule",{value:!0});lu.ResponseFormat$=lu.ResponseFormat$outboundSchema=lu.ResponseFormat$inboundSchema=void 0;lu.responseFormatToJSON=Xrn;lu.responseFormatFromJSON=Qrn;var sse=Yrn(Te()),PFt=Ue(),Zrn=ve(),EFt=zNe(),TFt=HNe();lu.ResponseFormat$inboundSchema=sse.object({type:TFt.ResponseFormats$inboundSchema.optional(),json_schema:sse.nullable(EFt.JsonSchema$inboundSchema).optional()}).transform(t=>(0,PFt.remap)(t,{json_schema:"jsonSchema"}));lu.ResponseFormat$outboundSchema=sse.object({type:TFt.ResponseFormats$outboundSchema.optional(),jsonSchema:sse.nullable(EFt.JsonSchema$outboundSchema).optional()}).transform(t=>(0,PFt.remap)(t,{jsonSchema:"json_schema"}));var OFt;(function(t){t.inboundSchema=lu.ResponseFormat$inboundSchema,t.outboundSchema=lu.ResponseFormat$outboundSchema})(OFt||(lu.ResponseFormat$=OFt={}));function Xrn(t){return JSON.stringify(lu.ResponseFormat$outboundSchema.parse(t))}function Qrn(t){return(0,Zrn.safeParse)(t,e=>lu.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var hD=v(Tr=>{"use strict";var enn=Tr&&Tr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tnn=Tr&&Tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rnn=Tr&&Tr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&enn(e,t,r);return tnn(e,t),e};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.SystemMessage$=Tr.SystemMessage$outboundSchema=Tr.SystemMessage$inboundSchema=Tr.Role$=Tr.Role$outboundSchema=Tr.Role$inboundSchema=Tr.SystemMessageContent$=Tr.SystemMessageContent$outboundSchema=Tr.SystemMessageContent$inboundSchema=Tr.Role=void 0;Tr.systemMessageContentToJSON=nnn;Tr.systemMessageContentFromJSON=onn;Tr.systemMessageToJSON=inn;Tr.systemMessageFromJSON=ann;var Qf=rnn(Te()),RFt=ve(),use=ose();Tr.Role={System:"system"};Tr.SystemMessageContent$inboundSchema=Qf.union([Qf.string(),Qf.array(use.TextChunk$inboundSchema)]);Tr.SystemMessageContent$outboundSchema=Qf.union([Qf.string(),Qf.array(use.TextChunk$outboundSchema)]);var AFt;(function(t){t.inboundSchema=Tr.SystemMessageContent$inboundSchema,t.outboundSchema=Tr.SystemMessageContent$outboundSchema})(AFt||(Tr.SystemMessageContent$=AFt={}));function nnn(t){return JSON.stringify(Tr.SystemMessageContent$outboundSchema.parse(t))}function onn(t){return(0,RFt.safeParse)(t,e=>Tr.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}Tr.Role$inboundSchema=Qf.nativeEnum(Tr.Role);Tr.Role$outboundSchema=Tr.Role$inboundSchema;var IFt;(function(t){t.inboundSchema=Tr.Role$inboundSchema,t.outboundSchema=Tr.Role$outboundSchema})(IFt||(Tr.Role$=IFt={}));Tr.SystemMessage$inboundSchema=Qf.object({content:Qf.union([Qf.string(),Qf.array(use.TextChunk$inboundSchema)]),role:Tr.Role$inboundSchema.default("system")});Tr.SystemMessage$outboundSchema=Qf.object({content:Qf.union([Qf.string(),Qf.array(use.TextChunk$outboundSchema)]),role:Tr.Role$outboundSchema.default("system")});var MFt;(function(t){t.inboundSchema=Tr.SystemMessage$inboundSchema,t.outboundSchema=Tr.SystemMessage$outboundSchema})(MFt||(Tr.SystemMessage$=MFt={}));function inn(t){return JSON.stringify(Tr.SystemMessage$outboundSchema.parse(t))}function ann(t){return(0,RFt.safeParse)(t,e=>Tr.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var VNe=v(cu=>{"use strict";var snn=cu&&cu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),unn=cu&&cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lnn=cu&&cu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&snn(e,t,r);return unn(e,t),e};Object.defineProperty(cu,"__esModule",{value:!0});cu.FunctionT$=cu.FunctionT$outboundSchema=cu.FunctionT$inboundSchema=void 0;cu.functionToJSON=dnn;cu.functionFromJSON=fnn;var Dg=lnn(Te()),cnn=ve();cu.FunctionT$inboundSchema=Dg.object({name:Dg.string(),description:Dg.string().default(""),strict:Dg.boolean().default(!1),parameters:Dg.record(Dg.any())});cu.FunctionT$outboundSchema=Dg.object({name:Dg.string(),description:Dg.string().default(""),strict:Dg.boolean().default(!1),parameters:Dg.record(Dg.any())});var jFt;(function(t){t.inboundSchema=cu.FunctionT$inboundSchema,t.outboundSchema=cu.FunctionT$outboundSchema})(jFt||(cu.FunctionT$=jFt={}));function dnn(t){return JSON.stringify(cu.FunctionT$outboundSchema.parse(t))}function fnn(t){return(0,cnn.safeParse)(t,e=>cu.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var MU=v(du=>{"use strict";var pnn=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]}),mnn=du&&du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hnn=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)&&pnn(e,t,r);return mnn(e,t),e};Object.defineProperty(du,"__esModule",{value:!0});du.Tool$=du.Tool$outboundSchema=du.Tool$inboundSchema=void 0;du.toolToJSON=ynn;du.toolFromJSON=bnn;var DFt=hnn(Te()),gnn=ve(),LFt=VNe(),FFt=V5();du.Tool$inboundSchema=DFt.object({type:FFt.ToolTypes$inboundSchema.optional(),function:LFt.FunctionT$inboundSchema});du.Tool$outboundSchema=DFt.object({type:FFt.ToolTypes$outboundSchema.optional(),function:LFt.FunctionT$outboundSchema});var NFt;(function(t){t.inboundSchema=du.Tool$inboundSchema,t.outboundSchema=du.Tool$outboundSchema})(NFt||(du.Tool$=NFt={}));function ynn(t){return JSON.stringify(du.Tool$outboundSchema.parse(t))}function bnn(t){return(0,gnn.safeParse)(t,e=>du.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var WNe=v(fu=>{"use strict";var _nn=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]}),vnn=fu&&fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wnn=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)&&_nn(e,t,r);return vnn(e,t),e};Object.defineProperty(fu,"__esModule",{value:!0});fu.FunctionName$=fu.FunctionName$outboundSchema=fu.FunctionName$inboundSchema=void 0;fu.functionNameToJSON=xnn;fu.functionNameFromJSON=Cnn;var lse=wnn(Te()),Snn=ve();fu.FunctionName$inboundSchema=lse.object({name:lse.string()});fu.FunctionName$outboundSchema=lse.object({name:lse.string()});var kFt;(function(t){t.inboundSchema=fu.FunctionName$inboundSchema,t.outboundSchema=fu.FunctionName$outboundSchema})(kFt||(fu.FunctionName$=kFt={}));function xnn(t){return JSON.stringify(fu.FunctionName$outboundSchema.parse(t))}function Cnn(t){return(0,Snn.safeParse)(t,e=>fu.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var RU=v(pu=>{"use strict";var Onn=pu&&pu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pnn=pu&&pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Enn=pu&&pu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Onn(e,t,r);return Pnn(e,t),e};Object.defineProperty(pu,"__esModule",{value:!0});pu.ToolChoice$=pu.ToolChoice$outboundSchema=pu.ToolChoice$inboundSchema=void 0;pu.toolChoiceToJSON=Ann;pu.toolChoiceFromJSON=Inn;var BFt=Enn(Te()),Tnn=ve(),qFt=WNe(),UFt=V5();pu.ToolChoice$inboundSchema=BFt.object({type:UFt.ToolTypes$inboundSchema.optional(),function:qFt.FunctionName$inboundSchema});pu.ToolChoice$outboundSchema=BFt.object({type:UFt.ToolTypes$outboundSchema.optional(),function:qFt.FunctionName$outboundSchema});var $Ft;(function(t){t.inboundSchema=pu.ToolChoice$inboundSchema,t.outboundSchema=pu.ToolChoice$outboundSchema})($Ft||(pu.ToolChoice$=$Ft={}));function Ann(t){return JSON.stringify(pu.ToolChoice$outboundSchema.parse(t))}function Inn(t){return(0,Tnn.safeParse)(t,e=>pu.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var jU=v(mu=>{"use strict";var Mnn=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]}),Rnn=mu&&mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jnn=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)&&Mnn(e,t,r);return Rnn(e,t),e};Object.defineProperty(mu,"__esModule",{value:!0});mu.ToolChoiceEnum$=mu.ToolChoiceEnum$outboundSchema=mu.ToolChoiceEnum$inboundSchema=mu.ToolChoiceEnum=void 0;var Nnn=jnn(Te());mu.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};mu.ToolChoiceEnum$inboundSchema=Nnn.nativeEnum(mu.ToolChoiceEnum);mu.ToolChoiceEnum$outboundSchema=mu.ToolChoiceEnum$inboundSchema;var zFt;(function(t){t.inboundSchema=mu.ToolChoiceEnum$inboundSchema,t.outboundSchema=mu.ToolChoiceEnum$outboundSchema})(zFt||(mu.ToolChoiceEnum$=zFt={}))});var gD=v(Ar=>{"use strict";var Dnn=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]}),Lnn=Ar&&Ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fnn=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)&&Dnn(e,t,r);return Lnn(e,t),e};Object.defineProperty(Ar,"__esModule",{value:!0});Ar.ToolMessage$=Ar.ToolMessage$outboundSchema=Ar.ToolMessage$inboundSchema=Ar.ToolMessageRole$=Ar.ToolMessageRole$outboundSchema=Ar.ToolMessageRole$inboundSchema=Ar.ToolMessageContent$=Ar.ToolMessageContent$outboundSchema=Ar.ToolMessageContent$inboundSchema=Ar.ToolMessageRole=void 0;Ar.toolMessageContentToJSON=knn;Ar.toolMessageContentFromJSON=$nn;Ar.toolMessageToJSON=Bnn;Ar.toolMessageFromJSON=qnn;var ha=Fnn(Te()),KFt=Ue(),GFt=ve(),cse=EU();Ar.ToolMessageRole={Tool:"tool"};Ar.ToolMessageContent$inboundSchema=ha.union([ha.string(),ha.array(cse.ContentChunk$inboundSchema)]);Ar.ToolMessageContent$outboundSchema=ha.union([ha.string(),ha.array(cse.ContentChunk$outboundSchema)]);var HFt;(function(t){t.inboundSchema=Ar.ToolMessageContent$inboundSchema,t.outboundSchema=Ar.ToolMessageContent$outboundSchema})(HFt||(Ar.ToolMessageContent$=HFt={}));function knn(t){return JSON.stringify(Ar.ToolMessageContent$outboundSchema.parse(t))}function $nn(t){return(0,GFt.safeParse)(t,e=>Ar.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}Ar.ToolMessageRole$inboundSchema=ha.nativeEnum(Ar.ToolMessageRole);Ar.ToolMessageRole$outboundSchema=Ar.ToolMessageRole$inboundSchema;var VFt;(function(t){t.inboundSchema=Ar.ToolMessageRole$inboundSchema,t.outboundSchema=Ar.ToolMessageRole$outboundSchema})(VFt||(Ar.ToolMessageRole$=VFt={}));Ar.ToolMessage$inboundSchema=ha.object({content:ha.nullable(ha.union([ha.string(),ha.array(cse.ContentChunk$inboundSchema)])),tool_call_id:ha.nullable(ha.string()).optional(),name:ha.nullable(ha.string()).optional(),role:Ar.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,KFt.remap)(t,{tool_call_id:"toolCallId"}));Ar.ToolMessage$outboundSchema=ha.object({content:ha.nullable(ha.union([ha.string(),ha.array(cse.ContentChunk$outboundSchema)])),toolCallId:ha.nullable(ha.string()).optional(),name:ha.nullable(ha.string()).optional(),role:Ar.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,KFt.remap)(t,{toolCallId:"tool_call_id"}));var WFt;(function(t){t.inboundSchema=Ar.ToolMessage$inboundSchema,t.outboundSchema=Ar.ToolMessage$outboundSchema})(WFt||(Ar.ToolMessage$=WFt={}));function Bnn(t){return JSON.stringify(Ar.ToolMessage$outboundSchema.parse(t))}function qnn(t){return(0,GFt.safeParse)(t,e=>Ar.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var yD=v(Ir=>{"use strict";var Unn=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]}),znn=Ir&&Ir.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hnn=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)&&Unn(e,t,r);return znn(e,t),e};Object.defineProperty(Ir,"__esModule",{value:!0});Ir.UserMessage$=Ir.UserMessage$outboundSchema=Ir.UserMessage$inboundSchema=Ir.UserMessageRole$=Ir.UserMessageRole$outboundSchema=Ir.UserMessageRole$inboundSchema=Ir.UserMessageContent$=Ir.UserMessageContent$outboundSchema=Ir.UserMessageContent$inboundSchema=Ir.UserMessageRole=void 0;Ir.userMessageContentToJSON=Vnn;Ir.userMessageContentFromJSON=Wnn;Ir.userMessageToJSON=Knn;Ir.userMessageFromJSON=Gnn;var rd=Hnn(Te()),XFt=ve(),dse=EU();Ir.UserMessageRole={User:"user"};Ir.UserMessageContent$inboundSchema=rd.union([rd.string(),rd.array(dse.ContentChunk$inboundSchema)]);Ir.UserMessageContent$outboundSchema=rd.union([rd.string(),rd.array(dse.ContentChunk$outboundSchema)]);var JFt;(function(t){t.inboundSchema=Ir.UserMessageContent$inboundSchema,t.outboundSchema=Ir.UserMessageContent$outboundSchema})(JFt||(Ir.UserMessageContent$=JFt={}));function Vnn(t){return JSON.stringify(Ir.UserMessageContent$outboundSchema.parse(t))}function Wnn(t){return(0,XFt.safeParse)(t,e=>Ir.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}Ir.UserMessageRole$inboundSchema=rd.nativeEnum(Ir.UserMessageRole);Ir.UserMessageRole$outboundSchema=Ir.UserMessageRole$inboundSchema;var YFt;(function(t){t.inboundSchema=Ir.UserMessageRole$inboundSchema,t.outboundSchema=Ir.UserMessageRole$outboundSchema})(YFt||(Ir.UserMessageRole$=YFt={}));Ir.UserMessage$inboundSchema=rd.object({content:rd.nullable(rd.union([rd.string(),rd.array(dse.ContentChunk$inboundSchema)])),role:Ir.UserMessageRole$inboundSchema.default("user")});Ir.UserMessage$outboundSchema=rd.object({content:rd.nullable(rd.union([rd.string(),rd.array(dse.ContentChunk$outboundSchema)])),role:Ir.UserMessageRole$outboundSchema.default("user")});var ZFt;(function(t){t.inboundSchema=Ir.UserMessage$inboundSchema,t.outboundSchema=Ir.UserMessage$outboundSchema})(ZFt||(Ir.UserMessage$=ZFt={}));function Knn(t){return JSON.stringify(Ir.UserMessage$outboundSchema.parse(t))}function Gnn(t){return(0,XFt.safeParse)(t,e=>Ir.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var skt=v(Jt=>{"use strict";var Jnn=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]}),Ynn=Jt&&Jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Znn=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)&&Jnn(e,t,r);return Ynn(e,t),e};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.AgentsCompletionRequest$=Jt.AgentsCompletionRequest$outboundSchema=Jt.AgentsCompletionRequest$inboundSchema=Jt.AgentsCompletionRequestToolChoice$=Jt.AgentsCompletionRequestToolChoice$outboundSchema=Jt.AgentsCompletionRequestToolChoice$inboundSchema=Jt.AgentsCompletionRequestMessages$=Jt.AgentsCompletionRequestMessages$outboundSchema=Jt.AgentsCompletionRequestMessages$inboundSchema=Jt.AgentsCompletionRequestStop$=Jt.AgentsCompletionRequestStop$outboundSchema=Jt.AgentsCompletionRequestStop$inboundSchema=void 0;Jt.agentsCompletionRequestStopToJSON=Xnn;Jt.agentsCompletionRequestStopFromJSON=Qnn;Jt.agentsCompletionRequestMessagesToJSON=eon;Jt.agentsCompletionRequestMessagesFromJSON=ton;Jt.agentsCompletionRequestToolChoiceToJSON=ron;Jt.agentsCompletionRequestToolChoiceFromJSON=non;Jt.agentsCompletionRequestToJSON=oon;Jt.agentsCompletionRequestFromJSON=ion;var Xe=Znn(Te()),nkt=Ue(),fse=ve(),pse=qI(),okt=AU(),ikt=IU(),mse=hD(),akt=MU(),hse=RU(),gse=jU(),yse=gD(),bse=yD();Jt.AgentsCompletionRequestStop$inboundSchema=Xe.union([Xe.string(),Xe.array(Xe.string())]);Jt.AgentsCompletionRequestStop$outboundSchema=Xe.union([Xe.string(),Xe.array(Xe.string())]);var QFt;(function(t){t.inboundSchema=Jt.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=Jt.AgentsCompletionRequestStop$outboundSchema})(QFt||(Jt.AgentsCompletionRequestStop$=QFt={}));function Xnn(t){return JSON.stringify(Jt.AgentsCompletionRequestStop$outboundSchema.parse(t))}function Qnn(t){return(0,fse.safeParse)(t,e=>Jt.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}Jt.AgentsCompletionRequestMessages$inboundSchema=Xe.union([mse.SystemMessage$inboundSchema.and(Xe.object({role:Xe.literal("system")}).transform(t=>({role:t.role}))),bse.UserMessage$inboundSchema.and(Xe.object({role:Xe.literal("user")}).transform(t=>({role:t.role}))),pse.AssistantMessage$inboundSchema.and(Xe.object({role:Xe.literal("assistant")}).transform(t=>({role:t.role}))),yse.ToolMessage$inboundSchema.and(Xe.object({role:Xe.literal("tool")}).transform(t=>({role:t.role})))]);Jt.AgentsCompletionRequestMessages$outboundSchema=Xe.union([mse.SystemMessage$outboundSchema.and(Xe.object({role:Xe.literal("system")}).transform(t=>({role:t.role}))),bse.UserMessage$outboundSchema.and(Xe.object({role:Xe.literal("user")}).transform(t=>({role:t.role}))),pse.AssistantMessage$outboundSchema.and(Xe.object({role:Xe.literal("assistant")}).transform(t=>({role:t.role}))),yse.ToolMessage$outboundSchema.and(Xe.object({role:Xe.literal("tool")}).transform(t=>({role:t.role})))]);var ekt;(function(t){t.inboundSchema=Jt.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=Jt.AgentsCompletionRequestMessages$outboundSchema})(ekt||(Jt.AgentsCompletionRequestMessages$=ekt={}));function eon(t){return JSON.stringify(Jt.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function ton(t){return(0,fse.safeParse)(t,e=>Jt.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}Jt.AgentsCompletionRequestToolChoice$inboundSchema=Xe.union([hse.ToolChoice$inboundSchema,gse.ToolChoiceEnum$inboundSchema]);Jt.AgentsCompletionRequestToolChoice$outboundSchema=Xe.union([hse.ToolChoice$outboundSchema,gse.ToolChoiceEnum$outboundSchema]);var tkt;(function(t){t.inboundSchema=Jt.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Jt.AgentsCompletionRequestToolChoice$outboundSchema})(tkt||(Jt.AgentsCompletionRequestToolChoice$=tkt={}));function ron(t){return JSON.stringify(Jt.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function non(t){return(0,fse.safeParse)(t,e=>Jt.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}Jt.AgentsCompletionRequest$inboundSchema=Xe.object({max_tokens:Xe.nullable(Xe.number().int()).optional(),stream:Xe.boolean().default(!1),stop:Xe.union([Xe.string(),Xe.array(Xe.string())]).optional(),random_seed:Xe.nullable(Xe.number().int()).optional(),messages:Xe.array(Xe.union([mse.SystemMessage$inboundSchema.and(Xe.object({role:Xe.literal("system")}).transform(t=>({role:t.role}))),bse.UserMessage$inboundSchema.and(Xe.object({role:Xe.literal("user")}).transform(t=>({role:t.role}))),pse.AssistantMessage$inboundSchema.and(Xe.object({role:Xe.literal("assistant")}).transform(t=>({role:t.role}))),yse.ToolMessage$inboundSchema.and(Xe.object({role:Xe.literal("tool")}).transform(t=>({role:t.role})))])),response_format:ikt.ResponseFormat$inboundSchema.optional(),tools:Xe.nullable(Xe.array(akt.Tool$inboundSchema)).optional(),tool_choice:Xe.union([hse.ToolChoice$inboundSchema,gse.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Xe.number().optional(),frequency_penalty:Xe.number().optional(),n:Xe.nullable(Xe.number().int()).optional(),prediction:okt.Prediction$inboundSchema.optional(),agent_id:Xe.string()}).transform(t=>(0,nkt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));Jt.AgentsCompletionRequest$outboundSchema=Xe.object({maxTokens:Xe.nullable(Xe.number().int()).optional(),stream:Xe.boolean().default(!1),stop:Xe.union([Xe.string(),Xe.array(Xe.string())]).optional(),randomSeed:Xe.nullable(Xe.number().int()).optional(),messages:Xe.array(Xe.union([mse.SystemMessage$outboundSchema.and(Xe.object({role:Xe.literal("system")}).transform(t=>({role:t.role}))),bse.UserMessage$outboundSchema.and(Xe.object({role:Xe.literal("user")}).transform(t=>({role:t.role}))),pse.AssistantMessage$outboundSchema.and(Xe.object({role:Xe.literal("assistant")}).transform(t=>({role:t.role}))),yse.ToolMessage$outboundSchema.and(Xe.object({role:Xe.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:ikt.ResponseFormat$outboundSchema.optional(),tools:Xe.nullable(Xe.array(akt.Tool$outboundSchema)).optional(),toolChoice:Xe.union([hse.ToolChoice$outboundSchema,gse.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Xe.number().optional(),frequencyPenalty:Xe.number().optional(),n:Xe.nullable(Xe.number().int()).optional(),prediction:okt.Prediction$outboundSchema.optional(),agentId:Xe.string()}).transform(t=>(0,nkt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var rkt;(function(t){t.inboundSchema=Jt.AgentsCompletionRequest$inboundSchema,t.outboundSchema=Jt.AgentsCompletionRequest$outboundSchema})(rkt||(Jt.AgentsCompletionRequest$=rkt={}));function oon(t){return JSON.stringify(Jt.AgentsCompletionRequest$outboundSchema.parse(t))}function ion(t){return(0,fse.safeParse)(t,e=>Jt.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var gkt=v(Yt=>{"use strict";var aon=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]}),son=Yt&&Yt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uon=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)&&aon(e,t,r);return son(e,t),e};Object.defineProperty(Yt,"__esModule",{value:!0});Yt.AgentsCompletionStreamRequest$=Yt.AgentsCompletionStreamRequest$outboundSchema=Yt.AgentsCompletionStreamRequest$inboundSchema=Yt.AgentsCompletionStreamRequestToolChoice$=Yt.AgentsCompletionStreamRequestToolChoice$outboundSchema=Yt.AgentsCompletionStreamRequestToolChoice$inboundSchema=Yt.AgentsCompletionStreamRequestMessages$=Yt.AgentsCompletionStreamRequestMessages$outboundSchema=Yt.AgentsCompletionStreamRequestMessages$inboundSchema=Yt.AgentsCompletionStreamRequestStop$=Yt.AgentsCompletionStreamRequestStop$outboundSchema=Yt.AgentsCompletionStreamRequestStop$inboundSchema=void 0;Yt.agentsCompletionStreamRequestStopToJSON=lon;Yt.agentsCompletionStreamRequestStopFromJSON=con;Yt.agentsCompletionStreamRequestMessagesToJSON=don;Yt.agentsCompletionStreamRequestMessagesFromJSON=fon;Yt.agentsCompletionStreamRequestToolChoiceToJSON=pon;Yt.agentsCompletionStreamRequestToolChoiceFromJSON=mon;Yt.agentsCompletionStreamRequestToJSON=hon;Yt.agentsCompletionStreamRequestFromJSON=gon;var Qe=uon(Te()),fkt=Ue(),_se=ve(),vse=qI(),pkt=AU(),mkt=IU(),wse=hD(),hkt=MU(),Sse=RU(),xse=jU(),Cse=gD(),Ose=yD();Yt.AgentsCompletionStreamRequestStop$inboundSchema=Qe.union([Qe.string(),Qe.array(Qe.string())]);Yt.AgentsCompletionStreamRequestStop$outboundSchema=Qe.union([Qe.string(),Qe.array(Qe.string())]);var ukt;(function(t){t.inboundSchema=Yt.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Yt.AgentsCompletionStreamRequestStop$outboundSchema})(ukt||(Yt.AgentsCompletionStreamRequestStop$=ukt={}));function lon(t){return JSON.stringify(Yt.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function con(t){return(0,_se.safeParse)(t,e=>Yt.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}Yt.AgentsCompletionStreamRequestMessages$inboundSchema=Qe.union([wse.SystemMessage$inboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),Ose.UserMessage$inboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),vse.AssistantMessage$inboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role}))),Cse.ToolMessage$inboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role})))]);Yt.AgentsCompletionStreamRequestMessages$outboundSchema=Qe.union([wse.SystemMessage$outboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),Ose.UserMessage$outboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),vse.AssistantMessage$outboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role}))),Cse.ToolMessage$outboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role})))]);var lkt;(function(t){t.inboundSchema=Yt.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Yt.AgentsCompletionStreamRequestMessages$outboundSchema})(lkt||(Yt.AgentsCompletionStreamRequestMessages$=lkt={}));function don(t){return JSON.stringify(Yt.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function fon(t){return(0,_se.safeParse)(t,e=>Yt.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}Yt.AgentsCompletionStreamRequestToolChoice$inboundSchema=Qe.union([Sse.ToolChoice$inboundSchema,xse.ToolChoiceEnum$inboundSchema]);Yt.AgentsCompletionStreamRequestToolChoice$outboundSchema=Qe.union([Sse.ToolChoice$outboundSchema,xse.ToolChoiceEnum$outboundSchema]);var ckt;(function(t){t.inboundSchema=Yt.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Yt.AgentsCompletionStreamRequestToolChoice$outboundSchema})(ckt||(Yt.AgentsCompletionStreamRequestToolChoice$=ckt={}));function pon(t){return JSON.stringify(Yt.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function mon(t){return(0,_se.safeParse)(t,e=>Yt.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}Yt.AgentsCompletionStreamRequest$inboundSchema=Qe.object({max_tokens:Qe.nullable(Qe.number().int()).optional(),stream:Qe.boolean().default(!0),stop:Qe.union([Qe.string(),Qe.array(Qe.string())]).optional(),random_seed:Qe.nullable(Qe.number().int()).optional(),messages:Qe.array(Qe.union([wse.SystemMessage$inboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),Ose.UserMessage$inboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),vse.AssistantMessage$inboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role}))),Cse.ToolMessage$inboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role})))])),response_format:mkt.ResponseFormat$inboundSchema.optional(),tools:Qe.nullable(Qe.array(hkt.Tool$inboundSchema)).optional(),tool_choice:Qe.union([Sse.ToolChoice$inboundSchema,xse.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Qe.number().optional(),frequency_penalty:Qe.number().optional(),n:Qe.nullable(Qe.number().int()).optional(),prediction:pkt.Prediction$inboundSchema.optional(),agent_id:Qe.string()}).transform(t=>(0,fkt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));Yt.AgentsCompletionStreamRequest$outboundSchema=Qe.object({maxTokens:Qe.nullable(Qe.number().int()).optional(),stream:Qe.boolean().default(!0),stop:Qe.union([Qe.string(),Qe.array(Qe.string())]).optional(),randomSeed:Qe.nullable(Qe.number().int()).optional(),messages:Qe.array(Qe.union([wse.SystemMessage$outboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),Ose.UserMessage$outboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),vse.AssistantMessage$outboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role}))),Cse.ToolMessage$outboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:mkt.ResponseFormat$outboundSchema.optional(),tools:Qe.nullable(Qe.array(hkt.Tool$outboundSchema)).optional(),toolChoice:Qe.union([Sse.ToolChoice$outboundSchema,xse.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Qe.number().optional(),frequencyPenalty:Qe.number().optional(),n:Qe.nullable(Qe.number().int()).optional(),prediction:pkt.Prediction$outboundSchema.optional(),agentId:Qe.string()}).transform(t=>(0,fkt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var dkt;(function(t){t.inboundSchema=Yt.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=Yt.AgentsCompletionStreamRequest$outboundSchema})(dkt||(Yt.AgentsCompletionStreamRequest$=dkt={}));function hon(t){return JSON.stringify(Yt.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function gon(t){return(0,_se.safeParse)(t,e=>Yt.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var KNe=v(hu=>{"use strict";var yon=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]}),bon=hu&&hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_on=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)&&yon(e,t,r);return bon(e,t),e};Object.defineProperty(hu,"__esModule",{value:!0});hu.ApiEndpoint$=hu.ApiEndpoint$outboundSchema=hu.ApiEndpoint$inboundSchema=hu.ApiEndpoint=void 0;var bD=_on(Te()),von=BI();hu.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations"};hu.ApiEndpoint$inboundSchema=bD.union([bD.nativeEnum(hu.ApiEndpoint),bD.string().transform(von.catchUnrecognizedEnum)]);hu.ApiEndpoint$outboundSchema=bD.union([bD.nativeEnum(hu.ApiEndpoint),bD.string().and(bD.custom())]);var ykt;(function(t){t.inboundSchema=hu.ApiEndpoint$inboundSchema,t.outboundSchema=hu.ApiEndpoint$outboundSchema})(ykt||(hu.ApiEndpoint$=ykt={}))});var vkt=v(Mo=>{"use strict";var won=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]}),Son=Mo&&Mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xon=Mo&&Mo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&won(e,t,r);return Son(e,t),e};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.ArchiveFTModelOut$=Mo.ArchiveFTModelOut$outboundSchema=Mo.ArchiveFTModelOut$inboundSchema=Mo.ArchiveFTModelOutObject$=Mo.ArchiveFTModelOutObject$outboundSchema=Mo.ArchiveFTModelOutObject$inboundSchema=Mo.ArchiveFTModelOutObject=void 0;Mo.archiveFTModelOutToJSON=Oon;Mo.archiveFTModelOutFromJSON=Pon;var _P=xon(Te()),Con=ve();Mo.ArchiveFTModelOutObject={Model:"model"};Mo.ArchiveFTModelOutObject$inboundSchema=_P.nativeEnum(Mo.ArchiveFTModelOutObject);Mo.ArchiveFTModelOutObject$outboundSchema=Mo.ArchiveFTModelOutObject$inboundSchema;var bkt;(function(t){t.inboundSchema=Mo.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=Mo.ArchiveFTModelOutObject$outboundSchema})(bkt||(Mo.ArchiveFTModelOutObject$=bkt={}));Mo.ArchiveFTModelOut$inboundSchema=_P.object({id:_P.string(),object:_P.literal("model").default("model"),archived:_P.boolean().default(!0)});Mo.ArchiveFTModelOut$outboundSchema=_P.object({id:_P.string(),object:_P.literal("model").default("model"),archived:_P.boolean().default(!0)});var _kt;(function(t){t.inboundSchema=Mo.ArchiveFTModelOut$inboundSchema,t.outboundSchema=Mo.ArchiveFTModelOut$outboundSchema})(_kt||(Mo.ArchiveFTModelOut$=_kt={}));function Oon(t){return JSON.stringify(Mo.ArchiveFTModelOut$outboundSchema.parse(t))}function Pon(t){return(0,Con.safeParse)(t,e=>Mo.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var Pse=v(gu=>{"use strict";var Eon=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]}),Ton=gu&&gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Aon=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)&&Eon(e,t,r);return Ton(e,t),e};Object.defineProperty(gu,"__esModule",{value:!0});gu.ModelCapabilities$=gu.ModelCapabilities$outboundSchema=gu.ModelCapabilities$inboundSchema=void 0;gu.modelCapabilitiesToJSON=Mon;gu.modelCapabilitiesFromJSON=Ron;var Lg=Aon(Te()),Skt=Ue(),Ion=ve();gu.ModelCapabilities$inboundSchema=Lg.object({completion_chat:Lg.boolean().default(!0),completion_fim:Lg.boolean().default(!1),function_calling:Lg.boolean().default(!0),fine_tuning:Lg.boolean().default(!1),vision:Lg.boolean().default(!1)}).transform(t=>(0,Skt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));gu.ModelCapabilities$outboundSchema=Lg.object({completionChat:Lg.boolean().default(!0),completionFim:Lg.boolean().default(!1),functionCalling:Lg.boolean().default(!0),fineTuning:Lg.boolean().default(!1),vision:Lg.boolean().default(!1)}).transform(t=>(0,Skt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var wkt;(function(t){t.inboundSchema=gu.ModelCapabilities$inboundSchema,t.outboundSchema=gu.ModelCapabilities$outboundSchema})(wkt||(gu.ModelCapabilities$=wkt={}));function Mon(t){return JSON.stringify(gu.ModelCapabilities$outboundSchema.parse(t))}function Ron(t){return(0,Ion.safeParse)(t,e=>gu.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var GNe=v(Ro=>{"use strict";var jon=Ro&&Ro.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Non=Ro&&Ro.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Don=Ro&&Ro.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jon(e,t,r);return Non(e,t),e};Object.defineProperty(Ro,"__esModule",{value:!0});Ro.BaseModelCard$=Ro.BaseModelCard$outboundSchema=Ro.BaseModelCard$inboundSchema=Ro.Type$=Ro.Type$outboundSchema=Ro.Type$inboundSchema=Ro.Type=void 0;Ro.baseModelCardToJSON=Fon;Ro.baseModelCardFromJSON=kon;var Kn=Don(Te()),Okt=Ue(),Lon=ve(),Pkt=Pse();Ro.Type={Base:"base"};Ro.Type$inboundSchema=Kn.nativeEnum(Ro.Type);Ro.Type$outboundSchema=Ro.Type$inboundSchema;var xkt;(function(t){t.inboundSchema=Ro.Type$inboundSchema,t.outboundSchema=Ro.Type$outboundSchema})(xkt||(Ro.Type$=xkt={}));Ro.BaseModelCard$inboundSchema=Kn.object({id:Kn.string(),object:Kn.string().default("model"),created:Kn.number().int().optional(),owned_by:Kn.string().default("mistralai"),capabilities:Pkt.ModelCapabilities$inboundSchema,name:Kn.nullable(Kn.string()).optional(),description:Kn.nullable(Kn.string()).optional(),max_context_length:Kn.number().int().default(32768),aliases:Kn.array(Kn.string()).optional(),deprecation:Kn.nullable(Kn.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:Kn.nullable(Kn.number()).optional(),type:Kn.literal("base").default("base")}).transform(t=>(0,Okt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Ro.BaseModelCard$outboundSchema=Kn.object({id:Kn.string(),object:Kn.string().default("model"),created:Kn.number().int().optional(),ownedBy:Kn.string().default("mistralai"),capabilities:Pkt.ModelCapabilities$outboundSchema,name:Kn.nullable(Kn.string()).optional(),description:Kn.nullable(Kn.string()).optional(),maxContextLength:Kn.number().int().default(32768),aliases:Kn.array(Kn.string()).optional(),deprecation:Kn.nullable(Kn.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:Kn.nullable(Kn.number()).optional(),type:Kn.literal("base").default("base")}).transform(t=>(0,Okt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var Ckt;(function(t){t.inboundSchema=Ro.BaseModelCard$inboundSchema,t.outboundSchema=Ro.BaseModelCard$outboundSchema})(Ckt||(Ro.BaseModelCard$=Ckt={}));function Fon(t){return JSON.stringify(Ro.BaseModelCard$outboundSchema.parse(t))}function kon(t){return(0,Lon.safeParse)(t,e=>Ro.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var JNe=v(yu=>{"use strict";var $on=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]}),Bon=yu&&yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qon=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)&&$on(e,t,r);return Bon(e,t),e};Object.defineProperty(yu,"__esModule",{value:!0});yu.BatchError$=yu.BatchError$outboundSchema=yu.BatchError$inboundSchema=void 0;yu.batchErrorToJSON=zon;yu.batchErrorFromJSON=Hon;var NU=qon(Te()),Uon=ve();yu.BatchError$inboundSchema=NU.object({message:NU.string(),count:NU.number().int().default(1)});yu.BatchError$outboundSchema=NU.object({message:NU.string(),count:NU.number().int().default(1)});var Ekt;(function(t){t.inboundSchema=yu.BatchError$inboundSchema,t.outboundSchema=yu.BatchError$outboundSchema})(Ekt||(yu.BatchError$=Ekt={}));function zon(t){return JSON.stringify(yu.BatchError$outboundSchema.parse(t))}function Hon(t){return(0,Uon.safeParse)(t,e=>yu.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var Mkt=v(bu=>{"use strict";var Von=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]}),Won=bu&&bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kon=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)&&Von(e,t,r);return Won(e,t),e};Object.defineProperty(bu,"__esModule",{value:!0});bu.BatchJobIn$=bu.BatchJobIn$outboundSchema=bu.BatchJobIn$inboundSchema=void 0;bu.batchJobInToJSON=Jon;bu.batchJobInFromJSON=Yon;var uf=Kon(Te()),Akt=Ue(),Gon=ve(),Ikt=KNe();bu.BatchJobIn$inboundSchema=uf.object({input_files:uf.array(uf.string()),endpoint:Ikt.ApiEndpoint$inboundSchema,model:uf.string(),metadata:uf.nullable(uf.record(uf.string())).optional(),timeout_hours:uf.number().int().default(24)}).transform(t=>(0,Akt.remap)(t,{input_files:"inputFiles",timeout_hours:"timeoutHours"}));bu.BatchJobIn$outboundSchema=uf.object({inputFiles:uf.array(uf.string()),endpoint:Ikt.ApiEndpoint$outboundSchema,model:uf.string(),metadata:uf.nullable(uf.record(uf.string())).optional(),timeoutHours:uf.number().int().default(24)}).transform(t=>(0,Akt.remap)(t,{inputFiles:"input_files",timeoutHours:"timeout_hours"}));var Tkt;(function(t){t.inboundSchema=bu.BatchJobIn$inboundSchema,t.outboundSchema=bu.BatchJobIn$outboundSchema})(Tkt||(bu.BatchJobIn$=Tkt={}));function Jon(t){return JSON.stringify(bu.BatchJobIn$outboundSchema.parse(t))}function Yon(t){return(0,Gon.safeParse)(t,e=>bu.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var YNe=v(_u=>{"use strict";var Zon=_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]}),Xon=_u&&_u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qon=_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)&&Zon(e,t,r);return Xon(e,t),e};Object.defineProperty(_u,"__esModule",{value:!0});_u.BatchJobStatus$=_u.BatchJobStatus$outboundSchema=_u.BatchJobStatus$inboundSchema=_u.BatchJobStatus=void 0;var ein=Qon(Te());_u.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};_u.BatchJobStatus$inboundSchema=ein.nativeEnum(_u.BatchJobStatus);_u.BatchJobStatus$outboundSchema=_u.BatchJobStatus$inboundSchema;var Rkt;(function(t){t.inboundSchema=_u.BatchJobStatus$inboundSchema,t.outboundSchema=_u.BatchJobStatus$outboundSchema})(Rkt||(_u.BatchJobStatus$=Rkt={}))});var ZNe=v(jo=>{"use strict";var tin=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]}),rin=jo&&jo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nin=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)&&tin(e,t,r);return rin(e,t),e};Object.defineProperty(jo,"__esModule",{value:!0});jo.BatchJobOut$=jo.BatchJobOut$outboundSchema=jo.BatchJobOut$inboundSchema=jo.BatchJobOutObject$=jo.BatchJobOutObject$outboundSchema=jo.BatchJobOutObject$inboundSchema=jo.BatchJobOutObject=void 0;jo.batchJobOutToJSON=iin;jo.batchJobOutFromJSON=ain;var mr=nin(Te()),Dkt=Ue(),oin=ve(),Lkt=JNe(),Fkt=YNe();jo.BatchJobOutObject={Batch:"batch"};jo.BatchJobOutObject$inboundSchema=mr.nativeEnum(jo.BatchJobOutObject);jo.BatchJobOutObject$outboundSchema=jo.BatchJobOutObject$inboundSchema;var jkt;(function(t){t.inboundSchema=jo.BatchJobOutObject$inboundSchema,t.outboundSchema=jo.BatchJobOutObject$outboundSchema})(jkt||(jo.BatchJobOutObject$=jkt={}));jo.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(Lkt.BatchError$inboundSchema),status:Fkt.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,Dkt.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"}));jo.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(Lkt.BatchError$outboundSchema),status:Fkt.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,Dkt.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 Nkt;(function(t){t.inboundSchema=jo.BatchJobOut$inboundSchema,t.outboundSchema=jo.BatchJobOut$outboundSchema})(Nkt||(jo.BatchJobOut$=Nkt={}));function iin(t){return JSON.stringify(jo.BatchJobOut$outboundSchema.parse(t))}function ain(t){return(0,oin.safeParse)(t,e=>jo.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var qkt=v(No=>{"use strict";var sin=No&&No.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uin=No&&No.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lin=No&&No.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sin(e,t,r);return uin(e,t),e};Object.defineProperty(No,"__esModule",{value:!0});No.BatchJobsOut$=No.BatchJobsOut$outboundSchema=No.BatchJobsOut$inboundSchema=No.BatchJobsOutObject$=No.BatchJobsOutObject$outboundSchema=No.BatchJobsOutObject$inboundSchema=No.BatchJobsOutObject=void 0;No.batchJobsOutToJSON=din;No.batchJobsOutFromJSON=fin;var vP=lin(Te()),cin=ve(),Bkt=ZNe();No.BatchJobsOutObject={List:"list"};No.BatchJobsOutObject$inboundSchema=vP.nativeEnum(No.BatchJobsOutObject);No.BatchJobsOutObject$outboundSchema=No.BatchJobsOutObject$inboundSchema;var kkt;(function(t){t.inboundSchema=No.BatchJobsOutObject$inboundSchema,t.outboundSchema=No.BatchJobsOutObject$outboundSchema})(kkt||(No.BatchJobsOutObject$=kkt={}));No.BatchJobsOut$inboundSchema=vP.object({data:vP.array(Bkt.BatchJobOut$inboundSchema).optional(),object:vP.literal("list").default("list"),total:vP.number().int()});No.BatchJobsOut$outboundSchema=vP.object({data:vP.array(Bkt.BatchJobOut$outboundSchema).optional(),object:vP.literal("list").default("list"),total:vP.number().int()});var $kt;(function(t){t.inboundSchema=No.BatchJobsOut$inboundSchema,t.outboundSchema=No.BatchJobsOut$outboundSchema})($kt||(No.BatchJobsOut$=$kt={}));function din(t){return JSON.stringify(No.BatchJobsOut$outboundSchema.parse(t))}function fin(t){return(0,cin.safeParse)(t,e=>No.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var Kkt=v(Zt=>{"use strict";var pin=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]}),min=Zt&&Zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hin=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)&&pin(e,t,r);return min(e,t),e};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.ChatClassificationRequest$=Zt.ChatClassificationRequest$outboundSchema=Zt.ChatClassificationRequest$inboundSchema=Zt.ChatClassificationRequestInputs$=Zt.ChatClassificationRequestInputs$outboundSchema=Zt.ChatClassificationRequestInputs$inboundSchema=Zt.One$=Zt.One$outboundSchema=Zt.One$inboundSchema=Zt.Two$=Zt.Two$outboundSchema=Zt.Two$inboundSchema=void 0;Zt.twoToJSON=gin;Zt.twoFromJSON=yin;Zt.oneToJSON=bin;Zt.oneFromJSON=_in;Zt.chatClassificationRequestInputsToJSON=vin;Zt.chatClassificationRequestInputsFromJSON=win;Zt.chatClassificationRequestToJSON=Sin;Zt.chatClassificationRequestFromJSON=xin;var ye=hin(Te()),Wkt=Ue(),Ese=ve(),Fg=qI(),kg=hD(),$g=gD(),Bg=yD();Zt.Two$inboundSchema=ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);Zt.Two$outboundSchema=ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);var Ukt;(function(t){t.inboundSchema=Zt.Two$inboundSchema,t.outboundSchema=Zt.Two$outboundSchema})(Ukt||(Zt.Two$=Ukt={}));function gin(t){return JSON.stringify(Zt.Two$outboundSchema.parse(t))}function yin(t){return(0,Ese.safeParse)(t,e=>Zt.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}Zt.One$inboundSchema=ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);Zt.One$outboundSchema=ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);var zkt;(function(t){t.inboundSchema=Zt.One$inboundSchema,t.outboundSchema=Zt.One$outboundSchema})(zkt||(Zt.One$=zkt={}));function bin(t){return JSON.stringify(Zt.One$outboundSchema.parse(t))}function _in(t){return(0,Ese.safeParse)(t,e=>Zt.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}Zt.ChatClassificationRequestInputs$inboundSchema=ye.union([ye.array(ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]);Zt.ChatClassificationRequestInputs$outboundSchema=ye.union([ye.array(ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]);var Hkt;(function(t){t.inboundSchema=Zt.ChatClassificationRequestInputs$inboundSchema,t.outboundSchema=Zt.ChatClassificationRequestInputs$outboundSchema})(Hkt||(Zt.ChatClassificationRequestInputs$=Hkt={}));function vin(t){return JSON.stringify(Zt.ChatClassificationRequestInputs$outboundSchema.parse(t))}function win(t){return(0,Ese.safeParse)(t,e=>Zt.ChatClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequestInputs' from JSON")}Zt.ChatClassificationRequest$inboundSchema=ye.object({input:ye.union([ye.array(ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]),model:ye.nullable(ye.string())}).transform(t=>(0,Wkt.remap)(t,{input:"inputs"}));Zt.ChatClassificationRequest$outboundSchema=ye.object({inputs:ye.union([ye.array(ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]),model:ye.nullable(ye.string())}).transform(t=>(0,Wkt.remap)(t,{inputs:"input"}));var Vkt;(function(t){t.inboundSchema=Zt.ChatClassificationRequest$inboundSchema,t.outboundSchema=Zt.ChatClassificationRequest$outboundSchema})(Vkt||(Zt.ChatClassificationRequest$=Vkt={}));function Sin(t){return JSON.stringify(Zt.ChatClassificationRequest$outboundSchema.parse(t))}function xin(t){return(0,Ese.safeParse)(t,e=>Zt.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var Tse=v(lo=>{"use strict";var Cin=lo&&lo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Oin=lo&&lo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pin=lo&&lo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Cin(e,t,r);return Oin(e,t),e};Object.defineProperty(lo,"__esModule",{value:!0});lo.ChatCompletionChoice$=lo.ChatCompletionChoice$outboundSchema=lo.ChatCompletionChoice$inboundSchema=lo.FinishReason$=lo.FinishReason$outboundSchema=lo.FinishReason$inboundSchema=lo.FinishReason=void 0;lo.chatCompletionChoiceToJSON=Ain;lo.chatCompletionChoiceFromJSON=Iin;var pb=Pin(Te()),Ykt=Ue(),Ein=ve(),Tin=BI(),Zkt=qI();lo.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};lo.FinishReason$inboundSchema=pb.union([pb.nativeEnum(lo.FinishReason),pb.string().transform(Tin.catchUnrecognizedEnum)]);lo.FinishReason$outboundSchema=pb.union([pb.nativeEnum(lo.FinishReason),pb.string().and(pb.custom())]);var Gkt;(function(t){t.inboundSchema=lo.FinishReason$inboundSchema,t.outboundSchema=lo.FinishReason$outboundSchema})(Gkt||(lo.FinishReason$=Gkt={}));lo.ChatCompletionChoice$inboundSchema=pb.object({index:pb.number().int(),message:Zkt.AssistantMessage$inboundSchema,finish_reason:lo.FinishReason$inboundSchema}).transform(t=>(0,Ykt.remap)(t,{finish_reason:"finishReason"}));lo.ChatCompletionChoice$outboundSchema=pb.object({index:pb.number().int(),message:Zkt.AssistantMessage$outboundSchema,finishReason:lo.FinishReason$outboundSchema}).transform(t=>(0,Ykt.remap)(t,{finishReason:"finish_reason"}));var Jkt;(function(t){t.inboundSchema=lo.ChatCompletionChoice$inboundSchema,t.outboundSchema=lo.ChatCompletionChoice$outboundSchema})(Jkt||(lo.ChatCompletionChoice$=Jkt={}));function Ain(t){return JSON.stringify(lo.ChatCompletionChoice$outboundSchema.parse(t))}function Iin(t){return(0,Ein.safeParse)(t,e=>lo.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var a$t=v(Xt=>{"use strict";var Min=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]}),Rin=Xt&&Xt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jin=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)&&Min(e,t,r);return Rin(e,t),e};Object.defineProperty(Xt,"__esModule",{value:!0});Xt.ChatCompletionRequest$=Xt.ChatCompletionRequest$outboundSchema=Xt.ChatCompletionRequest$inboundSchema=Xt.ChatCompletionRequestToolChoice$=Xt.ChatCompletionRequestToolChoice$outboundSchema=Xt.ChatCompletionRequestToolChoice$inboundSchema=Xt.Messages$=Xt.Messages$outboundSchema=Xt.Messages$inboundSchema=Xt.Stop$=Xt.Stop$outboundSchema=Xt.Stop$inboundSchema=void 0;Xt.stopToJSON=Nin;Xt.stopFromJSON=Din;Xt.messagesToJSON=Lin;Xt.messagesFromJSON=Fin;Xt.chatCompletionRequestToolChoiceToJSON=kin;Xt.chatCompletionRequestToolChoiceFromJSON=$in;Xt.chatCompletionRequestToJSON=Bin;Xt.chatCompletionRequestFromJSON=qin;var ke=jin(Te()),r$t=Ue(),Ase=ve(),Ise=qI(),n$t=AU(),o$t=IU(),Mse=hD(),i$t=MU(),Rse=RU(),jse=jU(),Nse=gD(),Dse=yD();Xt.Stop$inboundSchema=ke.union([ke.string(),ke.array(ke.string())]);Xt.Stop$outboundSchema=ke.union([ke.string(),ke.array(ke.string())]);var Xkt;(function(t){t.inboundSchema=Xt.Stop$inboundSchema,t.outboundSchema=Xt.Stop$outboundSchema})(Xkt||(Xt.Stop$=Xkt={}));function Nin(t){return JSON.stringify(Xt.Stop$outboundSchema.parse(t))}function Din(t){return(0,Ase.safeParse)(t,e=>Xt.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}Xt.Messages$inboundSchema=ke.union([Mse.SystemMessage$inboundSchema.and(ke.object({role:ke.literal("system")}).transform(t=>({role:t.role}))),Dse.UserMessage$inboundSchema.and(ke.object({role:ke.literal("user")}).transform(t=>({role:t.role}))),Ise.AssistantMessage$inboundSchema.and(ke.object({role:ke.literal("assistant")}).transform(t=>({role:t.role}))),Nse.ToolMessage$inboundSchema.and(ke.object({role:ke.literal("tool")}).transform(t=>({role:t.role})))]);Xt.Messages$outboundSchema=ke.union([Mse.SystemMessage$outboundSchema.and(ke.object({role:ke.literal("system")}).transform(t=>({role:t.role}))),Dse.UserMessage$outboundSchema.and(ke.object({role:ke.literal("user")}).transform(t=>({role:t.role}))),Ise.AssistantMessage$outboundSchema.and(ke.object({role:ke.literal("assistant")}).transform(t=>({role:t.role}))),Nse.ToolMessage$outboundSchema.and(ke.object({role:ke.literal("tool")}).transform(t=>({role:t.role})))]);var Qkt;(function(t){t.inboundSchema=Xt.Messages$inboundSchema,t.outboundSchema=Xt.Messages$outboundSchema})(Qkt||(Xt.Messages$=Qkt={}));function Lin(t){return JSON.stringify(Xt.Messages$outboundSchema.parse(t))}function Fin(t){return(0,Ase.safeParse)(t,e=>Xt.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}Xt.ChatCompletionRequestToolChoice$inboundSchema=ke.union([Rse.ToolChoice$inboundSchema,jse.ToolChoiceEnum$inboundSchema]);Xt.ChatCompletionRequestToolChoice$outboundSchema=ke.union([Rse.ToolChoice$outboundSchema,jse.ToolChoiceEnum$outboundSchema]);var e$t;(function(t){t.inboundSchema=Xt.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Xt.ChatCompletionRequestToolChoice$outboundSchema})(e$t||(Xt.ChatCompletionRequestToolChoice$=e$t={}));function kin(t){return JSON.stringify(Xt.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function $in(t){return(0,Ase.safeParse)(t,e=>Xt.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}Xt.ChatCompletionRequest$inboundSchema=ke.object({model:ke.nullable(ke.string()),temperature:ke.nullable(ke.number()).optional(),top_p:ke.number().optional(),max_tokens:ke.nullable(ke.number().int()).optional(),stream:ke.boolean().default(!1),stop:ke.union([ke.string(),ke.array(ke.string())]).optional(),random_seed:ke.nullable(ke.number().int()).optional(),messages:ke.array(ke.union([Mse.SystemMessage$inboundSchema.and(ke.object({role:ke.literal("system")}).transform(t=>({role:t.role}))),Dse.UserMessage$inboundSchema.and(ke.object({role:ke.literal("user")}).transform(t=>({role:t.role}))),Ise.AssistantMessage$inboundSchema.and(ke.object({role:ke.literal("assistant")}).transform(t=>({role:t.role}))),Nse.ToolMessage$inboundSchema.and(ke.object({role:ke.literal("tool")}).transform(t=>({role:t.role})))])),response_format:o$t.ResponseFormat$inboundSchema.optional(),tools:ke.nullable(ke.array(i$t.Tool$inboundSchema)).optional(),tool_choice:ke.union([Rse.ToolChoice$inboundSchema,jse.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:ke.number().optional(),frequency_penalty:ke.number().optional(),n:ke.nullable(ke.number().int()).optional(),prediction:n$t.Prediction$inboundSchema.optional(),safe_prompt:ke.boolean().optional()}).transform(t=>(0,r$t.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"}));Xt.ChatCompletionRequest$outboundSchema=ke.object({model:ke.nullable(ke.string()),temperature:ke.nullable(ke.number()).optional(),topP:ke.number().optional(),maxTokens:ke.nullable(ke.number().int()).optional(),stream:ke.boolean().default(!1),stop:ke.union([ke.string(),ke.array(ke.string())]).optional(),randomSeed:ke.nullable(ke.number().int()).optional(),messages:ke.array(ke.union([Mse.SystemMessage$outboundSchema.and(ke.object({role:ke.literal("system")}).transform(t=>({role:t.role}))),Dse.UserMessage$outboundSchema.and(ke.object({role:ke.literal("user")}).transform(t=>({role:t.role}))),Ise.AssistantMessage$outboundSchema.and(ke.object({role:ke.literal("assistant")}).transform(t=>({role:t.role}))),Nse.ToolMessage$outboundSchema.and(ke.object({role:ke.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:o$t.ResponseFormat$outboundSchema.optional(),tools:ke.nullable(ke.array(i$t.Tool$outboundSchema)).optional(),toolChoice:ke.union([Rse.ToolChoice$outboundSchema,jse.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:ke.number().optional(),frequencyPenalty:ke.number().optional(),n:ke.nullable(ke.number().int()).optional(),prediction:n$t.Prediction$outboundSchema.optional(),safePrompt:ke.boolean().optional()}).transform(t=>(0,r$t.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 t$t;(function(t){t.inboundSchema=Xt.ChatCompletionRequest$inboundSchema,t.outboundSchema=Xt.ChatCompletionRequest$outboundSchema})(t$t||(Xt.ChatCompletionRequest$=t$t={}));function Bin(t){return JSON.stringify(Xt.ChatCompletionRequest$outboundSchema.parse(t))}function qin(t){return(0,Ase.safeParse)(t,e=>Xt.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var DU=v(vu=>{"use strict";var Uin=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]}),zin=vu&&vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hin=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)&&Uin(e,t,r);return zin(e,t),e};Object.defineProperty(vu,"__esModule",{value:!0});vu.UsageInfo$=vu.UsageInfo$outboundSchema=vu.UsageInfo$inboundSchema=void 0;vu.usageInfoToJSON=Win;vu.usageInfoFromJSON=Kin;var UI=Hin(Te()),u$t=Ue(),Vin=ve();vu.UsageInfo$inboundSchema=UI.object({prompt_tokens:UI.number().int(),completion_tokens:UI.number().int(),total_tokens:UI.number().int()}).transform(t=>(0,u$t.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens"}));vu.UsageInfo$outboundSchema=UI.object({promptTokens:UI.number().int(),completionTokens:UI.number().int(),totalTokens:UI.number().int()}).transform(t=>(0,u$t.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens"}));var s$t;(function(t){t.inboundSchema=vu.UsageInfo$inboundSchema,t.outboundSchema=vu.UsageInfo$outboundSchema})(s$t||(vu.UsageInfo$=s$t={}));function Win(t){return JSON.stringify(vu.UsageInfo$outboundSchema.parse(t))}function Kin(t){return(0,Vin.safeParse)(t,e=>vu.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var f$t=v(wu=>{"use strict";var Gin=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]}),Jin=wu&&wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yin=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)&&Gin(e,t,r);return Jin(e,t),e};Object.defineProperty(wu,"__esModule",{value:!0});wu.ChatCompletionResponse$=wu.ChatCompletionResponse$outboundSchema=wu.ChatCompletionResponse$inboundSchema=void 0;wu.chatCompletionResponseToJSON=Xin;wu.chatCompletionResponseFromJSON=Qin;var qg=Yin(Te()),Zin=ve(),c$t=Tse(),d$t=DU();wu.ChatCompletionResponse$inboundSchema=qg.object({id:qg.string(),object:qg.string(),model:qg.string(),usage:d$t.UsageInfo$inboundSchema,created:qg.number().int().optional(),choices:qg.array(c$t.ChatCompletionChoice$inboundSchema).optional()});wu.ChatCompletionResponse$outboundSchema=qg.object({id:qg.string(),object:qg.string(),model:qg.string(),usage:d$t.UsageInfo$outboundSchema,created:qg.number().int().optional(),choices:qg.array(c$t.ChatCompletionChoice$outboundSchema).optional()});var l$t;(function(t){t.inboundSchema=wu.ChatCompletionResponse$inboundSchema,t.outboundSchema=wu.ChatCompletionResponse$outboundSchema})(l$t||(wu.ChatCompletionResponse$=l$t={}));function Xin(t){return JSON.stringify(wu.ChatCompletionResponse$outboundSchema.parse(t))}function Qin(t){return(0,Zin.safeParse)(t,e=>wu.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var w$t=v(Qt=>{"use strict";var ean=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]}),tan=Qt&&Qt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ran=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)&&ean(e,t,r);return tan(e,t),e};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.ChatCompletionStreamRequest$=Qt.ChatCompletionStreamRequest$outboundSchema=Qt.ChatCompletionStreamRequest$inboundSchema=Qt.ChatCompletionStreamRequestToolChoice$=Qt.ChatCompletionStreamRequestToolChoice$outboundSchema=Qt.ChatCompletionStreamRequestToolChoice$inboundSchema=Qt.ChatCompletionStreamRequestMessages$=Qt.ChatCompletionStreamRequestMessages$outboundSchema=Qt.ChatCompletionStreamRequestMessages$inboundSchema=Qt.ChatCompletionStreamRequestStop$=Qt.ChatCompletionStreamRequestStop$outboundSchema=Qt.ChatCompletionStreamRequestStop$inboundSchema=void 0;Qt.chatCompletionStreamRequestStopToJSON=nan;Qt.chatCompletionStreamRequestStopFromJSON=oan;Qt.chatCompletionStreamRequestMessagesToJSON=ian;Qt.chatCompletionStreamRequestMessagesFromJSON=aan;Qt.chatCompletionStreamRequestToolChoiceToJSON=san;Qt.chatCompletionStreamRequestToolChoiceFromJSON=uan;Qt.chatCompletionStreamRequestToJSON=lan;Qt.chatCompletionStreamRequestFromJSON=can;var $e=ran(Te()),y$t=Ue(),Lse=ve(),Fse=qI(),b$t=AU(),_$t=IU(),kse=hD(),v$t=MU(),$se=RU(),Bse=jU(),qse=gD(),Use=yD();Qt.ChatCompletionStreamRequestStop$inboundSchema=$e.union([$e.string(),$e.array($e.string())]);Qt.ChatCompletionStreamRequestStop$outboundSchema=$e.union([$e.string(),$e.array($e.string())]);var p$t;(function(t){t.inboundSchema=Qt.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Qt.ChatCompletionStreamRequestStop$outboundSchema})(p$t||(Qt.ChatCompletionStreamRequestStop$=p$t={}));function nan(t){return JSON.stringify(Qt.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function oan(t){return(0,Lse.safeParse)(t,e=>Qt.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}Qt.ChatCompletionStreamRequestMessages$inboundSchema=$e.union([kse.SystemMessage$inboundSchema.and($e.object({role:$e.literal("system")}).transform(t=>({role:t.role}))),Use.UserMessage$inboundSchema.and($e.object({role:$e.literal("user")}).transform(t=>({role:t.role}))),Fse.AssistantMessage$inboundSchema.and($e.object({role:$e.literal("assistant")}).transform(t=>({role:t.role}))),qse.ToolMessage$inboundSchema.and($e.object({role:$e.literal("tool")}).transform(t=>({role:t.role})))]);Qt.ChatCompletionStreamRequestMessages$outboundSchema=$e.union([kse.SystemMessage$outboundSchema.and($e.object({role:$e.literal("system")}).transform(t=>({role:t.role}))),Use.UserMessage$outboundSchema.and($e.object({role:$e.literal("user")}).transform(t=>({role:t.role}))),Fse.AssistantMessage$outboundSchema.and($e.object({role:$e.literal("assistant")}).transform(t=>({role:t.role}))),qse.ToolMessage$outboundSchema.and($e.object({role:$e.literal("tool")}).transform(t=>({role:t.role})))]);var m$t;(function(t){t.inboundSchema=Qt.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Qt.ChatCompletionStreamRequestMessages$outboundSchema})(m$t||(Qt.ChatCompletionStreamRequestMessages$=m$t={}));function ian(t){return JSON.stringify(Qt.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function aan(t){return(0,Lse.safeParse)(t,e=>Qt.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}Qt.ChatCompletionStreamRequestToolChoice$inboundSchema=$e.union([$se.ToolChoice$inboundSchema,Bse.ToolChoiceEnum$inboundSchema]);Qt.ChatCompletionStreamRequestToolChoice$outboundSchema=$e.union([$se.ToolChoice$outboundSchema,Bse.ToolChoiceEnum$outboundSchema]);var h$t;(function(t){t.inboundSchema=Qt.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Qt.ChatCompletionStreamRequestToolChoice$outboundSchema})(h$t||(Qt.ChatCompletionStreamRequestToolChoice$=h$t={}));function san(t){return JSON.stringify(Qt.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function uan(t){return(0,Lse.safeParse)(t,e=>Qt.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}Qt.ChatCompletionStreamRequest$inboundSchema=$e.object({model:$e.nullable($e.string()),temperature:$e.nullable($e.number()).optional(),top_p:$e.number().optional(),max_tokens:$e.nullable($e.number().int()).optional(),stream:$e.boolean().default(!0),stop:$e.union([$e.string(),$e.array($e.string())]).optional(),random_seed:$e.nullable($e.number().int()).optional(),messages:$e.array($e.union([kse.SystemMessage$inboundSchema.and($e.object({role:$e.literal("system")}).transform(t=>({role:t.role}))),Use.UserMessage$inboundSchema.and($e.object({role:$e.literal("user")}).transform(t=>({role:t.role}))),Fse.AssistantMessage$inboundSchema.and($e.object({role:$e.literal("assistant")}).transform(t=>({role:t.role}))),qse.ToolMessage$inboundSchema.and($e.object({role:$e.literal("tool")}).transform(t=>({role:t.role})))])),response_format:_$t.ResponseFormat$inboundSchema.optional(),tools:$e.nullable($e.array(v$t.Tool$inboundSchema)).optional(),tool_choice:$e.union([$se.ToolChoice$inboundSchema,Bse.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:$e.number().optional(),frequency_penalty:$e.number().optional(),n:$e.nullable($e.number().int()).optional(),prediction:b$t.Prediction$inboundSchema.optional(),safe_prompt:$e.boolean().optional()}).transform(t=>(0,y$t.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"}));Qt.ChatCompletionStreamRequest$outboundSchema=$e.object({model:$e.nullable($e.string()),temperature:$e.nullable($e.number()).optional(),topP:$e.number().optional(),maxTokens:$e.nullable($e.number().int()).optional(),stream:$e.boolean().default(!0),stop:$e.union([$e.string(),$e.array($e.string())]).optional(),randomSeed:$e.nullable($e.number().int()).optional(),messages:$e.array($e.union([kse.SystemMessage$outboundSchema.and($e.object({role:$e.literal("system")}).transform(t=>({role:t.role}))),Use.UserMessage$outboundSchema.and($e.object({role:$e.literal("user")}).transform(t=>({role:t.role}))),Fse.AssistantMessage$outboundSchema.and($e.object({role:$e.literal("assistant")}).transform(t=>({role:t.role}))),qse.ToolMessage$outboundSchema.and($e.object({role:$e.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:_$t.ResponseFormat$outboundSchema.optional(),tools:$e.nullable($e.array(v$t.Tool$outboundSchema)).optional(),toolChoice:$e.union([$se.ToolChoice$outboundSchema,Bse.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:$e.number().optional(),frequencyPenalty:$e.number().optional(),n:$e.nullable($e.number().int()).optional(),prediction:b$t.Prediction$outboundSchema.optional(),safePrompt:$e.boolean().optional()}).transform(t=>(0,y$t.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 g$t;(function(t){t.inboundSchema=Qt.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=Qt.ChatCompletionStreamRequest$outboundSchema})(g$t||(Qt.ChatCompletionStreamRequest$=g$t={}));function lan(t){return JSON.stringify(Qt.ChatCompletionStreamRequest$outboundSchema.parse(t))}function can(t){return(0,Lse.safeParse)(t,e=>Qt.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var XNe=v(Su=>{"use strict";var dan=Su&&Su.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fan=Su&&Su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pan=Su&&Su.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dan(e,t,r);return fan(e,t),e};Object.defineProperty(Su,"__esModule",{value:!0});Su.MetricOut$=Su.MetricOut$outboundSchema=Su.MetricOut$inboundSchema=void 0;Su.metricOutToJSON=han;Su.metricOutFromJSON=gan;var rm=pan(Te()),x$t=Ue(),man=ve();Su.MetricOut$inboundSchema=rm.object({train_loss:rm.nullable(rm.number()).optional(),valid_loss:rm.nullable(rm.number()).optional(),valid_mean_token_accuracy:rm.nullable(rm.number()).optional()}).transform(t=>(0,x$t.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));Su.MetricOut$outboundSchema=rm.object({trainLoss:rm.nullable(rm.number()).optional(),validLoss:rm.nullable(rm.number()).optional(),validMeanTokenAccuracy:rm.nullable(rm.number()).optional()}).transform(t=>(0,x$t.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var S$t;(function(t){t.inboundSchema=Su.MetricOut$inboundSchema,t.outboundSchema=Su.MetricOut$outboundSchema})(S$t||(Su.MetricOut$=S$t={}));function han(t){return JSON.stringify(Su.MetricOut$outboundSchema.parse(t))}function gan(t){return(0,man.safeParse)(t,e=>Su.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var QNe=v(xu=>{"use strict";var yan=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]}),ban=xu&&xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_an=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)&&yan(e,t,r);return ban(e,t),e};Object.defineProperty(xu,"__esModule",{value:!0});xu.CheckpointOut$=xu.CheckpointOut$outboundSchema=xu.CheckpointOut$inboundSchema=void 0;xu.checkpointOutToJSON=wan;xu.checkpointOutFromJSON=San;var LU=_an(Te()),O$t=Ue(),van=ve(),P$t=XNe();xu.CheckpointOut$inboundSchema=LU.object({metrics:P$t.MetricOut$inboundSchema,step_number:LU.number().int(),created_at:LU.number().int()}).transform(t=>(0,O$t.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));xu.CheckpointOut$outboundSchema=LU.object({metrics:P$t.MetricOut$outboundSchema,stepNumber:LU.number().int(),createdAt:LU.number().int()}).transform(t=>(0,O$t.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var C$t;(function(t){t.inboundSchema=xu.CheckpointOut$inboundSchema,t.outboundSchema=xu.CheckpointOut$outboundSchema})(C$t||(xu.CheckpointOut$=C$t={}));function wan(t){return JSON.stringify(xu.CheckpointOut$outboundSchema.parse(t))}function San(t){return(0,van.safeParse)(t,e=>xu.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var eDe=v(Cu=>{"use strict";var xan=Cu&&Cu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Can=Cu&&Cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Oan=Cu&&Cu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xan(e,t,r);return Can(e,t),e};Object.defineProperty(Cu,"__esModule",{value:!0});Cu.ClassificationObject$=Cu.ClassificationObject$outboundSchema=Cu.ClassificationObject$inboundSchema=void 0;Cu.classificationObjectToJSON=Ean;Cu.classificationObjectFromJSON=Tan;var qx=Oan(Te()),T$t=Ue(),Pan=ve();Cu.ClassificationObject$inboundSchema=qx.object({categories:qx.record(qx.boolean()).optional(),category_scores:qx.record(qx.number()).optional()}).transform(t=>(0,T$t.remap)(t,{category_scores:"categoryScores"}));Cu.ClassificationObject$outboundSchema=qx.object({categories:qx.record(qx.boolean()).optional(),categoryScores:qx.record(qx.number()).optional()}).transform(t=>(0,T$t.remap)(t,{categoryScores:"category_scores"}));var E$t;(function(t){t.inboundSchema=Cu.ClassificationObject$inboundSchema,t.outboundSchema=Cu.ClassificationObject$outboundSchema})(E$t||(Cu.ClassificationObject$=E$t={}));function Ean(t){return JSON.stringify(Cu.ClassificationObject$outboundSchema.parse(t))}function Tan(t){return(0,Pan.safeParse)(t,e=>Cu.ClassificationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationObject' from JSON")}});var j$t=v(Do=>{"use strict";var Aan=Do&&Do.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ian=Do&&Do.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Man=Do&&Do.__importStar||function(t){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 Ian(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.ClassificationRequest$=Do.ClassificationRequest$outboundSchema=Do.ClassificationRequest$inboundSchema=Do.ClassificationRequestInputs$=Do.ClassificationRequestInputs$outboundSchema=Do.ClassificationRequestInputs$inboundSchema=void 0;Do.classificationRequestInputsToJSON=Ran;Do.classificationRequestInputsFromJSON=jan;Do.classificationRequestToJSON=Nan;Do.classificationRequestFromJSON=Dan;var _s=Man(Te()),M$t=Ue(),R$t=ve();Do.ClassificationRequestInputs$inboundSchema=_s.union([_s.string(),_s.array(_s.string())]);Do.ClassificationRequestInputs$outboundSchema=_s.union([_s.string(),_s.array(_s.string())]);var A$t;(function(t){t.inboundSchema=Do.ClassificationRequestInputs$inboundSchema,t.outboundSchema=Do.ClassificationRequestInputs$outboundSchema})(A$t||(Do.ClassificationRequestInputs$=A$t={}));function Ran(t){return JSON.stringify(Do.ClassificationRequestInputs$outboundSchema.parse(t))}function jan(t){return(0,R$t.safeParse)(t,e=>Do.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}Do.ClassificationRequest$inboundSchema=_s.object({input:_s.union([_s.string(),_s.array(_s.string())]),model:_s.nullable(_s.string()).optional()}).transform(t=>(0,M$t.remap)(t,{input:"inputs"}));Do.ClassificationRequest$outboundSchema=_s.object({inputs:_s.union([_s.string(),_s.array(_s.string())]),model:_s.nullable(_s.string()).optional()}).transform(t=>(0,M$t.remap)(t,{inputs:"input"}));var I$t;(function(t){t.inboundSchema=Do.ClassificationRequest$inboundSchema,t.outboundSchema=Do.ClassificationRequest$outboundSchema})(I$t||(Do.ClassificationRequest$=I$t={}));function Nan(t){return JSON.stringify(Do.ClassificationRequest$outboundSchema.parse(t))}function Dan(t){return(0,R$t.safeParse)(t,e=>Do.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var L$t=v(Ou=>{"use strict";var Lan=Ou&&Ou.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fan=Ou&&Ou.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kan=Ou&&Ou.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lan(e,t,r);return Fan(e,t),e};Object.defineProperty(Ou,"__esModule",{value:!0});Ou.ClassificationResponse$=Ou.ClassificationResponse$outboundSchema=Ou.ClassificationResponse$inboundSchema=void 0;Ou.classificationResponseToJSON=Ban;Ou.classificationResponseFromJSON=qan;var zI=kan(Te()),$an=ve(),D$t=eDe();Ou.ClassificationResponse$inboundSchema=zI.object({id:zI.string().optional(),model:zI.string().optional(),results:zI.array(D$t.ClassificationObject$inboundSchema).optional()});Ou.ClassificationResponse$outboundSchema=zI.object({id:zI.string().optional(),model:zI.string().optional(),results:zI.array(D$t.ClassificationObject$outboundSchema).optional()});var N$t;(function(t){t.inboundSchema=Ou.ClassificationResponse$inboundSchema,t.outboundSchema=Ou.ClassificationResponse$outboundSchema})(N$t||(Ou.ClassificationResponse$=N$t={}));function Ban(t){return JSON.stringify(Ou.ClassificationResponse$outboundSchema.parse(t))}function qan(t){return(0,$an.safeParse)(t,e=>Ou.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var tDe=v(Lo=>{"use strict";var Uan=Lo&&Lo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zan=Lo&&Lo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Han=Lo&&Lo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Uan(e,t,r);return zan(e,t),e};Object.defineProperty(Lo,"__esModule",{value:!0});Lo.DeltaMessage$=Lo.DeltaMessage$outboundSchema=Lo.DeltaMessage$inboundSchema=Lo.Content$=Lo.Content$outboundSchema=Lo.Content$inboundSchema=void 0;Lo.contentToJSON=Van;Lo.contentFromJSON=Wan;Lo.deltaMessageToJSON=Kan;Lo.deltaMessageFromJSON=Gan;var Ma=Han(Te()),$$t=Ue(),B$t=ve(),zse=EU(),q$t=ise();Lo.Content$inboundSchema=Ma.union([Ma.string(),Ma.array(zse.ContentChunk$inboundSchema)]);Lo.Content$outboundSchema=Ma.union([Ma.string(),Ma.array(zse.ContentChunk$outboundSchema)]);var F$t;(function(t){t.inboundSchema=Lo.Content$inboundSchema,t.outboundSchema=Lo.Content$outboundSchema})(F$t||(Lo.Content$=F$t={}));function Van(t){return JSON.stringify(Lo.Content$outboundSchema.parse(t))}function Wan(t){return(0,B$t.safeParse)(t,e=>Lo.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}Lo.DeltaMessage$inboundSchema=Ma.object({role:Ma.nullable(Ma.string()).optional(),content:Ma.nullable(Ma.union([Ma.string(),Ma.array(zse.ContentChunk$inboundSchema)])).optional(),tool_calls:Ma.nullable(Ma.array(q$t.ToolCall$inboundSchema)).optional()}).transform(t=>(0,$$t.remap)(t,{tool_calls:"toolCalls"}));Lo.DeltaMessage$outboundSchema=Ma.object({role:Ma.nullable(Ma.string()).optional(),content:Ma.nullable(Ma.union([Ma.string(),Ma.array(zse.ContentChunk$outboundSchema)])).optional(),toolCalls:Ma.nullable(Ma.array(q$t.ToolCall$outboundSchema)).optional()}).transform(t=>(0,$$t.remap)(t,{toolCalls:"tool_calls"}));var k$t;(function(t){t.inboundSchema=Lo.DeltaMessage$inboundSchema,t.outboundSchema=Lo.DeltaMessage$outboundSchema})(k$t||(Lo.DeltaMessage$=k$t={}));function Kan(t){return JSON.stringify(Lo.DeltaMessage$outboundSchema.parse(t))}function Gan(t){return(0,B$t.safeParse)(t,e=>Lo.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var rDe=v(co=>{"use strict";var Jan=co&&co.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yan=co&&co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zan=co&&co.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jan(e,t,r);return Yan(e,t),e};Object.defineProperty(co,"__esModule",{value:!0});co.CompletionResponseStreamChoice$=co.CompletionResponseStreamChoice$outboundSchema=co.CompletionResponseStreamChoice$inboundSchema=co.CompletionResponseStreamChoiceFinishReason$=co.CompletionResponseStreamChoiceFinishReason$outboundSchema=co.CompletionResponseStreamChoiceFinishReason$inboundSchema=co.CompletionResponseStreamChoiceFinishReason=void 0;co.completionResponseStreamChoiceToJSON=esn;co.completionResponseStreamChoiceFromJSON=tsn;var sh=Zan(Te()),H$t=Ue(),Xan=ve(),Qan=BI(),V$t=tDe();co.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};co.CompletionResponseStreamChoiceFinishReason$inboundSchema=sh.union([sh.nativeEnum(co.CompletionResponseStreamChoiceFinishReason),sh.string().transform(Qan.catchUnrecognizedEnum)]);co.CompletionResponseStreamChoiceFinishReason$outboundSchema=sh.union([sh.nativeEnum(co.CompletionResponseStreamChoiceFinishReason),sh.string().and(sh.custom())]);var U$t;(function(t){t.inboundSchema=co.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=co.CompletionResponseStreamChoiceFinishReason$outboundSchema})(U$t||(co.CompletionResponseStreamChoiceFinishReason$=U$t={}));co.CompletionResponseStreamChoice$inboundSchema=sh.object({index:sh.number().int(),delta:V$t.DeltaMessage$inboundSchema,finish_reason:sh.nullable(co.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,H$t.remap)(t,{finish_reason:"finishReason"}));co.CompletionResponseStreamChoice$outboundSchema=sh.object({index:sh.number().int(),delta:V$t.DeltaMessage$outboundSchema,finishReason:sh.nullable(co.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,H$t.remap)(t,{finishReason:"finish_reason"}));var z$t;(function(t){t.inboundSchema=co.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=co.CompletionResponseStreamChoice$outboundSchema})(z$t||(co.CompletionResponseStreamChoice$=z$t={}));function esn(t){return JSON.stringify(co.CompletionResponseStreamChoice$outboundSchema.parse(t))}function tsn(t){return(0,Xan.safeParse)(t,e=>co.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var nDe=v(Pu=>{"use strict";var rsn=Pu&&Pu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nsn=Pu&&Pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),osn=Pu&&Pu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rsn(e,t,r);return nsn(e,t),e};Object.defineProperty(Pu,"__esModule",{value:!0});Pu.CompletionChunk$=Pu.CompletionChunk$outboundSchema=Pu.CompletionChunk$inboundSchema=void 0;Pu.completionChunkToJSON=asn;Pu.completionChunkFromJSON=ssn;var Ug=osn(Te()),isn=ve(),K$t=rDe(),G$t=DU();Pu.CompletionChunk$inboundSchema=Ug.object({id:Ug.string(),object:Ug.string().optional(),created:Ug.number().int().optional(),model:Ug.string(),usage:G$t.UsageInfo$inboundSchema.optional(),choices:Ug.array(K$t.CompletionResponseStreamChoice$inboundSchema)});Pu.CompletionChunk$outboundSchema=Ug.object({id:Ug.string(),object:Ug.string().optional(),created:Ug.number().int().optional(),model:Ug.string(),usage:G$t.UsageInfo$outboundSchema.optional(),choices:Ug.array(K$t.CompletionResponseStreamChoice$outboundSchema)});var W$t;(function(t){t.inboundSchema=Pu.CompletionChunk$inboundSchema,t.outboundSchema=Pu.CompletionChunk$outboundSchema})(W$t||(Pu.CompletionChunk$=W$t={}));function asn(t){return JSON.stringify(Pu.CompletionChunk$outboundSchema.parse(t))}function ssn(t){return(0,isn.safeParse)(t,e=>Pu.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var Z$t=v(Eu=>{"use strict";var usn=Eu&&Eu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lsn=Eu&&Eu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),csn=Eu&&Eu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&usn(e,t,r);return lsn(e,t),e};Object.defineProperty(Eu,"__esModule",{value:!0});Eu.CompletionEvent$=Eu.CompletionEvent$outboundSchema=Eu.CompletionEvent$inboundSchema=void 0;Eu.completionEventToJSON=fsn;Eu.completionEventFromJSON=psn;var W5=csn(Te()),dsn=ve(),Y$t=nDe();Eu.CompletionEvent$inboundSchema=W5.object({data:W5.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:W5.ZodIssueCode.custom,message:`malformed json: ${r}`}),W5.NEVER}}).pipe(Y$t.CompletionChunk$inboundSchema)});Eu.CompletionEvent$outboundSchema=W5.object({data:Y$t.CompletionChunk$outboundSchema});var J$t;(function(t){t.inboundSchema=Eu.CompletionEvent$inboundSchema,t.outboundSchema=Eu.CompletionEvent$outboundSchema})(J$t||(Eu.CompletionEvent$=J$t={}));function fsn(t){return JSON.stringify(Eu.CompletionEvent$outboundSchema.parse(t))}function psn(t){return(0,dsn.safeParse)(t,e=>Eu.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var Q$t=v(Tu=>{"use strict";var msn=Tu&&Tu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hsn=Tu&&Tu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gsn=Tu&&Tu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&msn(e,t,r);return hsn(e,t),e};Object.defineProperty(Tu,"__esModule",{value:!0});Tu.DeleteFileOut$=Tu.DeleteFileOut$outboundSchema=Tu.DeleteFileOut$inboundSchema=void 0;Tu.deleteFileOutToJSON=bsn;Tu.deleteFileOutFromJSON=_sn;var HI=gsn(Te()),ysn=ve();Tu.DeleteFileOut$inboundSchema=HI.object({id:HI.string(),object:HI.string(),deleted:HI.boolean()});Tu.DeleteFileOut$outboundSchema=HI.object({id:HI.string(),object:HI.string(),deleted:HI.boolean()});var X$t;(function(t){t.inboundSchema=Tu.DeleteFileOut$inboundSchema,t.outboundSchema=Tu.DeleteFileOut$outboundSchema})(X$t||(Tu.DeleteFileOut$=X$t={}));function bsn(t){return JSON.stringify(Tu.DeleteFileOut$outboundSchema.parse(t))}function _sn(t){return(0,ysn.safeParse)(t,e=>Tu.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var tBt=v(Au=>{"use strict";var vsn=Au&&Au.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wsn=Au&&Au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ssn=Au&&Au.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vsn(e,t,r);return wsn(e,t),e};Object.defineProperty(Au,"__esModule",{value:!0});Au.DeleteModelOut$=Au.DeleteModelOut$outboundSchema=Au.DeleteModelOut$inboundSchema=void 0;Au.deleteModelOutToJSON=Csn;Au.deleteModelOutFromJSON=Osn;var VI=Ssn(Te()),xsn=ve();Au.DeleteModelOut$inboundSchema=VI.object({id:VI.string(),object:VI.string().default("model"),deleted:VI.boolean().default(!0)});Au.DeleteModelOut$outboundSchema=VI.object({id:VI.string(),object:VI.string().default("model"),deleted:VI.boolean().default(!0)});var eBt;(function(t){t.inboundSchema=Au.DeleteModelOut$inboundSchema,t.outboundSchema=Au.DeleteModelOut$outboundSchema})(eBt||(Au.DeleteModelOut$=eBt={}));function Csn(t){return JSON.stringify(Au.DeleteModelOut$outboundSchema.parse(t))}function Osn(t){return(0,xsn.safeParse)(t,e=>Au.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var oDe=v(Iu=>{"use strict";var Psn=Iu&&Iu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Esn=Iu&&Iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tsn=Iu&&Iu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Psn(e,t,r);return Esn(e,t),e};Object.defineProperty(Iu,"__esModule",{value:!0});Iu.EventOut$=Iu.EventOut$outboundSchema=Iu.EventOut$inboundSchema=void 0;Iu.eventOutToJSON=Isn;Iu.eventOutFromJSON=Msn;var zg=Tsn(Te()),nBt=Ue(),Asn=ve();Iu.EventOut$inboundSchema=zg.object({name:zg.string(),data:zg.nullable(zg.record(zg.any())).optional(),created_at:zg.number().int()}).transform(t=>(0,nBt.remap)(t,{created_at:"createdAt"}));Iu.EventOut$outboundSchema=zg.object({name:zg.string(),data:zg.nullable(zg.record(zg.any())).optional(),createdAt:zg.number().int()}).transform(t=>(0,nBt.remap)(t,{createdAt:"created_at"}));var rBt;(function(t){t.inboundSchema=Iu.EventOut$inboundSchema,t.outboundSchema=Iu.EventOut$outboundSchema})(rBt||(Iu.EventOut$=rBt={}));function Isn(t){return JSON.stringify(Iu.EventOut$outboundSchema.parse(t))}function Msn(t){return(0,Asn.safeParse)(t,e=>Iu.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var Hse=v(Fo=>{"use strict";var Rsn=Fo&&Fo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jsn=Fo&&Fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nsn=Fo&&Fo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rsn(e,t,r);return jsn(e,t),e};Object.defineProperty(Fo,"__esModule",{value:!0});Fo.GithubRepositoryOut$=Fo.GithubRepositoryOut$outboundSchema=Fo.GithubRepositoryOut$inboundSchema=Fo.GithubRepositoryOutType$=Fo.GithubRepositoryOutType$outboundSchema=Fo.GithubRepositoryOutType$inboundSchema=Fo.GithubRepositoryOutType=void 0;Fo.githubRepositoryOutToJSON=Lsn;Fo.githubRepositoryOutFromJSON=Fsn;var nd=Nsn(Te()),aBt=Ue(),Dsn=ve();Fo.GithubRepositoryOutType={Github:"github"};Fo.GithubRepositoryOutType$inboundSchema=nd.nativeEnum(Fo.GithubRepositoryOutType);Fo.GithubRepositoryOutType$outboundSchema=Fo.GithubRepositoryOutType$inboundSchema;var oBt;(function(t){t.inboundSchema=Fo.GithubRepositoryOutType$inboundSchema,t.outboundSchema=Fo.GithubRepositoryOutType$outboundSchema})(oBt||(Fo.GithubRepositoryOutType$=oBt={}));Fo.GithubRepositoryOut$inboundSchema=nd.object({type:nd.literal("github").default("github"),name:nd.string(),owner:nd.string(),ref:nd.nullable(nd.string()).optional(),weight:nd.number().default(1),commit_id:nd.string()}).transform(t=>(0,aBt.remap)(t,{commit_id:"commitId"}));Fo.GithubRepositoryOut$outboundSchema=nd.object({type:nd.literal("github").default("github"),name:nd.string(),owner:nd.string(),ref:nd.nullable(nd.string()).optional(),weight:nd.number().default(1),commitId:nd.string()}).transform(t=>(0,aBt.remap)(t,{commitId:"commit_id"}));var iBt;(function(t){t.inboundSchema=Fo.GithubRepositoryOut$inboundSchema,t.outboundSchema=Fo.GithubRepositoryOut$outboundSchema})(iBt||(Fo.GithubRepositoryOut$=iBt={}));function Lsn(t){return JSON.stringify(Fo.GithubRepositoryOut$outboundSchema.parse(t))}function Fsn(t){return(0,Dsn.safeParse)(t,e=>Fo.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var Vse=v(Mu=>{"use strict";var ksn=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]}),$sn=Mu&&Mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bsn=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)&&ksn(e,t,r);return $sn(e,t),e};Object.defineProperty(Mu,"__esModule",{value:!0});Mu.JobMetadataOut$=Mu.JobMetadataOut$outboundSchema=Mu.JobMetadataOut$inboundSchema=void 0;Mu.jobMetadataOutToJSON=Usn;Mu.jobMetadataOutFromJSON=zsn;var gi=Bsn(Te()),uBt=Ue(),qsn=ve();Mu.JobMetadataOut$inboundSchema=gi.object({expected_duration_seconds:gi.nullable(gi.number().int()).optional(),cost:gi.nullable(gi.number()).optional(),cost_currency:gi.nullable(gi.string()).optional(),train_tokens_per_step:gi.nullable(gi.number().int()).optional(),train_tokens:gi.nullable(gi.number().int()).optional(),data_tokens:gi.nullable(gi.number().int()).optional(),estimated_start_time:gi.nullable(gi.number().int()).optional()}).transform(t=>(0,uBt.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));Mu.JobMetadataOut$outboundSchema=gi.object({expectedDurationSeconds:gi.nullable(gi.number().int()).optional(),cost:gi.nullable(gi.number()).optional(),costCurrency:gi.nullable(gi.string()).optional(),trainTokensPerStep:gi.nullable(gi.number().int()).optional(),trainTokens:gi.nullable(gi.number().int()).optional(),dataTokens:gi.nullable(gi.number().int()).optional(),estimatedStartTime:gi.nullable(gi.number().int()).optional()}).transform(t=>(0,uBt.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 sBt;(function(t){t.inboundSchema=Mu.JobMetadataOut$inboundSchema,t.outboundSchema=Mu.JobMetadataOut$outboundSchema})(sBt||(Mu.JobMetadataOut$=sBt={}));function Usn(t){return JSON.stringify(Mu.JobMetadataOut$outboundSchema.parse(t))}function zsn(t){return(0,qsn.safeParse)(t,e=>Mu.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var Wse=v(Ru=>{"use strict";var Hsn=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]}),Vsn=Ru&&Ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wsn=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)&&Hsn(e,t,r);return Vsn(e,t),e};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.TrainingParameters$=Ru.TrainingParameters$outboundSchema=Ru.TrainingParameters$inboundSchema=void 0;Ru.trainingParametersToJSON=Gsn;Ru.trainingParametersFromJSON=Jsn;var Ai=Wsn(Te()),cBt=Ue(),Ksn=ve();Ru.TrainingParameters$inboundSchema=Ai.object({training_steps:Ai.nullable(Ai.number().int()).optional(),learning_rate:Ai.number().default(1e-4),weight_decay:Ai.nullable(Ai.number()).optional(),warmup_fraction:Ai.nullable(Ai.number()).optional(),epochs:Ai.nullable(Ai.number()).optional(),fim_ratio:Ai.nullable(Ai.number()).optional(),seq_len:Ai.nullable(Ai.number().int()).optional()}).transform(t=>(0,cBt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));Ru.TrainingParameters$outboundSchema=Ai.object({trainingSteps:Ai.nullable(Ai.number().int()).optional(),learningRate:Ai.number().default(1e-4),weightDecay:Ai.nullable(Ai.number()).optional(),warmupFraction:Ai.nullable(Ai.number()).optional(),epochs:Ai.nullable(Ai.number()).optional(),fimRatio:Ai.nullable(Ai.number()).optional(),seqLen:Ai.nullable(Ai.number().int()).optional()}).transform(t=>(0,cBt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var lBt;(function(t){t.inboundSchema=Ru.TrainingParameters$inboundSchema,t.outboundSchema=Ru.TrainingParameters$outboundSchema})(lBt||(Ru.TrainingParameters$=lBt={}));function Gsn(t){return JSON.stringify(Ru.TrainingParameters$outboundSchema.parse(t))}function Jsn(t){return(0,Ksn.safeParse)(t,e=>Ru.TrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParameters' from JSON")}});var Kse=v(ko=>{"use strict";var Ysn=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]}),Zsn=ko&&ko.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xsn=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)&&Ysn(e,t,r);return Zsn(e,t),e};Object.defineProperty(ko,"__esModule",{value:!0});ko.WandbIntegrationOut$=ko.WandbIntegrationOut$outboundSchema=ko.WandbIntegrationOut$inboundSchema=ko.WandbIntegrationOutType$=ko.WandbIntegrationOutType$outboundSchema=ko.WandbIntegrationOutType$inboundSchema=ko.WandbIntegrationOutType=void 0;ko.wandbIntegrationOutToJSON=eun;ko.wandbIntegrationOutFromJSON=tun;var ep=Xsn(Te()),pBt=Ue(),Qsn=ve();ko.WandbIntegrationOutType={Wandb:"wandb"};ko.WandbIntegrationOutType$inboundSchema=ep.nativeEnum(ko.WandbIntegrationOutType);ko.WandbIntegrationOutType$outboundSchema=ko.WandbIntegrationOutType$inboundSchema;var dBt;(function(t){t.inboundSchema=ko.WandbIntegrationOutType$inboundSchema,t.outboundSchema=ko.WandbIntegrationOutType$outboundSchema})(dBt||(ko.WandbIntegrationOutType$=dBt={}));ko.WandbIntegrationOut$inboundSchema=ep.object({type:ep.literal("wandb").default("wandb"),project:ep.string(),name:ep.nullable(ep.string()).optional(),run_name:ep.nullable(ep.string()).optional()}).transform(t=>(0,pBt.remap)(t,{run_name:"runName"}));ko.WandbIntegrationOut$outboundSchema=ep.object({type:ep.literal("wandb").default("wandb"),project:ep.string(),name:ep.nullable(ep.string()).optional(),runName:ep.nullable(ep.string()).optional()}).transform(t=>(0,pBt.remap)(t,{runName:"run_name"}));var fBt;(function(t){t.inboundSchema=ko.WandbIntegrationOut$inboundSchema,t.outboundSchema=ko.WandbIntegrationOut$outboundSchema})(fBt||(ko.WandbIntegrationOut$=fBt={}));function eun(t){return JSON.stringify(ko.WandbIntegrationOut$outboundSchema.parse(t))}function tun(t){return(0,Qsn.safeParse)(t,e=>ko.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var CBt=v(gt=>{"use strict";var run=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]}),nun=gt&>.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oun=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)&&run(e,t,r);return nun(e,t),e};Object.defineProperty(gt,"__esModule",{value:!0});gt.DetailedJobOut$=gt.DetailedJobOut$outboundSchema=gt.DetailedJobOut$inboundSchema=gt.DetailedJobOutRepositories$=gt.DetailedJobOutRepositories$outboundSchema=gt.DetailedJobOutRepositories$inboundSchema=gt.DetailedJobOutIntegrations$=gt.DetailedJobOutIntegrations$outboundSchema=gt.DetailedJobOutIntegrations$inboundSchema=gt.DetailedJobOutObject$=gt.DetailedJobOutObject$outboundSchema=gt.DetailedJobOutObject$inboundSchema=gt.DetailedJobOutStatus$=gt.DetailedJobOutStatus$outboundSchema=gt.DetailedJobOutStatus$inboundSchema=gt.DetailedJobOutObject=gt.DetailedJobOutStatus=void 0;gt.detailedJobOutIntegrationsToJSON=iun;gt.detailedJobOutIntegrationsFromJSON=aun;gt.detailedJobOutRepositoriesToJSON=sun;gt.detailedJobOutRepositoriesFromJSON=uun;gt.detailedJobOutToJSON=lun;gt.detailedJobOutFromJSON=cun;var ur=oun(Te()),_Bt=Ue(),iDe=ve(),vBt=QNe(),wBt=oDe(),Gse=Hse(),SBt=Vse(),xBt=Wse(),Jse=Kse();gt.DetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};gt.DetailedJobOutObject={Job:"job"};gt.DetailedJobOutStatus$inboundSchema=ur.nativeEnum(gt.DetailedJobOutStatus);gt.DetailedJobOutStatus$outboundSchema=gt.DetailedJobOutStatus$inboundSchema;var mBt;(function(t){t.inboundSchema=gt.DetailedJobOutStatus$inboundSchema,t.outboundSchema=gt.DetailedJobOutStatus$outboundSchema})(mBt||(gt.DetailedJobOutStatus$=mBt={}));gt.DetailedJobOutObject$inboundSchema=ur.nativeEnum(gt.DetailedJobOutObject);gt.DetailedJobOutObject$outboundSchema=gt.DetailedJobOutObject$inboundSchema;var hBt;(function(t){t.inboundSchema=gt.DetailedJobOutObject$inboundSchema,t.outboundSchema=gt.DetailedJobOutObject$outboundSchema})(hBt||(gt.DetailedJobOutObject$=hBt={}));gt.DetailedJobOutIntegrations$inboundSchema=Jse.WandbIntegrationOut$inboundSchema;gt.DetailedJobOutIntegrations$outboundSchema=Jse.WandbIntegrationOut$outboundSchema;var gBt;(function(t){t.inboundSchema=gt.DetailedJobOutIntegrations$inboundSchema,t.outboundSchema=gt.DetailedJobOutIntegrations$outboundSchema})(gBt||(gt.DetailedJobOutIntegrations$=gBt={}));function iun(t){return JSON.stringify(gt.DetailedJobOutIntegrations$outboundSchema.parse(t))}function aun(t){return(0,iDe.safeParse)(t,e=>gt.DetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutIntegrations' from JSON")}gt.DetailedJobOutRepositories$inboundSchema=Gse.GithubRepositoryOut$inboundSchema;gt.DetailedJobOutRepositories$outboundSchema=Gse.GithubRepositoryOut$outboundSchema;var yBt;(function(t){t.inboundSchema=gt.DetailedJobOutRepositories$inboundSchema,t.outboundSchema=gt.DetailedJobOutRepositories$outboundSchema})(yBt||(gt.DetailedJobOutRepositories$=yBt={}));function sun(t){return JSON.stringify(gt.DetailedJobOutRepositories$outboundSchema.parse(t))}function uun(t){return(0,iDe.safeParse)(t,e=>gt.DetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutRepositories' from JSON")}gt.DetailedJobOut$inboundSchema=ur.object({id:ur.string(),auto_start:ur.boolean(),hyperparameters:xBt.TrainingParameters$inboundSchema,model:ur.string(),status:gt.DetailedJobOutStatus$inboundSchema,job_type:ur.string(),created_at:ur.number().int(),modified_at:ur.number().int(),training_files:ur.array(ur.string()),validation_files:ur.nullable(ur.array(ur.string())).optional(),object:ur.literal("job").default("job"),fine_tuned_model:ur.nullable(ur.string()).optional(),suffix:ur.nullable(ur.string()).optional(),integrations:ur.nullable(ur.array(Jse.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:ur.nullable(ur.number().int()).optional(),repositories:ur.array(Gse.GithubRepositoryOut$inboundSchema).optional(),metadata:ur.nullable(SBt.JobMetadataOut$inboundSchema).optional(),events:ur.array(wBt.EventOut$inboundSchema).optional(),checkpoints:ur.array(vBt.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,_Bt.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"}));gt.DetailedJobOut$outboundSchema=ur.object({id:ur.string(),autoStart:ur.boolean(),hyperparameters:xBt.TrainingParameters$outboundSchema,model:ur.string(),status:gt.DetailedJobOutStatus$outboundSchema,jobType:ur.string(),createdAt:ur.number().int(),modifiedAt:ur.number().int(),trainingFiles:ur.array(ur.string()),validationFiles:ur.nullable(ur.array(ur.string())).optional(),object:ur.literal("job").default("job"),fineTunedModel:ur.nullable(ur.string()).optional(),suffix:ur.nullable(ur.string()).optional(),integrations:ur.nullable(ur.array(Jse.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:ur.nullable(ur.number().int()).optional(),repositories:ur.array(Gse.GithubRepositoryOut$outboundSchema).optional(),metadata:ur.nullable(SBt.JobMetadataOut$outboundSchema).optional(),events:ur.array(wBt.EventOut$outboundSchema).optional(),checkpoints:ur.array(vBt.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,_Bt.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 bBt;(function(t){t.inboundSchema=gt.DetailedJobOut$inboundSchema,t.outboundSchema=gt.DetailedJobOut$outboundSchema})(bBt||(gt.DetailedJobOut$=bBt={}));function lun(t){return JSON.stringify(gt.DetailedJobOut$outboundSchema.parse(t))}function cun(t){return(0,iDe.safeParse)(t,e=>gt.DetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOut' from JSON")}});var ABt=v($o=>{"use strict";var dun=$o&&$o.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fun=$o&&$o.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pun=$o&&$o.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dun(e,t,r);return fun(e,t),e};Object.defineProperty($o,"__esModule",{value:!0});$o.EmbeddingRequest$=$o.EmbeddingRequest$outboundSchema=$o.EmbeddingRequest$inboundSchema=$o.Inputs$=$o.Inputs$outboundSchema=$o.Inputs$inboundSchema=void 0;$o.inputsToJSON=mun;$o.inputsFromJSON=hun;$o.embeddingRequestToJSON=gun;$o.embeddingRequestFromJSON=yun;var Ra=pun(Te()),EBt=Ue(),TBt=ve();$o.Inputs$inboundSchema=Ra.union([Ra.string(),Ra.array(Ra.string())]);$o.Inputs$outboundSchema=Ra.union([Ra.string(),Ra.array(Ra.string())]);var OBt;(function(t){t.inboundSchema=$o.Inputs$inboundSchema,t.outboundSchema=$o.Inputs$outboundSchema})(OBt||($o.Inputs$=OBt={}));function mun(t){return JSON.stringify($o.Inputs$outboundSchema.parse(t))}function hun(t){return(0,TBt.safeParse)(t,e=>$o.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}$o.EmbeddingRequest$inboundSchema=Ra.object({input:Ra.union([Ra.string(),Ra.array(Ra.string())]),model:Ra.string().default("mistral-embed"),encoding_format:Ra.nullable(Ra.string()).optional()}).transform(t=>(0,EBt.remap)(t,{input:"inputs",encoding_format:"encodingFormat"}));$o.EmbeddingRequest$outboundSchema=Ra.object({inputs:Ra.union([Ra.string(),Ra.array(Ra.string())]),model:Ra.string().default("mistral-embed"),encodingFormat:Ra.nullable(Ra.string()).optional()}).transform(t=>(0,EBt.remap)(t,{inputs:"input",encodingFormat:"encoding_format"}));var PBt;(function(t){t.inboundSchema=$o.EmbeddingRequest$inboundSchema,t.outboundSchema=$o.EmbeddingRequest$outboundSchema})(PBt||($o.EmbeddingRequest$=PBt={}));function gun(t){return JSON.stringify($o.EmbeddingRequest$outboundSchema.parse(t))}function yun(t){return(0,TBt.safeParse)(t,e=>$o.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var aDe=v(ju=>{"use strict";var bun=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]}),_un=ju&&ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vun=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)&&bun(e,t,r);return _un(e,t),e};Object.defineProperty(ju,"__esModule",{value:!0});ju.EmbeddingResponseData$=ju.EmbeddingResponseData$outboundSchema=ju.EmbeddingResponseData$inboundSchema=void 0;ju.embeddingResponseDataToJSON=Sun;ju.embeddingResponseDataFromJSON=xun;var Ux=vun(Te()),wun=ve();ju.EmbeddingResponseData$inboundSchema=Ux.object({object:Ux.string().optional(),embedding:Ux.array(Ux.number()).optional(),index:Ux.number().int().optional()});ju.EmbeddingResponseData$outboundSchema=Ux.object({object:Ux.string().optional(),embedding:Ux.array(Ux.number()).optional(),index:Ux.number().int().optional()});var IBt;(function(t){t.inboundSchema=ju.EmbeddingResponseData$inboundSchema,t.outboundSchema=ju.EmbeddingResponseData$outboundSchema})(IBt||(ju.EmbeddingResponseData$=IBt={}));function Sun(t){return JSON.stringify(ju.EmbeddingResponseData$outboundSchema.parse(t))}function xun(t){return(0,wun.safeParse)(t,e=>ju.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var NBt=v(Nu=>{"use strict";var Cun=Nu&&Nu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Oun=Nu&&Nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pun=Nu&&Nu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Cun(e,t,r);return Oun(e,t),e};Object.defineProperty(Nu,"__esModule",{value:!0});Nu.EmbeddingResponse$=Nu.EmbeddingResponse$outboundSchema=Nu.EmbeddingResponse$inboundSchema=void 0;Nu.embeddingResponseToJSON=Tun;Nu.embeddingResponseFromJSON=Aun;var zx=Pun(Te()),Eun=ve(),RBt=aDe(),jBt=DU();Nu.EmbeddingResponse$inboundSchema=zx.object({id:zx.string(),object:zx.string(),model:zx.string(),usage:jBt.UsageInfo$inboundSchema,data:zx.array(RBt.EmbeddingResponseData$inboundSchema)});Nu.EmbeddingResponse$outboundSchema=zx.object({id:zx.string(),object:zx.string(),model:zx.string(),usage:jBt.UsageInfo$outboundSchema,data:zx.array(RBt.EmbeddingResponseData$outboundSchema)});var MBt;(function(t){t.inboundSchema=Nu.EmbeddingResponse$inboundSchema,t.outboundSchema=Nu.EmbeddingResponse$outboundSchema})(MBt||(Nu.EmbeddingResponse$=MBt={}));function Tun(t){return JSON.stringify(Nu.EmbeddingResponse$outboundSchema.parse(t))}function Aun(t){return(0,Eun.safeParse)(t,e=>Nu.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var K5=v(Du=>{"use strict";var Iun=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]}),Mun=Du&&Du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Run=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)&&Iun(e,t,r);return Mun(e,t),e};Object.defineProperty(Du,"__esModule",{value:!0});Du.FilePurpose$=Du.FilePurpose$outboundSchema=Du.FilePurpose$inboundSchema=Du.FilePurpose=void 0;var _D=Run(Te()),jun=BI();Du.FilePurpose={FineTune:"fine-tune",Batch:"batch"};Du.FilePurpose$inboundSchema=_D.union([_D.nativeEnum(Du.FilePurpose),_D.string().transform(jun.catchUnrecognizedEnum)]);Du.FilePurpose$outboundSchema=_D.union([_D.nativeEnum(Du.FilePurpose),_D.string().and(_D.custom())]);var DBt;(function(t){t.inboundSchema=Du.FilePurpose$inboundSchema,t.outboundSchema=Du.FilePurpose$outboundSchema})(DBt||(Du.FilePurpose$=DBt={}))});var G5=v(Lu=>{"use strict";var Nun=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]}),Dun=Lu&&Lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lun=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)&&Nun(e,t,r);return Dun(e,t),e};Object.defineProperty(Lu,"__esModule",{value:!0});Lu.SampleType$=Lu.SampleType$outboundSchema=Lu.SampleType$inboundSchema=Lu.SampleType=void 0;var vD=Lun(Te()),Fun=BI();Lu.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};Lu.SampleType$inboundSchema=vD.union([vD.nativeEnum(Lu.SampleType),vD.string().transform(Fun.catchUnrecognizedEnum)]);Lu.SampleType$outboundSchema=vD.union([vD.nativeEnum(Lu.SampleType),vD.string().and(vD.custom())]);var LBt;(function(t){t.inboundSchema=Lu.SampleType$inboundSchema,t.outboundSchema=Lu.SampleType$outboundSchema})(LBt||(Lu.SampleType$=LBt={}))});var J5=v(Fu=>{"use strict";var kun=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]}),$un=Fu&&Fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qun=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)&&kun(e,t,r);return $un(e,t),e};Object.defineProperty(Fu,"__esModule",{value:!0});Fu.Source$=Fu.Source$outboundSchema=Fu.Source$inboundSchema=Fu.Source=void 0;var wD=qun(Te()),Uun=BI();Fu.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};Fu.Source$inboundSchema=wD.union([wD.nativeEnum(Fu.Source),wD.string().transform(Uun.catchUnrecognizedEnum)]);Fu.Source$outboundSchema=wD.union([wD.nativeEnum(Fu.Source),wD.string().and(wD.custom())]);var FBt;(function(t){t.inboundSchema=Fu.Source$inboundSchema,t.outboundSchema=Fu.Source$outboundSchema})(FBt||(Fu.Source$=FBt={}))});var sDe=v(ku=>{"use strict";var zun=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]}),Hun=ku&&ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vun=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)&&zun(e,t,r);return Hun(e,t),e};Object.defineProperty(ku,"__esModule",{value:!0});ku.FileSchema$=ku.FileSchema$outboundSchema=ku.FileSchema$inboundSchema=void 0;ku.fileSchemaToJSON=Kun;ku.fileSchemaFromJSON=Gun;var lf=Vun(Te()),$Bt=Ue(),Wun=ve(),BBt=K5(),qBt=G5(),UBt=J5();ku.FileSchema$inboundSchema=lf.object({id:lf.string(),object:lf.string(),bytes:lf.number().int(),created_at:lf.number().int(),filename:lf.string(),purpose:BBt.FilePurpose$inboundSchema,sample_type:qBt.SampleType$inboundSchema,num_lines:lf.nullable(lf.number().int()).optional(),source:UBt.Source$inboundSchema}).transform(t=>(0,$Bt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));ku.FileSchema$outboundSchema=lf.object({id:lf.string(),object:lf.string(),sizeBytes:lf.number().int(),createdAt:lf.number().int(),filename:lf.string(),purpose:BBt.FilePurpose$outboundSchema,sampleType:qBt.SampleType$outboundSchema,numLines:lf.nullable(lf.number().int()).optional(),source:UBt.Source$outboundSchema}).transform(t=>(0,$Bt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var kBt;(function(t){t.inboundSchema=ku.FileSchema$inboundSchema,t.outboundSchema=ku.FileSchema$outboundSchema})(kBt||(ku.FileSchema$=kBt={}));function Kun(t){return JSON.stringify(ku.FileSchema$outboundSchema.parse(t))}function Gun(t){return(0,Wun.safeParse)(t,e=>ku.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var HBt=v($u=>{"use strict";var Jun=$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]}),Yun=$u&&$u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zun=$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)&&Jun(e,t,r);return Yun(e,t),e};Object.defineProperty($u,"__esModule",{value:!0});$u.FileSignedURL$=$u.FileSignedURL$outboundSchema=$u.FileSignedURL$inboundSchema=void 0;$u.fileSignedURLToJSON=Qun;$u.fileSignedURLFromJSON=eln;var Yse=Zun(Te()),Xun=ve();$u.FileSignedURL$inboundSchema=Yse.object({url:Yse.string()});$u.FileSignedURL$outboundSchema=Yse.object({url:Yse.string()});var zBt;(function(t){t.inboundSchema=$u.FileSignedURL$inboundSchema,t.outboundSchema=$u.FileSignedURL$outboundSchema})(zBt||($u.FileSignedURL$=zBt={}));function Qun(t){return JSON.stringify($u.FileSignedURL$outboundSchema.parse(t))}function eln(t){return(0,Xun.safeParse)(t,e=>$u.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var JBt=v(Bo=>{"use strict";var tln=Bo&&Bo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rln=Bo&&Bo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nln=Bo&&Bo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tln(e,t,r);return rln(e,t),e};Object.defineProperty(Bo,"__esModule",{value:!0});Bo.FIMCompletionRequest$=Bo.FIMCompletionRequest$outboundSchema=Bo.FIMCompletionRequest$inboundSchema=Bo.FIMCompletionRequestStop$=Bo.FIMCompletionRequestStop$outboundSchema=Bo.FIMCompletionRequestStop$inboundSchema=void 0;Bo.fimCompletionRequestStopToJSON=oln;Bo.fimCompletionRequestStopFromJSON=iln;Bo.fimCompletionRequestToJSON=aln;Bo.fimCompletionRequestFromJSON=sln;var yr=nln(Te()),KBt=Ue(),GBt=ve();Bo.FIMCompletionRequestStop$inboundSchema=yr.union([yr.string(),yr.array(yr.string())]);Bo.FIMCompletionRequestStop$outboundSchema=yr.union([yr.string(),yr.array(yr.string())]);var VBt;(function(t){t.inboundSchema=Bo.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=Bo.FIMCompletionRequestStop$outboundSchema})(VBt||(Bo.FIMCompletionRequestStop$=VBt={}));function oln(t){return JSON.stringify(Bo.FIMCompletionRequestStop$outboundSchema.parse(t))}function iln(t){return(0,GBt.safeParse)(t,e=>Bo.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}Bo.FIMCompletionRequest$inboundSchema=yr.object({model:yr.nullable(yr.string()),temperature:yr.nullable(yr.number()).optional(),top_p:yr.number().default(1),max_tokens:yr.nullable(yr.number().int()).optional(),stream:yr.boolean().default(!1),stop:yr.union([yr.string(),yr.array(yr.string())]).optional(),random_seed:yr.nullable(yr.number().int()).optional(),prompt:yr.string(),suffix:yr.nullable(yr.string()).optional(),min_tokens:yr.nullable(yr.number().int()).optional()}).transform(t=>(0,KBt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));Bo.FIMCompletionRequest$outboundSchema=yr.object({model:yr.nullable(yr.string()),temperature:yr.nullable(yr.number()).optional(),topP:yr.number().default(1),maxTokens:yr.nullable(yr.number().int()).optional(),stream:yr.boolean().default(!1),stop:yr.union([yr.string(),yr.array(yr.string())]).optional(),randomSeed:yr.nullable(yr.number().int()).optional(),prompt:yr.string(),suffix:yr.nullable(yr.string()).optional(),minTokens:yr.nullable(yr.number().int()).optional()}).transform(t=>(0,KBt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var WBt;(function(t){t.inboundSchema=Bo.FIMCompletionRequest$inboundSchema,t.outboundSchema=Bo.FIMCompletionRequest$outboundSchema})(WBt||(Bo.FIMCompletionRequest$=WBt={}));function aln(t){return JSON.stringify(Bo.FIMCompletionRequest$outboundSchema.parse(t))}function sln(t){return(0,GBt.safeParse)(t,e=>Bo.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var QBt=v(Bu=>{"use strict";var uln=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]}),lln=Bu&&Bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cln=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)&&uln(e,t,r);return lln(e,t),e};Object.defineProperty(Bu,"__esModule",{value:!0});Bu.FIMCompletionResponse$=Bu.FIMCompletionResponse$outboundSchema=Bu.FIMCompletionResponse$inboundSchema=void 0;Bu.fimCompletionResponseToJSON=fln;Bu.fimCompletionResponseFromJSON=pln;var Hg=cln(Te()),dln=ve(),ZBt=Tse(),XBt=DU();Bu.FIMCompletionResponse$inboundSchema=Hg.object({id:Hg.string(),object:Hg.string(),model:Hg.string(),usage:XBt.UsageInfo$inboundSchema,created:Hg.number().int().optional(),choices:Hg.array(ZBt.ChatCompletionChoice$inboundSchema).optional()});Bu.FIMCompletionResponse$outboundSchema=Hg.object({id:Hg.string(),object:Hg.string(),model:Hg.string(),usage:XBt.UsageInfo$outboundSchema,created:Hg.number().int().optional(),choices:Hg.array(ZBt.ChatCompletionChoice$outboundSchema).optional()});var YBt;(function(t){t.inboundSchema=Bu.FIMCompletionResponse$inboundSchema,t.outboundSchema=Bu.FIMCompletionResponse$outboundSchema})(YBt||(Bu.FIMCompletionResponse$=YBt={}));function fln(t){return JSON.stringify(Bu.FIMCompletionResponse$outboundSchema.parse(t))}function pln(t){return(0,dln.safeParse)(t,e=>Bu.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var oqt=v(qo=>{"use strict";var mln=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]}),hln=qo&&qo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gln=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)&&mln(e,t,r);return hln(e,t),e};Object.defineProperty(qo,"__esModule",{value:!0});qo.FIMCompletionStreamRequest$=qo.FIMCompletionStreamRequest$outboundSchema=qo.FIMCompletionStreamRequest$inboundSchema=qo.FIMCompletionStreamRequestStop$=qo.FIMCompletionStreamRequestStop$outboundSchema=qo.FIMCompletionStreamRequestStop$inboundSchema=void 0;qo.fimCompletionStreamRequestStopToJSON=yln;qo.fimCompletionStreamRequestStopFromJSON=bln;qo.fimCompletionStreamRequestToJSON=_ln;qo.fimCompletionStreamRequestFromJSON=vln;var br=gln(Te()),rqt=Ue(),nqt=ve();qo.FIMCompletionStreamRequestStop$inboundSchema=br.union([br.string(),br.array(br.string())]);qo.FIMCompletionStreamRequestStop$outboundSchema=br.union([br.string(),br.array(br.string())]);var eqt;(function(t){t.inboundSchema=qo.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=qo.FIMCompletionStreamRequestStop$outboundSchema})(eqt||(qo.FIMCompletionStreamRequestStop$=eqt={}));function yln(t){return JSON.stringify(qo.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function bln(t){return(0,nqt.safeParse)(t,e=>qo.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}qo.FIMCompletionStreamRequest$inboundSchema=br.object({model:br.nullable(br.string()),temperature:br.nullable(br.number()).optional(),top_p:br.number().default(1),max_tokens:br.nullable(br.number().int()).optional(),stream:br.boolean().default(!0),stop:br.union([br.string(),br.array(br.string())]).optional(),random_seed:br.nullable(br.number().int()).optional(),prompt:br.string(),suffix:br.nullable(br.string()).optional(),min_tokens:br.nullable(br.number().int()).optional()}).transform(t=>(0,rqt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));qo.FIMCompletionStreamRequest$outboundSchema=br.object({model:br.nullable(br.string()),temperature:br.nullable(br.number()).optional(),topP:br.number().default(1),maxTokens:br.nullable(br.number().int()).optional(),stream:br.boolean().default(!0),stop:br.union([br.string(),br.array(br.string())]).optional(),randomSeed:br.nullable(br.number().int()).optional(),prompt:br.string(),suffix:br.nullable(br.string()).optional(),minTokens:br.nullable(br.number().int()).optional()}).transform(t=>(0,rqt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var tqt;(function(t){t.inboundSchema=qo.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=qo.FIMCompletionStreamRequest$outboundSchema})(tqt||(qo.FIMCompletionStreamRequest$=tqt={}));function _ln(t){return JSON.stringify(qo.FIMCompletionStreamRequest$outboundSchema.parse(t))}function vln(t){return(0,nqt.safeParse)(t,e=>qo.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var uDe=v(qu=>{"use strict";var wln=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]}),Sln=qu&&qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xln=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)&&wln(e,t,r);return Sln(e,t),e};Object.defineProperty(qu,"__esModule",{value:!0});qu.FTModelCapabilitiesOut$=qu.FTModelCapabilitiesOut$outboundSchema=qu.FTModelCapabilitiesOut$inboundSchema=void 0;qu.ftModelCapabilitiesOutToJSON=Oln;qu.ftModelCapabilitiesOutFromJSON=Pln;var Hx=xln(Te()),aqt=Ue(),Cln=ve();qu.FTModelCapabilitiesOut$inboundSchema=Hx.object({completion_chat:Hx.boolean().default(!0),completion_fim:Hx.boolean().default(!1),function_calling:Hx.boolean().default(!1),fine_tuning:Hx.boolean().default(!1)}).transform(t=>(0,aqt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));qu.FTModelCapabilitiesOut$outboundSchema=Hx.object({completionChat:Hx.boolean().default(!0),completionFim:Hx.boolean().default(!1),functionCalling:Hx.boolean().default(!1),fineTuning:Hx.boolean().default(!1)}).transform(t=>(0,aqt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var iqt;(function(t){t.inboundSchema=qu.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=qu.FTModelCapabilitiesOut$outboundSchema})(iqt||(qu.FTModelCapabilitiesOut$=iqt={}));function Oln(t){return JSON.stringify(qu.FTModelCapabilitiesOut$outboundSchema.parse(t))}function Pln(t){return(0,Cln.safeParse)(t,e=>qu.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var lDe=v(Uo=>{"use strict";var Eln=Uo&&Uo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tln=Uo&&Uo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Aln=Uo&&Uo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Eln(e,t,r);return Tln(e,t),e};Object.defineProperty(Uo,"__esModule",{value:!0});Uo.FTModelCard$=Uo.FTModelCard$outboundSchema=Uo.FTModelCard$inboundSchema=Uo.FTModelCardType$=Uo.FTModelCardType$outboundSchema=Uo.FTModelCardType$inboundSchema=Uo.FTModelCardType=void 0;Uo.ftModelCardToJSON=Mln;Uo.ftModelCardFromJSON=Rln;var on=Aln(Te()),lqt=Ue(),Iln=ve(),cqt=Pse();Uo.FTModelCardType={FineTuned:"fine-tuned"};Uo.FTModelCardType$inboundSchema=on.nativeEnum(Uo.FTModelCardType);Uo.FTModelCardType$outboundSchema=Uo.FTModelCardType$inboundSchema;var sqt;(function(t){t.inboundSchema=Uo.FTModelCardType$inboundSchema,t.outboundSchema=Uo.FTModelCardType$outboundSchema})(sqt||(Uo.FTModelCardType$=sqt={}));Uo.FTModelCard$inboundSchema=on.object({id:on.string(),object:on.string().default("model"),created:on.number().int().optional(),owned_by:on.string().default("mistralai"),capabilities:cqt.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,lqt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Uo.FTModelCard$outboundSchema=on.object({id:on.string(),object:on.string().default("model"),created:on.number().int().optional(),ownedBy:on.string().default("mistralai"),capabilities:cqt.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,lqt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var uqt;(function(t){t.inboundSchema=Uo.FTModelCard$inboundSchema,t.outboundSchema=Uo.FTModelCard$outboundSchema})(uqt||(Uo.FTModelCard$=uqt={}));function Mln(t){return JSON.stringify(Uo.FTModelCard$outboundSchema.parse(t))}function Rln(t){return(0,Iln.safeParse)(t,e=>Uo.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var hqt=v(zo=>{"use strict";var jln=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]}),Nln=zo&&zo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dln=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)&&jln(e,t,r);return Nln(e,t),e};Object.defineProperty(zo,"__esModule",{value:!0});zo.FTModelOut$=zo.FTModelOut$outboundSchema=zo.FTModelOut$inboundSchema=zo.FTModelOutObject$=zo.FTModelOutObject$outboundSchema=zo.FTModelOutObject$inboundSchema=zo.FTModelOutObject=void 0;zo.ftModelOutToJSON=Fln;zo.ftModelOutFromJSON=kln;var ui=Dln(Te()),pqt=Ue(),Lln=ve(),mqt=uDe();zo.FTModelOutObject={Model:"model"};zo.FTModelOutObject$inboundSchema=ui.nativeEnum(zo.FTModelOutObject);zo.FTModelOutObject$outboundSchema=zo.FTModelOutObject$inboundSchema;var dqt;(function(t){t.inboundSchema=zo.FTModelOutObject$inboundSchema,t.outboundSchema=zo.FTModelOutObject$outboundSchema})(dqt||(zo.FTModelOutObject$=dqt={}));zo.FTModelOut$inboundSchema=ui.object({id:ui.string(),object:ui.literal("model").default("model"),created:ui.number().int(),owned_by:ui.string(),root:ui.string(),archived:ui.boolean(),name:ui.nullable(ui.string()).optional(),description:ui.nullable(ui.string()).optional(),capabilities:mqt.FTModelCapabilitiesOut$inboundSchema,max_context_length:ui.number().int().default(32768),aliases:ui.array(ui.string()).optional(),job:ui.string()}).transform(t=>(0,pqt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength"}));zo.FTModelOut$outboundSchema=ui.object({id:ui.string(),object:ui.literal("model").default("model"),created:ui.number().int(),ownedBy:ui.string(),root:ui.string(),archived:ui.boolean(),name:ui.nullable(ui.string()).optional(),description:ui.nullable(ui.string()).optional(),capabilities:mqt.FTModelCapabilitiesOut$outboundSchema,maxContextLength:ui.number().int().default(32768),aliases:ui.array(ui.string()).optional(),job:ui.string()}).transform(t=>(0,pqt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length"}));var fqt;(function(t){t.inboundSchema=zo.FTModelOut$inboundSchema,t.outboundSchema=zo.FTModelOut$outboundSchema})(fqt||(zo.FTModelOut$=fqt={}));function Fln(t){return JSON.stringify(zo.FTModelOut$outboundSchema.parse(t))}function kln(t){return(0,Lln.safeParse)(t,e=>zo.FTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelOut' from JSON")}});var cDe=v(Ho=>{"use strict";var $ln=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]}),Bln=Ho&&Ho.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qln=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)&&$ln(e,t,r);return Bln(e,t),e};Object.defineProperty(Ho,"__esModule",{value:!0});Ho.GithubRepositoryIn$=Ho.GithubRepositoryIn$outboundSchema=Ho.GithubRepositoryIn$inboundSchema=Ho.GithubRepositoryInType$=Ho.GithubRepositoryInType$outboundSchema=Ho.GithubRepositoryInType$inboundSchema=Ho.GithubRepositoryInType=void 0;Ho.githubRepositoryInToJSON=zln;Ho.githubRepositoryInFromJSON=Hln;var od=qln(Te()),Uln=ve();Ho.GithubRepositoryInType={Github:"github"};Ho.GithubRepositoryInType$inboundSchema=od.nativeEnum(Ho.GithubRepositoryInType);Ho.GithubRepositoryInType$outboundSchema=Ho.GithubRepositoryInType$inboundSchema;var gqt;(function(t){t.inboundSchema=Ho.GithubRepositoryInType$inboundSchema,t.outboundSchema=Ho.GithubRepositoryInType$outboundSchema})(gqt||(Ho.GithubRepositoryInType$=gqt={}));Ho.GithubRepositoryIn$inboundSchema=od.object({type:od.literal("github").default("github"),name:od.string(),owner:od.string(),ref:od.nullable(od.string()).optional(),weight:od.number().default(1),token:od.string()});Ho.GithubRepositoryIn$outboundSchema=od.object({type:od.literal("github").default("github"),name:od.string(),owner:od.string(),ref:od.nullable(od.string()).optional(),weight:od.number().default(1),token:od.string()});var yqt;(function(t){t.inboundSchema=Ho.GithubRepositoryIn$inboundSchema,t.outboundSchema=Ho.GithubRepositoryIn$outboundSchema})(yqt||(Ho.GithubRepositoryIn$=yqt={}));function zln(t){return JSON.stringify(Ho.GithubRepositoryIn$outboundSchema.parse(t))}function Hln(t){return(0,Uln.safeParse)(t,e=>Ho.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var dDe=v(Uu=>{"use strict";var Vln=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]}),Wln=Uu&&Uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kln=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)&&Vln(e,t,r);return Wln(e,t),e};Object.defineProperty(Uu,"__esModule",{value:!0});Uu.TrainingFile$=Uu.TrainingFile$outboundSchema=Uu.TrainingFile$inboundSchema=void 0;Uu.trainingFileToJSON=Jln;Uu.trainingFileFromJSON=Yln;var FU=Kln(Te()),_qt=Ue(),Gln=ve();Uu.TrainingFile$inboundSchema=FU.object({file_id:FU.string(),weight:FU.number().default(1)}).transform(t=>(0,_qt.remap)(t,{file_id:"fileId"}));Uu.TrainingFile$outboundSchema=FU.object({fileId:FU.string(),weight:FU.number().default(1)}).transform(t=>(0,_qt.remap)(t,{fileId:"file_id"}));var bqt;(function(t){t.inboundSchema=Uu.TrainingFile$inboundSchema,t.outboundSchema=Uu.TrainingFile$outboundSchema})(bqt||(Uu.TrainingFile$=bqt={}));function Jln(t){return JSON.stringify(Uu.TrainingFile$outboundSchema.parse(t))}function Yln(t){return(0,Gln.safeParse)(t,e=>Uu.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var fDe=v(zu=>{"use strict";var Zln=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]}),Xln=zu&&zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qln=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)&&Zln(e,t,r);return Xln(e,t),e};Object.defineProperty(zu,"__esModule",{value:!0});zu.TrainingParametersIn$=zu.TrainingParametersIn$outboundSchema=zu.TrainingParametersIn$inboundSchema=void 0;zu.trainingParametersInToJSON=tcn;zu.trainingParametersInFromJSON=rcn;var Ii=Qln(Te()),wqt=Ue(),ecn=ve();zu.TrainingParametersIn$inboundSchema=Ii.object({training_steps:Ii.nullable(Ii.number().int()).optional(),learning_rate:Ii.number().default(1e-4),weight_decay:Ii.nullable(Ii.number()).optional(),warmup_fraction:Ii.nullable(Ii.number()).optional(),epochs:Ii.nullable(Ii.number()).optional(),fim_ratio:Ii.nullable(Ii.number()).optional(),seq_len:Ii.nullable(Ii.number().int()).optional()}).transform(t=>(0,wqt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));zu.TrainingParametersIn$outboundSchema=Ii.object({trainingSteps:Ii.nullable(Ii.number().int()).optional(),learningRate:Ii.number().default(1e-4),weightDecay:Ii.nullable(Ii.number()).optional(),warmupFraction:Ii.nullable(Ii.number()).optional(),epochs:Ii.nullable(Ii.number()).optional(),fimRatio:Ii.nullable(Ii.number()).optional(),seqLen:Ii.nullable(Ii.number().int()).optional()}).transform(t=>(0,wqt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var vqt;(function(t){t.inboundSchema=zu.TrainingParametersIn$inboundSchema,t.outboundSchema=zu.TrainingParametersIn$outboundSchema})(vqt||(zu.TrainingParametersIn$=vqt={}));function tcn(t){return JSON.stringify(zu.TrainingParametersIn$outboundSchema.parse(t))}function rcn(t){return(0,ecn.safeParse)(t,e=>zu.TrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParametersIn' from JSON")}});var pDe=v(Vo=>{"use strict";var ncn=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]}),ocn=Vo&&Vo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),icn=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)&&ncn(e,t,r);return ocn(e,t),e};Object.defineProperty(Vo,"__esModule",{value:!0});Vo.WandbIntegration$=Vo.WandbIntegration$outboundSchema=Vo.WandbIntegration$inboundSchema=Vo.WandbIntegrationType$=Vo.WandbIntegrationType$outboundSchema=Vo.WandbIntegrationType$inboundSchema=Vo.WandbIntegrationType=void 0;Vo.wandbIntegrationToJSON=scn;Vo.wandbIntegrationFromJSON=ucn;var id=icn(Te()),Cqt=Ue(),acn=ve();Vo.WandbIntegrationType={Wandb:"wandb"};Vo.WandbIntegrationType$inboundSchema=id.nativeEnum(Vo.WandbIntegrationType);Vo.WandbIntegrationType$outboundSchema=Vo.WandbIntegrationType$inboundSchema;var Sqt;(function(t){t.inboundSchema=Vo.WandbIntegrationType$inboundSchema,t.outboundSchema=Vo.WandbIntegrationType$outboundSchema})(Sqt||(Vo.WandbIntegrationType$=Sqt={}));Vo.WandbIntegration$inboundSchema=id.object({type:id.literal("wandb").default("wandb"),project:id.string(),name:id.nullable(id.string()).optional(),api_key:id.string(),run_name:id.nullable(id.string()).optional()}).transform(t=>(0,Cqt.remap)(t,{api_key:"apiKey",run_name:"runName"}));Vo.WandbIntegration$outboundSchema=id.object({type:id.literal("wandb").default("wandb"),project:id.string(),name:id.nullable(id.string()).optional(),apiKey:id.string(),runName:id.nullable(id.string()).optional()}).transform(t=>(0,Cqt.remap)(t,{apiKey:"api_key",runName:"run_name"}));var xqt;(function(t){t.inboundSchema=Vo.WandbIntegration$inboundSchema,t.outboundSchema=Vo.WandbIntegration$outboundSchema})(xqt||(Vo.WandbIntegration$=xqt={}));function scn(t){return JSON.stringify(Vo.WandbIntegration$outboundSchema.parse(t))}function ucn(t){return(0,acn.safeParse)(t,e=>Vo.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var Mqt=v(Lr=>{"use strict";var lcn=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]}),ccn=Lr&&Lr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dcn=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)&&lcn(e,t,r);return ccn(e,t),e};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.JobIn$=Lr.JobIn$outboundSchema=Lr.JobIn$inboundSchema=Lr.JobInRepositories$=Lr.JobInRepositories$outboundSchema=Lr.JobInRepositories$inboundSchema=Lr.JobInIntegrations$=Lr.JobInIntegrations$outboundSchema=Lr.JobInIntegrations$inboundSchema=void 0;Lr.jobInIntegrationsToJSON=fcn;Lr.jobInIntegrationsFromJSON=pcn;Lr.jobInRepositoriesToJSON=mcn;Lr.jobInRepositoriesFromJSON=hcn;Lr.jobInToJSON=gcn;Lr.jobInFromJSON=ycn;var ja=dcn(Te()),Tqt=Ue(),mDe=ve(),Zse=cDe(),Aqt=dDe(),Iqt=fDe(),Xse=pDe();Lr.JobInIntegrations$inboundSchema=Xse.WandbIntegration$inboundSchema;Lr.JobInIntegrations$outboundSchema=Xse.WandbIntegration$outboundSchema;var Oqt;(function(t){t.inboundSchema=Lr.JobInIntegrations$inboundSchema,t.outboundSchema=Lr.JobInIntegrations$outboundSchema})(Oqt||(Lr.JobInIntegrations$=Oqt={}));function fcn(t){return JSON.stringify(Lr.JobInIntegrations$outboundSchema.parse(t))}function pcn(t){return(0,mDe.safeParse)(t,e=>Lr.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}Lr.JobInRepositories$inboundSchema=Zse.GithubRepositoryIn$inboundSchema;Lr.JobInRepositories$outboundSchema=Zse.GithubRepositoryIn$outboundSchema;var Pqt;(function(t){t.inboundSchema=Lr.JobInRepositories$inboundSchema,t.outboundSchema=Lr.JobInRepositories$outboundSchema})(Pqt||(Lr.JobInRepositories$=Pqt={}));function mcn(t){return JSON.stringify(Lr.JobInRepositories$outboundSchema.parse(t))}function hcn(t){return(0,mDe.safeParse)(t,e=>Lr.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}Lr.JobIn$inboundSchema=ja.object({model:ja.string(),training_files:ja.array(Aqt.TrainingFile$inboundSchema).optional(),validation_files:ja.nullable(ja.array(ja.string())).optional(),hyperparameters:Iqt.TrainingParametersIn$inboundSchema,suffix:ja.nullable(ja.string()).optional(),integrations:ja.nullable(ja.array(Xse.WandbIntegration$inboundSchema)).optional(),repositories:ja.array(Zse.GithubRepositoryIn$inboundSchema).optional(),auto_start:ja.boolean().optional()}).transform(t=>(0,Tqt.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart"}));Lr.JobIn$outboundSchema=ja.object({model:ja.string(),trainingFiles:ja.array(Aqt.TrainingFile$outboundSchema).optional(),validationFiles:ja.nullable(ja.array(ja.string())).optional(),hyperparameters:Iqt.TrainingParametersIn$outboundSchema,suffix:ja.nullable(ja.string()).optional(),integrations:ja.nullable(ja.array(Xse.WandbIntegration$outboundSchema)).optional(),repositories:ja.array(Zse.GithubRepositoryIn$outboundSchema).optional(),autoStart:ja.boolean().optional()}).transform(t=>(0,Tqt.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start"}));var Eqt;(function(t){t.inboundSchema=Lr.JobIn$inboundSchema,t.outboundSchema=Lr.JobIn$outboundSchema})(Eqt||(Lr.JobIn$=Eqt={}));function gcn(t){return JSON.stringify(Lr.JobIn$outboundSchema.parse(t))}function ycn(t){return(0,mDe.safeParse)(t,e=>Lr.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var gDe=v(yt=>{"use strict";var bcn=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]}),_cn=yt&&yt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vcn=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)&&bcn(e,t,r);return _cn(e,t),e};Object.defineProperty(yt,"__esModule",{value:!0});yt.JobOut$=yt.JobOut$outboundSchema=yt.JobOut$inboundSchema=yt.Repositories$=yt.Repositories$outboundSchema=yt.Repositories$inboundSchema=yt.Integrations$=yt.Integrations$outboundSchema=yt.Integrations$inboundSchema=yt.ObjectT$=yt.ObjectT$outboundSchema=yt.ObjectT$inboundSchema=yt.Status$=yt.Status$outboundSchema=yt.Status$inboundSchema=yt.ObjectT=yt.Status=void 0;yt.integrationsToJSON=wcn;yt.integrationsFromJSON=Scn;yt.repositoriesToJSON=xcn;yt.repositoriesFromJSON=Ccn;yt.jobOutToJSON=Ocn;yt.jobOutFromJSON=Pcn;var _r=vcn(Te()),Fqt=Ue(),hDe=ve(),Qse=Hse(),kqt=Vse(),$qt=Wse(),eue=Kse();yt.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};yt.ObjectT={Job:"job"};yt.Status$inboundSchema=_r.nativeEnum(yt.Status);yt.Status$outboundSchema=yt.Status$inboundSchema;var Rqt;(function(t){t.inboundSchema=yt.Status$inboundSchema,t.outboundSchema=yt.Status$outboundSchema})(Rqt||(yt.Status$=Rqt={}));yt.ObjectT$inboundSchema=_r.nativeEnum(yt.ObjectT);yt.ObjectT$outboundSchema=yt.ObjectT$inboundSchema;var jqt;(function(t){t.inboundSchema=yt.ObjectT$inboundSchema,t.outboundSchema=yt.ObjectT$outboundSchema})(jqt||(yt.ObjectT$=jqt={}));yt.Integrations$inboundSchema=eue.WandbIntegrationOut$inboundSchema;yt.Integrations$outboundSchema=eue.WandbIntegrationOut$outboundSchema;var Nqt;(function(t){t.inboundSchema=yt.Integrations$inboundSchema,t.outboundSchema=yt.Integrations$outboundSchema})(Nqt||(yt.Integrations$=Nqt={}));function wcn(t){return JSON.stringify(yt.Integrations$outboundSchema.parse(t))}function Scn(t){return(0,hDe.safeParse)(t,e=>yt.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}yt.Repositories$inboundSchema=Qse.GithubRepositoryOut$inboundSchema;yt.Repositories$outboundSchema=Qse.GithubRepositoryOut$outboundSchema;var Dqt;(function(t){t.inboundSchema=yt.Repositories$inboundSchema,t.outboundSchema=yt.Repositories$outboundSchema})(Dqt||(yt.Repositories$=Dqt={}));function xcn(t){return JSON.stringify(yt.Repositories$outboundSchema.parse(t))}function Ccn(t){return(0,hDe.safeParse)(t,e=>yt.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}yt.JobOut$inboundSchema=_r.object({id:_r.string(),auto_start:_r.boolean(),hyperparameters:$qt.TrainingParameters$inboundSchema,model:_r.string(),status:yt.Status$inboundSchema,job_type:_r.string(),created_at:_r.number().int(),modified_at:_r.number().int(),training_files:_r.array(_r.string()),validation_files:_r.nullable(_r.array(_r.string())).optional(),object:_r.literal("job").default("job"),fine_tuned_model:_r.nullable(_r.string()).optional(),suffix:_r.nullable(_r.string()).optional(),integrations:_r.nullable(_r.array(eue.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:_r.nullable(_r.number().int()).optional(),repositories:_r.array(Qse.GithubRepositoryOut$inboundSchema).optional(),metadata:_r.nullable(kqt.JobMetadataOut$inboundSchema).optional()}).transform(t=>(0,Fqt.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"}));yt.JobOut$outboundSchema=_r.object({id:_r.string(),autoStart:_r.boolean(),hyperparameters:$qt.TrainingParameters$outboundSchema,model:_r.string(),status:yt.Status$outboundSchema,jobType:_r.string(),createdAt:_r.number().int(),modifiedAt:_r.number().int(),trainingFiles:_r.array(_r.string()),validationFiles:_r.nullable(_r.array(_r.string())).optional(),object:_r.literal("job").default("job"),fineTunedModel:_r.nullable(_r.string()).optional(),suffix:_r.nullable(_r.string()).optional(),integrations:_r.nullable(_r.array(eue.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:_r.nullable(_r.number().int()).optional(),repositories:_r.array(Qse.GithubRepositoryOut$outboundSchema).optional(),metadata:_r.nullable(kqt.JobMetadataOut$outboundSchema).optional()}).transform(t=>(0,Fqt.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 Lqt;(function(t){t.inboundSchema=yt.JobOut$inboundSchema,t.outboundSchema=yt.JobOut$outboundSchema})(Lqt||(yt.JobOut$=Lqt={}));function Ocn(t){return JSON.stringify(yt.JobOut$outboundSchema.parse(t))}function Pcn(t){return(0,hDe.safeParse)(t,e=>yt.JobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobOut' from JSON")}});var zqt=v(Wo=>{"use strict";var Ecn=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]}),Tcn=Wo&&Wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Acn=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)&&Ecn(e,t,r);return Tcn(e,t),e};Object.defineProperty(Wo,"__esModule",{value:!0});Wo.JobsOut$=Wo.JobsOut$outboundSchema=Wo.JobsOut$inboundSchema=Wo.JobsOutObject$=Wo.JobsOutObject$outboundSchema=Wo.JobsOutObject$inboundSchema=Wo.JobsOutObject=void 0;Wo.jobsOutToJSON=Mcn;Wo.jobsOutFromJSON=Rcn;var wP=Acn(Te()),Icn=ve(),Uqt=gDe();Wo.JobsOutObject={List:"list"};Wo.JobsOutObject$inboundSchema=wP.nativeEnum(Wo.JobsOutObject);Wo.JobsOutObject$outboundSchema=Wo.JobsOutObject$inboundSchema;var Bqt;(function(t){t.inboundSchema=Wo.JobsOutObject$inboundSchema,t.outboundSchema=Wo.JobsOutObject$outboundSchema})(Bqt||(Wo.JobsOutObject$=Bqt={}));Wo.JobsOut$inboundSchema=wP.object({data:wP.array(Uqt.JobOut$inboundSchema).optional(),object:wP.literal("list").default("list"),total:wP.number().int()});Wo.JobsOut$outboundSchema=wP.object({data:wP.array(Uqt.JobOut$outboundSchema).optional(),object:wP.literal("list").default("list"),total:wP.number().int()});var qqt;(function(t){t.inboundSchema=Wo.JobsOut$inboundSchema,t.outboundSchema=Wo.JobsOut$outboundSchema})(qqt||(Wo.JobsOut$=qqt={}));function Mcn(t){return JSON.stringify(Wo.JobsOut$outboundSchema.parse(t))}function Rcn(t){return(0,Icn.safeParse)(t,e=>Wo.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var Kqt=v(Ko=>{"use strict";var jcn=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}),Dcn=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)&&jcn(e,t,r);return Ncn(e,t),e};Object.defineProperty(Ko,"__esModule",{value:!0});Ko.LegacyJobMetadataOut$=Ko.LegacyJobMetadataOut$outboundSchema=Ko.LegacyJobMetadataOut$inboundSchema=Ko.LegacyJobMetadataOutObject$=Ko.LegacyJobMetadataOutObject$outboundSchema=Ko.LegacyJobMetadataOutObject$inboundSchema=Ko.LegacyJobMetadataOutObject=void 0;Ko.legacyJobMetadataOutToJSON=Fcn;Ko.legacyJobMetadataOutFromJSON=kcn;var Nr=Dcn(Te()),Wqt=Ue(),Lcn=ve();Ko.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};Ko.LegacyJobMetadataOutObject$inboundSchema=Nr.nativeEnum(Ko.LegacyJobMetadataOutObject);Ko.LegacyJobMetadataOutObject$outboundSchema=Ko.LegacyJobMetadataOutObject$inboundSchema;var Hqt;(function(t){t.inboundSchema=Ko.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=Ko.LegacyJobMetadataOutObject$outboundSchema})(Hqt||(Ko.LegacyJobMetadataOutObject$=Hqt={}));Ko.LegacyJobMetadataOut$inboundSchema=Nr.object({expected_duration_seconds:Nr.nullable(Nr.number().int()).optional(),cost:Nr.nullable(Nr.number()).optional(),cost_currency:Nr.nullable(Nr.string()).optional(),train_tokens_per_step:Nr.nullable(Nr.number().int()).optional(),train_tokens:Nr.nullable(Nr.number().int()).optional(),data_tokens:Nr.nullable(Nr.number().int()).optional(),estimated_start_time:Nr.nullable(Nr.number().int()).optional(),deprecated:Nr.boolean().default(!0),details:Nr.string(),epochs:Nr.nullable(Nr.number()).optional(),training_steps:Nr.nullable(Nr.number().int()).optional(),object:Nr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,Wqt.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"}));Ko.LegacyJobMetadataOut$outboundSchema=Nr.object({expectedDurationSeconds:Nr.nullable(Nr.number().int()).optional(),cost:Nr.nullable(Nr.number()).optional(),costCurrency:Nr.nullable(Nr.string()).optional(),trainTokensPerStep:Nr.nullable(Nr.number().int()).optional(),trainTokens:Nr.nullable(Nr.number().int()).optional(),dataTokens:Nr.nullable(Nr.number().int()).optional(),estimatedStartTime:Nr.nullable(Nr.number().int()).optional(),deprecated:Nr.boolean().default(!0),details:Nr.string(),epochs:Nr.nullable(Nr.number()).optional(),trainingSteps:Nr.nullable(Nr.number().int()).optional(),object:Nr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,Wqt.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 Vqt;(function(t){t.inboundSchema=Ko.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=Ko.LegacyJobMetadataOut$outboundSchema})(Vqt||(Ko.LegacyJobMetadataOut$=Vqt={}));function Fcn(t){return JSON.stringify(Ko.LegacyJobMetadataOut$outboundSchema.parse(t))}function kcn(t){return(0,Lcn.safeParse)(t,e=>Ko.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var Yqt=v(Hu=>{"use strict";var $cn=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]}),Bcn=Hu&&Hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qcn=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)&&$cn(e,t,r);return Bcn(e,t),e};Object.defineProperty(Hu,"__esModule",{value:!0});Hu.ListFilesOut$=Hu.ListFilesOut$outboundSchema=Hu.ListFilesOut$inboundSchema=void 0;Hu.listFilesOutToJSON=zcn;Hu.listFilesOutFromJSON=Hcn;var WI=qcn(Te()),Ucn=ve(),Jqt=sDe();Hu.ListFilesOut$inboundSchema=WI.object({data:WI.array(Jqt.FileSchema$inboundSchema),object:WI.string(),total:WI.number().int()});Hu.ListFilesOut$outboundSchema=WI.object({data:WI.array(Jqt.FileSchema$outboundSchema),object:WI.string(),total:WI.number().int()});var Gqt;(function(t){t.inboundSchema=Hu.ListFilesOut$inboundSchema,t.outboundSchema=Hu.ListFilesOut$outboundSchema})(Gqt||(Hu.ListFilesOut$=Gqt={}));function zcn(t){return JSON.stringify(Hu.ListFilesOut$outboundSchema.parse(t))}function Hcn(t){return(0,Ucn.safeParse)(t,e=>Hu.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var eUt=v(Go=>{"use strict";var Vcn=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]}),Wcn=Go&&Go.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kcn=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)&&Vcn(e,t,r);return Wcn(e,t),e};Object.defineProperty(Go,"__esModule",{value:!0});Go.ModelList$=Go.ModelList$outboundSchema=Go.ModelList$inboundSchema=Go.Data$=Go.Data$outboundSchema=Go.Data$inboundSchema=void 0;Go.dataToJSON=Gcn;Go.dataFromJSON=Jcn;Go.modelListToJSON=Ycn;Go.modelListFromJSON=Zcn;var Gi=Kcn(Te()),Qqt=ve(),tue=GNe(),rue=lDe();Go.Data$inboundSchema=Gi.union([tue.BaseModelCard$inboundSchema.and(Gi.object({type:Gi.literal("base")}).transform(t=>({type:t.type}))),rue.FTModelCard$inboundSchema.and(Gi.object({type:Gi.literal("fine-tuned")}).transform(t=>({type:t.type})))]);Go.Data$outboundSchema=Gi.union([tue.BaseModelCard$outboundSchema.and(Gi.object({type:Gi.literal("base")}).transform(t=>({type:t.type}))),rue.FTModelCard$outboundSchema.and(Gi.object({type:Gi.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var Zqt;(function(t){t.inboundSchema=Go.Data$inboundSchema,t.outboundSchema=Go.Data$outboundSchema})(Zqt||(Go.Data$=Zqt={}));function Gcn(t){return JSON.stringify(Go.Data$outboundSchema.parse(t))}function Jcn(t){return(0,Qqt.safeParse)(t,e=>Go.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}Go.ModelList$inboundSchema=Gi.object({object:Gi.string().default("list"),data:Gi.array(Gi.union([tue.BaseModelCard$inboundSchema.and(Gi.object({type:Gi.literal("base")}).transform(t=>({type:t.type}))),rue.FTModelCard$inboundSchema.and(Gi.object({type:Gi.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});Go.ModelList$outboundSchema=Gi.object({object:Gi.string().default("list"),data:Gi.array(Gi.union([tue.BaseModelCard$outboundSchema.and(Gi.object({type:Gi.literal("base")}).transform(t=>({type:t.type}))),rue.FTModelCard$outboundSchema.and(Gi.object({type:Gi.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});var Xqt;(function(t){t.inboundSchema=Go.ModelList$inboundSchema,t.outboundSchema=Go.ModelList$outboundSchema})(Xqt||(Go.ModelList$=Xqt={}));function Ycn(t){return JSON.stringify(Go.ModelList$outboundSchema.parse(t))}function Zcn(t){return(0,Qqt.safeParse)(t,e=>Go.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var aUt=v(Vu=>{"use strict";var Xcn=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]}),Qcn=Vu&&Vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),edn=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)&&Xcn(e,t,r);return Qcn(e,t),e};Object.defineProperty(Vu,"__esModule",{value:!0});Vu.RetrieveFileOut$=Vu.RetrieveFileOut$outboundSchema=Vu.RetrieveFileOut$inboundSchema=void 0;Vu.retrieveFileOutToJSON=rdn;Vu.retrieveFileOutFromJSON=ndn;var gc=edn(Te()),rUt=Ue(),tdn=ve(),nUt=K5(),oUt=G5(),iUt=J5();Vu.RetrieveFileOut$inboundSchema=gc.object({id:gc.string(),object:gc.string(),bytes:gc.number().int(),created_at:gc.number().int(),filename:gc.string(),purpose:nUt.FilePurpose$inboundSchema,sample_type:oUt.SampleType$inboundSchema,num_lines:gc.nullable(gc.number().int()).optional(),source:iUt.Source$inboundSchema,deleted:gc.boolean()}).transform(t=>(0,rUt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Vu.RetrieveFileOut$outboundSchema=gc.object({id:gc.string(),object:gc.string(),sizeBytes:gc.number().int(),createdAt:gc.number().int(),filename:gc.string(),purpose:nUt.FilePurpose$outboundSchema,sampleType:oUt.SampleType$outboundSchema,numLines:gc.nullable(gc.number().int()).optional(),source:iUt.Source$outboundSchema,deleted:gc.boolean()}).transform(t=>(0,rUt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var tUt;(function(t){t.inboundSchema=Vu.RetrieveFileOut$inboundSchema,t.outboundSchema=Vu.RetrieveFileOut$outboundSchema})(tUt||(Vu.RetrieveFileOut$=tUt={}));function rdn(t){return JSON.stringify(Vu.RetrieveFileOut$outboundSchema.parse(t))}function ndn(t){return(0,tdn.safeParse)(t,e=>Vu.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var lUt=v(Wu=>{"use strict";var odn=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]}),idn=Wu&&Wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),adn=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)&&odn(e,t,r);return idn(e,t),e};Object.defineProperty(Wu,"__esModule",{value:!0});Wu.Security$=Wu.Security$outboundSchema=Wu.Security$inboundSchema=void 0;Wu.securityToJSON=udn;Wu.securityFromJSON=ldn;var nue=adn(Te()),uUt=Ue(),sdn=ve();Wu.Security$inboundSchema=nue.object({ApiKey:nue.string().optional()}).transform(t=>(0,uUt.remap)(t,{ApiKey:"apiKey"}));Wu.Security$outboundSchema=nue.object({apiKey:nue.string().optional()}).transform(t=>(0,uUt.remap)(t,{apiKey:"ApiKey"}));var sUt;(function(t){t.inboundSchema=Wu.Security$inboundSchema,t.outboundSchema=Wu.Security$outboundSchema})(sUt||(Wu.Security$=sUt={}));function udn(t){return JSON.stringify(Wu.Security$outboundSchema.parse(t))}function ldn(t){return(0,sdn.safeParse)(t,e=>Wu.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var fUt=v(Jo=>{"use strict";var cdn=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]}),ddn=Jo&&Jo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fdn=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)&&cdn(e,t,r);return ddn(e,t),e};Object.defineProperty(Jo,"__esModule",{value:!0});Jo.UnarchiveFTModelOut$=Jo.UnarchiveFTModelOut$outboundSchema=Jo.UnarchiveFTModelOut$inboundSchema=Jo.UnarchiveFTModelOutObject$=Jo.UnarchiveFTModelOutObject$outboundSchema=Jo.UnarchiveFTModelOutObject$inboundSchema=Jo.UnarchiveFTModelOutObject=void 0;Jo.unarchiveFTModelOutToJSON=mdn;Jo.unarchiveFTModelOutFromJSON=hdn;var SP=fdn(Te()),pdn=ve();Jo.UnarchiveFTModelOutObject={Model:"model"};Jo.UnarchiveFTModelOutObject$inboundSchema=SP.nativeEnum(Jo.UnarchiveFTModelOutObject);Jo.UnarchiveFTModelOutObject$outboundSchema=Jo.UnarchiveFTModelOutObject$inboundSchema;var cUt;(function(t){t.inboundSchema=Jo.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=Jo.UnarchiveFTModelOutObject$outboundSchema})(cUt||(Jo.UnarchiveFTModelOutObject$=cUt={}));Jo.UnarchiveFTModelOut$inboundSchema=SP.object({id:SP.string(),object:SP.literal("model").default("model"),archived:SP.boolean().default(!1)});Jo.UnarchiveFTModelOut$outboundSchema=SP.object({id:SP.string(),object:SP.literal("model").default("model"),archived:SP.boolean().default(!1)});var dUt;(function(t){t.inboundSchema=Jo.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=Jo.UnarchiveFTModelOut$outboundSchema})(dUt||(Jo.UnarchiveFTModelOut$=dUt={}));function mdn(t){return JSON.stringify(Jo.UnarchiveFTModelOut$outboundSchema.parse(t))}function hdn(t){return(0,pdn.safeParse)(t,e=>Jo.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var mUt=v(Ku=>{"use strict";var gdn=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]}),ydn=Ku&&Ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bdn=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)&&gdn(e,t,r);return ydn(e,t),e};Object.defineProperty(Ku,"__esModule",{value:!0});Ku.UpdateFTModelIn$=Ku.UpdateFTModelIn$outboundSchema=Ku.UpdateFTModelIn$inboundSchema=void 0;Ku.updateFTModelInToJSON=vdn;Ku.updateFTModelInFromJSON=wdn;var Vx=bdn(Te()),_dn=ve();Ku.UpdateFTModelIn$inboundSchema=Vx.object({name:Vx.nullable(Vx.string()).optional(),description:Vx.nullable(Vx.string()).optional()});Ku.UpdateFTModelIn$outboundSchema=Vx.object({name:Vx.nullable(Vx.string()).optional(),description:Vx.nullable(Vx.string()).optional()});var pUt;(function(t){t.inboundSchema=Ku.UpdateFTModelIn$inboundSchema,t.outboundSchema=Ku.UpdateFTModelIn$outboundSchema})(pUt||(Ku.UpdateFTModelIn$=pUt={}));function vdn(t){return JSON.stringify(Ku.UpdateFTModelIn$outboundSchema.parse(t))}function wdn(t){return(0,_dn.safeParse)(t,e=>Ku.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var vUt=v(Gu=>{"use strict";var Sdn=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]}),xdn=Gu&&Gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cdn=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)&&Sdn(e,t,r);return xdn(e,t),e};Object.defineProperty(Gu,"__esModule",{value:!0});Gu.UploadFileOut$=Gu.UploadFileOut$outboundSchema=Gu.UploadFileOut$inboundSchema=void 0;Gu.uploadFileOutToJSON=Pdn;Gu.uploadFileOutFromJSON=Edn;var cf=Cdn(Te()),gUt=Ue(),Odn=ve(),yUt=K5(),bUt=G5(),_Ut=J5();Gu.UploadFileOut$inboundSchema=cf.object({id:cf.string(),object:cf.string(),bytes:cf.number().int(),created_at:cf.number().int(),filename:cf.string(),purpose:yUt.FilePurpose$inboundSchema,sample_type:bUt.SampleType$inboundSchema,num_lines:cf.nullable(cf.number().int()).optional(),source:_Ut.Source$inboundSchema}).transform(t=>(0,gUt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Gu.UploadFileOut$outboundSchema=cf.object({id:cf.string(),object:cf.string(),sizeBytes:cf.number().int(),createdAt:cf.number().int(),filename:cf.string(),purpose:yUt.FilePurpose$outboundSchema,sampleType:bUt.SampleType$outboundSchema,numLines:cf.nullable(cf.number().int()).optional(),source:_Ut.Source$outboundSchema}).transform(t=>(0,gUt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var hUt;(function(t){t.inboundSchema=Gu.UploadFileOut$inboundSchema,t.outboundSchema=Gu.UploadFileOut$outboundSchema})(hUt||(Gu.UploadFileOut$=hUt={}));function Pdn(t){return JSON.stringify(Gu.UploadFileOut$outboundSchema.parse(t))}function Edn(t){return(0,Odn.safeParse)(t,e=>Gu.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var CUt=v(Yo=>{"use strict";var Tdn=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]}),Adn=Yo&&Yo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Idn=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)&&Tdn(e,t,r);return Adn(e,t),e};Object.defineProperty(Yo,"__esModule",{value:!0});Yo.ValidationError$=Yo.ValidationError$outboundSchema=Yo.ValidationError$inboundSchema=Yo.Loc$=Yo.Loc$outboundSchema=Yo.Loc$inboundSchema=void 0;Yo.locToJSON=Mdn;Yo.locFromJSON=Rdn;Yo.validationErrorToJSON=jdn;Yo.validationErrorFromJSON=Ndn;var Ju=Idn(Te()),xUt=ve();Yo.Loc$inboundSchema=Ju.union([Ju.string(),Ju.number().int()]);Yo.Loc$outboundSchema=Ju.union([Ju.string(),Ju.number().int()]);var wUt;(function(t){t.inboundSchema=Yo.Loc$inboundSchema,t.outboundSchema=Yo.Loc$outboundSchema})(wUt||(Yo.Loc$=wUt={}));function Mdn(t){return JSON.stringify(Yo.Loc$outboundSchema.parse(t))}function Rdn(t){return(0,xUt.safeParse)(t,e=>Yo.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}Yo.ValidationError$inboundSchema=Ju.object({loc:Ju.array(Ju.union([Ju.string(),Ju.number().int()])),msg:Ju.string(),type:Ju.string()});Yo.ValidationError$outboundSchema=Ju.object({loc:Ju.array(Ju.union([Ju.string(),Ju.number().int()])),msg:Ju.string(),type:Ju.string()});var SUt;(function(t){t.inboundSchema=Yo.ValidationError$inboundSchema,t.outboundSchema=Yo.ValidationError$outboundSchema})(SUt||(Yo.ValidationError$=SUt={}));function jdn(t){return JSON.stringify(Yo.ValidationError$outboundSchema.parse(t))}function Ndn(t){return(0,xUt.safeParse)(t,e=>Yo.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var Fn=v(Ve=>{"use strict";var Ddn=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]}),Ze=Ve&&Ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ddn(e,t,r)};Object.defineProperty(Ve,"__esModule",{value:!0});Ze(skt(),Ve);Ze(gkt(),Ve);Ze(KNe(),Ve);Ze(vkt(),Ve);Ze(qI(),Ve);Ze(GNe(),Ve);Ze(JNe(),Ve);Ze(Mkt(),Ve);Ze(ZNe(),Ve);Ze(qkt(),Ve);Ze(YNe(),Ve);Ze(Kkt(),Ve);Ze(Tse(),Ve);Ze(a$t(),Ve);Ze(f$t(),Ve);Ze(w$t(),Ve);Ze(QNe(),Ve);Ze(eDe(),Ve);Ze(j$t(),Ve);Ze(L$t(),Ve);Ze(nDe(),Ve);Ze(Z$t(),Ve);Ze(rDe(),Ve);Ze(EU(),Ve);Ze(Q$t(),Ve);Ze(tBt(),Ve);Ze(tDe(),Ve);Ze(CBt(),Ve);Ze(ABt(),Ve);Ze(NBt(),Ve);Ze(aDe(),Ve);Ze(oDe(),Ve);Ze(K5(),Ve);Ze(sDe(),Ve);Ze(HBt(),Ve);Ze(JBt(),Ve);Ze(QBt(),Ve);Ze(oqt(),Ve);Ze(uDe(),Ve);Ze(lDe(),Ve);Ze(hqt(),Ve);Ze(VNe(),Ve);Ze(qNe(),Ve);Ze(WNe(),Ve);Ze(cDe(),Ve);Ze(Hse(),Ve);Ze(kNe(),Ve);Ze($Ne(),Ve);Ze(Mqt(),Ve);Ze(Vse(),Ve);Ze(gDe(),Ve);Ze(zqt(),Ve);Ze(zNe(),Ve);Ze(Kqt(),Ve);Ze(Yqt(),Ve);Ze(XNe(),Ve);Ze(Pse(),Ve);Ze(eUt(),Ve);Ze(AU(),Ve);Ze(BNe(),Ve);Ze(IU(),Ve);Ze(HNe(),Ve);Ze(aUt(),Ve);Ze(G5(),Ve);Ze(lUt(),Ve);Ze(J5(),Ve);Ze(hD(),Ve);Ze(ose(),Ve);Ze(MU(),Ve);Ze(ise(),Ve);Ze(RU(),Ve);Ze(jU(),Ve);Ze(gD(),Ve);Ze(V5(),Ve);Ze(dDe(),Ve);Ze(Wse(),Ve);Ze(fDe(),Ve);Ze(fUt(),Ve);Ze(mUt(),Ve);Ze(vUt(),Ve);Ze(DU(),Ve);Ze(yD(),Ve);Ze(CUt(),Ve);Ze(pDe(),Ve);Ze(Kse(),Ve)});var TUt=v(yc=>{"use strict";var Ldn=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]}),Fdn=yc&&yc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PUt=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)&&Ldn(e,t,r);return Fdn(e,t),e};Object.defineProperty(yc,"__esModule",{value:!0});yc.HTTPValidationError$=yc.HTTPValidationError$outboundSchema=yc.HTTPValidationError$inboundSchema=yc.HTTPValidationError=void 0;var Y5=PUt(Te()),EUt=PUt(Fn()),Z5=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"}};yc.HTTPValidationError=Z5;yc.HTTPValidationError$inboundSchema=Y5.object({detail:Y5.array(EUt.ValidationError$inboundSchema).optional()}).transform(t=>new Z5(t));yc.HTTPValidationError$outboundSchema=Y5.instanceof(Z5).transform(t=>t.data$).pipe(Y5.object({detail:Y5.array(EUt.ValidationError$outboundSchema).optional()}));var OUt;(function(t){t.inboundSchema=yc.HTTPValidationError$inboundSchema,t.outboundSchema=yc.HTTPValidationError$outboundSchema})(OUt||(yc.HTTPValidationError$=OUt={}))});var uh=v(Wx=>{"use strict";var kdn=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]}),oue=Wx&&Wx.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kdn(e,t,r)};Object.defineProperty(Wx,"__esModule",{value:!0});oue(lNe(),Wx);oue(TUt(),Wx);oue(MNe(),Wx);oue(LNe(),Wx)});var MUt=v(xP=>{"use strict";var $dn=xP&&xP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Bdn=xP&&xP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yDe=xP&&xP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$dn(e,t,r);return Bdn(e,t),e};Object.defineProperty(xP,"__esModule",{value:!0});xP.agentsComplete=Wdn;var qdn=ii(),X5=yDe(ai()),Udn=Ue(),zdn=ve(),AUt=si(),Hdn=To(),IUt=yDe(Fn()),Vdn=yDe(uh());async function Wdn(t,e,r){let n=(0,zdn.safeParse)(e,y=>IUt.AgentsCompletionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,qdn.encodeJSON)("body",o,{explode:!0}),a=(0,Hdn.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,Udn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,AUt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,AUt.resolveGlobalSecurity)(l),d={operationID:"agents_completion_v1_agents_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await X5.match(X5.json(200,IUt.ChatCompletionResponse$inboundSchema),X5.jsonErr(422,Vdn.HTTPValidationError$inboundSchema),X5.fail("4XX"),X5.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var NUt=v(CP=>{"use strict";var Kdn=CP&&CP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gdn=CP&&CP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iue=CP&&CP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Kdn(e,t,r);return Gdn(e,t),e};Object.defineProperty(CP,"__esModule",{value:!0});CP.agentsStream=rfn;var Jdn=iue(Te()),Ydn=ii(),Zdn=U5(),Q5=iue(ai()),Xdn=Ue(),Qdn=ve(),RUt=si(),efn=To(),jUt=iue(Fn()),tfn=iue(uh());async function rfn(t,e,r){let n=(0,Qdn.safeParse)(e,y=>jUt.AgentsCompletionStreamRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Ydn.encodeJSON)("body",o,{explode:!0}),a=(0,efn.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,Xdn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,RUt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,RUt.resolveGlobalSecurity)(l),d={operationID:"stream_agents",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await Q5.match(Q5.sse(200,Jdn.instanceof(ReadableStream).transform(y=>new Zdn.EventStream({stream:y,decoder(S){return jUt.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),Q5.jsonErr(422,tfn.HTTPValidationError$inboundSchema),Q5.fail("4XX"),Q5.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var LUt=v(aue=>{"use strict";Object.defineProperty(aue,"__esModule",{value:!0});aue.Agents=void 0;var nfn=MUt(),ofn=NUt(),ifn=ah(),DUt=Ig(),bDe=class extends ifn.ClientSDK{async complete(e,r){return(0,DUt.unwrapAsync)((0,nfn.agentsComplete)(this,e,r))}async stream(e,r){return(0,DUt.unwrapAsync)((0,ofn.agentsStream)(this,e,r))}};aue.Agents=bDe});var $Ut=v(Yu=>{"use strict";var afn=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]}),sfn=Yu&&Yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ufn=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)&&afn(e,t,r);return sfn(e,t),e};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.DeleteModelV1ModelsModelIdDeleteRequest$=Yu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Yu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;Yu.deleteModelV1ModelsModelIdDeleteRequestToJSON=cfn;Yu.deleteModelV1ModelsModelIdDeleteRequestFromJSON=dfn;var sue=ufn(Te()),kUt=Ue(),lfn=ve();Yu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=sue.object({model_id:sue.string()}).transform(t=>(0,kUt.remap)(t,{model_id:"modelId"}));Yu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=sue.object({modelId:sue.string()}).transform(t=>(0,kUt.remap)(t,{modelId:"model_id"}));var FUt;(function(t){t.inboundSchema=Yu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=Yu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(FUt||(Yu.DeleteModelV1ModelsModelIdDeleteRequest$=FUt={}));function cfn(t){return JSON.stringify(Yu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function dfn(t){return(0,lfn.safeParse)(t,e=>Yu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var UUt=v(Zu=>{"use strict";var ffn=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]}),pfn=Zu&&Zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mfn=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)&&ffn(e,t,r);return pfn(e,t),e};Object.defineProperty(Zu,"__esModule",{value:!0});Zu.FilesApiRoutesDeleteFileRequest$=Zu.FilesApiRoutesDeleteFileRequest$outboundSchema=Zu.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;Zu.filesApiRoutesDeleteFileRequestToJSON=gfn;Zu.filesApiRoutesDeleteFileRequestFromJSON=yfn;var uue=mfn(Te()),qUt=Ue(),hfn=ve();Zu.FilesApiRoutesDeleteFileRequest$inboundSchema=uue.object({file_id:uue.string()}).transform(t=>(0,qUt.remap)(t,{file_id:"fileId"}));Zu.FilesApiRoutesDeleteFileRequest$outboundSchema=uue.object({fileId:uue.string()}).transform(t=>(0,qUt.remap)(t,{fileId:"file_id"}));var BUt;(function(t){t.inboundSchema=Zu.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=Zu.FilesApiRoutesDeleteFileRequest$outboundSchema})(BUt||(Zu.FilesApiRoutesDeleteFileRequest$=BUt={}));function gfn(t){return JSON.stringify(Zu.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function yfn(t){return(0,hfn.safeParse)(t,e=>Zu.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var VUt=v(Xu=>{"use strict";var bfn=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]}),_fn=Xu&&Xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vfn=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)&&bfn(e,t,r);return _fn(e,t),e};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.FilesApiRoutesDownloadFileRequest$=Xu.FilesApiRoutesDownloadFileRequest$outboundSchema=Xu.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;Xu.filesApiRoutesDownloadFileRequestToJSON=Sfn;Xu.filesApiRoutesDownloadFileRequestFromJSON=xfn;var lue=vfn(Te()),HUt=Ue(),wfn=ve();Xu.FilesApiRoutesDownloadFileRequest$inboundSchema=lue.object({file_id:lue.string()}).transform(t=>(0,HUt.remap)(t,{file_id:"fileId"}));Xu.FilesApiRoutesDownloadFileRequest$outboundSchema=lue.object({fileId:lue.string()}).transform(t=>(0,HUt.remap)(t,{fileId:"file_id"}));var zUt;(function(t){t.inboundSchema=Xu.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=Xu.FilesApiRoutesDownloadFileRequest$outboundSchema})(zUt||(Xu.FilesApiRoutesDownloadFileRequest$=zUt={}));function Sfn(t){return JSON.stringify(Xu.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function xfn(t){return(0,wfn.safeParse)(t,e=>Xu.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var GUt=v(Qu=>{"use strict";var Cfn=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]}),Ofn=Qu&&Qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pfn=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)&&Cfn(e,t,r);return Ofn(e,t),e};Object.defineProperty(Qu,"__esModule",{value:!0});Qu.FilesApiRoutesGetSignedUrlRequest$=Qu.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Qu.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;Qu.filesApiRoutesGetSignedUrlRequestToJSON=Tfn;Qu.filesApiRoutesGetSignedUrlRequestFromJSON=Afn;var kU=Pfn(Te()),KUt=Ue(),Efn=ve();Qu.FilesApiRoutesGetSignedUrlRequest$inboundSchema=kU.object({file_id:kU.string(),expiry:kU.number().int().default(24)}).transform(t=>(0,KUt.remap)(t,{file_id:"fileId"}));Qu.FilesApiRoutesGetSignedUrlRequest$outboundSchema=kU.object({fileId:kU.string(),expiry:kU.number().int().default(24)}).transform(t=>(0,KUt.remap)(t,{fileId:"file_id"}));var WUt;(function(t){t.inboundSchema=Qu.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=Qu.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(WUt||(Qu.FilesApiRoutesGetSignedUrlRequest$=WUt={}));function Tfn(t){return JSON.stringify(Qu.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function Afn(t){return(0,Efn.safeParse)(t,e=>Qu.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var XUt=v(tl=>{"use strict";var Ifn=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]}),Mfn=tl&&tl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YUt=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)&&Ifn(e,t,r);return Mfn(e,t),e};Object.defineProperty(tl,"__esModule",{value:!0});tl.FilesApiRoutesListFilesRequest$=tl.FilesApiRoutesListFilesRequest$outboundSchema=tl.FilesApiRoutesListFilesRequest$inboundSchema=void 0;tl.filesApiRoutesListFilesRequestToJSON=jfn;tl.filesApiRoutesListFilesRequestFromJSON=Nfn;var el=YUt(Te()),ZUt=Ue(),Rfn=ve(),$U=YUt(Fn());tl.FilesApiRoutesListFilesRequest$inboundSchema=el.object({page:el.number().int().default(0),page_size:el.number().int().default(100),sample_type:el.nullable(el.array($U.SampleType$inboundSchema)).optional(),source:el.nullable(el.array($U.Source$inboundSchema)).optional(),search:el.nullable(el.string()).optional(),purpose:el.nullable($U.FilePurpose$inboundSchema).optional()}).transform(t=>(0,ZUt.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));tl.FilesApiRoutesListFilesRequest$outboundSchema=el.object({page:el.number().int().default(0),pageSize:el.number().int().default(100),sampleType:el.nullable(el.array($U.SampleType$outboundSchema)).optional(),source:el.nullable(el.array($U.Source$outboundSchema)).optional(),search:el.nullable(el.string()).optional(),purpose:el.nullable($U.FilePurpose$outboundSchema).optional()}).transform(t=>(0,ZUt.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var JUt;(function(t){t.inboundSchema=tl.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=tl.FilesApiRoutesListFilesRequest$outboundSchema})(JUt||(tl.FilesApiRoutesListFilesRequest$=JUt={}));function jfn(t){return JSON.stringify(tl.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function Nfn(t){return(0,Rfn.safeParse)(t,e=>tl.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var tzt=v(rl=>{"use strict";var Dfn=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]}),Lfn=rl&&rl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ffn=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)&&Dfn(e,t,r);return Lfn(e,t),e};Object.defineProperty(rl,"__esModule",{value:!0});rl.FilesApiRoutesRetrieveFileRequest$=rl.FilesApiRoutesRetrieveFileRequest$outboundSchema=rl.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;rl.filesApiRoutesRetrieveFileRequestToJSON=$fn;rl.filesApiRoutesRetrieveFileRequestFromJSON=Bfn;var cue=Ffn(Te()),ezt=Ue(),kfn=ve();rl.FilesApiRoutesRetrieveFileRequest$inboundSchema=cue.object({file_id:cue.string()}).transform(t=>(0,ezt.remap)(t,{file_id:"fileId"}));rl.FilesApiRoutesRetrieveFileRequest$outboundSchema=cue.object({fileId:cue.string()}).transform(t=>(0,ezt.remap)(t,{fileId:"file_id"}));var QUt;(function(t){t.inboundSchema=rl.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=rl.FilesApiRoutesRetrieveFileRequest$outboundSchema})(QUt||(rl.FilesApiRoutesRetrieveFileRequest$=QUt={}));function $fn(t){return JSON.stringify(rl.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function Bfn(t){return(0,kfn.safeParse)(t,e=>rl.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var _De=v(mb=>{"use strict";var qfn=mb&&mb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ufn=mb&&mb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zfn=mb&&mb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qfn(e,t,r);return Ufn(e,t),e};Object.defineProperty(mb,"__esModule",{value:!0});mb.blobLikeSchema=void 0;mb.isBlobLike=rzt;var Hfn=zfn(Te());mb.blobLikeSchema=Hfn.custom(rzt,{message:"expected a Blob, File or Blob-like object",fatal:!0});function rzt(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 uzt=v(fo=>{"use strict";var Vfn=fo&&fo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wfn=fo&&fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),izt=fo&&fo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vfn(e,t,r);return Wfn(e,t),e};Object.defineProperty(fo,"__esModule",{value:!0});fo.FilesApiRoutesUploadFileMultiPartBodyParams$=fo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=fo.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=fo.FileT$=fo.FileT$outboundSchema=fo.FileT$inboundSchema=void 0;fo.fileToJSON=Gfn;fo.fileFromJSON=Jfn;fo.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=Yfn;fo.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=Zfn;var bc=izt(Te()),azt=ve(),Kfn=_De(),szt=izt(Fn());fo.FileT$inboundSchema=bc.object({fileName:bc.string(),content:bc.union([bc.instanceof(ReadableStream),bc.instanceof(Blob),bc.instanceof(ArrayBuffer),bc.instanceof(Uint8Array)])});fo.FileT$outboundSchema=bc.object({fileName:bc.string(),content:bc.union([bc.instanceof(ReadableStream),bc.instanceof(Blob),bc.instanceof(ArrayBuffer),bc.instanceof(Uint8Array)])});var nzt;(function(t){t.inboundSchema=fo.FileT$inboundSchema,t.outboundSchema=fo.FileT$outboundSchema})(nzt||(fo.FileT$=nzt={}));function Gfn(t){return JSON.stringify(fo.FileT$outboundSchema.parse(t))}function Jfn(t){return(0,azt.safeParse)(t,e=>fo.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}fo.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=bc.object({file:bc.lazy(()=>fo.FileT$inboundSchema),purpose:szt.FilePurpose$inboundSchema.optional()});fo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=bc.object({file:bc.lazy(()=>fo.FileT$outboundSchema).or(Kfn.blobLikeSchema),purpose:szt.FilePurpose$outboundSchema.optional()});var ozt;(function(t){t.inboundSchema=fo.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=fo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(ozt||(fo.FilesApiRoutesUploadFileMultiPartBodyParams$=ozt={}));function Yfn(t){return JSON.stringify(fo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function Zfn(t){return(0,azt.safeParse)(t,e=>fo.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var dzt=v(nl=>{"use strict";var Xfn=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]}),Qfn=nl&&nl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),epn=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)&&Xfn(e,t,r);return Qfn(e,t),e};Object.defineProperty(nl,"__esModule",{value:!0});nl.JobsApiRoutesBatchCancelBatchJobRequest$=nl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=nl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;nl.jobsApiRoutesBatchCancelBatchJobRequestToJSON=rpn;nl.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=npn;var due=epn(Te()),czt=Ue(),tpn=ve();nl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=due.object({job_id:due.string()}).transform(t=>(0,czt.remap)(t,{job_id:"jobId"}));nl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=due.object({jobId:due.string()}).transform(t=>(0,czt.remap)(t,{jobId:"job_id"}));var lzt;(function(t){t.inboundSchema=nl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=nl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(lzt||(nl.JobsApiRoutesBatchCancelBatchJobRequest$=lzt={}));function rpn(t){return JSON.stringify(nl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function npn(t){return(0,tpn.safeParse)(t,e=>nl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var mzt=v(ol=>{"use strict";var opn=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]}),ipn=ol&&ol.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),apn=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)&&opn(e,t,r);return ipn(e,t),e};Object.defineProperty(ol,"__esModule",{value:!0});ol.JobsApiRoutesBatchGetBatchJobRequest$=ol.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=ol.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;ol.jobsApiRoutesBatchGetBatchJobRequestToJSON=upn;ol.jobsApiRoutesBatchGetBatchJobRequestFromJSON=lpn;var fue=apn(Te()),pzt=Ue(),spn=ve();ol.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=fue.object({job_id:fue.string()}).transform(t=>(0,pzt.remap)(t,{job_id:"jobId"}));ol.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=fue.object({jobId:fue.string()}).transform(t=>(0,pzt.remap)(t,{jobId:"job_id"}));var fzt;(function(t){t.inboundSchema=ol.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=ol.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(fzt||(ol.JobsApiRoutesBatchGetBatchJobRequest$=fzt={}));function upn(t){return JSON.stringify(ol.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function lpn(t){return(0,spn.safeParse)(t,e=>ol.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var _zt=v(il=>{"use strict";var cpn=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]}),dpn=il&&il.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gzt=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)&&cpn(e,t,r);return dpn(e,t),e};Object.defineProperty(il,"__esModule",{value:!0});il.JobsApiRoutesBatchGetBatchJobsRequest$=il.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=il.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;il.jobsApiRoutesBatchGetBatchJobsRequestToJSON=ppn;il.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=mpn;var Na=gzt(Te()),yzt=Ue(),fpn=ve(),bzt=gzt(Fn());il.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=Na.object({page:Na.number().int().default(0),page_size:Na.number().int().default(100),model:Na.nullable(Na.string()).optional(),metadata:Na.nullable(Na.record(Na.any())).optional(),created_after:Na.nullable(Na.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Na.boolean().default(!1),status:Na.nullable(bzt.BatchJobStatus$inboundSchema).optional()}).transform(t=>(0,yzt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe"}));il.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Na.object({page:Na.number().int().default(0),pageSize:Na.number().int().default(100),model:Na.nullable(Na.string()).optional(),metadata:Na.nullable(Na.record(Na.any())).optional(),createdAfter:Na.nullable(Na.date().transform(t=>t.toISOString())).optional(),createdByMe:Na.boolean().default(!1),status:Na.nullable(bzt.BatchJobStatus$outboundSchema).optional()}).transform(t=>(0,yzt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me"}));var hzt;(function(t){t.inboundSchema=il.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=il.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(hzt||(il.JobsApiRoutesBatchGetBatchJobsRequest$=hzt={}));function ppn(t){return JSON.stringify(il.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function mpn(t){return(0,fpn.safeParse)(t,e=>il.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var Szt=v(al=>{"use strict";var hpn=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]}),gpn=al&&al.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ypn=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)&&hpn(e,t,r);return gpn(e,t),e};Object.defineProperty(al,"__esModule",{value:!0});al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;al.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=_pn;al.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=vpn;var pue=ypn(Te()),wzt=Ue(),bpn=ve();al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=pue.object({model_id:pue.string()}).transform(t=>(0,wzt.remap)(t,{model_id:"modelId"}));al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=pue.object({modelId:pue.string()}).transform(t=>(0,wzt.remap)(t,{modelId:"model_id"}));var vzt;(function(t){t.inboundSchema=al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(vzt||(al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=vzt={}));function _pn(t){return JSON.stringify(al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function vpn(t){return(0,bpn.safeParse)(t,e=>al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var Ozt=v(sl=>{"use strict";var wpn=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]}),Spn=sl&&sl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xpn=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)&&wpn(e,t,r);return Spn(e,t),e};Object.defineProperty(sl,"__esModule",{value:!0});sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;sl.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=Opn;sl.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=Ppn;var mue=xpn(Te()),Czt=Ue(),Cpn=ve();sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=mue.object({job_id:mue.string()}).transform(t=>(0,Czt.remap)(t,{job_id:"jobId"}));sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=mue.object({jobId:mue.string()}).transform(t=>(0,Czt.remap)(t,{jobId:"job_id"}));var xzt;(function(t){t.inboundSchema=sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(xzt||(sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=xzt={}));function Opn(t){return JSON.stringify(sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function Ppn(t){return(0,Cpn.safeParse)(t,e=>sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}});var Azt=v(ul=>{"use strict";var Epn=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]}),Tpn=ul&&ul.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ezt=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)&&Epn(e,t,r);return Tpn(e,t),e};Object.defineProperty(ul,"__esModule",{value:!0});ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=void 0;ul.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=Ipn;ul.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=Mpn;var Tzt=Ezt(Te()),Apn=ve(),hue=Ezt(Fn());ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=Tzt.union([hue.LegacyJobMetadataOut$inboundSchema,hue.JobOut$inboundSchema]);ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Tzt.union([hue.LegacyJobMetadataOut$outboundSchema,hue.JobOut$outboundSchema]);var Pzt;(function(t){t.inboundSchema=ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(Pzt||(ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Pzt={}));function Ipn(t){return JSON.stringify(ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function Mpn(t){return(0,Apn.safeParse)(t,e=>ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var Rzt=v(ll=>{"use strict";var Rpn=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]}),jpn=ll&&ll.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Npn=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)&&Rpn(e,t,r);return jpn(e,t),e};Object.defineProperty(ll,"__esModule",{value:!0});ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$=ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;ll.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=Lpn;ll.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=Fpn;var gue=Npn(Te()),Mzt=Ue(),Dpn=ve();ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=gue.object({job_id:gue.string()}).transform(t=>(0,Mzt.remap)(t,{job_id:"jobId"}));ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=gue.object({jobId:gue.string()}).transform(t=>(0,Mzt.remap)(t,{jobId:"job_id"}));var Izt;(function(t){t.inboundSchema=ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(Izt||(ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$=Izt={}));function Lpn(t){return JSON.stringify(ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function Fpn(t){return(0,Dpn.safeParse)(t,e=>ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}});var Lzt=v(po=>{"use strict";var kpn=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]}),$pn=po&&po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bpn=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)&&kpn(e,t,r);return $pn(e,t),e};Object.defineProperty(po,"__esModule",{value:!0});po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=po.Status$=po.Status$outboundSchema=po.Status$inboundSchema=po.Status=void 0;po.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=Upn;po.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=zpn;var li=Bpn(Te()),Dzt=Ue(),qpn=ve();po.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};po.Status$inboundSchema=li.nativeEnum(po.Status);po.Status$outboundSchema=po.Status$inboundSchema;var jzt;(function(t){t.inboundSchema=po.Status$inboundSchema,t.outboundSchema=po.Status$outboundSchema})(jzt||(po.Status$=jzt={}));po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=li.object({page:li.number().int().default(0),page_size:li.number().int().default(100),model:li.nullable(li.string()).optional(),created_after:li.nullable(li.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:li.boolean().default(!1),status:li.nullable(po.Status$inboundSchema).optional(),wandb_project:li.nullable(li.string()).optional(),wandb_name:li.nullable(li.string()).optional(),suffix:li.nullable(li.string()).optional()}).transform(t=>(0,Dzt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=li.object({page:li.number().int().default(0),pageSize:li.number().int().default(100),model:li.nullable(li.string()).optional(),createdAfter:li.nullable(li.date().transform(t=>t.toISOString())).optional(),createdByMe:li.boolean().default(!1),status:li.nullable(po.Status$outboundSchema).optional(),wandbProject:li.nullable(li.string()).optional(),wandbName:li.nullable(li.string()).optional(),suffix:li.nullable(li.string()).optional()}).transform(t=>(0,Dzt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var Nzt;(function(t){t.inboundSchema=po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(Nzt||(po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=Nzt={}));function Upn(t){return JSON.stringify(po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function zpn(t){return(0,qpn.safeParse)(t,e=>po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var $zt=v(cl=>{"use strict";var Hpn=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]}),Vpn=cl&&cl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wpn=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)&&Hpn(e,t,r);return Vpn(e,t),e};Object.defineProperty(cl,"__esModule",{value:!0});cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$=cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;cl.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=Gpn;cl.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=Jpn;var yue=Wpn(Te()),kzt=Ue(),Kpn=ve();cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=yue.object({job_id:yue.string()}).transform(t=>(0,kzt.remap)(t,{job_id:"jobId"}));cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=yue.object({jobId:yue.string()}).transform(t=>(0,kzt.remap)(t,{jobId:"job_id"}));var Fzt;(function(t){t.inboundSchema=cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(Fzt||(cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Fzt={}));function Gpn(t){return JSON.stringify(cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function Jpn(t){return(0,Kpn.safeParse)(t,e=>cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}});var Uzt=v(dl=>{"use strict";var Ypn=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]}),Zpn=dl&&dl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xpn=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)&&Ypn(e,t,r);return Zpn(e,t),e};Object.defineProperty(dl,"__esModule",{value:!0});dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;dl.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=emn;dl.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=tmn;var bue=Xpn(Te()),qzt=Ue(),Qpn=ve();dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=bue.object({model_id:bue.string()}).transform(t=>(0,qzt.remap)(t,{model_id:"modelId"}));dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=bue.object({modelId:bue.string()}).transform(t=>(0,qzt.remap)(t,{modelId:"model_id"}));var Bzt;(function(t){t.inboundSchema=dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(Bzt||(dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=Bzt={}));function emn(t){return JSON.stringify(dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function tmn(t){return(0,Qpn.safeParse)(t,e=>dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var Kzt=v(fl=>{"use strict";var rmn=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]}),nmn=fl&&fl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hzt=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)&&rmn(e,t,r);return nmn(e,t),e};Object.defineProperty(fl,"__esModule",{value:!0});fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;fl.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=imn;fl.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=amn;var _ue=Hzt(Te()),Vzt=Ue(),omn=ve(),Wzt=Hzt(Fn());fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=_ue.object({model_id:_ue.string(),UpdateFTModelIn:Wzt.UpdateFTModelIn$inboundSchema}).transform(t=>(0,Vzt.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=_ue.object({modelId:_ue.string(),updateFTModelIn:Wzt.UpdateFTModelIn$outboundSchema}).transform(t=>(0,Vzt.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var zzt;(function(t){t.inboundSchema=fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(zzt||(fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=zzt={}));function imn(t){return JSON.stringify(fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function amn(t){return(0,omn.safeParse)(t,e=>fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}});var Qzt=v(Zo=>{"use strict";var smn=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]}),umn=Zo&&Zo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yzt=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)&&smn(e,t,r);return umn(e,t),e};Object.defineProperty(Zo,"__esModule",{value:!0});Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=Zo.RetrieveModelV1ModelsModelIdGetRequest$=Zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=Zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;Zo.retrieveModelV1ModelsModelIdGetRequestToJSON=lmn;Zo.retrieveModelV1ModelsModelIdGetRequestFromJSON=cmn;Zo.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=dmn;Zo.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=fmn;var nm=Yzt(Te()),Zzt=Ue(),Xzt=ve(),vue=Yzt(Fn());Zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=nm.object({model_id:nm.string()}).transform(t=>(0,Zzt.remap)(t,{model_id:"modelId"}));Zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=nm.object({modelId:nm.string()}).transform(t=>(0,Zzt.remap)(t,{modelId:"model_id"}));var Gzt;(function(t){t.inboundSchema=Zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=Zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(Gzt||(Zo.RetrieveModelV1ModelsModelIdGetRequest$=Gzt={}));function lmn(t){return JSON.stringify(Zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function cmn(t){return(0,Xzt.safeParse)(t,e=>Zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=nm.union([vue.BaseModelCard$inboundSchema.and(nm.object({type:nm.literal("base")}).transform(t=>({type:t.type}))),vue.FTModelCard$inboundSchema.and(nm.object({type:nm.literal("fine-tuned")}).transform(t=>({type:t.type})))]);Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=nm.union([vue.BaseModelCard$outboundSchema.and(nm.object({type:nm.literal("base")}).transform(t=>({type:t.type}))),vue.FTModelCard$outboundSchema.and(nm.object({type:nm.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var Jzt;(function(t){t.inboundSchema=Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(Jzt||(Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=Jzt={}));function dmn(t){return JSON.stringify(Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function fmn(t){return(0,Xzt.safeParse)(t,e=>Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var pl=v(ga=>{"use strict";var pmn=ga&&ga.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kl=ga&&ga.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&pmn(e,t,r)};Object.defineProperty(ga,"__esModule",{value:!0});kl($Ut(),ga);kl(UUt(),ga);kl(VUt(),ga);kl(GUt(),ga);kl(XUt(),ga);kl(tzt(),ga);kl(uzt(),ga);kl(dzt(),ga);kl(mzt(),ga);kl(_zt(),ga);kl(Szt(),ga);kl(Ozt(),ga);kl(Azt(),ga);kl(Rzt(),ga);kl(Lzt(),ga);kl($zt(),ga);kl(Uzt(),ga);kl(Kzt(),ga);kl(Qzt(),ga)});var t2t=v(OP=>{"use strict";var mmn=OP&&OP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hmn=OP&&OP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vDe=OP&&OP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mmn(e,t,r);return hmn(e,t),e};Object.defineProperty(OP,"__esModule",{value:!0});OP.batchJobsCancel=Smn;var gmn=ii(),wue=vDe(ai()),ymn=Ue(),bmn=ve(),e2t=si(),_mn=To(),vmn=vDe(Fn()),wmn=vDe(pl());async function Smn(t,e,r){let n=(0,bmn.safeParse)(e,y=>wmn.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,gmn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,_mn.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,ymn.compactMap)({Accept:"application/json"})),l=await(0,e2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,e2t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_cancel_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await wue.match(wue.json(200,vmn.BatchJobOut$inboundSchema),wue.fail("4XX"),wue.fail("5XX"))(b);return g.ok,g}});var i2t=v(PP=>{"use strict";var xmn=PP&&PP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cmn=PP&&PP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o2t=PP&&PP.__importStar||function(t){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 Cmn(e,t),e};Object.defineProperty(PP,"__esModule",{value:!0});PP.batchJobsCreate=Amn;var Omn=ii(),Sue=o2t(ai()),Pmn=Ue(),Emn=ve(),r2t=si(),Tmn=To(),n2t=o2t(Fn());async function Amn(t,e,r){let n=(0,Emn.safeParse)(e,g=>n2t.BatchJobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Omn.encodeJSON)("body",o,{explode:!0}),a=(0,Tmn.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,Pmn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,r2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,r2t.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_batch_create_batch_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[b]=await Sue.match(Sue.json(200,n2t.BatchJobOut$inboundSchema),Sue.fail("4XX"),Sue.fail("5XX"))(h);return b.ok,b}});var s2t=v(EP=>{"use strict";var Imn=EP&&EP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=EP&&EP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wDe=EP&&EP.__importStar||function(t){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(EP,"__esModule",{value:!0});EP.batchJobsGet=kmn;var Rmn=ii(),xue=wDe(ai()),jmn=Ue(),Nmn=ve(),a2t=si(),Dmn=To(),Lmn=wDe(Fn()),Fmn=wDe(pl());async function kmn(t,e,r){let n=(0,Nmn.safeParse)(e,y=>Fmn.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,Rmn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Dmn.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,jmn.compactMap)({Accept:"application/json"})),l=await(0,a2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,a2t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await xue.match(xue.json(200,Lmn.BatchJobOut$inboundSchema),xue.fail("4XX"),xue.fail("5XX"))(b);return g.ok,g}});var l2t=v(TP=>{"use strict";var $mn=TP&&TP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Bmn=TP&&TP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SDe=TP&&TP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$mn(e,t,r);return Bmn(e,t),e};Object.defineProperty(TP,"__esModule",{value:!0});TP.batchJobsList=Kmn;var qmn=ii(),Cue=SDe(ai()),Umn=Ue(),zmn=ve(),u2t=si(),Hmn=To(),Vmn=SDe(Fn()),Wmn=SDe(pl());async function Kmn(t,e,r){let n=(0,zmn.safeParse)(e,y=>Wmn.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,Hmn.pathToFunc)("/v1/batch/jobs")(),s=(0,qmn.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,Umn.compactMap)({Accept:"application/json"})),l=await(0,u2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,u2t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Cue.match(Cue.json(200,Vmn.BatchJobsOut$inboundSchema),Cue.fail("4XX"),Cue.fail("5XX"))(b);return g.ok,g}});var c2t=v(Pue=>{"use strict";Object.defineProperty(Pue,"__esModule",{value:!0});Pue.MistralJobs=void 0;var Gmn=t2t(),Jmn=i2t(),Ymn=s2t(),Zmn=l2t(),Xmn=ah(),Oue=Ig(),xDe=class extends Xmn.ClientSDK{async list(e,r){return(0,Oue.unwrapAsync)((0,Zmn.batchJobsList)(this,e,r))}async create(e,r){return(0,Oue.unwrapAsync)((0,Jmn.batchJobsCreate)(this,e,r))}async get(e,r){return(0,Oue.unwrapAsync)((0,Ymn.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,Oue.unwrapAsync)((0,Gmn.batchJobsCancel)(this,e,r))}};Pue.MistralJobs=xDe});var d2t=v(Eue=>{"use strict";Object.defineProperty(Eue,"__esModule",{value:!0});Eue.Batch=void 0;var Qmn=ah(),ehn=c2t(),CDe=class extends Qmn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new ehn.MistralJobs(this._options))}};Eue.Batch=CDe});var m2t=v(AP=>{"use strict";var thn=AP&&AP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rhn=AP&&AP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ODe=AP&&AP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&thn(e,t,r);return rhn(e,t),e};Object.defineProperty(AP,"__esModule",{value:!0});AP.chatComplete=uhn;var nhn=ii(),eW=ODe(ai()),ohn=Ue(),ihn=ve(),f2t=si(),ahn=To(),p2t=ODe(Fn()),shn=ODe(uh());async function uhn(t,e,r){let n=(0,ihn.safeParse)(e,y=>p2t.ChatCompletionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,nhn.encodeJSON)("body",o,{explode:!0}),a=(0,ahn.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,ohn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,f2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,f2t.resolveGlobalSecurity)(l),d={operationID:"chat_completion_v1_chat_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await eW.match(eW.json(200,p2t.ChatCompletionResponse$inboundSchema),eW.jsonErr(422,shn.HTTPValidationError$inboundSchema),eW.fail("4XX"),eW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var y2t=v(IP=>{"use strict";var lhn=IP&&IP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),chn=IP&&IP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tue=IP&&IP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lhn(e,t,r);return chn(e,t),e};Object.defineProperty(IP,"__esModule",{value:!0});IP.chatStream=bhn;var dhn=Tue(Te()),fhn=ii(),phn=U5(),tW=Tue(ai()),mhn=Ue(),hhn=ve(),h2t=si(),ghn=To(),g2t=Tue(Fn()),yhn=Tue(uh());async function bhn(t,e,r){let n=(0,hhn.safeParse)(e,y=>g2t.ChatCompletionStreamRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,fhn.encodeJSON)("body",o,{explode:!0}),a=(0,ghn.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,mhn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,h2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,h2t.resolveGlobalSecurity)(l),d={operationID:"stream_chat",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await tW.match(tW.sse(200,dhn.instanceof(ReadableStream).transform(y=>new phn.EventStream({stream:y,decoder(S){return g2t.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),tW.jsonErr(422,yhn.HTTPValidationError$inboundSchema),tW.fail("4XX"),tW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var Aue=v(Kx=>{"use strict";Object.defineProperty(Kx,"__esModule",{value:!0});Kx.getDefaultOptions=Kx.defaultOptions=Kx.ignoreOverride=void 0;Kx.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");Kx.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 _hn=t=>typeof t=="string"?{...Kx.defaultOptions,name:t}:{...Kx.defaultOptions,...t};Kx.getDefaultOptions=_hn});var PDe=v(Iue=>{"use strict";Object.defineProperty(Iue,"__esModule",{value:!0});Iue.getRefs=void 0;var vhn=Aue(),whn=t=>{let e=(0,vhn.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}]))}};Iue.getRefs=whn});var KI=v(BU=>{"use strict";Object.defineProperty(BU,"__esModule",{value:!0});BU.setResponseValueAndErrors=BU.addErrorMessage=void 0;function b2t(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}BU.addErrorMessage=b2t;function Shn(t,e,r,n,o){t[e]=r,b2t(t,e,n,o)}BU.setResponseValueAndErrors=Shn});var EDe=v(Mue=>{"use strict";Object.defineProperty(Mue,"__esModule",{value:!0});Mue.parseAnyDef=void 0;function xhn(){return{}}Mue.parseAnyDef=xhn});var TDe=v(jue=>{"use strict";Object.defineProperty(jue,"__esModule",{value:!0});jue.parseArrayDef=void 0;var Chn=Te(),Rue=KI(),Ohn=ml();function Phn(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==Chn.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,Ohn.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,Rue.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,Rue.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,Rue.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,Rue.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}jue.parseArrayDef=Phn});var ADe=v(Nue=>{"use strict";Object.defineProperty(Nue,"__esModule",{value:!0});Nue.parseBigintDef=void 0;var SD=KI();function Ehn(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,SD.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,SD.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,SD.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,SD.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,SD.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,SD.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,SD.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}Nue.parseBigintDef=Ehn});var IDe=v(Due=>{"use strict";Object.defineProperty(Due,"__esModule",{value:!0});Due.parseBooleanDef=void 0;function Thn(){return{type:"boolean"}}Due.parseBooleanDef=Thn});var Fue=v(Lue=>{"use strict";Object.defineProperty(Lue,"__esModule",{value:!0});Lue.parseBrandedDef=void 0;var Ahn=ml();function Ihn(t,e){return(0,Ahn.parseDef)(t.type._def,e)}Lue.parseBrandedDef=Ihn});var MDe=v(kue=>{"use strict";Object.defineProperty(kue,"__esModule",{value:!0});kue.parseCatchDef=void 0;var Mhn=ml(),Rhn=(t,e)=>(0,Mhn.parseDef)(t.innerType._def,e);kue.parseCatchDef=Rhn});var RDe=v($ue=>{"use strict";Object.defineProperty($ue,"__esModule",{value:!0});$ue.parseDateDef=void 0;var _2t=KI();function v2t(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>v2t(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 jhn(t,e)}}$ue.parseDateDef=v2t;var jhn=(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,_2t.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,_2t.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var jDe=v(Bue=>{"use strict";Object.defineProperty(Bue,"__esModule",{value:!0});Bue.parseDefaultDef=void 0;var Nhn=ml();function Dhn(t,e){return{...(0,Nhn.parseDef)(t.innerType._def,e),default:t.defaultValue()}}Bue.parseDefaultDef=Dhn});var NDe=v(que=>{"use strict";Object.defineProperty(que,"__esModule",{value:!0});que.parseEffectsDef=void 0;var Lhn=ml();function Fhn(t,e){return e.effectStrategy==="input"?(0,Lhn.parseDef)(t.schema._def,e):{}}que.parseEffectsDef=Fhn});var DDe=v(Uue=>{"use strict";Object.defineProperty(Uue,"__esModule",{value:!0});Uue.parseEnumDef=void 0;function khn(t){return{type:"string",enum:Array.from(t.values)}}Uue.parseEnumDef=khn});var LDe=v(zue=>{"use strict";Object.defineProperty(zue,"__esModule",{value:!0});zue.parseIntersectionDef=void 0;var w2t=ml(),$hn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Bhn(t,e){let r=[(0,w2t.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,w2t.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($hn(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}zue.parseIntersectionDef=Bhn});var FDe=v(Hue=>{"use strict";Object.defineProperty(Hue,"__esModule",{value:!0});Hue.parseLiteralDef=void 0;function qhn(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}}Hue.parseLiteralDef=qhn});var Vue=v(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.parseStringDef=ad.zodPatterns=void 0;var xD=KI(),kDe;ad.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:()=>(kDe===void 0&&(kDe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),kDe),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 Uhn(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,xD.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,xD.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":hb(r,"email",n.message,e);break;case"format:idn-email":hb(r,"idn-email",n.message,e);break;case"pattern:zod":tp(r,ad.zodPatterns.email,n.message,e);break}break;case"url":hb(r,"uri",n.message,e);break;case"uuid":hb(r,"uuid",n.message,e);break;case"regex":tp(r,n.regex,n.message,e);break;case"cuid":tp(r,ad.zodPatterns.cuid,n.message,e);break;case"cuid2":tp(r,ad.zodPatterns.cuid2,n.message,e);break;case"startsWith":tp(r,RegExp(`^${$De(n.value,e)}`),n.message,e);break;case"endsWith":tp(r,RegExp(`${$De(n.value,e)}$`),n.message,e);break;case"datetime":hb(r,"date-time",n.message,e);break;case"date":hb(r,"date",n.message,e);break;case"time":hb(r,"time",n.message,e);break;case"duration":hb(r,"duration",n.message,e);break;case"length":(0,xD.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,xD.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{tp(r,RegExp($De(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&hb(r,"ipv4",n.message,e),n.version!=="v4"&&hb(r,"ipv6",n.message,e);break}case"base64url":tp(r,ad.zodPatterns.base64url,n.message,e);break;case"jwt":tp(r,ad.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&tp(r,ad.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&tp(r,ad.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":tp(r,ad.zodPatterns.emoji(),n.message,e);break;case"ulid":{tp(r,ad.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{hb(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,xD.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{tp(r,ad.zodPatterns.base64,n.message,e);break}}break}case"nanoid":tp(r,ad.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}ad.parseStringDef=Uhn;function $De(t,e){return e.patternStrategy==="escape"?Hhn(t):t}var zhn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Hhn(t){let e="";for(let r=0;ro.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,xD.setResponseValueAndErrors)(t,"format",e,r,n)}function tp(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:S2t(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,xD.setResponseValueAndErrors)(t,"pattern",S2t(e,n),r,n)}function S2t(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{d.pageContent.trim()&&i.push({content:d.pageContent,fileInfo:l})})}return i}getDocHash(e){return(0,m1t.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=rf(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>eu(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(!eu(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 ie([`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 Ix.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 Ix.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=ue(),o=bg(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...eie(this.app),...bg(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 Ix.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 Ix.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 Ix.Notice("Indexing cancelled");return}e.length>0?new Ix.Notice(`Indexing completed with ${e.length} errors. Check console for details.`):new Ix.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;asetTimeout(e,100)),this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide()}}});var g1t={};Cf(g1t,{default:()=>ma});var z8,ma,Mx=w(()=>{wT();pN();nr();z8=require("obsidian");rie();n1t();h1t();ma=class t{constructor(){this.embeddingsManager=Xs.getInstance(),this.dbOps=new eP(app),this.indexOps=new sie(app,this.dbOps,this.embeddingsManager),this.eventHandler=new nie(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={...ue()};let e=async()=>{let r=ue(),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())}};xa(()=>{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 Rr&&r.message.includes("Vault adapter not available")&&(e--,e>0)){await new Promise(n=>setTimeout(n,100));continue}new z8.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(),z8.Platform.isMobile&&ue().disableIndexOnMobile?(new z8.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 Kbe(t){return t.split("|")[1]==="copilot-plus"}function xq(){return Rn().isPlusUser}async function uie(){return ue().plusLicenseKey?(await Fi.getInstance().validateLicenseKey()).isValid:(JRe(),!1)}function b1t(){let t=FGr,e=KRe,r=ue().embeddingModelKey;ie("applyPlusSettings: Changing embedding model",{from:r,to:e,changed:r!==e}),e8e(t),UR("copilot_plus"),zE({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e?(ie("applyPlusSettings: Embedding model changed, triggering indexing"),Promise.resolve().then(()=>(Mx(),g1t)).then(n=>{n.default.getInstance().indexVaultToVectorStore()}).catch(n=>{fe("Failed to trigger indexing after Plus settings applied:",n),new y1t.Notice("Failed to update Copilot index. Please try force reindexing from the command palette.")})):ie("applyPlusSettings: No embedding model change, skipping indexing")}function GRe(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function m1(t){window.open(GRe(t),"_blank")}function _1t(){dt("isPlusUser",!0)}function JRe(){let t=ue().isPlusUser;dt("isPlusUser",!1),t&&new U7(app).open()}var y1t,VRe,FGr,WRe,KRe,Ezo,Tzo,oO=w(()=>{Cl();Fd();mKe();$r();mg();yo();nr();y1t=require("obsidian"),VRe="copilot-plus-flash",FGr=VRe+"|"+"copilot-plus",WRe="copilot-plus-small",KRe=WRe+"|"+"copilot-plus",Ezo=Ic.defaultModelKey,Tzo=Ic.embeddingModelKey});var v1t,w1t,Fi,mg=w(()=>{$r();qR();yo();oO();nr();v1t=F(Pp()),w1t=require("obsidian"),Fi=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!ue().plusLicenseKey)throw new w1t.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=ue().userId;let a=new URL(`${VE}${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 eo(ue().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 ie(`==== ${e} request ====:`,u),{data:u}}async makeFormDataRequest(e,r,n=!1){n||this.checkLicenseKey(),r.append("user_id",ue().userId);let o=new URL(`${VE}${e}`);try{let i=await fetch(o.toString(),{method:"POST",headers:{Authorization:`Bearer ${await eo(ue().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 ie(`==== ${e} FormData request ====:`,a),{data:a}}catch(i){return{data:null,error:i instanceof Error?i:new Error(String(i))}}}async validateLicenseKey(){let{data:e,error:r}=await this.makeRequest("/license",{license_key:await eo(ue().plusLicenseKey)},"POST",!0,!0);return r?r.message==="Invalid license key"?(JRe(),{isValid:!1}):{isValid:void 0}:(_1t(),{isValid:!0,plan:e?.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=v1t.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 XRe=v((kzo,O1t)=>{var kGr="Expected a function",x1t=NaN,$Gr="[object Symbol]",BGr=/^\s+|\s+$/g,qGr=/^[-+]0x[0-9a-f]+$/i,UGr=/^0b[01]+$/i,zGr=/^0o[0-7]+$/i,HGr=parseInt,VGr=typeof window=="object"&&window&&window.Object===Object&&window,WGr=typeof self=="object"&&self&&self.Object===Object&&self,KGr=VGr||WGr||Function("return this")(),GGr=Object.prototype,JGr=GGr.toString,YGr=Math.max,ZGr=Math.min,YRe=function(){return KGr.Date.now()};function XGr(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(kGr);e=C1t(e)||0,ZRe(r)&&(c=!!r.leading,d="maxWait"in r,i=d?YGr(C1t(r.maxWait)||0,e):i,f="trailing"in r?!!r.trailing:f);function p(P){var E=n,A=o;return n=o=void 0,l=P,a=t.apply(A,E),a}function m(P){return l=P,s=setTimeout(g,e),c?p(P):a}function h(P){var E=P-u,A=P-l,I=e-E;return d?ZGr(I,i-A):I}function b(P){var E=P-u,A=P-l;return u===void 0||E>=e||E<0||d&&A>=i}function g(){var P=YRe();if(b(P))return y(P);s=setTimeout(g,h(P))}function y(P){return s=void 0,f&&n?p(P):(n=o=void 0,a)}function S(){s!==void 0&&clearTimeout(s),l=0,n=u=o=s=void 0}function x(){return s===void 0?a:y(YRe())}function O(){var P=YRe(),E=b(P);if(n=arguments,o=this,u=P,E){if(s===void 0)return m(u);if(d)return s=setTimeout(g,e),p(u)}return s===void 0&&(s=setTimeout(g,e)),a}return O.cancel=S,O.flush=x,O}function ZRe(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function QGr(t){return!!t&&typeof t=="object"}function eJr(t){return typeof t=="symbol"||QGr(t)&&JGr.call(t)==$Gr}function C1t(t){if(typeof t=="number")return t;if(eJr(t))return x1t;if(ZRe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ZRe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(BGr,"");var r=UGr.test(t);return r||zGr.test(t)?HGr(t.slice(2),r?2:8):qGr.test(t)?x1t:+t}O1t.exports=XGr});var F1t=v((i1e,a1e)=>{(function(t,e){typeof i1e=="object"&&typeof a1e<"u"?a1e.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(i1e,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 iI=v((s1e,u1e)=>{(function(t,e){typeof s1e=="object"&&typeof u1e<"u"?u1e.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(s1e,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",l="month",c="quarter",d="year",f="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={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(j){var $=["th","st","nd","rd"],k=j%100;return"["+j+($[(k-20)%10]||$[k]||$[0])+"]"}},g=function(j,$,k){var z=String(j);return!z||z.length>=$?j:""+Array($+1-z.length).join(k)+j},y={s:g,z:function(j){var $=-j.utcOffset(),k=Math.abs($),z=Math.floor(k/60),V=k%60;return($<=0?"+":"-")+g(z,2,"0")+":"+g(V,2,"0")},m:function j($,k){if($.date()1)return j(J[0])}else{var D=$.name;x[D]=$,V=D}return!z&&V&&(S=V),V||!z&&S},A=function(j,$){if(P(j))return j.clone();var k=typeof $=="object"?$:{};return k.date=j,k.args=arguments,new R(k)},I=y;I.l=E,I.i=P,I.w=function(j,$){return A(j,{locale:$.$L,utc:$.$u,x:$.$x,$offset:$.$offset})};var R=function(){function j(k){this.$L=E(k.locale,null,!0),this.parse(k),this.$x=this.$x||k.x||{},this[O]=!0}var $=j.prototype;return $.parse=function(k){this.$d=function(z){var V=z.date,Q=z.utc;if(V===null)return new Date(NaN);if(I.u(V))return new Date;if(V instanceof Date)return new Date(V);if(typeof V=="string"&&!/Z$/i.test(V)){var J=V.match(m);if(J){var D=J[2]-1||0,B=(J[7]||"0").substring(0,3);return Q?new Date(Date.UTC(J[1],D,J[3]||1,J[4]||0,J[5]||0,J[6]||0,B)):new Date(J[1],D,J[3]||1,J[4]||0,J[5]||0,J[6]||0,B)}}return new Date(V)}(k),this.init()},$.init=function(){var k=this.$d;this.$y=k.getFullYear(),this.$M=k.getMonth(),this.$D=k.getDate(),this.$W=k.getDay(),this.$H=k.getHours(),this.$m=k.getMinutes(),this.$s=k.getSeconds(),this.$ms=k.getMilliseconds()},$.$utils=function(){return I},$.isValid=function(){return this.$d.toString()!==p},$.isSame=function(k,z){var V=A(k);return this.startOf(z)<=V&&V<=this.endOf(z)},$.isAfter=function(k,z){return A(k){"use strict";Object.defineProperty(Qje,"__esModule",{value:!0});Qje.pathToFunc=jXr;var RXr=Object.prototype.hasOwnProperty;function jXr(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!RXr.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 kae=v(Ag=>{"use strict";Object.defineProperty(Ag,"__esModule",{value:!0});Ag.SDK_METADATA=Ag.ServerList=Ag.ServerEu=void 0;Ag.serverURLFromOptions=DXr;var NXr=To();Ag.ServerEu="eu";Ag.ServerList={[Ag.ServerEu]:"https://api.mistral.ai"};function DXr(t){let e=t.serverURL,r={};if(!e){let o=t.server??Ag.ServerEu;e=Ag.ServerList[o]||""}let n=(0,NXr.pathToFunc)(e)(r);return new URL(n)}Ag.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 tNe=v(eNe=>{"use strict";Object.defineProperty(eNe,"__esModule",{value:!0});eNe.readableStreamToArrayBuffer=LXr;async function LXr(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 JDt=v($ae=>{"use strict";Object.defineProperty($ae,"__esModule",{value:!0});$ae.CustomUserAgentHook=void 0;var FXr=kae(),rNe=class{beforeRequest(e,r){let o=`mistral-client-typescript/${FXr.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};$ae.CustomUserAgentHook=rNe});var ZDt=v(Bae=>{"use strict";Object.defineProperty(Bae,"__esModule",{value:!0});Bae.DeprecationWarningHook=void 0;var YDt="x-model-deprecation-timestamp",nNe=class{afterSuccess(e,r){return r.headers.has(YDt)&&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(YDt)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};Bae.DeprecationWarningHook=nNe});var XDt=v(oNe=>{"use strict";Object.defineProperty(oNe,"__esModule",{value:!0});oNe.initHooks=BXr;var kXr=JDt(),$Xr=ZDt();function BXr(t){let e=new kXr.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new $Xr.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var QDt=v(qae=>{"use strict";Object.defineProperty(qae,"__esModule",{value:!0});qae.SDKHooks=void 0;var qXr=XDt(),iNe=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,qXr.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}}};qae.SDKHooks=iNe});var dNe=v(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});Zp.ConnectionError=Zp.RequestTimeoutError=Zp.RequestAbortedError=Zp.InvalidRequestError=Zp.UnexpectedClientError=Zp.HTTPClientError=void 0;var RI=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)}};Zp.HTTPClientError=RI;var aNe=class extends RI{constructor(){super(...arguments),this.name="UnexpectedClientError"}};Zp.UnexpectedClientError=aNe;var sNe=class extends RI{constructor(){super(...arguments),this.name="InvalidRequestError"}};Zp.InvalidRequestError=sNe;var uNe=class extends RI{constructor(){super(...arguments),this.name="RequestAbortedError"}};Zp.RequestAbortedError=uNe;var lNe=class extends RI{constructor(){super(...arguments),this.name="RequestTimeoutError"}};Zp.RequestTimeoutError=lNe;var cNe=class extends RI{constructor(){super(...arguments),this.name="ConnectionError"}};Zp.ConnectionError=cNe});var Ig=v(yU=>{"use strict";Object.defineProperty(yU,"__esModule",{value:!0});yU.OK=UXr;yU.ERR=zXr;yU.unwrap=HXr;yU.unwrapAsync=VXr;function UXr(t){return{ok:!0,value:t}}function zXr(t){return{ok:!1,error:t}}function HXr(t){if(!t.ok)throw t.error;return t.value}async function VXr(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var E5=v(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.getParsedType=Ki.ZodParsedType=Ki.objectUtil=Ki.util=void 0;var fNe;(function(t){t.assertEqual=o=>o;function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(fNe||(Ki.util=fNe={}));var eLt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(eLt||(Ki.objectUtil=eLt={}));Ki.ZodParsedType=fNe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var WXr=t=>{switch(typeof t){case"undefined":return Ki.ZodParsedType.undefined;case"string":return Ki.ZodParsedType.string;case"number":return isNaN(t)?Ki.ZodParsedType.nan:Ki.ZodParsedType.number;case"boolean":return Ki.ZodParsedType.boolean;case"function":return Ki.ZodParsedType.function;case"bigint":return Ki.ZodParsedType.bigint;case"symbol":return Ki.ZodParsedType.symbol;case"object":return Array.isArray(t)?Ki.ZodParsedType.array:t===null?Ki.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ki.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?Ki.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?Ki.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?Ki.ZodParsedType.date:Ki.ZodParsedType.object;default:return Ki.ZodParsedType.unknown}};Ki.getParsedType=WXr});var Uae=v(jI=>{"use strict";Object.defineProperty(jI,"__esModule",{value:!0});jI.ZodError=jI.quotelessJson=jI.ZodIssueCode=void 0;var tLt=E5();jI.ZodIssueCode=tLt.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 KXr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");jI.quotelessJson=KXr;var T5=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(;ur.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};jI.ZodError=T5;T5.create=t=>new T5(t)});var mNe=v(pNe=>{"use strict";Object.defineProperty(pNe,"__esModule",{value:!0});var GN=E5(),sf=Uae(),GXr=(t,e)=>{let r;switch(t.code){case sf.ZodIssueCode.invalid_type:t.received===GN.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case sf.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,GN.util.jsonStringifyReplacer)}`;break;case sf.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${GN.util.joinValues(t.keys,", ")}`;break;case sf.ZodIssueCode.invalid_union:r="Invalid input";break;case sf.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${GN.util.joinValues(t.options)}`;break;case sf.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${GN.util.joinValues(t.options)}, received '${t.received}'`;break;case sf.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case sf.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case sf.ZodIssueCode.invalid_date:r="Invalid date";break;case sf.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}"`:GN.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case sf.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case sf.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 sf.ZodIssueCode.custom:r="Invalid input";break;case sf.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case sf.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case sf.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,GN.util.assertNever(t)}return{message:r}};pNe.default=GXr});var zae=v(Fx=>{"use strict";var JXr=Fx&&Fx.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fx,"__esModule",{value:!0});Fx.getErrorMap=Fx.setErrorMap=Fx.defaultErrorMap=void 0;var rLt=JXr(mNe());Fx.defaultErrorMap=rLt.default;var nLt=rLt.default;function YXr(t){nLt=t}Fx.setErrorMap=YXr;function ZXr(){return nLt}Fx.getErrorMap=ZXr});var gNe=v(hi=>{"use strict";var XXr=hi&&hi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hi,"__esModule",{value:!0});hi.isAsync=hi.isValid=hi.isDirty=hi.isAborted=hi.OK=hi.DIRTY=hi.INVALID=hi.ParseStatus=hi.addIssueToContext=hi.EMPTY_PATH=hi.makeIssue=void 0;var QXr=zae(),oLt=XXr(mNe()),eQr=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}};hi.makeIssue=eQr;hi.EMPTY_PATH=[];function tQr(t,e){let r=(0,QXr.getErrorMap)(),n=(0,hi.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===oLt.default?void 0:oLt.default].filter(o=>!!o)});t.common.issues.push(n)}hi.addIssueToContext=tQr;var hNe=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 hi.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 hi.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}}};hi.ParseStatus=hNe;hi.INVALID=Object.freeze({status:"aborted"});var rQr=t=>({status:"dirty",value:t});hi.DIRTY=rQr;var nQr=t=>({status:"valid",value:t});hi.OK=nQr;var oQr=t=>t.status==="aborted";hi.isAborted=oQr;var iQr=t=>t.status==="dirty";hi.isDirty=iQr;var aQr=t=>t.status==="valid";hi.isValid=aQr;var sQr=t=>typeof Promise<"u"&&t instanceof Promise;hi.isAsync=sQr});var aLt=v(iLt=>{"use strict";Object.defineProperty(iLt,"__esModule",{value:!0})});var uLt=v(Hae=>{"use strict";Object.defineProperty(Hae,"__esModule",{value:!0});Hae.errorUtil=void 0;var sLt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(sLt||(Hae.errorUtil=sLt={}))});var wLt=v(re=>{"use strict";var Wae=re&&re.__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)},dLt=re&&re.__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},A5,I5;Object.defineProperty(re,"__esModule",{value:!0});re.boolean=re.bigint=re.array=re.any=re.coerce=re.ZodFirstPartyTypeKind=re.late=re.ZodSchema=re.Schema=re.custom=re.ZodReadonly=re.ZodPipeline=re.ZodBranded=re.BRAND=re.ZodNaN=re.ZodCatch=re.ZodDefault=re.ZodNullable=re.ZodOptional=re.ZodTransformer=re.ZodEffects=re.ZodPromise=re.ZodNativeEnum=re.ZodEnum=re.ZodLiteral=re.ZodLazy=re.ZodFunction=re.ZodSet=re.ZodMap=re.ZodRecord=re.ZodTuple=re.ZodIntersection=re.ZodDiscriminatedUnion=re.ZodUnion=re.ZodObject=re.ZodArray=re.ZodVoid=re.ZodNever=re.ZodUnknown=re.ZodAny=re.ZodNull=re.ZodUndefined=re.ZodSymbol=re.ZodDate=re.ZodBoolean=re.ZodBigInt=re.ZodNumber=re.ZodString=re.datetimeRegex=re.ZodType=void 0;re.NEVER=re.void=re.unknown=re.union=re.undefined=re.tuple=re.transformer=re.symbol=re.string=re.strictObject=re.set=re.record=re.promise=re.preprocess=re.pipeline=re.ostring=re.optional=re.onumber=re.oboolean=re.object=re.number=re.nullable=re.null=re.never=re.nativeEnum=re.nan=re.map=re.literal=re.lazy=re.intersection=re.instanceof=re.function=re.enum=re.effect=re.discriminatedUnion=re.date=void 0;var Vae=zae(),Ut=uLt(),ne=gNe(),nt=E5(),We=Uae(),Rg=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},lLt=(t,e)=>{if((0,ne.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 We.ZodError(t.common.issues);return this._error=r,this._error}}};function Zr(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{var u,l;let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(u=c??n)!==null&&u!==void 0?u:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(l=c??r)!==null&&l!==void 0?l:s.defaultError}},description:o}}var Xr=class{get description(){return this._def.description}_getType(e){return(0,nt.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,nt.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ne.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,nt.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,ne.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let o={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,nt.getParsedType)(e)},i=this._parseSync({data:e,path:o.path,parent:o});return lLt(o,i)}"~validate"(e){var r,n;let o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,nt.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:o});return(0,ne.isValid)(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((n=(r=i?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then(i=>(0,ne.isValid)(i)?{value:i.value}:{issues:o.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,nt.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,ne.isAsync)(o)?o:Promise.resolve(o));return lLt(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:We.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 oh({schema:this,typeName:gr.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 Mg.create(this,this._def)}nullable(){return $x.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hP.create(this)}promise(){return LI.create(this,this._def)}or(e){return tD.create([this,e],this._def)}and(e){return rD.create(this,e,this._def)}transform(e){return new oh({...Zr(this._def),schema:this,typeName:gr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new sD({...Zr(this._def),innerType:this,defaultValue:r,typeName:gr.ZodDefault})}brand(){return new M5({typeName:gr.ZodBranded,type:this,...Zr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new uD({...Zr(this._def),innerType:this,catchValue:r,typeName:gr.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return R5.create(this,e)}readonly(){return lD.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};re.ZodType=Xr;re.Schema=Xr;re.ZodSchema=Xr;var uQr=/^c[^\s-]{8,}$/i,lQr=/^[0-9a-z]+$/,cQr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dQr=/^[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,fQr=/^[a-z0-9_-]{21}$/i,pQr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mQr=/^[-+]?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)?)??$/,hQr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,gQr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",yNe,yQr=/^(?:(?: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])$/,bQr=/^(?:(?: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])$/,_Qr=/^(([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]))$/,vQr=/^(([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])$/,wQr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,SQr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fLt="((\\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])))",xQr=new RegExp(`^${fLt}$`);function pLt(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function CQr(t){return new RegExp(`^${pLt(t)}$`)}function mLt(t){let e=`${fLt}T${pLt(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}re.datetimeRegex=mLt;function OQr(t,e){return!!((e==="v4"||!e)&&yQr.test(t)||(e==="v6"||!e)&&_Qr.test(t))}function PQr(t,e){if(!pQr.test(t))return!1;try{let[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||!o.typ||!o.alg||e&&o.alg!==e)}catch{return!1}}function EQr(t,e){return!!((e==="v4"||!e)&&bQr.test(t)||(e==="v6"||!e)&&vQr.test(t))}var NI=class t extends Xr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==nt.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(i,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.string,received:i.parsedType}),ne.INVALID}let n=new ne.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{code:We.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.lengthe.test(o),{validation:r,code:We.ZodIssueCode.invalid_string,...Ut.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ut.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ut.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ut.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ut.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ut.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ut.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ut.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ut.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ut.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ut.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ut.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ut.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ut.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...Ut.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,...Ut.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ut.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Ut.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Ut.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Ut.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Ut.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Ut.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Ut.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Ut.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,Ut.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{var e;return new NI({checks:[],typeName:gr.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Zr(t)})};function TQr(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=parseInt(t.toFixed(o).replace(".","")),a=parseInt(e.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}var JN=class t extends Xr{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)!==nt.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(i,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.number,received:i.parsedType}),ne.INVALID}let n,o=new ne.ParseStatus;for(let i of this._def.checks)i.kind==="int"?nt.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?TQr(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,ne.addIssueToContext)(n,{code:We.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,ne.addIssueToContext)(n,{code:We.ZodIssueCode.not_finite,message:i.message}),o.dirty()):nt.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Ut.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ut.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ut.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ut.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Ut.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ut.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ut.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ut.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ut.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ut.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ut.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Ut.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ut.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ut.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.valuee.kind==="int"||e.kind==="multipleOf"&&nt.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.valuenew JN({checks:[],typeName:gr.ZodNumber,coerce:t?.coerce||!1,...Zr(t)});var YN=class t extends Xr{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)!==nt.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new ne.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,ne.addIssueToContext)(n,{code:We.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,ne.addIssueToContext)(n,{code:We.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):nt.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.bigint,received:r.parsedType}),ne.INVALID}gte(e,r){return this.setLimit("min",e,!0,Ut.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ut.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ut.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ut.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Ut.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:Ut.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ut.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ut.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ut.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ut.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{var e;return new YN({checks:[],typeName:gr.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Zr(t)})};var ZN=class extends Xr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==nt.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.boolean,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodBoolean=ZN;ZN.create=t=>new ZN({typeName:gr.ZodBoolean,coerce:t?.coerce||!1,...Zr(t)});var XN=class t extends Xr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==nt.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(i,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.date,received:i.parsedType}),ne.INVALID}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(i,{code:We.ZodIssueCode.invalid_date}),ne.INVALID}let n=new ne.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{code:We.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):nt.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:Ut.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Ut.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.valuenew XN({checks:[],coerce:t?.coerce||!1,typeName:gr.ZodDate,...Zr(t)});var _U=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.symbol,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodSymbol=_U;_U.create=t=>new _U({typeName:gr.ZodSymbol,...Zr(t)});var QN=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.undefined,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodUndefined=QN;QN.create=t=>new QN({typeName:gr.ZodUndefined,...Zr(t)});var eD=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.null,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodNull=eD;eD.create=t=>new eD({typeName:gr.ZodNull,...Zr(t)});var DI=class extends Xr{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,ne.OK)(e.data)}};re.ZodAny=DI;DI.create=t=>new DI({typeName:gr.ZodAny,...Zr(t)});var mP=class extends Xr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,ne.OK)(e.data)}};re.ZodUnknown=mP;mP.create=t=>new mP({typeName:gr.ZodUnknown,...Zr(t)});var lb=class extends Xr{_parse(e){let r=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.never,received:r.parsedType}),ne.INVALID}};re.ZodNever=lb;lb.create=t=>new lb({typeName:gr.ZodNever,...Zr(t)});var vU=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.void,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodVoid=vU;vU.create=t=>new vU({typeName:gr.ZodVoid,...Zr(t)});var hP=class t extends Xr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==nt.ZodParsedType.array)return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.array,received:r.parsedType}),ne.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.lengtho.maxLength.value&&((0,ne.addIssueToContext)(r,{code:We.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 Rg(r,a,r.path,s)))).then(a=>ne.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Rg(r,a,r.path,s)));return ne.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Ut.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Ut.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Ut.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};re.ZodArray=hP;hP.create=(t,e)=>new hP({type:t,minLength:null,maxLength:null,exactLength:null,typeName:gr.ZodArray,...Zr(e)});function bU(t){if(t instanceof Xp){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Mg.create(bU(n))}return new Xp({...t._def,shape:()=>e})}else return t instanceof hP?new hP({...t._def,type:bU(t.element)}):t instanceof Mg?Mg.create(bU(t.unwrap())):t instanceof $x?$x.create(bU(t.unwrap())):t instanceof kx?kx.create(t.items.map(e=>bU(e))):t}var Xp=class t extends Xr{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=nt.util.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==nt.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(l,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.object,received:l.parsedType}),ne.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof lb&&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 Rg(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof lb){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,ne.addIssueToContext)(o,{code:We.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 Rg(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=>ne.ParseStatus.mergeObjectSync(n,l)):ne.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Ut.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i,a,s;let u=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=Ut.errorUtil.errToObj(e).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:gr.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return nt.util.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return nt.util.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return bU(this)}partial(e){let r={};return nt.util.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return nt.util.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Mg;)i=i._def.innerType;r[n]=i}}),new t({...this._def,shape:()=>r})}keyof(){return hLt(nt.util.objectKeys(this.shape))}};re.ZodObject=Xp;Xp.create=(t,e)=>new Xp({shape:()=>t,unknownKeys:"strip",catchall:lb.create(),typeName:gr.ZodObject,...Zr(e)});Xp.strictCreate=(t,e)=>new Xp({shape:()=>t,unknownKeys:"strict",catchall:lb.create(),typeName:gr.ZodObject,...Zr(e)});Xp.lazycreate=(t,e)=>new Xp({shape:t,unknownKeys:"strip",catchall:lb.create(),typeName:gr.ZodObject,...Zr(e)});var tD=class extends Xr{_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 We.ZodError(s.ctx.common.issues));return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_union,unionErrors:a}),ne.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 We.ZodError(u));return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_union,unionErrors:s}),ne.INVALID}}get options(){return this._def.options}};re.ZodUnion=tD;tD.create=(t,e)=>new tD({options:t,typeName:gr.ZodUnion,...Zr(e)});var pP=t=>t instanceof nD?pP(t.schema):t instanceof oh?pP(t.innerType()):t instanceof oD?[t.value]:t instanceof iD?t.options:t instanceof aD?nt.util.objectValues(t.enum):t instanceof sD?pP(t._def.innerType):t instanceof QN?[void 0]:t instanceof eD?[null]:t instanceof Mg?[void 0,...pP(t.unwrap())]:t instanceof $x?[null,...pP(t.unwrap())]:t instanceof M5||t instanceof lD?pP(t.unwrap()):t instanceof uD?pP(t._def.innerType):[],Kae=class t extends Xr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==nt.ZodParsedType.object)return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.object,received:r.parsedType}),ne.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,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ne.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=pP(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:gr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Zr(n)})}};re.ZodDiscriminatedUnion=Kae;function bNe(t,e){let r=(0,nt.getParsedType)(t),n=(0,nt.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===nt.ZodParsedType.object&&n===nt.ZodParsedType.object){let o=nt.util.objectKeys(e),i=nt.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=bNe(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===nt.ZodParsedType.array&&n===nt.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{if((0,ne.isAborted)(i)||(0,ne.isAborted)(a))return ne.INVALID;let s=bNe(i.value,a.value);return s.valid?(((0,ne.isDirty)(i)||(0,ne.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_intersection_types}),ne.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}))}};re.ZodIntersection=rD;rD.create=(t,e,r)=>new rD({left:t,right:e,typeName:gr.ZodIntersection,...Zr(r)});var kx=class t extends Xr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==nt.ZodParsedType.array)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.array,received:n.parsedType}),ne.INVALID;if(n.data.lengththis._def.items.length&&((0,ne.addIssueToContext)(n,{code:We.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 Rg(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>ne.ParseStatus.mergeArray(r,a)):ne.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};re.ZodTuple=kx;kx.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new kx({items:t,typeName:gr.ZodTuple,rest:null,...Zr(e)})};var Gae=class t extends Xr{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!==nt.ZodParsedType.object)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.object,received:n.parsedType}),ne.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Rg(n,s,n.path,s)),value:a._parse(new Rg(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?ne.ParseStatus.mergeObjectAsync(r,o):ne.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Xr?new t({keyType:e,valueType:r,typeName:gr.ZodRecord,...Zr(n)}):new t({keyType:NI.create(),valueType:e,typeName:gr.ZodRecord,...Zr(r)})}};re.ZodRecord=Gae;var wU=class extends Xr{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!==nt.ZodParsedType.map)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.map,received:n.parsedType}),ne.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Rg(n,s,n.path,[l,"key"])),value:i._parse(new Rg(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 ne.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 ne.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};re.ZodMap=wU;wU.create=(t,e,r)=>new wU({valueType:e,keyType:t,typeName:gr.ZodMap,...Zr(r)});var SU=class t extends Xr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==nt.ZodParsedType.set)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.set,received:n.parsedType}),ne.INVALID;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&((0,ne.addIssueToContext)(n,{code:We.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 ne.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 Rg(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:Ut.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Ut.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};re.ZodSet=SU;SU.create=(t,e)=>new SU({valueType:t,minSize:null,maxSize:null,typeName:gr.ZodSet,...Zr(e)});var Jae=class t extends Xr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==nt.ZodParsedType.function)return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.function,received:r.parsedType}),ne.INVALID;function n(s,u){return(0,ne.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Vae.getErrorMap)(),Vae.defaultErrorMap].filter(l=>!!l),issueData:{code:We.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,ne.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Vae.getErrorMap)(),Vae.defaultErrorMap].filter(l=>!!l),issueData:{code:We.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof LI){let s=this;return(0,ne.OK)(async function(...u){let l=new We.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,ne.OK)(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new We.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 We.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:kx.create(e).rest(mP.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||kx.create([]).rest(mP.create()),returns:r||mP.create(),typeName:gr.ZodFunction,...Zr(n)})}};re.ZodFunction=Jae;var nD=class extends Xr{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})}};re.ZodLazy=nD;nD.create=(t,e)=>new nD({getter:t,typeName:gr.ZodLazy,...Zr(e)});var oD=class extends Xr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(r,{received:r.data,code:We.ZodIssueCode.invalid_literal,expected:this._def.value}),ne.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};re.ZodLiteral=oD;oD.create=(t,e)=>new oD({value:t,typeName:gr.ZodLiteral,...Zr(e)});function hLt(t,e){return new iD({values:t,typeName:gr.ZodEnum,...Zr(e)})}var iD=class t extends Xr{constructor(){super(...arguments),A5.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ne.addIssueToContext)(r,{expected:nt.util.joinValues(n),received:r.parsedType,code:We.ZodIssueCode.invalid_type}),ne.INVALID}if(Wae(this,A5,"f")||dLt(this,A5,new Set(this._def.values),"f"),!Wae(this,A5,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ne.addIssueToContext)(r,{received:r.data,code:We.ZodIssueCode.invalid_enum_value,options:n}),ne.INVALID}return(0,ne.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})}};re.ZodEnum=iD;A5=new WeakMap;iD.create=hLt;var aD=class extends Xr{constructor(){super(...arguments),I5.set(this,void 0)}_parse(e){let r=nt.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==nt.ZodParsedType.string&&n.parsedType!==nt.ZodParsedType.number){let o=nt.util.objectValues(r);return(0,ne.addIssueToContext)(n,{expected:nt.util.joinValues(o),received:n.parsedType,code:We.ZodIssueCode.invalid_type}),ne.INVALID}if(Wae(this,I5,"f")||dLt(this,I5,new Set(nt.util.getValidEnumValues(this._def.values)),"f"),!Wae(this,I5,"f").has(e.data)){let o=nt.util.objectValues(r);return(0,ne.addIssueToContext)(n,{received:n.data,code:We.ZodIssueCode.invalid_enum_value,options:o}),ne.INVALID}return(0,ne.OK)(e.data)}get enum(){return this._def.values}};re.ZodNativeEnum=aD;I5=new WeakMap;aD.create=(t,e)=>new aD({values:t,typeName:gr.ZodNativeEnum,...Zr(e)});var LI=class extends Xr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==nt.ZodParsedType.promise&&r.common.async===!1)return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.promise,received:r.parsedType}),ne.INVALID;let n=r.parsedType===nt.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,ne.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};re.ZodPromise=LI;LI.create=(t,e)=>new LI({type:t,typeName:gr.ZodPromise,...Zr(e)});var oh=class extends Xr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===gr.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,ne.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 ne.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?ne.INVALID:u.status==="dirty"||r.value==="dirty"?(0,ne.DIRTY)(u.value):u});{if(r.value==="aborted")return ne.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?ne.INVALID:s.status==="dirty"||r.value==="dirty"?(0,ne.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"?ne.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"?ne.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,ne.isValid)(a))return a;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,ne.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);nt.util.assertNever(o)}};re.ZodEffects=oh;re.ZodTransformer=oh;oh.create=(t,e,r)=>new oh({schema:t,typeName:gr.ZodEffects,effect:e,...Zr(r)});oh.createWithPreprocess=(t,e,r)=>new oh({schema:e,effect:{type:"preprocess",transform:t},typeName:gr.ZodEffects,...Zr(r)});var Mg=class extends Xr{_parse(e){return this._getType(e)===nt.ZodParsedType.undefined?(0,ne.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};re.ZodOptional=Mg;Mg.create=(t,e)=>new Mg({innerType:t,typeName:gr.ZodOptional,...Zr(e)});var $x=class extends Xr{_parse(e){return this._getType(e)===nt.ZodParsedType.null?(0,ne.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};re.ZodNullable=$x;$x.create=(t,e)=>new $x({innerType:t,typeName:gr.ZodNullable,...Zr(e)});var sD=class extends Xr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===nt.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};re.ZodDefault=sD;sD.create=(t,e)=>new sD({innerType:t,typeName:gr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Zr(e)});var uD=class extends Xr{_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,ne.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new We.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new We.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};re.ZodCatch=uD;uD.create=(t,e)=>new uD({innerType:t,typeName:gr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Zr(e)});var xU=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.nan,received:n.parsedType}),ne.INVALID}return{status:"valid",value:e.data}}};re.ZodNaN=xU;xU.create=t=>new xU({typeName:gr.ZodNaN,...Zr(t)});re.BRAND=Symbol("zod_brand");var M5=class extends Xr{_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}};re.ZodBranded=M5;var R5=class t extends Xr{_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"?ne.INVALID:i.status==="dirty"?(r.dirty(),(0,ne.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"?ne.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:gr.ZodPipeline})}};re.ZodPipeline=R5;var lD=class extends Xr{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,ne.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,ne.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};re.ZodReadonly=lD;lD.create=(t,e)=>new lD({innerType:t,typeName:gr.ZodReadonly,...Zr(e)});function cLt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function gLt(t,e={},r){return t?DI.create().superRefine((n,o)=>{var i,a;let s=t(n);if(s instanceof Promise)return s.then(u=>{var l,c;if(!u){let d=cLt(e,n),f=(c=(l=d.fatal)!==null&&l!==void 0?l:r)!==null&&c!==void 0?c:!0;o.addIssue({code:"custom",...d,fatal:f})}});if(!s){let u=cLt(e,n),l=(a=(i=u.fatal)!==null&&i!==void 0?i:r)!==null&&a!==void 0?a:!0;o.addIssue({code:"custom",...u,fatal:l})}}):DI.create()}re.custom=gLt;re.late={object:Xp.lazycreate};var gr;(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"})(gr||(re.ZodFirstPartyTypeKind=gr={}));var AQr=(t,e={message:`Input not instance of ${t.name}`})=>gLt(r=>r instanceof t,e);re.instanceof=AQr;var yLt=NI.create;re.string=yLt;var bLt=JN.create;re.number=bLt;var IQr=xU.create;re.nan=IQr;var MQr=YN.create;re.bigint=MQr;var _Lt=ZN.create;re.boolean=_Lt;var RQr=XN.create;re.date=RQr;var jQr=_U.create;re.symbol=jQr;var NQr=QN.create;re.undefined=NQr;var DQr=eD.create;re.null=DQr;var LQr=DI.create;re.any=LQr;var FQr=mP.create;re.unknown=FQr;var kQr=lb.create;re.never=kQr;var $Qr=vU.create;re.void=$Qr;var BQr=hP.create;re.array=BQr;var qQr=Xp.create;re.object=qQr;var UQr=Xp.strictCreate;re.strictObject=UQr;var zQr=tD.create;re.union=zQr;var HQr=Kae.create;re.discriminatedUnion=HQr;var VQr=rD.create;re.intersection=VQr;var WQr=kx.create;re.tuple=WQr;var KQr=Gae.create;re.record=KQr;var GQr=wU.create;re.map=GQr;var JQr=SU.create;re.set=JQr;var YQr=Jae.create;re.function=YQr;var ZQr=nD.create;re.lazy=ZQr;var XQr=oD.create;re.literal=XQr;var QQr=iD.create;re.enum=QQr;var een=aD.create;re.nativeEnum=een;var ten=LI.create;re.promise=ten;var vLt=oh.create;re.effect=vLt;re.transformer=vLt;var ren=Mg.create;re.optional=ren;var nen=$x.create;re.nullable=nen;var oen=oh.createWithPreprocess;re.preprocess=oen;var ien=R5.create;re.pipeline=ien;var aen=()=>yLt().optional();re.ostring=aen;var sen=()=>bLt().optional();re.onumber=sen;var uen=()=>_Lt().optional();re.oboolean=uen;re.coerce={string:t=>NI.create({...t,coerce:!0}),number:t=>JN.create({...t,coerce:!0}),boolean:t=>ZN.create({...t,coerce:!0}),bigint:t=>YN.create({...t,coerce:!0}),date:t=>XN.create({...t,coerce:!0})};re.NEVER=ne.INVALID});var _Ne=v(jg=>{"use strict";var len=jg&&jg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CU=jg&&jg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&len(e,t,r)};Object.defineProperty(jg,"__esModule",{value:!0});CU(zae(),jg);CU(gNe(),jg);CU(aLt(),jg);CU(E5(),jg);CU(wLt(),jg);CU(Uae(),jg)});var Te=v(Qp=>{"use strict";var SLt=Qp&&Qp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Qp&&Qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),den=Qp&&Qp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SLt(e,t,r);return cen(e,t),e},fen=Qp&&Qp.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&SLt(e,t,r)};Object.defineProperty(Qp,"__esModule",{value:!0});Qp.z=void 0;var xLt=den(_Ne());Qp.z=xLt;fen(_Ne(),Qp);Qp.default=xLt});var SNe=v(mc=>{"use strict";var pen=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]}),men=mc&&mc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hen=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)&&pen(e,t,r);return men(e,t),e};Object.defineProperty(mc,"__esModule",{value:!0});mc.zodInbound=mc.zodOutbound=void 0;mc.bytesToBase64=CLt;mc.bytesFromBase64=vNe;mc.stringToBytes=wNe;mc.stringFromBytes=OLt;mc.stringToBase64=gen;mc.stringFromBase64=yen;var Yae=hen(Te());function CLt(t){return btoa(String.fromCodePoint(...t))}function vNe(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function wNe(t){return new TextEncoder().encode(t)}function OLt(t){return new TextDecoder().decode(t)}function gen(t){return CLt(wNe(t))}function yen(t){return OLt(vNe(t))}mc.zodOutbound=Yae.instanceof(Uint8Array).or(Yae.string().transform(wNe));mc.zodInbound=Yae.instanceof(Uint8Array).or(Yae.string().transform(vNe))});var CNe=v(xNe=>{"use strict";Object.defineProperty(xNe,"__esModule",{value:!0});xNe.isPlainObject=ben;function ben(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 ii=v(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.encodeDeepObjectQuery=ao.encodePipeDelimitedQuery=ao.encodeSpaceDelimitedQuery=ao.encodeFormQuery=ao.encodeJSONQuery=ao.encodeSimple=ao.encodePipeDelimited=ao.encodeSpaceDelimited=ao.encodeForm=ao.EncodingError=void 0;ao.encodeMatrix=_en;ao.encodeLabel=ven;ao.encodeBodyForm=wen;ao.encodeDeepObject=ELt;ao.encodeDeepObjectObject=PNe;ao.encodeJSON=TLt;ao.queryJoin=ALt;ao.queryEncoder=PU;ao.appendForm=xen;var PLt=SNe(),cb=CNe(),j5=class extends Error{constructor(e){super(e),this.name="EncodingError"}};ao.EncodingError=j5;function _en(t,e,r){let n="",o=r?.explode?N5(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(OU(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=D5(u,f=>`${a(f)}`)?.join(","):(0,cb.isPlainObject)(u)?c=Xae(Object.entries(u),([p,m])=>`,${i(p)},${a(m)}`)?.join("").slice(1):c=`${a(u)}`,c==null))return;let d=i(s);l=`${d}=${c}`,l===`${d}=`&&(l=l.slice(0,-1)),l&&(n+=`;${l}`)}),n}function ven(t,e,r){let n="",o=r?.explode?N5(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(OU(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=D5(u,c=>`${a(c)}`)?.join("."):(0,cb.isPlainObject)(u)?l=Xae(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,cb.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function ONe(t){return(e,r,n)=>{let o="",i=n?.explode?N5(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(OU(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=D5(c,p=>`${s(p)}`)?.join(u):(0,cb.isPlainObject)(c)?f=Xae(Object.entries(c),([p,m])=>`${a(p)}${u}${s(m)}`)?.join(u):f=`${s(c)}`,f!=null&&(d=`${a(l)}=${f}`,!(!d||d==="=")&&(o+=`&${d}`)))}),o.slice(1)}}ao.encodeForm=ONe(",");ao.encodeSpaceDelimited=ONe(" ");ao.encodePipeDelimited=ONe("|");function wen(t,e,r){let n="",o=r?.explode?N5(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(OU(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,cb.isPlainObject)(u)?c=JSON.stringify(u,Zae):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function ELt(t,e,r){if(e!=null){if(!(0,cb.isPlainObject)(e))throw new j5(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return PNe(t,e,r)}}function PNe(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,cb.isPlainObject)(e))throw new j5(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,cb.isPlainObject)(a)){let c=PNe(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=D5(u,c=>`${o(s)}=${o(OU(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function TLt(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,Zae));return r?.explode?o:`${n(t)}=${o}`}var Sen=(t,e,r)=>{let n="",o=r?.explode?N5(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(OU(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=D5(u,c=>`${a(c)}`)?.join(","):(0,cb.isPlainObject)(u)?l=Xae(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,cb.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};ao.encodeSimple=Sen;function N5(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,cb.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function OU(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,PLt.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,Zae):`${t}`}function Zae(t,e){return e instanceof Uint8Array?(0,PLt.bytesToBase64)(e):e}function D5(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 Xae(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 ALt(...t){return t.filter(Boolean).join("&")}function PU(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 ALt(...i)}}ao.encodeJSONQuery=PU(TLt);ao.encodeFormQuery=PU(ao.encodeForm);ao.encodeSpaceDelimitedQuery=PU(ao.encodeSpaceDelimited);ao.encodePipeDelimitedQuery=PU(ao.encodePipeDelimited);ao.encodeDeepObjectQuery=PU(ELt);function xen(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 ILt=v(ENe=>{"use strict";Object.defineProperty(ENe,"__esModule",{value:!0});ENe.dlv=Cen;function Cen(t,e,r,n,o){for(e=Array.isArray(e)?e:e.split("."),n=0;n{"use strict";var Oen=ih&&ih.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pen=ih&&ih.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Een=ih&&ih.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Oen(e,t,r);return Pen(e,t),e};Object.defineProperty(ih,"__esModule",{value:!0});ih.envSchema=void 0;ih.env=Ten;ih.resetEnv=Aen;var MLt=ILt(),TNe=Een(Te());ih.envSchema=TNe.object({MISTRAL_API_KEY:TNe.string().optional(),MISTRAL_DEBUG:TNe.coerce.boolean().optional()});var L5;function Ten(){return L5||(L5=ih.envSchema.parse((0,MLt.dlv)(globalThis,"process.env")??(0,MLt.dlv)(globalThis,"Deno.env")??{}),L5)}function Aen(){L5=void 0}});var F5=v(Bx=>{"use strict";Object.defineProperty(Bx,"__esModule",{value:!0});Bx.HTTPClient=void 0;Bx.matchContentType=jLt;Bx.matchStatusCode=NLt;Bx.matchResponse=Ren;Bx.isConnectionError=jen;Bx.isTimeoutError=Nen;Bx.isAbortError=Den;var Ien=(t,e)=>e==null?fetch(t):fetch(t,e),INe=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||Ien}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}};Bx.HTTPClient=INe;var RLt=/\s*;\s*/g;function jLt(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(RLt),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(RLt),[s="",...u]=a,[l="",c=""]=s.split("/");if(!l||!c||o!=="*/*"&&s!==o&&`${l}/*`!==o&&`*/${c}`!==o||u.length{let i=`${o}`;if(i==="default")return!0;if(!Men.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 Ren(t,e,r){return NLt(t,e)&&jLt(t,r)}function jen(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 Nen(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 Den(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 LLt=v(dD=>{"use strict";Object.defineProperty(dD,"__esModule",{value:!0});dD.TemporaryError=dD.PermanentError=void 0;dD.retry=Fen;var DLt=F5(),Len={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},k5=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)}};dD.PermanentError=k5;var cD=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};dD.TemporaryError=cD;async function Fen(t,e){switch(e.config.strategy){case"backoff":return qen(ken(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??Len);default:return await t()}}function ken(t,e){return async()=>{try{let r=await t();if(Ben(r,e.statusCodes))throw new cD("Response failed with retryable status code",r);return r}catch(r){throw r instanceof cD||e.retryConnectionErrors&&((0,DLt.isTimeoutError)(r)||(0,DLt.isConnectionError)(r))?r:new k5("Permanent error",{cause:r})}}}var $en=new RegExp("^[0-9]xx$","i");function Ben(t,e){let r=`${t.status}`;return e.some(n=>{if(!$en.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 qen(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 k5)throw u.cause;if(Date.now()-a>r){if(u instanceof cD)return u.response;throw u}let c=0;u instanceof cD&&(c=Uen(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await zen(d),s++}}function Uen(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 zen(t){return new Promise(e=>setTimeout(e,t))}});var ah=v(kI=>{"use strict";var $5=kI&&kI.__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},Ng=kI&&kI.__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)},ese,qx,gP;Object.defineProperty(kI,"__esModule",{value:!0});kI.ClientSDK=void 0;var FLt=QDt(),EU=dNe(),FI=Ig(),Hen=SNe(),kLt=kae(),Ven=ii(),Wen=ANe(),yP=F5(),Ken=LLt(),Qae=typeof globalThis>"u"?null:globalThis,Gen=typeof Qae=="object"&&Qae!=null&&"importScripts"in Qae&&typeof Qae.importScripts=="function",Jen=Gen||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",MNe=class{constructor(e={}){ese.set(this,void 0),qx.set(this,void 0),gP.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof FLt.SDKHooks?$5(this,qx,r.hooks,"f"):$5(this,qx,new FLt.SDKHooks,"f"),this._options={...e,hooks:Ng(this,qx,"f")};let n=(0,kLt.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=Ng(this,qx,"f").sdkInit({baseURL:n,client:e.httpClient||new yP.HTTPClient});this._baseURL=o,$5(this,ese,i,"f"),$5(this,gP,e.debugLogger,"f"),!Ng(this,gP,"f")&&(0,Wen.env)().MISTRAL_DEBUG&&$5(this,gP,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,FI.ERR)(new EU.InvalidRequestError("No base URL provided for operation"));let c=new URL(l),d=new URL(i,c);i&&(c.pathname+=c.pathname.endsWith("/")?"":"/",c.pathname+=d.pathname.replace(/^\/+/,""));let f=a||"",p=[];for(let[P,E]of Object.entries(u?.queryParams||{})){let A=(0,Ven.encodeForm)(P,E,{charEncoding:"percent"});typeof A<"u"&&p.push(A)}if(p.length&&(f+=`&${p.join("&")}`),f){let P=f.startsWith("&")?f.slice(1):f;c.search=`?${P}`}let m=new Headers(s),h=u?.basic.username,b=u?.basic.password;if(h!=null||b!=null){let P=(0,Hen.stringToBase64)([h||"",b||""].join(":"));m.set("Authorization",`Basic ${P}`)}let g=new Headers(u?.headers||{});for(let[P,E]of g)m.set(P,E);let y=m.get("cookie")||"";for(let[P,E]of Object.entries(u?.cookies||{}))y+=`; ${P}=${E}`;y=y.startsWith("; ")?y.slice(2):y,m.set("cookie",y);let S=new Headers(n?.fetchOptions?.headers);for(let[P,E]of S)m.set(P,E);Jen||m.set(r.uaHeader??"user-agent",kLt.SDK_METADATA.userAgent);let x=n?.fetchOptions;if(!x?.signal&&r.timeoutMs&&r.timeoutMs>0){let P=AbortSignal.timeout(r.timeoutMs);x?x.signal=P:x={signal:P}}r.body instanceof ReadableStream&&(x?x.duplex="half":x={duplex:"half"});let O;try{O=Ng(this,qx,"f").beforeCreateRequest(e,{url:c,options:{...x,body:r.body??null,headers:m,method:o}})}catch(P){return(0,FI.ERR)(new EU.UnexpectedClientError("Create request hook failed to execute",{cause:P}))}return(0,FI.OK)(new Request(O.url,O.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,Ken.retry)(async()=>{let i=await Ng(this,qx,"f").beforeRequest(n,e.clone());await Yen(Ng(this,gP,"f"),i).catch(s=>Ng(this,gP,"f")?.log("Failed to log request:",s));let a=await Ng(this,ese,"f").request(i);try{if((0,yP.matchStatusCode)(a,o)){let s=await Ng(this,qx,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await Ng(this,qx,"f").afterSuccess(n,a)}finally{await Zen(Ng(this,gP,"f"),a,i).catch(s=>Ng(this,gP,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,FI.OK)(i),i=>{switch(!0){case(0,yP.isAbortError)(i):return(0,FI.ERR)(new EU.RequestAbortedError("Request aborted by client",{cause:i}));case(0,yP.isTimeoutError)(i):return(0,FI.ERR)(new EU.RequestTimeoutError("Request timed out",{cause:i}));case(0,yP.isConnectionError)(i):return(0,FI.ERR)(new EU.ConnectionError("Unable to make request",{cause:i}));default:return(0,FI.ERR)(new EU.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};kI.ClientSDK=MNe;ese=new WeakMap,qx=new WeakMap,gP=new WeakMap;var $Lt=/^application\/(?:.{0,100}\+)?json/;async function Yen(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 $Lt.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?"":a;t.log(`${i}: ${s}`)}break}default:t.log(`<${r}>`);break}t.groupEnd(),t.groupEnd()}async function Zen(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,yP.matchContentType)(e,"application/json")||$Lt.test(o)):t.log(await e.clone().json());break;case(0,yP.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,yP.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,yP.matchContentType)(e,"multipart/form-data"):{let i=await e.clone().formData();for(let[a,s]of i){let u=s instanceof Blob?"":s;t.log(`${a}: ${u}`)}break}default:t.log(`<${n}>`);break}t.groupEnd(),t.groupEnd()}});var jNe=v(tse=>{"use strict";Object.defineProperty(tse,"__esModule",{value:!0});tse.SDKError=void 0;var RNe=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"}};tse.SDKError=RNe});var z5=v(U5=>{"use strict";Object.defineProperty(U5,"__esModule",{value:!0});U5.EventStream=void 0;U5.discardSentinel=etn;var B5=10,q5=13,BLt=new Set([B5,q5]),Xen=[new Uint8Array([q5,B5,q5,B5]),new Uint8Array([q5,q5]),new Uint8Array([B5,B5])],NNe=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;s0&&(r=r.slice(n),n=0)}if(r.length>0){let o=DNe(r,this.decoder);o!=null&&(yield o)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{e.releaseLock()}}};U5.EventStream=NNe;function qLt(t,e){let r=t[e],n=t[e+1];if(r==null||n==null||!BLt.has(r)||!BLt.has(n))return null;for(let o of Xen){let i=Qen(e,t,o);if(i!=null)return i}return null}function Qen(t,e,r){if(r.length>e.length-t)return null;for(let n=0;n0?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 etn(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{"use strict";var rtn=db&&db.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ntn=db&&db.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),otn=db&&db.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rtn(e,t,r);return ntn(e,t),e};Object.defineProperty(db,"__esModule",{value:!0});db.SDKValidationError=void 0;db.formatZodError=FNe;var itn=otn(Te()),LNe=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 itn.ZodError?`${this.rawMessage} +${FNe(this.cause)}`:this.toString()}};db.SDKValidationError=LNe;function FNe(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?`.${u}`:"",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(`${FNe(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var ve=v(H5=>{"use strict";Object.defineProperty(H5,"__esModule",{value:!0});H5.parse=stn;H5.safeParse=utn;H5.collectExtraKeys=ltn;var atn=Te(),zLt=kNe(),ULt=Ig();function stn(t,e,r){try{return e(t)}catch(n){throw n instanceof atn.ZodError?new zLt.SDKValidationError(r,n,t):n}}function utn(t,e,r){try{return(0,ULt.OK)(e(t))}catch(n){return(0,ULt.ERR)(new zLt.SDKValidationError(r,n,t))}}function ltn(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 ai=v(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.jsonErr=ftn;hc.json=ptn;hc.textErr=mtn;hc.text=htn;hc.bytesErr=gtn;hc.bytes=ytn;hc.streamErr=btn;hc.stream=_tn;hc.sseErr=vtn;hc.sse=wtn;hc.nilErr=Stn;hc.nil=xtn;hc.fail=Ctn;hc.match=Otn;hc.unpackHeaders=rse;hc.discardResponseBody=GLt;var HLt=jNe(),ctn=z5(),VLt=F5(),WLt=CNe(),KLt=ve(),dtn={json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function ftn(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function ptn(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function mtn(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function htn(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function gtn(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function ytn(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function btn(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function _tn(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function vtn(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function wtn(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function Stn(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function xtn(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function Ctn(t){return{enc:"fail",codes:t}}function Otn(...t){return async function(r,n){let o,i;for(let l of t){let{codes:c}=l,d="ctype"in l?l.ctype:dtn[l.enc];if(d&&(0,VLt.matchResponse)(r,c,d)){i=l;break}else if(!d&&(0,VLt.matchStatusCode)(r,c)){i=l;break}}if(!i){let l=await r.text();return[{ok:!1,error:new HLt.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,ctn.discardSentinel)(r.body,i.sseSentinel):r.body;break;case"nil":o=await GLt(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 HLt.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:rse(r.headers)}:null,...(0,WLt.isPlainObject)(o)?o:null}:s?u={...n?.extraFields,...i.hdrs?{Headers:rse(r.headers)}:null,[s]:o}:i.hdrs?u={...n?.extraFields,...i.hdrs?{Headers:rse(r.headers)}:null,...(0,WLt.isPlainObject)(o)?o:null}:u=o,"err"in i){let l=(0,KLt.safeParse)(u,c=>i.schema.parse(c),"Response validation failed");return[l.ok?{ok:!1,error:l.value}:l,o]}else return[(0,KLt.safeParse)(u,l=>i.schema.parse(l),"Response validation failed"),o]}}var Ptn=/, */;function rse(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(Ptn);return e}async function GLt(t){let e=t.body?.getReader();if(e!=null)try{let r=!1;for(;!r;)r=(await e.read()).done}finally{e.releaseLock()}}});var Ue=v(fD=>{"use strict";Object.defineProperty(fD,"__esModule",{value:!0});fD.invariant=Etn;fD.remap=Ttn;fD.combineSignals=Atn;fD.abortSignalAny=JLt;fD.compactMap=Itn;var $Ne=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function Etn(t,e){if(!t)throw new $Ne(e)}function Ttn(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 Atn(...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):JLt(e)}}function JLt(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 Itn(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}});var si=v(bP=>{"use strict";Object.defineProperty(bP,"__esModule",{value:!0});bP.SecurityError=bP.SecurityErrorCode=void 0;bP.resolveSecurity=YLt;bP.resolveGlobalSecurity=jtn;bP.extractSecurity=Ntn;var Mtn=ANe(),ose;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(ose||(bP.SecurityErrorCode=ose={}));var ise=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(ose.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(ose.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};bP.SecurityError=ise;function YLt(...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":Rtn(e,n);break;case"http:custom":break;case"http:bearer":nse(e,n);break;case"oauth2":nse(e,n);break;case"oauth2:password":nse(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":nse(e,n);break;default:throw ise.unrecognizedType(o)}}),e)}function Rtn(t,e){e.value!=null&&(t.basic=e.value)}function nse(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 jtn(t){return YLt([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,Mtn.env)().MISTRAL_API_KEY}])}async function Ntn(t){if(t!=null)return typeof t=="function"?t():t}});var BNe=v(ru=>{"use strict";var Dtn=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]}),Ltn=ru&&ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ftn=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)&&Dtn(e,t,r);return Ltn(e,t),e};Object.defineProperty(ru,"__esModule",{value:!0});ru.ImageURL$=ru.ImageURL$outboundSchema=ru.ImageURL$inboundSchema=void 0;ru.imageURLToJSON=$tn;ru.imageURLFromJSON=Btn;var $I=Ftn(Te()),ktn=ve();ru.ImageURL$inboundSchema=$I.object({url:$I.string(),detail:$I.nullable($I.string()).optional()});ru.ImageURL$outboundSchema=$I.object({url:$I.string(),detail:$I.nullable($I.string()).optional()});var ZLt;(function(t){t.inboundSchema=ru.ImageURL$inboundSchema,t.outboundSchema=ru.ImageURL$outboundSchema})(ZLt||(ru.ImageURL$=ZLt={}));function $tn(t){return JSON.stringify(ru.ImageURL$outboundSchema.parse(t))}function Btn(t){return(0,ktn.safeParse)(t,e=>ru.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var qNe=v(Pr=>{"use strict";var qtn=Pr&&Pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Utn=Pr&&Pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ztn=Pr&&Pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qtn(e,t,r);return Utn(e,t),e};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.ImageURLChunk$=Pr.ImageURLChunk$outboundSchema=Pr.ImageURLChunk$inboundSchema=Pr.ImageURLChunkType$=Pr.ImageURLChunkType$outboundSchema=Pr.ImageURLChunkType$inboundSchema=Pr.ImageURLChunkImageURL$=Pr.ImageURLChunkImageURL$outboundSchema=Pr.ImageURLChunkImageURL$inboundSchema=Pr.ImageURLChunkType=void 0;Pr.imageURLChunkImageURLToJSON=Htn;Pr.imageURLChunkImageURLFromJSON=Vtn;Pr.imageURLChunkToJSON=Wtn;Pr.imageURLChunkFromJSON=Ktn;var fb=ztn(Te()),tFt=Ue(),rFt=ve(),ase=BNe();Pr.ImageURLChunkType={ImageUrl:"image_url"};Pr.ImageURLChunkImageURL$inboundSchema=fb.union([ase.ImageURL$inboundSchema,fb.string()]);Pr.ImageURLChunkImageURL$outboundSchema=fb.union([ase.ImageURL$outboundSchema,fb.string()]);var XLt;(function(t){t.inboundSchema=Pr.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=Pr.ImageURLChunkImageURL$outboundSchema})(XLt||(Pr.ImageURLChunkImageURL$=XLt={}));function Htn(t){return JSON.stringify(Pr.ImageURLChunkImageURL$outboundSchema.parse(t))}function Vtn(t){return(0,rFt.safeParse)(t,e=>Pr.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}Pr.ImageURLChunkType$inboundSchema=fb.nativeEnum(Pr.ImageURLChunkType);Pr.ImageURLChunkType$outboundSchema=Pr.ImageURLChunkType$inboundSchema;var QLt;(function(t){t.inboundSchema=Pr.ImageURLChunkType$inboundSchema,t.outboundSchema=Pr.ImageURLChunkType$outboundSchema})(QLt||(Pr.ImageURLChunkType$=QLt={}));Pr.ImageURLChunk$inboundSchema=fb.object({image_url:fb.union([ase.ImageURL$inboundSchema,fb.string()]),type:Pr.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,tFt.remap)(t,{image_url:"imageUrl"}));Pr.ImageURLChunk$outboundSchema=fb.object({imageUrl:fb.union([ase.ImageURL$outboundSchema,fb.string()]),type:Pr.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,tFt.remap)(t,{imageUrl:"image_url"}));var eFt;(function(t){t.inboundSchema=Pr.ImageURLChunk$inboundSchema,t.outboundSchema=Pr.ImageURLChunk$outboundSchema})(eFt||(Pr.ImageURLChunk$=eFt={}));function Wtn(t){return JSON.stringify(Pr.ImageURLChunk$outboundSchema.parse(t))}function Ktn(t){return(0,rFt.safeParse)(t,e=>Pr.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var UNe=v(so=>{"use strict";var Gtn=so&&so.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jtn=so&&so.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ytn=so&&so.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gtn(e,t,r);return Jtn(e,t),e};Object.defineProperty(so,"__esModule",{value:!0});so.ReferenceChunk$=so.ReferenceChunk$outboundSchema=so.ReferenceChunk$inboundSchema=so.ReferenceChunkType$=so.ReferenceChunkType$outboundSchema=so.ReferenceChunkType$inboundSchema=so.ReferenceChunkType=void 0;so.referenceChunkToJSON=Xtn;so.referenceChunkFromJSON=Qtn;var pD=Ytn(Te()),iFt=Ue(),Ztn=ve();so.ReferenceChunkType={Reference:"reference"};so.ReferenceChunkType$inboundSchema=pD.nativeEnum(so.ReferenceChunkType);so.ReferenceChunkType$outboundSchema=so.ReferenceChunkType$inboundSchema;var nFt;(function(t){t.inboundSchema=so.ReferenceChunkType$inboundSchema,t.outboundSchema=so.ReferenceChunkType$outboundSchema})(nFt||(so.ReferenceChunkType$=nFt={}));so.ReferenceChunk$inboundSchema=pD.object({reference_ids:pD.array(pD.number().int()),type:so.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,iFt.remap)(t,{reference_ids:"referenceIds"}));so.ReferenceChunk$outboundSchema=pD.object({referenceIds:pD.array(pD.number().int()),type:so.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,iFt.remap)(t,{referenceIds:"reference_ids"}));var oFt;(function(t){t.inboundSchema=so.ReferenceChunk$inboundSchema,t.outboundSchema=so.ReferenceChunk$outboundSchema})(oFt||(so.ReferenceChunk$=oFt={}));function Xtn(t){return JSON.stringify(so.ReferenceChunk$outboundSchema.parse(t))}function Qtn(t){return(0,Ztn.safeParse)(t,e=>so.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var sse=v(uo=>{"use strict";var ern=uo&&uo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),trn=uo&&uo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rrn=uo&&uo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ern(e,t,r);return trn(e,t),e};Object.defineProperty(uo,"__esModule",{value:!0});uo.TextChunk$=uo.TextChunk$outboundSchema=uo.TextChunk$inboundSchema=uo.TextChunkType$=uo.TextChunkType$outboundSchema=uo.TextChunkType$inboundSchema=uo.TextChunkType=void 0;uo.textChunkToJSON=orn;uo.textChunkFromJSON=irn;var V5=rrn(Te()),nrn=ve();uo.TextChunkType={Text:"text"};uo.TextChunkType$inboundSchema=V5.nativeEnum(uo.TextChunkType);uo.TextChunkType$outboundSchema=uo.TextChunkType$inboundSchema;var aFt;(function(t){t.inboundSchema=uo.TextChunkType$inboundSchema,t.outboundSchema=uo.TextChunkType$outboundSchema})(aFt||(uo.TextChunkType$=aFt={}));uo.TextChunk$inboundSchema=V5.object({text:V5.string(),type:uo.TextChunkType$inboundSchema.default("text")});uo.TextChunk$outboundSchema=V5.object({text:V5.string(),type:uo.TextChunkType$outboundSchema.default("text")});var sFt;(function(t){t.inboundSchema=uo.TextChunk$inboundSchema,t.outboundSchema=uo.TextChunk$outboundSchema})(sFt||(uo.TextChunk$=sFt={}));function orn(t){return JSON.stringify(uo.TextChunk$outboundSchema.parse(t))}function irn(t){return(0,nrn.safeParse)(t,e=>uo.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var TU=v(nu=>{"use strict";var arn=nu&&nu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),srn=nu&&nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),urn=nu&&nu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&arn(e,t,r);return srn(e,t),e};Object.defineProperty(nu,"__esModule",{value:!0});nu.ContentChunk$=nu.ContentChunk$outboundSchema=nu.ContentChunk$inboundSchema=void 0;nu.contentChunkToJSON=crn;nu.contentChunkFromJSON=drn;var em=urn(Te()),lrn=ve(),lFt=qNe(),cFt=UNe(),dFt=sse();nu.ContentChunk$inboundSchema=em.union([lFt.ImageURLChunk$inboundSchema.and(em.object({type:em.literal("image_url")}).transform(t=>({type:t.type}))),dFt.TextChunk$inboundSchema.and(em.object({type:em.literal("text")}).transform(t=>({type:t.type}))),cFt.ReferenceChunk$inboundSchema.and(em.object({type:em.literal("reference")}).transform(t=>({type:t.type})))]);nu.ContentChunk$outboundSchema=em.union([lFt.ImageURLChunk$outboundSchema.and(em.object({type:em.literal("image_url")}).transform(t=>({type:t.type}))),dFt.TextChunk$outboundSchema.and(em.object({type:em.literal("text")}).transform(t=>({type:t.type}))),cFt.ReferenceChunk$outboundSchema.and(em.object({type:em.literal("reference")}).transform(t=>({type:t.type})))]);var uFt;(function(t){t.inboundSchema=nu.ContentChunk$inboundSchema,t.outboundSchema=nu.ContentChunk$outboundSchema})(uFt||(nu.ContentChunk$=uFt={}));function crn(t){return JSON.stringify(nu.ContentChunk$outboundSchema.parse(t))}function drn(t){return(0,lrn.safeParse)(t,e=>nu.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var zNe=v(Ao=>{"use strict";var frn=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]}),prn=Ao&&Ao.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mrn=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)&&frn(e,t,r);return prn(e,t),e};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.FunctionCall$=Ao.FunctionCall$outboundSchema=Ao.FunctionCall$inboundSchema=Ao.Arguments$=Ao.Arguments$outboundSchema=Ao.Arguments$inboundSchema=void 0;Ao.argumentsToJSON=hrn;Ao.argumentsFromJSON=grn;Ao.functionCallToJSON=yrn;Ao.functionCallFromJSON=brn;var ou=mrn(Te()),mFt=ve();Ao.Arguments$inboundSchema=ou.union([ou.record(ou.any()),ou.string()]);Ao.Arguments$outboundSchema=ou.union([ou.record(ou.any()),ou.string()]);var fFt;(function(t){t.inboundSchema=Ao.Arguments$inboundSchema,t.outboundSchema=Ao.Arguments$outboundSchema})(fFt||(Ao.Arguments$=fFt={}));function hrn(t){return JSON.stringify(Ao.Arguments$outboundSchema.parse(t))}function grn(t){return(0,mFt.safeParse)(t,e=>Ao.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}Ao.FunctionCall$inboundSchema=ou.object({name:ou.string(),arguments:ou.union([ou.record(ou.any()),ou.string()])});Ao.FunctionCall$outboundSchema=ou.object({name:ou.string(),arguments:ou.union([ou.record(ou.any()),ou.string()])});var pFt;(function(t){t.inboundSchema=Ao.FunctionCall$inboundSchema,t.outboundSchema=Ao.FunctionCall$outboundSchema})(pFt||(Ao.FunctionCall$=pFt={}));function yrn(t){return JSON.stringify(Ao.FunctionCall$outboundSchema.parse(t))}function brn(t){return(0,mFt.safeParse)(t,e=>Ao.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var BI=v(HNe=>{"use strict";Object.defineProperty(HNe,"__esModule",{value:!0});HNe.catchUnrecognizedEnum=_rn;function _rn(t){return t}});var W5=v(iu=>{"use strict";var vrn=iu&&iu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wrn=iu&&iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Srn=iu&&iu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vrn(e,t,r);return wrn(e,t),e};Object.defineProperty(iu,"__esModule",{value:!0});iu.ToolTypes$=iu.ToolTypes$outboundSchema=iu.ToolTypes$inboundSchema=iu.ToolTypes=void 0;var mD=Srn(Te()),xrn=BI();iu.ToolTypes={Function:"function"};iu.ToolTypes$inboundSchema=mD.union([mD.nativeEnum(iu.ToolTypes),mD.string().transform(xrn.catchUnrecognizedEnum)]);iu.ToolTypes$outboundSchema=mD.union([mD.nativeEnum(iu.ToolTypes),mD.string().and(mD.custom())]);var hFt;(function(t){t.inboundSchema=iu.ToolTypes$inboundSchema,t.outboundSchema=iu.ToolTypes$outboundSchema})(hFt||(iu.ToolTypes$=hFt={}))});var use=v(au=>{"use strict";var Crn=au&&au.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Orn=au&&au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Prn=au&&au.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Crn(e,t,r);return Orn(e,t),e};Object.defineProperty(au,"__esModule",{value:!0});au.ToolCall$=au.ToolCall$outboundSchema=au.ToolCall$inboundSchema=void 0;au.toolCallToJSON=Trn;au.toolCallFromJSON=Arn;var AU=Prn(Te()),Ern=ve(),yFt=zNe(),bFt=W5();au.ToolCall$inboundSchema=AU.object({id:AU.string().default("null"),type:bFt.ToolTypes$inboundSchema.optional(),function:yFt.FunctionCall$inboundSchema,index:AU.number().int().default(0)});au.ToolCall$outboundSchema=AU.object({id:AU.string().default("null"),type:bFt.ToolTypes$outboundSchema.optional(),function:yFt.FunctionCall$outboundSchema,index:AU.number().int().default(0)});var gFt;(function(t){t.inboundSchema=au.ToolCall$inboundSchema,t.outboundSchema=au.ToolCall$outboundSchema})(gFt||(au.ToolCall$=gFt={}));function Trn(t){return JSON.stringify(au.ToolCall$outboundSchema.parse(t))}function Arn(t){return(0,Ern.safeParse)(t,e=>au.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var qI=v(Er=>{"use strict";var Irn=Er&&Er.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Er&&Er.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rrn=Er&&Er.__importStar||function(t){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(Er,"__esModule",{value:!0});Er.AssistantMessage$=Er.AssistantMessage$outboundSchema=Er.AssistantMessage$inboundSchema=Er.AssistantMessageRole$=Er.AssistantMessageRole$outboundSchema=Er.AssistantMessageRole$inboundSchema=Er.AssistantMessageContent$=Er.AssistantMessageContent$outboundSchema=Er.AssistantMessageContent$inboundSchema=Er.AssistantMessageRole=void 0;Er.assistantMessageContentToJSON=jrn;Er.assistantMessageContentFromJSON=Nrn;Er.assistantMessageToJSON=Drn;Er.assistantMessageFromJSON=Lrn;var Xa=Rrn(Te()),SFt=Ue(),xFt=ve(),lse=TU(),CFt=use();Er.AssistantMessageRole={Assistant:"assistant"};Er.AssistantMessageContent$inboundSchema=Xa.union([Xa.string(),Xa.array(lse.ContentChunk$inboundSchema)]);Er.AssistantMessageContent$outboundSchema=Xa.union([Xa.string(),Xa.array(lse.ContentChunk$outboundSchema)]);var _Ft;(function(t){t.inboundSchema=Er.AssistantMessageContent$inboundSchema,t.outboundSchema=Er.AssistantMessageContent$outboundSchema})(_Ft||(Er.AssistantMessageContent$=_Ft={}));function jrn(t){return JSON.stringify(Er.AssistantMessageContent$outboundSchema.parse(t))}function Nrn(t){return(0,xFt.safeParse)(t,e=>Er.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}Er.AssistantMessageRole$inboundSchema=Xa.nativeEnum(Er.AssistantMessageRole);Er.AssistantMessageRole$outboundSchema=Er.AssistantMessageRole$inboundSchema;var vFt;(function(t){t.inboundSchema=Er.AssistantMessageRole$inboundSchema,t.outboundSchema=Er.AssistantMessageRole$outboundSchema})(vFt||(Er.AssistantMessageRole$=vFt={}));Er.AssistantMessage$inboundSchema=Xa.object({content:Xa.nullable(Xa.union([Xa.string(),Xa.array(lse.ContentChunk$inboundSchema)])).optional(),tool_calls:Xa.nullable(Xa.array(CFt.ToolCall$inboundSchema)).optional(),prefix:Xa.boolean().default(!1),role:Er.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,SFt.remap)(t,{tool_calls:"toolCalls"}));Er.AssistantMessage$outboundSchema=Xa.object({content:Xa.nullable(Xa.union([Xa.string(),Xa.array(lse.ContentChunk$outboundSchema)])).optional(),toolCalls:Xa.nullable(Xa.array(CFt.ToolCall$outboundSchema)).optional(),prefix:Xa.boolean().default(!1),role:Er.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,SFt.remap)(t,{toolCalls:"tool_calls"}));var wFt;(function(t){t.inboundSchema=Er.AssistantMessage$inboundSchema,t.outboundSchema=Er.AssistantMessage$outboundSchema})(wFt||(Er.AssistantMessage$=wFt={}));function Drn(t){return JSON.stringify(Er.AssistantMessage$outboundSchema.parse(t))}function Lrn(t){return(0,xFt.safeParse)(t,e=>Er.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var IU=v(Io=>{"use strict";var Frn=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]}),krn=Io&&Io.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$rn=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)&&Frn(e,t,r);return krn(e,t),e};Object.defineProperty(Io,"__esModule",{value:!0});Io.Prediction$=Io.Prediction$outboundSchema=Io.Prediction$inboundSchema=Io.PredictionType$=Io.PredictionType$outboundSchema=Io.PredictionType$inboundSchema=Io.PredictionType=void 0;Io.predictionToJSON=qrn;Io.predictionFromJSON=Urn;var hD=$rn(Te()),Brn=ve();Io.PredictionType={Content:"content"};Io.PredictionType$inboundSchema=hD.nativeEnum(Io.PredictionType);Io.PredictionType$outboundSchema=Io.PredictionType$inboundSchema;var OFt;(function(t){t.inboundSchema=Io.PredictionType$inboundSchema,t.outboundSchema=Io.PredictionType$outboundSchema})(OFt||(Io.PredictionType$=OFt={}));Io.Prediction$inboundSchema=hD.object({type:hD.literal("content").default("content"),content:hD.string().default("")});Io.Prediction$outboundSchema=hD.object({type:hD.literal("content").default("content"),content:hD.string().default("")});var PFt;(function(t){t.inboundSchema=Io.Prediction$inboundSchema,t.outboundSchema=Io.Prediction$outboundSchema})(PFt||(Io.Prediction$=PFt={}));function qrn(t){return JSON.stringify(Io.Prediction$outboundSchema.parse(t))}function Urn(t){return(0,Brn.safeParse)(t,e=>Io.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var VNe=v(su=>{"use strict";var zrn=su&&su.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hrn=su&&su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vrn=su&&su.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zrn(e,t,r);return Hrn(e,t),e};Object.defineProperty(su,"__esModule",{value:!0});su.JsonSchema$=su.JsonSchema$outboundSchema=su.JsonSchema$inboundSchema=void 0;su.jsonSchemaToJSON=Krn;su.jsonSchemaFromJSON=Grn;var tm=Vrn(Te()),TFt=Ue(),Wrn=ve();su.JsonSchema$inboundSchema=tm.object({name:tm.string(),description:tm.nullable(tm.string()).optional(),schema:tm.record(tm.any()),strict:tm.boolean().default(!1)}).transform(t=>(0,TFt.remap)(t,{schema:"schemaDefinition"}));su.JsonSchema$outboundSchema=tm.object({name:tm.string(),description:tm.nullable(tm.string()).optional(),schemaDefinition:tm.record(tm.any()),strict:tm.boolean().default(!1)}).transform(t=>(0,TFt.remap)(t,{schemaDefinition:"schema"}));var EFt;(function(t){t.inboundSchema=su.JsonSchema$inboundSchema,t.outboundSchema=su.JsonSchema$outboundSchema})(EFt||(su.JsonSchema$=EFt={}));function Krn(t){return JSON.stringify(su.JsonSchema$outboundSchema.parse(t))}function Grn(t){return(0,Wrn.safeParse)(t,e=>su.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var WNe=v(uu=>{"use strict";var Jrn=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]}),Yrn=uu&&uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zrn=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)&&Jrn(e,t,r);return Yrn(e,t),e};Object.defineProperty(uu,"__esModule",{value:!0});uu.ResponseFormats$=uu.ResponseFormats$outboundSchema=uu.ResponseFormats$inboundSchema=uu.ResponseFormats=void 0;var Xrn=Zrn(Te());uu.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};uu.ResponseFormats$inboundSchema=Xrn.nativeEnum(uu.ResponseFormats);uu.ResponseFormats$outboundSchema=uu.ResponseFormats$inboundSchema;var AFt;(function(t){t.inboundSchema=uu.ResponseFormats$inboundSchema,t.outboundSchema=uu.ResponseFormats$outboundSchema})(AFt||(uu.ResponseFormats$=AFt={}))});var MU=v(lu=>{"use strict";var Qrn=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]}),enn=lu&&lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tnn=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)&&Qrn(e,t,r);return enn(e,t),e};Object.defineProperty(lu,"__esModule",{value:!0});lu.ResponseFormat$=lu.ResponseFormat$outboundSchema=lu.ResponseFormat$inboundSchema=void 0;lu.responseFormatToJSON=nnn;lu.responseFormatFromJSON=onn;var cse=tnn(Te()),MFt=Ue(),rnn=ve(),RFt=VNe(),jFt=WNe();lu.ResponseFormat$inboundSchema=cse.object({type:jFt.ResponseFormats$inboundSchema.optional(),json_schema:cse.nullable(RFt.JsonSchema$inboundSchema).optional()}).transform(t=>(0,MFt.remap)(t,{json_schema:"jsonSchema"}));lu.ResponseFormat$outboundSchema=cse.object({type:jFt.ResponseFormats$outboundSchema.optional(),jsonSchema:cse.nullable(RFt.JsonSchema$outboundSchema).optional()}).transform(t=>(0,MFt.remap)(t,{jsonSchema:"json_schema"}));var IFt;(function(t){t.inboundSchema=lu.ResponseFormat$inboundSchema,t.outboundSchema=lu.ResponseFormat$outboundSchema})(IFt||(lu.ResponseFormat$=IFt={}));function nnn(t){return JSON.stringify(lu.ResponseFormat$outboundSchema.parse(t))}function onn(t){return(0,rnn.safeParse)(t,e=>lu.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var gD=v(Tr=>{"use strict";var inn=Tr&&Tr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Tr&&Tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),snn=Tr&&Tr.__importStar||function(t){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(Tr,"__esModule",{value:!0});Tr.SystemMessage$=Tr.SystemMessage$outboundSchema=Tr.SystemMessage$inboundSchema=Tr.Role$=Tr.Role$outboundSchema=Tr.Role$inboundSchema=Tr.SystemMessageContent$=Tr.SystemMessageContent$outboundSchema=Tr.SystemMessageContent$inboundSchema=Tr.Role=void 0;Tr.systemMessageContentToJSON=unn;Tr.systemMessageContentFromJSON=lnn;Tr.systemMessageToJSON=cnn;Tr.systemMessageFromJSON=dnn;var Qf=snn(Te()),FFt=ve(),dse=sse();Tr.Role={System:"system"};Tr.SystemMessageContent$inboundSchema=Qf.union([Qf.string(),Qf.array(dse.TextChunk$inboundSchema)]);Tr.SystemMessageContent$outboundSchema=Qf.union([Qf.string(),Qf.array(dse.TextChunk$outboundSchema)]);var NFt;(function(t){t.inboundSchema=Tr.SystemMessageContent$inboundSchema,t.outboundSchema=Tr.SystemMessageContent$outboundSchema})(NFt||(Tr.SystemMessageContent$=NFt={}));function unn(t){return JSON.stringify(Tr.SystemMessageContent$outboundSchema.parse(t))}function lnn(t){return(0,FFt.safeParse)(t,e=>Tr.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}Tr.Role$inboundSchema=Qf.nativeEnum(Tr.Role);Tr.Role$outboundSchema=Tr.Role$inboundSchema;var DFt;(function(t){t.inboundSchema=Tr.Role$inboundSchema,t.outboundSchema=Tr.Role$outboundSchema})(DFt||(Tr.Role$=DFt={}));Tr.SystemMessage$inboundSchema=Qf.object({content:Qf.union([Qf.string(),Qf.array(dse.TextChunk$inboundSchema)]),role:Tr.Role$inboundSchema.default("system")});Tr.SystemMessage$outboundSchema=Qf.object({content:Qf.union([Qf.string(),Qf.array(dse.TextChunk$outboundSchema)]),role:Tr.Role$outboundSchema.default("system")});var LFt;(function(t){t.inboundSchema=Tr.SystemMessage$inboundSchema,t.outboundSchema=Tr.SystemMessage$outboundSchema})(LFt||(Tr.SystemMessage$=LFt={}));function cnn(t){return JSON.stringify(Tr.SystemMessage$outboundSchema.parse(t))}function dnn(t){return(0,FFt.safeParse)(t,e=>Tr.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var KNe=v(cu=>{"use strict";var fnn=cu&&cu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pnn=cu&&cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mnn=cu&&cu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fnn(e,t,r);return pnn(e,t),e};Object.defineProperty(cu,"__esModule",{value:!0});cu.FunctionT$=cu.FunctionT$outboundSchema=cu.FunctionT$inboundSchema=void 0;cu.functionToJSON=gnn;cu.functionFromJSON=ynn;var Dg=mnn(Te()),hnn=ve();cu.FunctionT$inboundSchema=Dg.object({name:Dg.string(),description:Dg.string().default(""),strict:Dg.boolean().default(!1),parameters:Dg.record(Dg.any())});cu.FunctionT$outboundSchema=Dg.object({name:Dg.string(),description:Dg.string().default(""),strict:Dg.boolean().default(!1),parameters:Dg.record(Dg.any())});var kFt;(function(t){t.inboundSchema=cu.FunctionT$inboundSchema,t.outboundSchema=cu.FunctionT$outboundSchema})(kFt||(cu.FunctionT$=kFt={}));function gnn(t){return JSON.stringify(cu.FunctionT$outboundSchema.parse(t))}function ynn(t){return(0,hnn.safeParse)(t,e=>cu.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var RU=v(du=>{"use strict";var bnn=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]}),_nn=du&&du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vnn=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)&&bnn(e,t,r);return _nn(e,t),e};Object.defineProperty(du,"__esModule",{value:!0});du.Tool$=du.Tool$outboundSchema=du.Tool$inboundSchema=void 0;du.toolToJSON=Snn;du.toolFromJSON=xnn;var BFt=vnn(Te()),wnn=ve(),qFt=KNe(),UFt=W5();du.Tool$inboundSchema=BFt.object({type:UFt.ToolTypes$inboundSchema.optional(),function:qFt.FunctionT$inboundSchema});du.Tool$outboundSchema=BFt.object({type:UFt.ToolTypes$outboundSchema.optional(),function:qFt.FunctionT$outboundSchema});var $Ft;(function(t){t.inboundSchema=du.Tool$inboundSchema,t.outboundSchema=du.Tool$outboundSchema})($Ft||(du.Tool$=$Ft={}));function Snn(t){return JSON.stringify(du.Tool$outboundSchema.parse(t))}function xnn(t){return(0,wnn.safeParse)(t,e=>du.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var GNe=v(fu=>{"use strict";var Cnn=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]}),Onn=fu&&fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pnn=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)&&Cnn(e,t,r);return Onn(e,t),e};Object.defineProperty(fu,"__esModule",{value:!0});fu.FunctionName$=fu.FunctionName$outboundSchema=fu.FunctionName$inboundSchema=void 0;fu.functionNameToJSON=Tnn;fu.functionNameFromJSON=Ann;var fse=Pnn(Te()),Enn=ve();fu.FunctionName$inboundSchema=fse.object({name:fse.string()});fu.FunctionName$outboundSchema=fse.object({name:fse.string()});var zFt;(function(t){t.inboundSchema=fu.FunctionName$inboundSchema,t.outboundSchema=fu.FunctionName$outboundSchema})(zFt||(fu.FunctionName$=zFt={}));function Tnn(t){return JSON.stringify(fu.FunctionName$outboundSchema.parse(t))}function Ann(t){return(0,Enn.safeParse)(t,e=>fu.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var jU=v(pu=>{"use strict";var Inn=pu&&pu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mnn=pu&&pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rnn=pu&&pu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Inn(e,t,r);return Mnn(e,t),e};Object.defineProperty(pu,"__esModule",{value:!0});pu.ToolChoice$=pu.ToolChoice$outboundSchema=pu.ToolChoice$inboundSchema=void 0;pu.toolChoiceToJSON=Nnn;pu.toolChoiceFromJSON=Dnn;var VFt=Rnn(Te()),jnn=ve(),WFt=GNe(),KFt=W5();pu.ToolChoice$inboundSchema=VFt.object({type:KFt.ToolTypes$inboundSchema.optional(),function:WFt.FunctionName$inboundSchema});pu.ToolChoice$outboundSchema=VFt.object({type:KFt.ToolTypes$outboundSchema.optional(),function:WFt.FunctionName$outboundSchema});var HFt;(function(t){t.inboundSchema=pu.ToolChoice$inboundSchema,t.outboundSchema=pu.ToolChoice$outboundSchema})(HFt||(pu.ToolChoice$=HFt={}));function Nnn(t){return JSON.stringify(pu.ToolChoice$outboundSchema.parse(t))}function Dnn(t){return(0,jnn.safeParse)(t,e=>pu.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var NU=v(mu=>{"use strict";var Lnn=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]}),Fnn=mu&&mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),knn=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)&&Lnn(e,t,r);return Fnn(e,t),e};Object.defineProperty(mu,"__esModule",{value:!0});mu.ToolChoiceEnum$=mu.ToolChoiceEnum$outboundSchema=mu.ToolChoiceEnum$inboundSchema=mu.ToolChoiceEnum=void 0;var $nn=knn(Te());mu.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};mu.ToolChoiceEnum$inboundSchema=$nn.nativeEnum(mu.ToolChoiceEnum);mu.ToolChoiceEnum$outboundSchema=mu.ToolChoiceEnum$inboundSchema;var GFt;(function(t){t.inboundSchema=mu.ToolChoiceEnum$inboundSchema,t.outboundSchema=mu.ToolChoiceEnum$outboundSchema})(GFt||(mu.ToolChoiceEnum$=GFt={}))});var yD=v(Ar=>{"use strict";var Bnn=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]}),qnn=Ar&&Ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Unn=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)&&Bnn(e,t,r);return qnn(e,t),e};Object.defineProperty(Ar,"__esModule",{value:!0});Ar.ToolMessage$=Ar.ToolMessage$outboundSchema=Ar.ToolMessage$inboundSchema=Ar.ToolMessageRole$=Ar.ToolMessageRole$outboundSchema=Ar.ToolMessageRole$inboundSchema=Ar.ToolMessageContent$=Ar.ToolMessageContent$outboundSchema=Ar.ToolMessageContent$inboundSchema=Ar.ToolMessageRole=void 0;Ar.toolMessageContentToJSON=znn;Ar.toolMessageContentFromJSON=Hnn;Ar.toolMessageToJSON=Vnn;Ar.toolMessageFromJSON=Wnn;var ha=Unn(Te()),XFt=Ue(),QFt=ve(),pse=TU();Ar.ToolMessageRole={Tool:"tool"};Ar.ToolMessageContent$inboundSchema=ha.union([ha.string(),ha.array(pse.ContentChunk$inboundSchema)]);Ar.ToolMessageContent$outboundSchema=ha.union([ha.string(),ha.array(pse.ContentChunk$outboundSchema)]);var JFt;(function(t){t.inboundSchema=Ar.ToolMessageContent$inboundSchema,t.outboundSchema=Ar.ToolMessageContent$outboundSchema})(JFt||(Ar.ToolMessageContent$=JFt={}));function znn(t){return JSON.stringify(Ar.ToolMessageContent$outboundSchema.parse(t))}function Hnn(t){return(0,QFt.safeParse)(t,e=>Ar.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}Ar.ToolMessageRole$inboundSchema=ha.nativeEnum(Ar.ToolMessageRole);Ar.ToolMessageRole$outboundSchema=Ar.ToolMessageRole$inboundSchema;var YFt;(function(t){t.inboundSchema=Ar.ToolMessageRole$inboundSchema,t.outboundSchema=Ar.ToolMessageRole$outboundSchema})(YFt||(Ar.ToolMessageRole$=YFt={}));Ar.ToolMessage$inboundSchema=ha.object({content:ha.nullable(ha.union([ha.string(),ha.array(pse.ContentChunk$inboundSchema)])),tool_call_id:ha.nullable(ha.string()).optional(),name:ha.nullable(ha.string()).optional(),role:Ar.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,XFt.remap)(t,{tool_call_id:"toolCallId"}));Ar.ToolMessage$outboundSchema=ha.object({content:ha.nullable(ha.union([ha.string(),ha.array(pse.ContentChunk$outboundSchema)])),toolCallId:ha.nullable(ha.string()).optional(),name:ha.nullable(ha.string()).optional(),role:Ar.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,XFt.remap)(t,{toolCallId:"tool_call_id"}));var ZFt;(function(t){t.inboundSchema=Ar.ToolMessage$inboundSchema,t.outboundSchema=Ar.ToolMessage$outboundSchema})(ZFt||(Ar.ToolMessage$=ZFt={}));function Vnn(t){return JSON.stringify(Ar.ToolMessage$outboundSchema.parse(t))}function Wnn(t){return(0,QFt.safeParse)(t,e=>Ar.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var bD=v(Ir=>{"use strict";var Knn=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]}),Gnn=Ir&&Ir.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jnn=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)&&Knn(e,t,r);return Gnn(e,t),e};Object.defineProperty(Ir,"__esModule",{value:!0});Ir.UserMessage$=Ir.UserMessage$outboundSchema=Ir.UserMessage$inboundSchema=Ir.UserMessageRole$=Ir.UserMessageRole$outboundSchema=Ir.UserMessageRole$inboundSchema=Ir.UserMessageContent$=Ir.UserMessageContent$outboundSchema=Ir.UserMessageContent$inboundSchema=Ir.UserMessageRole=void 0;Ir.userMessageContentToJSON=Ynn;Ir.userMessageContentFromJSON=Znn;Ir.userMessageToJSON=Xnn;Ir.userMessageFromJSON=Qnn;var rd=Jnn(Te()),nkt=ve(),mse=TU();Ir.UserMessageRole={User:"user"};Ir.UserMessageContent$inboundSchema=rd.union([rd.string(),rd.array(mse.ContentChunk$inboundSchema)]);Ir.UserMessageContent$outboundSchema=rd.union([rd.string(),rd.array(mse.ContentChunk$outboundSchema)]);var ekt;(function(t){t.inboundSchema=Ir.UserMessageContent$inboundSchema,t.outboundSchema=Ir.UserMessageContent$outboundSchema})(ekt||(Ir.UserMessageContent$=ekt={}));function Ynn(t){return JSON.stringify(Ir.UserMessageContent$outboundSchema.parse(t))}function Znn(t){return(0,nkt.safeParse)(t,e=>Ir.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}Ir.UserMessageRole$inboundSchema=rd.nativeEnum(Ir.UserMessageRole);Ir.UserMessageRole$outboundSchema=Ir.UserMessageRole$inboundSchema;var tkt;(function(t){t.inboundSchema=Ir.UserMessageRole$inboundSchema,t.outboundSchema=Ir.UserMessageRole$outboundSchema})(tkt||(Ir.UserMessageRole$=tkt={}));Ir.UserMessage$inboundSchema=rd.object({content:rd.nullable(rd.union([rd.string(),rd.array(mse.ContentChunk$inboundSchema)])),role:Ir.UserMessageRole$inboundSchema.default("user")});Ir.UserMessage$outboundSchema=rd.object({content:rd.nullable(rd.union([rd.string(),rd.array(mse.ContentChunk$outboundSchema)])),role:Ir.UserMessageRole$outboundSchema.default("user")});var rkt;(function(t){t.inboundSchema=Ir.UserMessage$inboundSchema,t.outboundSchema=Ir.UserMessage$outboundSchema})(rkt||(Ir.UserMessage$=rkt={}));function Xnn(t){return JSON.stringify(Ir.UserMessage$outboundSchema.parse(t))}function Qnn(t){return(0,nkt.safeParse)(t,e=>Ir.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var fkt=v(Jt=>{"use strict";var eon=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]}),ton=Jt&&Jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ron=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)&&eon(e,t,r);return ton(e,t),e};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.AgentsCompletionRequest$=Jt.AgentsCompletionRequest$outboundSchema=Jt.AgentsCompletionRequest$inboundSchema=Jt.AgentsCompletionRequestToolChoice$=Jt.AgentsCompletionRequestToolChoice$outboundSchema=Jt.AgentsCompletionRequestToolChoice$inboundSchema=Jt.AgentsCompletionRequestMessages$=Jt.AgentsCompletionRequestMessages$outboundSchema=Jt.AgentsCompletionRequestMessages$inboundSchema=Jt.AgentsCompletionRequestStop$=Jt.AgentsCompletionRequestStop$outboundSchema=Jt.AgentsCompletionRequestStop$inboundSchema=void 0;Jt.agentsCompletionRequestStopToJSON=non;Jt.agentsCompletionRequestStopFromJSON=oon;Jt.agentsCompletionRequestMessagesToJSON=ion;Jt.agentsCompletionRequestMessagesFromJSON=aon;Jt.agentsCompletionRequestToolChoiceToJSON=son;Jt.agentsCompletionRequestToolChoiceFromJSON=uon;Jt.agentsCompletionRequestToJSON=lon;Jt.agentsCompletionRequestFromJSON=con;var Xe=ron(Te()),ukt=Ue(),hse=ve(),gse=qI(),lkt=IU(),ckt=MU(),yse=gD(),dkt=RU(),bse=jU(),_se=NU(),vse=yD(),wse=bD();Jt.AgentsCompletionRequestStop$inboundSchema=Xe.union([Xe.string(),Xe.array(Xe.string())]);Jt.AgentsCompletionRequestStop$outboundSchema=Xe.union([Xe.string(),Xe.array(Xe.string())]);var okt;(function(t){t.inboundSchema=Jt.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=Jt.AgentsCompletionRequestStop$outboundSchema})(okt||(Jt.AgentsCompletionRequestStop$=okt={}));function non(t){return JSON.stringify(Jt.AgentsCompletionRequestStop$outboundSchema.parse(t))}function oon(t){return(0,hse.safeParse)(t,e=>Jt.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}Jt.AgentsCompletionRequestMessages$inboundSchema=Xe.union([yse.SystemMessage$inboundSchema.and(Xe.object({role:Xe.literal("system")}).transform(t=>({role:t.role}))),wse.UserMessage$inboundSchema.and(Xe.object({role:Xe.literal("user")}).transform(t=>({role:t.role}))),gse.AssistantMessage$inboundSchema.and(Xe.object({role:Xe.literal("assistant")}).transform(t=>({role:t.role}))),vse.ToolMessage$inboundSchema.and(Xe.object({role:Xe.literal("tool")}).transform(t=>({role:t.role})))]);Jt.AgentsCompletionRequestMessages$outboundSchema=Xe.union([yse.SystemMessage$outboundSchema.and(Xe.object({role:Xe.literal("system")}).transform(t=>({role:t.role}))),wse.UserMessage$outboundSchema.and(Xe.object({role:Xe.literal("user")}).transform(t=>({role:t.role}))),gse.AssistantMessage$outboundSchema.and(Xe.object({role:Xe.literal("assistant")}).transform(t=>({role:t.role}))),vse.ToolMessage$outboundSchema.and(Xe.object({role:Xe.literal("tool")}).transform(t=>({role:t.role})))]);var ikt;(function(t){t.inboundSchema=Jt.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=Jt.AgentsCompletionRequestMessages$outboundSchema})(ikt||(Jt.AgentsCompletionRequestMessages$=ikt={}));function ion(t){return JSON.stringify(Jt.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function aon(t){return(0,hse.safeParse)(t,e=>Jt.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}Jt.AgentsCompletionRequestToolChoice$inboundSchema=Xe.union([bse.ToolChoice$inboundSchema,_se.ToolChoiceEnum$inboundSchema]);Jt.AgentsCompletionRequestToolChoice$outboundSchema=Xe.union([bse.ToolChoice$outboundSchema,_se.ToolChoiceEnum$outboundSchema]);var akt;(function(t){t.inboundSchema=Jt.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Jt.AgentsCompletionRequestToolChoice$outboundSchema})(akt||(Jt.AgentsCompletionRequestToolChoice$=akt={}));function son(t){return JSON.stringify(Jt.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function uon(t){return(0,hse.safeParse)(t,e=>Jt.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}Jt.AgentsCompletionRequest$inboundSchema=Xe.object({max_tokens:Xe.nullable(Xe.number().int()).optional(),stream:Xe.boolean().default(!1),stop:Xe.union([Xe.string(),Xe.array(Xe.string())]).optional(),random_seed:Xe.nullable(Xe.number().int()).optional(),messages:Xe.array(Xe.union([yse.SystemMessage$inboundSchema.and(Xe.object({role:Xe.literal("system")}).transform(t=>({role:t.role}))),wse.UserMessage$inboundSchema.and(Xe.object({role:Xe.literal("user")}).transform(t=>({role:t.role}))),gse.AssistantMessage$inboundSchema.and(Xe.object({role:Xe.literal("assistant")}).transform(t=>({role:t.role}))),vse.ToolMessage$inboundSchema.and(Xe.object({role:Xe.literal("tool")}).transform(t=>({role:t.role})))])),response_format:ckt.ResponseFormat$inboundSchema.optional(),tools:Xe.nullable(Xe.array(dkt.Tool$inboundSchema)).optional(),tool_choice:Xe.union([bse.ToolChoice$inboundSchema,_se.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Xe.number().optional(),frequency_penalty:Xe.number().optional(),n:Xe.nullable(Xe.number().int()).optional(),prediction:lkt.Prediction$inboundSchema.optional(),agent_id:Xe.string()}).transform(t=>(0,ukt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));Jt.AgentsCompletionRequest$outboundSchema=Xe.object({maxTokens:Xe.nullable(Xe.number().int()).optional(),stream:Xe.boolean().default(!1),stop:Xe.union([Xe.string(),Xe.array(Xe.string())]).optional(),randomSeed:Xe.nullable(Xe.number().int()).optional(),messages:Xe.array(Xe.union([yse.SystemMessage$outboundSchema.and(Xe.object({role:Xe.literal("system")}).transform(t=>({role:t.role}))),wse.UserMessage$outboundSchema.and(Xe.object({role:Xe.literal("user")}).transform(t=>({role:t.role}))),gse.AssistantMessage$outboundSchema.and(Xe.object({role:Xe.literal("assistant")}).transform(t=>({role:t.role}))),vse.ToolMessage$outboundSchema.and(Xe.object({role:Xe.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:ckt.ResponseFormat$outboundSchema.optional(),tools:Xe.nullable(Xe.array(dkt.Tool$outboundSchema)).optional(),toolChoice:Xe.union([bse.ToolChoice$outboundSchema,_se.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Xe.number().optional(),frequencyPenalty:Xe.number().optional(),n:Xe.nullable(Xe.number().int()).optional(),prediction:lkt.Prediction$outboundSchema.optional(),agentId:Xe.string()}).transform(t=>(0,ukt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var skt;(function(t){t.inboundSchema=Jt.AgentsCompletionRequest$inboundSchema,t.outboundSchema=Jt.AgentsCompletionRequest$outboundSchema})(skt||(Jt.AgentsCompletionRequest$=skt={}));function lon(t){return JSON.stringify(Jt.AgentsCompletionRequest$outboundSchema.parse(t))}function con(t){return(0,hse.safeParse)(t,e=>Jt.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var wkt=v(Yt=>{"use strict";var don=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]}),fon=Yt&&Yt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pon=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)&&don(e,t,r);return fon(e,t),e};Object.defineProperty(Yt,"__esModule",{value:!0});Yt.AgentsCompletionStreamRequest$=Yt.AgentsCompletionStreamRequest$outboundSchema=Yt.AgentsCompletionStreamRequest$inboundSchema=Yt.AgentsCompletionStreamRequestToolChoice$=Yt.AgentsCompletionStreamRequestToolChoice$outboundSchema=Yt.AgentsCompletionStreamRequestToolChoice$inboundSchema=Yt.AgentsCompletionStreamRequestMessages$=Yt.AgentsCompletionStreamRequestMessages$outboundSchema=Yt.AgentsCompletionStreamRequestMessages$inboundSchema=Yt.AgentsCompletionStreamRequestStop$=Yt.AgentsCompletionStreamRequestStop$outboundSchema=Yt.AgentsCompletionStreamRequestStop$inboundSchema=void 0;Yt.agentsCompletionStreamRequestStopToJSON=mon;Yt.agentsCompletionStreamRequestStopFromJSON=hon;Yt.agentsCompletionStreamRequestMessagesToJSON=gon;Yt.agentsCompletionStreamRequestMessagesFromJSON=yon;Yt.agentsCompletionStreamRequestToolChoiceToJSON=bon;Yt.agentsCompletionStreamRequestToolChoiceFromJSON=_on;Yt.agentsCompletionStreamRequestToJSON=von;Yt.agentsCompletionStreamRequestFromJSON=won;var Qe=pon(Te()),ykt=Ue(),Sse=ve(),xse=qI(),bkt=IU(),_kt=MU(),Cse=gD(),vkt=RU(),Ose=jU(),Pse=NU(),Ese=yD(),Tse=bD();Yt.AgentsCompletionStreamRequestStop$inboundSchema=Qe.union([Qe.string(),Qe.array(Qe.string())]);Yt.AgentsCompletionStreamRequestStop$outboundSchema=Qe.union([Qe.string(),Qe.array(Qe.string())]);var pkt;(function(t){t.inboundSchema=Yt.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Yt.AgentsCompletionStreamRequestStop$outboundSchema})(pkt||(Yt.AgentsCompletionStreamRequestStop$=pkt={}));function mon(t){return JSON.stringify(Yt.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function hon(t){return(0,Sse.safeParse)(t,e=>Yt.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}Yt.AgentsCompletionStreamRequestMessages$inboundSchema=Qe.union([Cse.SystemMessage$inboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),Tse.UserMessage$inboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),xse.AssistantMessage$inboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role}))),Ese.ToolMessage$inboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role})))]);Yt.AgentsCompletionStreamRequestMessages$outboundSchema=Qe.union([Cse.SystemMessage$outboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),Tse.UserMessage$outboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),xse.AssistantMessage$outboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role}))),Ese.ToolMessage$outboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role})))]);var mkt;(function(t){t.inboundSchema=Yt.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Yt.AgentsCompletionStreamRequestMessages$outboundSchema})(mkt||(Yt.AgentsCompletionStreamRequestMessages$=mkt={}));function gon(t){return JSON.stringify(Yt.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function yon(t){return(0,Sse.safeParse)(t,e=>Yt.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}Yt.AgentsCompletionStreamRequestToolChoice$inboundSchema=Qe.union([Ose.ToolChoice$inboundSchema,Pse.ToolChoiceEnum$inboundSchema]);Yt.AgentsCompletionStreamRequestToolChoice$outboundSchema=Qe.union([Ose.ToolChoice$outboundSchema,Pse.ToolChoiceEnum$outboundSchema]);var hkt;(function(t){t.inboundSchema=Yt.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Yt.AgentsCompletionStreamRequestToolChoice$outboundSchema})(hkt||(Yt.AgentsCompletionStreamRequestToolChoice$=hkt={}));function bon(t){return JSON.stringify(Yt.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function _on(t){return(0,Sse.safeParse)(t,e=>Yt.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}Yt.AgentsCompletionStreamRequest$inboundSchema=Qe.object({max_tokens:Qe.nullable(Qe.number().int()).optional(),stream:Qe.boolean().default(!0),stop:Qe.union([Qe.string(),Qe.array(Qe.string())]).optional(),random_seed:Qe.nullable(Qe.number().int()).optional(),messages:Qe.array(Qe.union([Cse.SystemMessage$inboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),Tse.UserMessage$inboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),xse.AssistantMessage$inboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role}))),Ese.ToolMessage$inboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role})))])),response_format:_kt.ResponseFormat$inboundSchema.optional(),tools:Qe.nullable(Qe.array(vkt.Tool$inboundSchema)).optional(),tool_choice:Qe.union([Ose.ToolChoice$inboundSchema,Pse.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Qe.number().optional(),frequency_penalty:Qe.number().optional(),n:Qe.nullable(Qe.number().int()).optional(),prediction:bkt.Prediction$inboundSchema.optional(),agent_id:Qe.string()}).transform(t=>(0,ykt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));Yt.AgentsCompletionStreamRequest$outboundSchema=Qe.object({maxTokens:Qe.nullable(Qe.number().int()).optional(),stream:Qe.boolean().default(!0),stop:Qe.union([Qe.string(),Qe.array(Qe.string())]).optional(),randomSeed:Qe.nullable(Qe.number().int()).optional(),messages:Qe.array(Qe.union([Cse.SystemMessage$outboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),Tse.UserMessage$outboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),xse.AssistantMessage$outboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role}))),Ese.ToolMessage$outboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:_kt.ResponseFormat$outboundSchema.optional(),tools:Qe.nullable(Qe.array(vkt.Tool$outboundSchema)).optional(),toolChoice:Qe.union([Ose.ToolChoice$outboundSchema,Pse.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Qe.number().optional(),frequencyPenalty:Qe.number().optional(),n:Qe.nullable(Qe.number().int()).optional(),prediction:bkt.Prediction$outboundSchema.optional(),agentId:Qe.string()}).transform(t=>(0,ykt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var gkt;(function(t){t.inboundSchema=Yt.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=Yt.AgentsCompletionStreamRequest$outboundSchema})(gkt||(Yt.AgentsCompletionStreamRequest$=gkt={}));function von(t){return JSON.stringify(Yt.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function won(t){return(0,Sse.safeParse)(t,e=>Yt.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var JNe=v(hu=>{"use strict";var Son=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]}),xon=hu&&hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Con=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)&&Son(e,t,r);return xon(e,t),e};Object.defineProperty(hu,"__esModule",{value:!0});hu.ApiEndpoint$=hu.ApiEndpoint$outboundSchema=hu.ApiEndpoint$inboundSchema=hu.ApiEndpoint=void 0;var _D=Con(Te()),Oon=BI();hu.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations"};hu.ApiEndpoint$inboundSchema=_D.union([_D.nativeEnum(hu.ApiEndpoint),_D.string().transform(Oon.catchUnrecognizedEnum)]);hu.ApiEndpoint$outboundSchema=_D.union([_D.nativeEnum(hu.ApiEndpoint),_D.string().and(_D.custom())]);var Skt;(function(t){t.inboundSchema=hu.ApiEndpoint$inboundSchema,t.outboundSchema=hu.ApiEndpoint$outboundSchema})(Skt||(hu.ApiEndpoint$=Skt={}))});var Okt=v(Mo=>{"use strict";var Pon=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]}),Eon=Mo&&Mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ton=Mo&&Mo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Pon(e,t,r);return Eon(e,t),e};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.ArchiveFTModelOut$=Mo.ArchiveFTModelOut$outboundSchema=Mo.ArchiveFTModelOut$inboundSchema=Mo.ArchiveFTModelOutObject$=Mo.ArchiveFTModelOutObject$outboundSchema=Mo.ArchiveFTModelOutObject$inboundSchema=Mo.ArchiveFTModelOutObject=void 0;Mo.archiveFTModelOutToJSON=Ion;Mo.archiveFTModelOutFromJSON=Mon;var _P=Ton(Te()),Aon=ve();Mo.ArchiveFTModelOutObject={Model:"model"};Mo.ArchiveFTModelOutObject$inboundSchema=_P.nativeEnum(Mo.ArchiveFTModelOutObject);Mo.ArchiveFTModelOutObject$outboundSchema=Mo.ArchiveFTModelOutObject$inboundSchema;var xkt;(function(t){t.inboundSchema=Mo.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=Mo.ArchiveFTModelOutObject$outboundSchema})(xkt||(Mo.ArchiveFTModelOutObject$=xkt={}));Mo.ArchiveFTModelOut$inboundSchema=_P.object({id:_P.string(),object:_P.literal("model").default("model"),archived:_P.boolean().default(!0)});Mo.ArchiveFTModelOut$outboundSchema=_P.object({id:_P.string(),object:_P.literal("model").default("model"),archived:_P.boolean().default(!0)});var Ckt;(function(t){t.inboundSchema=Mo.ArchiveFTModelOut$inboundSchema,t.outboundSchema=Mo.ArchiveFTModelOut$outboundSchema})(Ckt||(Mo.ArchiveFTModelOut$=Ckt={}));function Ion(t){return JSON.stringify(Mo.ArchiveFTModelOut$outboundSchema.parse(t))}function Mon(t){return(0,Aon.safeParse)(t,e=>Mo.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var Ase=v(gu=>{"use strict";var Ron=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]}),jon=gu&&gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Non=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)&&Ron(e,t,r);return jon(e,t),e};Object.defineProperty(gu,"__esModule",{value:!0});gu.ModelCapabilities$=gu.ModelCapabilities$outboundSchema=gu.ModelCapabilities$inboundSchema=void 0;gu.modelCapabilitiesToJSON=Lon;gu.modelCapabilitiesFromJSON=Fon;var Lg=Non(Te()),Ekt=Ue(),Don=ve();gu.ModelCapabilities$inboundSchema=Lg.object({completion_chat:Lg.boolean().default(!0),completion_fim:Lg.boolean().default(!1),function_calling:Lg.boolean().default(!0),fine_tuning:Lg.boolean().default(!1),vision:Lg.boolean().default(!1)}).transform(t=>(0,Ekt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));gu.ModelCapabilities$outboundSchema=Lg.object({completionChat:Lg.boolean().default(!0),completionFim:Lg.boolean().default(!1),functionCalling:Lg.boolean().default(!0),fineTuning:Lg.boolean().default(!1),vision:Lg.boolean().default(!1)}).transform(t=>(0,Ekt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var Pkt;(function(t){t.inboundSchema=gu.ModelCapabilities$inboundSchema,t.outboundSchema=gu.ModelCapabilities$outboundSchema})(Pkt||(gu.ModelCapabilities$=Pkt={}));function Lon(t){return JSON.stringify(gu.ModelCapabilities$outboundSchema.parse(t))}function Fon(t){return(0,Don.safeParse)(t,e=>gu.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var YNe=v(Ro=>{"use strict";var kon=Ro&&Ro.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$on=Ro&&Ro.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bon=Ro&&Ro.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kon(e,t,r);return $on(e,t),e};Object.defineProperty(Ro,"__esModule",{value:!0});Ro.BaseModelCard$=Ro.BaseModelCard$outboundSchema=Ro.BaseModelCard$inboundSchema=Ro.Type$=Ro.Type$outboundSchema=Ro.Type$inboundSchema=Ro.Type=void 0;Ro.baseModelCardToJSON=Uon;Ro.baseModelCardFromJSON=zon;var Kn=Bon(Te()),Ikt=Ue(),qon=ve(),Mkt=Ase();Ro.Type={Base:"base"};Ro.Type$inboundSchema=Kn.nativeEnum(Ro.Type);Ro.Type$outboundSchema=Ro.Type$inboundSchema;var Tkt;(function(t){t.inboundSchema=Ro.Type$inboundSchema,t.outboundSchema=Ro.Type$outboundSchema})(Tkt||(Ro.Type$=Tkt={}));Ro.BaseModelCard$inboundSchema=Kn.object({id:Kn.string(),object:Kn.string().default("model"),created:Kn.number().int().optional(),owned_by:Kn.string().default("mistralai"),capabilities:Mkt.ModelCapabilities$inboundSchema,name:Kn.nullable(Kn.string()).optional(),description:Kn.nullable(Kn.string()).optional(),max_context_length:Kn.number().int().default(32768),aliases:Kn.array(Kn.string()).optional(),deprecation:Kn.nullable(Kn.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:Kn.nullable(Kn.number()).optional(),type:Kn.literal("base").default("base")}).transform(t=>(0,Ikt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Ro.BaseModelCard$outboundSchema=Kn.object({id:Kn.string(),object:Kn.string().default("model"),created:Kn.number().int().optional(),ownedBy:Kn.string().default("mistralai"),capabilities:Mkt.ModelCapabilities$outboundSchema,name:Kn.nullable(Kn.string()).optional(),description:Kn.nullable(Kn.string()).optional(),maxContextLength:Kn.number().int().default(32768),aliases:Kn.array(Kn.string()).optional(),deprecation:Kn.nullable(Kn.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:Kn.nullable(Kn.number()).optional(),type:Kn.literal("base").default("base")}).transform(t=>(0,Ikt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var Akt;(function(t){t.inboundSchema=Ro.BaseModelCard$inboundSchema,t.outboundSchema=Ro.BaseModelCard$outboundSchema})(Akt||(Ro.BaseModelCard$=Akt={}));function Uon(t){return JSON.stringify(Ro.BaseModelCard$outboundSchema.parse(t))}function zon(t){return(0,qon.safeParse)(t,e=>Ro.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var ZNe=v(yu=>{"use strict";var Hon=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]}),Von=yu&&yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Won=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)&&Hon(e,t,r);return Von(e,t),e};Object.defineProperty(yu,"__esModule",{value:!0});yu.BatchError$=yu.BatchError$outboundSchema=yu.BatchError$inboundSchema=void 0;yu.batchErrorToJSON=Gon;yu.batchErrorFromJSON=Jon;var DU=Won(Te()),Kon=ve();yu.BatchError$inboundSchema=DU.object({message:DU.string(),count:DU.number().int().default(1)});yu.BatchError$outboundSchema=DU.object({message:DU.string(),count:DU.number().int().default(1)});var Rkt;(function(t){t.inboundSchema=yu.BatchError$inboundSchema,t.outboundSchema=yu.BatchError$outboundSchema})(Rkt||(yu.BatchError$=Rkt={}));function Gon(t){return JSON.stringify(yu.BatchError$outboundSchema.parse(t))}function Jon(t){return(0,Kon.safeParse)(t,e=>yu.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var Lkt=v(bu=>{"use strict";var Yon=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]}),Zon=bu&&bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xon=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)&&Yon(e,t,r);return Zon(e,t),e};Object.defineProperty(bu,"__esModule",{value:!0});bu.BatchJobIn$=bu.BatchJobIn$outboundSchema=bu.BatchJobIn$inboundSchema=void 0;bu.batchJobInToJSON=ein;bu.batchJobInFromJSON=tin;var uf=Xon(Te()),Nkt=Ue(),Qon=ve(),Dkt=JNe();bu.BatchJobIn$inboundSchema=uf.object({input_files:uf.array(uf.string()),endpoint:Dkt.ApiEndpoint$inboundSchema,model:uf.string(),metadata:uf.nullable(uf.record(uf.string())).optional(),timeout_hours:uf.number().int().default(24)}).transform(t=>(0,Nkt.remap)(t,{input_files:"inputFiles",timeout_hours:"timeoutHours"}));bu.BatchJobIn$outboundSchema=uf.object({inputFiles:uf.array(uf.string()),endpoint:Dkt.ApiEndpoint$outboundSchema,model:uf.string(),metadata:uf.nullable(uf.record(uf.string())).optional(),timeoutHours:uf.number().int().default(24)}).transform(t=>(0,Nkt.remap)(t,{inputFiles:"input_files",timeoutHours:"timeout_hours"}));var jkt;(function(t){t.inboundSchema=bu.BatchJobIn$inboundSchema,t.outboundSchema=bu.BatchJobIn$outboundSchema})(jkt||(bu.BatchJobIn$=jkt={}));function ein(t){return JSON.stringify(bu.BatchJobIn$outboundSchema.parse(t))}function tin(t){return(0,Qon.safeParse)(t,e=>bu.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var XNe=v(_u=>{"use strict";var rin=_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]}),nin=_u&&_u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oin=_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)&&rin(e,t,r);return nin(e,t),e};Object.defineProperty(_u,"__esModule",{value:!0});_u.BatchJobStatus$=_u.BatchJobStatus$outboundSchema=_u.BatchJobStatus$inboundSchema=_u.BatchJobStatus=void 0;var iin=oin(Te());_u.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};_u.BatchJobStatus$inboundSchema=iin.nativeEnum(_u.BatchJobStatus);_u.BatchJobStatus$outboundSchema=_u.BatchJobStatus$inboundSchema;var Fkt;(function(t){t.inboundSchema=_u.BatchJobStatus$inboundSchema,t.outboundSchema=_u.BatchJobStatus$outboundSchema})(Fkt||(_u.BatchJobStatus$=Fkt={}))});var QNe=v(jo=>{"use strict";var ain=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]}),sin=jo&&jo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uin=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)&&ain(e,t,r);return sin(e,t),e};Object.defineProperty(jo,"__esModule",{value:!0});jo.BatchJobOut$=jo.BatchJobOut$outboundSchema=jo.BatchJobOut$inboundSchema=jo.BatchJobOutObject$=jo.BatchJobOutObject$outboundSchema=jo.BatchJobOutObject$inboundSchema=jo.BatchJobOutObject=void 0;jo.batchJobOutToJSON=cin;jo.batchJobOutFromJSON=din;var mr=uin(Te()),Bkt=Ue(),lin=ve(),qkt=ZNe(),Ukt=XNe();jo.BatchJobOutObject={Batch:"batch"};jo.BatchJobOutObject$inboundSchema=mr.nativeEnum(jo.BatchJobOutObject);jo.BatchJobOutObject$outboundSchema=jo.BatchJobOutObject$inboundSchema;var kkt;(function(t){t.inboundSchema=jo.BatchJobOutObject$inboundSchema,t.outboundSchema=jo.BatchJobOutObject$outboundSchema})(kkt||(jo.BatchJobOutObject$=kkt={}));jo.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(qkt.BatchError$inboundSchema),status:Ukt.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,Bkt.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"}));jo.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(qkt.BatchError$outboundSchema),status:Ukt.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,Bkt.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 $kt;(function(t){t.inboundSchema=jo.BatchJobOut$inboundSchema,t.outboundSchema=jo.BatchJobOut$outboundSchema})($kt||(jo.BatchJobOut$=$kt={}));function cin(t){return JSON.stringify(jo.BatchJobOut$outboundSchema.parse(t))}function din(t){return(0,lin.safeParse)(t,e=>jo.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var Wkt=v(No=>{"use strict";var fin=No&&No.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pin=No&&No.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),min=No&&No.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fin(e,t,r);return pin(e,t),e};Object.defineProperty(No,"__esModule",{value:!0});No.BatchJobsOut$=No.BatchJobsOut$outboundSchema=No.BatchJobsOut$inboundSchema=No.BatchJobsOutObject$=No.BatchJobsOutObject$outboundSchema=No.BatchJobsOutObject$inboundSchema=No.BatchJobsOutObject=void 0;No.batchJobsOutToJSON=gin;No.batchJobsOutFromJSON=yin;var vP=min(Te()),hin=ve(),Vkt=QNe();No.BatchJobsOutObject={List:"list"};No.BatchJobsOutObject$inboundSchema=vP.nativeEnum(No.BatchJobsOutObject);No.BatchJobsOutObject$outboundSchema=No.BatchJobsOutObject$inboundSchema;var zkt;(function(t){t.inboundSchema=No.BatchJobsOutObject$inboundSchema,t.outboundSchema=No.BatchJobsOutObject$outboundSchema})(zkt||(No.BatchJobsOutObject$=zkt={}));No.BatchJobsOut$inboundSchema=vP.object({data:vP.array(Vkt.BatchJobOut$inboundSchema).optional(),object:vP.literal("list").default("list"),total:vP.number().int()});No.BatchJobsOut$outboundSchema=vP.object({data:vP.array(Vkt.BatchJobOut$outboundSchema).optional(),object:vP.literal("list").default("list"),total:vP.number().int()});var Hkt;(function(t){t.inboundSchema=No.BatchJobsOut$inboundSchema,t.outboundSchema=No.BatchJobsOut$outboundSchema})(Hkt||(No.BatchJobsOut$=Hkt={}));function gin(t){return JSON.stringify(No.BatchJobsOut$outboundSchema.parse(t))}function yin(t){return(0,hin.safeParse)(t,e=>No.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var Xkt=v(Zt=>{"use strict";var bin=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]}),_in=Zt&&Zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vin=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)&&bin(e,t,r);return _in(e,t),e};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.ChatClassificationRequest$=Zt.ChatClassificationRequest$outboundSchema=Zt.ChatClassificationRequest$inboundSchema=Zt.ChatClassificationRequestInputs$=Zt.ChatClassificationRequestInputs$outboundSchema=Zt.ChatClassificationRequestInputs$inboundSchema=Zt.One$=Zt.One$outboundSchema=Zt.One$inboundSchema=Zt.Two$=Zt.Two$outboundSchema=Zt.Two$inboundSchema=void 0;Zt.twoToJSON=win;Zt.twoFromJSON=Sin;Zt.oneToJSON=xin;Zt.oneFromJSON=Cin;Zt.chatClassificationRequestInputsToJSON=Oin;Zt.chatClassificationRequestInputsFromJSON=Pin;Zt.chatClassificationRequestToJSON=Ein;Zt.chatClassificationRequestFromJSON=Tin;var ye=vin(Te()),Zkt=Ue(),Ise=ve(),Fg=qI(),kg=gD(),$g=yD(),Bg=bD();Zt.Two$inboundSchema=ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);Zt.Two$outboundSchema=ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);var Kkt;(function(t){t.inboundSchema=Zt.Two$inboundSchema,t.outboundSchema=Zt.Two$outboundSchema})(Kkt||(Zt.Two$=Kkt={}));function win(t){return JSON.stringify(Zt.Two$outboundSchema.parse(t))}function Sin(t){return(0,Ise.safeParse)(t,e=>Zt.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}Zt.One$inboundSchema=ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);Zt.One$outboundSchema=ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);var Gkt;(function(t){t.inboundSchema=Zt.One$inboundSchema,t.outboundSchema=Zt.One$outboundSchema})(Gkt||(Zt.One$=Gkt={}));function xin(t){return JSON.stringify(Zt.One$outboundSchema.parse(t))}function Cin(t){return(0,Ise.safeParse)(t,e=>Zt.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}Zt.ChatClassificationRequestInputs$inboundSchema=ye.union([ye.array(ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]);Zt.ChatClassificationRequestInputs$outboundSchema=ye.union([ye.array(ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]);var Jkt;(function(t){t.inboundSchema=Zt.ChatClassificationRequestInputs$inboundSchema,t.outboundSchema=Zt.ChatClassificationRequestInputs$outboundSchema})(Jkt||(Zt.ChatClassificationRequestInputs$=Jkt={}));function Oin(t){return JSON.stringify(Zt.ChatClassificationRequestInputs$outboundSchema.parse(t))}function Pin(t){return(0,Ise.safeParse)(t,e=>Zt.ChatClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequestInputs' from JSON")}Zt.ChatClassificationRequest$inboundSchema=ye.object({input:ye.union([ye.array(ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]),model:ye.nullable(ye.string())}).transform(t=>(0,Zkt.remap)(t,{input:"inputs"}));Zt.ChatClassificationRequest$outboundSchema=ye.object({inputs:ye.union([ye.array(ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]),model:ye.nullable(ye.string())}).transform(t=>(0,Zkt.remap)(t,{inputs:"input"}));var Ykt;(function(t){t.inboundSchema=Zt.ChatClassificationRequest$inboundSchema,t.outboundSchema=Zt.ChatClassificationRequest$outboundSchema})(Ykt||(Zt.ChatClassificationRequest$=Ykt={}));function Ein(t){return JSON.stringify(Zt.ChatClassificationRequest$outboundSchema.parse(t))}function Tin(t){return(0,Ise.safeParse)(t,e=>Zt.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var Mse=v(lo=>{"use strict";var Ain=lo&&lo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Iin=lo&&lo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Min=lo&&lo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ain(e,t,r);return Iin(e,t),e};Object.defineProperty(lo,"__esModule",{value:!0});lo.ChatCompletionChoice$=lo.ChatCompletionChoice$outboundSchema=lo.ChatCompletionChoice$inboundSchema=lo.FinishReason$=lo.FinishReason$outboundSchema=lo.FinishReason$inboundSchema=lo.FinishReason=void 0;lo.chatCompletionChoiceToJSON=Nin;lo.chatCompletionChoiceFromJSON=Din;var pb=Min(Te()),t$t=Ue(),Rin=ve(),jin=BI(),r$t=qI();lo.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};lo.FinishReason$inboundSchema=pb.union([pb.nativeEnum(lo.FinishReason),pb.string().transform(jin.catchUnrecognizedEnum)]);lo.FinishReason$outboundSchema=pb.union([pb.nativeEnum(lo.FinishReason),pb.string().and(pb.custom())]);var Qkt;(function(t){t.inboundSchema=lo.FinishReason$inboundSchema,t.outboundSchema=lo.FinishReason$outboundSchema})(Qkt||(lo.FinishReason$=Qkt={}));lo.ChatCompletionChoice$inboundSchema=pb.object({index:pb.number().int(),message:r$t.AssistantMessage$inboundSchema,finish_reason:lo.FinishReason$inboundSchema}).transform(t=>(0,t$t.remap)(t,{finish_reason:"finishReason"}));lo.ChatCompletionChoice$outboundSchema=pb.object({index:pb.number().int(),message:r$t.AssistantMessage$outboundSchema,finishReason:lo.FinishReason$outboundSchema}).transform(t=>(0,t$t.remap)(t,{finishReason:"finish_reason"}));var e$t;(function(t){t.inboundSchema=lo.ChatCompletionChoice$inboundSchema,t.outboundSchema=lo.ChatCompletionChoice$outboundSchema})(e$t||(lo.ChatCompletionChoice$=e$t={}));function Nin(t){return JSON.stringify(lo.ChatCompletionChoice$outboundSchema.parse(t))}function Din(t){return(0,Rin.safeParse)(t,e=>lo.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var d$t=v(Xt=>{"use strict";var Lin=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]}),Fin=Xt&&Xt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kin=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)&&Lin(e,t,r);return Fin(e,t),e};Object.defineProperty(Xt,"__esModule",{value:!0});Xt.ChatCompletionRequest$=Xt.ChatCompletionRequest$outboundSchema=Xt.ChatCompletionRequest$inboundSchema=Xt.ChatCompletionRequestToolChoice$=Xt.ChatCompletionRequestToolChoice$outboundSchema=Xt.ChatCompletionRequestToolChoice$inboundSchema=Xt.Messages$=Xt.Messages$outboundSchema=Xt.Messages$inboundSchema=Xt.Stop$=Xt.Stop$outboundSchema=Xt.Stop$inboundSchema=void 0;Xt.stopToJSON=$in;Xt.stopFromJSON=Bin;Xt.messagesToJSON=qin;Xt.messagesFromJSON=Uin;Xt.chatCompletionRequestToolChoiceToJSON=zin;Xt.chatCompletionRequestToolChoiceFromJSON=Hin;Xt.chatCompletionRequestToJSON=Vin;Xt.chatCompletionRequestFromJSON=Win;var ke=kin(Te()),s$t=Ue(),Rse=ve(),jse=qI(),u$t=IU(),l$t=MU(),Nse=gD(),c$t=RU(),Dse=jU(),Lse=NU(),Fse=yD(),kse=bD();Xt.Stop$inboundSchema=ke.union([ke.string(),ke.array(ke.string())]);Xt.Stop$outboundSchema=ke.union([ke.string(),ke.array(ke.string())]);var n$t;(function(t){t.inboundSchema=Xt.Stop$inboundSchema,t.outboundSchema=Xt.Stop$outboundSchema})(n$t||(Xt.Stop$=n$t={}));function $in(t){return JSON.stringify(Xt.Stop$outboundSchema.parse(t))}function Bin(t){return(0,Rse.safeParse)(t,e=>Xt.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}Xt.Messages$inboundSchema=ke.union([Nse.SystemMessage$inboundSchema.and(ke.object({role:ke.literal("system")}).transform(t=>({role:t.role}))),kse.UserMessage$inboundSchema.and(ke.object({role:ke.literal("user")}).transform(t=>({role:t.role}))),jse.AssistantMessage$inboundSchema.and(ke.object({role:ke.literal("assistant")}).transform(t=>({role:t.role}))),Fse.ToolMessage$inboundSchema.and(ke.object({role:ke.literal("tool")}).transform(t=>({role:t.role})))]);Xt.Messages$outboundSchema=ke.union([Nse.SystemMessage$outboundSchema.and(ke.object({role:ke.literal("system")}).transform(t=>({role:t.role}))),kse.UserMessage$outboundSchema.and(ke.object({role:ke.literal("user")}).transform(t=>({role:t.role}))),jse.AssistantMessage$outboundSchema.and(ke.object({role:ke.literal("assistant")}).transform(t=>({role:t.role}))),Fse.ToolMessage$outboundSchema.and(ke.object({role:ke.literal("tool")}).transform(t=>({role:t.role})))]);var o$t;(function(t){t.inboundSchema=Xt.Messages$inboundSchema,t.outboundSchema=Xt.Messages$outboundSchema})(o$t||(Xt.Messages$=o$t={}));function qin(t){return JSON.stringify(Xt.Messages$outboundSchema.parse(t))}function Uin(t){return(0,Rse.safeParse)(t,e=>Xt.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}Xt.ChatCompletionRequestToolChoice$inboundSchema=ke.union([Dse.ToolChoice$inboundSchema,Lse.ToolChoiceEnum$inboundSchema]);Xt.ChatCompletionRequestToolChoice$outboundSchema=ke.union([Dse.ToolChoice$outboundSchema,Lse.ToolChoiceEnum$outboundSchema]);var i$t;(function(t){t.inboundSchema=Xt.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Xt.ChatCompletionRequestToolChoice$outboundSchema})(i$t||(Xt.ChatCompletionRequestToolChoice$=i$t={}));function zin(t){return JSON.stringify(Xt.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function Hin(t){return(0,Rse.safeParse)(t,e=>Xt.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}Xt.ChatCompletionRequest$inboundSchema=ke.object({model:ke.nullable(ke.string()),temperature:ke.nullable(ke.number()).optional(),top_p:ke.number().optional(),max_tokens:ke.nullable(ke.number().int()).optional(),stream:ke.boolean().default(!1),stop:ke.union([ke.string(),ke.array(ke.string())]).optional(),random_seed:ke.nullable(ke.number().int()).optional(),messages:ke.array(ke.union([Nse.SystemMessage$inboundSchema.and(ke.object({role:ke.literal("system")}).transform(t=>({role:t.role}))),kse.UserMessage$inboundSchema.and(ke.object({role:ke.literal("user")}).transform(t=>({role:t.role}))),jse.AssistantMessage$inboundSchema.and(ke.object({role:ke.literal("assistant")}).transform(t=>({role:t.role}))),Fse.ToolMessage$inboundSchema.and(ke.object({role:ke.literal("tool")}).transform(t=>({role:t.role})))])),response_format:l$t.ResponseFormat$inboundSchema.optional(),tools:ke.nullable(ke.array(c$t.Tool$inboundSchema)).optional(),tool_choice:ke.union([Dse.ToolChoice$inboundSchema,Lse.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:ke.number().optional(),frequency_penalty:ke.number().optional(),n:ke.nullable(ke.number().int()).optional(),prediction:u$t.Prediction$inboundSchema.optional(),safe_prompt:ke.boolean().optional()}).transform(t=>(0,s$t.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"}));Xt.ChatCompletionRequest$outboundSchema=ke.object({model:ke.nullable(ke.string()),temperature:ke.nullable(ke.number()).optional(),topP:ke.number().optional(),maxTokens:ke.nullable(ke.number().int()).optional(),stream:ke.boolean().default(!1),stop:ke.union([ke.string(),ke.array(ke.string())]).optional(),randomSeed:ke.nullable(ke.number().int()).optional(),messages:ke.array(ke.union([Nse.SystemMessage$outboundSchema.and(ke.object({role:ke.literal("system")}).transform(t=>({role:t.role}))),kse.UserMessage$outboundSchema.and(ke.object({role:ke.literal("user")}).transform(t=>({role:t.role}))),jse.AssistantMessage$outboundSchema.and(ke.object({role:ke.literal("assistant")}).transform(t=>({role:t.role}))),Fse.ToolMessage$outboundSchema.and(ke.object({role:ke.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:l$t.ResponseFormat$outboundSchema.optional(),tools:ke.nullable(ke.array(c$t.Tool$outboundSchema)).optional(),toolChoice:ke.union([Dse.ToolChoice$outboundSchema,Lse.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:ke.number().optional(),frequencyPenalty:ke.number().optional(),n:ke.nullable(ke.number().int()).optional(),prediction:u$t.Prediction$outboundSchema.optional(),safePrompt:ke.boolean().optional()}).transform(t=>(0,s$t.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 a$t;(function(t){t.inboundSchema=Xt.ChatCompletionRequest$inboundSchema,t.outboundSchema=Xt.ChatCompletionRequest$outboundSchema})(a$t||(Xt.ChatCompletionRequest$=a$t={}));function Vin(t){return JSON.stringify(Xt.ChatCompletionRequest$outboundSchema.parse(t))}function Win(t){return(0,Rse.safeParse)(t,e=>Xt.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var LU=v(vu=>{"use strict";var Kin=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]}),Gin=vu&&vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jin=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)&&Kin(e,t,r);return Gin(e,t),e};Object.defineProperty(vu,"__esModule",{value:!0});vu.UsageInfo$=vu.UsageInfo$outboundSchema=vu.UsageInfo$inboundSchema=void 0;vu.usageInfoToJSON=Zin;vu.usageInfoFromJSON=Xin;var UI=Jin(Te()),p$t=Ue(),Yin=ve();vu.UsageInfo$inboundSchema=UI.object({prompt_tokens:UI.number().int(),completion_tokens:UI.number().int(),total_tokens:UI.number().int()}).transform(t=>(0,p$t.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens"}));vu.UsageInfo$outboundSchema=UI.object({promptTokens:UI.number().int(),completionTokens:UI.number().int(),totalTokens:UI.number().int()}).transform(t=>(0,p$t.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens"}));var f$t;(function(t){t.inboundSchema=vu.UsageInfo$inboundSchema,t.outboundSchema=vu.UsageInfo$outboundSchema})(f$t||(vu.UsageInfo$=f$t={}));function Zin(t){return JSON.stringify(vu.UsageInfo$outboundSchema.parse(t))}function Xin(t){return(0,Yin.safeParse)(t,e=>vu.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var y$t=v(wu=>{"use strict";var Qin=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]}),ean=wu&&wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tan=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)&&Qin(e,t,r);return ean(e,t),e};Object.defineProperty(wu,"__esModule",{value:!0});wu.ChatCompletionResponse$=wu.ChatCompletionResponse$outboundSchema=wu.ChatCompletionResponse$inboundSchema=void 0;wu.chatCompletionResponseToJSON=nan;wu.chatCompletionResponseFromJSON=oan;var qg=tan(Te()),ran=ve(),h$t=Mse(),g$t=LU();wu.ChatCompletionResponse$inboundSchema=qg.object({id:qg.string(),object:qg.string(),model:qg.string(),usage:g$t.UsageInfo$inboundSchema,created:qg.number().int().optional(),choices:qg.array(h$t.ChatCompletionChoice$inboundSchema).optional()});wu.ChatCompletionResponse$outboundSchema=qg.object({id:qg.string(),object:qg.string(),model:qg.string(),usage:g$t.UsageInfo$outboundSchema,created:qg.number().int().optional(),choices:qg.array(h$t.ChatCompletionChoice$outboundSchema).optional()});var m$t;(function(t){t.inboundSchema=wu.ChatCompletionResponse$inboundSchema,t.outboundSchema=wu.ChatCompletionResponse$outboundSchema})(m$t||(wu.ChatCompletionResponse$=m$t={}));function nan(t){return JSON.stringify(wu.ChatCompletionResponse$outboundSchema.parse(t))}function oan(t){return(0,ran.safeParse)(t,e=>wu.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var P$t=v(Qt=>{"use strict";var ian=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]}),aan=Qt&&Qt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),san=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)&&ian(e,t,r);return aan(e,t),e};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.ChatCompletionStreamRequest$=Qt.ChatCompletionStreamRequest$outboundSchema=Qt.ChatCompletionStreamRequest$inboundSchema=Qt.ChatCompletionStreamRequestToolChoice$=Qt.ChatCompletionStreamRequestToolChoice$outboundSchema=Qt.ChatCompletionStreamRequestToolChoice$inboundSchema=Qt.ChatCompletionStreamRequestMessages$=Qt.ChatCompletionStreamRequestMessages$outboundSchema=Qt.ChatCompletionStreamRequestMessages$inboundSchema=Qt.ChatCompletionStreamRequestStop$=Qt.ChatCompletionStreamRequestStop$outboundSchema=Qt.ChatCompletionStreamRequestStop$inboundSchema=void 0;Qt.chatCompletionStreamRequestStopToJSON=uan;Qt.chatCompletionStreamRequestStopFromJSON=lan;Qt.chatCompletionStreamRequestMessagesToJSON=can;Qt.chatCompletionStreamRequestMessagesFromJSON=dan;Qt.chatCompletionStreamRequestToolChoiceToJSON=fan;Qt.chatCompletionStreamRequestToolChoiceFromJSON=pan;Qt.chatCompletionStreamRequestToJSON=man;Qt.chatCompletionStreamRequestFromJSON=han;var $e=san(Te()),S$t=Ue(),$se=ve(),Bse=qI(),x$t=IU(),C$t=MU(),qse=gD(),O$t=RU(),Use=jU(),zse=NU(),Hse=yD(),Vse=bD();Qt.ChatCompletionStreamRequestStop$inboundSchema=$e.union([$e.string(),$e.array($e.string())]);Qt.ChatCompletionStreamRequestStop$outboundSchema=$e.union([$e.string(),$e.array($e.string())]);var b$t;(function(t){t.inboundSchema=Qt.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Qt.ChatCompletionStreamRequestStop$outboundSchema})(b$t||(Qt.ChatCompletionStreamRequestStop$=b$t={}));function uan(t){return JSON.stringify(Qt.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function lan(t){return(0,$se.safeParse)(t,e=>Qt.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}Qt.ChatCompletionStreamRequestMessages$inboundSchema=$e.union([qse.SystemMessage$inboundSchema.and($e.object({role:$e.literal("system")}).transform(t=>({role:t.role}))),Vse.UserMessage$inboundSchema.and($e.object({role:$e.literal("user")}).transform(t=>({role:t.role}))),Bse.AssistantMessage$inboundSchema.and($e.object({role:$e.literal("assistant")}).transform(t=>({role:t.role}))),Hse.ToolMessage$inboundSchema.and($e.object({role:$e.literal("tool")}).transform(t=>({role:t.role})))]);Qt.ChatCompletionStreamRequestMessages$outboundSchema=$e.union([qse.SystemMessage$outboundSchema.and($e.object({role:$e.literal("system")}).transform(t=>({role:t.role}))),Vse.UserMessage$outboundSchema.and($e.object({role:$e.literal("user")}).transform(t=>({role:t.role}))),Bse.AssistantMessage$outboundSchema.and($e.object({role:$e.literal("assistant")}).transform(t=>({role:t.role}))),Hse.ToolMessage$outboundSchema.and($e.object({role:$e.literal("tool")}).transform(t=>({role:t.role})))]);var _$t;(function(t){t.inboundSchema=Qt.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Qt.ChatCompletionStreamRequestMessages$outboundSchema})(_$t||(Qt.ChatCompletionStreamRequestMessages$=_$t={}));function can(t){return JSON.stringify(Qt.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function dan(t){return(0,$se.safeParse)(t,e=>Qt.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}Qt.ChatCompletionStreamRequestToolChoice$inboundSchema=$e.union([Use.ToolChoice$inboundSchema,zse.ToolChoiceEnum$inboundSchema]);Qt.ChatCompletionStreamRequestToolChoice$outboundSchema=$e.union([Use.ToolChoice$outboundSchema,zse.ToolChoiceEnum$outboundSchema]);var v$t;(function(t){t.inboundSchema=Qt.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Qt.ChatCompletionStreamRequestToolChoice$outboundSchema})(v$t||(Qt.ChatCompletionStreamRequestToolChoice$=v$t={}));function fan(t){return JSON.stringify(Qt.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function pan(t){return(0,$se.safeParse)(t,e=>Qt.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}Qt.ChatCompletionStreamRequest$inboundSchema=$e.object({model:$e.nullable($e.string()),temperature:$e.nullable($e.number()).optional(),top_p:$e.number().optional(),max_tokens:$e.nullable($e.number().int()).optional(),stream:$e.boolean().default(!0),stop:$e.union([$e.string(),$e.array($e.string())]).optional(),random_seed:$e.nullable($e.number().int()).optional(),messages:$e.array($e.union([qse.SystemMessage$inboundSchema.and($e.object({role:$e.literal("system")}).transform(t=>({role:t.role}))),Vse.UserMessage$inboundSchema.and($e.object({role:$e.literal("user")}).transform(t=>({role:t.role}))),Bse.AssistantMessage$inboundSchema.and($e.object({role:$e.literal("assistant")}).transform(t=>({role:t.role}))),Hse.ToolMessage$inboundSchema.and($e.object({role:$e.literal("tool")}).transform(t=>({role:t.role})))])),response_format:C$t.ResponseFormat$inboundSchema.optional(),tools:$e.nullable($e.array(O$t.Tool$inboundSchema)).optional(),tool_choice:$e.union([Use.ToolChoice$inboundSchema,zse.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:$e.number().optional(),frequency_penalty:$e.number().optional(),n:$e.nullable($e.number().int()).optional(),prediction:x$t.Prediction$inboundSchema.optional(),safe_prompt:$e.boolean().optional()}).transform(t=>(0,S$t.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"}));Qt.ChatCompletionStreamRequest$outboundSchema=$e.object({model:$e.nullable($e.string()),temperature:$e.nullable($e.number()).optional(),topP:$e.number().optional(),maxTokens:$e.nullable($e.number().int()).optional(),stream:$e.boolean().default(!0),stop:$e.union([$e.string(),$e.array($e.string())]).optional(),randomSeed:$e.nullable($e.number().int()).optional(),messages:$e.array($e.union([qse.SystemMessage$outboundSchema.and($e.object({role:$e.literal("system")}).transform(t=>({role:t.role}))),Vse.UserMessage$outboundSchema.and($e.object({role:$e.literal("user")}).transform(t=>({role:t.role}))),Bse.AssistantMessage$outboundSchema.and($e.object({role:$e.literal("assistant")}).transform(t=>({role:t.role}))),Hse.ToolMessage$outboundSchema.and($e.object({role:$e.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:C$t.ResponseFormat$outboundSchema.optional(),tools:$e.nullable($e.array(O$t.Tool$outboundSchema)).optional(),toolChoice:$e.union([Use.ToolChoice$outboundSchema,zse.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:$e.number().optional(),frequencyPenalty:$e.number().optional(),n:$e.nullable($e.number().int()).optional(),prediction:x$t.Prediction$outboundSchema.optional(),safePrompt:$e.boolean().optional()}).transform(t=>(0,S$t.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 w$t;(function(t){t.inboundSchema=Qt.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=Qt.ChatCompletionStreamRequest$outboundSchema})(w$t||(Qt.ChatCompletionStreamRequest$=w$t={}));function man(t){return JSON.stringify(Qt.ChatCompletionStreamRequest$outboundSchema.parse(t))}function han(t){return(0,$se.safeParse)(t,e=>Qt.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var eDe=v(Su=>{"use strict";var gan=Su&&Su.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yan=Su&&Su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ban=Su&&Su.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gan(e,t,r);return yan(e,t),e};Object.defineProperty(Su,"__esModule",{value:!0});Su.MetricOut$=Su.MetricOut$outboundSchema=Su.MetricOut$inboundSchema=void 0;Su.metricOutToJSON=van;Su.metricOutFromJSON=wan;var rm=ban(Te()),T$t=Ue(),_an=ve();Su.MetricOut$inboundSchema=rm.object({train_loss:rm.nullable(rm.number()).optional(),valid_loss:rm.nullable(rm.number()).optional(),valid_mean_token_accuracy:rm.nullable(rm.number()).optional()}).transform(t=>(0,T$t.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));Su.MetricOut$outboundSchema=rm.object({trainLoss:rm.nullable(rm.number()).optional(),validLoss:rm.nullable(rm.number()).optional(),validMeanTokenAccuracy:rm.nullable(rm.number()).optional()}).transform(t=>(0,T$t.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var E$t;(function(t){t.inboundSchema=Su.MetricOut$inboundSchema,t.outboundSchema=Su.MetricOut$outboundSchema})(E$t||(Su.MetricOut$=E$t={}));function van(t){return JSON.stringify(Su.MetricOut$outboundSchema.parse(t))}function wan(t){return(0,_an.safeParse)(t,e=>Su.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var tDe=v(xu=>{"use strict";var San=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]}),xan=xu&&xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Can=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)&&San(e,t,r);return xan(e,t),e};Object.defineProperty(xu,"__esModule",{value:!0});xu.CheckpointOut$=xu.CheckpointOut$outboundSchema=xu.CheckpointOut$inboundSchema=void 0;xu.checkpointOutToJSON=Pan;xu.checkpointOutFromJSON=Ean;var FU=Can(Te()),I$t=Ue(),Oan=ve(),M$t=eDe();xu.CheckpointOut$inboundSchema=FU.object({metrics:M$t.MetricOut$inboundSchema,step_number:FU.number().int(),created_at:FU.number().int()}).transform(t=>(0,I$t.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));xu.CheckpointOut$outboundSchema=FU.object({metrics:M$t.MetricOut$outboundSchema,stepNumber:FU.number().int(),createdAt:FU.number().int()}).transform(t=>(0,I$t.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var A$t;(function(t){t.inboundSchema=xu.CheckpointOut$inboundSchema,t.outboundSchema=xu.CheckpointOut$outboundSchema})(A$t||(xu.CheckpointOut$=A$t={}));function Pan(t){return JSON.stringify(xu.CheckpointOut$outboundSchema.parse(t))}function Ean(t){return(0,Oan.safeParse)(t,e=>xu.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var rDe=v(Cu=>{"use strict";var Tan=Cu&&Cu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Aan=Cu&&Cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ian=Cu&&Cu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tan(e,t,r);return Aan(e,t),e};Object.defineProperty(Cu,"__esModule",{value:!0});Cu.ClassificationObject$=Cu.ClassificationObject$outboundSchema=Cu.ClassificationObject$inboundSchema=void 0;Cu.classificationObjectToJSON=Ran;Cu.classificationObjectFromJSON=jan;var Ux=Ian(Te()),j$t=Ue(),Man=ve();Cu.ClassificationObject$inboundSchema=Ux.object({categories:Ux.record(Ux.boolean()).optional(),category_scores:Ux.record(Ux.number()).optional()}).transform(t=>(0,j$t.remap)(t,{category_scores:"categoryScores"}));Cu.ClassificationObject$outboundSchema=Ux.object({categories:Ux.record(Ux.boolean()).optional(),categoryScores:Ux.record(Ux.number()).optional()}).transform(t=>(0,j$t.remap)(t,{categoryScores:"category_scores"}));var R$t;(function(t){t.inboundSchema=Cu.ClassificationObject$inboundSchema,t.outboundSchema=Cu.ClassificationObject$outboundSchema})(R$t||(Cu.ClassificationObject$=R$t={}));function Ran(t){return JSON.stringify(Cu.ClassificationObject$outboundSchema.parse(t))}function jan(t){return(0,Man.safeParse)(t,e=>Cu.ClassificationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationObject' from JSON")}});var k$t=v(Do=>{"use strict";var Nan=Do&&Do.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Dan=Do&&Do.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lan=Do&&Do.__importStar||function(t){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 Dan(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.ClassificationRequest$=Do.ClassificationRequest$outboundSchema=Do.ClassificationRequest$inboundSchema=Do.ClassificationRequestInputs$=Do.ClassificationRequestInputs$outboundSchema=Do.ClassificationRequestInputs$inboundSchema=void 0;Do.classificationRequestInputsToJSON=Fan;Do.classificationRequestInputsFromJSON=kan;Do.classificationRequestToJSON=$an;Do.classificationRequestFromJSON=Ban;var _s=Lan(Te()),L$t=Ue(),F$t=ve();Do.ClassificationRequestInputs$inboundSchema=_s.union([_s.string(),_s.array(_s.string())]);Do.ClassificationRequestInputs$outboundSchema=_s.union([_s.string(),_s.array(_s.string())]);var N$t;(function(t){t.inboundSchema=Do.ClassificationRequestInputs$inboundSchema,t.outboundSchema=Do.ClassificationRequestInputs$outboundSchema})(N$t||(Do.ClassificationRequestInputs$=N$t={}));function Fan(t){return JSON.stringify(Do.ClassificationRequestInputs$outboundSchema.parse(t))}function kan(t){return(0,F$t.safeParse)(t,e=>Do.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}Do.ClassificationRequest$inboundSchema=_s.object({input:_s.union([_s.string(),_s.array(_s.string())]),model:_s.nullable(_s.string()).optional()}).transform(t=>(0,L$t.remap)(t,{input:"inputs"}));Do.ClassificationRequest$outboundSchema=_s.object({inputs:_s.union([_s.string(),_s.array(_s.string())]),model:_s.nullable(_s.string()).optional()}).transform(t=>(0,L$t.remap)(t,{inputs:"input"}));var D$t;(function(t){t.inboundSchema=Do.ClassificationRequest$inboundSchema,t.outboundSchema=Do.ClassificationRequest$outboundSchema})(D$t||(Do.ClassificationRequest$=D$t={}));function $an(t){return JSON.stringify(Do.ClassificationRequest$outboundSchema.parse(t))}function Ban(t){return(0,F$t.safeParse)(t,e=>Do.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var q$t=v(Ou=>{"use strict";var qan=Ou&&Ou.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Uan=Ou&&Ou.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zan=Ou&&Ou.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qan(e,t,r);return Uan(e,t),e};Object.defineProperty(Ou,"__esModule",{value:!0});Ou.ClassificationResponse$=Ou.ClassificationResponse$outboundSchema=Ou.ClassificationResponse$inboundSchema=void 0;Ou.classificationResponseToJSON=Van;Ou.classificationResponseFromJSON=Wan;var zI=zan(Te()),Han=ve(),B$t=rDe();Ou.ClassificationResponse$inboundSchema=zI.object({id:zI.string().optional(),model:zI.string().optional(),results:zI.array(B$t.ClassificationObject$inboundSchema).optional()});Ou.ClassificationResponse$outboundSchema=zI.object({id:zI.string().optional(),model:zI.string().optional(),results:zI.array(B$t.ClassificationObject$outboundSchema).optional()});var $$t;(function(t){t.inboundSchema=Ou.ClassificationResponse$inboundSchema,t.outboundSchema=Ou.ClassificationResponse$outboundSchema})($$t||(Ou.ClassificationResponse$=$$t={}));function Van(t){return JSON.stringify(Ou.ClassificationResponse$outboundSchema.parse(t))}function Wan(t){return(0,Han.safeParse)(t,e=>Ou.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var nDe=v(Lo=>{"use strict";var Kan=Lo&&Lo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gan=Lo&&Lo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jan=Lo&&Lo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Kan(e,t,r);return Gan(e,t),e};Object.defineProperty(Lo,"__esModule",{value:!0});Lo.DeltaMessage$=Lo.DeltaMessage$outboundSchema=Lo.DeltaMessage$inboundSchema=Lo.Content$=Lo.Content$outboundSchema=Lo.Content$inboundSchema=void 0;Lo.contentToJSON=Yan;Lo.contentFromJSON=Zan;Lo.deltaMessageToJSON=Xan;Lo.deltaMessageFromJSON=Qan;var Ma=Jan(Te()),H$t=Ue(),V$t=ve(),Wse=TU(),W$t=use();Lo.Content$inboundSchema=Ma.union([Ma.string(),Ma.array(Wse.ContentChunk$inboundSchema)]);Lo.Content$outboundSchema=Ma.union([Ma.string(),Ma.array(Wse.ContentChunk$outboundSchema)]);var U$t;(function(t){t.inboundSchema=Lo.Content$inboundSchema,t.outboundSchema=Lo.Content$outboundSchema})(U$t||(Lo.Content$=U$t={}));function Yan(t){return JSON.stringify(Lo.Content$outboundSchema.parse(t))}function Zan(t){return(0,V$t.safeParse)(t,e=>Lo.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}Lo.DeltaMessage$inboundSchema=Ma.object({role:Ma.nullable(Ma.string()).optional(),content:Ma.nullable(Ma.union([Ma.string(),Ma.array(Wse.ContentChunk$inboundSchema)])).optional(),tool_calls:Ma.nullable(Ma.array(W$t.ToolCall$inboundSchema)).optional()}).transform(t=>(0,H$t.remap)(t,{tool_calls:"toolCalls"}));Lo.DeltaMessage$outboundSchema=Ma.object({role:Ma.nullable(Ma.string()).optional(),content:Ma.nullable(Ma.union([Ma.string(),Ma.array(Wse.ContentChunk$outboundSchema)])).optional(),toolCalls:Ma.nullable(Ma.array(W$t.ToolCall$outboundSchema)).optional()}).transform(t=>(0,H$t.remap)(t,{toolCalls:"tool_calls"}));var z$t;(function(t){t.inboundSchema=Lo.DeltaMessage$inboundSchema,t.outboundSchema=Lo.DeltaMessage$outboundSchema})(z$t||(Lo.DeltaMessage$=z$t={}));function Xan(t){return JSON.stringify(Lo.DeltaMessage$outboundSchema.parse(t))}function Qan(t){return(0,V$t.safeParse)(t,e=>Lo.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var oDe=v(co=>{"use strict";var esn=co&&co.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tsn=co&&co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rsn=co&&co.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&esn(e,t,r);return tsn(e,t),e};Object.defineProperty(co,"__esModule",{value:!0});co.CompletionResponseStreamChoice$=co.CompletionResponseStreamChoice$outboundSchema=co.CompletionResponseStreamChoice$inboundSchema=co.CompletionResponseStreamChoiceFinishReason$=co.CompletionResponseStreamChoiceFinishReason$outboundSchema=co.CompletionResponseStreamChoiceFinishReason$inboundSchema=co.CompletionResponseStreamChoiceFinishReason=void 0;co.completionResponseStreamChoiceToJSON=isn;co.completionResponseStreamChoiceFromJSON=asn;var sh=rsn(Te()),J$t=Ue(),nsn=ve(),osn=BI(),Y$t=nDe();co.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};co.CompletionResponseStreamChoiceFinishReason$inboundSchema=sh.union([sh.nativeEnum(co.CompletionResponseStreamChoiceFinishReason),sh.string().transform(osn.catchUnrecognizedEnum)]);co.CompletionResponseStreamChoiceFinishReason$outboundSchema=sh.union([sh.nativeEnum(co.CompletionResponseStreamChoiceFinishReason),sh.string().and(sh.custom())]);var K$t;(function(t){t.inboundSchema=co.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=co.CompletionResponseStreamChoiceFinishReason$outboundSchema})(K$t||(co.CompletionResponseStreamChoiceFinishReason$=K$t={}));co.CompletionResponseStreamChoice$inboundSchema=sh.object({index:sh.number().int(),delta:Y$t.DeltaMessage$inboundSchema,finish_reason:sh.nullable(co.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,J$t.remap)(t,{finish_reason:"finishReason"}));co.CompletionResponseStreamChoice$outboundSchema=sh.object({index:sh.number().int(),delta:Y$t.DeltaMessage$outboundSchema,finishReason:sh.nullable(co.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,J$t.remap)(t,{finishReason:"finish_reason"}));var G$t;(function(t){t.inboundSchema=co.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=co.CompletionResponseStreamChoice$outboundSchema})(G$t||(co.CompletionResponseStreamChoice$=G$t={}));function isn(t){return JSON.stringify(co.CompletionResponseStreamChoice$outboundSchema.parse(t))}function asn(t){return(0,nsn.safeParse)(t,e=>co.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var iDe=v(Pu=>{"use strict";var ssn=Pu&&Pu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),usn=Pu&&Pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lsn=Pu&&Pu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ssn(e,t,r);return usn(e,t),e};Object.defineProperty(Pu,"__esModule",{value:!0});Pu.CompletionChunk$=Pu.CompletionChunk$outboundSchema=Pu.CompletionChunk$inboundSchema=void 0;Pu.completionChunkToJSON=dsn;Pu.completionChunkFromJSON=fsn;var Ug=lsn(Te()),csn=ve(),X$t=oDe(),Q$t=LU();Pu.CompletionChunk$inboundSchema=Ug.object({id:Ug.string(),object:Ug.string().optional(),created:Ug.number().int().optional(),model:Ug.string(),usage:Q$t.UsageInfo$inboundSchema.optional(),choices:Ug.array(X$t.CompletionResponseStreamChoice$inboundSchema)});Pu.CompletionChunk$outboundSchema=Ug.object({id:Ug.string(),object:Ug.string().optional(),created:Ug.number().int().optional(),model:Ug.string(),usage:Q$t.UsageInfo$outboundSchema.optional(),choices:Ug.array(X$t.CompletionResponseStreamChoice$outboundSchema)});var Z$t;(function(t){t.inboundSchema=Pu.CompletionChunk$inboundSchema,t.outboundSchema=Pu.CompletionChunk$outboundSchema})(Z$t||(Pu.CompletionChunk$=Z$t={}));function dsn(t){return JSON.stringify(Pu.CompletionChunk$outboundSchema.parse(t))}function fsn(t){return(0,csn.safeParse)(t,e=>Pu.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var rBt=v(Eu=>{"use strict";var psn=Eu&&Eu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),msn=Eu&&Eu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hsn=Eu&&Eu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&psn(e,t,r);return msn(e,t),e};Object.defineProperty(Eu,"__esModule",{value:!0});Eu.CompletionEvent$=Eu.CompletionEvent$outboundSchema=Eu.CompletionEvent$inboundSchema=void 0;Eu.completionEventToJSON=ysn;Eu.completionEventFromJSON=bsn;var K5=hsn(Te()),gsn=ve(),tBt=iDe();Eu.CompletionEvent$inboundSchema=K5.object({data:K5.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:K5.ZodIssueCode.custom,message:`malformed json: ${r}`}),K5.NEVER}}).pipe(tBt.CompletionChunk$inboundSchema)});Eu.CompletionEvent$outboundSchema=K5.object({data:tBt.CompletionChunk$outboundSchema});var eBt;(function(t){t.inboundSchema=Eu.CompletionEvent$inboundSchema,t.outboundSchema=Eu.CompletionEvent$outboundSchema})(eBt||(Eu.CompletionEvent$=eBt={}));function ysn(t){return JSON.stringify(Eu.CompletionEvent$outboundSchema.parse(t))}function bsn(t){return(0,gsn.safeParse)(t,e=>Eu.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var oBt=v(Tu=>{"use strict";var _sn=Tu&&Tu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vsn=Tu&&Tu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wsn=Tu&&Tu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_sn(e,t,r);return vsn(e,t),e};Object.defineProperty(Tu,"__esModule",{value:!0});Tu.DeleteFileOut$=Tu.DeleteFileOut$outboundSchema=Tu.DeleteFileOut$inboundSchema=void 0;Tu.deleteFileOutToJSON=xsn;Tu.deleteFileOutFromJSON=Csn;var HI=wsn(Te()),Ssn=ve();Tu.DeleteFileOut$inboundSchema=HI.object({id:HI.string(),object:HI.string(),deleted:HI.boolean()});Tu.DeleteFileOut$outboundSchema=HI.object({id:HI.string(),object:HI.string(),deleted:HI.boolean()});var nBt;(function(t){t.inboundSchema=Tu.DeleteFileOut$inboundSchema,t.outboundSchema=Tu.DeleteFileOut$outboundSchema})(nBt||(Tu.DeleteFileOut$=nBt={}));function xsn(t){return JSON.stringify(Tu.DeleteFileOut$outboundSchema.parse(t))}function Csn(t){return(0,Ssn.safeParse)(t,e=>Tu.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var aBt=v(Au=>{"use strict";var Osn=Au&&Au.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Psn=Au&&Au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Esn=Au&&Au.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Osn(e,t,r);return Psn(e,t),e};Object.defineProperty(Au,"__esModule",{value:!0});Au.DeleteModelOut$=Au.DeleteModelOut$outboundSchema=Au.DeleteModelOut$inboundSchema=void 0;Au.deleteModelOutToJSON=Asn;Au.deleteModelOutFromJSON=Isn;var VI=Esn(Te()),Tsn=ve();Au.DeleteModelOut$inboundSchema=VI.object({id:VI.string(),object:VI.string().default("model"),deleted:VI.boolean().default(!0)});Au.DeleteModelOut$outboundSchema=VI.object({id:VI.string(),object:VI.string().default("model"),deleted:VI.boolean().default(!0)});var iBt;(function(t){t.inboundSchema=Au.DeleteModelOut$inboundSchema,t.outboundSchema=Au.DeleteModelOut$outboundSchema})(iBt||(Au.DeleteModelOut$=iBt={}));function Asn(t){return JSON.stringify(Au.DeleteModelOut$outboundSchema.parse(t))}function Isn(t){return(0,Tsn.safeParse)(t,e=>Au.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var aDe=v(Iu=>{"use strict";var Msn=Iu&&Iu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Rsn=Iu&&Iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jsn=Iu&&Iu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Msn(e,t,r);return Rsn(e,t),e};Object.defineProperty(Iu,"__esModule",{value:!0});Iu.EventOut$=Iu.EventOut$outboundSchema=Iu.EventOut$inboundSchema=void 0;Iu.eventOutToJSON=Dsn;Iu.eventOutFromJSON=Lsn;var zg=jsn(Te()),uBt=Ue(),Nsn=ve();Iu.EventOut$inboundSchema=zg.object({name:zg.string(),data:zg.nullable(zg.record(zg.any())).optional(),created_at:zg.number().int()}).transform(t=>(0,uBt.remap)(t,{created_at:"createdAt"}));Iu.EventOut$outboundSchema=zg.object({name:zg.string(),data:zg.nullable(zg.record(zg.any())).optional(),createdAt:zg.number().int()}).transform(t=>(0,uBt.remap)(t,{createdAt:"created_at"}));var sBt;(function(t){t.inboundSchema=Iu.EventOut$inboundSchema,t.outboundSchema=Iu.EventOut$outboundSchema})(sBt||(Iu.EventOut$=sBt={}));function Dsn(t){return JSON.stringify(Iu.EventOut$outboundSchema.parse(t))}function Lsn(t){return(0,Nsn.safeParse)(t,e=>Iu.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var Kse=v(Fo=>{"use strict";var Fsn=Fo&&Fo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ksn=Fo&&Fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$sn=Fo&&Fo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Fsn(e,t,r);return ksn(e,t),e};Object.defineProperty(Fo,"__esModule",{value:!0});Fo.GithubRepositoryOut$=Fo.GithubRepositoryOut$outboundSchema=Fo.GithubRepositoryOut$inboundSchema=Fo.GithubRepositoryOutType$=Fo.GithubRepositoryOutType$outboundSchema=Fo.GithubRepositoryOutType$inboundSchema=Fo.GithubRepositoryOutType=void 0;Fo.githubRepositoryOutToJSON=qsn;Fo.githubRepositoryOutFromJSON=Usn;var nd=$sn(Te()),dBt=Ue(),Bsn=ve();Fo.GithubRepositoryOutType={Github:"github"};Fo.GithubRepositoryOutType$inboundSchema=nd.nativeEnum(Fo.GithubRepositoryOutType);Fo.GithubRepositoryOutType$outboundSchema=Fo.GithubRepositoryOutType$inboundSchema;var lBt;(function(t){t.inboundSchema=Fo.GithubRepositoryOutType$inboundSchema,t.outboundSchema=Fo.GithubRepositoryOutType$outboundSchema})(lBt||(Fo.GithubRepositoryOutType$=lBt={}));Fo.GithubRepositoryOut$inboundSchema=nd.object({type:nd.literal("github").default("github"),name:nd.string(),owner:nd.string(),ref:nd.nullable(nd.string()).optional(),weight:nd.number().default(1),commit_id:nd.string()}).transform(t=>(0,dBt.remap)(t,{commit_id:"commitId"}));Fo.GithubRepositoryOut$outboundSchema=nd.object({type:nd.literal("github").default("github"),name:nd.string(),owner:nd.string(),ref:nd.nullable(nd.string()).optional(),weight:nd.number().default(1),commitId:nd.string()}).transform(t=>(0,dBt.remap)(t,{commitId:"commit_id"}));var cBt;(function(t){t.inboundSchema=Fo.GithubRepositoryOut$inboundSchema,t.outboundSchema=Fo.GithubRepositoryOut$outboundSchema})(cBt||(Fo.GithubRepositoryOut$=cBt={}));function qsn(t){return JSON.stringify(Fo.GithubRepositoryOut$outboundSchema.parse(t))}function Usn(t){return(0,Bsn.safeParse)(t,e=>Fo.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var Gse=v(Mu=>{"use strict";var zsn=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]}),Hsn=Mu&&Mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vsn=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)&&zsn(e,t,r);return Hsn(e,t),e};Object.defineProperty(Mu,"__esModule",{value:!0});Mu.JobMetadataOut$=Mu.JobMetadataOut$outboundSchema=Mu.JobMetadataOut$inboundSchema=void 0;Mu.jobMetadataOutToJSON=Ksn;Mu.jobMetadataOutFromJSON=Gsn;var gi=Vsn(Te()),pBt=Ue(),Wsn=ve();Mu.JobMetadataOut$inboundSchema=gi.object({expected_duration_seconds:gi.nullable(gi.number().int()).optional(),cost:gi.nullable(gi.number()).optional(),cost_currency:gi.nullable(gi.string()).optional(),train_tokens_per_step:gi.nullable(gi.number().int()).optional(),train_tokens:gi.nullable(gi.number().int()).optional(),data_tokens:gi.nullable(gi.number().int()).optional(),estimated_start_time:gi.nullable(gi.number().int()).optional()}).transform(t=>(0,pBt.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));Mu.JobMetadataOut$outboundSchema=gi.object({expectedDurationSeconds:gi.nullable(gi.number().int()).optional(),cost:gi.nullable(gi.number()).optional(),costCurrency:gi.nullable(gi.string()).optional(),trainTokensPerStep:gi.nullable(gi.number().int()).optional(),trainTokens:gi.nullable(gi.number().int()).optional(),dataTokens:gi.nullable(gi.number().int()).optional(),estimatedStartTime:gi.nullable(gi.number().int()).optional()}).transform(t=>(0,pBt.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 fBt;(function(t){t.inboundSchema=Mu.JobMetadataOut$inboundSchema,t.outboundSchema=Mu.JobMetadataOut$outboundSchema})(fBt||(Mu.JobMetadataOut$=fBt={}));function Ksn(t){return JSON.stringify(Mu.JobMetadataOut$outboundSchema.parse(t))}function Gsn(t){return(0,Wsn.safeParse)(t,e=>Mu.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var Jse=v(Ru=>{"use strict";var Jsn=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]}),Ysn=Ru&&Ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zsn=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)&&Jsn(e,t,r);return Ysn(e,t),e};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.TrainingParameters$=Ru.TrainingParameters$outboundSchema=Ru.TrainingParameters$inboundSchema=void 0;Ru.trainingParametersToJSON=Qsn;Ru.trainingParametersFromJSON=eun;var Ai=Zsn(Te()),hBt=Ue(),Xsn=ve();Ru.TrainingParameters$inboundSchema=Ai.object({training_steps:Ai.nullable(Ai.number().int()).optional(),learning_rate:Ai.number().default(1e-4),weight_decay:Ai.nullable(Ai.number()).optional(),warmup_fraction:Ai.nullable(Ai.number()).optional(),epochs:Ai.nullable(Ai.number()).optional(),fim_ratio:Ai.nullable(Ai.number()).optional(),seq_len:Ai.nullable(Ai.number().int()).optional()}).transform(t=>(0,hBt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));Ru.TrainingParameters$outboundSchema=Ai.object({trainingSteps:Ai.nullable(Ai.number().int()).optional(),learningRate:Ai.number().default(1e-4),weightDecay:Ai.nullable(Ai.number()).optional(),warmupFraction:Ai.nullable(Ai.number()).optional(),epochs:Ai.nullable(Ai.number()).optional(),fimRatio:Ai.nullable(Ai.number()).optional(),seqLen:Ai.nullable(Ai.number().int()).optional()}).transform(t=>(0,hBt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var mBt;(function(t){t.inboundSchema=Ru.TrainingParameters$inboundSchema,t.outboundSchema=Ru.TrainingParameters$outboundSchema})(mBt||(Ru.TrainingParameters$=mBt={}));function Qsn(t){return JSON.stringify(Ru.TrainingParameters$outboundSchema.parse(t))}function eun(t){return(0,Xsn.safeParse)(t,e=>Ru.TrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParameters' from JSON")}});var Yse=v(ko=>{"use strict";var tun=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]}),run=ko&&ko.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nun=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)&&tun(e,t,r);return run(e,t),e};Object.defineProperty(ko,"__esModule",{value:!0});ko.WandbIntegrationOut$=ko.WandbIntegrationOut$outboundSchema=ko.WandbIntegrationOut$inboundSchema=ko.WandbIntegrationOutType$=ko.WandbIntegrationOutType$outboundSchema=ko.WandbIntegrationOutType$inboundSchema=ko.WandbIntegrationOutType=void 0;ko.wandbIntegrationOutToJSON=iun;ko.wandbIntegrationOutFromJSON=aun;var ep=nun(Te()),bBt=Ue(),oun=ve();ko.WandbIntegrationOutType={Wandb:"wandb"};ko.WandbIntegrationOutType$inboundSchema=ep.nativeEnum(ko.WandbIntegrationOutType);ko.WandbIntegrationOutType$outboundSchema=ko.WandbIntegrationOutType$inboundSchema;var gBt;(function(t){t.inboundSchema=ko.WandbIntegrationOutType$inboundSchema,t.outboundSchema=ko.WandbIntegrationOutType$outboundSchema})(gBt||(ko.WandbIntegrationOutType$=gBt={}));ko.WandbIntegrationOut$inboundSchema=ep.object({type:ep.literal("wandb").default("wandb"),project:ep.string(),name:ep.nullable(ep.string()).optional(),run_name:ep.nullable(ep.string()).optional()}).transform(t=>(0,bBt.remap)(t,{run_name:"runName"}));ko.WandbIntegrationOut$outboundSchema=ep.object({type:ep.literal("wandb").default("wandb"),project:ep.string(),name:ep.nullable(ep.string()).optional(),runName:ep.nullable(ep.string()).optional()}).transform(t=>(0,bBt.remap)(t,{runName:"run_name"}));var yBt;(function(t){t.inboundSchema=ko.WandbIntegrationOut$inboundSchema,t.outboundSchema=ko.WandbIntegrationOut$outboundSchema})(yBt||(ko.WandbIntegrationOut$=yBt={}));function iun(t){return JSON.stringify(ko.WandbIntegrationOut$outboundSchema.parse(t))}function aun(t){return(0,oun.safeParse)(t,e=>ko.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var ABt=v(gt=>{"use strict";var sun=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]}),uun=gt&>.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lun=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)&&sun(e,t,r);return uun(e,t),e};Object.defineProperty(gt,"__esModule",{value:!0});gt.DetailedJobOut$=gt.DetailedJobOut$outboundSchema=gt.DetailedJobOut$inboundSchema=gt.DetailedJobOutRepositories$=gt.DetailedJobOutRepositories$outboundSchema=gt.DetailedJobOutRepositories$inboundSchema=gt.DetailedJobOutIntegrations$=gt.DetailedJobOutIntegrations$outboundSchema=gt.DetailedJobOutIntegrations$inboundSchema=gt.DetailedJobOutObject$=gt.DetailedJobOutObject$outboundSchema=gt.DetailedJobOutObject$inboundSchema=gt.DetailedJobOutStatus$=gt.DetailedJobOutStatus$outboundSchema=gt.DetailedJobOutStatus$inboundSchema=gt.DetailedJobOutObject=gt.DetailedJobOutStatus=void 0;gt.detailedJobOutIntegrationsToJSON=cun;gt.detailedJobOutIntegrationsFromJSON=dun;gt.detailedJobOutRepositoriesToJSON=fun;gt.detailedJobOutRepositoriesFromJSON=pun;gt.detailedJobOutToJSON=mun;gt.detailedJobOutFromJSON=hun;var ur=lun(Te()),CBt=Ue(),sDe=ve(),OBt=tDe(),PBt=aDe(),Zse=Kse(),EBt=Gse(),TBt=Jse(),Xse=Yse();gt.DetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};gt.DetailedJobOutObject={Job:"job"};gt.DetailedJobOutStatus$inboundSchema=ur.nativeEnum(gt.DetailedJobOutStatus);gt.DetailedJobOutStatus$outboundSchema=gt.DetailedJobOutStatus$inboundSchema;var _Bt;(function(t){t.inboundSchema=gt.DetailedJobOutStatus$inboundSchema,t.outboundSchema=gt.DetailedJobOutStatus$outboundSchema})(_Bt||(gt.DetailedJobOutStatus$=_Bt={}));gt.DetailedJobOutObject$inboundSchema=ur.nativeEnum(gt.DetailedJobOutObject);gt.DetailedJobOutObject$outboundSchema=gt.DetailedJobOutObject$inboundSchema;var vBt;(function(t){t.inboundSchema=gt.DetailedJobOutObject$inboundSchema,t.outboundSchema=gt.DetailedJobOutObject$outboundSchema})(vBt||(gt.DetailedJobOutObject$=vBt={}));gt.DetailedJobOutIntegrations$inboundSchema=Xse.WandbIntegrationOut$inboundSchema;gt.DetailedJobOutIntegrations$outboundSchema=Xse.WandbIntegrationOut$outboundSchema;var wBt;(function(t){t.inboundSchema=gt.DetailedJobOutIntegrations$inboundSchema,t.outboundSchema=gt.DetailedJobOutIntegrations$outboundSchema})(wBt||(gt.DetailedJobOutIntegrations$=wBt={}));function cun(t){return JSON.stringify(gt.DetailedJobOutIntegrations$outboundSchema.parse(t))}function dun(t){return(0,sDe.safeParse)(t,e=>gt.DetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutIntegrations' from JSON")}gt.DetailedJobOutRepositories$inboundSchema=Zse.GithubRepositoryOut$inboundSchema;gt.DetailedJobOutRepositories$outboundSchema=Zse.GithubRepositoryOut$outboundSchema;var SBt;(function(t){t.inboundSchema=gt.DetailedJobOutRepositories$inboundSchema,t.outboundSchema=gt.DetailedJobOutRepositories$outboundSchema})(SBt||(gt.DetailedJobOutRepositories$=SBt={}));function fun(t){return JSON.stringify(gt.DetailedJobOutRepositories$outboundSchema.parse(t))}function pun(t){return(0,sDe.safeParse)(t,e=>gt.DetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutRepositories' from JSON")}gt.DetailedJobOut$inboundSchema=ur.object({id:ur.string(),auto_start:ur.boolean(),hyperparameters:TBt.TrainingParameters$inboundSchema,model:ur.string(),status:gt.DetailedJobOutStatus$inboundSchema,job_type:ur.string(),created_at:ur.number().int(),modified_at:ur.number().int(),training_files:ur.array(ur.string()),validation_files:ur.nullable(ur.array(ur.string())).optional(),object:ur.literal("job").default("job"),fine_tuned_model:ur.nullable(ur.string()).optional(),suffix:ur.nullable(ur.string()).optional(),integrations:ur.nullable(ur.array(Xse.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:ur.nullable(ur.number().int()).optional(),repositories:ur.array(Zse.GithubRepositoryOut$inboundSchema).optional(),metadata:ur.nullable(EBt.JobMetadataOut$inboundSchema).optional(),events:ur.array(PBt.EventOut$inboundSchema).optional(),checkpoints:ur.array(OBt.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,CBt.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"}));gt.DetailedJobOut$outboundSchema=ur.object({id:ur.string(),autoStart:ur.boolean(),hyperparameters:TBt.TrainingParameters$outboundSchema,model:ur.string(),status:gt.DetailedJobOutStatus$outboundSchema,jobType:ur.string(),createdAt:ur.number().int(),modifiedAt:ur.number().int(),trainingFiles:ur.array(ur.string()),validationFiles:ur.nullable(ur.array(ur.string())).optional(),object:ur.literal("job").default("job"),fineTunedModel:ur.nullable(ur.string()).optional(),suffix:ur.nullable(ur.string()).optional(),integrations:ur.nullable(ur.array(Xse.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:ur.nullable(ur.number().int()).optional(),repositories:ur.array(Zse.GithubRepositoryOut$outboundSchema).optional(),metadata:ur.nullable(EBt.JobMetadataOut$outboundSchema).optional(),events:ur.array(PBt.EventOut$outboundSchema).optional(),checkpoints:ur.array(OBt.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,CBt.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 xBt;(function(t){t.inboundSchema=gt.DetailedJobOut$inboundSchema,t.outboundSchema=gt.DetailedJobOut$outboundSchema})(xBt||(gt.DetailedJobOut$=xBt={}));function mun(t){return JSON.stringify(gt.DetailedJobOut$outboundSchema.parse(t))}function hun(t){return(0,sDe.safeParse)(t,e=>gt.DetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOut' from JSON")}});var NBt=v($o=>{"use strict";var gun=$o&&$o.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yun=$o&&$o.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bun=$o&&$o.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gun(e,t,r);return yun(e,t),e};Object.defineProperty($o,"__esModule",{value:!0});$o.EmbeddingRequest$=$o.EmbeddingRequest$outboundSchema=$o.EmbeddingRequest$inboundSchema=$o.Inputs$=$o.Inputs$outboundSchema=$o.Inputs$inboundSchema=void 0;$o.inputsToJSON=_un;$o.inputsFromJSON=vun;$o.embeddingRequestToJSON=wun;$o.embeddingRequestFromJSON=Sun;var Ra=bun(Te()),RBt=Ue(),jBt=ve();$o.Inputs$inboundSchema=Ra.union([Ra.string(),Ra.array(Ra.string())]);$o.Inputs$outboundSchema=Ra.union([Ra.string(),Ra.array(Ra.string())]);var IBt;(function(t){t.inboundSchema=$o.Inputs$inboundSchema,t.outboundSchema=$o.Inputs$outboundSchema})(IBt||($o.Inputs$=IBt={}));function _un(t){return JSON.stringify($o.Inputs$outboundSchema.parse(t))}function vun(t){return(0,jBt.safeParse)(t,e=>$o.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}$o.EmbeddingRequest$inboundSchema=Ra.object({input:Ra.union([Ra.string(),Ra.array(Ra.string())]),model:Ra.string().default("mistral-embed"),encoding_format:Ra.nullable(Ra.string()).optional()}).transform(t=>(0,RBt.remap)(t,{input:"inputs",encoding_format:"encodingFormat"}));$o.EmbeddingRequest$outboundSchema=Ra.object({inputs:Ra.union([Ra.string(),Ra.array(Ra.string())]),model:Ra.string().default("mistral-embed"),encodingFormat:Ra.nullable(Ra.string()).optional()}).transform(t=>(0,RBt.remap)(t,{inputs:"input",encodingFormat:"encoding_format"}));var MBt;(function(t){t.inboundSchema=$o.EmbeddingRequest$inboundSchema,t.outboundSchema=$o.EmbeddingRequest$outboundSchema})(MBt||($o.EmbeddingRequest$=MBt={}));function wun(t){return JSON.stringify($o.EmbeddingRequest$outboundSchema.parse(t))}function Sun(t){return(0,jBt.safeParse)(t,e=>$o.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var uDe=v(ju=>{"use strict";var xun=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]}),Cun=ju&&ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Oun=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)&&xun(e,t,r);return Cun(e,t),e};Object.defineProperty(ju,"__esModule",{value:!0});ju.EmbeddingResponseData$=ju.EmbeddingResponseData$outboundSchema=ju.EmbeddingResponseData$inboundSchema=void 0;ju.embeddingResponseDataToJSON=Eun;ju.embeddingResponseDataFromJSON=Tun;var zx=Oun(Te()),Pun=ve();ju.EmbeddingResponseData$inboundSchema=zx.object({object:zx.string().optional(),embedding:zx.array(zx.number()).optional(),index:zx.number().int().optional()});ju.EmbeddingResponseData$outboundSchema=zx.object({object:zx.string().optional(),embedding:zx.array(zx.number()).optional(),index:zx.number().int().optional()});var DBt;(function(t){t.inboundSchema=ju.EmbeddingResponseData$inboundSchema,t.outboundSchema=ju.EmbeddingResponseData$outboundSchema})(DBt||(ju.EmbeddingResponseData$=DBt={}));function Eun(t){return JSON.stringify(ju.EmbeddingResponseData$outboundSchema.parse(t))}function Tun(t){return(0,Pun.safeParse)(t,e=>ju.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var $Bt=v(Nu=>{"use strict";var Aun=Nu&&Nu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Iun=Nu&&Nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mun=Nu&&Nu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Aun(e,t,r);return Iun(e,t),e};Object.defineProperty(Nu,"__esModule",{value:!0});Nu.EmbeddingResponse$=Nu.EmbeddingResponse$outboundSchema=Nu.EmbeddingResponse$inboundSchema=void 0;Nu.embeddingResponseToJSON=jun;Nu.embeddingResponseFromJSON=Nun;var Hx=Mun(Te()),Run=ve(),FBt=uDe(),kBt=LU();Nu.EmbeddingResponse$inboundSchema=Hx.object({id:Hx.string(),object:Hx.string(),model:Hx.string(),usage:kBt.UsageInfo$inboundSchema,data:Hx.array(FBt.EmbeddingResponseData$inboundSchema)});Nu.EmbeddingResponse$outboundSchema=Hx.object({id:Hx.string(),object:Hx.string(),model:Hx.string(),usage:kBt.UsageInfo$outboundSchema,data:Hx.array(FBt.EmbeddingResponseData$outboundSchema)});var LBt;(function(t){t.inboundSchema=Nu.EmbeddingResponse$inboundSchema,t.outboundSchema=Nu.EmbeddingResponse$outboundSchema})(LBt||(Nu.EmbeddingResponse$=LBt={}));function jun(t){return JSON.stringify(Nu.EmbeddingResponse$outboundSchema.parse(t))}function Nun(t){return(0,Run.safeParse)(t,e=>Nu.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var G5=v(Du=>{"use strict";var Dun=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]}),Lun=Du&&Du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fun=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)&&Dun(e,t,r);return Lun(e,t),e};Object.defineProperty(Du,"__esModule",{value:!0});Du.FilePurpose$=Du.FilePurpose$outboundSchema=Du.FilePurpose$inboundSchema=Du.FilePurpose=void 0;var vD=Fun(Te()),kun=BI();Du.FilePurpose={FineTune:"fine-tune",Batch:"batch"};Du.FilePurpose$inboundSchema=vD.union([vD.nativeEnum(Du.FilePurpose),vD.string().transform(kun.catchUnrecognizedEnum)]);Du.FilePurpose$outboundSchema=vD.union([vD.nativeEnum(Du.FilePurpose),vD.string().and(vD.custom())]);var BBt;(function(t){t.inboundSchema=Du.FilePurpose$inboundSchema,t.outboundSchema=Du.FilePurpose$outboundSchema})(BBt||(Du.FilePurpose$=BBt={}))});var J5=v(Lu=>{"use strict";var $un=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]}),qun=Lu&&Lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uun=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)&&$un(e,t,r);return qun(e,t),e};Object.defineProperty(Lu,"__esModule",{value:!0});Lu.SampleType$=Lu.SampleType$outboundSchema=Lu.SampleType$inboundSchema=Lu.SampleType=void 0;var wD=Uun(Te()),zun=BI();Lu.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};Lu.SampleType$inboundSchema=wD.union([wD.nativeEnum(Lu.SampleType),wD.string().transform(zun.catchUnrecognizedEnum)]);Lu.SampleType$outboundSchema=wD.union([wD.nativeEnum(Lu.SampleType),wD.string().and(wD.custom())]);var qBt;(function(t){t.inboundSchema=Lu.SampleType$inboundSchema,t.outboundSchema=Lu.SampleType$outboundSchema})(qBt||(Lu.SampleType$=qBt={}))});var Y5=v(Fu=>{"use strict";var Hun=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]}),Vun=Fu&&Fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wun=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)&&Hun(e,t,r);return Vun(e,t),e};Object.defineProperty(Fu,"__esModule",{value:!0});Fu.Source$=Fu.Source$outboundSchema=Fu.Source$inboundSchema=Fu.Source=void 0;var SD=Wun(Te()),Kun=BI();Fu.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};Fu.Source$inboundSchema=SD.union([SD.nativeEnum(Fu.Source),SD.string().transform(Kun.catchUnrecognizedEnum)]);Fu.Source$outboundSchema=SD.union([SD.nativeEnum(Fu.Source),SD.string().and(SD.custom())]);var UBt;(function(t){t.inboundSchema=Fu.Source$inboundSchema,t.outboundSchema=Fu.Source$outboundSchema})(UBt||(Fu.Source$=UBt={}))});var lDe=v(ku=>{"use strict";var Gun=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]}),Jun=ku&&ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yun=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)&&Gun(e,t,r);return Jun(e,t),e};Object.defineProperty(ku,"__esModule",{value:!0});ku.FileSchema$=ku.FileSchema$outboundSchema=ku.FileSchema$inboundSchema=void 0;ku.fileSchemaToJSON=Xun;ku.fileSchemaFromJSON=Qun;var lf=Yun(Te()),HBt=Ue(),Zun=ve(),VBt=G5(),WBt=J5(),KBt=Y5();ku.FileSchema$inboundSchema=lf.object({id:lf.string(),object:lf.string(),bytes:lf.number().int(),created_at:lf.number().int(),filename:lf.string(),purpose:VBt.FilePurpose$inboundSchema,sample_type:WBt.SampleType$inboundSchema,num_lines:lf.nullable(lf.number().int()).optional(),source:KBt.Source$inboundSchema}).transform(t=>(0,HBt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));ku.FileSchema$outboundSchema=lf.object({id:lf.string(),object:lf.string(),sizeBytes:lf.number().int(),createdAt:lf.number().int(),filename:lf.string(),purpose:VBt.FilePurpose$outboundSchema,sampleType:WBt.SampleType$outboundSchema,numLines:lf.nullable(lf.number().int()).optional(),source:KBt.Source$outboundSchema}).transform(t=>(0,HBt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var zBt;(function(t){t.inboundSchema=ku.FileSchema$inboundSchema,t.outboundSchema=ku.FileSchema$outboundSchema})(zBt||(ku.FileSchema$=zBt={}));function Xun(t){return JSON.stringify(ku.FileSchema$outboundSchema.parse(t))}function Qun(t){return(0,Zun.safeParse)(t,e=>ku.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var JBt=v($u=>{"use strict";var eln=$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]}),tln=$u&&$u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rln=$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)&&eln(e,t,r);return tln(e,t),e};Object.defineProperty($u,"__esModule",{value:!0});$u.FileSignedURL$=$u.FileSignedURL$outboundSchema=$u.FileSignedURL$inboundSchema=void 0;$u.fileSignedURLToJSON=oln;$u.fileSignedURLFromJSON=iln;var Qse=rln(Te()),nln=ve();$u.FileSignedURL$inboundSchema=Qse.object({url:Qse.string()});$u.FileSignedURL$outboundSchema=Qse.object({url:Qse.string()});var GBt;(function(t){t.inboundSchema=$u.FileSignedURL$inboundSchema,t.outboundSchema=$u.FileSignedURL$outboundSchema})(GBt||($u.FileSignedURL$=GBt={}));function oln(t){return JSON.stringify($u.FileSignedURL$outboundSchema.parse(t))}function iln(t){return(0,nln.safeParse)(t,e=>$u.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var eqt=v(Bo=>{"use strict";var aln=Bo&&Bo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sln=Bo&&Bo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uln=Bo&&Bo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aln(e,t,r);return sln(e,t),e};Object.defineProperty(Bo,"__esModule",{value:!0});Bo.FIMCompletionRequest$=Bo.FIMCompletionRequest$outboundSchema=Bo.FIMCompletionRequest$inboundSchema=Bo.FIMCompletionRequestStop$=Bo.FIMCompletionRequestStop$outboundSchema=Bo.FIMCompletionRequestStop$inboundSchema=void 0;Bo.fimCompletionRequestStopToJSON=lln;Bo.fimCompletionRequestStopFromJSON=cln;Bo.fimCompletionRequestToJSON=dln;Bo.fimCompletionRequestFromJSON=fln;var yr=uln(Te()),XBt=Ue(),QBt=ve();Bo.FIMCompletionRequestStop$inboundSchema=yr.union([yr.string(),yr.array(yr.string())]);Bo.FIMCompletionRequestStop$outboundSchema=yr.union([yr.string(),yr.array(yr.string())]);var YBt;(function(t){t.inboundSchema=Bo.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=Bo.FIMCompletionRequestStop$outboundSchema})(YBt||(Bo.FIMCompletionRequestStop$=YBt={}));function lln(t){return JSON.stringify(Bo.FIMCompletionRequestStop$outboundSchema.parse(t))}function cln(t){return(0,QBt.safeParse)(t,e=>Bo.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}Bo.FIMCompletionRequest$inboundSchema=yr.object({model:yr.nullable(yr.string()),temperature:yr.nullable(yr.number()).optional(),top_p:yr.number().default(1),max_tokens:yr.nullable(yr.number().int()).optional(),stream:yr.boolean().default(!1),stop:yr.union([yr.string(),yr.array(yr.string())]).optional(),random_seed:yr.nullable(yr.number().int()).optional(),prompt:yr.string(),suffix:yr.nullable(yr.string()).optional(),min_tokens:yr.nullable(yr.number().int()).optional()}).transform(t=>(0,XBt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));Bo.FIMCompletionRequest$outboundSchema=yr.object({model:yr.nullable(yr.string()),temperature:yr.nullable(yr.number()).optional(),topP:yr.number().default(1),maxTokens:yr.nullable(yr.number().int()).optional(),stream:yr.boolean().default(!1),stop:yr.union([yr.string(),yr.array(yr.string())]).optional(),randomSeed:yr.nullable(yr.number().int()).optional(),prompt:yr.string(),suffix:yr.nullable(yr.string()).optional(),minTokens:yr.nullable(yr.number().int()).optional()}).transform(t=>(0,XBt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var ZBt;(function(t){t.inboundSchema=Bo.FIMCompletionRequest$inboundSchema,t.outboundSchema=Bo.FIMCompletionRequest$outboundSchema})(ZBt||(Bo.FIMCompletionRequest$=ZBt={}));function dln(t){return JSON.stringify(Bo.FIMCompletionRequest$outboundSchema.parse(t))}function fln(t){return(0,QBt.safeParse)(t,e=>Bo.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var oqt=v(Bu=>{"use strict";var pln=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]}),mln=Bu&&Bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hln=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)&&pln(e,t,r);return mln(e,t),e};Object.defineProperty(Bu,"__esModule",{value:!0});Bu.FIMCompletionResponse$=Bu.FIMCompletionResponse$outboundSchema=Bu.FIMCompletionResponse$inboundSchema=void 0;Bu.fimCompletionResponseToJSON=yln;Bu.fimCompletionResponseFromJSON=bln;var Hg=hln(Te()),gln=ve(),rqt=Mse(),nqt=LU();Bu.FIMCompletionResponse$inboundSchema=Hg.object({id:Hg.string(),object:Hg.string(),model:Hg.string(),usage:nqt.UsageInfo$inboundSchema,created:Hg.number().int().optional(),choices:Hg.array(rqt.ChatCompletionChoice$inboundSchema).optional()});Bu.FIMCompletionResponse$outboundSchema=Hg.object({id:Hg.string(),object:Hg.string(),model:Hg.string(),usage:nqt.UsageInfo$outboundSchema,created:Hg.number().int().optional(),choices:Hg.array(rqt.ChatCompletionChoice$outboundSchema).optional()});var tqt;(function(t){t.inboundSchema=Bu.FIMCompletionResponse$inboundSchema,t.outboundSchema=Bu.FIMCompletionResponse$outboundSchema})(tqt||(Bu.FIMCompletionResponse$=tqt={}));function yln(t){return JSON.stringify(Bu.FIMCompletionResponse$outboundSchema.parse(t))}function bln(t){return(0,gln.safeParse)(t,e=>Bu.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var lqt=v(qo=>{"use strict";var _ln=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]}),vln=qo&&qo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wln=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)&&_ln(e,t,r);return vln(e,t),e};Object.defineProperty(qo,"__esModule",{value:!0});qo.FIMCompletionStreamRequest$=qo.FIMCompletionStreamRequest$outboundSchema=qo.FIMCompletionStreamRequest$inboundSchema=qo.FIMCompletionStreamRequestStop$=qo.FIMCompletionStreamRequestStop$outboundSchema=qo.FIMCompletionStreamRequestStop$inboundSchema=void 0;qo.fimCompletionStreamRequestStopToJSON=Sln;qo.fimCompletionStreamRequestStopFromJSON=xln;qo.fimCompletionStreamRequestToJSON=Cln;qo.fimCompletionStreamRequestFromJSON=Oln;var br=wln(Te()),sqt=Ue(),uqt=ve();qo.FIMCompletionStreamRequestStop$inboundSchema=br.union([br.string(),br.array(br.string())]);qo.FIMCompletionStreamRequestStop$outboundSchema=br.union([br.string(),br.array(br.string())]);var iqt;(function(t){t.inboundSchema=qo.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=qo.FIMCompletionStreamRequestStop$outboundSchema})(iqt||(qo.FIMCompletionStreamRequestStop$=iqt={}));function Sln(t){return JSON.stringify(qo.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function xln(t){return(0,uqt.safeParse)(t,e=>qo.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}qo.FIMCompletionStreamRequest$inboundSchema=br.object({model:br.nullable(br.string()),temperature:br.nullable(br.number()).optional(),top_p:br.number().default(1),max_tokens:br.nullable(br.number().int()).optional(),stream:br.boolean().default(!0),stop:br.union([br.string(),br.array(br.string())]).optional(),random_seed:br.nullable(br.number().int()).optional(),prompt:br.string(),suffix:br.nullable(br.string()).optional(),min_tokens:br.nullable(br.number().int()).optional()}).transform(t=>(0,sqt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));qo.FIMCompletionStreamRequest$outboundSchema=br.object({model:br.nullable(br.string()),temperature:br.nullable(br.number()).optional(),topP:br.number().default(1),maxTokens:br.nullable(br.number().int()).optional(),stream:br.boolean().default(!0),stop:br.union([br.string(),br.array(br.string())]).optional(),randomSeed:br.nullable(br.number().int()).optional(),prompt:br.string(),suffix:br.nullable(br.string()).optional(),minTokens:br.nullable(br.number().int()).optional()}).transform(t=>(0,sqt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var aqt;(function(t){t.inboundSchema=qo.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=qo.FIMCompletionStreamRequest$outboundSchema})(aqt||(qo.FIMCompletionStreamRequest$=aqt={}));function Cln(t){return JSON.stringify(qo.FIMCompletionStreamRequest$outboundSchema.parse(t))}function Oln(t){return(0,uqt.safeParse)(t,e=>qo.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var cDe=v(qu=>{"use strict";var Pln=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]}),Eln=qu&&qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tln=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)&&Pln(e,t,r);return Eln(e,t),e};Object.defineProperty(qu,"__esModule",{value:!0});qu.FTModelCapabilitiesOut$=qu.FTModelCapabilitiesOut$outboundSchema=qu.FTModelCapabilitiesOut$inboundSchema=void 0;qu.ftModelCapabilitiesOutToJSON=Iln;qu.ftModelCapabilitiesOutFromJSON=Mln;var Vx=Tln(Te()),dqt=Ue(),Aln=ve();qu.FTModelCapabilitiesOut$inboundSchema=Vx.object({completion_chat:Vx.boolean().default(!0),completion_fim:Vx.boolean().default(!1),function_calling:Vx.boolean().default(!1),fine_tuning:Vx.boolean().default(!1)}).transform(t=>(0,dqt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));qu.FTModelCapabilitiesOut$outboundSchema=Vx.object({completionChat:Vx.boolean().default(!0),completionFim:Vx.boolean().default(!1),functionCalling:Vx.boolean().default(!1),fineTuning:Vx.boolean().default(!1)}).transform(t=>(0,dqt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var cqt;(function(t){t.inboundSchema=qu.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=qu.FTModelCapabilitiesOut$outboundSchema})(cqt||(qu.FTModelCapabilitiesOut$=cqt={}));function Iln(t){return JSON.stringify(qu.FTModelCapabilitiesOut$outboundSchema.parse(t))}function Mln(t){return(0,Aln.safeParse)(t,e=>qu.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var dDe=v(Uo=>{"use strict";var Rln=Uo&&Uo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jln=Uo&&Uo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nln=Uo&&Uo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rln(e,t,r);return jln(e,t),e};Object.defineProperty(Uo,"__esModule",{value:!0});Uo.FTModelCard$=Uo.FTModelCard$outboundSchema=Uo.FTModelCard$inboundSchema=Uo.FTModelCardType$=Uo.FTModelCardType$outboundSchema=Uo.FTModelCardType$inboundSchema=Uo.FTModelCardType=void 0;Uo.ftModelCardToJSON=Lln;Uo.ftModelCardFromJSON=Fln;var on=Nln(Te()),mqt=Ue(),Dln=ve(),hqt=Ase();Uo.FTModelCardType={FineTuned:"fine-tuned"};Uo.FTModelCardType$inboundSchema=on.nativeEnum(Uo.FTModelCardType);Uo.FTModelCardType$outboundSchema=Uo.FTModelCardType$inboundSchema;var fqt;(function(t){t.inboundSchema=Uo.FTModelCardType$inboundSchema,t.outboundSchema=Uo.FTModelCardType$outboundSchema})(fqt||(Uo.FTModelCardType$=fqt={}));Uo.FTModelCard$inboundSchema=on.object({id:on.string(),object:on.string().default("model"),created:on.number().int().optional(),owned_by:on.string().default("mistralai"),capabilities:hqt.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,mqt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Uo.FTModelCard$outboundSchema=on.object({id:on.string(),object:on.string().default("model"),created:on.number().int().optional(),ownedBy:on.string().default("mistralai"),capabilities:hqt.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,mqt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var pqt;(function(t){t.inboundSchema=Uo.FTModelCard$inboundSchema,t.outboundSchema=Uo.FTModelCard$outboundSchema})(pqt||(Uo.FTModelCard$=pqt={}));function Lln(t){return JSON.stringify(Uo.FTModelCard$outboundSchema.parse(t))}function Fln(t){return(0,Dln.safeParse)(t,e=>Uo.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var vqt=v(zo=>{"use strict";var kln=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]}),$ln=zo&&zo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bln=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)&&kln(e,t,r);return $ln(e,t),e};Object.defineProperty(zo,"__esModule",{value:!0});zo.FTModelOut$=zo.FTModelOut$outboundSchema=zo.FTModelOut$inboundSchema=zo.FTModelOutObject$=zo.FTModelOutObject$outboundSchema=zo.FTModelOutObject$inboundSchema=zo.FTModelOutObject=void 0;zo.ftModelOutToJSON=Uln;zo.ftModelOutFromJSON=zln;var ui=Bln(Te()),bqt=Ue(),qln=ve(),_qt=cDe();zo.FTModelOutObject={Model:"model"};zo.FTModelOutObject$inboundSchema=ui.nativeEnum(zo.FTModelOutObject);zo.FTModelOutObject$outboundSchema=zo.FTModelOutObject$inboundSchema;var gqt;(function(t){t.inboundSchema=zo.FTModelOutObject$inboundSchema,t.outboundSchema=zo.FTModelOutObject$outboundSchema})(gqt||(zo.FTModelOutObject$=gqt={}));zo.FTModelOut$inboundSchema=ui.object({id:ui.string(),object:ui.literal("model").default("model"),created:ui.number().int(),owned_by:ui.string(),root:ui.string(),archived:ui.boolean(),name:ui.nullable(ui.string()).optional(),description:ui.nullable(ui.string()).optional(),capabilities:_qt.FTModelCapabilitiesOut$inboundSchema,max_context_length:ui.number().int().default(32768),aliases:ui.array(ui.string()).optional(),job:ui.string()}).transform(t=>(0,bqt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength"}));zo.FTModelOut$outboundSchema=ui.object({id:ui.string(),object:ui.literal("model").default("model"),created:ui.number().int(),ownedBy:ui.string(),root:ui.string(),archived:ui.boolean(),name:ui.nullable(ui.string()).optional(),description:ui.nullable(ui.string()).optional(),capabilities:_qt.FTModelCapabilitiesOut$outboundSchema,maxContextLength:ui.number().int().default(32768),aliases:ui.array(ui.string()).optional(),job:ui.string()}).transform(t=>(0,bqt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length"}));var yqt;(function(t){t.inboundSchema=zo.FTModelOut$inboundSchema,t.outboundSchema=zo.FTModelOut$outboundSchema})(yqt||(zo.FTModelOut$=yqt={}));function Uln(t){return JSON.stringify(zo.FTModelOut$outboundSchema.parse(t))}function zln(t){return(0,qln.safeParse)(t,e=>zo.FTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelOut' from JSON")}});var fDe=v(Ho=>{"use strict";var Hln=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]}),Vln=Ho&&Ho.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wln=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)&&Hln(e,t,r);return Vln(e,t),e};Object.defineProperty(Ho,"__esModule",{value:!0});Ho.GithubRepositoryIn$=Ho.GithubRepositoryIn$outboundSchema=Ho.GithubRepositoryIn$inboundSchema=Ho.GithubRepositoryInType$=Ho.GithubRepositoryInType$outboundSchema=Ho.GithubRepositoryInType$inboundSchema=Ho.GithubRepositoryInType=void 0;Ho.githubRepositoryInToJSON=Gln;Ho.githubRepositoryInFromJSON=Jln;var od=Wln(Te()),Kln=ve();Ho.GithubRepositoryInType={Github:"github"};Ho.GithubRepositoryInType$inboundSchema=od.nativeEnum(Ho.GithubRepositoryInType);Ho.GithubRepositoryInType$outboundSchema=Ho.GithubRepositoryInType$inboundSchema;var wqt;(function(t){t.inboundSchema=Ho.GithubRepositoryInType$inboundSchema,t.outboundSchema=Ho.GithubRepositoryInType$outboundSchema})(wqt||(Ho.GithubRepositoryInType$=wqt={}));Ho.GithubRepositoryIn$inboundSchema=od.object({type:od.literal("github").default("github"),name:od.string(),owner:od.string(),ref:od.nullable(od.string()).optional(),weight:od.number().default(1),token:od.string()});Ho.GithubRepositoryIn$outboundSchema=od.object({type:od.literal("github").default("github"),name:od.string(),owner:od.string(),ref:od.nullable(od.string()).optional(),weight:od.number().default(1),token:od.string()});var Sqt;(function(t){t.inboundSchema=Ho.GithubRepositoryIn$inboundSchema,t.outboundSchema=Ho.GithubRepositoryIn$outboundSchema})(Sqt||(Ho.GithubRepositoryIn$=Sqt={}));function Gln(t){return JSON.stringify(Ho.GithubRepositoryIn$outboundSchema.parse(t))}function Jln(t){return(0,Kln.safeParse)(t,e=>Ho.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var pDe=v(Uu=>{"use strict";var Yln=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]}),Zln=Uu&&Uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xln=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)&&Yln(e,t,r);return Zln(e,t),e};Object.defineProperty(Uu,"__esModule",{value:!0});Uu.TrainingFile$=Uu.TrainingFile$outboundSchema=Uu.TrainingFile$inboundSchema=void 0;Uu.trainingFileToJSON=ecn;Uu.trainingFileFromJSON=tcn;var kU=Xln(Te()),Cqt=Ue(),Qln=ve();Uu.TrainingFile$inboundSchema=kU.object({file_id:kU.string(),weight:kU.number().default(1)}).transform(t=>(0,Cqt.remap)(t,{file_id:"fileId"}));Uu.TrainingFile$outboundSchema=kU.object({fileId:kU.string(),weight:kU.number().default(1)}).transform(t=>(0,Cqt.remap)(t,{fileId:"file_id"}));var xqt;(function(t){t.inboundSchema=Uu.TrainingFile$inboundSchema,t.outboundSchema=Uu.TrainingFile$outboundSchema})(xqt||(Uu.TrainingFile$=xqt={}));function ecn(t){return JSON.stringify(Uu.TrainingFile$outboundSchema.parse(t))}function tcn(t){return(0,Qln.safeParse)(t,e=>Uu.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var mDe=v(zu=>{"use strict";var rcn=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]}),ncn=zu&&zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ocn=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)&&rcn(e,t,r);return ncn(e,t),e};Object.defineProperty(zu,"__esModule",{value:!0});zu.TrainingParametersIn$=zu.TrainingParametersIn$outboundSchema=zu.TrainingParametersIn$inboundSchema=void 0;zu.trainingParametersInToJSON=acn;zu.trainingParametersInFromJSON=scn;var Ii=ocn(Te()),Pqt=Ue(),icn=ve();zu.TrainingParametersIn$inboundSchema=Ii.object({training_steps:Ii.nullable(Ii.number().int()).optional(),learning_rate:Ii.number().default(1e-4),weight_decay:Ii.nullable(Ii.number()).optional(),warmup_fraction:Ii.nullable(Ii.number()).optional(),epochs:Ii.nullable(Ii.number()).optional(),fim_ratio:Ii.nullable(Ii.number()).optional(),seq_len:Ii.nullable(Ii.number().int()).optional()}).transform(t=>(0,Pqt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));zu.TrainingParametersIn$outboundSchema=Ii.object({trainingSteps:Ii.nullable(Ii.number().int()).optional(),learningRate:Ii.number().default(1e-4),weightDecay:Ii.nullable(Ii.number()).optional(),warmupFraction:Ii.nullable(Ii.number()).optional(),epochs:Ii.nullable(Ii.number()).optional(),fimRatio:Ii.nullable(Ii.number()).optional(),seqLen:Ii.nullable(Ii.number().int()).optional()}).transform(t=>(0,Pqt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var Oqt;(function(t){t.inboundSchema=zu.TrainingParametersIn$inboundSchema,t.outboundSchema=zu.TrainingParametersIn$outboundSchema})(Oqt||(zu.TrainingParametersIn$=Oqt={}));function acn(t){return JSON.stringify(zu.TrainingParametersIn$outboundSchema.parse(t))}function scn(t){return(0,icn.safeParse)(t,e=>zu.TrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParametersIn' from JSON")}});var hDe=v(Vo=>{"use strict";var ucn=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]}),lcn=Vo&&Vo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ccn=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)&&ucn(e,t,r);return lcn(e,t),e};Object.defineProperty(Vo,"__esModule",{value:!0});Vo.WandbIntegration$=Vo.WandbIntegration$outboundSchema=Vo.WandbIntegration$inboundSchema=Vo.WandbIntegrationType$=Vo.WandbIntegrationType$outboundSchema=Vo.WandbIntegrationType$inboundSchema=Vo.WandbIntegrationType=void 0;Vo.wandbIntegrationToJSON=fcn;Vo.wandbIntegrationFromJSON=pcn;var id=ccn(Te()),Aqt=Ue(),dcn=ve();Vo.WandbIntegrationType={Wandb:"wandb"};Vo.WandbIntegrationType$inboundSchema=id.nativeEnum(Vo.WandbIntegrationType);Vo.WandbIntegrationType$outboundSchema=Vo.WandbIntegrationType$inboundSchema;var Eqt;(function(t){t.inboundSchema=Vo.WandbIntegrationType$inboundSchema,t.outboundSchema=Vo.WandbIntegrationType$outboundSchema})(Eqt||(Vo.WandbIntegrationType$=Eqt={}));Vo.WandbIntegration$inboundSchema=id.object({type:id.literal("wandb").default("wandb"),project:id.string(),name:id.nullable(id.string()).optional(),api_key:id.string(),run_name:id.nullable(id.string()).optional()}).transform(t=>(0,Aqt.remap)(t,{api_key:"apiKey",run_name:"runName"}));Vo.WandbIntegration$outboundSchema=id.object({type:id.literal("wandb").default("wandb"),project:id.string(),name:id.nullable(id.string()).optional(),apiKey:id.string(),runName:id.nullable(id.string()).optional()}).transform(t=>(0,Aqt.remap)(t,{apiKey:"api_key",runName:"run_name"}));var Tqt;(function(t){t.inboundSchema=Vo.WandbIntegration$inboundSchema,t.outboundSchema=Vo.WandbIntegration$outboundSchema})(Tqt||(Vo.WandbIntegration$=Tqt={}));function fcn(t){return JSON.stringify(Vo.WandbIntegration$outboundSchema.parse(t))}function pcn(t){return(0,dcn.safeParse)(t,e=>Vo.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var Lqt=v(Lr=>{"use strict";var mcn=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]}),hcn=Lr&&Lr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gcn=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)&&mcn(e,t,r);return hcn(e,t),e};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.JobIn$=Lr.JobIn$outboundSchema=Lr.JobIn$inboundSchema=Lr.JobInRepositories$=Lr.JobInRepositories$outboundSchema=Lr.JobInRepositories$inboundSchema=Lr.JobInIntegrations$=Lr.JobInIntegrations$outboundSchema=Lr.JobInIntegrations$inboundSchema=void 0;Lr.jobInIntegrationsToJSON=ycn;Lr.jobInIntegrationsFromJSON=bcn;Lr.jobInRepositoriesToJSON=_cn;Lr.jobInRepositoriesFromJSON=vcn;Lr.jobInToJSON=wcn;Lr.jobInFromJSON=Scn;var ja=gcn(Te()),jqt=Ue(),gDe=ve(),eue=fDe(),Nqt=pDe(),Dqt=mDe(),tue=hDe();Lr.JobInIntegrations$inboundSchema=tue.WandbIntegration$inboundSchema;Lr.JobInIntegrations$outboundSchema=tue.WandbIntegration$outboundSchema;var Iqt;(function(t){t.inboundSchema=Lr.JobInIntegrations$inboundSchema,t.outboundSchema=Lr.JobInIntegrations$outboundSchema})(Iqt||(Lr.JobInIntegrations$=Iqt={}));function ycn(t){return JSON.stringify(Lr.JobInIntegrations$outboundSchema.parse(t))}function bcn(t){return(0,gDe.safeParse)(t,e=>Lr.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}Lr.JobInRepositories$inboundSchema=eue.GithubRepositoryIn$inboundSchema;Lr.JobInRepositories$outboundSchema=eue.GithubRepositoryIn$outboundSchema;var Mqt;(function(t){t.inboundSchema=Lr.JobInRepositories$inboundSchema,t.outboundSchema=Lr.JobInRepositories$outboundSchema})(Mqt||(Lr.JobInRepositories$=Mqt={}));function _cn(t){return JSON.stringify(Lr.JobInRepositories$outboundSchema.parse(t))}function vcn(t){return(0,gDe.safeParse)(t,e=>Lr.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}Lr.JobIn$inboundSchema=ja.object({model:ja.string(),training_files:ja.array(Nqt.TrainingFile$inboundSchema).optional(),validation_files:ja.nullable(ja.array(ja.string())).optional(),hyperparameters:Dqt.TrainingParametersIn$inboundSchema,suffix:ja.nullable(ja.string()).optional(),integrations:ja.nullable(ja.array(tue.WandbIntegration$inboundSchema)).optional(),repositories:ja.array(eue.GithubRepositoryIn$inboundSchema).optional(),auto_start:ja.boolean().optional()}).transform(t=>(0,jqt.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart"}));Lr.JobIn$outboundSchema=ja.object({model:ja.string(),trainingFiles:ja.array(Nqt.TrainingFile$outboundSchema).optional(),validationFiles:ja.nullable(ja.array(ja.string())).optional(),hyperparameters:Dqt.TrainingParametersIn$outboundSchema,suffix:ja.nullable(ja.string()).optional(),integrations:ja.nullable(ja.array(tue.WandbIntegration$outboundSchema)).optional(),repositories:ja.array(eue.GithubRepositoryIn$outboundSchema).optional(),autoStart:ja.boolean().optional()}).transform(t=>(0,jqt.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start"}));var Rqt;(function(t){t.inboundSchema=Lr.JobIn$inboundSchema,t.outboundSchema=Lr.JobIn$outboundSchema})(Rqt||(Lr.JobIn$=Rqt={}));function wcn(t){return JSON.stringify(Lr.JobIn$outboundSchema.parse(t))}function Scn(t){return(0,gDe.safeParse)(t,e=>Lr.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var bDe=v(yt=>{"use strict";var xcn=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]}),Ccn=yt&&yt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ocn=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)&&xcn(e,t,r);return Ccn(e,t),e};Object.defineProperty(yt,"__esModule",{value:!0});yt.JobOut$=yt.JobOut$outboundSchema=yt.JobOut$inboundSchema=yt.Repositories$=yt.Repositories$outboundSchema=yt.Repositories$inboundSchema=yt.Integrations$=yt.Integrations$outboundSchema=yt.Integrations$inboundSchema=yt.ObjectT$=yt.ObjectT$outboundSchema=yt.ObjectT$inboundSchema=yt.Status$=yt.Status$outboundSchema=yt.Status$inboundSchema=yt.ObjectT=yt.Status=void 0;yt.integrationsToJSON=Pcn;yt.integrationsFromJSON=Ecn;yt.repositoriesToJSON=Tcn;yt.repositoriesFromJSON=Acn;yt.jobOutToJSON=Icn;yt.jobOutFromJSON=Mcn;var _r=Ocn(Te()),Uqt=Ue(),yDe=ve(),rue=Kse(),zqt=Gse(),Hqt=Jse(),nue=Yse();yt.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};yt.ObjectT={Job:"job"};yt.Status$inboundSchema=_r.nativeEnum(yt.Status);yt.Status$outboundSchema=yt.Status$inboundSchema;var Fqt;(function(t){t.inboundSchema=yt.Status$inboundSchema,t.outboundSchema=yt.Status$outboundSchema})(Fqt||(yt.Status$=Fqt={}));yt.ObjectT$inboundSchema=_r.nativeEnum(yt.ObjectT);yt.ObjectT$outboundSchema=yt.ObjectT$inboundSchema;var kqt;(function(t){t.inboundSchema=yt.ObjectT$inboundSchema,t.outboundSchema=yt.ObjectT$outboundSchema})(kqt||(yt.ObjectT$=kqt={}));yt.Integrations$inboundSchema=nue.WandbIntegrationOut$inboundSchema;yt.Integrations$outboundSchema=nue.WandbIntegrationOut$outboundSchema;var $qt;(function(t){t.inboundSchema=yt.Integrations$inboundSchema,t.outboundSchema=yt.Integrations$outboundSchema})($qt||(yt.Integrations$=$qt={}));function Pcn(t){return JSON.stringify(yt.Integrations$outboundSchema.parse(t))}function Ecn(t){return(0,yDe.safeParse)(t,e=>yt.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}yt.Repositories$inboundSchema=rue.GithubRepositoryOut$inboundSchema;yt.Repositories$outboundSchema=rue.GithubRepositoryOut$outboundSchema;var Bqt;(function(t){t.inboundSchema=yt.Repositories$inboundSchema,t.outboundSchema=yt.Repositories$outboundSchema})(Bqt||(yt.Repositories$=Bqt={}));function Tcn(t){return JSON.stringify(yt.Repositories$outboundSchema.parse(t))}function Acn(t){return(0,yDe.safeParse)(t,e=>yt.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}yt.JobOut$inboundSchema=_r.object({id:_r.string(),auto_start:_r.boolean(),hyperparameters:Hqt.TrainingParameters$inboundSchema,model:_r.string(),status:yt.Status$inboundSchema,job_type:_r.string(),created_at:_r.number().int(),modified_at:_r.number().int(),training_files:_r.array(_r.string()),validation_files:_r.nullable(_r.array(_r.string())).optional(),object:_r.literal("job").default("job"),fine_tuned_model:_r.nullable(_r.string()).optional(),suffix:_r.nullable(_r.string()).optional(),integrations:_r.nullable(_r.array(nue.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:_r.nullable(_r.number().int()).optional(),repositories:_r.array(rue.GithubRepositoryOut$inboundSchema).optional(),metadata:_r.nullable(zqt.JobMetadataOut$inboundSchema).optional()}).transform(t=>(0,Uqt.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"}));yt.JobOut$outboundSchema=_r.object({id:_r.string(),autoStart:_r.boolean(),hyperparameters:Hqt.TrainingParameters$outboundSchema,model:_r.string(),status:yt.Status$outboundSchema,jobType:_r.string(),createdAt:_r.number().int(),modifiedAt:_r.number().int(),trainingFiles:_r.array(_r.string()),validationFiles:_r.nullable(_r.array(_r.string())).optional(),object:_r.literal("job").default("job"),fineTunedModel:_r.nullable(_r.string()).optional(),suffix:_r.nullable(_r.string()).optional(),integrations:_r.nullable(_r.array(nue.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:_r.nullable(_r.number().int()).optional(),repositories:_r.array(rue.GithubRepositoryOut$outboundSchema).optional(),metadata:_r.nullable(zqt.JobMetadataOut$outboundSchema).optional()}).transform(t=>(0,Uqt.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 qqt;(function(t){t.inboundSchema=yt.JobOut$inboundSchema,t.outboundSchema=yt.JobOut$outboundSchema})(qqt||(yt.JobOut$=qqt={}));function Icn(t){return JSON.stringify(yt.JobOut$outboundSchema.parse(t))}function Mcn(t){return(0,yDe.safeParse)(t,e=>yt.JobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobOut' from JSON")}});var Gqt=v(Wo=>{"use strict";var Rcn=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]}),jcn=Wo&&Wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ncn=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)&&Rcn(e,t,r);return jcn(e,t),e};Object.defineProperty(Wo,"__esModule",{value:!0});Wo.JobsOut$=Wo.JobsOut$outboundSchema=Wo.JobsOut$inboundSchema=Wo.JobsOutObject$=Wo.JobsOutObject$outboundSchema=Wo.JobsOutObject$inboundSchema=Wo.JobsOutObject=void 0;Wo.jobsOutToJSON=Lcn;Wo.jobsOutFromJSON=Fcn;var wP=Ncn(Te()),Dcn=ve(),Kqt=bDe();Wo.JobsOutObject={List:"list"};Wo.JobsOutObject$inboundSchema=wP.nativeEnum(Wo.JobsOutObject);Wo.JobsOutObject$outboundSchema=Wo.JobsOutObject$inboundSchema;var Vqt;(function(t){t.inboundSchema=Wo.JobsOutObject$inboundSchema,t.outboundSchema=Wo.JobsOutObject$outboundSchema})(Vqt||(Wo.JobsOutObject$=Vqt={}));Wo.JobsOut$inboundSchema=wP.object({data:wP.array(Kqt.JobOut$inboundSchema).optional(),object:wP.literal("list").default("list"),total:wP.number().int()});Wo.JobsOut$outboundSchema=wP.object({data:wP.array(Kqt.JobOut$outboundSchema).optional(),object:wP.literal("list").default("list"),total:wP.number().int()});var Wqt;(function(t){t.inboundSchema=Wo.JobsOut$inboundSchema,t.outboundSchema=Wo.JobsOut$outboundSchema})(Wqt||(Wo.JobsOut$=Wqt={}));function Lcn(t){return JSON.stringify(Wo.JobsOut$outboundSchema.parse(t))}function Fcn(t){return(0,Dcn.safeParse)(t,e=>Wo.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var Xqt=v(Ko=>{"use strict";var kcn=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]}),$cn=Ko&&Ko.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bcn=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)&&kcn(e,t,r);return $cn(e,t),e};Object.defineProperty(Ko,"__esModule",{value:!0});Ko.LegacyJobMetadataOut$=Ko.LegacyJobMetadataOut$outboundSchema=Ko.LegacyJobMetadataOut$inboundSchema=Ko.LegacyJobMetadataOutObject$=Ko.LegacyJobMetadataOutObject$outboundSchema=Ko.LegacyJobMetadataOutObject$inboundSchema=Ko.LegacyJobMetadataOutObject=void 0;Ko.legacyJobMetadataOutToJSON=Ucn;Ko.legacyJobMetadataOutFromJSON=zcn;var Nr=Bcn(Te()),Zqt=Ue(),qcn=ve();Ko.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};Ko.LegacyJobMetadataOutObject$inboundSchema=Nr.nativeEnum(Ko.LegacyJobMetadataOutObject);Ko.LegacyJobMetadataOutObject$outboundSchema=Ko.LegacyJobMetadataOutObject$inboundSchema;var Jqt;(function(t){t.inboundSchema=Ko.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=Ko.LegacyJobMetadataOutObject$outboundSchema})(Jqt||(Ko.LegacyJobMetadataOutObject$=Jqt={}));Ko.LegacyJobMetadataOut$inboundSchema=Nr.object({expected_duration_seconds:Nr.nullable(Nr.number().int()).optional(),cost:Nr.nullable(Nr.number()).optional(),cost_currency:Nr.nullable(Nr.string()).optional(),train_tokens_per_step:Nr.nullable(Nr.number().int()).optional(),train_tokens:Nr.nullable(Nr.number().int()).optional(),data_tokens:Nr.nullable(Nr.number().int()).optional(),estimated_start_time:Nr.nullable(Nr.number().int()).optional(),deprecated:Nr.boolean().default(!0),details:Nr.string(),epochs:Nr.nullable(Nr.number()).optional(),training_steps:Nr.nullable(Nr.number().int()).optional(),object:Nr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,Zqt.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"}));Ko.LegacyJobMetadataOut$outboundSchema=Nr.object({expectedDurationSeconds:Nr.nullable(Nr.number().int()).optional(),cost:Nr.nullable(Nr.number()).optional(),costCurrency:Nr.nullable(Nr.string()).optional(),trainTokensPerStep:Nr.nullable(Nr.number().int()).optional(),trainTokens:Nr.nullable(Nr.number().int()).optional(),dataTokens:Nr.nullable(Nr.number().int()).optional(),estimatedStartTime:Nr.nullable(Nr.number().int()).optional(),deprecated:Nr.boolean().default(!0),details:Nr.string(),epochs:Nr.nullable(Nr.number()).optional(),trainingSteps:Nr.nullable(Nr.number().int()).optional(),object:Nr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,Zqt.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 Yqt;(function(t){t.inboundSchema=Ko.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=Ko.LegacyJobMetadataOut$outboundSchema})(Yqt||(Ko.LegacyJobMetadataOut$=Yqt={}));function Ucn(t){return JSON.stringify(Ko.LegacyJobMetadataOut$outboundSchema.parse(t))}function zcn(t){return(0,qcn.safeParse)(t,e=>Ko.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var tUt=v(Hu=>{"use strict";var Hcn=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]}),Vcn=Hu&&Hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wcn=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)&&Hcn(e,t,r);return Vcn(e,t),e};Object.defineProperty(Hu,"__esModule",{value:!0});Hu.ListFilesOut$=Hu.ListFilesOut$outboundSchema=Hu.ListFilesOut$inboundSchema=void 0;Hu.listFilesOutToJSON=Gcn;Hu.listFilesOutFromJSON=Jcn;var WI=Wcn(Te()),Kcn=ve(),eUt=lDe();Hu.ListFilesOut$inboundSchema=WI.object({data:WI.array(eUt.FileSchema$inboundSchema),object:WI.string(),total:WI.number().int()});Hu.ListFilesOut$outboundSchema=WI.object({data:WI.array(eUt.FileSchema$outboundSchema),object:WI.string(),total:WI.number().int()});var Qqt;(function(t){t.inboundSchema=Hu.ListFilesOut$inboundSchema,t.outboundSchema=Hu.ListFilesOut$outboundSchema})(Qqt||(Hu.ListFilesOut$=Qqt={}));function Gcn(t){return JSON.stringify(Hu.ListFilesOut$outboundSchema.parse(t))}function Jcn(t){return(0,Kcn.safeParse)(t,e=>Hu.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var iUt=v(Go=>{"use strict";var Ycn=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]}),Zcn=Go&&Go.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xcn=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)&&Ycn(e,t,r);return Zcn(e,t),e};Object.defineProperty(Go,"__esModule",{value:!0});Go.ModelList$=Go.ModelList$outboundSchema=Go.ModelList$inboundSchema=Go.Data$=Go.Data$outboundSchema=Go.Data$inboundSchema=void 0;Go.dataToJSON=Qcn;Go.dataFromJSON=edn;Go.modelListToJSON=tdn;Go.modelListFromJSON=rdn;var Gi=Xcn(Te()),oUt=ve(),oue=YNe(),iue=dDe();Go.Data$inboundSchema=Gi.union([oue.BaseModelCard$inboundSchema.and(Gi.object({type:Gi.literal("base")}).transform(t=>({type:t.type}))),iue.FTModelCard$inboundSchema.and(Gi.object({type:Gi.literal("fine-tuned")}).transform(t=>({type:t.type})))]);Go.Data$outboundSchema=Gi.union([oue.BaseModelCard$outboundSchema.and(Gi.object({type:Gi.literal("base")}).transform(t=>({type:t.type}))),iue.FTModelCard$outboundSchema.and(Gi.object({type:Gi.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var rUt;(function(t){t.inboundSchema=Go.Data$inboundSchema,t.outboundSchema=Go.Data$outboundSchema})(rUt||(Go.Data$=rUt={}));function Qcn(t){return JSON.stringify(Go.Data$outboundSchema.parse(t))}function edn(t){return(0,oUt.safeParse)(t,e=>Go.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}Go.ModelList$inboundSchema=Gi.object({object:Gi.string().default("list"),data:Gi.array(Gi.union([oue.BaseModelCard$inboundSchema.and(Gi.object({type:Gi.literal("base")}).transform(t=>({type:t.type}))),iue.FTModelCard$inboundSchema.and(Gi.object({type:Gi.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});Go.ModelList$outboundSchema=Gi.object({object:Gi.string().default("list"),data:Gi.array(Gi.union([oue.BaseModelCard$outboundSchema.and(Gi.object({type:Gi.literal("base")}).transform(t=>({type:t.type}))),iue.FTModelCard$outboundSchema.and(Gi.object({type:Gi.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});var nUt;(function(t){t.inboundSchema=Go.ModelList$inboundSchema,t.outboundSchema=Go.ModelList$outboundSchema})(nUt||(Go.ModelList$=nUt={}));function tdn(t){return JSON.stringify(Go.ModelList$outboundSchema.parse(t))}function rdn(t){return(0,oUt.safeParse)(t,e=>Go.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var dUt=v(Vu=>{"use strict";var ndn=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]}),odn=Vu&&Vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),idn=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)&&ndn(e,t,r);return odn(e,t),e};Object.defineProperty(Vu,"__esModule",{value:!0});Vu.RetrieveFileOut$=Vu.RetrieveFileOut$outboundSchema=Vu.RetrieveFileOut$inboundSchema=void 0;Vu.retrieveFileOutToJSON=sdn;Vu.retrieveFileOutFromJSON=udn;var gc=idn(Te()),sUt=Ue(),adn=ve(),uUt=G5(),lUt=J5(),cUt=Y5();Vu.RetrieveFileOut$inboundSchema=gc.object({id:gc.string(),object:gc.string(),bytes:gc.number().int(),created_at:gc.number().int(),filename:gc.string(),purpose:uUt.FilePurpose$inboundSchema,sample_type:lUt.SampleType$inboundSchema,num_lines:gc.nullable(gc.number().int()).optional(),source:cUt.Source$inboundSchema,deleted:gc.boolean()}).transform(t=>(0,sUt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Vu.RetrieveFileOut$outboundSchema=gc.object({id:gc.string(),object:gc.string(),sizeBytes:gc.number().int(),createdAt:gc.number().int(),filename:gc.string(),purpose:uUt.FilePurpose$outboundSchema,sampleType:lUt.SampleType$outboundSchema,numLines:gc.nullable(gc.number().int()).optional(),source:cUt.Source$outboundSchema,deleted:gc.boolean()}).transform(t=>(0,sUt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var aUt;(function(t){t.inboundSchema=Vu.RetrieveFileOut$inboundSchema,t.outboundSchema=Vu.RetrieveFileOut$outboundSchema})(aUt||(Vu.RetrieveFileOut$=aUt={}));function sdn(t){return JSON.stringify(Vu.RetrieveFileOut$outboundSchema.parse(t))}function udn(t){return(0,adn.safeParse)(t,e=>Vu.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var mUt=v(Wu=>{"use strict";var ldn=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]}),cdn=Wu&&Wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ddn=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)&&ldn(e,t,r);return cdn(e,t),e};Object.defineProperty(Wu,"__esModule",{value:!0});Wu.Security$=Wu.Security$outboundSchema=Wu.Security$inboundSchema=void 0;Wu.securityToJSON=pdn;Wu.securityFromJSON=mdn;var aue=ddn(Te()),pUt=Ue(),fdn=ve();Wu.Security$inboundSchema=aue.object({ApiKey:aue.string().optional()}).transform(t=>(0,pUt.remap)(t,{ApiKey:"apiKey"}));Wu.Security$outboundSchema=aue.object({apiKey:aue.string().optional()}).transform(t=>(0,pUt.remap)(t,{apiKey:"ApiKey"}));var fUt;(function(t){t.inboundSchema=Wu.Security$inboundSchema,t.outboundSchema=Wu.Security$outboundSchema})(fUt||(Wu.Security$=fUt={}));function pdn(t){return JSON.stringify(Wu.Security$outboundSchema.parse(t))}function mdn(t){return(0,fdn.safeParse)(t,e=>Wu.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var yUt=v(Jo=>{"use strict";var hdn=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]}),gdn=Jo&&Jo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ydn=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)&&hdn(e,t,r);return gdn(e,t),e};Object.defineProperty(Jo,"__esModule",{value:!0});Jo.UnarchiveFTModelOut$=Jo.UnarchiveFTModelOut$outboundSchema=Jo.UnarchiveFTModelOut$inboundSchema=Jo.UnarchiveFTModelOutObject$=Jo.UnarchiveFTModelOutObject$outboundSchema=Jo.UnarchiveFTModelOutObject$inboundSchema=Jo.UnarchiveFTModelOutObject=void 0;Jo.unarchiveFTModelOutToJSON=_dn;Jo.unarchiveFTModelOutFromJSON=vdn;var SP=ydn(Te()),bdn=ve();Jo.UnarchiveFTModelOutObject={Model:"model"};Jo.UnarchiveFTModelOutObject$inboundSchema=SP.nativeEnum(Jo.UnarchiveFTModelOutObject);Jo.UnarchiveFTModelOutObject$outboundSchema=Jo.UnarchiveFTModelOutObject$inboundSchema;var hUt;(function(t){t.inboundSchema=Jo.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=Jo.UnarchiveFTModelOutObject$outboundSchema})(hUt||(Jo.UnarchiveFTModelOutObject$=hUt={}));Jo.UnarchiveFTModelOut$inboundSchema=SP.object({id:SP.string(),object:SP.literal("model").default("model"),archived:SP.boolean().default(!1)});Jo.UnarchiveFTModelOut$outboundSchema=SP.object({id:SP.string(),object:SP.literal("model").default("model"),archived:SP.boolean().default(!1)});var gUt;(function(t){t.inboundSchema=Jo.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=Jo.UnarchiveFTModelOut$outboundSchema})(gUt||(Jo.UnarchiveFTModelOut$=gUt={}));function _dn(t){return JSON.stringify(Jo.UnarchiveFTModelOut$outboundSchema.parse(t))}function vdn(t){return(0,bdn.safeParse)(t,e=>Jo.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var _Ut=v(Ku=>{"use strict";var wdn=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]}),Sdn=Ku&&Ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xdn=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)&&wdn(e,t,r);return Sdn(e,t),e};Object.defineProperty(Ku,"__esModule",{value:!0});Ku.UpdateFTModelIn$=Ku.UpdateFTModelIn$outboundSchema=Ku.UpdateFTModelIn$inboundSchema=void 0;Ku.updateFTModelInToJSON=Odn;Ku.updateFTModelInFromJSON=Pdn;var Wx=xdn(Te()),Cdn=ve();Ku.UpdateFTModelIn$inboundSchema=Wx.object({name:Wx.nullable(Wx.string()).optional(),description:Wx.nullable(Wx.string()).optional()});Ku.UpdateFTModelIn$outboundSchema=Wx.object({name:Wx.nullable(Wx.string()).optional(),description:Wx.nullable(Wx.string()).optional()});var bUt;(function(t){t.inboundSchema=Ku.UpdateFTModelIn$inboundSchema,t.outboundSchema=Ku.UpdateFTModelIn$outboundSchema})(bUt||(Ku.UpdateFTModelIn$=bUt={}));function Odn(t){return JSON.stringify(Ku.UpdateFTModelIn$outboundSchema.parse(t))}function Pdn(t){return(0,Cdn.safeParse)(t,e=>Ku.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var OUt=v(Gu=>{"use strict";var Edn=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]}),Tdn=Gu&&Gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Adn=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)&&Edn(e,t,r);return Tdn(e,t),e};Object.defineProperty(Gu,"__esModule",{value:!0});Gu.UploadFileOut$=Gu.UploadFileOut$outboundSchema=Gu.UploadFileOut$inboundSchema=void 0;Gu.uploadFileOutToJSON=Mdn;Gu.uploadFileOutFromJSON=Rdn;var cf=Adn(Te()),wUt=Ue(),Idn=ve(),SUt=G5(),xUt=J5(),CUt=Y5();Gu.UploadFileOut$inboundSchema=cf.object({id:cf.string(),object:cf.string(),bytes:cf.number().int(),created_at:cf.number().int(),filename:cf.string(),purpose:SUt.FilePurpose$inboundSchema,sample_type:xUt.SampleType$inboundSchema,num_lines:cf.nullable(cf.number().int()).optional(),source:CUt.Source$inboundSchema}).transform(t=>(0,wUt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Gu.UploadFileOut$outboundSchema=cf.object({id:cf.string(),object:cf.string(),sizeBytes:cf.number().int(),createdAt:cf.number().int(),filename:cf.string(),purpose:SUt.FilePurpose$outboundSchema,sampleType:xUt.SampleType$outboundSchema,numLines:cf.nullable(cf.number().int()).optional(),source:CUt.Source$outboundSchema}).transform(t=>(0,wUt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var vUt;(function(t){t.inboundSchema=Gu.UploadFileOut$inboundSchema,t.outboundSchema=Gu.UploadFileOut$outboundSchema})(vUt||(Gu.UploadFileOut$=vUt={}));function Mdn(t){return JSON.stringify(Gu.UploadFileOut$outboundSchema.parse(t))}function Rdn(t){return(0,Idn.safeParse)(t,e=>Gu.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var AUt=v(Yo=>{"use strict";var jdn=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]}),Ndn=Yo&&Yo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ddn=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)&&jdn(e,t,r);return Ndn(e,t),e};Object.defineProperty(Yo,"__esModule",{value:!0});Yo.ValidationError$=Yo.ValidationError$outboundSchema=Yo.ValidationError$inboundSchema=Yo.Loc$=Yo.Loc$outboundSchema=Yo.Loc$inboundSchema=void 0;Yo.locToJSON=Ldn;Yo.locFromJSON=Fdn;Yo.validationErrorToJSON=kdn;Yo.validationErrorFromJSON=$dn;var Ju=Ddn(Te()),TUt=ve();Yo.Loc$inboundSchema=Ju.union([Ju.string(),Ju.number().int()]);Yo.Loc$outboundSchema=Ju.union([Ju.string(),Ju.number().int()]);var PUt;(function(t){t.inboundSchema=Yo.Loc$inboundSchema,t.outboundSchema=Yo.Loc$outboundSchema})(PUt||(Yo.Loc$=PUt={}));function Ldn(t){return JSON.stringify(Yo.Loc$outboundSchema.parse(t))}function Fdn(t){return(0,TUt.safeParse)(t,e=>Yo.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}Yo.ValidationError$inboundSchema=Ju.object({loc:Ju.array(Ju.union([Ju.string(),Ju.number().int()])),msg:Ju.string(),type:Ju.string()});Yo.ValidationError$outboundSchema=Ju.object({loc:Ju.array(Ju.union([Ju.string(),Ju.number().int()])),msg:Ju.string(),type:Ju.string()});var EUt;(function(t){t.inboundSchema=Yo.ValidationError$inboundSchema,t.outboundSchema=Yo.ValidationError$outboundSchema})(EUt||(Yo.ValidationError$=EUt={}));function kdn(t){return JSON.stringify(Yo.ValidationError$outboundSchema.parse(t))}function $dn(t){return(0,TUt.safeParse)(t,e=>Yo.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var Fn=v(Ve=>{"use strict";var Bdn=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]}),Ze=Ve&&Ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Bdn(e,t,r)};Object.defineProperty(Ve,"__esModule",{value:!0});Ze(fkt(),Ve);Ze(wkt(),Ve);Ze(JNe(),Ve);Ze(Okt(),Ve);Ze(qI(),Ve);Ze(YNe(),Ve);Ze(ZNe(),Ve);Ze(Lkt(),Ve);Ze(QNe(),Ve);Ze(Wkt(),Ve);Ze(XNe(),Ve);Ze(Xkt(),Ve);Ze(Mse(),Ve);Ze(d$t(),Ve);Ze(y$t(),Ve);Ze(P$t(),Ve);Ze(tDe(),Ve);Ze(rDe(),Ve);Ze(k$t(),Ve);Ze(q$t(),Ve);Ze(iDe(),Ve);Ze(rBt(),Ve);Ze(oDe(),Ve);Ze(TU(),Ve);Ze(oBt(),Ve);Ze(aBt(),Ve);Ze(nDe(),Ve);Ze(ABt(),Ve);Ze(NBt(),Ve);Ze($Bt(),Ve);Ze(uDe(),Ve);Ze(aDe(),Ve);Ze(G5(),Ve);Ze(lDe(),Ve);Ze(JBt(),Ve);Ze(eqt(),Ve);Ze(oqt(),Ve);Ze(lqt(),Ve);Ze(cDe(),Ve);Ze(dDe(),Ve);Ze(vqt(),Ve);Ze(KNe(),Ve);Ze(zNe(),Ve);Ze(GNe(),Ve);Ze(fDe(),Ve);Ze(Kse(),Ve);Ze(BNe(),Ve);Ze(qNe(),Ve);Ze(Lqt(),Ve);Ze(Gse(),Ve);Ze(bDe(),Ve);Ze(Gqt(),Ve);Ze(VNe(),Ve);Ze(Xqt(),Ve);Ze(tUt(),Ve);Ze(eDe(),Ve);Ze(Ase(),Ve);Ze(iUt(),Ve);Ze(IU(),Ve);Ze(UNe(),Ve);Ze(MU(),Ve);Ze(WNe(),Ve);Ze(dUt(),Ve);Ze(J5(),Ve);Ze(mUt(),Ve);Ze(Y5(),Ve);Ze(gD(),Ve);Ze(sse(),Ve);Ze(RU(),Ve);Ze(use(),Ve);Ze(jU(),Ve);Ze(NU(),Ve);Ze(yD(),Ve);Ze(W5(),Ve);Ze(pDe(),Ve);Ze(Jse(),Ve);Ze(mDe(),Ve);Ze(yUt(),Ve);Ze(_Ut(),Ve);Ze(OUt(),Ve);Ze(LU(),Ve);Ze(bD(),Ve);Ze(AUt(),Ve);Ze(hDe(),Ve);Ze(Yse(),Ve)});var jUt=v(yc=>{"use strict";var qdn=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]}),Udn=yc&&yc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MUt=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)&&qdn(e,t,r);return Udn(e,t),e};Object.defineProperty(yc,"__esModule",{value:!0});yc.HTTPValidationError$=yc.HTTPValidationError$outboundSchema=yc.HTTPValidationError$inboundSchema=yc.HTTPValidationError=void 0;var Z5=MUt(Te()),RUt=MUt(Fn()),X5=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"}};yc.HTTPValidationError=X5;yc.HTTPValidationError$inboundSchema=Z5.object({detail:Z5.array(RUt.ValidationError$inboundSchema).optional()}).transform(t=>new X5(t));yc.HTTPValidationError$outboundSchema=Z5.instanceof(X5).transform(t=>t.data$).pipe(Z5.object({detail:Z5.array(RUt.ValidationError$outboundSchema).optional()}));var IUt;(function(t){t.inboundSchema=yc.HTTPValidationError$inboundSchema,t.outboundSchema=yc.HTTPValidationError$outboundSchema})(IUt||(yc.HTTPValidationError$=IUt={}))});var uh=v(Kx=>{"use strict";var zdn=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]}),sue=Kx&&Kx.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zdn(e,t,r)};Object.defineProperty(Kx,"__esModule",{value:!0});sue(dNe(),Kx);sue(jUt(),Kx);sue(jNe(),Kx);sue(kNe(),Kx)});var LUt=v(xP=>{"use strict";var Hdn=xP&&xP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Vdn=xP&&xP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_De=xP&&xP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Hdn(e,t,r);return Vdn(e,t),e};Object.defineProperty(xP,"__esModule",{value:!0});xP.agentsComplete=Zdn;var Wdn=ii(),Q5=_De(ai()),Kdn=Ue(),Gdn=ve(),NUt=si(),Jdn=To(),DUt=_De(Fn()),Ydn=_De(uh());async function Zdn(t,e,r){let n=(0,Gdn.safeParse)(e,y=>DUt.AgentsCompletionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Wdn.encodeJSON)("body",o,{explode:!0}),a=(0,Jdn.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,Kdn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,NUt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,NUt.resolveGlobalSecurity)(l),d={operationID:"agents_completion_v1_agents_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await Q5.match(Q5.json(200,DUt.ChatCompletionResponse$inboundSchema),Q5.jsonErr(422,Ydn.HTTPValidationError$inboundSchema),Q5.fail("4XX"),Q5.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var $Ut=v(CP=>{"use strict";var Xdn=CP&&CP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qdn=CP&&CP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uue=CP&&CP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xdn(e,t,r);return Qdn(e,t),e};Object.defineProperty(CP,"__esModule",{value:!0});CP.agentsStream=sfn;var efn=uue(Te()),tfn=ii(),rfn=z5(),eW=uue(ai()),nfn=Ue(),ofn=ve(),FUt=si(),ifn=To(),kUt=uue(Fn()),afn=uue(uh());async function sfn(t,e,r){let n=(0,ofn.safeParse)(e,y=>kUt.AgentsCompletionStreamRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,tfn.encodeJSON)("body",o,{explode:!0}),a=(0,ifn.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,nfn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,FUt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,FUt.resolveGlobalSecurity)(l),d={operationID:"stream_agents",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await eW.match(eW.sse(200,efn.instanceof(ReadableStream).transform(y=>new rfn.EventStream({stream:y,decoder(S){return kUt.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),eW.jsonErr(422,afn.HTTPValidationError$inboundSchema),eW.fail("4XX"),eW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var qUt=v(lue=>{"use strict";Object.defineProperty(lue,"__esModule",{value:!0});lue.Agents=void 0;var ufn=LUt(),lfn=$Ut(),cfn=ah(),BUt=Ig(),vDe=class extends cfn.ClientSDK{async complete(e,r){return(0,BUt.unwrapAsync)((0,ufn.agentsComplete)(this,e,r))}async stream(e,r){return(0,BUt.unwrapAsync)((0,lfn.agentsStream)(this,e,r))}};lue.Agents=vDe});var HUt=v(Yu=>{"use strict";var dfn=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]}),ffn=Yu&&Yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pfn=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)&&dfn(e,t,r);return ffn(e,t),e};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.DeleteModelV1ModelsModelIdDeleteRequest$=Yu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Yu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;Yu.deleteModelV1ModelsModelIdDeleteRequestToJSON=hfn;Yu.deleteModelV1ModelsModelIdDeleteRequestFromJSON=gfn;var cue=pfn(Te()),zUt=Ue(),mfn=ve();Yu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=cue.object({model_id:cue.string()}).transform(t=>(0,zUt.remap)(t,{model_id:"modelId"}));Yu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=cue.object({modelId:cue.string()}).transform(t=>(0,zUt.remap)(t,{modelId:"model_id"}));var UUt;(function(t){t.inboundSchema=Yu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=Yu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(UUt||(Yu.DeleteModelV1ModelsModelIdDeleteRequest$=UUt={}));function hfn(t){return JSON.stringify(Yu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function gfn(t){return(0,mfn.safeParse)(t,e=>Yu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var KUt=v(Zu=>{"use strict";var yfn=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]}),bfn=Zu&&Zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_fn=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)&&yfn(e,t,r);return bfn(e,t),e};Object.defineProperty(Zu,"__esModule",{value:!0});Zu.FilesApiRoutesDeleteFileRequest$=Zu.FilesApiRoutesDeleteFileRequest$outboundSchema=Zu.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;Zu.filesApiRoutesDeleteFileRequestToJSON=wfn;Zu.filesApiRoutesDeleteFileRequestFromJSON=Sfn;var due=_fn(Te()),WUt=Ue(),vfn=ve();Zu.FilesApiRoutesDeleteFileRequest$inboundSchema=due.object({file_id:due.string()}).transform(t=>(0,WUt.remap)(t,{file_id:"fileId"}));Zu.FilesApiRoutesDeleteFileRequest$outboundSchema=due.object({fileId:due.string()}).transform(t=>(0,WUt.remap)(t,{fileId:"file_id"}));var VUt;(function(t){t.inboundSchema=Zu.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=Zu.FilesApiRoutesDeleteFileRequest$outboundSchema})(VUt||(Zu.FilesApiRoutesDeleteFileRequest$=VUt={}));function wfn(t){return JSON.stringify(Zu.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function Sfn(t){return(0,vfn.safeParse)(t,e=>Zu.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var YUt=v(Xu=>{"use strict";var xfn=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]}),Cfn=Xu&&Xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ofn=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)&&xfn(e,t,r);return Cfn(e,t),e};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.FilesApiRoutesDownloadFileRequest$=Xu.FilesApiRoutesDownloadFileRequest$outboundSchema=Xu.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;Xu.filesApiRoutesDownloadFileRequestToJSON=Efn;Xu.filesApiRoutesDownloadFileRequestFromJSON=Tfn;var fue=Ofn(Te()),JUt=Ue(),Pfn=ve();Xu.FilesApiRoutesDownloadFileRequest$inboundSchema=fue.object({file_id:fue.string()}).transform(t=>(0,JUt.remap)(t,{file_id:"fileId"}));Xu.FilesApiRoutesDownloadFileRequest$outboundSchema=fue.object({fileId:fue.string()}).transform(t=>(0,JUt.remap)(t,{fileId:"file_id"}));var GUt;(function(t){t.inboundSchema=Xu.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=Xu.FilesApiRoutesDownloadFileRequest$outboundSchema})(GUt||(Xu.FilesApiRoutesDownloadFileRequest$=GUt={}));function Efn(t){return JSON.stringify(Xu.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function Tfn(t){return(0,Pfn.safeParse)(t,e=>Xu.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var QUt=v(Qu=>{"use strict";var Afn=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]}),Ifn=Qu&&Qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mfn=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)&&Afn(e,t,r);return Ifn(e,t),e};Object.defineProperty(Qu,"__esModule",{value:!0});Qu.FilesApiRoutesGetSignedUrlRequest$=Qu.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Qu.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;Qu.filesApiRoutesGetSignedUrlRequestToJSON=jfn;Qu.filesApiRoutesGetSignedUrlRequestFromJSON=Nfn;var $U=Mfn(Te()),XUt=Ue(),Rfn=ve();Qu.FilesApiRoutesGetSignedUrlRequest$inboundSchema=$U.object({file_id:$U.string(),expiry:$U.number().int().default(24)}).transform(t=>(0,XUt.remap)(t,{file_id:"fileId"}));Qu.FilesApiRoutesGetSignedUrlRequest$outboundSchema=$U.object({fileId:$U.string(),expiry:$U.number().int().default(24)}).transform(t=>(0,XUt.remap)(t,{fileId:"file_id"}));var ZUt;(function(t){t.inboundSchema=Qu.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=Qu.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(ZUt||(Qu.FilesApiRoutesGetSignedUrlRequest$=ZUt={}));function jfn(t){return JSON.stringify(Qu.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function Nfn(t){return(0,Rfn.safeParse)(t,e=>Qu.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var nzt=v(tl=>{"use strict";var Dfn=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]}),Lfn=tl&&tl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tzt=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)&&Dfn(e,t,r);return Lfn(e,t),e};Object.defineProperty(tl,"__esModule",{value:!0});tl.FilesApiRoutesListFilesRequest$=tl.FilesApiRoutesListFilesRequest$outboundSchema=tl.FilesApiRoutesListFilesRequest$inboundSchema=void 0;tl.filesApiRoutesListFilesRequestToJSON=kfn;tl.filesApiRoutesListFilesRequestFromJSON=$fn;var el=tzt(Te()),rzt=Ue(),Ffn=ve(),BU=tzt(Fn());tl.FilesApiRoutesListFilesRequest$inboundSchema=el.object({page:el.number().int().default(0),page_size:el.number().int().default(100),sample_type:el.nullable(el.array(BU.SampleType$inboundSchema)).optional(),source:el.nullable(el.array(BU.Source$inboundSchema)).optional(),search:el.nullable(el.string()).optional(),purpose:el.nullable(BU.FilePurpose$inboundSchema).optional()}).transform(t=>(0,rzt.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));tl.FilesApiRoutesListFilesRequest$outboundSchema=el.object({page:el.number().int().default(0),pageSize:el.number().int().default(100),sampleType:el.nullable(el.array(BU.SampleType$outboundSchema)).optional(),source:el.nullable(el.array(BU.Source$outboundSchema)).optional(),search:el.nullable(el.string()).optional(),purpose:el.nullable(BU.FilePurpose$outboundSchema).optional()}).transform(t=>(0,rzt.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var ezt;(function(t){t.inboundSchema=tl.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=tl.FilesApiRoutesListFilesRequest$outboundSchema})(ezt||(tl.FilesApiRoutesListFilesRequest$=ezt={}));function kfn(t){return JSON.stringify(tl.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function $fn(t){return(0,Ffn.safeParse)(t,e=>tl.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var azt=v(rl=>{"use strict";var Bfn=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]}),qfn=rl&&rl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ufn=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)&&Bfn(e,t,r);return qfn(e,t),e};Object.defineProperty(rl,"__esModule",{value:!0});rl.FilesApiRoutesRetrieveFileRequest$=rl.FilesApiRoutesRetrieveFileRequest$outboundSchema=rl.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;rl.filesApiRoutesRetrieveFileRequestToJSON=Hfn;rl.filesApiRoutesRetrieveFileRequestFromJSON=Vfn;var pue=Ufn(Te()),izt=Ue(),zfn=ve();rl.FilesApiRoutesRetrieveFileRequest$inboundSchema=pue.object({file_id:pue.string()}).transform(t=>(0,izt.remap)(t,{file_id:"fileId"}));rl.FilesApiRoutesRetrieveFileRequest$outboundSchema=pue.object({fileId:pue.string()}).transform(t=>(0,izt.remap)(t,{fileId:"file_id"}));var ozt;(function(t){t.inboundSchema=rl.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=rl.FilesApiRoutesRetrieveFileRequest$outboundSchema})(ozt||(rl.FilesApiRoutesRetrieveFileRequest$=ozt={}));function Hfn(t){return JSON.stringify(rl.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function Vfn(t){return(0,zfn.safeParse)(t,e=>rl.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var wDe=v(mb=>{"use strict";var Wfn=mb&&mb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kfn=mb&&mb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gfn=mb&&mb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Wfn(e,t,r);return Kfn(e,t),e};Object.defineProperty(mb,"__esModule",{value:!0});mb.blobLikeSchema=void 0;mb.isBlobLike=szt;var Jfn=Gfn(Te());mb.blobLikeSchema=Jfn.custom(szt,{message:"expected a Blob, File or Blob-like object",fatal:!0});function szt(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 pzt=v(fo=>{"use strict";var Yfn=fo&&fo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zfn=fo&&fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),czt=fo&&fo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Yfn(e,t,r);return Zfn(e,t),e};Object.defineProperty(fo,"__esModule",{value:!0});fo.FilesApiRoutesUploadFileMultiPartBodyParams$=fo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=fo.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=fo.FileT$=fo.FileT$outboundSchema=fo.FileT$inboundSchema=void 0;fo.fileToJSON=Qfn;fo.fileFromJSON=epn;fo.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=tpn;fo.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=rpn;var bc=czt(Te()),dzt=ve(),Xfn=wDe(),fzt=czt(Fn());fo.FileT$inboundSchema=bc.object({fileName:bc.string(),content:bc.union([bc.instanceof(ReadableStream),bc.instanceof(Blob),bc.instanceof(ArrayBuffer),bc.instanceof(Uint8Array)])});fo.FileT$outboundSchema=bc.object({fileName:bc.string(),content:bc.union([bc.instanceof(ReadableStream),bc.instanceof(Blob),bc.instanceof(ArrayBuffer),bc.instanceof(Uint8Array)])});var uzt;(function(t){t.inboundSchema=fo.FileT$inboundSchema,t.outboundSchema=fo.FileT$outboundSchema})(uzt||(fo.FileT$=uzt={}));function Qfn(t){return JSON.stringify(fo.FileT$outboundSchema.parse(t))}function epn(t){return(0,dzt.safeParse)(t,e=>fo.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}fo.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=bc.object({file:bc.lazy(()=>fo.FileT$inboundSchema),purpose:fzt.FilePurpose$inboundSchema.optional()});fo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=bc.object({file:bc.lazy(()=>fo.FileT$outboundSchema).or(Xfn.blobLikeSchema),purpose:fzt.FilePurpose$outboundSchema.optional()});var lzt;(function(t){t.inboundSchema=fo.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=fo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(lzt||(fo.FilesApiRoutesUploadFileMultiPartBodyParams$=lzt={}));function tpn(t){return JSON.stringify(fo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function rpn(t){return(0,dzt.safeParse)(t,e=>fo.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var gzt=v(nl=>{"use strict";var npn=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]}),opn=nl&&nl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ipn=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)&&npn(e,t,r);return opn(e,t),e};Object.defineProperty(nl,"__esModule",{value:!0});nl.JobsApiRoutesBatchCancelBatchJobRequest$=nl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=nl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;nl.jobsApiRoutesBatchCancelBatchJobRequestToJSON=spn;nl.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=upn;var mue=ipn(Te()),hzt=Ue(),apn=ve();nl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=mue.object({job_id:mue.string()}).transform(t=>(0,hzt.remap)(t,{job_id:"jobId"}));nl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=mue.object({jobId:mue.string()}).transform(t=>(0,hzt.remap)(t,{jobId:"job_id"}));var mzt;(function(t){t.inboundSchema=nl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=nl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(mzt||(nl.JobsApiRoutesBatchCancelBatchJobRequest$=mzt={}));function spn(t){return JSON.stringify(nl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function upn(t){return(0,apn.safeParse)(t,e=>nl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var _zt=v(ol=>{"use strict";var lpn=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]}),cpn=ol&&ol.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dpn=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)&&lpn(e,t,r);return cpn(e,t),e};Object.defineProperty(ol,"__esModule",{value:!0});ol.JobsApiRoutesBatchGetBatchJobRequest$=ol.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=ol.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;ol.jobsApiRoutesBatchGetBatchJobRequestToJSON=ppn;ol.jobsApiRoutesBatchGetBatchJobRequestFromJSON=mpn;var hue=dpn(Te()),bzt=Ue(),fpn=ve();ol.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=hue.object({job_id:hue.string()}).transform(t=>(0,bzt.remap)(t,{job_id:"jobId"}));ol.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=hue.object({jobId:hue.string()}).transform(t=>(0,bzt.remap)(t,{jobId:"job_id"}));var yzt;(function(t){t.inboundSchema=ol.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=ol.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(yzt||(ol.JobsApiRoutesBatchGetBatchJobRequest$=yzt={}));function ppn(t){return JSON.stringify(ol.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function mpn(t){return(0,fpn.safeParse)(t,e=>ol.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var Czt=v(il=>{"use strict";var hpn=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]}),gpn=il&&il.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wzt=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)&&hpn(e,t,r);return gpn(e,t),e};Object.defineProperty(il,"__esModule",{value:!0});il.JobsApiRoutesBatchGetBatchJobsRequest$=il.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=il.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;il.jobsApiRoutesBatchGetBatchJobsRequestToJSON=bpn;il.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=_pn;var Na=wzt(Te()),Szt=Ue(),ypn=ve(),xzt=wzt(Fn());il.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=Na.object({page:Na.number().int().default(0),page_size:Na.number().int().default(100),model:Na.nullable(Na.string()).optional(),metadata:Na.nullable(Na.record(Na.any())).optional(),created_after:Na.nullable(Na.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Na.boolean().default(!1),status:Na.nullable(xzt.BatchJobStatus$inboundSchema).optional()}).transform(t=>(0,Szt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe"}));il.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Na.object({page:Na.number().int().default(0),pageSize:Na.number().int().default(100),model:Na.nullable(Na.string()).optional(),metadata:Na.nullable(Na.record(Na.any())).optional(),createdAfter:Na.nullable(Na.date().transform(t=>t.toISOString())).optional(),createdByMe:Na.boolean().default(!1),status:Na.nullable(xzt.BatchJobStatus$outboundSchema).optional()}).transform(t=>(0,Szt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me"}));var vzt;(function(t){t.inboundSchema=il.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=il.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(vzt||(il.JobsApiRoutesBatchGetBatchJobsRequest$=vzt={}));function bpn(t){return JSON.stringify(il.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function _pn(t){return(0,ypn.safeParse)(t,e=>il.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var Ezt=v(al=>{"use strict";var vpn=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]}),wpn=al&&al.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Spn=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)&&vpn(e,t,r);return wpn(e,t),e};Object.defineProperty(al,"__esModule",{value:!0});al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;al.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=Cpn;al.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=Opn;var gue=Spn(Te()),Pzt=Ue(),xpn=ve();al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=gue.object({model_id:gue.string()}).transform(t=>(0,Pzt.remap)(t,{model_id:"modelId"}));al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=gue.object({modelId:gue.string()}).transform(t=>(0,Pzt.remap)(t,{modelId:"model_id"}));var Ozt;(function(t){t.inboundSchema=al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(Ozt||(al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=Ozt={}));function Cpn(t){return JSON.stringify(al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function Opn(t){return(0,xpn.safeParse)(t,e=>al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var Izt=v(sl=>{"use strict";var Ppn=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]}),Epn=sl&&sl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tpn=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)&&Ppn(e,t,r);return Epn(e,t),e};Object.defineProperty(sl,"__esModule",{value:!0});sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;sl.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=Ipn;sl.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=Mpn;var yue=Tpn(Te()),Azt=Ue(),Apn=ve();sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=yue.object({job_id:yue.string()}).transform(t=>(0,Azt.remap)(t,{job_id:"jobId"}));sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=yue.object({jobId:yue.string()}).transform(t=>(0,Azt.remap)(t,{jobId:"job_id"}));var Tzt;(function(t){t.inboundSchema=sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(Tzt||(sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=Tzt={}));function Ipn(t){return JSON.stringify(sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function Mpn(t){return(0,Apn.safeParse)(t,e=>sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}});var Nzt=v(ul=>{"use strict";var Rpn=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]}),jpn=ul&&ul.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rzt=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)&&Rpn(e,t,r);return jpn(e,t),e};Object.defineProperty(ul,"__esModule",{value:!0});ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=void 0;ul.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=Dpn;ul.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=Lpn;var jzt=Rzt(Te()),Npn=ve(),bue=Rzt(Fn());ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=jzt.union([bue.LegacyJobMetadataOut$inboundSchema,bue.JobOut$inboundSchema]);ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=jzt.union([bue.LegacyJobMetadataOut$outboundSchema,bue.JobOut$outboundSchema]);var Mzt;(function(t){t.inboundSchema=ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(Mzt||(ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Mzt={}));function Dpn(t){return JSON.stringify(ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function Lpn(t){return(0,Npn.safeParse)(t,e=>ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var Fzt=v(ll=>{"use strict";var Fpn=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]}),kpn=ll&&ll.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$pn=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)&&Fpn(e,t,r);return kpn(e,t),e};Object.defineProperty(ll,"__esModule",{value:!0});ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$=ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;ll.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=qpn;ll.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=Upn;var _ue=$pn(Te()),Lzt=Ue(),Bpn=ve();ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=_ue.object({job_id:_ue.string()}).transform(t=>(0,Lzt.remap)(t,{job_id:"jobId"}));ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=_ue.object({jobId:_ue.string()}).transform(t=>(0,Lzt.remap)(t,{jobId:"job_id"}));var Dzt;(function(t){t.inboundSchema=ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(Dzt||(ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$=Dzt={}));function qpn(t){return JSON.stringify(ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function Upn(t){return(0,Bpn.safeParse)(t,e=>ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}});var qzt=v(po=>{"use strict";var zpn=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]}),Hpn=po&&po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vpn=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)&&zpn(e,t,r);return Hpn(e,t),e};Object.defineProperty(po,"__esModule",{value:!0});po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=po.Status$=po.Status$outboundSchema=po.Status$inboundSchema=po.Status=void 0;po.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=Kpn;po.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=Gpn;var li=Vpn(Te()),Bzt=Ue(),Wpn=ve();po.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};po.Status$inboundSchema=li.nativeEnum(po.Status);po.Status$outboundSchema=po.Status$inboundSchema;var kzt;(function(t){t.inboundSchema=po.Status$inboundSchema,t.outboundSchema=po.Status$outboundSchema})(kzt||(po.Status$=kzt={}));po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=li.object({page:li.number().int().default(0),page_size:li.number().int().default(100),model:li.nullable(li.string()).optional(),created_after:li.nullable(li.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:li.boolean().default(!1),status:li.nullable(po.Status$inboundSchema).optional(),wandb_project:li.nullable(li.string()).optional(),wandb_name:li.nullable(li.string()).optional(),suffix:li.nullable(li.string()).optional()}).transform(t=>(0,Bzt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=li.object({page:li.number().int().default(0),pageSize:li.number().int().default(100),model:li.nullable(li.string()).optional(),createdAfter:li.nullable(li.date().transform(t=>t.toISOString())).optional(),createdByMe:li.boolean().default(!1),status:li.nullable(po.Status$outboundSchema).optional(),wandbProject:li.nullable(li.string()).optional(),wandbName:li.nullable(li.string()).optional(),suffix:li.nullable(li.string()).optional()}).transform(t=>(0,Bzt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var $zt;(function(t){t.inboundSchema=po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})($zt||(po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=$zt={}));function Kpn(t){return JSON.stringify(po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function Gpn(t){return(0,Wpn.safeParse)(t,e=>po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var Hzt=v(cl=>{"use strict";var Jpn=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]}),Ypn=cl&&cl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zpn=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)&&Jpn(e,t,r);return Ypn(e,t),e};Object.defineProperty(cl,"__esModule",{value:!0});cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$=cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;cl.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=Qpn;cl.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=emn;var vue=Zpn(Te()),zzt=Ue(),Xpn=ve();cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=vue.object({job_id:vue.string()}).transform(t=>(0,zzt.remap)(t,{job_id:"jobId"}));cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=vue.object({jobId:vue.string()}).transform(t=>(0,zzt.remap)(t,{jobId:"job_id"}));var Uzt;(function(t){t.inboundSchema=cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(Uzt||(cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Uzt={}));function Qpn(t){return JSON.stringify(cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function emn(t){return(0,Xpn.safeParse)(t,e=>cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}});var Kzt=v(dl=>{"use strict";var tmn=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]}),rmn=dl&&dl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nmn=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)&&tmn(e,t,r);return rmn(e,t),e};Object.defineProperty(dl,"__esModule",{value:!0});dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;dl.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=imn;dl.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=amn;var wue=nmn(Te()),Wzt=Ue(),omn=ve();dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=wue.object({model_id:wue.string()}).transform(t=>(0,Wzt.remap)(t,{model_id:"modelId"}));dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=wue.object({modelId:wue.string()}).transform(t=>(0,Wzt.remap)(t,{modelId:"model_id"}));var Vzt;(function(t){t.inboundSchema=dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(Vzt||(dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=Vzt={}));function imn(t){return JSON.stringify(dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function amn(t){return(0,omn.safeParse)(t,e=>dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var Xzt=v(fl=>{"use strict";var smn=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]}),umn=fl&&fl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jzt=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)&&smn(e,t,r);return umn(e,t),e};Object.defineProperty(fl,"__esModule",{value:!0});fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;fl.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=cmn;fl.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=dmn;var Sue=Jzt(Te()),Yzt=Ue(),lmn=ve(),Zzt=Jzt(Fn());fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=Sue.object({model_id:Sue.string(),UpdateFTModelIn:Zzt.UpdateFTModelIn$inboundSchema}).transform(t=>(0,Yzt.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Sue.object({modelId:Sue.string(),updateFTModelIn:Zzt.UpdateFTModelIn$outboundSchema}).transform(t=>(0,Yzt.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var Gzt;(function(t){t.inboundSchema=fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(Gzt||(fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=Gzt={}));function cmn(t){return JSON.stringify(fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function dmn(t){return(0,lmn.safeParse)(t,e=>fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}});var o2t=v(Zo=>{"use strict";var fmn=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]}),pmn=Zo&&Zo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t2t=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)&&fmn(e,t,r);return pmn(e,t),e};Object.defineProperty(Zo,"__esModule",{value:!0});Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=Zo.RetrieveModelV1ModelsModelIdGetRequest$=Zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=Zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;Zo.retrieveModelV1ModelsModelIdGetRequestToJSON=mmn;Zo.retrieveModelV1ModelsModelIdGetRequestFromJSON=hmn;Zo.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=gmn;Zo.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=ymn;var nm=t2t(Te()),r2t=Ue(),n2t=ve(),xue=t2t(Fn());Zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=nm.object({model_id:nm.string()}).transform(t=>(0,r2t.remap)(t,{model_id:"modelId"}));Zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=nm.object({modelId:nm.string()}).transform(t=>(0,r2t.remap)(t,{modelId:"model_id"}));var Qzt;(function(t){t.inboundSchema=Zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=Zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(Qzt||(Zo.RetrieveModelV1ModelsModelIdGetRequest$=Qzt={}));function mmn(t){return JSON.stringify(Zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function hmn(t){return(0,n2t.safeParse)(t,e=>Zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=nm.union([xue.BaseModelCard$inboundSchema.and(nm.object({type:nm.literal("base")}).transform(t=>({type:t.type}))),xue.FTModelCard$inboundSchema.and(nm.object({type:nm.literal("fine-tuned")}).transform(t=>({type:t.type})))]);Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=nm.union([xue.BaseModelCard$outboundSchema.and(nm.object({type:nm.literal("base")}).transform(t=>({type:t.type}))),xue.FTModelCard$outboundSchema.and(nm.object({type:nm.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var e2t;(function(t){t.inboundSchema=Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(e2t||(Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=e2t={}));function gmn(t){return JSON.stringify(Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function ymn(t){return(0,n2t.safeParse)(t,e=>Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var pl=v(ga=>{"use strict";var bmn=ga&&ga.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kl=ga&&ga.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bmn(e,t,r)};Object.defineProperty(ga,"__esModule",{value:!0});kl(HUt(),ga);kl(KUt(),ga);kl(YUt(),ga);kl(QUt(),ga);kl(nzt(),ga);kl(azt(),ga);kl(pzt(),ga);kl(gzt(),ga);kl(_zt(),ga);kl(Czt(),ga);kl(Ezt(),ga);kl(Izt(),ga);kl(Nzt(),ga);kl(Fzt(),ga);kl(qzt(),ga);kl(Hzt(),ga);kl(Kzt(),ga);kl(Xzt(),ga);kl(o2t(),ga)});var a2t=v(OP=>{"use strict";var _mn=OP&&OP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vmn=OP&&OP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SDe=OP&&OP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_mn(e,t,r);return vmn(e,t),e};Object.defineProperty(OP,"__esModule",{value:!0});OP.batchJobsCancel=Emn;var wmn=ii(),Cue=SDe(ai()),Smn=Ue(),xmn=ve(),i2t=si(),Cmn=To(),Omn=SDe(Fn()),Pmn=SDe(pl());async function Emn(t,e,r){let n=(0,xmn.safeParse)(e,y=>Pmn.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,wmn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Cmn.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,Smn.compactMap)({Accept:"application/json"})),l=await(0,i2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,i2t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_cancel_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Cue.match(Cue.json(200,Omn.BatchJobOut$inboundSchema),Cue.fail("4XX"),Cue.fail("5XX"))(b);return g.ok,g}});var c2t=v(PP=>{"use strict";var Tmn=PP&&PP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Amn=PP&&PP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l2t=PP&&PP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tmn(e,t,r);return Amn(e,t),e};Object.defineProperty(PP,"__esModule",{value:!0});PP.batchJobsCreate=Nmn;var Imn=ii(),Oue=l2t(ai()),Mmn=Ue(),Rmn=ve(),s2t=si(),jmn=To(),u2t=l2t(Fn());async function Nmn(t,e,r){let n=(0,Rmn.safeParse)(e,g=>u2t.BatchJobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Imn.encodeJSON)("body",o,{explode:!0}),a=(0,jmn.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,Mmn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,s2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,s2t.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_batch_create_batch_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[b]=await Oue.match(Oue.json(200,u2t.BatchJobOut$inboundSchema),Oue.fail("4XX"),Oue.fail("5XX"))(h);return b.ok,b}});var f2t=v(EP=>{"use strict";var Dmn=EP&&EP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=EP&&EP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xDe=EP&&EP.__importStar||function(t){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(EP,"__esModule",{value:!0});EP.batchJobsGet=zmn;var Fmn=ii(),Pue=xDe(ai()),kmn=Ue(),$mn=ve(),d2t=si(),Bmn=To(),qmn=xDe(Fn()),Umn=xDe(pl());async function zmn(t,e,r){let n=(0,$mn.safeParse)(e,y=>Umn.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,Fmn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Bmn.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,kmn.compactMap)({Accept:"application/json"})),l=await(0,d2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,d2t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Pue.match(Pue.json(200,qmn.BatchJobOut$inboundSchema),Pue.fail("4XX"),Pue.fail("5XX"))(b);return g.ok,g}});var m2t=v(TP=>{"use strict";var Hmn=TP&&TP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Vmn=TP&&TP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CDe=TP&&TP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Hmn(e,t,r);return Vmn(e,t),e};Object.defineProperty(TP,"__esModule",{value:!0});TP.batchJobsList=Xmn;var Wmn=ii(),Eue=CDe(ai()),Kmn=Ue(),Gmn=ve(),p2t=si(),Jmn=To(),Ymn=CDe(Fn()),Zmn=CDe(pl());async function Xmn(t,e,r){let n=(0,Gmn.safeParse)(e,y=>Zmn.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,Jmn.pathToFunc)("/v1/batch/jobs")(),s=(0,Wmn.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,Kmn.compactMap)({Accept:"application/json"})),l=await(0,p2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,p2t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Eue.match(Eue.json(200,Ymn.BatchJobsOut$inboundSchema),Eue.fail("4XX"),Eue.fail("5XX"))(b);return g.ok,g}});var h2t=v(Aue=>{"use strict";Object.defineProperty(Aue,"__esModule",{value:!0});Aue.MistralJobs=void 0;var Qmn=a2t(),ehn=c2t(),thn=f2t(),rhn=m2t(),nhn=ah(),Tue=Ig(),ODe=class extends nhn.ClientSDK{async list(e,r){return(0,Tue.unwrapAsync)((0,rhn.batchJobsList)(this,e,r))}async create(e,r){return(0,Tue.unwrapAsync)((0,ehn.batchJobsCreate)(this,e,r))}async get(e,r){return(0,Tue.unwrapAsync)((0,thn.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,Tue.unwrapAsync)((0,Qmn.batchJobsCancel)(this,e,r))}};Aue.MistralJobs=ODe});var g2t=v(Iue=>{"use strict";Object.defineProperty(Iue,"__esModule",{value:!0});Iue.Batch=void 0;var ohn=ah(),ihn=h2t(),PDe=class extends ohn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new ihn.MistralJobs(this._options))}};Iue.Batch=PDe});var _2t=v(AP=>{"use strict";var ahn=AP&&AP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),shn=AP&&AP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EDe=AP&&AP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ahn(e,t,r);return shn(e,t),e};Object.defineProperty(AP,"__esModule",{value:!0});AP.chatComplete=phn;var uhn=ii(),tW=EDe(ai()),lhn=Ue(),chn=ve(),y2t=si(),dhn=To(),b2t=EDe(Fn()),fhn=EDe(uh());async function phn(t,e,r){let n=(0,chn.safeParse)(e,y=>b2t.ChatCompletionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,uhn.encodeJSON)("body",o,{explode:!0}),a=(0,dhn.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,lhn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,y2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,y2t.resolveGlobalSecurity)(l),d={operationID:"chat_completion_v1_chat_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await tW.match(tW.json(200,b2t.ChatCompletionResponse$inboundSchema),tW.jsonErr(422,fhn.HTTPValidationError$inboundSchema),tW.fail("4XX"),tW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var S2t=v(IP=>{"use strict";var mhn=IP&&IP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hhn=IP&&IP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mue=IP&&IP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mhn(e,t,r);return hhn(e,t),e};Object.defineProperty(IP,"__esModule",{value:!0});IP.chatStream=xhn;var ghn=Mue(Te()),yhn=ii(),bhn=z5(),rW=Mue(ai()),_hn=Ue(),vhn=ve(),v2t=si(),whn=To(),w2t=Mue(Fn()),Shn=Mue(uh());async function xhn(t,e,r){let n=(0,vhn.safeParse)(e,y=>w2t.ChatCompletionStreamRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,yhn.encodeJSON)("body",o,{explode:!0}),a=(0,whn.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,_hn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,v2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,v2t.resolveGlobalSecurity)(l),d={operationID:"stream_chat",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await rW.match(rW.sse(200,ghn.instanceof(ReadableStream).transform(y=>new bhn.EventStream({stream:y,decoder(S){return w2t.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),rW.jsonErr(422,Shn.HTTPValidationError$inboundSchema),rW.fail("4XX"),rW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var Rue=v(Gx=>{"use strict";Object.defineProperty(Gx,"__esModule",{value:!0});Gx.getDefaultOptions=Gx.defaultOptions=Gx.ignoreOverride=void 0;Gx.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");Gx.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 Chn=t=>typeof t=="string"?{...Gx.defaultOptions,name:t}:{...Gx.defaultOptions,...t};Gx.getDefaultOptions=Chn});var TDe=v(jue=>{"use strict";Object.defineProperty(jue,"__esModule",{value:!0});jue.getRefs=void 0;var Ohn=Rue(),Phn=t=>{let e=(0,Ohn.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}]))}};jue.getRefs=Phn});var KI=v(qU=>{"use strict";Object.defineProperty(qU,"__esModule",{value:!0});qU.setResponseValueAndErrors=qU.addErrorMessage=void 0;function x2t(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}qU.addErrorMessage=x2t;function Ehn(t,e,r,n,o){t[e]=r,x2t(t,e,n,o)}qU.setResponseValueAndErrors=Ehn});var ADe=v(Nue=>{"use strict";Object.defineProperty(Nue,"__esModule",{value:!0});Nue.parseAnyDef=void 0;function Thn(){return{}}Nue.parseAnyDef=Thn});var IDe=v(Lue=>{"use strict";Object.defineProperty(Lue,"__esModule",{value:!0});Lue.parseArrayDef=void 0;var Ahn=Te(),Due=KI(),Ihn=ml();function Mhn(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==Ahn.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,Ihn.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,Due.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,Due.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,Due.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,Due.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}Lue.parseArrayDef=Mhn});var MDe=v(Fue=>{"use strict";Object.defineProperty(Fue,"__esModule",{value:!0});Fue.parseBigintDef=void 0;var xD=KI();function Rhn(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,xD.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,xD.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,xD.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,xD.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,xD.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,xD.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,xD.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}Fue.parseBigintDef=Rhn});var RDe=v(kue=>{"use strict";Object.defineProperty(kue,"__esModule",{value:!0});kue.parseBooleanDef=void 0;function jhn(){return{type:"boolean"}}kue.parseBooleanDef=jhn});var Bue=v($ue=>{"use strict";Object.defineProperty($ue,"__esModule",{value:!0});$ue.parseBrandedDef=void 0;var Nhn=ml();function Dhn(t,e){return(0,Nhn.parseDef)(t.type._def,e)}$ue.parseBrandedDef=Dhn});var jDe=v(que=>{"use strict";Object.defineProperty(que,"__esModule",{value:!0});que.parseCatchDef=void 0;var Lhn=ml(),Fhn=(t,e)=>(0,Lhn.parseDef)(t.innerType._def,e);que.parseCatchDef=Fhn});var NDe=v(Uue=>{"use strict";Object.defineProperty(Uue,"__esModule",{value:!0});Uue.parseDateDef=void 0;var C2t=KI();function O2t(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>O2t(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 khn(t,e)}}Uue.parseDateDef=O2t;var khn=(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,C2t.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,C2t.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var DDe=v(zue=>{"use strict";Object.defineProperty(zue,"__esModule",{value:!0});zue.parseDefaultDef=void 0;var $hn=ml();function Bhn(t,e){return{...(0,$hn.parseDef)(t.innerType._def,e),default:t.defaultValue()}}zue.parseDefaultDef=Bhn});var LDe=v(Hue=>{"use strict";Object.defineProperty(Hue,"__esModule",{value:!0});Hue.parseEffectsDef=void 0;var qhn=ml();function Uhn(t,e){return e.effectStrategy==="input"?(0,qhn.parseDef)(t.schema._def,e):{}}Hue.parseEffectsDef=Uhn});var FDe=v(Vue=>{"use strict";Object.defineProperty(Vue,"__esModule",{value:!0});Vue.parseEnumDef=void 0;function zhn(t){return{type:"string",enum:Array.from(t.values)}}Vue.parseEnumDef=zhn});var kDe=v(Wue=>{"use strict";Object.defineProperty(Wue,"__esModule",{value:!0});Wue.parseIntersectionDef=void 0;var P2t=ml(),Hhn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Vhn(t,e){let r=[(0,P2t.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,P2t.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(Hhn(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}Wue.parseIntersectionDef=Vhn});var $De=v(Kue=>{"use strict";Object.defineProperty(Kue,"__esModule",{value:!0});Kue.parseLiteralDef=void 0;function Whn(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}}Kue.parseLiteralDef=Whn});var Gue=v(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.parseStringDef=ad.zodPatterns=void 0;var CD=KI(),BDe;ad.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:()=>(BDe===void 0&&(BDe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),BDe),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 Khn(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,CD.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,CD.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":hb(r,"email",n.message,e);break;case"format:idn-email":hb(r,"idn-email",n.message,e);break;case"pattern:zod":tp(r,ad.zodPatterns.email,n.message,e);break}break;case"url":hb(r,"uri",n.message,e);break;case"uuid":hb(r,"uuid",n.message,e);break;case"regex":tp(r,n.regex,n.message,e);break;case"cuid":tp(r,ad.zodPatterns.cuid,n.message,e);break;case"cuid2":tp(r,ad.zodPatterns.cuid2,n.message,e);break;case"startsWith":tp(r,RegExp(`^${qDe(n.value,e)}`),n.message,e);break;case"endsWith":tp(r,RegExp(`${qDe(n.value,e)}$`),n.message,e);break;case"datetime":hb(r,"date-time",n.message,e);break;case"date":hb(r,"date",n.message,e);break;case"time":hb(r,"time",n.message,e);break;case"duration":hb(r,"duration",n.message,e);break;case"length":(0,CD.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,CD.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{tp(r,RegExp(qDe(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&hb(r,"ipv4",n.message,e),n.version!=="v4"&&hb(r,"ipv6",n.message,e);break}case"base64url":tp(r,ad.zodPatterns.base64url,n.message,e);break;case"jwt":tp(r,ad.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&tp(r,ad.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&tp(r,ad.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":tp(r,ad.zodPatterns.emoji(),n.message,e);break;case"ulid":{tp(r,ad.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{hb(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,CD.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{tp(r,ad.zodPatterns.base64,n.message,e);break}}break}case"nanoid":tp(r,ad.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}ad.parseStringDef=Khn;function qDe(t,e){return e.patternStrategy==="escape"?Jhn(t):t}var Ghn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Jhn(t){let e="";for(let r=0;ro.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,CD.setResponseValueAndErrors)(t,"format",e,r,n)}function tp(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:E2t(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,CD.setResponseValueAndErrors)(t,"pattern",E2t(e,n),r,n)}function E2t(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{"use strict";Object.defineProperty(Wue,"__esModule",{value:!0});Wue.parseRecordDef=void 0;var rW=Te(),x2t=ml(),Vhn=Vue(),Whn=Fue();function Khn(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===rW.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,x2t.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,x2t.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===rW.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,Vhn.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===rW.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===rW.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===rW.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,Whn.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}Wue.parseRecordDef=Khn});var BDe=v(Gue=>{"use strict";Object.defineProperty(Gue,"__esModule",{value:!0});Gue.parseMapDef=void 0;var C2t=ml(),Ghn=Kue();function Jhn(t,e){if(e.mapStrategy==="record")return(0,Ghn.parseRecordDef)(t,e);let r=(0,C2t.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,C2t.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}}}Gue.parseMapDef=Jhn});var qDe=v(Jue=>{"use strict";Object.defineProperty(Jue,"__esModule",{value:!0});Jue.parseNativeEnumDef=void 0;function Yhn(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}}Jue.parseNativeEnumDef=Yhn});var UDe=v(Yue=>{"use strict";Object.defineProperty(Yue,"__esModule",{value:!0});Yue.parseNeverDef=void 0;function Zhn(){return{not:{}}}Yue.parseNeverDef=Zhn});var zDe=v(Zue=>{"use strict";Object.defineProperty(Zue,"__esModule",{value:!0});Zue.parseNullDef=void 0;function Xhn(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}Zue.parseNullDef=Xhn});var Xue=v(GI=>{"use strict";Object.defineProperty(GI,"__esModule",{value:!0});GI.parseUnionDef=GI.primitiveMappings=void 0;var Qhn=ml();GI.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function egn(t,e){if(e.target==="openApi3")return O2t(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in GI.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=GI.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 O2t(t,e)}GI.parseUnionDef=egn;var O2t=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,Qhn.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 HDe=v(Que=>{"use strict";Object.defineProperty(Que,"__esModule",{value:!0});Que.parseNullableDef=void 0;var P2t=ml(),E2t=Xue();function tgn(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:E2t.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[E2t.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,P2t.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,P2t.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}Que.parseNullableDef=tgn});var VDe=v(ele=>{"use strict";Object.defineProperty(ele,"__esModule",{value:!0});ele.parseNumberDef=void 0;var JI=KI();function rgn(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,JI.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,JI.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,JI.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,JI.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,JI.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,JI.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,JI.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,JI.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}ele.parseNumberDef=rgn});var KDe=v(tle=>{"use strict";Object.defineProperty(tle,"__esModule",{value:!0});tle.parseObjectDef=void 0;var ngn=Te(),WDe=ml();function ogn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,WDe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,WDe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function ign(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 ngn.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,WDe.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:ogn(t,e)};return n.required.length||delete n.required,n}tle.parseObjectDef=ign});var GDe=v(rle=>{"use strict";Object.defineProperty(rle,"__esModule",{value:!0});rle.parseOptionalDef=void 0;var T2t=ml(),agn=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,T2t.parseDef)(t.innerType._def,e);let r=(0,T2t.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};rle.parseOptionalDef=agn});var JDe=v(ole=>{"use strict";Object.defineProperty(ole,"__esModule",{value:!0});ole.parsePipelineDef=void 0;var nle=ml(),sgn=(t,e)=>{if(e.pipeStrategy==="input")return(0,nle.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,nle.parseDef)(t.out._def,e);let r=(0,nle.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,nle.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};ole.parsePipelineDef=sgn});var YDe=v(ile=>{"use strict";Object.defineProperty(ile,"__esModule",{value:!0});ile.parsePromiseDef=void 0;var ugn=ml();function lgn(t,e){return(0,ugn.parseDef)(t.type._def,e)}ile.parsePromiseDef=lgn});var ZDe=v(ale=>{"use strict";Object.defineProperty(ale,"__esModule",{value:!0});ale.parseSetDef=void 0;var A2t=KI(),cgn=ml();function dgn(t,e){let n={type:"array",uniqueItems:!0,items:(0,cgn.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,A2t.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,A2t.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}ale.parseSetDef=dgn});var QDe=v(sle=>{"use strict";Object.defineProperty(sle,"__esModule",{value:!0});sle.parseTupleDef=void 0;var XDe=ml();function fgn(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,XDe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,XDe.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,XDe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}sle.parseTupleDef=fgn});var eLe=v(ule=>{"use strict";Object.defineProperty(ule,"__esModule",{value:!0});ule.parseUndefinedDef=void 0;function pgn(){return{not:{}}}ule.parseUndefinedDef=pgn});var tLe=v(lle=>{"use strict";Object.defineProperty(lle,"__esModule",{value:!0});lle.parseUnknownDef=void 0;function mgn(){return{}}lle.parseUnknownDef=mgn});var rLe=v(cle=>{"use strict";Object.defineProperty(cle,"__esModule",{value:!0});cle.parseReadonlyDef=void 0;var hgn=ml(),ggn=(t,e)=>(0,hgn.parseDef)(t.innerType._def,e);cle.parseReadonlyDef=ggn});var ml=v(dle=>{"use strict";Object.defineProperty(dle,"__esModule",{value:!0});dle.parseDef=void 0;var kn=Te(),ygn=EDe(),bgn=TDe(),_gn=ADe(),vgn=IDe(),wgn=Fue(),Sgn=MDe(),xgn=RDe(),Cgn=jDe(),Ogn=NDe(),Pgn=DDe(),Egn=LDe(),Tgn=FDe(),Agn=BDe(),Ign=qDe(),Mgn=UDe(),Rgn=zDe(),jgn=HDe(),Ngn=VDe(),Dgn=KDe(),Lgn=GDe(),Fgn=JDe(),kgn=YDe(),$gn=Kue(),Bgn=ZDe(),qgn=Vue(),Ugn=QDe(),zgn=eLe(),Hgn=Xue(),Vgn=tLe(),Wgn=rLe(),Kgn=Aue();function I2t(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Kgn.ignoreOverride)return a}if(n&&!r){let a=Ggn(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=Ygn(t,t.typeName,e);return i&&Zgn(t,e,i),o.jsonSchema=i,i}dle.parseDef=I2t;var Ggn=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Jgn(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},Jgn=(t,e)=>{let r=0;for(;r{switch(e){case kn.ZodFirstPartyTypeKind.ZodString:return(0,qgn.parseStringDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodNumber:return(0,Ngn.parseNumberDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodObject:return(0,Dgn.parseObjectDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodBigInt:return(0,_gn.parseBigintDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodBoolean:return(0,vgn.parseBooleanDef)();case kn.ZodFirstPartyTypeKind.ZodDate:return(0,xgn.parseDateDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodUndefined:return(0,zgn.parseUndefinedDef)();case kn.ZodFirstPartyTypeKind.ZodNull:return(0,Rgn.parseNullDef)(r);case kn.ZodFirstPartyTypeKind.ZodArray:return(0,bgn.parseArrayDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodUnion:case kn.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,Hgn.parseUnionDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodIntersection:return(0,Egn.parseIntersectionDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodTuple:return(0,Ugn.parseTupleDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodRecord:return(0,$gn.parseRecordDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodLiteral:return(0,Tgn.parseLiteralDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodEnum:return(0,Pgn.parseEnumDef)(t);case kn.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,Ign.parseNativeEnumDef)(t);case kn.ZodFirstPartyTypeKind.ZodNullable:return(0,jgn.parseNullableDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodOptional:return(0,Lgn.parseOptionalDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodMap:return(0,Agn.parseMapDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodSet:return(0,Bgn.parseSetDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodLazy:return I2t(t.getter()._def,r);case kn.ZodFirstPartyTypeKind.ZodPromise:return(0,kgn.parsePromiseDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodNaN:case kn.ZodFirstPartyTypeKind.ZodNever:return(0,Mgn.parseNeverDef)();case kn.ZodFirstPartyTypeKind.ZodEffects:return(0,Ogn.parseEffectsDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodAny:return(0,ygn.parseAnyDef)();case kn.ZodFirstPartyTypeKind.ZodUnknown:return(0,Vgn.parseUnknownDef)();case kn.ZodFirstPartyTypeKind.ZodDefault:return(0,Cgn.parseDefaultDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodBranded:return(0,wgn.parseBrandedDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodReadonly:return(0,Wgn.parseReadonlyDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodCatch:return(0,Sgn.parseCatchDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodPipeline:return(0,Fgn.parsePipelineDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodFunction:case kn.ZodFirstPartyTypeKind.ZodVoid:case kn.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},Zgn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var nLe=v(fle=>{"use strict";Object.defineProperty(fle,"__esModule",{value:!0});fle.zodToJsonSchema=void 0;var M2t=ml(),Xgn=PDe(),Qgn=(t,e)=>{let r=(0,Xgn.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,M2t.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,M2t.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};fle.zodToJsonSchema=Qgn});var R2t=v(Qr=>{"use strict";var eyn=Qr&&Qr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gn=Qr&&Qr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eyn(e,t,r)};Object.defineProperty(Qr,"__esModule",{value:!0});Gn(Aue(),Qr);Gn(PDe(),Qr);Gn(KI(),Qr);Gn(ml(),Qr);Gn(EDe(),Qr);Gn(TDe(),Qr);Gn(ADe(),Qr);Gn(IDe(),Qr);Gn(Fue(),Qr);Gn(MDe(),Qr);Gn(RDe(),Qr);Gn(jDe(),Qr);Gn(NDe(),Qr);Gn(DDe(),Qr);Gn(LDe(),Qr);Gn(FDe(),Qr);Gn(BDe(),Qr);Gn(qDe(),Qr);Gn(UDe(),Qr);Gn(zDe(),Qr);Gn(HDe(),Qr);Gn(VDe(),Qr);Gn(KDe(),Qr);Gn(GDe(),Qr);Gn(JDe(),Qr);Gn(YDe(),Qr);Gn(rLe(),Qr);Gn(Kue(),Qr);Gn(ZDe(),Qr);Gn(Vue(),Qr);Gn(QDe(),Qr);Gn(eLe(),Qr);Gn(Xue(),Qr);Gn(tLe(),Qr);Gn(nLe(),Qr);var tyn=nLe();Qr.default=tyn.zodToJsonSchema});var N2t=v(nW=>{"use strict";Object.defineProperty(nW,"__esModule",{value:!0});nW.transformToChatCompletionRequest=nyn;nW.convertToParsedChatCompletionResponse=oyn;nW.responseFormatFromZodObject=j2t;var ryn=R2t();function nyn(t){let{responseFormat:e,...r}=t,n=j2t(e);return{...r,responseFormat:n}}function oyn(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 j2t(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,ryn.zodToJsonSchema)(t),strict:!0}}}});var F2t=v(mle=>{"use strict";Object.defineProperty(mle,"__esModule",{value:!0});mle.Chat=void 0;var D2t=m2t(),L2t=y2t(),iyn=ah(),ple=Ig(),oLe=N2t(),iLe=class extends iyn.ClientSDK{async parse(e,r){let n=(0,oLe.transformToChatCompletionRequest)(e),o=await(0,ple.unwrapAsync)((0,D2t.chatComplete)(this,n,r));return(0,oLe.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,oLe.transformToChatCompletionRequest)(e);return(0,ple.unwrapAsync)((0,L2t.chatStream)(this,n,r))}async complete(e,r){return(0,ple.unwrapAsync)((0,D2t.chatComplete)(this,e,r))}async stream(e,r){return(0,ple.unwrapAsync)((0,L2t.chatStream)(this,e,r))}};mle.Chat=iLe});var B2t=v(MP=>{"use strict";var ayn=MP&&MP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),syn=MP&&MP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aLe=MP&&MP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ayn(e,t,r);return syn(e,t),e};Object.defineProperty(MP,"__esModule",{value:!0});MP.classifiersModerate=pyn;var uyn=ii(),oW=aLe(ai()),lyn=Ue(),cyn=ve(),k2t=si(),dyn=To(),$2t=aLe(Fn()),fyn=aLe(uh());async function pyn(t,e,r){let n=(0,cyn.safeParse)(e,y=>$2t.ClassificationRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,uyn.encodeJSON)("body",o,{explode:!0}),a=(0,dyn.pathToFunc)("/v1/moderations")(),s=new Headers((0,lyn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,k2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,k2t.resolveGlobalSecurity)(l),d={operationID:"moderations_v1_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await oW.match(oW.json(200,$2t.ClassificationResponse$inboundSchema),oW.jsonErr(422,fyn.HTTPValidationError$inboundSchema),oW.fail("4XX"),oW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var z2t=v(RP=>{"use strict";var myn=RP&&RP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hyn=RP&&RP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sLe=RP&&RP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&myn(e,t,r);return hyn(e,t),e};Object.defineProperty(RP,"__esModule",{value:!0});RP.classifiersModerateChat=wyn;var gyn=ii(),iW=sLe(ai()),yyn=Ue(),byn=ve(),q2t=si(),_yn=To(),U2t=sLe(Fn()),vyn=sLe(uh());async function wyn(t,e,r){let n=(0,byn.safeParse)(e,y=>U2t.ChatClassificationRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,gyn.encodeJSON)("body",o,{explode:!0}),a=(0,_yn.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,yyn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,q2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,q2t.resolveGlobalSecurity)(l),d={operationID:"moderations_chat_v1_chat_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await iW.match(iW.json(200,U2t.ClassificationResponse$inboundSchema),iW.jsonErr(422,vyn.HTTPValidationError$inboundSchema),iW.fail("4XX"),iW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var V2t=v(hle=>{"use strict";Object.defineProperty(hle,"__esModule",{value:!0});hle.Classifiers=void 0;var Syn=B2t(),xyn=z2t(),Cyn=ah(),H2t=Ig(),uLe=class extends Cyn.ClientSDK{async moderate(e,r){return(0,H2t.unwrapAsync)((0,Syn.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,H2t.unwrapAsync)((0,xyn.classifiersModerateChat)(this,e,r))}};hle.Classifiers=uLe});var G2t=v(jP=>{"use strict";var Oyn=jP&&jP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pyn=jP&&jP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lLe=jP&&jP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Oyn(e,t,r);return Pyn(e,t),e};Object.defineProperty(jP,"__esModule",{value:!0});jP.embeddingsCreate=Ryn;var Eyn=ii(),aW=lLe(ai()),Tyn=Ue(),Ayn=ve(),W2t=si(),Iyn=To(),K2t=lLe(Fn()),Myn=lLe(uh());async function Ryn(t,e,r){let n=(0,Ayn.safeParse)(e,y=>K2t.EmbeddingRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Eyn.encodeJSON)("body",o,{explode:!0}),a=(0,Iyn.pathToFunc)("/v1/embeddings")(),s=new Headers((0,Tyn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,W2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,W2t.resolveGlobalSecurity)(l),d={operationID:"embeddings_v1_embeddings_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await aW.match(aW.json(200,K2t.EmbeddingResponse$inboundSchema),aW.jsonErr(422,Myn.HTTPValidationError$inboundSchema),aW.fail("4XX"),aW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var J2t=v(gle=>{"use strict";Object.defineProperty(gle,"__esModule",{value:!0});gle.Embeddings=void 0;var jyn=G2t(),Nyn=ah(),Dyn=Ig(),cLe=class extends Nyn.ClientSDK{async create(e,r){return(0,Dyn.unwrapAsync)((0,jyn.embeddingsCreate)(this,e,r))}};gle.Embeddings=cLe});var Z2t=v(NP=>{"use strict";var Lyn=NP&&NP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fyn=NP&&NP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dLe=NP&&NP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lyn(e,t,r);return Fyn(e,t),e};Object.defineProperty(NP,"__esModule",{value:!0});NP.filesDelete=Hyn;var kyn=ii(),yle=dLe(ai()),$yn=Ue(),Byn=ve(),Y2t=si(),qyn=To(),Uyn=dLe(Fn()),zyn=dLe(pl());async function Hyn(t,e,r){let n=(0,Byn.safeParse)(e,y=>zyn.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,kyn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,qyn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,$yn.compactMap)({Accept:"application/json"})),l=await(0,Y2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Y2t.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_delete_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await yle.match(yle.json(200,Uyn.DeleteFileOut$inboundSchema),yle.fail("4XX"),yle.fail("5XX"))(b);return g.ok,g}});var Q2t=v(DP=>{"use strict";var Vyn=DP&&DP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wyn=DP&&DP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fLe=DP&&DP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vyn(e,t,r);return Wyn(e,t),e};Object.defineProperty(DP,"__esModule",{value:!0});DP.filesDownload=Qyn;var Kyn=fLe(Te()),Gyn=ii(),ble=fLe(ai()),Jyn=Ue(),Yyn=ve(),X2t=si(),Zyn=To(),Xyn=fLe(pl());async function Qyn(t,e,r){let n=(0,Yyn.safeParse)(e,y=>Xyn.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,Gyn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,Zyn.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,Jyn.compactMap)({Accept:"application/octet-stream"})),l=await(0,X2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,X2t.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_download_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await ble.match(ble.stream(200,Kyn.instanceof(ReadableStream)),ble.fail("4XX"),ble.fail("5XX"))(b);return g.ok,g}});var r4t=v(LP=>{"use strict";var ebn=LP&&LP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tbn=LP&&LP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pLe=LP&&LP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ebn(e,t,r);return tbn(e,t),e};Object.defineProperty(LP,"__esModule",{value:!0});LP.filesGetSignedUrl=sbn;var e4t=ii(),_le=pLe(ai()),rbn=Ue(),nbn=ve(),t4t=si(),obn=To(),ibn=pLe(Fn()),abn=pLe(pl());async function sbn(t,e,r){let n=(0,nbn.safeParse)(e,S=>abn.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,e4t.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,obn.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,e4t.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,rbn.compactMap)({Accept:"application/json"})),c=await(0,t4t.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,t4t.resolveGlobalSecurity)(d),p={operationID:"files_api_routes_get_signed_url",oAuth2Scopes:[],resolvedSecurity:f,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},m=t._createRequest(p,{security:f,method:"GET",baseURL:r?.serverURL,path:s,headers:l,query:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!m.ok)return m;let h=m.value,b=await t._do(h,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!b.ok)return b;let g=b.value,[y]=await _le.match(_le.json(200,ibn.FileSignedURL$inboundSchema),_le.fail("4XX"),_le.fail("5XX"))(g);return y.ok,y}});var o4t=v(FP=>{"use strict";var ubn=FP&&FP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lbn=FP&&FP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mLe=FP&&FP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ubn(e,t,r);return lbn(e,t),e};Object.defineProperty(FP,"__esModule",{value:!0});FP.filesList=gbn;var cbn=ii(),vle=mLe(ai()),dbn=Ue(),fbn=ve(),n4t=si(),pbn=To(),mbn=mLe(Fn()),hbn=mLe(pl());async function gbn(t,e,r){let n=(0,fbn.safeParse)(e,y=>hbn.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,pbn.pathToFunc)("/v1/files")(),s=(0,cbn.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,dbn.compactMap)({Accept:"application/json"})),l=await(0,n4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,n4t.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_list_files",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await vle.match(vle.json(200,mbn.ListFilesOut$inboundSchema),vle.fail("4XX"),vle.fail("5XX"))(b);return g.ok,g}});var a4t=v(kP=>{"use strict";var ybn=kP&&kP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bbn=kP&&kP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hLe=kP&&kP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ybn(e,t,r);return bbn(e,t),e};Object.defineProperty(kP,"__esModule",{value:!0});kP.filesRetrieve=Obn;var _bn=ii(),wle=hLe(ai()),vbn=Ue(),wbn=ve(),i4t=si(),Sbn=To(),xbn=hLe(Fn()),Cbn=hLe(pl());async function Obn(t,e,r){let n=(0,wbn.safeParse)(e,y=>Cbn.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,_bn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,Sbn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,vbn.compactMap)({Accept:"application/json"})),l=await(0,i4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,i4t.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_retrieve_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await wle.match(wle.json(200,xbn.RetrieveFileOut$inboundSchema),wle.fail("4XX"),wle.fail("5XX"))(b);return g.ok,g}});var s4t=v(gLe=>{"use strict";Object.defineProperty(gLe,"__esModule",{value:!0});gLe.isReadableStream=Pbn;function Pbn(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 l4t=v($P=>{"use strict";var Ebn=$P&&$P.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tbn=$P&&$P.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yLe=$P&&$P.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ebn(e,t,r);return Tbn(e,t),e};Object.defineProperty($P,"__esModule",{value:!0});$P.filesUpload=Fbn;var Sle=ii(),Abn=Qje(),xle=yLe(ai()),Ibn=Ue(),Mbn=ve(),u4t=si(),Rbn=To(),jbn=yLe(Fn()),Nbn=yLe(pl()),Dbn=_De(),Lbn=s4t();async function Fbn(t,e,r){let n=(0,Mbn.safeParse)(e,g=>Nbn.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=new FormData;if((0,Dbn.isBlobLike)(o.file))(0,Sle.appendForm)(i,"file",o.file);else if((0,Lbn.isReadableStream)(o.file.content)){let g=await(0,Abn.readableStreamToArrayBuffer)(o.file.content),y=new Blob([g],{type:"application/octet-stream"});(0,Sle.appendForm)(i,"file",y)}else(0,Sle.appendForm)(i,"file",new Blob([o.file.content],{type:"application/octet-stream"}),o.file.fileName);o.purpose!==void 0&&(0,Sle.appendForm)(i,"purpose",o.purpose);let a=(0,Rbn.pathToFunc)("/v1/files")(),s=new Headers((0,Ibn.compactMap)({Accept:"application/json"})),u=await(0,u4t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,u4t.resolveGlobalSecurity)(l),d={operationID:"files_api_routes_upload_file",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[b]=await xle.match(xle.json(200,jbn.UploadFileOut$inboundSchema),xle.fail("4XX"),xle.fail("5XX"))(h);return b.ok,b}});var c4t=v(Cle=>{"use strict";Object.defineProperty(Cle,"__esModule",{value:!0});Cle.Files=void 0;var kbn=Z2t(),$bn=Q2t(),Bbn=r4t(),qbn=o4t(),Ubn=a4t(),zbn=l4t(),Hbn=ah(),qU=Ig(),bLe=class extends Hbn.ClientSDK{async upload(e,r){return(0,qU.unwrapAsync)((0,zbn.filesUpload)(this,e,r))}async list(e,r){return(0,qU.unwrapAsync)((0,qbn.filesList)(this,e,r))}async retrieve(e,r){return(0,qU.unwrapAsync)((0,Ubn.filesRetrieve)(this,e,r))}async delete(e,r){return(0,qU.unwrapAsync)((0,kbn.filesDelete)(this,e,r))}async download(e,r){return(0,qU.unwrapAsync)((0,$bn.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,qU.unwrapAsync)((0,Bbn.filesGetSignedUrl)(this,e,r))}};Cle.Files=bLe});var p4t=v(BP=>{"use strict";var Vbn=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]}),Wbn=BP&&BP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Le=BP&&BP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vbn(e,t,r);return Wbn(e,t),e};Object.defineProperty(BP,"__esModule",{value:!0});BP.fimComplete=Xbn;var Kbn=ii(),sW=_Le(ai()),Gbn=Ue(),Jbn=ve(),d4t=si(),Ybn=To(),f4t=_Le(Fn()),Zbn=_Le(uh());async function Xbn(t,e,r){let n=(0,Jbn.safeParse)(e,y=>f4t.FIMCompletionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Kbn.encodeJSON)("body",o,{explode:!0}),a=(0,Ybn.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,Gbn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,d4t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,d4t.resolveGlobalSecurity)(l),d={operationID:"fim_completion_v1_fim_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await sW.match(sW.json(200,f4t.FIMCompletionResponse$inboundSchema),sW.jsonErr(422,Zbn.HTTPValidationError$inboundSchema),sW.fail("4XX"),sW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var g4t=v(qP=>{"use strict";var Qbn=qP&&qP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e_n=qP&&qP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ole=qP&&qP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Qbn(e,t,r);return e_n(e,t),e};Object.defineProperty(qP,"__esModule",{value:!0});qP.fimStream=u_n;var t_n=Ole(Te()),r_n=ii(),n_n=U5(),uW=Ole(ai()),o_n=Ue(),i_n=ve(),m4t=si(),a_n=To(),h4t=Ole(Fn()),s_n=Ole(uh());async function u_n(t,e,r){let n=(0,i_n.safeParse)(e,y=>h4t.FIMCompletionStreamRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,r_n.encodeJSON)("body",o,{explode:!0}),a=(0,a_n.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,o_n.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,m4t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,m4t.resolveGlobalSecurity)(l),d={operationID:"stream_fim",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await uW.match(uW.sse(200,t_n.instanceof(ReadableStream).transform(y=>new n_n.EventStream({stream:y,decoder(S){return h4t.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),uW.jsonErr(422,s_n.HTTPValidationError$inboundSchema),uW.fail("4XX"),uW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var b4t=v(Ple=>{"use strict";Object.defineProperty(Ple,"__esModule",{value:!0});Ple.Fim=void 0;var l_n=p4t(),c_n=g4t(),d_n=ah(),y4t=Ig(),vLe=class extends d_n.ClientSDK{async complete(e,r){return(0,y4t.unwrapAsync)((0,l_n.fimComplete)(this,e,r))}async stream(e,r){return(0,y4t.unwrapAsync)((0,c_n.fimStream)(this,e,r))}};Ple.Fim=vLe});var v4t=v(UP=>{"use strict";var f_n=UP&&UP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p_n=UP&&UP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wLe=UP&&UP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&f_n(e,t,r);return p_n(e,t),e};Object.defineProperty(UP,"__esModule",{value:!0});UP.fineTuningJobsCancel=v_n;var m_n=ii(),Ele=wLe(ai()),h_n=Ue(),g_n=ve(),_4t=si(),y_n=To(),b_n=wLe(Fn()),__n=wLe(pl());async function v_n(t,e,r){let n=(0,g_n.safeParse)(e,y=>__n.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,m_n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,y_n.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,h_n.compactMap)({Accept:"application/json"})),l=await(0,_4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,_4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_cancel_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Ele.match(Ele.json(200,b_n.DetailedJobOut$inboundSchema),Ele.fail("4XX"),Ele.fail("5XX"))(b);return g.ok,g}});var S4t=v(zP=>{"use strict";var w_n=zP&&zP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),S_n=zP&&zP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SLe=zP&&zP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&w_n(e,t,r);return S_n(e,t),e};Object.defineProperty(zP,"__esModule",{value:!0});zP.fineTuningJobsCreate=A_n;var x_n=ii(),Tle=SLe(ai()),C_n=Ue(),O_n=ve(),w4t=si(),P_n=To(),E_n=SLe(Fn()),T_n=SLe(pl());async function A_n(t,e,r){let n=(0,O_n.safeParse)(e,g=>E_n.JobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,x_n.encodeJSON)("body",o,{explode:!0}),a=(0,P_n.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,C_n.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,w4t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,w4t.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_fine_tuning_create_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[b]=await Tle.match(Tle.json(200,T_n.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),Tle.fail("4XX"),Tle.fail("5XX"))(h);return b.ok,b}});var C4t=v(HP=>{"use strict";var I_n=HP&&HP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M_n=HP&&HP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xLe=HP&&HP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&I_n(e,t,r);return M_n(e,t),e};Object.defineProperty(HP,"__esModule",{value:!0});HP.fineTuningJobsGet=k_n;var R_n=ii(),Ale=xLe(ai()),j_n=Ue(),N_n=ve(),x4t=si(),D_n=To(),L_n=xLe(Fn()),F_n=xLe(pl());async function k_n(t,e,r){let n=(0,N_n.safeParse)(e,y=>F_n.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,R_n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,D_n.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,j_n.compactMap)({Accept:"application/json"})),l=await(0,x4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,x4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Ale.match(Ale.json(200,L_n.DetailedJobOut$inboundSchema),Ale.fail("4XX"),Ale.fail("5XX"))(b);return g.ok,g}});var P4t=v(VP=>{"use strict";var $_n=VP&&VP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B_n=VP&&VP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CLe=VP&&VP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$_n(e,t,r);return B_n(e,t),e};Object.defineProperty(VP,"__esModule",{value:!0});VP.fineTuningJobsList=K_n;var q_n=ii(),Ile=CLe(ai()),U_n=Ue(),z_n=ve(),O4t=si(),H_n=To(),V_n=CLe(Fn()),W_n=CLe(pl());async function K_n(t,e,r){let n=(0,z_n.safeParse)(e,y=>W_n.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,H_n.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,q_n.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,U_n.compactMap)({Accept:"application/json"})),l=await(0,O4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,O4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Ile.match(Ile.json(200,V_n.JobsOut$inboundSchema),Ile.fail("4XX"),Ile.fail("5XX"))(b);return g.ok,g}});var T4t=v(WP=>{"use strict";var G_n=WP&&WP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J_n=WP&&WP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OLe=WP&&WP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G_n(e,t,r);return J_n(e,t),e};Object.defineProperty(WP,"__esModule",{value:!0});WP.fineTuningJobsStart=rvn;var Y_n=ii(),Mle=OLe(ai()),Z_n=Ue(),X_n=ve(),E4t=si(),Q_n=To(),evn=OLe(Fn()),tvn=OLe(pl());async function rvn(t,e,r){let n=(0,X_n.safeParse)(e,y=>tvn.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,Y_n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Q_n.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,Z_n.compactMap)({Accept:"application/json"})),l=await(0,E4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,E4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_start_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Mle.match(Mle.json(200,evn.DetailedJobOut$inboundSchema),Mle.fail("4XX"),Mle.fail("5XX"))(b);return g.ok,g}});var A4t=v(Rle=>{"use strict";Object.defineProperty(Rle,"__esModule",{value:!0});Rle.Jobs=void 0;var nvn=v4t(),ovn=S4t(),ivn=C4t(),avn=P4t(),svn=T4t(),uvn=ah(),lW=Ig(),PLe=class extends uvn.ClientSDK{async list(e,r){return(0,lW.unwrapAsync)((0,avn.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,lW.unwrapAsync)((0,ovn.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,lW.unwrapAsync)((0,ivn.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,lW.unwrapAsync)((0,nvn.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,lW.unwrapAsync)((0,svn.fineTuningJobsStart)(this,e,r))}};Rle.Jobs=PLe});var I4t=v(jle=>{"use strict";Object.defineProperty(jle,"__esModule",{value:!0});jle.FineTuning=void 0;var lvn=ah(),cvn=A4t(),ELe=class extends lvn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new cvn.Jobs(this._options))}};jle.FineTuning=ELe});var R4t=v(KP=>{"use strict";var dvn=KP&&KP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fvn=KP&&KP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TLe=KP&&KP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dvn(e,t,r);return fvn(e,t),e};Object.defineProperty(KP,"__esModule",{value:!0});KP.modelsArchive=_vn;var pvn=ii(),Nle=TLe(ai()),mvn=Ue(),hvn=ve(),M4t=si(),gvn=To(),yvn=TLe(Fn()),bvn=TLe(pl());async function _vn(t,e,r){let n=(0,hvn.safeParse)(e,y=>bvn.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,pvn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,gvn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,mvn.compactMap)({Accept:"application/json"})),l=await(0,M4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,M4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_archive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Nle.match(Nle.json(200,yvn.ArchiveFTModelOut$inboundSchema),Nle.fail("4XX"),Nle.fail("5XX"))(b);return g.ok,g}});var N4t=v(GP=>{"use strict";var vvn=GP&&GP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wvn=GP&&GP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dle=GP&&GP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vvn(e,t,r);return wvn(e,t),e};Object.defineProperty(GP,"__esModule",{value:!0});GP.modelsDelete=Avn;var Svn=ii(),cW=Dle(ai()),xvn=Ue(),Cvn=ve(),j4t=si(),Ovn=To(),Pvn=Dle(Fn()),Evn=Dle(uh()),Tvn=Dle(pl());async function Avn(t,e,r){let n=(0,Cvn.safeParse)(e,S=>Tvn.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Svn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Ovn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,xvn.compactMap)({Accept:"application/json"})),l=await(0,j4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,j4t.resolveGlobalSecurity)(c),f={operationID:"delete_model_v1_models__model_id__delete",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,g={HttpMeta:{Response:b,Request:m}},[y]=await cW.match(cW.json(200,Pvn.DeleteModelOut$inboundSchema),cW.jsonErr(422,Evn.HTTPValidationError$inboundSchema),cW.fail("4XX"),cW.fail("5XX"))(b,{extraFields:g});return y.ok,y}});var L4t=v(JP=>{"use strict";var Ivn=JP&&JP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mvn=JP&&JP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ALe=JP&&JP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ivn(e,t,r);return Mvn(e,t),e};Object.defineProperty(JP,"__esModule",{value:!0});JP.modelsList=Lvn;var dW=ALe(ai()),Rvn=Ue(),D4t=si(),jvn=To(),Nvn=ALe(Fn()),Dvn=ALe(uh());async function Lvn(t,e){let r=(0,jvn.pathToFunc)("/v1/models")(),n=new Headers((0,Rvn.compactMap)({Accept:"application/json"})),o=await(0,D4t.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,D4t.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 dW.match(dW.json(200,Nvn.ModelList$inboundSchema),dW.jsonErr(422,Dvn.HTTPValidationError$inboundSchema),dW.fail("4XX"),dW.fail("5XX"))(d,{extraFields:f});return p.ok,p}});var $4t=v(YP=>{"use strict";var Fvn=YP&&YP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kvn=YP&&YP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ILe=YP&&YP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Fvn(e,t,r);return kvn(e,t),e};Object.defineProperty(YP,"__esModule",{value:!0});YP.modelsRetrieve=Hvn;var $vn=ii(),fW=ILe(ai()),Bvn=Ue(),qvn=ve(),F4t=si(),Uvn=To(),zvn=ILe(uh()),k4t=ILe(pl());async function Hvn(t,e,r){let n=(0,qvn.safeParse)(e,S=>k4t.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,$vn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Uvn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Bvn.compactMap)({Accept:"application/json"})),l=await(0,F4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,F4t.resolveGlobalSecurity)(c),f={operationID:"retrieve_model_v1_models__model_id__get",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,g={HttpMeta:{Response:b,Request:m}},[y]=await fW.match(fW.json(200,k4t.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),fW.jsonErr(422,zvn.HTTPValidationError$inboundSchema),fW.fail("4XX"),fW.fail("5XX"))(b,{extraFields:g});return y.ok,y}});var q4t=v(ZP=>{"use strict";var Vvn=ZP&&ZP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wvn=ZP&&ZP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MLe=ZP&&ZP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vvn(e,t,r);return Wvn(e,t),e};Object.defineProperty(ZP,"__esModule",{value:!0});ZP.modelsUnarchive=Qvn;var Kvn=ii(),Lle=MLe(ai()),Gvn=Ue(),Jvn=ve(),B4t=si(),Yvn=To(),Zvn=MLe(Fn()),Xvn=MLe(pl());async function Qvn(t,e,r){let n=(0,Jvn.safeParse)(e,y=>Xvn.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Kvn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Yvn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,Gvn.compactMap)({Accept:"application/json"})),l=await(0,B4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,B4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_unarchive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Lle.match(Lle.json(200,Zvn.UnarchiveFTModelOut$inboundSchema),Lle.fail("4XX"),Lle.fail("5XX"))(b);return g.ok,g}});var H4t=v(XP=>{"use strict";var ewn=XP&&XP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),twn=XP&&XP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RLe=XP&&XP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ewn(e,t,r);return twn(e,t),e};Object.defineProperty(XP,"__esModule",{value:!0});XP.modelsUpdate=swn;var U4t=ii(),Fle=RLe(ai()),rwn=Ue(),nwn=ve(),z4t=si(),own=To(),iwn=RLe(Fn()),awn=RLe(pl());async function swn(t,e,r){let n=(0,nwn.safeParse)(e,y=>awn.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,U4t.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,U4t.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,own.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,rwn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,z4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,z4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_update_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"PATCH",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Fle.match(Fle.json(200,iwn.FTModelOut$inboundSchema),Fle.fail("4XX"),Fle.fail("5XX"))(b);return g.ok,g}});var V4t=v(kle=>{"use strict";Object.defineProperty(kle,"__esModule",{value:!0});kle.Models=void 0;var uwn=R4t(),lwn=N4t(),cwn=L4t(),dwn=$4t(),fwn=q4t(),pwn=H4t(),mwn=ah(),UU=Ig(),jLe=class extends mwn.ClientSDK{async list(e){return(0,UU.unwrapAsync)((0,cwn.modelsList)(this,e))}async retrieve(e,r){return(0,UU.unwrapAsync)((0,dwn.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,UU.unwrapAsync)((0,lwn.modelsDelete)(this,e,r))}async update(e,r){return(0,UU.unwrapAsync)((0,pwn.modelsUpdate)(this,e,r))}async archive(e,r){return(0,UU.unwrapAsync)((0,uwn.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,UU.unwrapAsync)((0,fwn.modelsUnarchive)(this,e,r))}};kle.Models=jLe});var W4t=v($le=>{"use strict";Object.defineProperty($le,"__esModule",{value:!0});$le.Mistral=void 0;var hwn=ah(),gwn=LUt(),ywn=d2t(),bwn=F2t(),_wn=V2t(),vwn=J2t(),wwn=c4t(),Swn=b4t(),xwn=I4t(),Cwn=V4t(),NLe=class extends hwn.ClientSDK{get models(){return this._models??(this._models=new Cwn.Models(this._options))}get files(){return this._files??(this._files=new wwn.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new xwn.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new ywn.Batch(this._options))}get chat(){return this._chat??(this._chat=new bwn.Chat(this._options))}get fim(){return this._fim??(this._fim=new Swn.Fim(this._options))}get agents(){return this._agents??(this._agents=new gwn.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new vwn.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new _wn.Classifiers(this._options))}};$le.Mistral=NLe});var J4t=v(om=>{"use strict";var K4t=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]}),Own=om&&om.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G4t=om&&om.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&K4t(e,t,r)},Pwn=om&&om.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K4t(e,t,r);return Own(e,t),e};Object.defineProperty(om,"__esModule",{value:!0});om.files=void 0;G4t(Dae(),om);om.files=Pwn(Qje());G4t(W4t(),om)});var u3t=w(()=>{LE()});var l3t=w(()=>{Qd();u3t();Sm();Wm()});var c3t=w(()=>{gy()});var VLe=w(()=>{Wm();qE();Sm();l3t();c3t()});var d3t={};Cf(d3t,{AutocompleteCache:()=>wW});var wW,WLe=w(()=>{yo();wW=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()}),ie(`[AutocompleteCache] Cached response for key: ${e.slice(0,50)}...`)}clear(){this.cache.clear(),ie("[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 V6t=v((Eci,H6t)=>{"use strict";var aOn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";H6t.exports=aOn});var J6t=v((Tci,G6t)=>{"use strict";var sOn=V6t();function W6t(){}function K6t(){}K6t.resetWarningCache=W6t;G6t.exports=function(){function t(n,o,i,a,s,u){if(u!==sOn){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:K6t,resetWarningCache:W6t};return r.PropTypes=r,r}});var Z6t=v((Mci,Y6t)=>{Y6t.exports=J6t()();var Aci,Ici});var n5t=v(Mke=>{"use strict";Mke.__esModule=!0;Mke.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 e1n={};Cf(e1n,{default:()=>Lfe});module.exports=zl(e1n);mg();Cl();yo();var y1t=F(vq()),xq=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)||(ie("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,y1t.MD5)(n).toString()}getCachePath(e){return`${this.cacheDir}/${e}.md`}async get(e){try{let r=this.memoryCache.get(e);if(r)return ie("Memory cache hit for file:",e),r.content;let n=this.getCachePath(e);if(await app.vault.adapter.exists(n)){ie("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 ie("Cache miss for file:",e),null}catch(r){return fe("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),ie("Cached file content:",e)}catch(n){fe("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),ie("Removed file from cache:",e))}catch(r){fe("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);ie("Clearing file cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){fe("Error clearing file cache:",e)}}};yo();_g();nr();var w1t=F(vq()),aie=require("obsidian"),S1t=F(YRe()),nI=class nI{constructor(){this.cacheDir=".copilot/project-context-cache";this.memoryCache=new Map;this.handleFileEvent=e=>{e instanceof aie.TFile&&this.debouncedHandleFileChange(e)};this.handleFileChange=async e=>{try{if(e.extension!=="md")return;let n=ue().projectList||[];for(let o of n){let{inclusions:i,exclusions:a}=rf({inclusions:o.contextSource.inclusions,exclusions:o.contextSource.exclusions,isProject:!0});eu(e,i,a)&&(await this.invalidateMarkdownContext(o),ie(`Invalidated markdown context for project ${o.name} due to file change: ${e.path}`))}}catch(r){fe("Error handling file change for project context cache:",r)}};this.debouncedHandleFileChange=(0,S1t.default)(e=>{this.handleFileChange(e)},nI.DEBOUNCE_DELAY,{leading:!0,trailing:!0});this.vault=app.vault,this.fileCache=xq.getInstance(),this.initializeEventListeners()}static getInstance(){return nI.instance||(nI.instance=new nI),nI.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)}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)||(ie("Creating project context cache directory:",this.cacheDir),await this.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){return(0,w1t.MD5)(e.id).toString()}getCachePath(e){return`${this.cacheDir}/${e}.json`}async get(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);if(n)return ie("Memory cache hit for project:",e.name),n;let o=this.getCachePath(r);if(await this.vault.adapter.exists(o)){ie("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 ie("Cache miss for project:",e.name),null}catch(r){return fe("Error reading from project context cache:",r),null}}getSync(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);return n?(ie("Memory cache hit for project:",e.name),n):(ie("Memory cache miss for project:",e.name),null)}catch(r){return fe("Error reading from project context memory cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);ie("Caching context for project:",e.name),this.memoryCache.set(n,r),await this.vault.adapter.write(o,JSON.stringify(r))}catch(n){fe("Error writing to project context cache:",n)}}createEmptyCache(){return{markdownContext:"",webContexts:{},youtubeContexts:{},fileContexts:{},timestamp:Date.now(),markdownNeedsReload:!1}}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);ie("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);ie(`Cleared ${e.size} file content cache entries associated with projects`)}catch(e){fe("Error clearing project context cache:",e)}}async clearForProject(e){try{ie(`[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){ie(`[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++):Mh(`[clearForProject] Project ${e.name}: Skipped removing FileCache entry for file ${s} due to missing cacheKey.`)}ie(`[clearForProject] Project ${e.name}: Attempted to clear ${o} entries from FileCache.`)}}else ie(`[clearForProject] Project ${e.name}: No fileContexts found in existing project cache to clear from FileCache.`);this.memoryCache.delete(r),ie(`[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),ie(`[clearForProject] Project ${e.name}: Successfully removed main project cache file: ${i}`)):ie(`[clearForProject] Project ${e.name}: Main project cache file not found (already deleted or never existed): ${i}`),ie(`[clearForProject] Completed for project: ${e.name}`)}catch(r){fe(`[clearForProject] Error for project ${e.name} (ID: ${e.id}):`,r)}}async invalidateMarkdownContext(e,r=!1){let n=await this.get(e);n&&(n.markdownContext="",n.markdownNeedsReload=!0,r&&(n.webContexts={},n.youtubeContexts={},ie(`Flagged Web/YouTube contexts for full reload for project ${e.name}`)),await this.set(e,n),await this.cleanupProjectFileReferences(e),ie(`Invalidated markdown context for project ${e.name}`))}async updateMarkdownContext(e,r){let n=await this.get(e)||this.createEmptyCache();n.markdownContext=r,n.markdownNeedsReload=!1,await this.set(e,n),ie(`Updated markdown context for project ${e.name}`)}async clearMarkdownContext(e){let r=await this.get(e);r&&(r.markdownContext="",r.markdownNeedsReload=!0,await this.set(e,r))}async getFileContext(e,r){try{if(!r||typeof r!="string")return fe("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 Mh(`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"?(Mh(`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 fe(`Error getting file context for ${r} in project ${e.name}:`,n),null}}async setFileContext(e,r,n){try{let o=await this.get(e)||this.createEmptyCache();o.fileContexts||(o.fileContexts={});let i=this.vault.getAbstractFileByPath(r);if(!(i instanceof aie.TFile))throw new Error(`File not found: ${r}`);let a=this.fileCache.getCacheKey(i,e.id);await this.fileCache.set(a,n),o.fileContexts[r]={timestamp:Date.now(),cacheKey:a},await this.set(e,o),ie(`Added/updated file context for ${r} in project ${e.name}`)}catch(o){fe(`Error setting file context for ${r}:`,o)}}async removeFileContext(e,r){try{let n=await this.get(e);if(n&&n.fileContexts[r]){let{cacheKey:o}=n.fileContexts[r];delete n.fileContexts[r],await this.set(e,n),await this.fileCache.remove(o),ie(`Removed file context for ${r} in project ${e.name}`)}}catch(n){fe(`Error removing file context for ${r}:`,n)}}async cleanupProjectFileReferences(e){try{let r=await this.get(e);if(!r||!r.fileContexts)return;let{inclusions:n,exclusions:o}=rf({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 aie.TFile)||!eu(u,n,o)?i++:a[s]=r.fileContexts[s]}i>0&&(r.fileContexts=a,await this.set(e,r),ie(`Removed ${i} file references from project ${e.name} that no longer match inclusion patterns`))}catch(r){fe(`Error cleaning up project file references for ${e.name}:`,r)}}async updateProjectFilesFromPatterns(e,r){try{ie(`[updateProjectFilesFromPatterns] Starting for project: ${e.name}`),r.fileContexts||(r.fileContexts={});let{inclusions:n,exclusions:o}=rf({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=this.vault.getFiles(),a=0;for(let s of i)if(eu(s,n,o)){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&&ie(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${a} new file references to context (in memory).`),ie(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(n){fe(`[updateProjectFilesFromPatterns] Error for project ${e.name}:`,n)}return r}async removeWebUrl(e,r){let n=await this.get(e);n?.webContexts?.[r]&&(delete n.webContexts[r],await this.set(e,n),ie(`Removed web context for URL ${r} in project ${e.name}`))}async updateWebUrl(e,r,n){let o=await this.get(e)||this.createEmptyCache();o.webContexts||(o.webContexts={}),o.webContexts[r]=n,await this.set(e,o),ie(`Updated web context for URL ${r} in project ${e.name}`)}async removeYoutubeUrl(e,r){let n=await this.get(e);n?.youtubeContexts?.[r]&&(delete n.youtubeContexts[r],await this.set(e,n),ie(`Removed YouTube context for URL ${r} in project ${e.name}`))}async updateYoutubeUrl(e,r,n){let o=await this.get(e)||this.createEmptyCache();o.youtubeContexts||(o.youtubeContexts={}),o.youtubeContexts[r]=n,await this.set(e,o),ie(`Updated YouTube context for URL ${r} in project ${e.name}`)}};nI.DEBOUNCE_DELAY=5e3;var tb=nI;Fd();$r();Cn();function x1t(t){let e=t.split(` -`),r=[],n="",o="",i="";for(let a of e)a.startsWith("**user**:")||a.startsWith("**ai**:")?(n&&o&&r.push({sender:n===Pi?Pi:e_,message:o.trim(),isVisible:!0,timestamp:i?Yhe(i):null}),n=a.startsWith("**user**:")?Pi:e_,o=a.substring(a.indexOf(":")+1).trim(),i=""):a.startsWith("[Timestamp:")?i=a.substring(11,a.length-1).trim():o+=` -`+a;return n&&o&&r.push({sender:n===Pi?Pi:e_,message:o.trim(),isVisible:!0,timestamp:i?Yhe(i):null}),r}async function _N(t,e){await e.clearChatMemory();for(let r=0;ru&&s>-1&&(n=a.substring(s+1).toLowerCase()),n&&!this.IMAGE_EXTENSIONS.some(c=>c.toLowerCase()===`.${n}`))return fe(`Unsupported image format from URL path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;try{let c=(await Us(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?(fe(`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 vN.TFile?i.stat.size>this.MAX_IMAGE_SIZE?(fe(`Vault file too large: ${i.stat.size} bytes for path: ${e}`),!1):!0:(fe(`File with image extension not found in vault: ${e}.`),!1)}else return n&&fe(`Unsupported image format for potential vault path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;return fe(`Could not determine image status for URL/path: ${e}`),!1}catch(n){return fe(`Unexpected error in isImageUrl for "${e}":`,n),!1}}static async handleVaultImage(e,r){try{if(e.stat.size>this.MAX_IMAGE_SIZE)return fe(`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 fe(`Invalid MIME type: ${o}, skipping: ${e.path}`),null;let a=Buffer.from(n).toString("base64");return`data:${o};base64,${a}`}catch(n){return fe("Error processing vault image:",n),null}}static async handleWebImage(e){try{let r=await Us(e,{method:"GET",headers:{}});if(!r.ok)return fe(`Failed to fetch image: ${r.statusText}, URL: ${e}`),null;let n=r.headers.get("content-type");if(!n?.startsWith("image/"))return fe(`Invalid content type: ${n}, URL: ${e}`),null;let o=await r.arrayBuffer();if(o.byteLength>this.MAX_IMAGE_SIZE)return fe(`Image too large: ${o.byteLength} bytes, URL: ${e}`),null;let a=Buffer.from(o).toString("base64");return`data:${n};base64,${a}`}catch(r){return fe("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 vN.TFile))return fe(`Local image not found: ${n}`),null;if(o.stat.size>this.MAX_IMAGE_SIZE)return fe(`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 fe(`Invalid MIME type: ${a}, path: ${n}`),null;let u=Buffer.from(i).toString("base64");return`data:${a};base64,${u}`}catch(n){return fe("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 vN.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 vN.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}}:(fe(`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 fe(i),new Error(i)}return o}};Mx.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],Mx.MAX_IMAGE_SIZE=3*1024*1024,Mx.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};var wN=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 fe("Error processing URL batch:",o),{successfulImages:[],failureDescriptions:e.map(i=>`Image read failed for: ${i}`)}}}static async processSingleUrl(e,r,n){try{if(!await Mx.isImageUrl(e,n))return null;let o=await Mx.convertToBase64(e,n);return o||(r.push(e),null)}catch(o){return fe(`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){fe("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 Mx.convertToBase64(e.image_url.url,n);return o||(r.push(e.image_url.url),null)}catch(o){return fe(`Failed to process chat image: ${e.image_url.url}`,o),r.push(e.image_url.url),null}}static showFailedImagesNotice(e){e.length>0&&new vN.Notice(`Failed to process images: +]`;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 Yue=v(Jue=>{"use strict";Object.defineProperty(Jue,"__esModule",{value:!0});Jue.parseRecordDef=void 0;var nW=Te(),T2t=ml(),Yhn=Gue(),Zhn=Bue();function Xhn(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===nW.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,T2t.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,T2t.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===nW.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,Yhn.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===nW.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===nW.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===nW.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,Zhn.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}Jue.parseRecordDef=Xhn});var UDe=v(Zue=>{"use strict";Object.defineProperty(Zue,"__esModule",{value:!0});Zue.parseMapDef=void 0;var A2t=ml(),Qhn=Yue();function egn(t,e){if(e.mapStrategy==="record")return(0,Qhn.parseRecordDef)(t,e);let r=(0,A2t.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,A2t.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}}}Zue.parseMapDef=egn});var zDe=v(Xue=>{"use strict";Object.defineProperty(Xue,"__esModule",{value:!0});Xue.parseNativeEnumDef=void 0;function tgn(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}}Xue.parseNativeEnumDef=tgn});var HDe=v(Que=>{"use strict";Object.defineProperty(Que,"__esModule",{value:!0});Que.parseNeverDef=void 0;function rgn(){return{not:{}}}Que.parseNeverDef=rgn});var VDe=v(ele=>{"use strict";Object.defineProperty(ele,"__esModule",{value:!0});ele.parseNullDef=void 0;function ngn(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}ele.parseNullDef=ngn});var tle=v(GI=>{"use strict";Object.defineProperty(GI,"__esModule",{value:!0});GI.parseUnionDef=GI.primitiveMappings=void 0;var ogn=ml();GI.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ign(t,e){if(e.target==="openApi3")return I2t(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in GI.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=GI.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 I2t(t,e)}GI.parseUnionDef=ign;var I2t=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,ogn.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 WDe=v(rle=>{"use strict";Object.defineProperty(rle,"__esModule",{value:!0});rle.parseNullableDef=void 0;var M2t=ml(),R2t=tle();function agn(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:R2t.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[R2t.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,M2t.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,M2t.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}rle.parseNullableDef=agn});var KDe=v(nle=>{"use strict";Object.defineProperty(nle,"__esModule",{value:!0});nle.parseNumberDef=void 0;var JI=KI();function sgn(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,JI.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,JI.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,JI.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,JI.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,JI.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,JI.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,JI.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,JI.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}nle.parseNumberDef=sgn});var JDe=v(ole=>{"use strict";Object.defineProperty(ole,"__esModule",{value:!0});ole.parseObjectDef=void 0;var ugn=Te(),GDe=ml();function lgn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,GDe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,GDe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function cgn(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 ugn.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,GDe.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:lgn(t,e)};return n.required.length||delete n.required,n}ole.parseObjectDef=cgn});var YDe=v(ile=>{"use strict";Object.defineProperty(ile,"__esModule",{value:!0});ile.parseOptionalDef=void 0;var j2t=ml(),dgn=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,j2t.parseDef)(t.innerType._def,e);let r=(0,j2t.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};ile.parseOptionalDef=dgn});var ZDe=v(sle=>{"use strict";Object.defineProperty(sle,"__esModule",{value:!0});sle.parsePipelineDef=void 0;var ale=ml(),fgn=(t,e)=>{if(e.pipeStrategy==="input")return(0,ale.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,ale.parseDef)(t.out._def,e);let r=(0,ale.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,ale.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};sle.parsePipelineDef=fgn});var XDe=v(ule=>{"use strict";Object.defineProperty(ule,"__esModule",{value:!0});ule.parsePromiseDef=void 0;var pgn=ml();function mgn(t,e){return(0,pgn.parseDef)(t.type._def,e)}ule.parsePromiseDef=mgn});var QDe=v(lle=>{"use strict";Object.defineProperty(lle,"__esModule",{value:!0});lle.parseSetDef=void 0;var N2t=KI(),hgn=ml();function ggn(t,e){let n={type:"array",uniqueItems:!0,items:(0,hgn.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,N2t.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,N2t.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}lle.parseSetDef=ggn});var tLe=v(cle=>{"use strict";Object.defineProperty(cle,"__esModule",{value:!0});cle.parseTupleDef=void 0;var eLe=ml();function ygn(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,eLe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,eLe.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,eLe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}cle.parseTupleDef=ygn});var rLe=v(dle=>{"use strict";Object.defineProperty(dle,"__esModule",{value:!0});dle.parseUndefinedDef=void 0;function bgn(){return{not:{}}}dle.parseUndefinedDef=bgn});var nLe=v(fle=>{"use strict";Object.defineProperty(fle,"__esModule",{value:!0});fle.parseUnknownDef=void 0;function _gn(){return{}}fle.parseUnknownDef=_gn});var oLe=v(ple=>{"use strict";Object.defineProperty(ple,"__esModule",{value:!0});ple.parseReadonlyDef=void 0;var vgn=ml(),wgn=(t,e)=>(0,vgn.parseDef)(t.innerType._def,e);ple.parseReadonlyDef=wgn});var ml=v(mle=>{"use strict";Object.defineProperty(mle,"__esModule",{value:!0});mle.parseDef=void 0;var kn=Te(),Sgn=ADe(),xgn=IDe(),Cgn=MDe(),Ogn=RDe(),Pgn=Bue(),Egn=jDe(),Tgn=NDe(),Agn=DDe(),Ign=LDe(),Mgn=FDe(),Rgn=kDe(),jgn=$De(),Ngn=UDe(),Dgn=zDe(),Lgn=HDe(),Fgn=VDe(),kgn=WDe(),$gn=KDe(),Bgn=JDe(),qgn=YDe(),Ugn=ZDe(),zgn=XDe(),Hgn=Yue(),Vgn=QDe(),Wgn=Gue(),Kgn=tLe(),Ggn=rLe(),Jgn=tle(),Ygn=nLe(),Zgn=oLe(),Xgn=Rue();function D2t(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Xgn.ignoreOverride)return a}if(n&&!r){let a=Qgn(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=tyn(t,t.typeName,e);return i&&ryn(t,e,i),o.jsonSchema=i,i}mle.parseDef=D2t;var Qgn=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:eyn(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},eyn=(t,e)=>{let r=0;for(;r{switch(e){case kn.ZodFirstPartyTypeKind.ZodString:return(0,Wgn.parseStringDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodNumber:return(0,$gn.parseNumberDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodObject:return(0,Bgn.parseObjectDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodBigInt:return(0,Cgn.parseBigintDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodBoolean:return(0,Ogn.parseBooleanDef)();case kn.ZodFirstPartyTypeKind.ZodDate:return(0,Tgn.parseDateDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodUndefined:return(0,Ggn.parseUndefinedDef)();case kn.ZodFirstPartyTypeKind.ZodNull:return(0,Fgn.parseNullDef)(r);case kn.ZodFirstPartyTypeKind.ZodArray:return(0,xgn.parseArrayDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodUnion:case kn.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,Jgn.parseUnionDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodIntersection:return(0,Rgn.parseIntersectionDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodTuple:return(0,Kgn.parseTupleDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodRecord:return(0,Hgn.parseRecordDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodLiteral:return(0,jgn.parseLiteralDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodEnum:return(0,Mgn.parseEnumDef)(t);case kn.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,Dgn.parseNativeEnumDef)(t);case kn.ZodFirstPartyTypeKind.ZodNullable:return(0,kgn.parseNullableDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodOptional:return(0,qgn.parseOptionalDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodMap:return(0,Ngn.parseMapDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodSet:return(0,Vgn.parseSetDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodLazy:return D2t(t.getter()._def,r);case kn.ZodFirstPartyTypeKind.ZodPromise:return(0,zgn.parsePromiseDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodNaN:case kn.ZodFirstPartyTypeKind.ZodNever:return(0,Lgn.parseNeverDef)();case kn.ZodFirstPartyTypeKind.ZodEffects:return(0,Ign.parseEffectsDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodAny:return(0,Sgn.parseAnyDef)();case kn.ZodFirstPartyTypeKind.ZodUnknown:return(0,Ygn.parseUnknownDef)();case kn.ZodFirstPartyTypeKind.ZodDefault:return(0,Agn.parseDefaultDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodBranded:return(0,Pgn.parseBrandedDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodReadonly:return(0,Zgn.parseReadonlyDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodCatch:return(0,Egn.parseCatchDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodPipeline:return(0,Ugn.parsePipelineDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodFunction:case kn.ZodFirstPartyTypeKind.ZodVoid:case kn.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},ryn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var iLe=v(hle=>{"use strict";Object.defineProperty(hle,"__esModule",{value:!0});hle.zodToJsonSchema=void 0;var L2t=ml(),nyn=TDe(),oyn=(t,e)=>{let r=(0,nyn.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,L2t.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,L2t.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};hle.zodToJsonSchema=oyn});var F2t=v(Qr=>{"use strict";var iyn=Qr&&Qr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gn=Qr&&Qr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&iyn(e,t,r)};Object.defineProperty(Qr,"__esModule",{value:!0});Gn(Rue(),Qr);Gn(TDe(),Qr);Gn(KI(),Qr);Gn(ml(),Qr);Gn(ADe(),Qr);Gn(IDe(),Qr);Gn(MDe(),Qr);Gn(RDe(),Qr);Gn(Bue(),Qr);Gn(jDe(),Qr);Gn(NDe(),Qr);Gn(DDe(),Qr);Gn(LDe(),Qr);Gn(FDe(),Qr);Gn(kDe(),Qr);Gn($De(),Qr);Gn(UDe(),Qr);Gn(zDe(),Qr);Gn(HDe(),Qr);Gn(VDe(),Qr);Gn(WDe(),Qr);Gn(KDe(),Qr);Gn(JDe(),Qr);Gn(YDe(),Qr);Gn(ZDe(),Qr);Gn(XDe(),Qr);Gn(oLe(),Qr);Gn(Yue(),Qr);Gn(QDe(),Qr);Gn(Gue(),Qr);Gn(tLe(),Qr);Gn(rLe(),Qr);Gn(tle(),Qr);Gn(nLe(),Qr);Gn(iLe(),Qr);var ayn=iLe();Qr.default=ayn.zodToJsonSchema});var $2t=v(oW=>{"use strict";Object.defineProperty(oW,"__esModule",{value:!0});oW.transformToChatCompletionRequest=uyn;oW.convertToParsedChatCompletionResponse=lyn;oW.responseFormatFromZodObject=k2t;var syn=F2t();function uyn(t){let{responseFormat:e,...r}=t,n=k2t(e);return{...r,responseFormat:n}}function lyn(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 k2t(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,syn.zodToJsonSchema)(t),strict:!0}}}});var U2t=v(yle=>{"use strict";Object.defineProperty(yle,"__esModule",{value:!0});yle.Chat=void 0;var B2t=_2t(),q2t=S2t(),cyn=ah(),gle=Ig(),aLe=$2t(),sLe=class extends cyn.ClientSDK{async parse(e,r){let n=(0,aLe.transformToChatCompletionRequest)(e),o=await(0,gle.unwrapAsync)((0,B2t.chatComplete)(this,n,r));return(0,aLe.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,aLe.transformToChatCompletionRequest)(e);return(0,gle.unwrapAsync)((0,q2t.chatStream)(this,n,r))}async complete(e,r){return(0,gle.unwrapAsync)((0,B2t.chatComplete)(this,e,r))}async stream(e,r){return(0,gle.unwrapAsync)((0,q2t.chatStream)(this,e,r))}};yle.Chat=sLe});var V2t=v(MP=>{"use strict";var dyn=MP&&MP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fyn=MP&&MP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uLe=MP&&MP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dyn(e,t,r);return fyn(e,t),e};Object.defineProperty(MP,"__esModule",{value:!0});MP.classifiersModerate=byn;var pyn=ii(),iW=uLe(ai()),myn=Ue(),hyn=ve(),z2t=si(),gyn=To(),H2t=uLe(Fn()),yyn=uLe(uh());async function byn(t,e,r){let n=(0,hyn.safeParse)(e,y=>H2t.ClassificationRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,pyn.encodeJSON)("body",o,{explode:!0}),a=(0,gyn.pathToFunc)("/v1/moderations")(),s=new Headers((0,myn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,z2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,z2t.resolveGlobalSecurity)(l),d={operationID:"moderations_v1_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await iW.match(iW.json(200,H2t.ClassificationResponse$inboundSchema),iW.jsonErr(422,yyn.HTTPValidationError$inboundSchema),iW.fail("4XX"),iW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var G2t=v(RP=>{"use strict";var _yn=RP&&RP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vyn=RP&&RP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lLe=RP&&RP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_yn(e,t,r);return vyn(e,t),e};Object.defineProperty(RP,"__esModule",{value:!0});RP.classifiersModerateChat=Pyn;var wyn=ii(),aW=lLe(ai()),Syn=Ue(),xyn=ve(),W2t=si(),Cyn=To(),K2t=lLe(Fn()),Oyn=lLe(uh());async function Pyn(t,e,r){let n=(0,xyn.safeParse)(e,y=>K2t.ChatClassificationRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,wyn.encodeJSON)("body",o,{explode:!0}),a=(0,Cyn.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,Syn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,W2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,W2t.resolveGlobalSecurity)(l),d={operationID:"moderations_chat_v1_chat_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await aW.match(aW.json(200,K2t.ClassificationResponse$inboundSchema),aW.jsonErr(422,Oyn.HTTPValidationError$inboundSchema),aW.fail("4XX"),aW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var Y2t=v(ble=>{"use strict";Object.defineProperty(ble,"__esModule",{value:!0});ble.Classifiers=void 0;var Eyn=V2t(),Tyn=G2t(),Ayn=ah(),J2t=Ig(),cLe=class extends Ayn.ClientSDK{async moderate(e,r){return(0,J2t.unwrapAsync)((0,Eyn.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,J2t.unwrapAsync)((0,Tyn.classifiersModerateChat)(this,e,r))}};ble.Classifiers=cLe});var Q2t=v(jP=>{"use strict";var Iyn=jP&&jP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Myn=jP&&jP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dLe=jP&&jP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Iyn(e,t,r);return Myn(e,t),e};Object.defineProperty(jP,"__esModule",{value:!0});jP.embeddingsCreate=Fyn;var Ryn=ii(),sW=dLe(ai()),jyn=Ue(),Nyn=ve(),Z2t=si(),Dyn=To(),X2t=dLe(Fn()),Lyn=dLe(uh());async function Fyn(t,e,r){let n=(0,Nyn.safeParse)(e,y=>X2t.EmbeddingRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Ryn.encodeJSON)("body",o,{explode:!0}),a=(0,Dyn.pathToFunc)("/v1/embeddings")(),s=new Headers((0,jyn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,Z2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Z2t.resolveGlobalSecurity)(l),d={operationID:"embeddings_v1_embeddings_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await sW.match(sW.json(200,X2t.EmbeddingResponse$inboundSchema),sW.jsonErr(422,Lyn.HTTPValidationError$inboundSchema),sW.fail("4XX"),sW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var e4t=v(_le=>{"use strict";Object.defineProperty(_le,"__esModule",{value:!0});_le.Embeddings=void 0;var kyn=Q2t(),$yn=ah(),Byn=Ig(),fLe=class extends $yn.ClientSDK{async create(e,r){return(0,Byn.unwrapAsync)((0,kyn.embeddingsCreate)(this,e,r))}};_le.Embeddings=fLe});var r4t=v(NP=>{"use strict";var qyn=NP&&NP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Uyn=NP&&NP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pLe=NP&&NP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qyn(e,t,r);return Uyn(e,t),e};Object.defineProperty(NP,"__esModule",{value:!0});NP.filesDelete=Jyn;var zyn=ii(),vle=pLe(ai()),Hyn=Ue(),Vyn=ve(),t4t=si(),Wyn=To(),Kyn=pLe(Fn()),Gyn=pLe(pl());async function Jyn(t,e,r){let n=(0,Vyn.safeParse)(e,y=>Gyn.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,zyn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,Wyn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,Hyn.compactMap)({Accept:"application/json"})),l=await(0,t4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,t4t.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_delete_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await vle.match(vle.json(200,Kyn.DeleteFileOut$inboundSchema),vle.fail("4XX"),vle.fail("5XX"))(b);return g.ok,g}});var o4t=v(DP=>{"use strict";var Yyn=DP&&DP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zyn=DP&&DP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mLe=DP&&DP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Yyn(e,t,r);return Zyn(e,t),e};Object.defineProperty(DP,"__esModule",{value:!0});DP.filesDownload=obn;var Xyn=mLe(Te()),Qyn=ii(),wle=mLe(ai()),ebn=Ue(),tbn=ve(),n4t=si(),rbn=To(),nbn=mLe(pl());async function obn(t,e,r){let n=(0,tbn.safeParse)(e,y=>nbn.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,Qyn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,rbn.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,ebn.compactMap)({Accept:"application/octet-stream"})),l=await(0,n4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,n4t.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_download_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await wle.match(wle.stream(200,Xyn.instanceof(ReadableStream)),wle.fail("4XX"),wle.fail("5XX"))(b);return g.ok,g}});var s4t=v(LP=>{"use strict";var ibn=LP&&LP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),abn=LP&&LP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hLe=LP&&LP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ibn(e,t,r);return abn(e,t),e};Object.defineProperty(LP,"__esModule",{value:!0});LP.filesGetSignedUrl=fbn;var i4t=ii(),Sle=hLe(ai()),sbn=Ue(),ubn=ve(),a4t=si(),lbn=To(),cbn=hLe(Fn()),dbn=hLe(pl());async function fbn(t,e,r){let n=(0,ubn.safeParse)(e,S=>dbn.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,i4t.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,lbn.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,i4t.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,sbn.compactMap)({Accept:"application/json"})),c=await(0,a4t.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,a4t.resolveGlobalSecurity)(d),p={operationID:"files_api_routes_get_signed_url",oAuth2Scopes:[],resolvedSecurity:f,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},m=t._createRequest(p,{security:f,method:"GET",baseURL:r?.serverURL,path:s,headers:l,query:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!m.ok)return m;let h=m.value,b=await t._do(h,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!b.ok)return b;let g=b.value,[y]=await Sle.match(Sle.json(200,cbn.FileSignedURL$inboundSchema),Sle.fail("4XX"),Sle.fail("5XX"))(g);return y.ok,y}});var l4t=v(FP=>{"use strict";var pbn=FP&&FP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mbn=FP&&FP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gLe=FP&&FP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pbn(e,t,r);return mbn(e,t),e};Object.defineProperty(FP,"__esModule",{value:!0});FP.filesList=wbn;var hbn=ii(),xle=gLe(ai()),gbn=Ue(),ybn=ve(),u4t=si(),bbn=To(),_bn=gLe(Fn()),vbn=gLe(pl());async function wbn(t,e,r){let n=(0,ybn.safeParse)(e,y=>vbn.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,bbn.pathToFunc)("/v1/files")(),s=(0,hbn.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,gbn.compactMap)({Accept:"application/json"})),l=await(0,u4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,u4t.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_list_files",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await xle.match(xle.json(200,_bn.ListFilesOut$inboundSchema),xle.fail("4XX"),xle.fail("5XX"))(b);return g.ok,g}});var d4t=v(kP=>{"use strict";var Sbn=kP&&kP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xbn=kP&&kP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yLe=kP&&kP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Sbn(e,t,r);return xbn(e,t),e};Object.defineProperty(kP,"__esModule",{value:!0});kP.filesRetrieve=Ibn;var Cbn=ii(),Cle=yLe(ai()),Obn=Ue(),Pbn=ve(),c4t=si(),Ebn=To(),Tbn=yLe(Fn()),Abn=yLe(pl());async function Ibn(t,e,r){let n=(0,Pbn.safeParse)(e,y=>Abn.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,Cbn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,Ebn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,Obn.compactMap)({Accept:"application/json"})),l=await(0,c4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,c4t.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_retrieve_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Cle.match(Cle.json(200,Tbn.RetrieveFileOut$inboundSchema),Cle.fail("4XX"),Cle.fail("5XX"))(b);return g.ok,g}});var f4t=v(bLe=>{"use strict";Object.defineProperty(bLe,"__esModule",{value:!0});bLe.isReadableStream=Mbn;function Mbn(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 m4t=v($P=>{"use strict";var Rbn=$P&&$P.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jbn=$P&&$P.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Le=$P&&$P.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rbn(e,t,r);return jbn(e,t),e};Object.defineProperty($P,"__esModule",{value:!0});$P.filesUpload=Ubn;var Ole=ii(),Nbn=tNe(),Ple=_Le(ai()),Dbn=Ue(),Lbn=ve(),p4t=si(),Fbn=To(),kbn=_Le(Fn()),$bn=_Le(pl()),Bbn=wDe(),qbn=f4t();async function Ubn(t,e,r){let n=(0,Lbn.safeParse)(e,g=>$bn.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=new FormData;if((0,Bbn.isBlobLike)(o.file))(0,Ole.appendForm)(i,"file",o.file);else if((0,qbn.isReadableStream)(o.file.content)){let g=await(0,Nbn.readableStreamToArrayBuffer)(o.file.content),y=new Blob([g],{type:"application/octet-stream"});(0,Ole.appendForm)(i,"file",y)}else(0,Ole.appendForm)(i,"file",new Blob([o.file.content],{type:"application/octet-stream"}),o.file.fileName);o.purpose!==void 0&&(0,Ole.appendForm)(i,"purpose",o.purpose);let a=(0,Fbn.pathToFunc)("/v1/files")(),s=new Headers((0,Dbn.compactMap)({Accept:"application/json"})),u=await(0,p4t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,p4t.resolveGlobalSecurity)(l),d={operationID:"files_api_routes_upload_file",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[b]=await Ple.match(Ple.json(200,kbn.UploadFileOut$inboundSchema),Ple.fail("4XX"),Ple.fail("5XX"))(h);return b.ok,b}});var h4t=v(Ele=>{"use strict";Object.defineProperty(Ele,"__esModule",{value:!0});Ele.Files=void 0;var zbn=r4t(),Hbn=o4t(),Vbn=s4t(),Wbn=l4t(),Kbn=d4t(),Gbn=m4t(),Jbn=ah(),UU=Ig(),vLe=class extends Jbn.ClientSDK{async upload(e,r){return(0,UU.unwrapAsync)((0,Gbn.filesUpload)(this,e,r))}async list(e,r){return(0,UU.unwrapAsync)((0,Wbn.filesList)(this,e,r))}async retrieve(e,r){return(0,UU.unwrapAsync)((0,Kbn.filesRetrieve)(this,e,r))}async delete(e,r){return(0,UU.unwrapAsync)((0,zbn.filesDelete)(this,e,r))}async download(e,r){return(0,UU.unwrapAsync)((0,Hbn.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,UU.unwrapAsync)((0,Vbn.filesGetSignedUrl)(this,e,r))}};Ele.Files=vLe});var b4t=v(BP=>{"use strict";var Ybn=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]}),Zbn=BP&&BP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wLe=BP&&BP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ybn(e,t,r);return Zbn(e,t),e};Object.defineProperty(BP,"__esModule",{value:!0});BP.fimComplete=n_n;var Xbn=ii(),uW=wLe(ai()),Qbn=Ue(),e_n=ve(),g4t=si(),t_n=To(),y4t=wLe(Fn()),r_n=wLe(uh());async function n_n(t,e,r){let n=(0,e_n.safeParse)(e,y=>y4t.FIMCompletionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Xbn.encodeJSON)("body",o,{explode:!0}),a=(0,t_n.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,Qbn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,g4t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,g4t.resolveGlobalSecurity)(l),d={operationID:"fim_completion_v1_fim_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await uW.match(uW.json(200,y4t.FIMCompletionResponse$inboundSchema),uW.jsonErr(422,r_n.HTTPValidationError$inboundSchema),uW.fail("4XX"),uW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var w4t=v(qP=>{"use strict";var o_n=qP&&qP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i_n=qP&&qP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tle=qP&&qP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o_n(e,t,r);return i_n(e,t),e};Object.defineProperty(qP,"__esModule",{value:!0});qP.fimStream=p_n;var a_n=Tle(Te()),s_n=ii(),u_n=z5(),lW=Tle(ai()),l_n=Ue(),c_n=ve(),_4t=si(),d_n=To(),v4t=Tle(Fn()),f_n=Tle(uh());async function p_n(t,e,r){let n=(0,c_n.safeParse)(e,y=>v4t.FIMCompletionStreamRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,s_n.encodeJSON)("body",o,{explode:!0}),a=(0,d_n.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,l_n.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,_4t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,_4t.resolveGlobalSecurity)(l),d={operationID:"stream_fim",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await lW.match(lW.sse(200,a_n.instanceof(ReadableStream).transform(y=>new u_n.EventStream({stream:y,decoder(S){return v4t.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),lW.jsonErr(422,f_n.HTTPValidationError$inboundSchema),lW.fail("4XX"),lW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var x4t=v(Ale=>{"use strict";Object.defineProperty(Ale,"__esModule",{value:!0});Ale.Fim=void 0;var m_n=b4t(),h_n=w4t(),g_n=ah(),S4t=Ig(),SLe=class extends g_n.ClientSDK{async complete(e,r){return(0,S4t.unwrapAsync)((0,m_n.fimComplete)(this,e,r))}async stream(e,r){return(0,S4t.unwrapAsync)((0,h_n.fimStream)(this,e,r))}};Ale.Fim=SLe});var O4t=v(UP=>{"use strict";var y_n=UP&&UP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),b_n=UP&&UP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xLe=UP&&UP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&y_n(e,t,r);return b_n(e,t),e};Object.defineProperty(UP,"__esModule",{value:!0});UP.fineTuningJobsCancel=O_n;var __n=ii(),Ile=xLe(ai()),v_n=Ue(),w_n=ve(),C4t=si(),S_n=To(),x_n=xLe(Fn()),C_n=xLe(pl());async function O_n(t,e,r){let n=(0,w_n.safeParse)(e,y=>C_n.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,__n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,S_n.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,v_n.compactMap)({Accept:"application/json"})),l=await(0,C4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,C4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_cancel_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Ile.match(Ile.json(200,x_n.DetailedJobOut$inboundSchema),Ile.fail("4XX"),Ile.fail("5XX"))(b);return g.ok,g}});var E4t=v(zP=>{"use strict";var P_n=zP&&zP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E_n=zP&&zP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CLe=zP&&zP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P_n(e,t,r);return E_n(e,t),e};Object.defineProperty(zP,"__esModule",{value:!0});zP.fineTuningJobsCreate=N_n;var T_n=ii(),Mle=CLe(ai()),A_n=Ue(),I_n=ve(),P4t=si(),M_n=To(),R_n=CLe(Fn()),j_n=CLe(pl());async function N_n(t,e,r){let n=(0,I_n.safeParse)(e,g=>R_n.JobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,T_n.encodeJSON)("body",o,{explode:!0}),a=(0,M_n.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,A_n.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,P4t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,P4t.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_fine_tuning_create_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[b]=await Mle.match(Mle.json(200,j_n.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),Mle.fail("4XX"),Mle.fail("5XX"))(h);return b.ok,b}});var A4t=v(HP=>{"use strict";var D_n=HP&&HP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L_n=HP&&HP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OLe=HP&&HP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&D_n(e,t,r);return L_n(e,t),e};Object.defineProperty(HP,"__esModule",{value:!0});HP.fineTuningJobsGet=z_n;var F_n=ii(),Rle=OLe(ai()),k_n=Ue(),$_n=ve(),T4t=si(),B_n=To(),q_n=OLe(Fn()),U_n=OLe(pl());async function z_n(t,e,r){let n=(0,$_n.safeParse)(e,y=>U_n.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,F_n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,B_n.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,k_n.compactMap)({Accept:"application/json"})),l=await(0,T4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,T4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Rle.match(Rle.json(200,q_n.DetailedJobOut$inboundSchema),Rle.fail("4XX"),Rle.fail("5XX"))(b);return g.ok,g}});var M4t=v(VP=>{"use strict";var H_n=VP&&VP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V_n=VP&&VP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PLe=VP&&VP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&H_n(e,t,r);return V_n(e,t),e};Object.defineProperty(VP,"__esModule",{value:!0});VP.fineTuningJobsList=X_n;var W_n=ii(),jle=PLe(ai()),K_n=Ue(),G_n=ve(),I4t=si(),J_n=To(),Y_n=PLe(Fn()),Z_n=PLe(pl());async function X_n(t,e,r){let n=(0,G_n.safeParse)(e,y=>Z_n.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,J_n.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,W_n.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,K_n.compactMap)({Accept:"application/json"})),l=await(0,I4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,I4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await jle.match(jle.json(200,Y_n.JobsOut$inboundSchema),jle.fail("4XX"),jle.fail("5XX"))(b);return g.ok,g}});var j4t=v(WP=>{"use strict";var Q_n=WP&&WP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),evn=WP&&WP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ELe=WP&&WP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Q_n(e,t,r);return evn(e,t),e};Object.defineProperty(WP,"__esModule",{value:!0});WP.fineTuningJobsStart=svn;var tvn=ii(),Nle=ELe(ai()),rvn=Ue(),nvn=ve(),R4t=si(),ovn=To(),ivn=ELe(Fn()),avn=ELe(pl());async function svn(t,e,r){let n=(0,nvn.safeParse)(e,y=>avn.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,tvn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,ovn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,rvn.compactMap)({Accept:"application/json"})),l=await(0,R4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,R4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_start_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Nle.match(Nle.json(200,ivn.DetailedJobOut$inboundSchema),Nle.fail("4XX"),Nle.fail("5XX"))(b);return g.ok,g}});var N4t=v(Dle=>{"use strict";Object.defineProperty(Dle,"__esModule",{value:!0});Dle.Jobs=void 0;var uvn=O4t(),lvn=E4t(),cvn=A4t(),dvn=M4t(),fvn=j4t(),pvn=ah(),cW=Ig(),TLe=class extends pvn.ClientSDK{async list(e,r){return(0,cW.unwrapAsync)((0,dvn.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,cW.unwrapAsync)((0,lvn.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,cW.unwrapAsync)((0,cvn.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,cW.unwrapAsync)((0,uvn.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,cW.unwrapAsync)((0,fvn.fineTuningJobsStart)(this,e,r))}};Dle.Jobs=TLe});var D4t=v(Lle=>{"use strict";Object.defineProperty(Lle,"__esModule",{value:!0});Lle.FineTuning=void 0;var mvn=ah(),hvn=N4t(),ALe=class extends mvn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new hvn.Jobs(this._options))}};Lle.FineTuning=ALe});var F4t=v(KP=>{"use strict";var gvn=KP&&KP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yvn=KP&&KP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ILe=KP&&KP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gvn(e,t,r);return yvn(e,t),e};Object.defineProperty(KP,"__esModule",{value:!0});KP.modelsArchive=Cvn;var bvn=ii(),Fle=ILe(ai()),_vn=Ue(),vvn=ve(),L4t=si(),wvn=To(),Svn=ILe(Fn()),xvn=ILe(pl());async function Cvn(t,e,r){let n=(0,vvn.safeParse)(e,y=>xvn.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,bvn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,wvn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,_vn.compactMap)({Accept:"application/json"})),l=await(0,L4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,L4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_archive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Fle.match(Fle.json(200,Svn.ArchiveFTModelOut$inboundSchema),Fle.fail("4XX"),Fle.fail("5XX"))(b);return g.ok,g}});var $4t=v(GP=>{"use strict";var Ovn=GP&&GP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pvn=GP&&GP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kle=GP&&GP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ovn(e,t,r);return Pvn(e,t),e};Object.defineProperty(GP,"__esModule",{value:!0});GP.modelsDelete=Nvn;var Evn=ii(),dW=kle(ai()),Tvn=Ue(),Avn=ve(),k4t=si(),Ivn=To(),Mvn=kle(Fn()),Rvn=kle(uh()),jvn=kle(pl());async function Nvn(t,e,r){let n=(0,Avn.safeParse)(e,S=>jvn.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Evn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Ivn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Tvn.compactMap)({Accept:"application/json"})),l=await(0,k4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,k4t.resolveGlobalSecurity)(c),f={operationID:"delete_model_v1_models__model_id__delete",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,g={HttpMeta:{Response:b,Request:m}},[y]=await dW.match(dW.json(200,Mvn.DeleteModelOut$inboundSchema),dW.jsonErr(422,Rvn.HTTPValidationError$inboundSchema),dW.fail("4XX"),dW.fail("5XX"))(b,{extraFields:g});return y.ok,y}});var q4t=v(JP=>{"use strict";var Dvn=JP&&JP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lvn=JP&&JP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MLe=JP&&JP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Dvn(e,t,r);return Lvn(e,t),e};Object.defineProperty(JP,"__esModule",{value:!0});JP.modelsList=qvn;var fW=MLe(ai()),Fvn=Ue(),B4t=si(),kvn=To(),$vn=MLe(Fn()),Bvn=MLe(uh());async function qvn(t,e){let r=(0,kvn.pathToFunc)("/v1/models")(),n=new Headers((0,Fvn.compactMap)({Accept:"application/json"})),o=await(0,B4t.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,B4t.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 fW.match(fW.json(200,$vn.ModelList$inboundSchema),fW.jsonErr(422,Bvn.HTTPValidationError$inboundSchema),fW.fail("4XX"),fW.fail("5XX"))(d,{extraFields:f});return p.ok,p}});var H4t=v(YP=>{"use strict";var Uvn=YP&&YP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zvn=YP&&YP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RLe=YP&&YP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Uvn(e,t,r);return zvn(e,t),e};Object.defineProperty(YP,"__esModule",{value:!0});YP.modelsRetrieve=Jvn;var Hvn=ii(),pW=RLe(ai()),Vvn=Ue(),Wvn=ve(),U4t=si(),Kvn=To(),Gvn=RLe(uh()),z4t=RLe(pl());async function Jvn(t,e,r){let n=(0,Wvn.safeParse)(e,S=>z4t.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Hvn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Kvn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Vvn.compactMap)({Accept:"application/json"})),l=await(0,U4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,U4t.resolveGlobalSecurity)(c),f={operationID:"retrieve_model_v1_models__model_id__get",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,g={HttpMeta:{Response:b,Request:m}},[y]=await pW.match(pW.json(200,z4t.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),pW.jsonErr(422,Gvn.HTTPValidationError$inboundSchema),pW.fail("4XX"),pW.fail("5XX"))(b,{extraFields:g});return y.ok,y}});var W4t=v(ZP=>{"use strict";var Yvn=ZP&&ZP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zvn=ZP&&ZP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jLe=ZP&&ZP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Yvn(e,t,r);return Zvn(e,t),e};Object.defineProperty(ZP,"__esModule",{value:!0});ZP.modelsUnarchive=own;var Xvn=ii(),$le=jLe(ai()),Qvn=Ue(),ewn=ve(),V4t=si(),twn=To(),rwn=jLe(Fn()),nwn=jLe(pl());async function own(t,e,r){let n=(0,ewn.safeParse)(e,y=>nwn.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Xvn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,twn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,Qvn.compactMap)({Accept:"application/json"})),l=await(0,V4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,V4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_unarchive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await $le.match($le.json(200,rwn.UnarchiveFTModelOut$inboundSchema),$le.fail("4XX"),$le.fail("5XX"))(b);return g.ok,g}});var J4t=v(XP=>{"use strict";var iwn=XP&&XP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),awn=XP&&XP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NLe=XP&&XP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iwn(e,t,r);return awn(e,t),e};Object.defineProperty(XP,"__esModule",{value:!0});XP.modelsUpdate=fwn;var K4t=ii(),Ble=NLe(ai()),swn=Ue(),uwn=ve(),G4t=si(),lwn=To(),cwn=NLe(Fn()),dwn=NLe(pl());async function fwn(t,e,r){let n=(0,uwn.safeParse)(e,y=>dwn.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,K4t.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,K4t.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,lwn.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,swn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,G4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,G4t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_update_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"PATCH",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Ble.match(Ble.json(200,cwn.FTModelOut$inboundSchema),Ble.fail("4XX"),Ble.fail("5XX"))(b);return g.ok,g}});var Y4t=v(qle=>{"use strict";Object.defineProperty(qle,"__esModule",{value:!0});qle.Models=void 0;var pwn=F4t(),mwn=$4t(),hwn=q4t(),gwn=H4t(),ywn=W4t(),bwn=J4t(),_wn=ah(),zU=Ig(),DLe=class extends _wn.ClientSDK{async list(e){return(0,zU.unwrapAsync)((0,hwn.modelsList)(this,e))}async retrieve(e,r){return(0,zU.unwrapAsync)((0,gwn.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,zU.unwrapAsync)((0,mwn.modelsDelete)(this,e,r))}async update(e,r){return(0,zU.unwrapAsync)((0,bwn.modelsUpdate)(this,e,r))}async archive(e,r){return(0,zU.unwrapAsync)((0,pwn.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,zU.unwrapAsync)((0,ywn.modelsUnarchive)(this,e,r))}};qle.Models=DLe});var Z4t=v(Ule=>{"use strict";Object.defineProperty(Ule,"__esModule",{value:!0});Ule.Mistral=void 0;var vwn=ah(),wwn=qUt(),Swn=g2t(),xwn=U2t(),Cwn=Y2t(),Own=e4t(),Pwn=h4t(),Ewn=x4t(),Twn=D4t(),Awn=Y4t(),LLe=class extends vwn.ClientSDK{get models(){return this._models??(this._models=new Awn.Models(this._options))}get files(){return this._files??(this._files=new Pwn.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new Twn.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new Swn.Batch(this._options))}get chat(){return this._chat??(this._chat=new xwn.Chat(this._options))}get fim(){return this._fim??(this._fim=new Ewn.Fim(this._options))}get agents(){return this._agents??(this._agents=new wwn.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new Own.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new Cwn.Classifiers(this._options))}};Ule.Mistral=LLe});var e3t=v(om=>{"use strict";var X4t=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]}),Iwn=om&&om.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q4t=om&&om.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&X4t(e,t,r)},Mwn=om&&om.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&X4t(e,t,r);return Iwn(e,t),e};Object.defineProperty(om,"__esModule",{value:!0});om.files=void 0;Q4t(kae(),om);om.files=Mwn(tNe());Q4t(Z4t(),om)});var p3t=w(()=>{LE()});var m3t=w(()=>{Qd();p3t();Sm();Wm()});var h3t=w(()=>{gy()});var KLe=w(()=>{Wm();qE();Sm();m3t();h3t()});var g3t={};Cf(g3t,{AutocompleteCache:()=>SW});var SW,GLe=w(()=>{yo();SW=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()}),ie(`[AutocompleteCache] Cached response for key: ${e.slice(0,50)}...`)}clear(){this.cache.clear(),ie("[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 Y6t=v((Lci,J6t)=>{"use strict";var dOn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";J6t.exports=dOn});var e5t=v((Fci,Q6t)=>{"use strict";var fOn=Y6t();function Z6t(){}function X6t(){}X6t.resetWarningCache=Z6t;Q6t.exports=function(){function t(n,o,i,a,s,u){if(u!==fOn){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:X6t,resetWarningCache:Z6t};return r.PropTypes=r,r}});var r5t=v((Bci,t5t)=>{t5t.exports=e5t()();var kci,$ci});var u5t=v(jke=>{"use strict";jke.__esModule=!0;jke.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 i1n={};Cf(i1n,{default:()=>$fe});module.exports=zl(i1n);mg();Cl();yo();var S1t=F(wq()),Cq=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)||(ie("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,S1t.MD5)(n).toString()}getCachePath(e){return`${this.cacheDir}/${e}.md`}async get(e){try{let r=this.memoryCache.get(e);if(r)return ie("Memory cache hit for file:",e),r.content;let n=this.getCachePath(e);if(await app.vault.adapter.exists(n)){ie("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 ie("Cache miss for file:",e),null}catch(r){return fe("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),ie("Cached file content:",e)}catch(n){fe("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),ie("Removed file from cache:",e))}catch(r){fe("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);ie("Clearing file cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){fe("Error clearing file cache:",e)}}};yo();_g();nr();var P1t=F(wq()),lie=require("obsidian"),E1t=F(XRe()),nI=class nI{constructor(){this.cacheDir=".copilot/project-context-cache";this.memoryCache=new Map;this.handleFileEvent=e=>{e instanceof lie.TFile&&this.debouncedHandleFileChange(e)};this.handleFileChange=async e=>{try{if(e.extension!=="md")return;let n=ue().projectList||[];for(let o of n){let{inclusions:i,exclusions:a}=rf({inclusions:o.contextSource.inclusions,exclusions:o.contextSource.exclusions,isProject:!0});eu(e,i,a)&&(await this.invalidateMarkdownContext(o),ie(`Invalidated markdown context for project ${o.name} due to file change: ${e.path}`))}}catch(r){fe("Error handling file change for project context cache:",r)}};this.debouncedHandleFileChange=(0,E1t.default)(e=>{this.handleFileChange(e)},nI.DEBOUNCE_DELAY,{leading:!0,trailing:!0});this.vault=app.vault,this.fileCache=Cq.getInstance(),this.initializeEventListeners()}static getInstance(){return nI.instance||(nI.instance=new nI),nI.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)}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)||(ie("Creating project context cache directory:",this.cacheDir),await this.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){return(0,P1t.MD5)(e.id).toString()}getCachePath(e){return`${this.cacheDir}/${e}.json`}async get(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);if(n)return ie("Memory cache hit for project:",e.name),n;let o=this.getCachePath(r);if(await this.vault.adapter.exists(o)){ie("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 ie("Cache miss for project:",e.name),null}catch(r){return fe("Error reading from project context cache:",r),null}}getSync(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);return n?(ie("Memory cache hit for project:",e.name),n):(ie("Memory cache miss for project:",e.name),null)}catch(r){return fe("Error reading from project context memory cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);ie("Caching context for project:",e.name),this.memoryCache.set(n,r),await this.vault.adapter.write(o,JSON.stringify(r))}catch(n){fe("Error writing to project context cache:",n)}}createEmptyCache(){return{markdownContext:"",webContexts:{},youtubeContexts:{},fileContexts:{},timestamp:Date.now(),markdownNeedsReload:!1}}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);ie("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);ie(`Cleared ${e.size} file content cache entries associated with projects`)}catch(e){fe("Error clearing project context cache:",e)}}async clearForProject(e){try{ie(`[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){ie(`[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++):Mh(`[clearForProject] Project ${e.name}: Skipped removing FileCache entry for file ${s} due to missing cacheKey.`)}ie(`[clearForProject] Project ${e.name}: Attempted to clear ${o} entries from FileCache.`)}}else ie(`[clearForProject] Project ${e.name}: No fileContexts found in existing project cache to clear from FileCache.`);this.memoryCache.delete(r),ie(`[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),ie(`[clearForProject] Project ${e.name}: Successfully removed main project cache file: ${i}`)):ie(`[clearForProject] Project ${e.name}: Main project cache file not found (already deleted or never existed): ${i}`),ie(`[clearForProject] Completed for project: ${e.name}`)}catch(r){fe(`[clearForProject] Error for project ${e.name} (ID: ${e.id}):`,r)}}async invalidateMarkdownContext(e,r=!1){let n=await this.get(e);n&&(n.markdownContext="",n.markdownNeedsReload=!0,r&&(n.webContexts={},n.youtubeContexts={},ie(`Flagged Web/YouTube contexts for full reload for project ${e.name}`)),await this.set(e,n),await this.cleanupProjectFileReferences(e),ie(`Invalidated markdown context for project ${e.name}`))}async updateMarkdownContext(e,r){let n=await this.get(e)||this.createEmptyCache();n.markdownContext=r,n.markdownNeedsReload=!1,await this.set(e,n),ie(`Updated markdown context for project ${e.name}`)}async clearMarkdownContext(e){let r=await this.get(e);r&&(r.markdownContext="",r.markdownNeedsReload=!0,await this.set(e,r))}async getFileContext(e,r){try{if(!r||typeof r!="string")return fe("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 Mh(`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"?(Mh(`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 fe(`Error getting file context for ${r} in project ${e.name}:`,n),null}}async setFileContext(e,r,n){try{let o=await this.get(e)||this.createEmptyCache();o.fileContexts||(o.fileContexts={});let i=this.vault.getAbstractFileByPath(r);if(!(i instanceof lie.TFile))throw new Error(`File not found: ${r}`);let a=this.fileCache.getCacheKey(i,e.id);await this.fileCache.set(a,n),o.fileContexts[r]={timestamp:Date.now(),cacheKey:a},await this.set(e,o),ie(`Added/updated file context for ${r} in project ${e.name}`)}catch(o){fe(`Error setting file context for ${r}:`,o)}}async removeFileContext(e,r){try{let n=await this.get(e);if(n&&n.fileContexts[r]){let{cacheKey:o}=n.fileContexts[r];delete n.fileContexts[r],await this.set(e,n),await this.fileCache.remove(o),ie(`Removed file context for ${r} in project ${e.name}`)}}catch(n){fe(`Error removing file context for ${r}:`,n)}}async cleanupProjectFileReferences(e){try{let r=await this.get(e);if(!r||!r.fileContexts)return;let{inclusions:n,exclusions:o}=rf({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 lie.TFile)||!eu(u,n,o)?i++:a[s]=r.fileContexts[s]}i>0&&(r.fileContexts=a,await this.set(e,r),ie(`Removed ${i} file references from project ${e.name} that no longer match inclusion patterns`))}catch(r){fe(`Error cleaning up project file references for ${e.name}:`,r)}}async updateProjectFilesFromPatterns(e,r){try{ie(`[updateProjectFilesFromPatterns] Starting for project: ${e.name}`),r.fileContexts||(r.fileContexts={});let{inclusions:n,exclusions:o}=rf({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=this.vault.getFiles(),a=0;for(let s of i)if(eu(s,n,o)){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&&ie(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${a} new file references to context (in memory).`),ie(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(n){fe(`[updateProjectFilesFromPatterns] Error for project ${e.name}:`,n)}return r}async removeWebUrl(e,r){let n=await this.get(e);n?.webContexts?.[r]&&(delete n.webContexts[r],await this.set(e,n),ie(`Removed web context for URL ${r} in project ${e.name}`))}async updateWebUrl(e,r,n){let o=await this.get(e)||this.createEmptyCache();o.webContexts||(o.webContexts={}),o.webContexts[r]=n,await this.set(e,o),ie(`Updated web context for URL ${r} in project ${e.name}`)}async removeYoutubeUrl(e,r){let n=await this.get(e);n?.youtubeContexts?.[r]&&(delete n.youtubeContexts[r],await this.set(e,n),ie(`Removed YouTube context for URL ${r} in project ${e.name}`))}async updateYoutubeUrl(e,r,n){let o=await this.get(e)||this.createEmptyCache();o.youtubeContexts||(o.youtubeContexts={}),o.youtubeContexts[r]=n,await this.set(e,o),ie(`Updated YouTube context for URL ${r} in project ${e.name}`)}};nI.DEBOUNCE_DELAY=5e3;var tb=nI;Fd();$r();yn();function T1t(t){let e=t.split(` +`),r=[],n="",o="",i="";for(let a of e)a.startsWith("**user**:")||a.startsWith("**ai**:")?(n&&o&&r.push({sender:n===Pi?Pi:e_,message:o.trim(),isVisible:!0,timestamp:i?Qhe(i):null}),n=a.startsWith("**user**:")?Pi:e_,o=a.substring(a.indexOf(":")+1).trim(),i=""):a.startsWith("[Timestamp:")?i=a.substring(11,a.length-1).trim():o+=` +`+a;return n&&o&&r.push({sender:n===Pi?Pi:e_,message:o.trim(),isVisible:!0,timestamp:i?Qhe(i):null}),r}async function vN(t,e){await e.clearChatMemory();for(let r=0;ru&&s>-1&&(n=a.substring(s+1).toLowerCase()),n&&!this.IMAGE_EXTENSIONS.some(c=>c.toLowerCase()===`.${n}`))return fe(`Unsupported image format from URL path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;try{let c=(await Us(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?(fe(`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 wN.TFile?i.stat.size>this.MAX_IMAGE_SIZE?(fe(`Vault file too large: ${i.stat.size} bytes for path: ${e}`),!1):!0:(fe(`File with image extension not found in vault: ${e}.`),!1)}else return n&&fe(`Unsupported image format for potential vault path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;return fe(`Could not determine image status for URL/path: ${e}`),!1}catch(n){return fe(`Unexpected error in isImageUrl for "${e}":`,n),!1}}static async handleVaultImage(e,r){try{if(e.stat.size>this.MAX_IMAGE_SIZE)return fe(`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 fe(`Invalid MIME type: ${o}, skipping: ${e.path}`),null;let a=Buffer.from(n).toString("base64");return`data:${o};base64,${a}`}catch(n){return fe("Error processing vault image:",n),null}}static async handleWebImage(e){try{let r=await Us(e,{method:"GET",headers:{}});if(!r.ok)return fe(`Failed to fetch image: ${r.statusText}, URL: ${e}`),null;let n=r.headers.get("content-type");if(!n?.startsWith("image/"))return fe(`Invalid content type: ${n}, URL: ${e}`),null;let o=await r.arrayBuffer();if(o.byteLength>this.MAX_IMAGE_SIZE)return fe(`Image too large: ${o.byteLength} bytes, URL: ${e}`),null;let a=Buffer.from(o).toString("base64");return`data:${n};base64,${a}`}catch(r){return fe("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 wN.TFile))return fe(`Local image not found: ${n}`),null;if(o.stat.size>this.MAX_IMAGE_SIZE)return fe(`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 fe(`Invalid MIME type: ${a}, path: ${n}`),null;let u=Buffer.from(i).toString("base64");return`data:${a};base64,${u}`}catch(n){return fe("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 wN.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 wN.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}}:(fe(`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 fe(i),new Error(i)}return o}};Rx.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],Rx.MAX_IMAGE_SIZE=3*1024*1024,Rx.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};var SN=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 fe("Error processing URL batch:",o),{successfulImages:[],failureDescriptions:e.map(i=>`Image read failed for: ${i}`)}}}static async processSingleUrl(e,r,n){try{if(!await Rx.isImageUrl(e,n))return null;let o=await Rx.convertToBase64(e,n);return o||(r.push(e),null)}catch(o){return fe(`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){fe("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 Rx.convertToBase64(e.image_url.url,n);return o||(r.push(e.image_url.url),null)}catch(o){return fe(`Failed to process chat image: ${e.image_url.url}`,o),r.push(e.image_url.url),null}}static showFailedImagesNotice(e){e.length>0&&new wN.Notice(`Failed to process images: ${e.join(` -`)}`)}};mg();Cn();var Cq=class t{constructor(){this.mentions=new Map,this.brevilabsClient=Fi.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=>!gVe(n))}async processUrl(e){try{return await this.brevilabsClient.url4llm(e)}catch(r){return console.error(`Error processing URL ${e}:`,r),{response:e,elapsed_time_ms:0}}}async processUrls(e){let r=this.extractUrls(e),n="",o=[];if(r.length===0)return{urlContext:"",imageUrls:[]};let i=r.map(async s=>{if(await Mx.isImageUrl(s,app.vault))return o.push(s),null;if(!this.mentions.has(s)){let u=await this.processUrl(s);this.mentions.set(s,{type:"url",original:s,processed:u.response})}return this.mentions.get(s)});return(await Promise.all(i)).forEach(s=>{s?.processed&&(n+=` +`)}`)}};mg();yn();var Oq=class t{constructor(){this.mentions=new Map,this.brevilabsClient=Fi.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=>!bVe(n))}async processUrl(e){try{return await this.brevilabsClient.url4llm(e)}catch(r){return console.error(`Error processing URL ${e}:`,r),{response:e,elapsed_time_ms:0}}}async processUrls(e){let r=this.extractUrls(e),n="",o=[];if(r.length===0)return{urlContext:"",imageUrls:[]};let i=r.map(async s=>{if(await Rx.isImageUrl(s,app.vault))return o.push(s),null;if(!this.mentions.has(s)){let u=await this.processUrl(s);this.mentions.set(s,{type:"url",original:s,processed:u.response})}return this.mentions.get(s)});return(await Promise.all(i)).forEach(s=>{s?.processed&&(n+=` Content from ${s.original}: -${s.processed}`)}),{urlContext:n,imageUrls:o}}getMentions(){return this.mentions}clearMentions(){this.mentions.clear()}};_g();nr();yo();var C1t=F(vq()),sie=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)||(ie("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,C1t.MD5)(r).toString();return ie("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)){ie("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return ie("Cache miss for PDF:",e.path),null}catch(r){return fe("Error reading from PDF cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);ie("Caching PDF response for:",e.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){fe("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);ie("Clearing PDF cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){fe("Error clearing PDF cache:",e)}}};yo();function SN(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 O1t(t){let r=(t?.message||t?.toString()||"").match(/Try again in ([\d\w\s]+)/);return r?r[1]:"some time"}var T1t=require("obsidian");var P1t=require("obsidian");var lie,E1t,uie=class{constructor(e){this.vault=e;pUe(this,lie)}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 P1t.TFile?await this.vault.cachedRead(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];mUe(this,lie,E1t).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: +${s.processed}`)}),{urlContext:n,imageUrls:o}}getMentions(){return this.mentions}clearMentions(){this.mentions.clear()}};_g();nr();yo();var A1t=F(wq()),cie=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)||(ie("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,A1t.MD5)(r).toString();return ie("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)){ie("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return ie("Cache miss for PDF:",e.path),null}catch(r){return fe("Error reading from PDF cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);ie("Caching PDF response for:",e.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){fe("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);ie("Clearing PDF cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){fe("Error clearing PDF cache:",e)}}};yo();function xN(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 I1t(t){let r=(t?.message||t?.toString()||"").match(/Try again in ([\d\w\s]+)/);return r?r[1]:"some time"}var j1t=require("obsidian");var M1t=require("obsidian");var fie,R1t,die=class{constructor(e){this.vault=e;hUe(this,fie)}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 M1t.TFile?await this.vault.cachedRead(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];gUe(this,fie,R1t).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: @@ -557,9 +557,9 @@ 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}};lie=new WeakSet,E1t=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 ZRe=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},cie=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=sie.getInstance()}async parseFile(e,r){try{ie("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return ie("Using cached PDF content for:",e.path),n.response;let o=await r.readBinary(e);ie("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 fe(`Error extracting content from PDF ${e.path}:`,n),`[Error: Could not extract content from PDF ${e.basename}]`}}async clearCache(){ie("Clearing PDF cache"),await this.pdfCache.clear()}},XRe=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{ie("Parsing Canvas file:",e.path);let n=new uie(r),o=await n.load(e);return n.buildPrompt(o)}catch(n){return fe(`Error parsing Canvas file ${e.path}:`,n),`[Error: Could not parse Canvas file ${e.basename}]`}}},Oq=class Oq{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=tb.getInstance(),this.currentProject=r}static resetRateLimitNoticeTimer(){Oq.lastRateLimitNoticeTime=0}async parseFile(e,r){try{if(ie(`[Docs4LLMParser] Project ${this.currentProject?.name}: Parsing ${e.extension} file: ${e.path}`),!this.currentProject)throw fe("[Docs4LLMParser] No project context for parsing file: ",e.path),new Error("No project context provided for file parsing");let n=await this.projectContextCache.getFileContext(this.currentProject,e.path);if(n)return ie(`[Docs4LLMParser] Project ${this.currentProject.name}: Using cached content for: ${e.path}`),n;ie(`[Docs4LLMParser] Project ${this.currentProject.name}: Cache miss for: ${e.path}. Proceeding to API call.`);let o=await r.readBinary(e);ie(`[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(` +`,o}};fie=new WeakSet,R1t=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 QRe=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},pie=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=cie.getInstance()}async parseFile(e,r){try{ie("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return ie("Using cached PDF content for:",e.path),n.response;let o=await r.readBinary(e);ie("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 fe(`Error extracting content from PDF ${e.path}:`,n),`[Error: Could not extract content from PDF ${e.basename}]`}}async clearCache(){ie("Clearing PDF cache"),await this.pdfCache.clear()}},e1e=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{ie("Parsing Canvas file:",e.path);let n=new die(r),o=await n.load(e);return n.buildPrompt(o)}catch(n){return fe(`Error parsing Canvas file ${e.path}:`,n),`[Error: Could not parse Canvas file ${e.basename}]`}}},Pq=class Pq{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=tb.getInstance(),this.currentProject=r}static resetRateLimitNoticeTimer(){Pq.lastRateLimitNoticeTime=0}async parseFile(e,r){try{if(ie(`[Docs4LLMParser] Project ${this.currentProject?.name}: Parsing ${e.extension} file: ${e.path}`),!this.currentProject)throw fe("[Docs4LLMParser] No project context for parsing file: ",e.path),new Error("No project context provided for file parsing");let n=await this.projectContextCache.getFileContext(this.currentProject,e.path);if(n)return ie(`[Docs4LLMParser] Project ${this.currentProject.name}: Using cached content for: ${e.path}`),n;ie(`[Docs4LLMParser] Project ${this.currentProject.name}: Cache miss for: ${e.path}. Proceeding to API call.`);let o=await r.readBinary(e);ie(`[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),ie(`[Docs4LLMParser] Project ${this.currentProject.name}: Successfully processed and cached: ${e.path}`),a}catch(n){throw fe(`[Docs4LLMParser] Project ${this.currentProject?.name}: Error processing file ${e.path}:`,n),SN(n)&&this.showRateLimitNotice(n),n}}showRateLimitNotice(e){let r=Date.now();if(r-Oq.lastRateLimitNoticeTime<6e4)return;Oq.lastRateLimitNoticeTime=r;let n=O1t(e);new T1t.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(){ie("Cache clearing is now handled at the project level")}};Oq.lastRateLimitNoticeTime=0;var z8=Oq,oI=class{constructor(e,r,n=!1,o=null){this.parsers=new Map;this.isProjectMode=n,this.currentProject=o,this.registerParser(new ZRe),this.registerParser(new z8(e,o)),n||this.registerParser(new cie(e)),this.registerParser(new XRe)}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 cie&&await e.clearCache()}};Cn();var vW=require("obsidian");mg();Cl();Fd();$r();Cl();Cn();async function die(t,e){let r=`Given the following conversation and a follow up question, +`)}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),ie(`[Docs4LLMParser] Project ${this.currentProject.name}: Successfully processed and cached: ${e.path}`),a}catch(n){throw fe(`[Docs4LLMParser] Project ${this.currentProject?.name}: Error processing file ${e.path}:`,n),xN(n)&&this.showRateLimitNotice(n),n}}showRateLimitNotice(e){let r=Date.now();if(r-Pq.lastRateLimitNoticeTime<6e4)return;Pq.lastRateLimitNoticeTime=r;let n=I1t(e);new j1t.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(){ie("Cache clearing is now handled at the project level")}};Pq.lastRateLimitNoticeTime=0;var H8=Pq,oI=class{constructor(e,r,n=!1,o=null){this.parsers=new Map;this.isProjectMode=n,this.currentProject=o,this.registerParser(new QRe),this.registerParser(new H8(e,o)),n||this.registerParser(new pie(e)),this.registerParser(new e1e)}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 pie&&await e.clearCache()}};yn();var wW=require("obsidian");mg();Cl();Fd();$r();Cl();yn();async function mie(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. @@ -570,59 +570,59 @@ When describing this canvas, please: {chat_history} Follow Up Input: {question} Standalone question:`,n=e.map(({role:o,content:i})=>`${o}: ${i}`).join(` -`);return await yy(async()=>{let i=await ac.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]);return FR(i.content)})}$r();mg();yo();mg();fN();yo();Ix();nr();Cn();rie();qE();LE();Df();Hb();var fie=class extends xn{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,un(r))}async getRelevantDocuments(e,r){let n=un(CR(r)),i=await(await Bs.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}}};L8();Qoe();var Rx=class extends fie{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=xp.fromTemplate(`Please write a passage to answer the question. If you don't know the answer, just make up a passage. +`);return await yy(async()=>{let i=await ac.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]);return kR(i.content)})}$r();mg();yo();mg();pN();yo();Mx();nr();yn();iie();qE();LE();Df();Hb();var hie=class extends Cn{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,un(r))}async getRelevantDocuments(e,r){let n=un(CR(r)),i=await(await Bs.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}}};F8();rie();var jx=class extends hie{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=xp.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 yy(async()=>{let o=NC(r,app.vault),i=o.map(h=>h.basename),a=[...new Set([...this.options.salientTerms,...i])],s=await this.getExplicitChunks(o),u=r;n?.runName!=="no_hyde"&&(u=await this.rewriteQuery(r));let l=await this.getOramaChunks(u,a,this.options.textWeight),c=this.filterAndFormatChunks(l,s),d=c;if(c.length===0)return ue().debug&&console.log("No chunks found for query:",r),d;let f=c.reduce((h,b)=>{let g=b.metadata.score;return typeof g=="number"&&!isNaN(g)?Math.max(h,g):h},0),p=c.every(h=>typeof h.metadata.score!="number"||isNaN(h.metadata.score)),m=this.options.useRerankerThreshold&&(fb.pageContent.slice(0,3e3)))).response.data.map(b=>({...c[b.index],metadata:{...c[b.index].metadata,rerank_score:b.relevance_score}}))),ue().debug&&(console.log("*** HYBRID RETRIEVER DEBUG INFO: ***"),n?.runName!=="no_hyde"&&(console.log(` +Passage:`)}async getRelevantDocuments(r,n){return yy(async()=>{let o=DC(r,app.vault),i=o.map(h=>h.basename),a=[...new Set([...this.options.salientTerms,...i])],s=await this.getExplicitChunks(o),u=r;n?.runName!=="no_hyde"&&(u=await this.rewriteQuery(r));let l=await this.getOramaChunks(u,a,this.options.textWeight),c=this.filterAndFormatChunks(l,s),d=c;if(c.length===0)return ue().debug&&console.log("No chunks found for query:",r),d;let f=c.reduce((h,b)=>{let g=b.metadata.score;return typeof g=="number"&&!isNaN(g)?Math.max(h,g):h},0),p=c.every(h=>typeof h.metadata.score!="number"||isNaN(h.metadata.score)),m=this.options.useRerankerThreshold&&(fb.pageContent.slice(0,3e3)))).response.data.map(b=>({...c[b.index],metadata:{...c[b.index].metadata,rerank_score:b.relevance_score}}))),ue().debug&&(console.log("*** HYBRID RETRIEVER DEBUG INFO: ***"),n?.runName!=="no_hyde"&&(console.log(` Original Query: `,r),console.log("Rewritten Query: ",u)),console.log(` -Explicit Chunks: `,s),console.log("Orama Chunks: ",l),console.log("Combined Chunks: ",c),console.log("Max Orama Score: ",f),m?console.log("Reranked Chunks: ",d):console.log("No reranking applied.")),d})}async rewriteQuery(r){try{let n=await this.queryRewritePrompt.format({question:r}),o=await yy(()=>ac.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke(n));return o&&"content"in o?FR(o.content):(console.warn("Unexpected rewrittenQuery format. Falling back to original query."),r)}catch(n){return console.error("Error in rewriteQuery:",n),r}}async getExplicitChunks(r){let n=[];for(let o of r){let i=await ma.getInstance().getDb(),a=await eP.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new tP({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 ma.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&&(ue().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);ie("==== Daily note date range: ====",d[0],d[d.length-1]);let f=NC(d.join(", "),app.vault),m=(await this.getExplicitChunks(f)).map(S=>({...S,metadata:{...S.metadata,includeInContext:!0}}));ie("==== Modified time range: ====",l,c),s.where={mtime:{between:[l,c]}};let b=(await Xc(a,s)).hits.map(S=>new tP({pageContent:S.document.content,metadata:{...S.document.metadata,score:S.score,path:S.document.path,mtime:S.document.mtime,ctime:S.document.ctime,title:S.document.title,id:S.document.id,embeddingModel:S.document.embeddingModel,tags:S.document.tags,extension:S.document.extension,created_at:S.document.created_at,nchars:S.document.nchars}})),g=[...m,...b];return Array.from(new Set(g.map(S=>S.metadata.id))).map(S=>g.find(x=>x.metadata.id===S)).filter(S=>S!==void 0)}ue().debug&&console.log(`==== Orama Search Params: ==== -`,s);let u=await Xc(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 tP({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 Xs.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}}))}};nr();var QRe=require("obsidian"),A1t=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 ";case"@pomodoro":return"Start a pomodoro timer. Example: @pomodoro 25m";case"@composer":return"Edit existing notes or create new notes.";default:return""}},Pq=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 QRe.Notice(n.message):new QRe.Notice("An error occurred while executing the tool. Check console for details."),null}}};Cn();var UNt=require("obsidian");Cl();ZA();Td();_g();function YGr(t){return"children"in t&&"path"in t}function ZGr(t){return"path"in t&&!("children"in t)}function XGr(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function e1e(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=rf();for(let u of t.children)if(ZGr(u)){if(eu(u,i,a)){e&&r.push(u.name);let l=XGr(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(YGr(u)){let l=e1e(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 I1t=t=>Qm(async()=>{let e=e1e(t,!0),r=`A JSON represents the file tree as a nested structure: +Explicit Chunks: `,s),console.log("Orama Chunks: ",l),console.log("Combined Chunks: ",c),console.log("Max Orama Score: ",f),m?console.log("Reranked Chunks: ",d):console.log("No reranking applied.")),d})}async rewriteQuery(r){try{let n=await this.queryRewritePrompt.format({question:r}),o=await yy(()=>ac.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke(n));return o&&"content"in o?kR(o.content):(console.warn("Unexpected rewrittenQuery format. Falling back to original query."),r)}catch(n){return console.error("Error in rewriteQuery:",n),r}}async getExplicitChunks(r){let n=[];for(let o of r){let i=await ma.getInstance().getDb(),a=await eP.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new tP({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 ma.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&&(ue().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);ie("==== Daily note date range: ====",d[0],d[d.length-1]);let f=DC(d.join(", "),app.vault),m=(await this.getExplicitChunks(f)).map(S=>({...S,metadata:{...S.metadata,includeInContext:!0}}));ie("==== Modified time range: ====",l,c),s.where={mtime:{between:[l,c]}};let b=(await Xc(a,s)).hits.map(S=>new tP({pageContent:S.document.content,metadata:{...S.document.metadata,score:S.score,path:S.document.path,mtime:S.document.mtime,ctime:S.document.ctime,title:S.document.title,id:S.document.id,embeddingModel:S.document.embeddingModel,tags:S.document.tags,extension:S.document.extension,created_at:S.document.created_at,nchars:S.document.nchars}})),g=[...m,...b];return Array.from(new Set(g.map(S=>S.metadata.id))).map(S=>g.find(x=>x.metadata.id===S)).filter(S=>S!==void 0)}ue().debug&&console.log(`==== Orama Search Params: ==== +`,s);let u=await Xc(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 tP({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 Xs.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}}))}};nr();var t1e=require("obsidian"),N1t=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 ";case"@pomodoro":return"Start a pomodoro timer. Example: @pomodoro 25m";case"@composer":return"Edit existing notes or create new notes.";default:return""}},Eq=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 t1e.Notice(n.message):new t1e.Notice("An error occurred while executing the tool. Check console for details."),null}}};yn();var KNt=require("obsidian");Cl();ZA();Td();_g();function tJr(t){return"children"in t&&"path"in t}function rJr(t){return"path"in t&&!("children"in t)}function nJr(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function r1e(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=rf();for(let u of t.children)if(rJr(u)){if(eu(u,i,a)){e&&r.push(u.name);let l=nJr(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(tJr(u)){let l=r1e(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 D1t=t=>Qm(async()=>{let e=r1e(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=e1e(t,!1);return r+JSON.stringify(o)}return r+n},{name:"getFileTree",description:"Get the file tree as a nested structure of folders and files",schema:Wr.void()});$r();wT();mg();Ix();nr();ZA();Td();var t1e=Qm(async({timeRange:t,query:e,salientTerms:r})=>{if(await ma.getInstance().isIndexEmpty())throw new Rr(oJ);let o=t!==void 0,i=ue().maxSourceChunks({title:l.metadata.title,content:l.pageContent,path:l.metadata.path,score:l.metadata.score,rerank_score:l.metadata.rerank_score,includeInContext:l.metadata.includeInContext}));return JSON.stringify(u)},{name:"localSearch",description:"Search for notes based on the time range and query",schema:Wr.object({timeRange:Wr.object({startTime:Wr.any(),endTime:Wr.any()}).optional(),query:Wr.string().describe("The search query"),salientTerms:Wr.array(Wr.string()).describe("List of salient terms extracted from the query")})}),M1t=Qm(async()=>{try{let t=await ma.getInstance().indexVaultToVectorStore();return`Please report whether the indexing was successful. -If success is true, just say it is successful. If 0 files is indexed, say there are no new files to index.`+JSON.stringify({success:!0,message:t===0?"No new files to index.":`Indexed ${t} files in the vault.`})}catch(t){return console.error("Error indexing vault:",t),JSON.stringify({success:!1,message:"An error occurred while indexing the vault."})}},{name:"indexVault",description:"Index the vault to the Copilot index"}),r1e=Qm(async({query:t,chatHistory:e})=>{try{let r=await die(t,e),n=await Fi.getInstance().webSearch(r),o=n.response.citations||[],i=o.length>0?` +`,n=JSON.stringify(e);if(n.length>5e5){let o=r1e(t,!1);return r+JSON.stringify(o)}return r+n},{name:"getFileTree",description:"Get the file tree as a nested structure of folders and files",schema:Wr.void()});$r();wT();mg();Mx();nr();ZA();Td();var n1e=Qm(async({timeRange:t,query:e,salientTerms:r})=>{if(await ma.getInstance().isIndexEmpty())throw new Rr(iJ);let o=t!==void 0,i=ue().maxSourceChunks({title:l.metadata.title,content:l.pageContent,path:l.metadata.path,score:l.metadata.score,rerank_score:l.metadata.rerank_score,includeInContext:l.metadata.includeInContext}));return JSON.stringify(u)},{name:"localSearch",description:"Search for notes based on the time range and query",schema:Wr.object({timeRange:Wr.object({startTime:Wr.any(),endTime:Wr.any()}).optional(),query:Wr.string().describe("The search query"),salientTerms:Wr.array(Wr.string()).describe("List of salient terms extracted from the query")})}),L1t=Qm(async()=>{try{let t=await ma.getInstance().indexVaultToVectorStore();return`Please report whether the indexing was successful. +If success is true, just say it is successful. If 0 files is indexed, say there are no new files to index.`+JSON.stringify({success:!0,message:t===0?"No new files to index.":`Indexed ${t} files in the vault.`})}catch(t){return console.error("Error indexing vault:",t),JSON.stringify({success:!1,message:"An error occurred while indexing the vault."})}},{name:"indexVault",description:"Index the vault to the Copilot index"}),o1e=Qm(async({query:t,chatHistory:e})=>{try{let r=await mie(t,e),n=await Fi.getInstance().webSearch(r),o=n.response.citations||[],i=o.length>0?` Sources: `+o.map((a,s)=>`[${s+1}] ${a}`).join(` `):"";return`Here are the web search results. Please provide a response based on this information and include source citations listed at the end of your response under the heading '#### Sources' as a list of markdown links. For each URL, create a descriptive title based on the domain and path and return it in the markdown format '- [title](url)': -`+n.response.choices[0].message.content+i}catch(r){return console.error(`Error processing web search query ${t}:`,r),""}},{name:"webSearch",description:"Search the web for information",schema:Wr.object({query:Wr.string().describe("The search query"),chatHistory:Wr.array(Wr.object({role:Wr.enum(["user","assistant"]),content:Wr.string()})).describe("Previous conversation turns")})});ZA();var D1t=F(R1t(),1),H8=F(iI(),1);var oo;(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(oo||(oo={}));var tu;(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"})(tu||(tu={}));var eh;(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"})(eh||(eh={}));function j1t(t,e){e=e.add(1,"day"),xN(t,e),Eq(t,e)}function rb(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function pie(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",oo.AM):t.assign("meridiem",oo.PM)}function xN(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function Eq(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var s1e=F(iI(),1);var QGr={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=>N1t(t,eh.MARCH,tu.SUNDAY,2),dstEnd:t=>N1t(t,eh.OCTOBER,tu.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=>aI(t,eh.MARCH,tu.SUNDAY,2,2),dstEnd:t=>aI(t,eh.NOVEMBER,tu.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=>aI(t,eh.MARCH,tu.SUNDAY,2,2),dstEnd:t=>aI(t,eh.NOVEMBER,tu.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=>aI(t,eh.MARCH,tu.SUNDAY,2,2),dstEnd:t=>aI(t,eh.NOVEMBER,tu.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=>aI(t,eh.MARCH,tu.SUNDAY,2,2),dstEnd:t=>aI(t,eh.NOVEMBER,tu.SUNDAY,1,2)},PWT:540,PYST:-180,PYT:-240,RET:240,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SRT:-180,SST:-660,TAHT:-600,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TVT:720,ULAT:480,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-210,VLAST:660,VLAT:660,VUT:660,WAST:120,WAT:60,WEST:60,WESZ:60,WET:0,WEZ:0,WFT:720,WGST:-120,WGT:-180,WIB:420,WIT:540,WITA:480,WST:780,WT:0,YAKST:600,YAKT:600,YAPT:600,YEKST:360,YEKT:360};function aI(t,e,r,n,o=0){let i=0,a=0;for(;a$1t(t,eh.MARCH,tu.SUNDAY,2),dstEnd:t=>$1t(t,eh.OCTOBER,tu.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=>aI(t,eh.MARCH,tu.SUNDAY,2,2),dstEnd:t=>aI(t,eh.NOVEMBER,tu.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=>aI(t,eh.MARCH,tu.SUNDAY,2,2),dstEnd:t=>aI(t,eh.NOVEMBER,tu.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=>aI(t,eh.MARCH,tu.SUNDAY,2,2),dstEnd:t=>aI(t,eh.NOVEMBER,tu.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=>aI(t,eh.MARCH,tu.SUNDAY,2,2),dstEnd:t=>aI(t,eh.NOVEMBER,tu.SUNDAY,1,2)},PWT:540,PYST:-180,PYT:-240,RET:240,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SRT:-180,SST:-660,TAHT:-600,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TVT:720,ULAT:480,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-210,VLAST:660,VLAT:660,VUT:660,WAST:120,WAT:60,WEST:60,WESZ:60,WET:0,WEZ:0,WFT:720,WGST:-120,WGT:-180,WIB:420,WIT:540,WITA:480,WST:780,WT:0,YAKST:600,YAKT:600,YAPT:600,YEKST:360,YEKT:360};function aI(t,e,r,n,o=0){let i=0,a=0;for(;an.length-r.length).join("|").replace(/\./g,"\\.")})`}var L1t=F(iI(),1);function hie(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function uI(t,e,r){let n=(0,L1t.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))31)return r.index=r.index+r[U1t].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[H1t]){let a=cI(r[H1t]);n.start.assign("year",a)}else{let a=uI(e.refDate,i,o);n.start.imply("year",a)}if(r[z1t]){let a=Aq(r[z1t]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};var lJr=new RegExp(`(${Qc(vg)})(?:-|/|\\s*,?\\s*)(${Tq})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${Tq})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${lI}))?(?=\\W|$)(?!\\:\\d)`,"i"),cJr=1,V1t=2,p1e=3,m1e=4,G8=class extends pi{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return lJr}innerExtract(e,r){let n=vg[r[cJr].toLowerCase()],o=Aq(r[V1t]);if(o>31||this.shouldSkipYearLikeDate&&!r[p1e]&&!r[m1e]&&r[V1t].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[m1e]){let u=cI(r[m1e]);i.assign("year",u)}else{let u=uI(e.refDate,o,n);i.imply("year",u)}if(!r[p1e])return i;let a=Aq(r[p1e]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}};var dJr=new RegExp(`((?:in)\\s*)?(${Qc(vg)})\\s*(?:[,-]?\\s*(${lI})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),fJr=1,pJr=2,W1t=3,J8=class extends pi{innerPattern(){return dJr}innerExtract(e,r){let n=r[pJr].toLowerCase();if(r[0].length<=3&&!f1e[n])return null;let o=e.createParsingResult(r.index+(r[fJr]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=vg[n];if(o.start.assign("month",i),r[W1t]){let a=cI(r[W1t]);o.start.assign("year",a)}else{let a=uI(e.refDate,1,i);o.start.imply("year",a)}return o}};var mJr=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${Qc(vg)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),hJr=1,gJr=2,K1t=3,yJr=4,Y8=class extends pi{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return mJr}innerExtract(e,r){let n=parseInt(r[hJr]),o=parseInt(r[yJr]),i=r[K1t]?parseInt(r[K1t]):vg[r[gJr].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 bJr=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),_Jr=1,vJr=2,Z8=class extends pi{innerPattern(){return bJr}innerExtract(e,r){let n=parseInt(r[vJr]),o=parseInt(r[_Jr]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}};function wJr(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 SJr(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 G1t=2,Iq=3,gie=4,yie=5,X8=6,bie=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[G1t]);if(s>100){if(this.strictMode||r[Iq]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[Iq]!=null){if(r[Iq].length==1&&!r[X8])return null;i=parseInt(r[Iq])}if(i>=60)return null;if(s>12&&(a=oo.PM),r[X8]!=null){if(s>12)return null;let u=r[X8][0].toLowerCase();u=="a"&&(a=oo.AM,s==12&&(s=0)),u=="p"&&(a=oo.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",oo.AM):o.imply("meridiem",oo.PM),r[yie]!=null){let u=parseInt(r[yie].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[gie]!=null){let u=parseInt(r[gie]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[yie]!=null){let u=parseInt(r[yie].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[gie]!=null){let u=parseInt(r[gie]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[G1t]),a=0,s=-1;if(r[Iq]!=null?a=parseInt(r[Iq]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=oo.PM),r[X8]!=null){if(i>12)return null;let u=r[X8][0].toLowerCase();u=="a"&&(s=oo.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=oo.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==oo.AM?(n.start.imply("meridiem",oo.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",oo.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",oo.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",oo.PM)):i>12?o.imply("meridiem",oo.PM):i<=12&&o.imply("meridiem",oo.AM),o.date().getTime()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=wJr(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=SJr(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}};var Q8=class extends bie{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",oo.PM)):o<6&&n.assign("meridiem",oo.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",oo.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",oo.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}};function fI(t){let e={};for(let r in t)e[r]=-t[r];return e}function J1t(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 xJr=new RegExp(`(${nP})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),CJr=new RegExp(`(${dI})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),e6=class extends pi{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?CJr:xJr}innerExtract(e,r){let n=wg(r[1]);if(!n)return null;let o=fI(n);return io.createRelativeFromReference(e.reference,o)}};var OJr=new RegExp(`(${nP})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),PJr=new RegExp(`(${dI})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),EJr=1,t6=class extends pi{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?PJr:OJr}innerExtract(e,r){let n=wg(r[EJr]);return n?io.createRelativeFromReference(e.reference,n):null}};var _ie=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},Sg=class{refine(e,r){if(r.length<2)return r;let n=[],o=r[0],i=null;for(let a=1;a{console.log(`${this.constructor.name} merged ${u} and ${l} into ${c}`)}),o=c}}return o!=null&&n.push(o),n}};var r6=class extends Sg{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{let i=e.text.substring(o.index+o.text.length),a=TJr.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=mie(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 AJr=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),IJr=1,MJr=2,RJr=3,a6=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=AJr.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[MJr]),s=parseInt(i[RJr]||"0"),u=a*60+s;u>14*60||(i[IJr]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}};var pI=class{refine(e,r){if(r.length<2)return r;let n=[],o=r[0];for(let i=1;i=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 Z1t=F(iI(),1);var s6=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,Z1t.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),xN(n.start,o),n.end&&n.end.isOnlyTime()&&(xN(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),xN(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 u6=class extends _ie{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 jJr=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"),NJr=1,DJr=2,LJr=3,X1t=4,FJr=5,Q1t=6,ejt=7,kJr=8,tjt=9,rjt=10,l6=class extends pi{innerPattern(){return jJr}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[NJr]),month:parseInt(r[DJr]),day:parseInt(r[LJr])});if(r[X1t]!=null&&(n.assign("hour",parseInt(r[X1t])),n.assign("minute",parseInt(r[FJr])),r[Q1t]!=null&&n.assign("second",parseInt(r[Q1t])),r[ejt]!=null&&n.assign("millisecond",parseInt(r[ejt])),r[kJr]!=null)){let o=0;if(r[tjt]){let i=parseInt(r[tjt]),a=0;r[rjt]!=null&&(a=parseInt(r[rjt])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}};var c6=class extends Sg{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 njt(t,e=!1){return t.parsers.unshift(new l6),t.refiners.unshift(new c6),t.refiners.unshift(new a6),t.refiners.unshift(new pI),t.refiners.push(new i6),t.refiners.push(new pI),t.refiners.push(new s6),t.refiners.push(new u6(e)),t}var gjt=F(iI(),1);var Rq=F(iI(),1);function ojt(t){let e=(0,Rq.default)(t.instant),r=new io(t,{});return rb(r,e),pie(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function ijt(t){let e=(0,Rq.default)(t.instant),r=new io(t,{});return rb(r,e),Eq(r,e),r.addTag("casualReference/today"),r}function ajt(t){return $Jr(t,1).addTag("casualReference/yesterday")}function $Jr(t,e){return ujt(t,-e)}function sjt(t){return ujt(t,1).addTag("casualReference/tomorrow")}function ujt(t,e){let r=(0,Rq.default)(t.instant),n=new io(t,{});return r=r.add(e,"day"),rb(n,r),Eq(n,r),n}function ljt(t,e=22){let r=(0,Rq.default)(t.instant),n=new io(t,{});return rb(n,r),n.imply("hour",e),n.imply("meridiem",oo.PM),n.addTag("casualReference/tonight"),n}function cjt(t,e=20){let r=new io(t,{});return r.imply("meridiem",oo.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function djt(t){let e=new io(t,{}),r=(0,Rq.default)(t.instant);return r.hour()>2&&j1t(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function fjt(t,e=6){let r=new io(t,{});return r.imply("meridiem",oo.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function pjt(t,e=15){let r=new io(t,{});return r.imply("meridiem",oo.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function mjt(t){let e=new io(t,{});return e.imply("meridiem",oo.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var BJr=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,d6=class extends pi{innerPattern(e){return BJr}innerExtract(e,r){let n=(0,gjt.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=ojt(e.reference);break;case"today":i=ijt(e.reference);break;case"yesterday":i=ajt(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=sjt(e.reference);break;case"tonight":i=ljt(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),rb(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}};var qJr=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,f6=class extends pi{innerPattern(){return qJr}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=pjt(e.reference);break;case"evening":case"night":n=cjt(e.reference);break;case"midnight":n=djt(e.reference);break;case"morning":n=fjt(e.reference);break;case"noon":case"midday":n=mjt(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}};function yjt(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=UJr(n,e,r),i=new io(t);return i=J1t(i,{day:o}),i.assign("weekday",e),i}function UJr(t,e,r){let n=t.getDay();switch(r){case"this":return vie(t,e);case"last":return bjt(t,e);case"next":return n==tu.SUNDAY?e==tu.SUNDAY?7:e:n==tu.SATURDAY?e==tu.SATURDAY?7:e==tu.SUNDAY?8:1+e:e=0&&(n-=7),n}var HJr=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${Qc(d1e)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),VJr=1,WJr=2,KJr=3,p6=class extends pi{innerPattern(){return HJr}innerExtract(e,r){let n=r[WJr].toLowerCase(),o=d1e[n],i=r[VJr],a=r[KJr],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"),yjt(e.reference,o,u)}};var _jt=F(iI(),1);var GJr=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${Qc(V8)})(?=\\s*)(?=\\W|$)`,"i"),JJr=1,YJr=2,m6=class extends pi{innerPattern(){return GJr}innerExtract(e,r){let n=r[JJr].toLowerCase(),o=r[YJr].toLowerCase(),i=V8[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,io.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,io.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,_jt.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 ZJr=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"),XJr=1,QJr=5,vjt=2,wjt=3,g1e=4,h6=class{constructor(e){this.groupNumberMonth=e?wjt:vjt,this.groupNumberDay=e?vjt:wjt}pattern(){return ZJr}extract(e,r){let n=r.index+r[XJr].length,o=r.index+r[0].length-r[QJr].length;if(n>0&&e.text.substring(0,n).match("\\d/?$")||o12)&&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[g1e]){let l=parseInt(r[g1e]),c=hie(l);a.start.assign("year",c)}else{let l=uI(e.refDate,u,s);a.start.imply("year",l)}return a}};var e7r=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${nP})(?=\\W|$)`,"i"),t7r=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${dI})(?=\\W|$)`,"i"),g6=class extends pi{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?e7r:t7r}innerExtract(e,r){let n=r[1].toLowerCase(),o=wg(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=fI(o);break}return io.createRelativeFromReference(e.reference,o)}};function r7r(t){return t.text.match(/^[+-]/i)!=null}function Sjt(t){return t.text.match(/^-/i)!=null}var y6=class extends Sg{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?r7r(n)||Sjt(n):!1}mergeResults(e,r,n,o){let i=wg(n.text);Sjt(n)&&(i=fI(i));let a=io.createRelativeFromReference(new sI(r.start.date()),i);return new rP(r.reference,r.index,`${r.text}${e}${n.text}`,a)}};function xjt(t){return t.text.match(/\s+(before|from)$/i)!=null}function n7r(t){return t.text.match(/\s+(after|since)$/i)!=null}var b6=class extends Sg{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!xjt(r)&&!n7r(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=wg(r.text);xjt(r)&&(o=fI(o));let i=io.createRelativeFromReference(new sI(n.start.date()),o);return new rP(n.reference,r.index,`${r.text}${e}${n.text}`,i)}};var o7r=new RegExp(`^\\s*(${lI})`,"i"),i7r=1,_6=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=o7r.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=cI(i[i7r]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}};var CN=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new d6),r.parsers.push(new f6),r.parsers.push(new J8),r.parsers.push(new m6),r.parsers.push(new g6),r}createConfiguration(e=!0,r=!1){let n=njt({parsers:[new h6(r),new W8(e),new K8,new G8(r),new p6,new Z8,new Q8(e),new e6(e),new t6(e)],refiners:[new Mq]},e);return n.parsers.unshift(new Y8(e)),n.refiners.unshift(new b6),n.refiners.unshift(new y6),n.refiners.unshift(new pI),n.refiners.push(new Mq),n.refiners.push(new _6),n.refiners.push(new n6),n}};var jq=class t{constructor(e){this.defaultConfig=new CN,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 y1e(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 rP?c=l:l instanceof io?(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}},y1e=class{constructor(e,r,n){this.text=e,this.reference=new sI(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof io?e:new io(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 rP(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 b1e=new CN,Cjt=new jq(b1e.createCasualConfiguration(!1)),a7r=new jq(b1e.createConfiguration(!0,!1)),KHo=new jq(b1e.createCasualConfiguration(!0));var u7r=Cjt;function _1e(t,e,r){return u7r.parse(t,e,r)}var oP=class extends Error{},wie=class extends oP{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Sie=class extends oP{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},xie=class extends oP{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},nb=class extends oP{},Nq=class extends oP{constructor(e){super(`Invalid unit ${e}`)}},ys=class extends oP{},ob=class extends oP{constructor(){super("Zone is an abstract class")}};var lt="numeric",ib="short",th="long",mI={year:lt,month:lt,day:lt},v6={year:lt,month:ib,day:lt},v1e={year:lt,month:ib,day:lt,weekday:ib},w6={year:lt,month:th,day:lt},S6={year:lt,month:th,day:lt,weekday:th},x6={hour:lt,minute:lt},C6={hour:lt,minute:lt,second:lt},O6={hour:lt,minute:lt,second:lt,timeZoneName:ib},P6={hour:lt,minute:lt,second:lt,timeZoneName:th},E6={hour:lt,minute:lt,hourCycle:"h23"},T6={hour:lt,minute:lt,second:lt,hourCycle:"h23"},A6={hour:lt,minute:lt,second:lt,hourCycle:"h23",timeZoneName:ib},I6={hour:lt,minute:lt,second:lt,hourCycle:"h23",timeZoneName:th},M6={year:lt,month:lt,day:lt,hour:lt,minute:lt},R6={year:lt,month:lt,day:lt,hour:lt,minute:lt,second:lt},j6={year:lt,month:ib,day:lt,hour:lt,minute:lt},N6={year:lt,month:ib,day:lt,hour:lt,minute:lt,second:lt},w1e={year:lt,month:ib,day:lt,weekday:ib,hour:lt,minute:lt},D6={year:lt,month:th,day:lt,hour:lt,minute:lt,timeZoneName:ib},L6={year:lt,month:th,day:lt,hour:lt,minute:lt,second:lt,timeZoneName:ib},F6={year:lt,month:th,day:lt,weekday:th,hour:lt,minute:lt,timeZoneName:th},k6={year:lt,month:th,day:lt,weekday:th,hour:lt,minute:lt,second:lt,timeZoneName:th};var Yp=class{get type(){throw new ob}get name(){throw new ob}get ianaName(){return this.name}get isUniversal(){throw new ob}offsetName(e,r){throw new ob}formatOffset(e,r){throw new ob}offset(e){throw new ob}equals(e){throw new ob}get isValid(){throw new ob}};var S1e=null,hI=class t extends Yp{static get instance(){return S1e===null&&(S1e=new t),S1e}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Oie(e,r,n)}formatOffset(e,r){return gI(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Eie={};function c7r(t){return Eie[t]||(Eie[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"})),Eie[t]}var d7r={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function f7r(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 p7r(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o=0?m:1e3+m,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var Ojt={};function m7r(t,e={}){let r=JSON.stringify([t,e]),n=Ojt[r];return n||(n=new Intl.ListFormat(t,e),Ojt[r]=n),n}var x1e={};function C1e(t,e={}){let r=JSON.stringify([t,e]),n=x1e[r];return n||(n=new Intl.DateTimeFormat(t,e),x1e[r]=n),n}var O1e={};function h7r(t,e={}){let r=JSON.stringify([t,e]),n=O1e[r];return n||(n=new Intl.NumberFormat(t,e),O1e[r]=n),n}var P1e={};function g7r(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=P1e[o];return i||(i=new Intl.RelativeTimeFormat(t,e),P1e[o]=i),i}var $6=null;function y7r(){return $6||($6=new Intl.DateTimeFormat().resolvedOptions().locale,$6)}var Pjt={};function b7r(t){let e=Pjt[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,Pjt[t]=e}return e}function _7r(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=C1e(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=C1e(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function v7r(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function w7r(t){let e=[];for(let r=1;r<=12;r++){let n=Yr.utc(2009,r,1);e.push(t(n))}return e}function S7r(t){let e=[];for(let r=1;r<=7;r++){let n=Yr.utc(2016,11,13+r);e.push(t(n))}return e}function Tie(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function x7r(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 E1e=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=h7r(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):Lq(e,3);return Ya(r,this.padTo)}}},T1e=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&&nf.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=C1e(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()}},A1e=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Aie()&&(this.rtf=g7r(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):Ejt(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},C7r={firstDay:1,minimalDays:4,weekend:[6,7]},Eo=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,n,o,i=!1){let a=e||Po.defaultLocale,s=a||(i?"en-US":y7r()),u=r||Po.defaultNumberingSystem,l=n||Po.defaultOutputCalendar,c=B6(o)||Po.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){$6=null,x1e={},O1e={},P1e={}}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]=_7r(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=v7r(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=x7r(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,B6(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 Tie(this,e,I1e,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=w7r(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return Tie(this,e,M1e,()=>{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]=S7r(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return Tie(this,void 0,()=>R1e,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Yr.utc(2016,11,13,9),Yr.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Tie(this,e,j1e,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[Yr.utc(-40,1,1),Yr.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 E1e(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new T1e(e,this.intl,r)}relFormatter(e={}){return new A1e(this.intl,this.isEnglish(),e)}listFormatter(e={}){return m7r(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:Iie()?b7r(this.locale):C7r}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 D1e=null,sc=class t extends Yp{static get utcInstance(){return D1e===null&&(D1e=new t(0)),D1e}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(ON(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${gI(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${gI(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return gI(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 Fq=class extends Yp{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 ab(t,e){let r;if(sr(t)||t===null)return e;if(t instanceof Yp)return t;if(Tjt(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?hI.instance:n==="utc"||n==="gmt"?sc.utcInstance:sc.parseSpecifier(n)||nf.create(t)}else return sb(t)?sc.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new Fq(t)}var L1e={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"},Ajt={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]},O7r=L1e.hanidec.replace(/[\[|\]]/g,"").split("");function Ijt(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}var kq={};function Mjt(){kq={}}function xg({numberingSystem:t},e=""){let r=t||"latn";return kq[r]||(kq[r]={}),kq[r][e]||(kq[r][e]=new RegExp(`${L1e[r]}${e}`)),kq[r][e]}var Rjt=()=>Date.now(),jjt="system",Njt=null,Djt=null,Ljt=null,Fjt=60,kjt,$jt=null,Po=class{static get now(){return Rjt}static set now(e){Rjt=e}static set defaultZone(e){jjt=e}static get defaultZone(){return ab(jjt,hI.instance)}static get defaultLocale(){return Njt}static set defaultLocale(e){Njt=e}static get defaultNumberingSystem(){return Djt}static set defaultNumberingSystem(e){Djt=e}static get defaultOutputCalendar(){return Ljt}static set defaultOutputCalendar(e){Ljt=e}static get defaultWeekSettings(){return $jt}static set defaultWeekSettings(e){$jt=B6(e)}static get twoDigitCutoffYear(){return Fjt}static set twoDigitCutoffYear(e){Fjt=e%100}static get throwOnInvalid(){return kjt}static set throwOnInvalid(e){kjt=e}static resetCaches(){Eo.resetCache(),nf.resetCache(),Yr.resetCache(),Mjt()}};var uc=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var Bjt=[0,31,59,90,120,151,181,212,243,273,304,334],qjt=[0,31,60,91,121,152,182,213,244,274,305,335];function Cg(t,e){return new uc("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Mie(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 Ujt(t,e,r){return r+(EN(t)?qjt:Bjt)[e-1]}function zjt(t,e){let r=EN(t)?qjt:Bjt,n=r.findIndex(i=>iPN(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...z6(t)}}function F1e(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=Rie(Mie(n,1,e),r),s=yI(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=yI(l)):u>s?(l=n+1,u-=yI(n)):l=n;let{month:c,day:d}=zjt(l,u);return{year:l,month:c,day:d,...z6(t)}}function jie(t){let{year:e,month:r,day:n}=t,o=Ujt(e,r,n);return{year:e,ordinal:o,...z6(t)}}function k1e(t){let{year:e,ordinal:r}=t,{month:n,day:o}=zjt(e,r);return{year:e,month:n,day:o,...z6(t)}}function $1e(t,e){if(!sr(t.localWeekday)||!sr(t.localWeekNumber)||!sr(t.localWeekYear)){if(!sr(t.weekday)||!sr(t.weekNumber)||!sr(t.weekYear))throw new nb("Cannot mix locale-based week fields with ISO-based week fields");return sr(t.localWeekday)||(t.weekday=t.localWeekday),sr(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),sr(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 Hjt(t,e=4,r=1){let n=U6(t.weekYear),o=rh(t.weekNumber,1,PN(t.weekYear,e,r)),i=rh(t.weekday,1,7);return n?o?i?!1:Cg("weekday",t.weekday):Cg("week",t.weekNumber):Cg("weekYear",t.weekYear)}function Vjt(t){let e=U6(t.year),r=rh(t.ordinal,1,yI(t.year));return e?r?!1:Cg("ordinal",t.ordinal):Cg("year",t.year)}function B1e(t){let e=U6(t.year),r=rh(t.month,1,12),n=rh(t.day,1,$q(t.year,t.month));return e?r?n?!1:Cg("day",t.day):Cg("month",t.month):Cg("year",t.year)}function q1e(t){let{hour:e,minute:r,second:n,millisecond:o}=t,i=rh(e,0,23)||e===24&&r===0&&n===0&&o===0,a=rh(r,0,59),s=rh(n,0,59),u=rh(o,0,999);return i?a?s?u?!1:Cg("millisecond",o):Cg("second",n):Cg("minute",r):Cg("hour",e)}function sr(t){return typeof t>"u"}function sb(t){return typeof t=="number"}function U6(t){return typeof t=="number"&&t%1===0}function Tjt(t){return typeof t=="string"}function Kjt(t){return Object.prototype.toString.call(t)==="[object Date]"}function Aie(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Iie(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Gjt(t){return Array.isArray(t)?t:[t]}function U1e(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 Jjt(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function bI(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function B6(t){if(t==null)return null;if(typeof t!="object")throw new ys("Week settings must be an object");if(!rh(t.firstDay,1,7)||!rh(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!rh(e,1,7)))throw new ys("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function rh(t,e,r){return U6(t)&&t>=e&&t<=r}function P7r(t,e){return t-e*Math.floor(t/e)}function Ya(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function iP(t){if(!(sr(t)||t===null||t===""))return parseInt(t,10)}function _I(t){if(!(sr(t)||t===null||t===""))return parseFloat(t)}function H6(t){if(!(sr(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function Lq(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function EN(t){return t%4===0&&(t%100!==0||t%400===0)}function yI(t){return EN(t)?366:365}function $q(t,e){let r=P7r(e-1,12)+1,n=t+(e-r)/12;return r===2?EN(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function Dq(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 Wjt(t,e,r){return-Rie(Mie(t,1,e),r)+e-1}function PN(t,e=4,r=1){let n=Wjt(t,e,r),o=Wjt(t+1,e,r);return(yI(t)-n+o)/7}function V6(t){return t>99?t:t>Po.twoDigitCutoffYear?1900+t:2e3+t}function Oie(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 ON(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 z1e(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new ys(`Invalid unit value ${t}`);return e}function Bq(t,e){let r={};for(let n in t)if(bI(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=z1e(o)}return r}function gI(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}${Ya(r,2)}:${Ya(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${Ya(r,2)}${Ya(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function z6(t){return Jjt(t,["hour","minute","second","millisecond"])}var E7r=["January","February","March","April","May","June","July","August","September","October","November","December"],H1e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],T7r=["J","F","M","A","M","J","J","A","S","O","N","D"];function I1e(t){switch(t){case"narrow":return[...T7r];case"short":return[...H1e];case"long":return[...E7r];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var V1e=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],W1e=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],A7r=["M","T","W","T","F","S","S"];function M1e(t){switch(t){case"narrow":return[...A7r];case"short":return[...W1e];case"long":return[...V1e];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var R1e=["AM","PM"],I7r=["Before Christ","Anno Domini"],M7r=["BC","AD"],R7r=["B","A"];function j1e(t){switch(t){case"narrow":return[...R7r];case"short":return[...M7r];case"long":return[...I7r];default:return null}}function Yjt(t){return R1e[t.hour<12?0:1]}function Zjt(t,e){return M1e(e)[t.weekday-1]}function Xjt(t,e){return I1e(e)[t.month-1]}function Qjt(t,e){return j1e(e)[t.year<0?0:1]}function Ejt(t,e,r="always",n=!1){let o={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&i){let d=t==="days";switch(e){case 1:return d?"tomorrow":`next ${o[t][0]}`;case-1:return d?"yesterday":`last ${o[t][0]}`;case 0:return d?"today":`this ${o[t][0]}`;default:}}let a=Object.is(e,-0)||e<0,s=Math.abs(e),u=s===1,l=o[t],c=n?u?l[1]:l[2]||l[1]:u?o[t][0]:t;return a?`${s} ${c} ago`:`in ${s} ${c}`}function eNt(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var j7r={D:mI,DD:v6,DDD:w6,DDDD:S6,t:x6,tt:C6,ttt:O6,tttt:P6,T:E6,TT:T6,TTT:A6,TTTT:I6,f:M6,ff:j6,fff:D6,ffff:F6,F:R6,FF:N6,FFF:L6,FFFF:k6},lc=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;a0&&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 j7r[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 Ya(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",o=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(p,m)=>this.loc.extract(e,p,m),a=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",s=()=>n?Yjt(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,m)=>n?Xjt(e,p):i(m?{month:p}:{month:p,day:"numeric"},"month"),l=(p,m)=>n?Zjt(e,p):i(m?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),c=p=>{let m=t.macroTokenToFormatOpts(p);return m?this.formatWithSystemDefault(e,m):p},d=p=>n?Qjt(e,p):i({era:p},"era"),f=p=>{switch(p){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return s();case"d":return o?i({day:"numeric"},"day"):this.num(e.day);case"dd":return o?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return o?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return o?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return o?i({month:"numeric"},"month"):this.num(e.month);case"MM":return o?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return o?i({year:"numeric"},"year"):this.num(e.year);case"yy":return o?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return o?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return o?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(p)}};return eNt(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 eNt(i,o(s))}};var rNt=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Uq(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function zq(...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 Hq(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 nNt(...t){return(e,r)=>{let n={},o;for(o=0;op!==void 0&&(m||p&&c)?-p:p;return[{years:f(_I(r)),months:f(_I(n)),weeks:f(_I(o)),days:f(_I(i)),hours:f(_I(a)),minutes:f(_I(s)),seconds:f(_I(u),u==="-0"),milliseconds:f(H6(l),d)}]}var W7r={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 J1e(t,e,r,n,o,i,a){let s={year:e.length===2?V6(iP(e)):iP(e),month:H1e.indexOf(r)+1,day:iP(n),hour:iP(o),minute:iP(i)};return a&&(s.second=iP(a)),t&&(s.weekday=t.length>3?V1e.indexOf(t)+1:W1e.indexOf(t)+1),s}var K7r=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function G7r(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=J1e(e,o,n,r,i,a,s),p;return u?p=W7r[u]:l?p=0:p=ON(c,d),[f,new sc(p)]}function J7r(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var Y7r=/^(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$/,Z7r=/^(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$/,X7r=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function tNt(t){let[,e,r,n,o,i,a,s]=t;return[J1e(e,o,n,r,i,a,s),sc.utcInstance]}function Q7r(t){let[,e,r,n,o,i,a,s]=t;return[J1e(e,s,r,n,o,i,a),sc.utcInstance]}var eYr=Uq(D7r,G1e),tYr=Uq(L7r,G1e),rYr=Uq(F7r,G1e),nYr=Uq(iNt),sNt=zq(U7r,Vq,W6,K6),oYr=zq(k7r,Vq,W6,K6),iYr=zq($7r,Vq,W6,K6),aYr=zq(Vq,W6,K6);function uNt(t){return Hq(t,[eYr,sNt],[tYr,oYr],[rYr,iYr],[nYr,aYr])}function lNt(t){return Hq(J7r(t),[K7r,G7r])}function cNt(t){return Hq(t,[Y7r,tNt],[Z7r,tNt],[X7r,Q7r])}function dNt(t){return Hq(t,[H7r,V7r])}var sYr=zq(Vq);function fNt(t){return Hq(t,[z7r,sYr])}var uYr=Uq(B7r,q7r),lYr=Uq(aNt),cYr=zq(Vq,W6,K6);function pNt(t){return Hq(t,[uYr,sNt],[lYr,cYr])}var mNt="Invalid Duration",gNt={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}},dYr={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},...gNt},Og=146097/400,Wq=146097/4800,fYr={years:{quarters:4,months:12,weeks:Og/7,days:Og,hours:Og*24,minutes:Og*24*60,seconds:Og*24*60*60,milliseconds:Og*24*60*60*1e3},quarters:{months:3,weeks:Og/28,days:Og/4,hours:Og*24/4,minutes:Og*24*60/4,seconds:Og*24*60*60/4,milliseconds:Og*24*60*60*1e3/4},months:{weeks:Wq/7,days:Wq,hours:Wq*24,minutes:Wq*24*60,seconds:Wq*24*60*60,milliseconds:Wq*24*60*60*1e3},...gNt},TN=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],pYr=TN.slice(0).reverse();function vI(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 Za(n)}function yNt(t,e){let r=e.milliseconds??0;for(let n of pYr.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function hNt(t,e){let r=yNt(t,e)<0?-1:1;TN.reduceRight((n,o)=>{if(sr(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),TN.reduce((n,o)=>{if(sr(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function mYr(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var Za=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?fYr:dYr;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Eo.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 ys(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:Bq(e,t.normalizeUnit),loc:Eo.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(sb(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new ys(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=dNt(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]=fNt(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 ys("need to specify a reason the Duration is invalid");let n=e instanceof uc?e:new uc(e,r);if(Po.throwOnInvalid)throw new xie(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 Nq(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?lc.create(this.loc,n).formatDurationFromString(this,e):mNt}toHuman(e={}){if(!this.isValid)return mNt;let r=TN.map(n=>{let o=this.values[n];return sr(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+=Lq(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},Yr.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?yNt(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 TN)(bI(r.values,o)||bI(this.values,o))&&(n[o]=r.get(o)+this.get(o));return vI(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]=z1e(e(this.values[n],n));return vI(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...Bq(e,t.normalizeUnit)};return vI(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 vI(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return hNt(this.matrix,e),vI(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=mYr(this.normalize().shiftToAll().toObject());return vI(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 TN)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;sb(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else sb(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 hNt(this.matrix,r),vI(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 vI(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 TN)if(!r(this.values[n],e.values[n]))return!1;return!0}};var Kq="Invalid Interval";function hYr(t,e){return!t||!t.isValid?aP.invalid("missing or invalid start"):!e||!e.isValid?aP.invalid("missing or invalid end"):ee:!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(Gq).filter(a=>this.contains(a)).sort((a,s)=>a.toMillis()-s.toMillis()),n=[],{s:o}=this,i=0;for(;o+this.e?this.e:a;n.push(t.fromDateTimes(o,s)),o=s,i+=1}return n}splitBy(e){let r=Za.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,o=1,i,a=[];for(;nu*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:!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=n?null:t.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.se.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()})`:Kq}[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=mI,r={}){return this.isValid?lc.create(this.s.loc.clone(r),e).formatInterval(this):Kq}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Kq}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Kq}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Kq}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:Kq}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):Za.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var sP=class{static hasDST(e=Po.defaultZone){let r=Yr.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return nf.isValidZone(e)}static normalizeZone(e){return ab(e,Po.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||Eo.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||Eo.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||Eo.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Eo.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Eo.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||Eo.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||Eo.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Eo.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return Eo.create(r,null,"gregory").eras(e)}static features(){return{relative:Aie(),localeWeek:Iie()}}};function bNt(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(Za.fromMillis(n).as("days"))}function gYr(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=bNt(u,l);return(c-c%7)/7}],["days",bNt]],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 _Nt(t,e,r,n){let[o,i,a,s]=gYr(t,e,r),u=e-o,l=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);l.length===0&&(a0?Za.fromMillis(u,n).shiftTo(...l).plus(c):c}var yYr="missing Intl.DateTimeFormat.formatToParts support";function oi(t,e=r=>r){return{regex:t,deser:([r])=>e(Ijt(r))}}var bYr="\xA0",SNt=`[ ${bYr}]`,xNt=new RegExp(SNt,"g");function _Yr(t){return t.replace(/\./g,"\\.?").replace(xNt,SNt)}function vNt(t){return t.replace(/\./g,"").replace(xNt," ").toLowerCase()}function ub(t,e){return t===null?null:{regex:RegExp(t.map(_Yr).join("|")),deser:([r])=>t.findIndex(n=>vNt(r)===vNt(n))+e}}function wNt(t,e){return{regex:t,deser:([,r,n])=>ON(r,n),groups:e}}function Nie(t){return{regex:t,deser:([e])=>e}}function vYr(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function wYr(t,e){let r=xg(e),n=xg(e,"{2}"),o=xg(e,"{3}"),i=xg(e,"{4}"),a=xg(e,"{6}"),s=xg(e,"{1,2}"),u=xg(e,"{1,3}"),l=xg(e,"{1,6}"),c=xg(e,"{1,9}"),d=xg(e,"{2,4}"),f=xg(e,"{4,6}"),p=b=>({regex:RegExp(vYr(b.val)),deser:([g])=>g,literal:!0}),h=(b=>{if(t.literal)return p(b);switch(b.val){case"G":return ub(e.eras("short"),0);case"GG":return ub(e.eras("long"),0);case"y":return oi(l);case"yy":return oi(d,V6);case"yyyy":return oi(i);case"yyyyy":return oi(f);case"yyyyyy":return oi(a);case"M":return oi(s);case"MM":return oi(n);case"MMM":return ub(e.months("short",!0),1);case"MMMM":return ub(e.months("long",!0),1);case"L":return oi(s);case"LL":return oi(n);case"LLL":return ub(e.months("short",!1),1);case"LLLL":return ub(e.months("long",!1),1);case"d":return oi(s);case"dd":return oi(n);case"o":return oi(u);case"ooo":return oi(o);case"HH":return oi(n);case"H":return oi(s);case"hh":return oi(n);case"h":return oi(s);case"mm":return oi(n);case"m":return oi(s);case"q":return oi(s);case"qq":return oi(n);case"s":return oi(s);case"ss":return oi(n);case"S":return oi(u);case"SSS":return oi(o);case"u":return Nie(c);case"uu":return Nie(s);case"uuu":return oi(r);case"a":return ub(e.meridiems(),0);case"kkkk":return oi(i);case"kk":return oi(d,V6);case"W":return oi(s);case"WW":return oi(n);case"E":case"c":return oi(r);case"EEE":return ub(e.weekdays("short",!1),1);case"EEEE":return ub(e.weekdays("long",!1),1);case"ccc":return ub(e.weekdays("short",!0),1);case"cccc":return ub(e.weekdays("long",!0),1);case"Z":case"ZZ":return wNt(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return wNt(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return Nie(/[a-z_+-/]{1,256}?/i);case" ":return Nie(/[^\S\n\r]/);default:return p(b)}})(t)||{invalidReason:yYr};return h.token=t,h}var SYr={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function xYr(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=SYr[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function CYr(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function OYr(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(bI(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 PYr(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 sr(t.z)||(r=nf.create(t.z)),sr(t.Z)||(r||(r=new sc(t.Z)),n=t.Z),sr(t.q)||(t.M=(t.q-1)*3+1),sr(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),sr(t.u)||(t.S=H6(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}var Y1e=null;function EYr(){return Y1e||(Y1e=Yr.fromMillis(1555555555555)),Y1e}function TYr(t,e){if(t.literal)return t;let r=lc.macroTokenToFormatOpts(t.val),n=Q1e(r,e);return n==null||n.includes(void 0)?t:n}function Z1e(t,e){return Array.prototype.concat(...t.map(r=>TYr(r,e)))}var G6=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=Z1e(lc.parseFormat(r),e),this.units=this.tokens.map(n=>wYr(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=CYr(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=OYr(e,this.regex,this.handlers),[o,i,a]=n?PYr(n):[null,null,void 0];if(bI(n,"a")&&bI(n,"H"))throw new nb("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 X1e(t,e,r){return new G6(t,r).explainFromTokens(e)}function CNt(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=X1e(t,e,r);return[n,o,i,a]}function Q1e(t,e){if(!t)return null;let n=lc.create(e,t).dtFormatter(EYr()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>xYr(a,t,i))}var eje="Invalid DateTime",ONt=864e13;function J6(t){return new uc("unsupported zone",`the zone "${t.name}" is not supported`)}function tje(t){return t.weekData===null&&(t.weekData=q6(t.c)),t.weekData}function rje(t){return t.localWeekData===null&&(t.localWeekData=q6(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function AN(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Yr({...r,...e,old:r})}function RNt(t,e,r){let n=t-e*60*1e3,o=r.offset(n);if(e===o)return[n,e];n-=(o-e)*60*1e3;let i=r.offset(n);return o===i?[n,o]:[t-Math.min(o,i)*60*1e3,Math.max(o,i)]}function Die(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function Fie(t,e,r){return RNt(Dq(t),e,r)}function PNt(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,$q(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=Za.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=Dq(i),[u,l]=RNt(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function Jq(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=Yr.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return Yr.invalid(new uc("unparsable",`the input "${o}" can't be parsed as ${n}`))}function Lie(t,e,r=!0){return t.isValid?lc.create(Eo.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function nje(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=Ya(t.c.year,r?6:4),e?(n+="-",n+=Ya(t.c.month),n+="-",n+=Ya(t.c.day)):(n+=Ya(t.c.month),n+=Ya(t.c.day)),n}function ENt(t,e,r,n,o,i){let a=Ya(t.c.hour);return e?(a+=":",a+=Ya(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=Ya(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=Ya(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=Ya(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=Ya(Math.trunc(-t.o/60)),a+=":",a+=Ya(Math.trunc(-t.o%60))):(a+="+",a+=Ya(Math.trunc(t.o/60)),a+=":",a+=Ya(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}var jNt={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},AYr={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},IYr={ordinal:1,hour:0,minute:0,second:0,millisecond:0},NNt=["year","month","day","hour","minute","second","millisecond"],MYr=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],RYr=["year","ordinal","hour","minute","second","millisecond"];function jYr(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 Nq(t);return e}function TNt(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return jYr(t)}}function NYr(t){return $ie[t]||(kie===void 0&&(kie=Po.now()),$ie[t]=t.offset(kie)),$ie[t]}function ANt(t,e){let r=ab(e.zone,Po.defaultZone);if(!r.isValid)return Yr.invalid(J6(r));let n=Eo.fromObject(e),o,i;if(sr(t.year))o=Po.now();else{for(let u of NNt)sr(t[u])&&(t[u]=jNt[u]);let a=B1e(t)||q1e(t);if(a)return Yr.invalid(a);let s=NYr(r);[o,i]=Fie(t,s,r)}return new Yr({ts:o,zone:r,loc:n,o:i})}function INt(t,e,r){let n=sr(r.round)?!0:r.round,o=(a,s)=>(a=Lq(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 MNt(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var kie,$ie={},Yr=class t{constructor(e){let r=e.zone||Po.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new uc("invalid input"):null)||(r.isValid?null:J6(r));this.ts=sr(e.ts)?Po.now():e.ts;let o=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[o,i]=[e.old.c,e.old.o];else{let s=sb(e.o)&&!e.old?e.o:r.offset(this.ts);o=Die(this.ts,s),n=Number.isNaN(o.year)?new uc("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||Eo.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]=MNt(arguments),[n,o,i,a,s,u,l]=r;return ANt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=MNt(arguments),[n,o,i,a,s,u,l]=r;return e.zone=sc.utcInstance,ANt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=Kjt(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=ab(r.zone,Po.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:Eo.fromObject(r)}):t.invalid(J6(o))}static fromMillis(e,r={}){if(sb(e))return e<-ONt||e>ONt?t.invalid("Timestamp out of range"):new t({ts:e,zone:ab(r.zone,Po.defaultZone),loc:Eo.fromObject(r)});throw new ys(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(sb(e))return new t({ts:e*1e3,zone:ab(r.zone,Po.defaultZone),loc:Eo.fromObject(r)});throw new ys("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=ab(r.zone,Po.defaultZone);if(!n.isValid)return t.invalid(J6(n));let o=Eo.fromObject(r),i=Bq(e,TNt),{minDaysInFirstWeek:a,startOfWeek:s}=$1e(i,o),u=Po.now(),l=sr(r.specificOffset)?n.offset(u):r.specificOffset,c=!sr(i.ordinal),d=!sr(i.year),f=!sr(i.month)||!sr(i.day),p=d||f,m=i.weekYear||i.weekNumber;if((p||c)&&m)throw new nb("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new nb("Can't mix ordinal dates with month/day");let h=m||i.weekday&&!p,b,g,y=Die(u,l);h?(b=MYr,g=AYr,y=q6(y,a,s)):c?(b=RYr,g=IYr,y=jie(y)):(b=NNt,g=jNt);let S=!1;for(let R of b){let N=i[R];sr(N)?S?i[R]=g[R]:i[R]=y[R]:S=!0}let x=h?Hjt(i,a,s):c?Vjt(i):B1e(i),O=x||q1e(i);if(O)return t.invalid(O);let P=h?F1e(i,a,s):c?k1e(i):i,[E,A]=Fie(P,l,n),I=new t({ts:E,zone:n,o:A,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]=uNt(e);return Jq(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=lNt(e);return Jq(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=cNt(e);return Jq(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(sr(e)||sr(r))throw new ys("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=Eo.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=CNt(a,e,r);return c?t.invalid(c):Jq(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]=pNt(e);return Jq(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new ys("need to specify a reason the DateTime is invalid");let n=e instanceof uc?e:new uc(e,r);if(Po.throwOnInvalid)throw new wie(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=Q1e(e,Eo.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return Z1e(lc.parseFormat(e),Eo.fromObject(r)).map(o=>o.val).join("")}static resetCache(){kie=void 0,$ie={}}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?tje(this).weekYear:NaN}get weekNumber(){return this.isValid?tje(this).weekNumber:NaN}get weekday(){return this.isValid?tje(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?rje(this).weekday:NaN}get localWeekNumber(){return this.isValid?rje(this).weekNumber:NaN}get localWeekYear(){return this.isValid?rje(this).weekYear:NaN}get ordinal(){return this.isValid?jie(this.c).ordinal:NaN}get monthShort(){return this.isValid?sP.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?sP.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?sP.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?sP.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=Dq(this.c),o=this.zone.offset(n-e),i=this.zone.offset(n+e),a=this.zone.offset(n-o*r),s=this.zone.offset(n-i*r);if(a===s)return[this];let u=n-a*r,l=n-s*r,c=Die(u,a),d=Die(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[AN(this,{ts:u}),AN(this,{ts:l})]:[this]}get isInLeapYear(){return EN(this.year)}get daysInMonth(){return $q(this.year,this.month)}get daysInYear(){return this.isValid?yI(this.year):NaN}get weeksInWeekYear(){return this.isValid?PN(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?PN(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=lc.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(sc.instance(e),r)}toLocal(){return this.setZone(Po.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=ab(e,Po.defaultZone),e.equals(this.zone))return this;if(e.isValid){let o=this.ts;if(r||n){let i=e.offset(this.ts),a=this.toObject();[o]=Fie(a,i,e)}return AN(this,{ts:o,zone:e})}else return t.invalid(J6(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return AN(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=Bq(e,TNt),{minDaysInFirstWeek:n,startOfWeek:o}=$1e(r,this.loc),i=!sr(r.weekYear)||!sr(r.weekNumber)||!sr(r.weekday),a=!sr(r.ordinal),s=!sr(r.year),u=!sr(r.month)||!sr(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new nb("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new nb("Can't mix ordinal dates with month/day");let d;i?d=F1e({...q6(this.c,n,o),...r},n,o):sr(r.ordinal)?(d={...this.toObject(),...r},sr(r.day)&&(d.day=Math.min($q(d.year,d.month),d.day))):d=k1e({...jie(this.c),...r});let[f,p]=Fie(d,this.o,this.zone);return AN(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=Za.fromDurationLike(e);return AN(this,PNt(this,r))}minus(e){if(!this.isValid)return this;let r=Za.fromDurationLike(e).negate();return AN(this,PNt(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=Za.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;athis.valueOf(),s=a?this:e,u=a?e:this,l=_Nt(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?aP.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?thisr.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new ys("max requires all arguments be DateTimes");return U1e(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=Eo.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return X1e(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=Eo.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new G6(i,e)}static fromFormatParser(e,r,n={}){if(sr(e)||sr(r))throw new ys("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=Eo.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new ys(`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):Jq(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return mI}static get DATE_MED(){return v6}static get DATE_MED_WITH_WEEKDAY(){return v1e}static get DATE_FULL(){return w6}static get DATE_HUGE(){return S6}static get TIME_SIMPLE(){return x6}static get TIME_WITH_SECONDS(){return C6}static get TIME_WITH_SHORT_OFFSET(){return O6}static get TIME_WITH_LONG_OFFSET(){return P6}static get TIME_24_SIMPLE(){return E6}static get TIME_24_WITH_SECONDS(){return T6}static get TIME_24_WITH_SHORT_OFFSET(){return A6}static get TIME_24_WITH_LONG_OFFSET(){return I6}static get DATETIME_SHORT(){return M6}static get DATETIME_SHORT_WITH_SECONDS(){return R6}static get DATETIME_MED(){return j6}static get DATETIME_MED_WITH_SECONDS(){return N6}static get DATETIME_MED_WITH_WEEKDAY(){return w1e}static get DATETIME_FULL(){return D6}static get DATETIME_FULL_WITH_SECONDS(){return L6}static get DATETIME_HUGE(){return F6}static get DATETIME_HUGE_WITH_SECONDS(){return k6}};function Gq(t){if(Yr.isDateTime(t))return t;if(t&&t.valueOf&&sb(t.valueOf()))return Yr.fromJSDate(t);if(t&&typeof t=="object")return Yr.fromObject(t);throw new ys(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var DNt=require("obsidian");Td();async function DYr(){let t=new Date,e=t.getTimezoneOffset(),r=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value||"Unknown";return{epoch:Math.floor(t.getTime()),isoString:t.toISOString(),userLocaleString:t.toLocaleString(),localDateString:t.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),timezoneOffset:-e,timezone:r}}var LNt=Qm(async()=>DYr(),{name:"getCurrentTime",description:"Get the current time in various formats, including timezone information",schema:Wr.object({})}),FNt={jan:1,january:1,feb:2,february:2,mar:3,march:3,apr:4,april:4,may:5,jun:6,june:6,jul:7,july:7,aug:8,august:8,sep:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};function LYr(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 FYr(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 kYr(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=_1e(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=Yr.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 $Yr(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=FNt[r[1]],o=e.year;n>e.month&&o--;let i=Yr.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 BYr(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=Yr.fromObject({year:n,month:1,day:1}),i=Yr.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 qYr(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=Yr.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 UYr(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=FNt[r[1].toLowerCase()],o=parseInt(r[2]),i=Yr.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 zYr(t){let e=Yr.now(),r=t.toLowerCase().replace("@vault","").trim(),n=LYr(r,e)||FYr(r,e)||kYr(r,e)||$Yr(r,e)||UYr(r,e)||qYr(r,e)||BYr(r,e);if(n)return{startTime:Y6(n.start),endTime:Y6(n.end)};let o=_1e(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=Yr.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?Yr.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:Y6(i),endTime:Y6(a)}}console.warn(`Unable to parse time expression: ${t}`)}function Y6(t){let e=t.toJSDate(),r=e.getTimezoneOffset(),n=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(e).find(o=>o.type==="timeZoneName")?.value||"Unknown";return{epoch:Math.floor(e.getTime()),isoString:e.toISOString(),userLocaleString:e.toLocaleString(),localDateString:e.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),timezoneOffset:-r,timezone:n}}var kNt=Qm(async({timeExpression:t})=>zYr(t),{name:"getTimeRangeMs",description:"Get a time range in milliseconds based on a natural language time expression",schema:Wr.object({timeExpression:Wr.string().describe("A natural language time expression (e.g., 'last week', 'from July 1 to July 15')")})});function HYr(t){let e=t.toString().length===10?t*1e3:t,r=Yr.fromMillis(e);return Y6(r)}var $Nt=Qm(async({epoch:t})=>HYr(t),{name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:Wr.object({epoch:Wr.number().describe("Unix timestamp in seconds or milliseconds")})});function VYr(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 WYr(t="25min"){let e=VYr(t);return new Promise(r=>{setTimeout(()=>{new DNt.Notice(`Pomodoro timer (${t}) completed! Take a break!`),r()},e)})}var oje=Qm(async({interval:t="25min"})=>(WYr(t),`Pomodoro timer started. It will end in ${t}.`),{name:"startPomodoro",description:"Start a Pomodoro timer with a customizable interval",schema:Wr.object({interval:Wr.string().optional().describe("Time interval (e.g., '25min', '5s', '1h'). Default is 25min.")})});mg();ZA();Td();var Bie=Qm(async({url:t})=>{try{let e=await Fi.getInstance().youtube4llm(t);return e.response.transcript?JSON.stringify({success:!0,transcript:e.response.transcript,elapsed_time_ms:e.elapsed_time_ms}):JSON.stringify({success:!1,message:"Transcript not available. Only English videos with the auto transcript option turned on are supported at the moment"})}catch(e){return console.error(`Error transcribing YouTube video ${t}:`,e),JSON.stringify({success:!1,message:"An error occurred while transcribing the YouTube video."})}},{name:"youtubeTranscription",description:"Get the transcript of a YouTube video",schema:Wr.object({url:Wr.string().describe("The YouTube video URL"),brevilabsClient:Wr.any().describe("The BrevilabsClient instance")})});Cn();mg();var Z6=["@vault","@composer","@websearch","@youtube","@pomodoro"],IN=class{static initTools(e){this.tools.length===0&&(this.tools=[LNt,$Nt,kNt,t1e,M1t,oje,r1e,Bie,I1t(e.getRoot())])}static async analyzeIntent(e){try{let r=await Fi.getInstance().broca(e,zR());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 Pq.callTool(u,l)),u.name=="getFileTree"&&zR())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")&&(a.length>0||i)){let u=this.removeAtCommands(e);r.push({tool:t1e,args:{timeRange:i||void 0,query:u,salientTerms:a}})}if(o.includes("@websearch")||o.includes("@web")){let u=this.removeAtCommands(e),c=await ac.instance.getCurrentChainManager().memoryManager.getMemory().loadMemoryVariables({}),d=DR(c);r.push({tool:r1e,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:oje,args:{interval:l}})}let s=yVe(e);for(let u of s)r.some(c=>c.tool.name===Bie.name&&c.args.url===u)||r.push({tool:Bie,args:{url:u}})}static removeAtCommands(e){return e.split(" ").filter(r=>!Z6.includes(r.toLowerCase())).join(" ").trim()}};IN.tools=[];var X6=class{constructor(e){this.updateCurrentAiMessage=e;this.hasOpenThinkBlock=!1;this.fullResponse=""}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+=` + reference: ${JSON.stringify(this.reference)}]`}dayjs(){return(0,V8.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,V8.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?(gie(o,n),rb(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(Tq(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}},rP=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 io(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 c1e(t,e,r="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${t}${n}(?:${r}${n}){0,10}`}function iJr(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function Qc(t){return`(?:${iJr(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var q1t=F(iI(),1);function bie(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function uI(t,e,r){let n=(0,q1t.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))31)return r.index=r.index+r[K1t].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[J1t]){let a=cI(r[J1t]);n.start.assign("year",a)}else{let a=uI(e.refDate,i,o);n.start.imply("year",a)}if(r[G1t]){let a=Iq(r[G1t]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};var mJr=new RegExp(`(${Qc(vg)})(?:-|/|\\s*,?\\s*)(${Aq})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${Aq})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${lI}))?(?=\\W|$)(?!\\:\\d)`,"i"),hJr=1,Y1t=2,h1e=3,g1e=4,J8=class extends pi{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return mJr}innerExtract(e,r){let n=vg[r[hJr].toLowerCase()],o=Iq(r[Y1t]);if(o>31||this.shouldSkipYearLikeDate&&!r[h1e]&&!r[g1e]&&r[Y1t].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[g1e]){let u=cI(r[g1e]);i.assign("year",u)}else{let u=uI(e.refDate,o,n);i.imply("year",u)}if(!r[h1e])return i;let a=Iq(r[h1e]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}};var gJr=new RegExp(`((?:in)\\s*)?(${Qc(vg)})\\s*(?:[,-]?\\s*(${lI})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),yJr=1,bJr=2,Z1t=3,Y8=class extends pi{innerPattern(){return gJr}innerExtract(e,r){let n=r[bJr].toLowerCase();if(r[0].length<=3&&!m1e[n])return null;let o=e.createParsingResult(r.index+(r[yJr]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=vg[n];if(o.start.assign("month",i),r[Z1t]){let a=cI(r[Z1t]);o.start.assign("year",a)}else{let a=uI(e.refDate,1,i);o.start.imply("year",a)}return o}};var _Jr=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${Qc(vg)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),vJr=1,wJr=2,X1t=3,SJr=4,Z8=class extends pi{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return _Jr}innerExtract(e,r){let n=parseInt(r[vJr]),o=parseInt(r[SJr]),i=r[X1t]?parseInt(r[X1t]):vg[r[wJr].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 xJr=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),CJr=1,OJr=2,X8=class extends pi{innerPattern(){return xJr}innerExtract(e,r){let n=parseInt(r[OJr]),o=parseInt(r[CJr]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}};function PJr(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 EJr(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 Q1t=2,Mq=3,_ie=4,vie=5,Q8=6,wie=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[Q1t]);if(s>100){if(this.strictMode||r[Mq]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[Mq]!=null){if(r[Mq].length==1&&!r[Q8])return null;i=parseInt(r[Mq])}if(i>=60)return null;if(s>12&&(a=oo.PM),r[Q8]!=null){if(s>12)return null;let u=r[Q8][0].toLowerCase();u=="a"&&(a=oo.AM,s==12&&(s=0)),u=="p"&&(a=oo.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",oo.AM):o.imply("meridiem",oo.PM),r[vie]!=null){let u=parseInt(r[vie].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[_ie]!=null){let u=parseInt(r[_ie]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[vie]!=null){let u=parseInt(r[vie].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[_ie]!=null){let u=parseInt(r[_ie]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[Q1t]),a=0,s=-1;if(r[Mq]!=null?a=parseInt(r[Mq]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=oo.PM),r[Q8]!=null){if(i>12)return null;let u=r[Q8][0].toLowerCase();u=="a"&&(s=oo.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=oo.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==oo.AM?(n.start.imply("meridiem",oo.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",oo.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",oo.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",oo.PM)):i>12?o.imply("meridiem",oo.PM):i<=12&&o.imply("meridiem",oo.AM),o.date().getTime()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=PJr(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=EJr(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}};var e6=class extends wie{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",oo.PM)):o<6&&n.assign("meridiem",oo.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",oo.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",oo.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}};function fI(t){let e={};for(let r in t)e[r]=-t[r];return e}function ejt(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 TJr=new RegExp(`(${nP})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),AJr=new RegExp(`(${dI})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),t6=class extends pi{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?AJr:TJr}innerExtract(e,r){let n=wg(r[1]);if(!n)return null;let o=fI(n);return io.createRelativeFromReference(e.reference,o)}};var IJr=new RegExp(`(${nP})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),MJr=new RegExp(`(${dI})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),RJr=1,r6=class extends pi{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?MJr:IJr}innerExtract(e,r){let n=wg(r[RJr]);return n?io.createRelativeFromReference(e.reference,n):null}};var Sie=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},Sg=class{refine(e,r){if(r.length<2)return r;let n=[],o=r[0],i=null;for(let a=1;a{console.log(`${this.constructor.name} merged ${u} and ${l} into ${c}`)}),o=c}}return o!=null&&n.push(o),n}};var n6=class extends Sg{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{let i=e.text.substring(o.index+o.text.length),a=jJr.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=yie(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 NJr=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),DJr=1,LJr=2,FJr=3,s6=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=NJr.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[LJr]),s=parseInt(i[FJr]||"0"),u=a*60+s;u>14*60||(i[DJr]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}};var pI=class{refine(e,r){if(r.length<2)return r;let n=[],o=r[0];for(let i=1;i=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 rjt=F(iI(),1);var u6=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,rjt.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),CN(n.start,o),n.end&&n.end.isOnlyTime()&&(CN(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),CN(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 l6=class extends Sie{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 kJr=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"),$Jr=1,BJr=2,qJr=3,njt=4,UJr=5,ojt=6,ijt=7,zJr=8,ajt=9,sjt=10,c6=class extends pi{innerPattern(){return kJr}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[$Jr]),month:parseInt(r[BJr]),day:parseInt(r[qJr])});if(r[njt]!=null&&(n.assign("hour",parseInt(r[njt])),n.assign("minute",parseInt(r[UJr])),r[ojt]!=null&&n.assign("second",parseInt(r[ojt])),r[ijt]!=null&&n.assign("millisecond",parseInt(r[ijt])),r[zJr]!=null)){let o=0;if(r[ajt]){let i=parseInt(r[ajt]),a=0;r[sjt]!=null&&(a=parseInt(r[sjt])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}};var d6=class extends Sg{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 ujt(t,e=!1){return t.parsers.unshift(new c6),t.refiners.unshift(new d6),t.refiners.unshift(new s6),t.refiners.unshift(new pI),t.refiners.push(new a6),t.refiners.push(new pI),t.refiners.push(new u6),t.refiners.push(new l6(e)),t}var wjt=F(iI(),1);var jq=F(iI(),1);function ljt(t){let e=(0,jq.default)(t.instant),r=new io(t,{});return rb(r,e),gie(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function cjt(t){let e=(0,jq.default)(t.instant),r=new io(t,{});return rb(r,e),Tq(r,e),r.addTag("casualReference/today"),r}function djt(t){return HJr(t,1).addTag("casualReference/yesterday")}function HJr(t,e){return pjt(t,-e)}function fjt(t){return pjt(t,1).addTag("casualReference/tomorrow")}function pjt(t,e){let r=(0,jq.default)(t.instant),n=new io(t,{});return r=r.add(e,"day"),rb(n,r),Tq(n,r),n}function mjt(t,e=22){let r=(0,jq.default)(t.instant),n=new io(t,{});return rb(n,r),n.imply("hour",e),n.imply("meridiem",oo.PM),n.addTag("casualReference/tonight"),n}function hjt(t,e=20){let r=new io(t,{});return r.imply("meridiem",oo.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function gjt(t){let e=new io(t,{}),r=(0,jq.default)(t.instant);return r.hour()>2&&k1t(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function yjt(t,e=6){let r=new io(t,{});return r.imply("meridiem",oo.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function bjt(t,e=15){let r=new io(t,{});return r.imply("meridiem",oo.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function _jt(t){let e=new io(t,{});return e.imply("meridiem",oo.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var VJr=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,f6=class extends pi{innerPattern(e){return VJr}innerExtract(e,r){let n=(0,wjt.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=ljt(e.reference);break;case"today":i=cjt(e.reference);break;case"yesterday":i=djt(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=fjt(e.reference);break;case"tonight":i=mjt(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),rb(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}};var WJr=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,p6=class extends pi{innerPattern(){return WJr}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=bjt(e.reference);break;case"evening":case"night":n=hjt(e.reference);break;case"midnight":n=gjt(e.reference);break;case"morning":n=yjt(e.reference);break;case"noon":case"midday":n=_jt(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}};function Sjt(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=KJr(n,e,r),i=new io(t);return i=ejt(i,{day:o}),i.assign("weekday",e),i}function KJr(t,e,r){let n=t.getDay();switch(r){case"this":return xie(t,e);case"last":return xjt(t,e);case"next":return n==tu.SUNDAY?e==tu.SUNDAY?7:e:n==tu.SATURDAY?e==tu.SATURDAY?7:e==tu.SUNDAY?8:1+e:e=0&&(n-=7),n}var JJr=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${Qc(p1e)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),YJr=1,ZJr=2,XJr=3,m6=class extends pi{innerPattern(){return JJr}innerExtract(e,r){let n=r[ZJr].toLowerCase(),o=p1e[n],i=r[YJr],a=r[XJr],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"),Sjt(e.reference,o,u)}};var Cjt=F(iI(),1);var QJr=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${Qc(W8)})(?=\\s*)(?=\\W|$)`,"i"),e7r=1,t7r=2,h6=class extends pi{innerPattern(){return QJr}innerExtract(e,r){let n=r[e7r].toLowerCase(),o=r[t7r].toLowerCase(),i=W8[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,io.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,io.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,Cjt.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 r7r=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"),n7r=1,o7r=5,Ojt=2,Pjt=3,b1e=4,g6=class{constructor(e){this.groupNumberMonth=e?Pjt:Ojt,this.groupNumberDay=e?Ojt:Pjt}pattern(){return r7r}extract(e,r){let n=r.index+r[n7r].length,o=r.index+r[0].length-r[o7r].length;if(n>0&&e.text.substring(0,n).match("\\d/?$")||o12)&&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[b1e]){let l=parseInt(r[b1e]),c=bie(l);a.start.assign("year",c)}else{let l=uI(e.refDate,u,s);a.start.imply("year",l)}return a}};var i7r=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${nP})(?=\\W|$)`,"i"),a7r=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${dI})(?=\\W|$)`,"i"),y6=class extends pi{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?i7r:a7r}innerExtract(e,r){let n=r[1].toLowerCase(),o=wg(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=fI(o);break}return io.createRelativeFromReference(e.reference,o)}};function s7r(t){return t.text.match(/^[+-]/i)!=null}function Ejt(t){return t.text.match(/^-/i)!=null}var b6=class extends Sg{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?s7r(n)||Ejt(n):!1}mergeResults(e,r,n,o){let i=wg(n.text);Ejt(n)&&(i=fI(i));let a=io.createRelativeFromReference(new sI(r.start.date()),i);return new rP(r.reference,r.index,`${r.text}${e}${n.text}`,a)}};function Tjt(t){return t.text.match(/\s+(before|from)$/i)!=null}function u7r(t){return t.text.match(/\s+(after|since)$/i)!=null}var _6=class extends Sg{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!Tjt(r)&&!u7r(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=wg(r.text);Tjt(r)&&(o=fI(o));let i=io.createRelativeFromReference(new sI(n.start.date()),o);return new rP(n.reference,r.index,`${r.text}${e}${n.text}`,i)}};var l7r=new RegExp(`^\\s*(${lI})`,"i"),c7r=1,v6=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=l7r.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=cI(i[c7r]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}};var ON=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new f6),r.parsers.push(new p6),r.parsers.push(new Y8),r.parsers.push(new h6),r.parsers.push(new y6),r}createConfiguration(e=!0,r=!1){let n=ujt({parsers:[new g6(r),new K8(e),new G8,new J8(r),new m6,new X8,new e6(e),new t6(e),new r6(e)],refiners:[new Rq]},e);return n.parsers.unshift(new Z8(e)),n.refiners.unshift(new _6),n.refiners.unshift(new b6),n.refiners.unshift(new pI),n.refiners.push(new Rq),n.refiners.push(new v6),n.refiners.push(new o6),n}};var Nq=class t{constructor(e){this.defaultConfig=new ON,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 _1e(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 rP?c=l:l instanceof io?(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}},_1e=class{constructor(e,r,n){this.text=e,this.reference=new sI(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof io?e:new io(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 rP(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 v1e=new ON,Ajt=new Nq(v1e.createCasualConfiguration(!1)),d7r=new Nq(v1e.createConfiguration(!0,!1)),tVo=new Nq(v1e.createCasualConfiguration(!0));var p7r=Ajt;function w1e(t,e,r){return p7r.parse(t,e,r)}var oP=class extends Error{},Cie=class extends oP{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Oie=class extends oP{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Pie=class extends oP{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},nb=class extends oP{},Dq=class extends oP{constructor(e){super(`Invalid unit ${e}`)}},ys=class extends oP{},ob=class extends oP{constructor(){super("Zone is an abstract class")}};var lt="numeric",ib="short",th="long",mI={year:lt,month:lt,day:lt},w6={year:lt,month:ib,day:lt},S1e={year:lt,month:ib,day:lt,weekday:ib},S6={year:lt,month:th,day:lt},x6={year:lt,month:th,day:lt,weekday:th},C6={hour:lt,minute:lt},O6={hour:lt,minute:lt,second:lt},P6={hour:lt,minute:lt,second:lt,timeZoneName:ib},E6={hour:lt,minute:lt,second:lt,timeZoneName:th},T6={hour:lt,minute:lt,hourCycle:"h23"},A6={hour:lt,minute:lt,second:lt,hourCycle:"h23"},I6={hour:lt,minute:lt,second:lt,hourCycle:"h23",timeZoneName:ib},M6={hour:lt,minute:lt,second:lt,hourCycle:"h23",timeZoneName:th},R6={year:lt,month:lt,day:lt,hour:lt,minute:lt},j6={year:lt,month:lt,day:lt,hour:lt,minute:lt,second:lt},N6={year:lt,month:ib,day:lt,hour:lt,minute:lt},D6={year:lt,month:ib,day:lt,hour:lt,minute:lt,second:lt},x1e={year:lt,month:ib,day:lt,weekday:ib,hour:lt,minute:lt},L6={year:lt,month:th,day:lt,hour:lt,minute:lt,timeZoneName:ib},F6={year:lt,month:th,day:lt,hour:lt,minute:lt,second:lt,timeZoneName:ib},k6={year:lt,month:th,day:lt,weekday:th,hour:lt,minute:lt,timeZoneName:th},$6={year:lt,month:th,day:lt,weekday:th,hour:lt,minute:lt,second:lt,timeZoneName:th};var Yp=class{get type(){throw new ob}get name(){throw new ob}get ianaName(){return this.name}get isUniversal(){throw new ob}offsetName(e,r){throw new ob}formatOffset(e,r){throw new ob}offset(e){throw new ob}equals(e){throw new ob}get isValid(){throw new ob}};var C1e=null,hI=class t extends Yp{static get instance(){return C1e===null&&(C1e=new t),C1e}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Tie(e,r,n)}formatOffset(e,r){return gI(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Iie={};function h7r(t){return Iie[t]||(Iie[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"})),Iie[t]}var g7r={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function y7r(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 b7r(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o=0?m:1e3+m,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var Ijt={};function _7r(t,e={}){let r=JSON.stringify([t,e]),n=Ijt[r];return n||(n=new Intl.ListFormat(t,e),Ijt[r]=n),n}var O1e={};function P1e(t,e={}){let r=JSON.stringify([t,e]),n=O1e[r];return n||(n=new Intl.DateTimeFormat(t,e),O1e[r]=n),n}var E1e={};function v7r(t,e={}){let r=JSON.stringify([t,e]),n=E1e[r];return n||(n=new Intl.NumberFormat(t,e),E1e[r]=n),n}var T1e={};function w7r(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=T1e[o];return i||(i=new Intl.RelativeTimeFormat(t,e),T1e[o]=i),i}var B6=null;function S7r(){return B6||(B6=new Intl.DateTimeFormat().resolvedOptions().locale,B6)}var Mjt={};function x7r(t){let e=Mjt[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,Mjt[t]=e}return e}function C7r(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=P1e(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=P1e(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function O7r(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function P7r(t){let e=[];for(let r=1;r<=12;r++){let n=Yr.utc(2009,r,1);e.push(t(n))}return e}function E7r(t){let e=[];for(let r=1;r<=7;r++){let n=Yr.utc(2016,11,13+r);e.push(t(n))}return e}function Mie(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function T7r(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 A1e=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=v7r(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):Fq(e,3);return Ya(r,this.padTo)}}},I1e=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&&nf.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=P1e(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()}},M1e=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Rie()&&(this.rtf=w7r(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):Rjt(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},A7r={firstDay:1,minimalDays:4,weekend:[6,7]},Eo=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,n,o,i=!1){let a=e||Po.defaultLocale,s=a||(i?"en-US":S7r()),u=r||Po.defaultNumberingSystem,l=n||Po.defaultOutputCalendar,c=q6(o)||Po.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){B6=null,O1e={},E1e={},T1e={}}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]=C7r(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=O7r(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=T7r(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,q6(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 Mie(this,e,R1e,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=P7r(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return Mie(this,e,j1e,()=>{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]=E7r(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return Mie(this,void 0,()=>N1e,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Yr.utc(2016,11,13,9),Yr.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Mie(this,e,D1e,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[Yr.utc(-40,1,1),Yr.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 A1e(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new I1e(e,this.intl,r)}relFormatter(e={}){return new M1e(this.intl,this.isEnglish(),e)}listFormatter(e={}){return _7r(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:jie()?x7r(this.locale):A7r}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 F1e=null,sc=class t extends Yp{static get utcInstance(){return F1e===null&&(F1e=new t(0)),F1e}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(PN(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${gI(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${gI(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return gI(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 kq=class extends Yp{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 ab(t,e){let r;if(sr(t)||t===null)return e;if(t instanceof Yp)return t;if(jjt(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?hI.instance:n==="utc"||n==="gmt"?sc.utcInstance:sc.parseSpecifier(n)||nf.create(t)}else return sb(t)?sc.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new kq(t)}var k1e={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"},Njt={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]},I7r=k1e.hanidec.replace(/[\[|\]]/g,"").split("");function Djt(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}var $q={};function Ljt(){$q={}}function xg({numberingSystem:t},e=""){let r=t||"latn";return $q[r]||($q[r]={}),$q[r][e]||($q[r][e]=new RegExp(`${k1e[r]}${e}`)),$q[r][e]}var Fjt=()=>Date.now(),kjt="system",$jt=null,Bjt=null,qjt=null,Ujt=60,zjt,Hjt=null,Po=class{static get now(){return Fjt}static set now(e){Fjt=e}static set defaultZone(e){kjt=e}static get defaultZone(){return ab(kjt,hI.instance)}static get defaultLocale(){return $jt}static set defaultLocale(e){$jt=e}static get defaultNumberingSystem(){return Bjt}static set defaultNumberingSystem(e){Bjt=e}static get defaultOutputCalendar(){return qjt}static set defaultOutputCalendar(e){qjt=e}static get defaultWeekSettings(){return Hjt}static set defaultWeekSettings(e){Hjt=q6(e)}static get twoDigitCutoffYear(){return Ujt}static set twoDigitCutoffYear(e){Ujt=e%100}static get throwOnInvalid(){return zjt}static set throwOnInvalid(e){zjt=e}static resetCaches(){Eo.resetCache(),nf.resetCache(),Yr.resetCache(),Ljt()}};var uc=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var Vjt=[0,31,59,90,120,151,181,212,243,273,304,334],Wjt=[0,31,60,91,121,152,182,213,244,274,305,335];function Cg(t,e){return new uc("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Nie(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 Kjt(t,e,r){return r+(TN(t)?Wjt:Vjt)[e-1]}function Gjt(t,e){let r=TN(t)?Wjt:Vjt,n=r.findIndex(i=>iEN(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...H6(t)}}function $1e(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=Die(Nie(n,1,e),r),s=yI(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=yI(l)):u>s?(l=n+1,u-=yI(n)):l=n;let{month:c,day:d}=Gjt(l,u);return{year:l,month:c,day:d,...H6(t)}}function Lie(t){let{year:e,month:r,day:n}=t,o=Kjt(e,r,n);return{year:e,ordinal:o,...H6(t)}}function B1e(t){let{year:e,ordinal:r}=t,{month:n,day:o}=Gjt(e,r);return{year:e,month:n,day:o,...H6(t)}}function q1e(t,e){if(!sr(t.localWeekday)||!sr(t.localWeekNumber)||!sr(t.localWeekYear)){if(!sr(t.weekday)||!sr(t.weekNumber)||!sr(t.weekYear))throw new nb("Cannot mix locale-based week fields with ISO-based week fields");return sr(t.localWeekday)||(t.weekday=t.localWeekday),sr(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),sr(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 Jjt(t,e=4,r=1){let n=z6(t.weekYear),o=rh(t.weekNumber,1,EN(t.weekYear,e,r)),i=rh(t.weekday,1,7);return n?o?i?!1:Cg("weekday",t.weekday):Cg("week",t.weekNumber):Cg("weekYear",t.weekYear)}function Yjt(t){let e=z6(t.year),r=rh(t.ordinal,1,yI(t.year));return e?r?!1:Cg("ordinal",t.ordinal):Cg("year",t.year)}function U1e(t){let e=z6(t.year),r=rh(t.month,1,12),n=rh(t.day,1,Bq(t.year,t.month));return e?r?n?!1:Cg("day",t.day):Cg("month",t.month):Cg("year",t.year)}function z1e(t){let{hour:e,minute:r,second:n,millisecond:o}=t,i=rh(e,0,23)||e===24&&r===0&&n===0&&o===0,a=rh(r,0,59),s=rh(n,0,59),u=rh(o,0,999);return i?a?s?u?!1:Cg("millisecond",o):Cg("second",n):Cg("minute",r):Cg("hour",e)}function sr(t){return typeof t>"u"}function sb(t){return typeof t=="number"}function z6(t){return typeof t=="number"&&t%1===0}function jjt(t){return typeof t=="string"}function Xjt(t){return Object.prototype.toString.call(t)==="[object Date]"}function Rie(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function jie(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Qjt(t){return Array.isArray(t)?t:[t]}function H1e(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 eNt(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function bI(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function q6(t){if(t==null)return null;if(typeof t!="object")throw new ys("Week settings must be an object");if(!rh(t.firstDay,1,7)||!rh(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!rh(e,1,7)))throw new ys("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function rh(t,e,r){return z6(t)&&t>=e&&t<=r}function M7r(t,e){return t-e*Math.floor(t/e)}function Ya(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function iP(t){if(!(sr(t)||t===null||t===""))return parseInt(t,10)}function _I(t){if(!(sr(t)||t===null||t===""))return parseFloat(t)}function V6(t){if(!(sr(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function Fq(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function TN(t){return t%4===0&&(t%100!==0||t%400===0)}function yI(t){return TN(t)?366:365}function Bq(t,e){let r=M7r(e-1,12)+1,n=t+(e-r)/12;return r===2?TN(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function Lq(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 Zjt(t,e,r){return-Die(Nie(t,1,e),r)+e-1}function EN(t,e=4,r=1){let n=Zjt(t,e,r),o=Zjt(t+1,e,r);return(yI(t)-n+o)/7}function W6(t){return t>99?t:t>Po.twoDigitCutoffYear?1900+t:2e3+t}function Tie(t,e,r,n=null){let o=new Date(t),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(i.timeZone=n);let a={timeZoneName:e,...i},s=new Intl.DateTimeFormat(r,a).formatToParts(o).find(u=>u.type.toLowerCase()==="timezonename");return s?s.value:null}function PN(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 V1e(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new ys(`Invalid unit value ${t}`);return e}function qq(t,e){let r={};for(let n in t)if(bI(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=V1e(o)}return r}function gI(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}${Ya(r,2)}:${Ya(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${Ya(r,2)}${Ya(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function H6(t){return eNt(t,["hour","minute","second","millisecond"])}var R7r=["January","February","March","April","May","June","July","August","September","October","November","December"],W1e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],j7r=["J","F","M","A","M","J","J","A","S","O","N","D"];function R1e(t){switch(t){case"narrow":return[...j7r];case"short":return[...W1e];case"long":return[...R7r];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var K1e=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],G1e=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],N7r=["M","T","W","T","F","S","S"];function j1e(t){switch(t){case"narrow":return[...N7r];case"short":return[...G1e];case"long":return[...K1e];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var N1e=["AM","PM"],D7r=["Before Christ","Anno Domini"],L7r=["BC","AD"],F7r=["B","A"];function D1e(t){switch(t){case"narrow":return[...F7r];case"short":return[...L7r];case"long":return[...D7r];default:return null}}function tNt(t){return N1e[t.hour<12?0:1]}function rNt(t,e){return j1e(e)[t.weekday-1]}function nNt(t,e){return R1e(e)[t.month-1]}function oNt(t,e){return D1e(e)[t.year<0?0:1]}function Rjt(t,e,r="always",n=!1){let o={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&i){let d=t==="days";switch(e){case 1:return d?"tomorrow":`next ${o[t][0]}`;case-1:return d?"yesterday":`last ${o[t][0]}`;case 0:return d?"today":`this ${o[t][0]}`;default:}}let a=Object.is(e,-0)||e<0,s=Math.abs(e),u=s===1,l=o[t],c=n?u?l[1]:l[2]||l[1]:u?o[t][0]:t;return a?`${s} ${c} ago`:`in ${s} ${c}`}function iNt(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var k7r={D:mI,DD:w6,DDD:S6,DDDD:x6,t:C6,tt:O6,ttt:P6,tttt:E6,T:T6,TT:A6,TTT:I6,TTTT:M6,f:R6,ff:N6,fff:L6,ffff:k6,F:j6,FF:D6,FFF:F6,FFFF:$6},lc=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;a0&&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 k7r[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 Ya(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",o=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(p,m)=>this.loc.extract(e,p,m),a=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",s=()=>n?tNt(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,m)=>n?nNt(e,p):i(m?{month:p}:{month:p,day:"numeric"},"month"),l=(p,m)=>n?rNt(e,p):i(m?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),c=p=>{let m=t.macroTokenToFormatOpts(p);return m?this.formatWithSystemDefault(e,m):p},d=p=>n?oNt(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 iNt(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 iNt(i,o(s))}};var sNt=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function zq(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function Hq(...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 Vq(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 uNt(...t){return(e,r)=>{let n={},o;for(o=0;op!==void 0&&(m||p&&c)?-p:p;return[{years:f(_I(r)),months:f(_I(n)),weeks:f(_I(o)),days:f(_I(i)),hours:f(_I(a)),minutes:f(_I(s)),seconds:f(_I(u),u==="-0"),milliseconds:f(V6(l),d)}]}var Z7r={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 Z1e(t,e,r,n,o,i,a){let s={year:e.length===2?W6(iP(e)):iP(e),month:W1e.indexOf(r)+1,day:iP(n),hour:iP(o),minute:iP(i)};return a&&(s.second=iP(a)),t&&(s.weekday=t.length>3?K1e.indexOf(t)+1:G1e.indexOf(t)+1),s}var X7r=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Q7r(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=Z1e(e,o,n,r,i,a,s),p;return u?p=Z7r[u]:l?p=0:p=PN(c,d),[f,new sc(p)]}function eYr(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var tYr=/^(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$/,rYr=/^(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$/,nYr=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function aNt(t){let[,e,r,n,o,i,a,s]=t;return[Z1e(e,o,n,r,i,a,s),sc.utcInstance]}function oYr(t){let[,e,r,n,o,i,a,s]=t;return[Z1e(e,s,r,n,o,i,a),sc.utcInstance]}var iYr=zq(B7r,Y1e),aYr=zq(q7r,Y1e),sYr=zq(U7r,Y1e),uYr=zq(cNt),fNt=Hq(K7r,Wq,K6,G6),lYr=Hq(z7r,Wq,K6,G6),cYr=Hq(H7r,Wq,K6,G6),dYr=Hq(Wq,K6,G6);function pNt(t){return Vq(t,[iYr,fNt],[aYr,lYr],[sYr,cYr],[uYr,dYr])}function mNt(t){return Vq(eYr(t),[X7r,Q7r])}function hNt(t){return Vq(t,[tYr,aNt],[rYr,aNt],[nYr,oYr])}function gNt(t){return Vq(t,[J7r,Y7r])}var fYr=Hq(Wq);function yNt(t){return Vq(t,[G7r,fYr])}var pYr=zq(V7r,W7r),mYr=zq(dNt),hYr=Hq(Wq,K6,G6);function bNt(t){return Vq(t,[pYr,fNt],[mYr,hYr])}var _Nt="Invalid Duration",wNt={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}},gYr={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},...wNt},Og=146097/400,Kq=146097/4800,yYr={years:{quarters:4,months:12,weeks:Og/7,days:Og,hours:Og*24,minutes:Og*24*60,seconds:Og*24*60*60,milliseconds:Og*24*60*60*1e3},quarters:{months:3,weeks:Og/28,days:Og/4,hours:Og*24/4,minutes:Og*24*60/4,seconds:Og*24*60*60/4,milliseconds:Og*24*60*60*1e3/4},months:{weeks:Kq/7,days:Kq,hours:Kq*24,minutes:Kq*24*60,seconds:Kq*24*60*60,milliseconds:Kq*24*60*60*1e3},...wNt},AN=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],bYr=AN.slice(0).reverse();function vI(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 Za(n)}function SNt(t,e){let r=e.milliseconds??0;for(let n of bYr.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function vNt(t,e){let r=SNt(t,e)<0?-1:1;AN.reduceRight((n,o)=>{if(sr(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),AN.reduce((n,o)=>{if(sr(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function _Yr(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var Za=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?yYr:gYr;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Eo.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 ys(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:qq(e,t.normalizeUnit),loc:Eo.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(sb(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new ys(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=gNt(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]=yNt(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 ys("need to specify a reason the Duration is invalid");let n=e instanceof uc?e:new uc(e,r);if(Po.throwOnInvalid)throw new Pie(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 Dq(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?lc.create(this.loc,n).formatDurationFromString(this,e):_Nt}toHuman(e={}){if(!this.isValid)return _Nt;let r=AN.map(n=>{let o=this.values[n];return sr(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+=Fq(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},Yr.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?SNt(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 AN)(bI(r.values,o)||bI(this.values,o))&&(n[o]=r.get(o)+this.get(o));return vI(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]=V1e(e(this.values[n],n));return vI(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...qq(e,t.normalizeUnit)};return vI(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 vI(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return vNt(this.matrix,e),vI(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=_Yr(this.normalize().shiftToAll().toObject());return vI(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 AN)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;sb(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else sb(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 vNt(this.matrix,r),vI(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 vI(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 AN)if(!r(this.values[n],e.values[n]))return!1;return!0}};var Gq="Invalid Interval";function vYr(t,e){return!t||!t.isValid?aP.invalid("missing or invalid start"):!e||!e.isValid?aP.invalid("missing or invalid end"):ee:!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(Jq).filter(a=>this.contains(a)).sort((a,s)=>a.toMillis()-s.toMillis()),n=[],{s:o}=this,i=0;for(;o+this.e?this.e:a;n.push(t.fromDateTimes(o,s)),o=s,i+=1}return n}splitBy(e){let r=Za.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,o=1,i,a=[];for(;nu*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:!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=n?null:t.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.se.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()})`:Gq}[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=mI,r={}){return this.isValid?lc.create(this.s.loc.clone(r),e).formatInterval(this):Gq}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Gq}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Gq}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Gq}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:Gq}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):Za.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var sP=class{static hasDST(e=Po.defaultZone){let r=Yr.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return nf.isValidZone(e)}static normalizeZone(e){return ab(e,Po.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||Eo.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||Eo.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||Eo.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Eo.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Eo.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||Eo.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||Eo.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Eo.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return Eo.create(r,null,"gregory").eras(e)}static features(){return{relative:Rie(),localeWeek:jie()}}};function xNt(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(Za.fromMillis(n).as("days"))}function wYr(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=xNt(u,l);return(c-c%7)/7}],["days",xNt]],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 CNt(t,e,r,n){let[o,i,a,s]=wYr(t,e,r),u=e-o,l=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);l.length===0&&(a0?Za.fromMillis(u,n).shiftTo(...l).plus(c):c}var SYr="missing Intl.DateTimeFormat.formatToParts support";function oi(t,e=r=>r){return{regex:t,deser:([r])=>e(Djt(r))}}var xYr="\xA0",ENt=`[ ${xYr}]`,TNt=new RegExp(ENt,"g");function CYr(t){return t.replace(/\./g,"\\.?").replace(TNt,ENt)}function ONt(t){return t.replace(/\./g,"").replace(TNt," ").toLowerCase()}function ub(t,e){return t===null?null:{regex:RegExp(t.map(CYr).join("|")),deser:([r])=>t.findIndex(n=>ONt(r)===ONt(n))+e}}function PNt(t,e){return{regex:t,deser:([,r,n])=>PN(r,n),groups:e}}function Fie(t){return{regex:t,deser:([e])=>e}}function OYr(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function PYr(t,e){let r=xg(e),n=xg(e,"{2}"),o=xg(e,"{3}"),i=xg(e,"{4}"),a=xg(e,"{6}"),s=xg(e,"{1,2}"),u=xg(e,"{1,3}"),l=xg(e,"{1,6}"),c=xg(e,"{1,9}"),d=xg(e,"{2,4}"),f=xg(e,"{4,6}"),p=b=>({regex:RegExp(OYr(b.val)),deser:([g])=>g,literal:!0}),h=(b=>{if(t.literal)return p(b);switch(b.val){case"G":return ub(e.eras("short"),0);case"GG":return ub(e.eras("long"),0);case"y":return oi(l);case"yy":return oi(d,W6);case"yyyy":return oi(i);case"yyyyy":return oi(f);case"yyyyyy":return oi(a);case"M":return oi(s);case"MM":return oi(n);case"MMM":return ub(e.months("short",!0),1);case"MMMM":return ub(e.months("long",!0),1);case"L":return oi(s);case"LL":return oi(n);case"LLL":return ub(e.months("short",!1),1);case"LLLL":return ub(e.months("long",!1),1);case"d":return oi(s);case"dd":return oi(n);case"o":return oi(u);case"ooo":return oi(o);case"HH":return oi(n);case"H":return oi(s);case"hh":return oi(n);case"h":return oi(s);case"mm":return oi(n);case"m":return oi(s);case"q":return oi(s);case"qq":return oi(n);case"s":return oi(s);case"ss":return oi(n);case"S":return oi(u);case"SSS":return oi(o);case"u":return Fie(c);case"uu":return Fie(s);case"uuu":return oi(r);case"a":return ub(e.meridiems(),0);case"kkkk":return oi(i);case"kk":return oi(d,W6);case"W":return oi(s);case"WW":return oi(n);case"E":case"c":return oi(r);case"EEE":return ub(e.weekdays("short",!1),1);case"EEEE":return ub(e.weekdays("long",!1),1);case"ccc":return ub(e.weekdays("short",!0),1);case"cccc":return ub(e.weekdays("long",!0),1);case"Z":case"ZZ":return PNt(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return PNt(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return Fie(/[a-z_+-/]{1,256}?/i);case" ":return Fie(/[^\S\n\r]/);default:return p(b)}})(t)||{invalidReason:SYr};return h.token=t,h}var EYr={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function TYr(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=EYr[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function AYr(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function IYr(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(bI(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 MYr(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 sr(t.z)||(r=nf.create(t.z)),sr(t.Z)||(r||(r=new sc(t.Z)),n=t.Z),sr(t.q)||(t.M=(t.q-1)*3+1),sr(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),sr(t.u)||(t.S=V6(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}var X1e=null;function RYr(){return X1e||(X1e=Yr.fromMillis(1555555555555)),X1e}function jYr(t,e){if(t.literal)return t;let r=lc.macroTokenToFormatOpts(t.val),n=tje(r,e);return n==null||n.includes(void 0)?t:n}function Q1e(t,e){return Array.prototype.concat(...t.map(r=>jYr(r,e)))}var J6=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=Q1e(lc.parseFormat(r),e),this.units=this.tokens.map(n=>PYr(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=AYr(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=IYr(e,this.regex,this.handlers),[o,i,a]=n?MYr(n):[null,null,void 0];if(bI(n,"a")&&bI(n,"H"))throw new nb("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 eje(t,e,r){return new J6(t,r).explainFromTokens(e)}function ANt(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=eje(t,e,r);return[n,o,i,a]}function tje(t,e){if(!t)return null;let n=lc.create(e,t).dtFormatter(RYr()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>TYr(a,t,i))}var rje="Invalid DateTime",INt=864e13;function Y6(t){return new uc("unsupported zone",`the zone "${t.name}" is not supported`)}function nje(t){return t.weekData===null&&(t.weekData=U6(t.c)),t.weekData}function oje(t){return t.localWeekData===null&&(t.localWeekData=U6(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function IN(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Yr({...r,...e,old:r})}function FNt(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 kie(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 Bie(t,e,r){return FNt(Lq(t),e,r)}function MNt(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,Bq(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=Za.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=Lq(i),[u,l]=FNt(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function Yq(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=Yr.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return Yr.invalid(new uc("unparsable",`the input "${o}" can't be parsed as ${n}`))}function $ie(t,e,r=!0){return t.isValid?lc.create(Eo.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function ije(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=Ya(t.c.year,r?6:4),e?(n+="-",n+=Ya(t.c.month),n+="-",n+=Ya(t.c.day)):(n+=Ya(t.c.month),n+=Ya(t.c.day)),n}function RNt(t,e,r,n,o,i){let a=Ya(t.c.hour);return e?(a+=":",a+=Ya(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=Ya(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=Ya(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=Ya(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=Ya(Math.trunc(-t.o/60)),a+=":",a+=Ya(Math.trunc(-t.o%60))):(a+="+",a+=Ya(Math.trunc(t.o/60)),a+=":",a+=Ya(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}var kNt={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},NYr={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},DYr={ordinal:1,hour:0,minute:0,second:0,millisecond:0},$Nt=["year","month","day","hour","minute","second","millisecond"],LYr=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],FYr=["year","ordinal","hour","minute","second","millisecond"];function kYr(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 Dq(t);return e}function jNt(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return kYr(t)}}function $Yr(t){return Uie[t]||(qie===void 0&&(qie=Po.now()),Uie[t]=t.offset(qie)),Uie[t]}function NNt(t,e){let r=ab(e.zone,Po.defaultZone);if(!r.isValid)return Yr.invalid(Y6(r));let n=Eo.fromObject(e),o,i;if(sr(t.year))o=Po.now();else{for(let u of $Nt)sr(t[u])&&(t[u]=kNt[u]);let a=U1e(t)||z1e(t);if(a)return Yr.invalid(a);let s=$Yr(r);[o,i]=Bie(t,s,r)}return new Yr({ts:o,zone:r,loc:n,o:i})}function DNt(t,e,r){let n=sr(r.round)?!0:r.round,o=(a,s)=>(a=Fq(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 LNt(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var qie,Uie={},Yr=class t{constructor(e){let r=e.zone||Po.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new uc("invalid input"):null)||(r.isValid?null:Y6(r));this.ts=sr(e.ts)?Po.now():e.ts;let o=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[o,i]=[e.old.c,e.old.o];else{let s=sb(e.o)&&!e.old?e.o:r.offset(this.ts);o=kie(this.ts,s),n=Number.isNaN(o.year)?new uc("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||Eo.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]=LNt(arguments),[n,o,i,a,s,u,l]=r;return NNt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=LNt(arguments),[n,o,i,a,s,u,l]=r;return e.zone=sc.utcInstance,NNt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=Xjt(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=ab(r.zone,Po.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:Eo.fromObject(r)}):t.invalid(Y6(o))}static fromMillis(e,r={}){if(sb(e))return e<-INt||e>INt?t.invalid("Timestamp out of range"):new t({ts:e,zone:ab(r.zone,Po.defaultZone),loc:Eo.fromObject(r)});throw new ys(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(sb(e))return new t({ts:e*1e3,zone:ab(r.zone,Po.defaultZone),loc:Eo.fromObject(r)});throw new ys("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=ab(r.zone,Po.defaultZone);if(!n.isValid)return t.invalid(Y6(n));let o=Eo.fromObject(r),i=qq(e,jNt),{minDaysInFirstWeek:a,startOfWeek:s}=q1e(i,o),u=Po.now(),l=sr(r.specificOffset)?n.offset(u):r.specificOffset,c=!sr(i.ordinal),d=!sr(i.year),f=!sr(i.month)||!sr(i.day),p=d||f,m=i.weekYear||i.weekNumber;if((p||c)&&m)throw new nb("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new nb("Can't mix ordinal dates with month/day");let h=m||i.weekday&&!p,b,g,y=kie(u,l);h?(b=LYr,g=NYr,y=U6(y,a,s)):c?(b=FYr,g=DYr,y=Lie(y)):(b=$Nt,g=kNt);let S=!1;for(let R of b){let N=i[R];sr(N)?S?i[R]=g[R]:i[R]=y[R]:S=!0}let x=h?Jjt(i,a,s):c?Yjt(i):U1e(i),O=x||z1e(i);if(O)return t.invalid(O);let P=h?$1e(i,a,s):c?B1e(i):i,[E,A]=Bie(P,l,n),I=new t({ts:E,zone:n,o:A,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]=pNt(e);return Yq(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=mNt(e);return Yq(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=hNt(e);return Yq(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(sr(e)||sr(r))throw new ys("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=Eo.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=ANt(a,e,r);return c?t.invalid(c):Yq(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]=bNt(e);return Yq(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new ys("need to specify a reason the DateTime is invalid");let n=e instanceof uc?e:new uc(e,r);if(Po.throwOnInvalid)throw new Cie(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=tje(e,Eo.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return Q1e(lc.parseFormat(e),Eo.fromObject(r)).map(o=>o.val).join("")}static resetCache(){qie=void 0,Uie={}}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?nje(this).weekYear:NaN}get weekNumber(){return this.isValid?nje(this).weekNumber:NaN}get weekday(){return this.isValid?nje(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?oje(this).weekday:NaN}get localWeekNumber(){return this.isValid?oje(this).weekNumber:NaN}get localWeekYear(){return this.isValid?oje(this).weekYear:NaN}get ordinal(){return this.isValid?Lie(this.c).ordinal:NaN}get monthShort(){return this.isValid?sP.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?sP.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?sP.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?sP.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=Lq(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=kie(u,a),d=kie(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[IN(this,{ts:u}),IN(this,{ts:l})]:[this]}get isInLeapYear(){return TN(this.year)}get daysInMonth(){return Bq(this.year,this.month)}get daysInYear(){return this.isValid?yI(this.year):NaN}get weeksInWeekYear(){return this.isValid?EN(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?EN(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=lc.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(sc.instance(e),r)}toLocal(){return this.setZone(Po.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=ab(e,Po.defaultZone),e.equals(this.zone))return this;if(e.isValid){let o=this.ts;if(r||n){let i=e.offset(this.ts),a=this.toObject();[o]=Bie(a,i,e)}return IN(this,{ts:o,zone:e})}else return t.invalid(Y6(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return IN(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=qq(e,jNt),{minDaysInFirstWeek:n,startOfWeek:o}=q1e(r,this.loc),i=!sr(r.weekYear)||!sr(r.weekNumber)||!sr(r.weekday),a=!sr(r.ordinal),s=!sr(r.year),u=!sr(r.month)||!sr(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new nb("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new nb("Can't mix ordinal dates with month/day");let d;i?d=$1e({...U6(this.c,n,o),...r},n,o):sr(r.ordinal)?(d={...this.toObject(),...r},sr(r.day)&&(d.day=Math.min(Bq(d.year,d.month),d.day))):d=B1e({...Lie(this.c),...r});let[f,p]=Bie(d,this.o,this.zone);return IN(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=Za.fromDurationLike(e);return IN(this,MNt(this,r))}minus(e){if(!this.isValid)return this;let r=Za.fromDurationLike(e).negate();return IN(this,MNt(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=Za.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;athis.valueOf(),s=a?this:e,u=a?e:this,l=CNt(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?aP.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?thisr.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new ys("max requires all arguments be DateTimes");return H1e(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=Eo.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return eje(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=Eo.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new J6(i,e)}static fromFormatParser(e,r,n={}){if(sr(e)||sr(r))throw new ys("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=Eo.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new ys(`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):Yq(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return mI}static get DATE_MED(){return w6}static get DATE_MED_WITH_WEEKDAY(){return S1e}static get DATE_FULL(){return S6}static get DATE_HUGE(){return x6}static get TIME_SIMPLE(){return C6}static get TIME_WITH_SECONDS(){return O6}static get TIME_WITH_SHORT_OFFSET(){return P6}static get TIME_WITH_LONG_OFFSET(){return E6}static get TIME_24_SIMPLE(){return T6}static get TIME_24_WITH_SECONDS(){return A6}static get TIME_24_WITH_SHORT_OFFSET(){return I6}static get TIME_24_WITH_LONG_OFFSET(){return M6}static get DATETIME_SHORT(){return R6}static get DATETIME_SHORT_WITH_SECONDS(){return j6}static get DATETIME_MED(){return N6}static get DATETIME_MED_WITH_SECONDS(){return D6}static get DATETIME_MED_WITH_WEEKDAY(){return x1e}static get DATETIME_FULL(){return L6}static get DATETIME_FULL_WITH_SECONDS(){return F6}static get DATETIME_HUGE(){return k6}static get DATETIME_HUGE_WITH_SECONDS(){return $6}};function Jq(t){if(Yr.isDateTime(t))return t;if(t&&t.valueOf&&sb(t.valueOf()))return Yr.fromJSDate(t);if(t&&typeof t=="object")return Yr.fromObject(t);throw new ys(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var BNt=require("obsidian");Td();async function BYr(){let t=new Date,e=t.getTimezoneOffset(),r=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value||"Unknown";return{epoch:Math.floor(t.getTime()),isoString:t.toISOString(),userLocaleString:t.toLocaleString(),localDateString:t.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),timezoneOffset:-e,timezone:r}}var qNt=Qm(async()=>BYr(),{name:"getCurrentTime",description:"Get the current time in various formats, including timezone information",schema:Wr.object({})}),UNt={jan:1,january:1,feb:2,february:2,mar:3,march:3,apr:4,april:4,may:5,jun:6,june:6,jul:7,july:7,aug:8,august:8,sep:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};function qYr(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 UYr(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 zYr(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=w1e(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=Yr.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 HYr(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=UNt[r[1]],o=e.year;n>e.month&&o--;let i=Yr.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 VYr(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=Yr.fromObject({year:n,month:1,day:1}),i=Yr.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 WYr(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=Yr.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 KYr(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=UNt[r[1].toLowerCase()],o=parseInt(r[2]),i=Yr.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 GYr(t){let e=Yr.now(),r=t.toLowerCase().replace("@vault","").trim(),n=qYr(r,e)||UYr(r,e)||zYr(r,e)||HYr(r,e)||KYr(r,e)||WYr(r,e)||VYr(r,e);if(n)return{startTime:Z6(n.start),endTime:Z6(n.end)};let o=w1e(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=Yr.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?Yr.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:Z6(i),endTime:Z6(a)}}console.warn(`Unable to parse time expression: ${t}`)}function Z6(t){let e=t.toJSDate(),r=e.getTimezoneOffset(),n=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(e).find(o=>o.type==="timeZoneName")?.value||"Unknown";return{epoch:Math.floor(e.getTime()),isoString:e.toISOString(),userLocaleString:e.toLocaleString(),localDateString:e.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),timezoneOffset:-r,timezone:n}}var zNt=Qm(async({timeExpression:t})=>GYr(t),{name:"getTimeRangeMs",description:"Get a time range in milliseconds based on a natural language time expression",schema:Wr.object({timeExpression:Wr.string().describe("A natural language time expression (e.g., 'last week', 'from July 1 to July 15')")})});function JYr(t){let e=t.toString().length===10?t*1e3:t,r=Yr.fromMillis(e);return Z6(r)}var HNt=Qm(async({epoch:t})=>JYr(t),{name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:Wr.object({epoch:Wr.number().describe("Unix timestamp in seconds or milliseconds")})});function YYr(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 ZYr(t="25min"){let e=YYr(t);return new Promise(r=>{setTimeout(()=>{new BNt.Notice(`Pomodoro timer (${t}) completed! Take a break!`),r()},e)})}var aje=Qm(async({interval:t="25min"})=>(ZYr(t),`Pomodoro timer started. It will end in ${t}.`),{name:"startPomodoro",description:"Start a Pomodoro timer with a customizable interval",schema:Wr.object({interval:Wr.string().optional().describe("Time interval (e.g., '25min', '5s', '1h'). Default is 25min.")})});mg();ZA();Td();var zie=Qm(async({url:t})=>{try{let e=await Fi.getInstance().youtube4llm(t);return e.response.transcript?JSON.stringify({success:!0,transcript:e.response.transcript,elapsed_time_ms:e.elapsed_time_ms}):JSON.stringify({success:!1,message:"Transcript not available. Only English videos with the auto transcript option turned on are supported at the moment"})}catch(e){return console.error(`Error transcribing YouTube video ${t}:`,e),JSON.stringify({success:!1,message:"An error occurred while transcribing the YouTube video."})}},{name:"youtubeTranscription",description:"Get the transcript of a YouTube video",schema:Wr.object({url:Wr.string().describe("The YouTube video URL"),brevilabsClient:Wr.any().describe("The BrevilabsClient instance")})});yn();mg();var X6=["@vault","@composer","@websearch","@youtube","@pomodoro"],MN=class{static initTools(e){this.tools.length===0&&(this.tools=[qNt,HNt,zNt,n1e,L1t,aje,o1e,zie,D1t(e.getRoot())])}static async analyzeIntent(e){try{let r=await Fi.getInstance().broca(e,HR());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 Eq.callTool(u,l)),u.name=="getFileTree"&&HR())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")&&(a.length>0||i)){let u=this.removeAtCommands(e);r.push({tool:n1e,args:{timeRange:i||void 0,query:u,salientTerms:a}})}if(o.includes("@websearch")||o.includes("@web")){let u=this.removeAtCommands(e),c=await ac.instance.getCurrentChainManager().memoryManager.getMemory().loadMemoryVariables({}),d=LR(c);r.push({tool:o1e,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:aje,args:{interval:l}})}let s=_Ve(e);for(let u of s)r.some(c=>c.tool.name===zie.name&&c.args.url===u)||r.push({tool:zie,args:{url:u}})}static removeAtCommands(e){return e.split(" ").filter(r=>!X6.includes(r.toLowerCase())).join(" ").trim()}};MN.tools=[];var Q6=class{constructor(e){this.updateCurrentAiMessage=e;this.hasOpenThinkBlock=!1;this.fullResponse=""}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+=` `,this.hasOpenThinkBlock=!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+=` -`,this.hasOpenThinkBlock=!0),this.fullResponse+=e.additional_kwargs.reasoning_content,!0):!1}processChunk(e){let r=!1;Array.isArray(e.content)?r=this.handleClaude37Chunk(e.content):r=this.handleDeepseekChunk(e),this.hasOpenThinkBlock&&!r&&(this.fullResponse+="",this.hasOpenThinkBlock=!1),this.updateCurrentAiMessage(this.fullResponse)}close(){return this.hasOpenThinkBlock&&(this.fullResponse+="",this.updateCurrentAiMessage(this.fullResponse)),this.fullResponse}},Q6=class{constructor(e){this.chainManager=e}async handleResponse(e,r,n,o,i,a){return e&&!(n.signal.aborted&&n.signal.reason==="new-chat")?(await this.chainManager.memoryManager.getMemory().saveContext({input:r.message},{output:e}),o({message:e,sender:e_,isVisible:!0,timestamp:Vl(new Date),sources:a}),i("")):n.signal.reason==="new-chat"&&i(""),ie(`==== Chat Memory ==== +`,this.hasOpenThinkBlock=!0),this.fullResponse+=e.additional_kwargs.reasoning_content,!0):!1}processChunk(e){let r=!1;Array.isArray(e.content)?r=this.handleClaude37Chunk(e.content):r=this.handleDeepseekChunk(e),this.hasOpenThinkBlock&&!r&&(this.fullResponse+="",this.hasOpenThinkBlock=!1),this.updateCurrentAiMessage(this.fullResponse)}close(){return this.hasOpenThinkBlock&&(this.fullResponse+="",this.updateCurrentAiMessage(this.fullResponse)),this.fullResponse}},e5=class{constructor(e){this.chainManager=e}async handleResponse(e,r,n,o,i,a){return e&&!(n.signal.aborted&&n.signal.reason==="new-chat")?(await this.chainManager.memoryManager.getMemory().saveContext({input:r.message},{output:e}),o({message:e,sender:e_,isVisible:!0,timestamp:Vl(new Date),sources:a}),i("")):n.signal.reason==="new-chat"&&i(""),ie(`==== Chat Memory ==== `,this.chainManager.memoryManager.getMemory().chatHistory.messages.map(s=>s.content)),ie(`==== Final AI Response ==== `,e),e}async handleError(e,r,n){let o=ei(e);fe("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}`,fe(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:e_,isVisible:!0,timestamp:Vl(new Date)})}else new UNt.Notice(s),fe(i)}},qie=class extends Q6{async run(e,r,n,o,i){let a=new X6(n);try{let l=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),c=DR(l),d=[],f=Yb(),p=this.chainManager.chatModelManager.getChatModel();f&&d.push({role:nJ(p),content:f});for(let h of c)d.push({role:h.role,content:h.content});d.push({role:"user",content:e.message}),ie(`==== Final Request to AI ==== -`,d);let m=await yy(()=>this.chainManager.chatModelManager.getChatModel().stream(d,{signal:r.signal}));for await(let h of m){if(r.signal.aborted){ie("Stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(h)}}catch(u){u.name==="AbortError"||r.signal.aborted?ie("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)}},Uie=class extends Q6{async run(e,r,n,o,i){let a=new X6(n);try{if(await this.chainManager.vectorStoreManager.isIndexEmpty())return this.handleResponse(oJ,e,r,o,n);let c=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),d=DR(c),f=e.message;d.length>0&&(f=e.message);let m=await new Rx({minSimilarityScore:.01,maxK:ue().maxSourceChunks,salientTerms:[]}).getRelevantDocuments(f);this.chainManager.storeRetrieverDocuments(m);let h=m.map(P=>P.pageContent).join(` +Error Details: `+s),r({message:s,isErrorMessage:!0,sender:e_,isVisible:!0,timestamp:Vl(new Date)})}else new KNt.Notice(s),fe(i)}},Hie=class extends e5{async run(e,r,n,o,i){let a=new Q6(n);try{let l=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),c=LR(l),d=[],f=Yb(),p=this.chainManager.chatModelManager.getChatModel();f&&d.push({role:oJ(p),content:f});for(let h of c)d.push({role:h.role,content:h.content});d.push({role:"user",content:e.message}),ie(`==== Final Request to AI ==== +`,d);let m=await yy(()=>this.chainManager.chatModelManager.getChatModel().stream(d,{signal:r.signal}));for await(let h of m){if(r.signal.aborted){ie("Stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(h)}}catch(u){u.name==="AbortError"||r.signal.aborted?ie("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)}},Vie=class extends e5{async run(e,r,n,o,i){let a=new Q6(n);try{if(await this.chainManager.vectorStoreManager.isIndexEmpty())return this.handleResponse(iJ,e,r,o,n);let c=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),d=LR(c),f=e.message;d.length>0&&(f=e.message);let m=await new jx({minSimilarityScore:.01,maxK:ue().maxSourceChunks,salientTerms:[]}).getRelevantDocuments(f);this.chainManager.storeRetrieverDocuments(m);let h=m.map(P=>P.pageContent).join(` `),b=[],g=Yb(),y=` Answer the question with as detailed as possible based only on the following context: -`+h,S=g+y,x=this.chainManager.chatModelManager.getChatModel();S&&b.push({role:nJ(x),content:S});for(let P of d)b.push({role:P.role,content:P.content});b.push({role:"user",content:e.message}),ie(`==== Final Request to AI ==== -`,b);let O=await yy(()=>this.chainManager.chatModelManager.getChatModel().stream(b,{signal:r.signal}));for await(let P of O){if(r.signal.aborted){ie("VaultQA stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(P)}}catch(u){u.name==="AbortError"||r.signal.aborted?ie("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=hVe(this.chainManager.getRetrievedDocuments());if(r.length>0){let n=r.map(o=>`- [[${o}]]`).join(` +`+h,S=g+y,x=this.chainManager.chatModelManager.getChatModel();S&&b.push({role:oJ(x),content:S});for(let P of d)b.push({role:P.role,content:P.content});b.push({role:"user",content:e.message}),ie(`==== Final Request to AI ==== +`,b);let O=await yy(()=>this.chainManager.chatModelManager.getChatModel().stream(b,{signal:r.signal}));for await(let P of O){if(r.signal.aborted){ie("VaultQA stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(P)}}catch(u){u.name==="AbortError"||r.signal.aborted?ie("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=yVe(this.chainManager.getRetrievedDocuments());if(r.length>0){let n=r.map(o=>`- [[${o}]]`).join(` `);e+=` #### Sources: -`+n}return e}},e5=class extends Q6{isYoutubeOnlyMessage(e){let r=e.trim(),n=r.includes("@youtube"),o=Qhe(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 wN.processUrlBatch(e,r,this.chainManager.app.vault);return wN.showFailedImagesNotice(r),n}async processChatInputImages(e){let r=[],n=await wN.processChatImageBatch(e,r,this.chainManager.app.vault);return wN.showFailedImagesNotice(r),n}async extractEmbeddedImages(e){let r=/!\[\[(.*?\.(png|jpg|jpeg|gif|webp|bmp|svg))\]\]/g;return[...e.matchAll(r)].map(i=>i[1])}async buildMessageContent(e,r){let n=[],o=[],i=ue(),a=[],s=r.context?.urls;if(s&&s.length>0&&a.push({urls:s,type:"context"}),i.passMarkdownImages){let d=await this.extractEmbeddedImages(e);d.length>0&&a.push({urls:d,type:"embedded"})}for(let d of a){let f=await this.processImageUrls(d.urls);o.push(...f.successfulImages),n.push(...f.failureDescriptions)}let u=r.content;if(u&&u.length>0){let d=await this.processChatInputImages(u);o.push(...d.successfulImages),n.push(...d.failureDescriptions)}let l=e;n.length>0&&(l=`${e} +`+n}return e}},t5=class extends e5{isYoutubeOnlyMessage(e){let r=e.trim(),n=r.includes("@youtube"),o=rge(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 SN.processUrlBatch(e,r,this.chainManager.app.vault);return SN.showFailedImagesNotice(r),n}async processChatInputImages(e){let r=[],n=await SN.processChatImageBatch(e,r,this.chainManager.app.vault);return SN.showFailedImagesNotice(r),n}async extractEmbeddedImages(e){let r=/!\[\[(.*?\.(png|jpg|jpeg|gif|webp|bmp|svg))\]\]/g;return[...e.matchAll(r)].map(i=>i[1])}async buildMessageContent(e,r){let n=[],o=[],i=ue(),a=[],s=r.context?.urls;if(s&&s.length>0&&a.push({urls:s,type:"context"}),i.passMarkdownImages){let d=await this.extractEmbeddedImages(e);d.length>0&&a.push({urls:d,type:"embedded"})}for(let d of a){let f=await this.processImageUrls(d.urls);o.push(...f.successfulImages),n.push(...f.failureDescriptions)}let u=r.content;if(u&&u.length>0){let d=await this.processChatInputImages(u);o.push(...d.successfulImages),n.push(...d.failureDescriptions)}let l=e;n.length>0&&(l=`${e} Note: ${n.join(` `)} -`);let c=[{type:"text",text:l}];return o.length>0&&c.push(...o),c}hasCapability(e,r){let n=e.modelName||e.model||"";return this.chainManager.chatModelManager.findModelByName(n)?.capabilities?.includes(r)??!1}isMultimodalModel(e){return this.hasCapability(e,"vision")}async streamMultimodalResponse(e,r,n,o){let a=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),s=DR(a),u=[],l=await this.getSystemPrompt();s.length>0&&(l+=` +`);let c=[{type:"text",text:l}];return o.length>0&&c.push(...o),c}hasCapability(e,r){let n=e.modelName||e.model||"";return this.chainManager.chatModelManager.findModelByName(n)?.capabilities?.includes(r)??!1}isMultimodalModel(e){return this.hasCapability(e,"vision")}async streamMultimodalResponse(e,r,n,o){let a=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),s=LR(a),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:nJ(c),content:`${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:oJ(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.`});for(let g of s)u.push({role:g.role,content:g.content});let d=this.chainManager.chatModelManager.getChatModel(),p=this.isMultimodalModel(d)?await this.buildMessageContent(e,r):e;u.push({role:"user",content:p});let m=p instanceof Array?p[0].text:p;ie("Enhanced user message: ",m),ie(`==== Final Request to AI ==== -`,u);let h=new X6(o),b=await yy(()=>this.chainManager.chatModelManager.getChatModel().stream(u,{signal:n.signal}));for await(let g of b){if(n.signal.aborted){ie("CopilotPlus multimodal stream iteration aborted",{reason:n.signal.reason});break}h.processChunk(g)}return h.close()}async run(e,r,n,o,i){let{updateLoadingMessage:a}=i,s="",u=[],l="",c=d=>{l=d,n(d)};try{if(this.isYoutubeOnlyMessage(e.message)){let S=Qhe(e.message),x="Transcript not available. Only videos with the auto transcript option turned on are supported at the moment.";if(S)try{let O=await Fi.getInstance().youtube4llm(S);return O.response.transcript?this.handleResponse(O.response.transcript,e,r,o,n):this.handleResponse(x,e,r,o,n)}catch(O){return fe("Error processing YouTube video:",O),this.handleResponse(x,e,r,o,n)}}ie("==== Step 1: Analyzing intent ====");let d,f=e.originalMessage||e.message;try{d=await IN.analyzeIntent(f)}catch(S){return this.handleResponse(cVe(S),e,r,o,n)}let p=e.message.split(" ").filter(S=>!Z6.includes(S.toLowerCase())).join(" ").trim(),m=await this.executeToolCalls(d,a),h=m.find(S=>S.tool==="localSearch"&&S.output&&S.output.length>0),g=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),y=DR(g);if(h){ie("==== Step 2: Processing local search results ====");let S=JSON.parse(h.output);ie("==== Step 3: Condensing Question ====");let x=await die(p,y);ie("Condensed standalone question: ",x),ie("==== Step 4: Preparing context ====");let O=this.getTimeExpression(d),P=this.prepareLocalSearchResult(S,O),E=m.filter(R=>R.tool==="getCurrentTime"),A=this.prepareEnhancedUserMessage(x,E);ie(P),ie("==== Step 5: Invoking QA Chain ====");let I=await this.chainManager.promptManager.getQAPrompt({question:A,context:P,systemMessage:""});s=await this.streamMultimodalResponse(I,e,r,c),u=this.getSources(S)}else{let S=this.prepareEnhancedUserMessage(p,m);ie("No local search results. Using standard LLM Chain."),s=await this.streamMultimodalResponse(S,e,r,c)}}catch(d){a?.(t_.DEFAULT),d.name==="AbortError"||r.signal.aborted?ie("CopilotPlus stream aborted by user",{reason:r.signal.reason}):await this.handleError(d,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)?(Mh("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){Mh("Invalid document structure:",n);continue}let o=r.get(n.title),i=n&&"rerank_score"in n,a=i?n.rerank_score:n.score;(!o||a>(o.score??0))&&r.set(n.title,{title:n.title,score:a,isReranked:i})}return Array.from(r.values()).sort((n,o)=>(o.score??0)-(n.score??0))}async executeToolCalls(e,r){let n=[];for(let o of e){ie(`==== Step 2: Calling tool: ${o.tool.name} ====`),o.tool.name==="localSearch"?r?.(t_.READING_FILES):o.tool.name==="webSearch"?r?.(t_.SEARCHING_WEB):o.tool.name==="getFileTree"&&r?.(t_.READING_FILE_TREE);let i=await Pq.callTool(o.tool,o.args);n.push({tool:o.tool.name,output:i})}return n}prepareEnhancedUserMessage(e,r){let n="";if(r.length>0){let o=r.filter(i=>i.output!=null);o.length>0&&(n=` +`,u);let h=new Q6(o),b=await yy(()=>this.chainManager.chatModelManager.getChatModel().stream(u,{signal:n.signal}));for await(let g of b){if(n.signal.aborted){ie("CopilotPlus multimodal stream iteration aborted",{reason:n.signal.reason});break}h.processChunk(g)}return h.close()}async run(e,r,n,o,i){let{updateLoadingMessage:a}=i,s="",u=[],l="",c=d=>{l=d,n(d)};try{if(this.isYoutubeOnlyMessage(e.message)){let S=rge(e.message),x="Transcript not available. Only videos with the auto transcript option turned on are supported at the moment.";if(S)try{let O=await Fi.getInstance().youtube4llm(S);return O.response.transcript?this.handleResponse(O.response.transcript,e,r,o,n):this.handleResponse(x,e,r,o,n)}catch(O){return fe("Error processing YouTube video:",O),this.handleResponse(x,e,r,o,n)}}ie("==== Step 1: Analyzing intent ====");let d,f=e.originalMessage||e.message;try{d=await MN.analyzeIntent(f)}catch(S){return this.handleResponse(fVe(S),e,r,o,n)}let p=e.message.split(" ").filter(S=>!X6.includes(S.toLowerCase())).join(" ").trim(),m=await this.executeToolCalls(d,a),h=m.find(S=>S.tool==="localSearch"&&S.output&&S.output.length>0),g=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),y=LR(g);if(h){ie("==== Step 2: Processing local search results ====");let S=JSON.parse(h.output);ie("==== Step 3: Condensing Question ====");let x=await mie(p,y);ie("Condensed standalone question: ",x),ie("==== Step 4: Preparing context ====");let O=this.getTimeExpression(d),P=this.prepareLocalSearchResult(S,O),E=m.filter(R=>R.tool==="getCurrentTime"),A=this.prepareEnhancedUserMessage(x,E);ie(P),ie("==== Step 5: Invoking QA Chain ====");let I=await this.chainManager.promptManager.getQAPrompt({question:A,context:P,systemMessage:""});s=await this.streamMultimodalResponse(I,e,r,c),u=this.getSources(S)}else{let S=this.prepareEnhancedUserMessage(p,m);ie("No local search results. Using standard LLM Chain."),s=await this.streamMultimodalResponse(S,e,r,c)}}catch(d){a?.(t_.DEFAULT),d.name==="AbortError"||r.signal.aborted?ie("CopilotPlus stream aborted by user",{reason:r.signal.reason}):await this.handleError(d,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)?(Mh("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){Mh("Invalid document structure:",n);continue}let o=r.get(n.title),i=n&&"rerank_score"in n,a=i?n.rerank_score:n.score;(!o||a>(o.score??0))&&r.set(n.title,{title:n.title,score:a,isReranked:i})}return Array.from(r.values()).sort((n,o)=>(o.score??0)-(n.score??0))}async executeToolCalls(e,r){let n=[];for(let o of e){ie(`==== Step 2: Calling tool: ${o.tool.name} ====`),o.tool.name==="localSearch"?r?.(t_.READING_FILES):o.tool.name==="webSearch"?r?.(t_.SEARCHING_WEB):o.tool.name==="getFileTree"&&r?.(t_.READING_FILE_TREE);let i=await Eq.callTool(o.tool,o.args);n.push({tool:o.tool.name,output:i})}return n}prepareEnhancedUserMessage(e,r){let n="";if(r.length>0){let o=r.filter(i=>i.output!=null);o.length>0&&(n=` # Additional context: @@ -630,11 +630,11 @@ IMPORTANT: Maintain consistency with previous responses in the conversation. If ${typeof i.output!="string"?JSON.stringify(i.output):i.output} `).join(` -`))}return`${e}${n}`}getTimeExpression(e){let r=e.find(n=>n.tool.name==="getTimeRangeMs");return r?r.args.timeExpression:""}prepareLocalSearchResult(e,r){let n=e.filter(s=>s.includeInContext),o=n.reduce((s,u)=>s+u.content.length,0),i=n;if(o>oge){let s=oge/o;ie("Truncating documents to fit context length. Truncation ratio:",s),i=n.map(u=>({...u,content:u.content.slice(0,Math.floor(u.content.length*s))}))}let a=i.map(s=>`Note in Vault: ${s.content}`).join(` +`))}return`${e}${n}`}getTimeExpression(e){let r=e.find(n=>n.tool.name==="getTimeRangeMs");return r?r.args.timeExpression:""}prepareLocalSearchResult(e,r){let n=e.filter(s=>s.includeInContext),o=n.reduce((s,u)=>s+u.content.length,0),i=n;if(o>sge){let s=sge/o;ie("Truncating documents to fit context length. Truncation ratio:",s),i=n.map(u=>({...u,content:u.content.slice(0,Math.floor(u.content.length*s))}))}let a=i.map(s=>`Note in Vault: ${s.content}`).join(` `);return r?`Local Search Result for ${r}: ${a}`:`Local Search Result: -${a}`}async getSystemPrompt(){return Yb()}},zie=class extends e5{async getSystemPrompt(){let e=Yb(),r=Mc();if(!r)return e;let n=await ac.instance.getProjectContext(r.id);return e=`${e} +${a}`}async getSystemPrompt(){return Yb()}},Wie=class extends t5{async getSystemPrompt(){let e=Yb(),r=Mc();if(!r)return e;let n=await ac.instance.getProjectContext(r.id);return e=`${e} ${r.systemPrompt} @@ -642,65 +642,65 @@ ${r.systemPrompt} ${n} -`),e}};yo();nr();Cn();qE();var Wle=require("obsidian");Cl();$r();BR();yo();nr();Cn();s8();var MN="0.39.0";var zNt=!1,RN,ije,KYr,GYr,JYr,HNt,YYr,Hie,aje,VNt,sje,Vie,WNt;function KNt(t,e={auto:!1}){if(zNt)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${t.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(RN)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${t.kind}'\` after \`import '@anthropic-ai/sdk/shims/${RN}'\``);zNt=e.auto,RN=t.kind,ije=t.fetch,KYr=t.Request,GYr=t.Response,JYr=t.Headers,HNt=t.FormData,YYr=t.Blob,Hie=t.File,aje=t.ReadableStream,VNt=t.getMultipartRequestOptions,sje=t.getDefaultAgent,Vie=t.fileFromPath,WNt=t.isFsReadStream}var Wie=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function GNt({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 Wie(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}}RN||KNt(GNt(),{auto:!0});var Or=class extends Error{},cc=class t extends Or{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 wI({message:n,cause:Kie(r)});let i=r;return e===400?new t5(e,i,n,o):e===401?new r5(e,i,n,o):e===403?new n5(e,i,n,o):e===404?new o5(e,i,n,o):e===409?new i5(e,i,n,o):e===422?new a5(e,i,n,o):e===429?new s5(e,i,n,o):e>=500?new u5(e,i,n,o):new t(e,i,n,o)}},ed=class extends cc{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},wI=class extends cc{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Yq=class extends wI{constructor({message:e}={}){super({message:e??"Request timed out."})}},t5=class extends cc{},r5=class extends cc{},n5=class extends cc{},o5=class extends cc{},i5=class extends cc{},a5=class extends cc{},s5=class extends cc{},u5=class extends cc{};var Gie=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},jN=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)},nh,uP=class{constructor(){nh.set(this,void 0),this.buffer=new Uint8Array,Gie(this,nh,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=QYr(this.buffer,jN(this,nh,"f")))!=null;){if(i.carriage&&jN(this,nh,"f")==null){Gie(this,nh,i.index,"f");continue}if(jN(this,nh,"f")!=null&&(i.index!==jN(this,nh,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,jN(this,nh,"f")-1))),this.buffer=this.buffer.slice(jN(this,nh,"f")),Gie(this,nh,null,"f");continue}let a=jN(this,nh,"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),Gie(this,nh,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 Or(`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 Or(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Or("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(` +`),e}};yo();nr();yn();qE();var Jle=require("obsidian");Cl();$r();qR();yo();nr();yn();u8();var RN="0.39.0";var GNt=!1,jN,sje,XYr,QYr,eZr,JNt,tZr,Kie,uje,YNt,lje,Gie,ZNt;function XNt(t,e={auto:!1}){if(GNt)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${t.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(jN)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${t.kind}'\` after \`import '@anthropic-ai/sdk/shims/${jN}'\``);GNt=e.auto,jN=t.kind,sje=t.fetch,XYr=t.Request,QYr=t.Response,eZr=t.Headers,JNt=t.FormData,tZr=t.Blob,Kie=t.File,uje=t.ReadableStream,YNt=t.getMultipartRequestOptions,lje=t.getDefaultAgent,Gie=t.fileFromPath,ZNt=t.isFsReadStream}var Jie=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function QNt({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 Jie(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}}jN||XNt(QNt(),{auto:!0});var Or=class extends Error{},cc=class t extends Or{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 wI({message:n,cause:Yie(r)});let i=r;return e===400?new r5(e,i,n,o):e===401?new n5(e,i,n,o):e===403?new o5(e,i,n,o):e===404?new i5(e,i,n,o):e===409?new a5(e,i,n,o):e===422?new s5(e,i,n,o):e===429?new u5(e,i,n,o):e>=500?new l5(e,i,n,o):new t(e,i,n,o)}},ed=class extends cc{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},wI=class extends cc{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Zq=class extends wI{constructor({message:e}={}){super({message:e??"Request timed out."})}},r5=class extends cc{},n5=class extends cc{},o5=class extends cc{},i5=class extends cc{},a5=class extends cc{},s5=class extends cc{},u5=class extends cc{},l5=class extends cc{};var Zie=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},NN=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)},nh,uP=class{constructor(){nh.set(this,void 0),this.buffer=new Uint8Array,Zie(this,nh,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=oZr(this.buffer,NN(this,nh,"f")))!=null;){if(i.carriage&&NN(this,nh,"f")==null){Zie(this,nh,i.index,"f");continue}if(NN(this,nh,"f")!=null&&(i.index!==NN(this,nh,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,NN(this,nh,"f")-1))),this.buffer=this.buffer.slice(NN(this,nh,"f")),Zie(this,nh,null,"f");continue}let a=NN(this,nh,"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),Zie(this,nh,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 Or(`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 Or(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Or("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(` `):[]}};nh=new WeakMap;uP.NEWLINE_CHARS=new Set([` -`,"\r"]);uP.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function QYr(t,e){for(let o=e??0;o({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 aje({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:a}=await r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+` -`);o.enqueue(s)}catch(i){o.error(i)}},async cancel(){await r.return?.()}})}};async function*eZr(t,e){if(!t.body)throw e.abort(),new Or("Attempted to iterate over a response with no body");let r=new uje,n=new uP,o=l5(t.body);for await(let i of tZr(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*tZr(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=JNt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var uje=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]=rZr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function rZr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var nZr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",oZr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&c5(t),c5=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function";async function YNt(t,e,r){if(t=await t,oZr(t))return t;if(nZr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=c5(o)?[await o.arrayBuffer()]:[o];return new Hie(i,e,r)}let n=await iZr(t);if(e||(e=sZr(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Hie(n,e,r)}async function iZr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(c5(t))e.push(await t.arrayBuffer());else if(uZr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${aZr(t)}`);return e}function aZr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function sZr(t){return cje(t.name)||cje(t.filename)||cje(t.path)?.split(/[\\/]/).pop()}var cje=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},uZr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",dje=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var cZr=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},dZr=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)},Jie;async function tDt(t){let{response:e}=t;if(t.options.stream)return Zq("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):jx.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 Zq("response",e.status,e.url,e.headers,i),rDt(i,e)}let o=await e.text();return Zq("response",e.status,e.url,e.headers,o),o}function rDt(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}var Zie=class t extends Promise{constructor(e,r=tDt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>rDt(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)}},Xie=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=fje("maxRetries",r),this.timeout=fje("timeout",n),this.httpAgent=o,this.fetch=i??ije}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...hZr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${vZr()}`}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&&c5(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:dje(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&&fje("timeout",e.timeout),e.timeout=e.timeout??this.timeout;let c=e.httpAgent??this.httpAgent??sje(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 eDt(i,a),eDt(i,r),dje(e.body)&&RN!=="node"&&delete i["content-type"],Yie(a,"x-stainless-retry-count")===void 0&&Yie(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),Yie(a,"x-stainless-timeout")===void 0&&Yie(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 Or("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 cc.generate(e,r,n,o)}request(e,r=null){return new Zie(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}),Zq("request",a,n,i.headers),n.signal?.aborted)throw new ed;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(Kie);if(l instanceof Error){if(n.signal?.aborted)throw new ed;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new Yq:new wI({cause:l})}let c=lje(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let b=`retrying, ${r} attempts remaining`;return Zq(`response (error; ${b})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(b=>Kie(b).message),f=gZr(d),p=f?void 0:d;throw Zq(`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 pje(this,n,e)}buildURL(e,r){let n=bZr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return d5(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 Or(`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 _Zr(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 ${MN}`}},Qie=class{constructor(e,r,n,o){Jie.set(this,void 0),cZr(this,Jie,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 Or("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 dZr(this,Jie,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Jie=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},pje=class extends Zie{constructor(e,r,n){super(r,async o=>new n(e,o.response,await tDt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},lje=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),fZr={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},Pg=t=>typeof t=="object"&&t!==null&&!d5(t)&&Object.keys(t).every(e=>nDt(fZr,e)),pZr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":MN,"X-Stainless-OS":XNt(Deno.build.os),"X-Stainless-Arch":ZNt(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":MN,"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":MN,"X-Stainless-OS":XNt(process.platform),"X-Stainless-Arch":ZNt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=mZr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":MN,"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":MN,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function mZr(){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 ZNt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",XNt=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"),QNt,hZr=()=>QNt??(QNt=pZr()),gZr=t=>{try{return JSON.parse(t)}catch{return}},yZr=/^[a-z][a-z0-9+.-]*:/i,bZr=t=>yZr.test(t),_Zr=t=>new Promise(e=>setTimeout(e,t)),fje=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Or(`${t} must be an integer`);if(e<0)throw new Or(`${t} must be a positive integer`);return e},Kie=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))};var eae=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function d5(t){if(!t)return!0;for(let e in t)return!1;return!0}function nDt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function eDt(t,e){for(let r in e){if(!nDt(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 Zq(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Anthropic:DEBUG:${t}`,...e)}var vZr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),oDt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",wZr=t=>typeof t?.get=="function";var Yie=(t,e)=>{let r=e.toLowerCase();if(wZr(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 Nx=class extends Qie{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 dc=class{constructor(e){this._client=e}};var NN=class extends dc{retrieve(e,r){return this._client.get(`/v1/models/${e}?beta=true`,r)}list(e={},r){return Pg(e)?this.list({},e):this._client.getAPIList("/v1/models?beta=true",Xq,{query:e,...r})}},Xq=class extends Nx{};NN.BetaModelInfosPage=Xq;var Qq=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new uP;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 Or("Attempted to iterate over a response with no body");return new t(l5(e.body),r)}};var DN=class extends dc{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(Pg(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(Pg(e))return this.list({},e);let{betas:n,...o}=e;return this._client.getAPIList("/v1/messages/batches?beta=true",eU,{query:o,...r,headers:{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r?.headers}})}delete(e,r={},n){if(Pg(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(Pg(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(Pg(r))return this.results(e,{},r);let o=await this.retrieve(e);if(!o.results_url)throw new Or(`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)=>Qq.fromResponse(s.response,s.controller))}},eU=class extends Nx{};DN.BetaMessageBatchesPage=eU;var OZr=t=>{let e=0,r=[];for(;e{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),tU(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),tU(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),tU(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),tU(t);break;case"delimiter":return t=t.slice(0,t.length-1),tU(t);break}return t},PZr=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},EZr=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},tae=t=>JSON.parse(EZr(PZr(tU(OZr(t)))));var of=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},bn=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)},Eg,SI,f5,rae,p5,m5,nae,h5,lP,g5,oae,iae,rU,aae,sae,mje,iDt,hje,gje,yje,bje,aDt,sDt="__json_buf",uae=class t{constructor(){Eg.add(this),this.messages=[],this.receivedMessages=[],SI.set(this,void 0),this.controller=new AbortController,f5.set(this,void 0),rae.set(this,()=>{}),p5.set(this,()=>{}),m5.set(this,void 0),nae.set(this,()=>{}),h5.set(this,()=>{}),lP.set(this,{}),g5.set(this,!1),oae.set(this,!1),iae.set(this,!1),rU.set(this,!1),aae.set(this,void 0),sae.set(this,void 0),hje.set(this,e=>{if(of(this,oae,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new ed),e instanceof ed)return of(this,iae,!0,"f"),this._emit("abort",e);if(e instanceof Or)return this._emit("error",e);if(e instanceof Error){let r=new Or(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Or(String(e)))}),of(this,f5,new Promise((e,r)=>{of(this,rae,e,"f"),of(this,p5,r,"f")}),"f"),of(this,m5,new Promise((e,r)=>{of(this,nae,e,"f"),of(this,h5,r,"f")}),"f"),bn(this,f5,"f").catch(()=>{}),bn(this,m5,"f").catch(()=>{})}get response(){return bn(this,aae,"f")}get request_id(){return bn(this,sae,"f")}async withResponse(){let e=await bn(this,f5,"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")},bn(this,hje,"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())),bn(this,Eg,"m",gje).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)bn(this,Eg,"m",yje).call(this,s);if(a.controller.signal?.aborted)throw new ed;bn(this,Eg,"m",bje).call(this)}_connected(e){this.ended||(of(this,aae,e,"f"),of(this,sae,e?.headers.get("request-id"),"f"),bn(this,rae,"f").call(this,e),this._emit("connect"))}get ended(){return bn(this,g5,"f")}get errored(){return bn(this,oae,"f")}get aborted(){return bn(this,iae,"f")}abort(){this.controller.abort()}on(e,r){return(bn(this,lP,"f")[e]||(bn(this,lP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=bn(this,lP,"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(bn(this,lP,"f")[e]||(bn(this,lP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{of(this,rU,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){of(this,rU,!0,"f"),await bn(this,m5,"f")}get currentMessage(){return bn(this,SI,"f")}async finalMessage(){return await this.done(),bn(this,Eg,"m",mje).call(this)}async finalText(){return await this.done(),bn(this,Eg,"m",iDt).call(this)}_emit(e,...r){if(bn(this,g5,"f"))return;e==="end"&&(of(this,g5,!0,"f"),bn(this,nae,"f").call(this));let n=bn(this,lP,"f")[e];if(n&&(bn(this,lP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!bn(this,rU,"f")&&!n?.length&&Promise.reject(o),bn(this,p5,"f").call(this,o),bn(this,h5,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!bn(this,rU,"f")&&!n?.length&&Promise.reject(o),bn(this,p5,"f").call(this,o),bn(this,h5,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",bn(this,Eg,"m",mje).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),bn(this,Eg,"m",gje).call(this),this._connected(null);let o=jx.fromReadableStream(e,this.controller);for await(let i of o)bn(this,Eg,"m",yje).call(this,i);if(o.controller.signal?.aborted)throw new ed;bn(this,Eg,"m",bje).call(this)}[(SI=new WeakMap,f5=new WeakMap,rae=new WeakMap,p5=new WeakMap,m5=new WeakMap,nae=new WeakMap,h5=new WeakMap,lP=new WeakMap,g5=new WeakMap,oae=new WeakMap,iae=new WeakMap,rU=new WeakMap,aae=new WeakMap,sae=new WeakMap,hje=new WeakMap,Eg=new WeakSet,mje=function(){if(this.receivedMessages.length===0)throw new Or("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},iDt=function(){if(this.receivedMessages.length===0)throw new Or("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 Or("stream ended without producing a content block with type=text");return r.join(" ")},gje=function(){this.ended||of(this,SI,void 0,"f")},yje=function(r){if(this.ended)return;let n=bn(this,Eg,"m",aDt).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":{of(this,SI,n,"f");break}case"content_block_start":case"message_delta":break}},bje=function(){if(this.ended)throw new Or("stream has ended, this shouldn't happen");let r=bn(this,SI,"f");if(!r)throw new Or("request ended without sending any chunks");return of(this,SI,void 0,"f"),r},aDt=function(r){let n=bn(this,SI,"f");if(r.type==="message_start"){if(n)throw new Or(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Or(`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[sDt]||"";i+=r.delta.partial_json,Object.defineProperty(o,sDt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=tae(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 jx(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var uDt={"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"},xI=class extends dc{constructor(){super(...arguments),this.batches=new DN(this._client)}create(e,r){let{betas:n,...o}=e;return o.model in uDt&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${uDt[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 uae.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}})}};xI.Batches=DN;xI.BetaMessageBatchesPage=eU;var Dx=class extends dc{constructor(){super(...arguments),this.models=new NN(this._client),this.messages=new xI(this._client)}};Dx.Models=NN;Dx.BetaModelInfosPage=Xq;Dx.Messages=xI;var LN=class extends dc{create(e,r){return this._client.post("/v1/complete",{body:e,timeout:this._client._options.timeout??6e5,...r,stream:e.stream??!1})}};var FN=class extends dc{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 Pg(e)?this.list({},e):this._client.getAPIList("/v1/messages/batches",nU,{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 Or(`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)=>Qq.fromResponse(i.response,i.controller))}},nU=class extends Nx{};FN.MessageBatchesPage=nU;var af=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)},Tg,CI,y5,lae,b5,_5,cae,v5,cP,w5,dae,fae,oU,pae,mae,_je,lDt,vje,wje,Sje,xje,cDt,dDt="__json_buf",hae=class t{constructor(){Tg.add(this),this.messages=[],this.receivedMessages=[],CI.set(this,void 0),this.controller=new AbortController,y5.set(this,void 0),lae.set(this,()=>{}),b5.set(this,()=>{}),_5.set(this,void 0),cae.set(this,()=>{}),v5.set(this,()=>{}),cP.set(this,{}),w5.set(this,!1),dae.set(this,!1),fae.set(this,!1),oU.set(this,!1),pae.set(this,void 0),mae.set(this,void 0),vje.set(this,e=>{if(af(this,dae,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new ed),e instanceof ed)return af(this,fae,!0,"f"),this._emit("abort",e);if(e instanceof Or)return this._emit("error",e);if(e instanceof Error){let r=new Or(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Or(String(e)))}),af(this,y5,new Promise((e,r)=>{af(this,lae,e,"f"),af(this,b5,r,"f")}),"f"),af(this,_5,new Promise((e,r)=>{af(this,cae,e,"f"),af(this,v5,r,"f")}),"f"),_n(this,y5,"f").catch(()=>{}),_n(this,_5,"f").catch(()=>{})}get response(){return _n(this,pae,"f")}get request_id(){return _n(this,mae,"f")}async withResponse(){let e=await _n(this,y5,"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,vje,"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,Tg,"m",wje).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,Tg,"m",Sje).call(this,s);if(a.controller.signal?.aborted)throw new ed;_n(this,Tg,"m",xje).call(this)}_connected(e){this.ended||(af(this,pae,e,"f"),af(this,mae,e?.headers.get("request-id"),"f"),_n(this,lae,"f").call(this,e),this._emit("connect"))}get ended(){return _n(this,w5,"f")}get errored(){return _n(this,dae,"f")}get aborted(){return _n(this,fae,"f")}abort(){this.controller.abort()}on(e,r){return(_n(this,cP,"f")[e]||(_n(this,cP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=_n(this,cP,"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,cP,"f")[e]||(_n(this,cP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{af(this,oU,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){af(this,oU,!0,"f"),await _n(this,_5,"f")}get currentMessage(){return _n(this,CI,"f")}async finalMessage(){return await this.done(),_n(this,Tg,"m",_je).call(this)}async finalText(){return await this.done(),_n(this,Tg,"m",lDt).call(this)}_emit(e,...r){if(_n(this,w5,"f"))return;e==="end"&&(af(this,w5,!0,"f"),_n(this,cae,"f").call(this));let n=_n(this,cP,"f")[e];if(n&&(_n(this,cP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!_n(this,oU,"f")&&!n?.length&&Promise.reject(o),_n(this,b5,"f").call(this,o),_n(this,v5,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!_n(this,oU,"f")&&!n?.length&&Promise.reject(o),_n(this,b5,"f").call(this,o),_n(this,v5,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",_n(this,Tg,"m",_je).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),_n(this,Tg,"m",wje).call(this),this._connected(null);let o=jx.fromReadableStream(e,this.controller);for await(let i of o)_n(this,Tg,"m",Sje).call(this,i);if(o.controller.signal?.aborted)throw new ed;_n(this,Tg,"m",xje).call(this)}[(CI=new WeakMap,y5=new WeakMap,lae=new WeakMap,b5=new WeakMap,_5=new WeakMap,cae=new WeakMap,v5=new WeakMap,cP=new WeakMap,w5=new WeakMap,dae=new WeakMap,fae=new WeakMap,oU=new WeakMap,pae=new WeakMap,mae=new WeakMap,vje=new WeakMap,Tg=new WeakSet,_je=function(){if(this.receivedMessages.length===0)throw new Or("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},lDt=function(){if(this.receivedMessages.length===0)throw new Or("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 Or("stream ended without producing a content block with type=text");return r.join(" ")},wje=function(){this.ended||af(this,CI,void 0,"f")},Sje=function(r){if(this.ended)return;let n=_n(this,Tg,"m",cDt).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":{af(this,CI,n,"f");break}case"content_block_start":case"message_delta":break}},xje=function(){if(this.ended)throw new Or("stream has ended, this shouldn't happen");let r=_n(this,CI,"f");if(!r)throw new Or("request ended without sending any chunks");return af(this,CI,void 0,"f"),r},cDt=function(r){let n=_n(this,CI,"f");if(r.type==="message_start"){if(n)throw new Or(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Or(`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[dDt]||"";i+=r.delta.partial_json,Object.defineProperty(o,dDt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=tae(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 jx(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var dP=class extends dc{constructor(){super(...arguments),this.batches=new FN(this._client)}create(e,r){return e.model in fDt&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${fDt[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 hae.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},fDt={"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"};dP.Batches=FN;dP.MessageBatchesPage=nU;var OI=class extends dc{retrieve(e,r){return this._client.get(`/v1/models/${e}`,r)}list(e={},r){return Pg(e)?this.list({},e):this._client.getAPIList("/v1/models",kN,{query:e,...r})}},kN=class extends Nx{};OI.ModelInfosPage=kN;var pDt,mi=class extends Xie{constructor({baseURL:e=eae("ANTHROPIC_BASE_URL"),apiKey:r=eae("ANTHROPIC_API_KEY")??null,authToken:n=eae("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&oDt())throw new Or(`It looks like you're running in a browser-like environment. +`,"\r"]);uP.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function oZr(t,e){for(let o=e??0;o({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 uje({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:a}=await r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+` +`);o.enqueue(s)}catch(i){o.error(i)}},async cancel(){await r.return?.()}})}};async function*iZr(t,e){if(!t.body)throw e.abort(),new Or("Attempted to iterate over a response with no body");let r=new cje,n=new uP,o=c5(t.body);for await(let i of aZr(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*aZr(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=eDt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var cje=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]=sZr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function sZr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var uZr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",lZr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&d5(t),d5=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function";async function tDt(t,e,r){if(t=await t,lZr(t))return t;if(uZr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=d5(o)?[await o.arrayBuffer()]:[o];return new Kie(i,e,r)}let n=await cZr(t);if(e||(e=fZr(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Kie(n,e,r)}async function cZr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(d5(t))e.push(await t.arrayBuffer());else if(pZr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${dZr(t)}`);return e}function dZr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function fZr(t){return fje(t.name)||fje(t.filename)||fje(t.path)?.split(/[\\/]/).pop()}var fje=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},pZr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",pje=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var hZr=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},gZr=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)},Xie;async function aDt(t){let{response:e}=t;if(t.options.stream)return Xq("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):Nx.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 Xq("response",e.status,e.url,e.headers,i),sDt(i,e)}let o=await e.text();return Xq("response",e.status,e.url,e.headers,o),o}function sDt(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}var eae=class t extends Promise{constructor(e,r=aDt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>sDt(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)}},tae=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=mje("maxRetries",r),this.timeout=mje("timeout",n),this.httpAgent=o,this.fetch=i??sje}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...vZr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${OZr()}`}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&&d5(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:pje(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&&mje("timeout",e.timeout),e.timeout=e.timeout??this.timeout;let c=e.httpAgent??this.httpAgent??lje(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 iDt(i,a),iDt(i,r),pje(e.body)&&jN!=="node"&&delete i["content-type"],Qie(a,"x-stainless-retry-count")===void 0&&Qie(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),Qie(a,"x-stainless-timeout")===void 0&&Qie(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 Or("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 cc.generate(e,r,n,o)}request(e,r=null){return new eae(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}),Xq("request",a,n,i.headers),n.signal?.aborted)throw new ed;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(Yie);if(l instanceof Error){if(n.signal?.aborted)throw new ed;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new Zq:new wI({cause:l})}let c=dje(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let b=`retrying, ${r} attempts remaining`;return Xq(`response (error; ${b})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(b=>Yie(b).message),f=wZr(d),p=f?void 0:d;throw Xq(`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 hje(this,n,e)}buildURL(e,r){let n=xZr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return f5(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 Or(`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 CZr(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 ${RN}`}},rae=class{constructor(e,r,n,o){Xie.set(this,void 0),hZr(this,Xie,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 Or("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 gZr(this,Xie,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Xie=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},hje=class extends eae{constructor(e,r,n){super(r,async o=>new n(e,o.response,await aDt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},dje=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),yZr={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},Pg=t=>typeof t=="object"&&t!==null&&!f5(t)&&Object.keys(t).every(e=>uDt(yZr,e)),bZr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":RN,"X-Stainless-OS":nDt(Deno.build.os),"X-Stainless-Arch":rDt(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":RN,"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":RN,"X-Stainless-OS":nDt(process.platform),"X-Stainless-Arch":rDt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=_Zr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":RN,"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":RN,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function _Zr(){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 rDt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",nDt=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"),oDt,vZr=()=>oDt??(oDt=bZr()),wZr=t=>{try{return JSON.parse(t)}catch{return}},SZr=/^[a-z][a-z0-9+.-]*:/i,xZr=t=>SZr.test(t),CZr=t=>new Promise(e=>setTimeout(e,t)),mje=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Or(`${t} must be an integer`);if(e<0)throw new Or(`${t} must be a positive integer`);return e},Yie=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))};var nae=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function f5(t){if(!t)return!0;for(let e in t)return!1;return!0}function uDt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function iDt(t,e){for(let r in e){if(!uDt(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 Xq(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Anthropic:DEBUG:${t}`,...e)}var OZr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),lDt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",PZr=t=>typeof t?.get=="function";var Qie=(t,e)=>{let r=e.toLowerCase();if(PZr(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 Dx=class extends rae{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 dc=class{constructor(e){this._client=e}};var DN=class extends dc{retrieve(e,r){return this._client.get(`/v1/models/${e}?beta=true`,r)}list(e={},r){return Pg(e)?this.list({},e):this._client.getAPIList("/v1/models?beta=true",Qq,{query:e,...r})}},Qq=class extends Dx{};DN.BetaModelInfosPage=Qq;var eU=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new uP;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 Or("Attempted to iterate over a response with no body");return new t(c5(e.body),r)}};var LN=class extends dc{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(Pg(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(Pg(e))return this.list({},e);let{betas:n,...o}=e;return this._client.getAPIList("/v1/messages/batches?beta=true",tU,{query:o,...r,headers:{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r?.headers}})}delete(e,r={},n){if(Pg(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(Pg(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(Pg(r))return this.results(e,{},r);let o=await this.retrieve(e);if(!o.results_url)throw new Or(`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)=>eU.fromResponse(s.response,s.controller))}},tU=class extends Dx{};LN.BetaMessageBatchesPage=tU;var IZr=t=>{let e=0,r=[];for(;e{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),rU(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),rU(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),rU(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),rU(t);break;case"delimiter":return t=t.slice(0,t.length-1),rU(t);break}return t},MZr=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},RZr=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},oae=t=>JSON.parse(RZr(MZr(rU(IZr(t)))));var of=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)},Eg,SI,p5,iae,m5,h5,aae,g5,lP,y5,sae,uae,nU,lae,cae,gje,cDt,yje,bje,_je,vje,dDt,fDt="__json_buf",dae=class t{constructor(){Eg.add(this),this.messages=[],this.receivedMessages=[],SI.set(this,void 0),this.controller=new AbortController,p5.set(this,void 0),iae.set(this,()=>{}),m5.set(this,()=>{}),h5.set(this,void 0),aae.set(this,()=>{}),g5.set(this,()=>{}),lP.set(this,{}),y5.set(this,!1),sae.set(this,!1),uae.set(this,!1),nU.set(this,!1),lae.set(this,void 0),cae.set(this,void 0),yje.set(this,e=>{if(of(this,sae,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new ed),e instanceof ed)return of(this,uae,!0,"f"),this._emit("abort",e);if(e instanceof Or)return this._emit("error",e);if(e instanceof Error){let r=new Or(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Or(String(e)))}),of(this,p5,new Promise((e,r)=>{of(this,iae,e,"f"),of(this,m5,r,"f")}),"f"),of(this,h5,new Promise((e,r)=>{of(this,aae,e,"f"),of(this,g5,r,"f")}),"f"),_n(this,p5,"f").catch(()=>{}),_n(this,h5,"f").catch(()=>{})}get response(){return _n(this,lae,"f")}get request_id(){return _n(this,cae,"f")}async withResponse(){let e=await _n(this,p5,"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,yje,"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,Eg,"m",bje).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,Eg,"m",_je).call(this,s);if(a.controller.signal?.aborted)throw new ed;_n(this,Eg,"m",vje).call(this)}_connected(e){this.ended||(of(this,lae,e,"f"),of(this,cae,e?.headers.get("request-id"),"f"),_n(this,iae,"f").call(this,e),this._emit("connect"))}get ended(){return _n(this,y5,"f")}get errored(){return _n(this,sae,"f")}get aborted(){return _n(this,uae,"f")}abort(){this.controller.abort()}on(e,r){return(_n(this,lP,"f")[e]||(_n(this,lP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=_n(this,lP,"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,lP,"f")[e]||(_n(this,lP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{of(this,nU,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){of(this,nU,!0,"f"),await _n(this,h5,"f")}get currentMessage(){return _n(this,SI,"f")}async finalMessage(){return await this.done(),_n(this,Eg,"m",gje).call(this)}async finalText(){return await this.done(),_n(this,Eg,"m",cDt).call(this)}_emit(e,...r){if(_n(this,y5,"f"))return;e==="end"&&(of(this,y5,!0,"f"),_n(this,aae,"f").call(this));let n=_n(this,lP,"f")[e];if(n&&(_n(this,lP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!_n(this,nU,"f")&&!n?.length&&Promise.reject(o),_n(this,m5,"f").call(this,o),_n(this,g5,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!_n(this,nU,"f")&&!n?.length&&Promise.reject(o),_n(this,m5,"f").call(this,o),_n(this,g5,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",_n(this,Eg,"m",gje).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),_n(this,Eg,"m",bje).call(this),this._connected(null);let o=Nx.fromReadableStream(e,this.controller);for await(let i of o)_n(this,Eg,"m",_je).call(this,i);if(o.controller.signal?.aborted)throw new ed;_n(this,Eg,"m",vje).call(this)}[(SI=new WeakMap,p5=new WeakMap,iae=new WeakMap,m5=new WeakMap,h5=new WeakMap,aae=new WeakMap,g5=new WeakMap,lP=new WeakMap,y5=new WeakMap,sae=new WeakMap,uae=new WeakMap,nU=new WeakMap,lae=new WeakMap,cae=new WeakMap,yje=new WeakMap,Eg=new WeakSet,gje=function(){if(this.receivedMessages.length===0)throw new Or("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},cDt=function(){if(this.receivedMessages.length===0)throw new Or("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 Or("stream ended without producing a content block with type=text");return r.join(" ")},bje=function(){this.ended||of(this,SI,void 0,"f")},_je=function(r){if(this.ended)return;let n=_n(this,Eg,"m",dDt).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":{of(this,SI,n,"f");break}case"content_block_start":case"message_delta":break}},vje=function(){if(this.ended)throw new Or("stream has ended, this shouldn't happen");let r=_n(this,SI,"f");if(!r)throw new Or("request ended without sending any chunks");return of(this,SI,void 0,"f"),r},dDt=function(r){let n=_n(this,SI,"f");if(r.type==="message_start"){if(n)throw new Or(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Or(`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[fDt]||"";i+=r.delta.partial_json,Object.defineProperty(o,fDt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=oae(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 Nx(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var pDt={"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"},xI=class extends dc{constructor(){super(...arguments),this.batches=new LN(this._client)}create(e,r){let{betas:n,...o}=e;return o.model in pDt&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${pDt[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 dae.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}})}};xI.Batches=LN;xI.BetaMessageBatchesPage=tU;var Lx=class extends dc{constructor(){super(...arguments),this.models=new DN(this._client),this.messages=new xI(this._client)}};Lx.Models=DN;Lx.BetaModelInfosPage=Qq;Lx.Messages=xI;var FN=class extends dc{create(e,r){return this._client.post("/v1/complete",{body:e,timeout:this._client._options.timeout??6e5,...r,stream:e.stream??!1})}};var kN=class extends dc{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 Pg(e)?this.list({},e):this._client.getAPIList("/v1/messages/batches",oU,{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 Or(`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)=>eU.fromResponse(i.response,i.controller))}},oU=class extends Dx{};kN.MessageBatchesPage=oU;var af=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},vn=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)},Tg,CI,b5,fae,_5,v5,pae,w5,cP,S5,mae,hae,iU,gae,yae,wje,mDt,Sje,xje,Cje,Oje,hDt,gDt="__json_buf",bae=class t{constructor(){Tg.add(this),this.messages=[],this.receivedMessages=[],CI.set(this,void 0),this.controller=new AbortController,b5.set(this,void 0),fae.set(this,()=>{}),_5.set(this,()=>{}),v5.set(this,void 0),pae.set(this,()=>{}),w5.set(this,()=>{}),cP.set(this,{}),S5.set(this,!1),mae.set(this,!1),hae.set(this,!1),iU.set(this,!1),gae.set(this,void 0),yae.set(this,void 0),Sje.set(this,e=>{if(af(this,mae,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new ed),e instanceof ed)return af(this,hae,!0,"f"),this._emit("abort",e);if(e instanceof Or)return this._emit("error",e);if(e instanceof Error){let r=new Or(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Or(String(e)))}),af(this,b5,new Promise((e,r)=>{af(this,fae,e,"f"),af(this,_5,r,"f")}),"f"),af(this,v5,new Promise((e,r)=>{af(this,pae,e,"f"),af(this,w5,r,"f")}),"f"),vn(this,b5,"f").catch(()=>{}),vn(this,v5,"f").catch(()=>{})}get response(){return vn(this,gae,"f")}get request_id(){return vn(this,yae,"f")}async withResponse(){let e=await vn(this,b5,"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")},vn(this,Sje,"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())),vn(this,Tg,"m",xje).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)vn(this,Tg,"m",Cje).call(this,s);if(a.controller.signal?.aborted)throw new ed;vn(this,Tg,"m",Oje).call(this)}_connected(e){this.ended||(af(this,gae,e,"f"),af(this,yae,e?.headers.get("request-id"),"f"),vn(this,fae,"f").call(this,e),this._emit("connect"))}get ended(){return vn(this,S5,"f")}get errored(){return vn(this,mae,"f")}get aborted(){return vn(this,hae,"f")}abort(){this.controller.abort()}on(e,r){return(vn(this,cP,"f")[e]||(vn(this,cP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=vn(this,cP,"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(vn(this,cP,"f")[e]||(vn(this,cP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{af(this,iU,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){af(this,iU,!0,"f"),await vn(this,v5,"f")}get currentMessage(){return vn(this,CI,"f")}async finalMessage(){return await this.done(),vn(this,Tg,"m",wje).call(this)}async finalText(){return await this.done(),vn(this,Tg,"m",mDt).call(this)}_emit(e,...r){if(vn(this,S5,"f"))return;e==="end"&&(af(this,S5,!0,"f"),vn(this,pae,"f").call(this));let n=vn(this,cP,"f")[e];if(n&&(vn(this,cP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!vn(this,iU,"f")&&!n?.length&&Promise.reject(o),vn(this,_5,"f").call(this,o),vn(this,w5,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!vn(this,iU,"f")&&!n?.length&&Promise.reject(o),vn(this,_5,"f").call(this,o),vn(this,w5,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",vn(this,Tg,"m",wje).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),vn(this,Tg,"m",xje).call(this),this._connected(null);let o=Nx.fromReadableStream(e,this.controller);for await(let i of o)vn(this,Tg,"m",Cje).call(this,i);if(o.controller.signal?.aborted)throw new ed;vn(this,Tg,"m",Oje).call(this)}[(CI=new WeakMap,b5=new WeakMap,fae=new WeakMap,_5=new WeakMap,v5=new WeakMap,pae=new WeakMap,w5=new WeakMap,cP=new WeakMap,S5=new WeakMap,mae=new WeakMap,hae=new WeakMap,iU=new WeakMap,gae=new WeakMap,yae=new WeakMap,Sje=new WeakMap,Tg=new WeakSet,wje=function(){if(this.receivedMessages.length===0)throw new Or("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},mDt=function(){if(this.receivedMessages.length===0)throw new Or("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 Or("stream ended without producing a content block with type=text");return r.join(" ")},xje=function(){this.ended||af(this,CI,void 0,"f")},Cje=function(r){if(this.ended)return;let n=vn(this,Tg,"m",hDt).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":{af(this,CI,n,"f");break}case"content_block_start":case"message_delta":break}},Oje=function(){if(this.ended)throw new Or("stream has ended, this shouldn't happen");let r=vn(this,CI,"f");if(!r)throw new Or("request ended without sending any chunks");return af(this,CI,void 0,"f"),r},hDt=function(r){let n=vn(this,CI,"f");if(r.type==="message_start"){if(n)throw new Or(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Or(`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[gDt]||"";i+=r.delta.partial_json,Object.defineProperty(o,gDt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=oae(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 Nx(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var dP=class extends dc{constructor(){super(...arguments),this.batches=new kN(this._client)}create(e,r){return e.model in yDt&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${yDt[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 bae.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},yDt={"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"};dP.Batches=kN;dP.MessageBatchesPage=oU;var OI=class extends dc{retrieve(e,r){return this._client.get(`/v1/models/${e}`,r)}list(e={},r){return Pg(e)?this.list({},e):this._client.getAPIList("/v1/models",$N,{query:e,...r})}},$N=class extends Dx{};OI.ModelInfosPage=$N;var bDt,mi=class extends tae{constructor({baseURL:e=nae("ANTHROPIC_BASE_URL"),apiKey:r=nae("ANTHROPIC_API_KEY")??null,authToken:n=nae("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&lDt())throw new Or(`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 LN(this),this.messages=new dP(this),this.models=new OI(this),this.beta=new Dx(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&&!d5(r)?r:n!=null&&!d5(n)?n:{}}apiKeyAuth(e){return this.apiKey==null?{}:{"X-Api-Key":this.apiKey}}bearerAuth(e){return this.authToken==null?{}:{Authorization:`Bearer ${this.authToken}`}}};pDt=mi;mi.Anthropic=pDt;mi.HUMAN_PROMPT=` +`);super({baseURL:i.baseURL,timeout:i.timeout??6e5,httpAgent:i.httpAgent,maxRetries:i.maxRetries,fetch:i.fetch}),this.completions=new FN(this),this.messages=new dP(this),this.models=new OI(this),this.beta=new Lx(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&&!f5(r)?r:n!=null&&!f5(n)?n:{}}apiKeyAuth(e){return this.apiKey==null?{}:{"X-Api-Key":this.apiKey}}bearerAuth(e){return this.authToken==null?{}:{Authorization:`Bearer ${this.authToken}`}}};bDt=mi;mi.Anthropic=bDt;mi.HUMAN_PROMPT=` Human:`;mi.AI_PROMPT=` -Assistant:`;mi.DEFAULT_TIMEOUT=6e5;mi.AnthropicError=Or;mi.APIError=cc;mi.APIConnectionError=wI;mi.APIConnectionTimeoutError=Yq;mi.APIUserAbortError=ed;mi.NotFoundError=o5;mi.ConflictError=i5;mi.RateLimitError=s5;mi.BadRequestError=t5;mi.AuthenticationError=r5;mi.InternalServerError=u5;mi.PermissionDeniedError=n5;mi.UnprocessableEntityError=a5;mi.toFile=YNt;mi.fileFromPath=Vie;mi.Completions=LN;mi.Messages=dP;mi.Models=OI;mi.ModelInfosPage=kN;mi.Beta=Dx;var{HUMAN_PROMPT:lWo,AI_PROMPT:cWo}=mi;gs();Qd();Dn();fx();Wm();Ec();Sm();pB();Km();gy();var S5=class extends PR{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 vm(`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 vm(`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)?Cje(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 Cje(t){let e=[];for(let r of t)r.type==="tool_use"&&e.push({name:r.name,args:r.input,id:r.id,type:"tool_call"});return e}function mDt(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:typeof t=="string"?{type:"tool",name:t}:t}gs();function hDt(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}function gDt(t){let e=ame({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(` +Assistant:`;mi.DEFAULT_TIMEOUT=6e5;mi.AnthropicError=Or;mi.APIError=cc;mi.APIConnectionError=wI;mi.APIConnectionTimeoutError=Zq;mi.APIUserAbortError=ed;mi.NotFoundError=i5;mi.ConflictError=a5;mi.RateLimitError=u5;mi.BadRequestError=r5;mi.AuthenticationError=n5;mi.InternalServerError=l5;mi.PermissionDeniedError=o5;mi.UnprocessableEntityError=s5;mi.toFile=tDt;mi.fileFromPath=Gie;mi.Completions=FN;mi.Messages=dP;mi.Models=OI;mi.ModelInfosPage=$N;mi.Beta=Lx;var{HUMAN_PROMPT:yWo,AI_PROMPT:bWo}=mi;gs();Qd();Dn();fx();Wm();Ec();Sm();mB();Km();gy();var x5=class extends PR{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 vm(`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 vm(`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)?Pje(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 Pje(t){let e=[];for(let r of t)r.type==="tool_use"&&e.push({name:r.name,args:r.input,id:r.id,type:"tool_call"});return e}function _Dt(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:typeof t=="string"?{type:"tool",name:t}:t}gs();function vDt(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}function wDt(t){let e=lme({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 MZr(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 Os({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new Os({content:[{type:"tool_result",content:Oje(r.content),tool_use_id:r.tool_call_id}]}));else e.push(r);return e}function yDt(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}}var RZr={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=ame({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 Oje(t){let e=["tool_use","tool_result","input_json_delta"],r=["text","text_delta"];return typeof t=="string"?t:t.map(o=>{if(jE(o))return H4e(o,RZr);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=gDt(o.image_url):a=gDt(o.image_url.url),{type:"image",source:a,...i?{cache_control:i}:{}}}else{if(hDt(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 gae(t){let e=MZr(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(Oi(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(yDt)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(yDt)]};{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:Oje(i.content)}}}else return{role:a,content:Oje(i.content)}});return{messages:jZr(o),system:r}}function jZr(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{if(jE(o))return W4e(o,FZr);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=wDt(o.image_url):a=wDt(o.image_url.url),{type:"image",source:a,...i?{cache_control:i}:{}}}else{if(vDt(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 _ae(t){let e=LZr(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(Oi(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(SDt)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(SDt)]};{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:Eje(i.content)}}}else return{role:a,content:Eje(i.content)}});return{messages:kZr(o),system:r}}function kZr(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;i0)}function DZr(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 LZr(t){return!!(t.thinking&&t.thinking.type==="enabled")}function FZr(t){return"input_schema"in t}function kZr(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 Eje=class extends Js{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??ot("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 mi(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(FZr(r))return r;if(Wc(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(rc(r))return{name:r.name,description:r.description,input_schema:Gs(r.schema)?So(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=mDt(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=gae(e),a={...o,...i,stream:!0},s=!NZr(a)&&!DZr(a)&&!LZr(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=bDt(l,{streamUsage:c,coerceContentToString:s});if(!d)continue;let{chunk:f}=d,p=kZr(f),m=new qn({message:new dr({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 m,await n?.handleLLMNewToken(p??"",void 0,void 0,void 0,void 0,{chunk:m})}}async _generateNonStreaming(e,r,n){let o=await this.completionWithRetry({...r,stream:!1,...gae(e)},n),{content:i,...a}=o,s=_Dt(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 Pje(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 Pje(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(Gs(n)){let m=So(n);l=[{name:s,description:m.description??"A function available to call.",input_schema:m}],u=new S5({returnSingle:!0,keyName:s,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.description=="string"&&typeof n.input_schema=="object"&&n.input_schema!=null?(m=n,s=n.name):m={name:s,description:n.description??"",input_schema:n},l=[m],u=new S5({returnSingle:!0,keyName:s})}let c;if(this.thinking?.type==="enabled"){let m="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(m),c=this.bind({tools:l});let h=b=>{if(!b.tool_calls||b.tool_calls.length===0)throw new Error(m);return b};c=c.pipe(h)}else c=this.bind({tools:l,tool_choice:{type:"tool",name:s}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=go.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=go.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return bi.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},bae=class extends Eje{};fAe();Dn();pg();gs();Qd();Dn();fx();Wm();Sm();gy();iq();Ec();sq();function $N(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}pg();Ec();Km();function x5(t,e){return t.lc_error_code=e,t.message=`${t.message} +`,t}function Tje(t){let e;return t.status===400&&t.message.includes("tool")?e=vae(t,"INVALID_TOOL_RESULTS"):t.status===401?e=vae(t,"MODEL_AUTHENTICATION"):t.status===404?e=vae(t,"MODEL_NOT_FOUND"):t.status===429?e=vae(t,"MODEL_RATE_LIMIT"):e=t,e}function $Zr(t){return!!(t.tools&&t.tools.length>0)}function BZr(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 qZr(t){return!!(t.thinking&&t.thinking.type==="enabled")}function UZr(t){return"input_schema"in t}function zZr(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 Aje=class extends Js{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??ot("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 mi(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(UZr(r))return r;if(Wc(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(rc(r))return{name:r.name,description:r.description,input_schema:Gs(r.schema)?So(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=_Dt(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=_ae(e),a={...o,...i,stream:!0},s=!$Zr(a)&&!BZr(a)&&!qZr(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=xDt(l,{streamUsage:c,coerceContentToString:s});if(!d)continue;let{chunk:f}=d,p=zZr(f),m=new qn({message:new dr({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 m,await n?.handleLLMNewToken(p??"",void 0,void 0,void 0,void 0,{chunk:m})}}async _generateNonStreaming(e,r,n){let o=await this.completionWithRetry({...r,stream:!1,..._ae(e)},n),{content:i,...a}=o,s=CDt(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 Tje(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 Tje(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(Gs(n)){let m=So(n);l=[{name:s,description:m.description??"A function available to call.",input_schema:m}],u=new x5({returnSingle:!0,keyName:s,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.description=="string"&&typeof n.input_schema=="object"&&n.input_schema!=null?(m=n,s=n.name):m={name:s,description:n.description??"",input_schema:n},l=[m],u=new x5({returnSingle:!0,keyName:s})}let c;if(this.thinking?.type==="enabled"){let m="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(m),c=this.bind({tools:l});let h=b=>{if(!b.tool_calls||b.tool_calls.length===0)throw new Error(m);return b};c=c.pipe(h)}else c=this.bind({tools:l,tool_choice:{type:"tool",name:s}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=go.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=go.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return bi.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},wae=class extends Aje{};hAe();Dn();pg();gs();Qd();Dn();fx();Wm();Sm();gy();aq();Ec();uq();function BN(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}pg();Ec();Km();function C5(t,e){return t.lc_error_code=e,t.message=`${t.message} Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/ -`,t}function BN(t){let e;return t.constructor.name===Xf.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Li.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=x5(t,"INVALID_TOOL_RESULTS"):t.status===401?e=x5(t,"MODEL_AUTHENTICATION"):t.status===429?e=x5(t,"MODEL_RATE_LIMIT"):t.status===404?e=x5(t,"MODEL_NOT_FOUND"):e=t,e}function Tje(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 $Zr(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function vDt(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(wDt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(` -`)}function wDt(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}: ${_ae(o,e)},`):r.push(`${n}?: ${_ae(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(` -`)}function _ae(t,e){if($Zr(t))return t.anyOf.map(r=>_ae(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["{",wDt(t,e+2),"}"].join(` -`);case"array":return t.items?`${_ae(t.items,e)}[]`:"any[]";default:return""}}Km();sq();function SDt(t,e){let r;if(rc(t)){let n=$ne({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:TA(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function BZr(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 Mje(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(!Cs.isInstance(t))throw new Error("Invalid generic chat message");return BZr(t)}default:throw new Error(`Unknown message type: ${e}`)}}function Ije(t,e){return t.flatMap(r=>{let n=Mje(r);n==="system"&&Rje(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=""),Oi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(Ox),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}var iU="__openai_function_call_ids__";function xDt(t,e){return t.flatMap(r=>{let n=Mje(r);if(n==="system"&&Rje(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[iU];if(Oi(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 ODt(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(Jp(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Xm(s,l))}i[iU]??(i[iU]={}),i[iU][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 gn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function qZr(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[iU]={[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=ODt(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 qn({text:e.map(u=>u.text).join(""),message:new dr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function Aje(t){return"type"in t&&t.type!=="function"}function UZr(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function CDt(t,e){return Wc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:SDt(t,e)}function Rje(t){return t?.startsWith("o1")||t?.startsWith("o3")}var C5=class extends Js{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??ot("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ot("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=>Aje(o)?o:CDt(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&vae(e.json_schema.schema)?aq(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=>Aje(l)?l:Wc(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:UZr(e?.tool_choice)?e?.tool_choice:(()=>{let l=Tje(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=>CDt(s,{strict:n})):void 0,tool_choice:Tje(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),Rje(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(Jp(u,{returnId:!0}))}catch(l){i.push(Xm(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 gn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Cs(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 Mf({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 dr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Rd({content:i,response_metadata:s}):o==="developer"?new Rd({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new ym({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Th({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new If({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:xDt(e,this.model),stream:!0},r);for await(let c of l){let d=qZr(c);d!=null&&(yield d)}return}let o=Ije(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new qn({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new qn({message:new dr({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=xDt(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:ODt(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(Aje),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=Ije(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let b={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};b.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},Oi(b.message)&&(b.message.usage_metadata=o),b.message=new gn(Object.fromEntries(Object.entries(b.message).filter(([g])=>!g.startsWith("lc_")))),p.push(b)}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=vDt(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(Mje(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 BN(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 BN(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 BN(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=$N(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Wt(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;zZr(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"}}),vae(n)?u=Tc.fromZodSchema(n):u=new Ac;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}}}),vae(n)){let f=Tc.fromZodSchema(n);u=Nf.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Ac;else{let f=o??"extract";if(vae(n)){let p=So(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 Zc({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 Zc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=go.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=go.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return bi.from([{raw:s},d])}};function vae(t){return typeof t?.parse=="function"}function zZr(t){return t!==void 0&&typeof t.schema=="object"}Dn();Wm();Qd();Dn();jj();dg();Dn();Dn();Dn();$O();dg();Dn();pg();ZA();var jje=class extends ZO{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??ot("OPENAI_API_KEY"),n=e?.organization??ot("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Wt(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(jje,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var wae=class extends C5{static lc_name(){return"ChatDeepSeek"}_llmType(){return"deepseek"}get lc_secrets(){return{apiKey:"DEEPSEEK_API_KEY"}}constructor(e){let r=e?.apiKey||ot("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)}};_Ae();Ec();fx();gs();Qd();Dn();pB();var qN="0.5.0";var PDt=!1,UN,Nje,HZr,VZr,WZr,Dje,KZr,Sae,Lje,Fje,kje,xae,$je;function EDt(t,e={auto:!1}){if(PDt)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(UN)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${UN}'\``);PDt=e.auto,UN=t.kind,Nje=t.fetch,HZr=t.Request,VZr=t.Response,WZr=t.Headers,Dje=t.FormData,KZr=t.Blob,Sae=t.File,Lje=t.ReadableStream,Fje=t.getMultipartRequestOptions,kje=t.getDefaultAgent,xae=t.fileFromPath,$je=t.isFsReadStream}var Cae=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function TDt({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 Cae(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}}UN||EDt(TDt(),{auto:!0});var Bje={};Cf(Bje,{APIConnectionError:()=>fP,APIConnectionTimeoutError:()=>zN,APIError:()=>Fl,APIUserAbortError:()=>PI,AuthenticationError:()=>sU,BadRequestError:()=>aU,ConflictError:()=>cU,GroqError:()=>fc,InternalServerError:()=>pU,NotFoundError:()=>lU,PermissionDeniedError:()=>uU,RateLimitError:()=>fU,UnprocessableEntityError:()=>dU});var fc=class extends Error{},Fl=class t extends fc{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 fP({cause:Oae(r)});let i=r;return e===400?new aU(e,i,n,o):e===401?new sU(e,i,n,o):e===403?new uU(e,i,n,o):e===404?new lU(e,i,n,o):e===409?new cU(e,i,n,o):e===422?new dU(e,i,n,o):e===429?new fU(e,i,n,o):e>=500?new pU(e,i,n,o):new t(e,i,n,o)}},PI=class extends Fl{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}},fP=class extends Fl{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},zN=class extends fP{constructor({message:e}={}){super({message:e??"Request timed out."})}},aU=class extends Fl{constructor(){super(...arguments),this.status=400}},sU=class extends Fl{constructor(){super(...arguments),this.status=401}},uU=class extends Fl{constructor(){super(...arguments),this.status=403}},lU=class extends Fl{constructor(){super(...arguments),this.status=404}},cU=class extends Fl{constructor(){super(...arguments),this.status=409}},dU=class extends Fl{constructor(){super(...arguments),this.status=422}},fU=class extends Fl{constructor(){super(...arguments),this.status=429}},pU=class extends Fl{};var Pae=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new qje;async function*i(){if(!e.body)throw r.abort(),new fc("Attempted to iterate over a response with no body");let s=new mU,u=ADt(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 Fl(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 mU,s=ADt(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 Lje({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?.()}})}},qje=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]=JZr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},mU=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 fc(`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 fc(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new fc("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}};mU.NEWLINE_CHARS=new Set([` -`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);mU.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;function JZr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function ADt(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 IDt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",MDt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Eae(t),Eae=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",YZr=t=>MDt(t)||IDt(t)||$je(t);async function Hje(t,e,r){if(t=await t,r??(r=MDt(t)?{lastModified:t.lastModified,type:t.type}:{}),IDt(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new Sae([o],e,r)}let n=await ZZr(t);if(e||(e=QZr(t)??"unknown_file"),!r.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Sae(n,e,r)}async function ZZr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Eae(t))e.push(await t.arrayBuffer());else if(eXr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${XZr(t)}`);return e}function XZr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function QZr(t){return Uje(t.name)||Uje(t.filename)||Uje(t.path)?.split(/[\\/]/).pop()}var Uje=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},eXr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Vje=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var O5=async t=>{let e=await RDt(t.body);return Fje(e,t)},RDt=async t=>{let e=new Dje;return await Promise.all(Object.entries(t||{}).map(([r,n])=>zje(e,r,n))),e};var zje=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(YZr(r)){let n=await Hje(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>zje(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>zje(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var rXr=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},nXr=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)},Tae;async function kDt(t){let{response:e}=t;if(t.options.stream)return hU("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):Pae.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 hU("response",e.status,e.url,e.headers,i),i}let o=await e.text();return hU("response",e.status,e.url,e.headers,o),o}var Aae=class t extends Promise{constructor(e,r=kDt){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)}},Iae=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=Wje("maxRetries",r),this.timeout=Wje("timeout",n),this.httpAgent=o,this.fetch=i??Nje}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...sXr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${mXr()}`}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&&Eae(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:Vje(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&&Wje("timeout",e.timeout);let l=e.timeout??this.timeout,c=e.httpAgent??this.httpAgent??kje(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 FDt(o,i),FDt(o,r),Vje(e.body)&&UN!=="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 Fl.generate(e,r,n,o)}request(e,r=null){return new Aae(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}),hU("request",i,n,o.headers),n.signal?.aborted)throw new PI;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(Oae);if(u instanceof Error){if(n.signal?.aborted)throw new PI;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new zN:new fP({cause:u})}let l=oXr(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let h=`retrying, ${r} attempts remaining`;return hU(`response (error; ${h})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(h=>Oae(h).message),d=uXr(c),f=d?void 0:c;throw hU(`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 Kje(this,n,e)}buildURL(e,r){let n=cXr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return fXr(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 fc(`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 dXr(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 ${qN}`}},jDt=class{constructor(e,r,n,o){Tae.set(this,void 0),rXr(this,Tae,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 fc("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 nXr(this,Tae,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Tae=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Kje=class extends Aae{constructor(e,r,n){super(r,async o=>new n(e,o.response,await kDt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},oXr=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}});var iXr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":qN,"X-Stainless-OS":DDt(Deno.build.os),"X-Stainless-Arch":NDt(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":qN,"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":qN,"X-Stainless-OS":DDt(process.platform),"X-Stainless-Arch":NDt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=aXr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":qN,"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":qN,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function aXr(){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 NDt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",DDt=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"),LDt,sXr=()=>LDt??(LDt=iXr()),uXr=t=>{try{return JSON.parse(t)}catch{return}},lXr=new RegExp("^(?:[a-z]+:)?//","i"),cXr=t=>lXr.test(t),dXr=t=>new Promise(e=>setTimeout(e,t)),Wje=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new fc(`${t} must be an integer`);if(e<0)throw new fc(`${t} must be a positive integer`);return e},Oae=t=>t instanceof Error?t:new Error(t);var Gje=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function fXr(t){if(!t)return!0;for(let e in t)return!1;return!0}function pXr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function FDt(t,e){for(let r in e){if(!pXr(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 hU(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var mXr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),$Dt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";var pc=class{constructor(e){this._client=e}};var HN=class extends pc{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",O5({body:e,...r}))}};HN||(HN={});var VN=class extends pc{create(e,r){return this._client.post("/openai/v1/audio/translations",O5({body:e,...r}))}};VN||(VN={});var EI=class extends pc{constructor(){super(...arguments),this.transcriptions=new HN(this._client),this.translations=new VN(this._client)}};(function(t){t.Transcriptions=HN,t.Translations=VN})(EI||(EI={}));var WN=class extends pc{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}};WN||(WN={});var TI=class extends pc{constructor(){super(...arguments),this.completions=new WN(this._client)}};(function(t){t.Completions=WN})(TI||(TI={}));var AI=class extends pc{};AI||(AI={});var II=class extends pc{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}};II||(II={});var MI=class extends pc{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)}};MI||(MI={});var BDt,bs=class extends Iae{constructor({baseURL:e=Gje("GROQ_BASE_URL"),apiKey:r=Gje("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new fc("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&&$Dt())throw new fc(`It looks like you're running in a browser-like environment. +`,t}function qN(t){let e;return t.constructor.name===Xf.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Li.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=C5(t,"INVALID_TOOL_RESULTS"):t.status===401?e=C5(t,"MODEL_AUTHENTICATION"):t.status===429?e=C5(t,"MODEL_RATE_LIMIT"):t.status===404?e=C5(t,"MODEL_NOT_FOUND"):e=t,e}function Ije(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 HZr(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function ODt(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(PDt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(` +`)}function PDt(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}: ${Sae(o,e)},`):r.push(`${n}?: ${Sae(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(` +`)}function Sae(t,e){if(HZr(t))return t.anyOf.map(r=>Sae(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["{",PDt(t,e+2),"}"].join(` +`);case"array":return t.items?`${Sae(t.items,e)}[]`:"any[]";default:return""}}Km();uq();function EDt(t,e){let r;if(rc(t)){let n=Bne({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:TA(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function VZr(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 jje(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(!Cs.isInstance(t))throw new Error("Invalid generic chat message");return VZr(t)}default:throw new Error(`Unknown message type: ${e}`)}}function Rje(t,e){return t.flatMap(r=>{let n=jje(r);n==="system"&&Nje(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=""),Oi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(Ox),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}var aU="__openai_function_call_ids__";function TDt(t,e){return t.flatMap(r=>{let n=jje(r);if(n==="system"&&Nje(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[aU];if(Oi(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 IDt(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(Jp(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Xm(s,l))}i[aU]??(i[aU]={}),i[aU][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 gn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function WZr(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[aU]={[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=IDt(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 qn({text:e.map(u=>u.text).join(""),message:new dr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function Mje(t){return"type"in t&&t.type!=="function"}function KZr(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function ADt(t,e){return Wc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:EDt(t,e)}function Nje(t){return t?.startsWith("o1")||t?.startsWith("o3")}var O5=class extends Js{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??ot("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ot("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=>Mje(o)?o:ADt(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&xae(e.json_schema.schema)?sq(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=>Mje(l)?l:Wc(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:KZr(e?.tool_choice)?e?.tool_choice:(()=>{let l=Ije(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=>ADt(s,{strict:n})):void 0,tool_choice:Ije(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),Nje(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(Jp(u,{returnId:!0}))}catch(l){i.push(Xm(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 gn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Cs(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 Mf({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 dr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Rd({content:i,response_metadata:s}):o==="developer"?new Rd({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new ym({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Th({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new If({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:TDt(e,this.model),stream:!0},r);for await(let c of l){let d=WZr(c);d!=null&&(yield d)}return}let o=Rje(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new qn({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new qn({message:new dr({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=TDt(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:IDt(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(Mje),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=Rje(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let b={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};b.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},Oi(b.message)&&(b.message.usage_metadata=o),b.message=new gn(Object.fromEntries(Object.entries(b.message).filter(([g])=>!g.startsWith("lc_")))),p.push(b)}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=ODt(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(jje(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 qN(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 qN(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 qN(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=BN(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Wt(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;GZr(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"}}),xae(n)?u=Tc.fromZodSchema(n):u=new Ac;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}}}),xae(n)){let f=Tc.fromZodSchema(n);u=Nf.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Ac;else{let f=o??"extract";if(xae(n)){let p=So(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 Zc({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 Zc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=go.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=go.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return bi.from([{raw:s},d])}};function xae(t){return typeof t?.parse=="function"}function GZr(t){return t!==void 0&&typeof t.schema=="object"}Dn();Wm();Qd();Dn();Nj();dg();Dn();Dn();Dn();BO();dg();Dn();pg();ZA();var Dje=class extends ZO{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??ot("OPENAI_API_KEY"),n=e?.organization??ot("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Wt(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(Dje,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var Cae=class extends O5{static lc_name(){return"ChatDeepSeek"}_llmType(){return"deepseek"}get lc_secrets(){return{apiKey:"DEEPSEEK_API_KEY"}}constructor(e){let r=e?.apiKey||ot("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)}};SAe();Ec();fx();gs();Qd();Dn();mB();var UN="0.5.0";var MDt=!1,zN,Lje,JZr,YZr,ZZr,Fje,XZr,Oae,kje,$je,Bje,Pae,qje;function RDt(t,e={auto:!1}){if(MDt)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(zN)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${zN}'\``);MDt=e.auto,zN=t.kind,Lje=t.fetch,JZr=t.Request,YZr=t.Response,ZZr=t.Headers,Fje=t.FormData,XZr=t.Blob,Oae=t.File,kje=t.ReadableStream,$je=t.getMultipartRequestOptions,Bje=t.getDefaultAgent,Pae=t.fileFromPath,qje=t.isFsReadStream}var Eae=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function jDt({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 Eae(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}}zN||RDt(jDt(),{auto:!0});var Uje={};Cf(Uje,{APIConnectionError:()=>fP,APIConnectionTimeoutError:()=>HN,APIError:()=>Fl,APIUserAbortError:()=>PI,AuthenticationError:()=>uU,BadRequestError:()=>sU,ConflictError:()=>dU,GroqError:()=>fc,InternalServerError:()=>mU,NotFoundError:()=>cU,PermissionDeniedError:()=>lU,RateLimitError:()=>pU,UnprocessableEntityError:()=>fU});var fc=class extends Error{},Fl=class t extends fc{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 fP({cause:Tae(r)});let i=r;return e===400?new sU(e,i,n,o):e===401?new uU(e,i,n,o):e===403?new lU(e,i,n,o):e===404?new cU(e,i,n,o):e===409?new dU(e,i,n,o):e===422?new fU(e,i,n,o):e===429?new pU(e,i,n,o):e>=500?new mU(e,i,n,o):new t(e,i,n,o)}},PI=class extends Fl{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}},fP=class extends Fl{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},HN=class extends fP{constructor({message:e}={}){super({message:e??"Request timed out."})}},sU=class extends Fl{constructor(){super(...arguments),this.status=400}},uU=class extends Fl{constructor(){super(...arguments),this.status=401}},lU=class extends Fl{constructor(){super(...arguments),this.status=403}},cU=class extends Fl{constructor(){super(...arguments),this.status=404}},dU=class extends Fl{constructor(){super(...arguments),this.status=409}},fU=class extends Fl{constructor(){super(...arguments),this.status=422}},pU=class extends Fl{constructor(){super(...arguments),this.status=429}},mU=class extends Fl{};var Aae=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new zje;async function*i(){if(!e.body)throw r.abort(),new fc("Attempted to iterate over a response with no body");let s=new hU,u=NDt(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 Fl(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 hU,s=NDt(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 kje({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?.()}})}},zje=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]=eXr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},hU=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 fc(`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 fc(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new fc("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}};hU.NEWLINE_CHARS=new Set([` +`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);hU.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;function eXr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function NDt(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 DDt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",LDt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Iae(t),Iae=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",tXr=t=>LDt(t)||DDt(t)||qje(t);async function Wje(t,e,r){if(t=await t,r??(r=LDt(t)?{lastModified:t.lastModified,type:t.type}:{}),DDt(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new Oae([o],e,r)}let n=await rXr(t);if(e||(e=oXr(t)??"unknown_file"),!r.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Oae(n,e,r)}async function rXr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Iae(t))e.push(await t.arrayBuffer());else if(iXr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${nXr(t)}`);return e}function nXr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function oXr(t){return Hje(t.name)||Hje(t.filename)||Hje(t.path)?.split(/[\\/]/).pop()}var Hje=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},iXr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Kje=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var P5=async t=>{let e=await FDt(t.body);return $je(e,t)},FDt=async t=>{let e=new Fje;return await Promise.all(Object.entries(t||{}).map(([r,n])=>Vje(e,r,n))),e};var Vje=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(tXr(r)){let n=await Wje(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>Vje(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>Vje(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var sXr=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},uXr=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)},Mae;async function zDt(t){let{response:e}=t;if(t.options.stream)return gU("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):Aae.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 gU("response",e.status,e.url,e.headers,i),i}let o=await e.text();return gU("response",e.status,e.url,e.headers,o),o}var Rae=class t extends Promise{constructor(e,r=zDt){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)}},jae=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=Gje("maxRetries",r),this.timeout=Gje("timeout",n),this.httpAgent=o,this.fetch=i??Lje}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...fXr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${_Xr()}`}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&&Iae(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:Kje(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&&Gje("timeout",e.timeout);let l=e.timeout??this.timeout,c=e.httpAgent??this.httpAgent??Bje(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 UDt(o,i),UDt(o,r),Kje(e.body)&&zN!=="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 Fl.generate(e,r,n,o)}request(e,r=null){return new Rae(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}),gU("request",i,n,o.headers),n.signal?.aborted)throw new PI;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(Tae);if(u instanceof Error){if(n.signal?.aborted)throw new PI;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new HN:new fP({cause:u})}let l=lXr(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let h=`retrying, ${r} attempts remaining`;return gU(`response (error; ${h})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(h=>Tae(h).message),d=pXr(c),f=d?void 0:c;throw gU(`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 Jje(this,n,e)}buildURL(e,r){let n=hXr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return yXr(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 fc(`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 gXr(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 ${UN}`}},kDt=class{constructor(e,r,n,o){Mae.set(this,void 0),sXr(this,Mae,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 fc("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 uXr(this,Mae,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Mae=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Jje=class extends Rae{constructor(e,r,n){super(r,async o=>new n(e,o.response,await zDt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},lXr=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}});var cXr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":UN,"X-Stainless-OS":BDt(Deno.build.os),"X-Stainless-Arch":$Dt(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":UN,"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":UN,"X-Stainless-OS":BDt(process.platform),"X-Stainless-Arch":$Dt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=dXr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":UN,"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":UN,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function dXr(){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 $Dt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",BDt=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"),qDt,fXr=()=>qDt??(qDt=cXr()),pXr=t=>{try{return JSON.parse(t)}catch{return}},mXr=new RegExp("^(?:[a-z]+:)?//","i"),hXr=t=>mXr.test(t),gXr=t=>new Promise(e=>setTimeout(e,t)),Gje=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new fc(`${t} must be an integer`);if(e<0)throw new fc(`${t} must be a positive integer`);return e},Tae=t=>t instanceof Error?t:new Error(t);var Yje=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function yXr(t){if(!t)return!0;for(let e in t)return!1;return!0}function bXr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function UDt(t,e){for(let r in e){if(!bXr(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 gU(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var _Xr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),HDt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";var pc=class{constructor(e){this._client=e}};var VN=class extends pc{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",P5({body:e,...r}))}};VN||(VN={});var WN=class extends pc{create(e,r){return this._client.post("/openai/v1/audio/translations",P5({body:e,...r}))}};WN||(WN={});var EI=class extends pc{constructor(){super(...arguments),this.transcriptions=new VN(this._client),this.translations=new WN(this._client)}};(function(t){t.Transcriptions=VN,t.Translations=WN})(EI||(EI={}));var KN=class extends pc{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}};KN||(KN={});var TI=class extends pc{constructor(){super(...arguments),this.completions=new KN(this._client)}};(function(t){t.Completions=KN})(TI||(TI={}));var AI=class extends pc{};AI||(AI={});var II=class extends pc{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}};II||(II={});var MI=class extends pc{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)}};MI||(MI={});var VDt,bs=class extends jae{constructor({baseURL:e=Yje("GROQ_BASE_URL"),apiKey:r=Yje("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new fc("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&&HDt())throw new fc(`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 AI(this),this.chat=new TI(this),this.embeddings=new II(this),this.audio=new EI(this),this.models=new MI(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}`}}};BDt=bs;bs.Groq=BDt;bs.GroqError=fc;bs.APIError=Fl;bs.APIConnectionError=fP;bs.APIConnectionTimeoutError=zN;bs.APIUserAbortError=PI;bs.NotFoundError=lU;bs.ConflictError=cU;bs.RateLimitError=fU;bs.BadRequestError=aU;bs.AuthenticationError=sU;bs.InternalServerError=pU;bs.PermissionDeniedError=uU;bs.UnprocessableEntityError=dU;bs.toFile=Hje;bs.fileFromPath=xae;var{GroqError:bGo,APIError:_Go,APIConnectionError:vGo,APIConnectionTimeoutError:wGo,APIUserAbortError:SGo,NotFoundError:xGo,ConflictError:CGo,RateLimitError:OGo,BadRequestError:PGo,AuthenticationError:EGo,InternalServerError:TGo,PermissionDeniedError:AGo,UnprocessableEntityError:IGo}=Bje;(function(t){t.Completions=AI,t.Chat=TI,t.Embeddings=II,t.Audio=EI,t.Models=MI})(bs||(bs={}));var qDt=bs;Sm();gy();iq();Km();function vXr(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 UDt(t){return t.map(e=>{if(typeof e.content!="string")throw new Error("Non string message content not supported");let r={role:vXr(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 Oi(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(Ox):(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 wXr(t,e){let r=t.tool_calls;switch(t.role){case"assistant":{let n=[],o=[];for(let i of r??[])try{n.push(Jp(i,{returnId:!0}))}catch(a){o.push(Xm(i,a.message))}return new gn({content:t.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:e})}default:return new Cs(t.content||"",t.role??"unknown")}}function SXr(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 xXr(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 Mf({content:o})};if(n==="assistant"){let u=SXr(t.tool_calls,e);return{message:new dr({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 Rd({content:o})}:{message:new If({content:o,role:n})}}var Mae=class extends Js{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||ot("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 qDt({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=>dx(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=UDt(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}=xXr({...d.delta,role:s},d.index,c.x_groq);if(p){let h=p.filter(b=>u.every(g=>g.id!==b.id));u.push(...h),yield new qn({message:new dr({content:"",tool_call_chunks:h}),text:""})}let m=new qn({message:f,text:d.delta.content??"",generationInfo:{finishReason:d.finish_reason}});yield m,n?.handleLLMNewToken(m.text??"")}if(l&&("choices"in l&&delete l.choices,yield new qn({message:new dr({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=UDt(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:wXr(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"}}),Gs(n)?u=Tc.fromZodSchema(n):u=new Ac;else if(Gs(n)){let p=So(n);l=this.bind({tools:[{type:"function",function:{name:s,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:s}}}),u=new Zc({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 Zc({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=go.assign({parsed:(p,m)=>u.invoke(p.raw,m)}),d=go.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return bi.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}};var td=[];for(Rae=0;Rae<256;++Rae)td.push((Rae+256).toString(16).slice(1));var Rae;function zDt(t,e=0){return(td[t[e+0]]+td[t[e+1]]+td[t[e+2]]+td[t[e+3]]+"-"+td[t[e+4]]+td[t[e+5]]+"-"+td[t[e+6]]+td[t[e+7]]+"-"+td[t[e+8]]+td[t[e+9]]+"-"+td[t[e+10]]+td[t[e+11]]+td[t[e+12]]+td[t[e+13]]+td[t[e+14]]+td[t[e+15]]).toLowerCase()}var jae,CXr=new Uint8Array(16);function Jje(){if(!jae&&(jae=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!jae))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return jae(CXr)}var OXr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Yje={randomUUID:OXr};function PXr(t,e,r){if(Yje.randomUUID&&!e&&!t)return Yje.randomUUID();t=t||{};var n=t.random||(t.rng||Jje)();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 zDt(n)}var Nae=PXr;var Q4t=F(J4t(),1),e3t=F(L5(),1);gs();fx();Qd();XL();Dn();gy();iq();Sm();Ec();var Ewn=/^[a-zA-Z0-9]{9}$/;function Twn(t){return Ewn.test(t)}function Awn(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 Iwn(t){let e=0;for(let r=0;r=9?r.slice(0,9):r.padStart(9,"0")}}function LLe(t){return t?typeof t=="string"?t:t.map(e=>{if(e.type==="image_url"){if(typeof e.imageUrl!="string"&&e.imageUrl?.detail){let{detail:r}=e.imageUrl;if(r!=="high"&&r!=="auto"&&r!=="low")return{type:e.type,image_url:{url:e.imageUrl.url}}}return{type:e.type,image_url:e.imageUrl}}return e}):""}function Y4t(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. +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 AI(this),this.chat=new TI(this),this.embeddings=new II(this),this.audio=new EI(this),this.models=new MI(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}`}}};VDt=bs;bs.Groq=VDt;bs.GroqError=fc;bs.APIError=Fl;bs.APIConnectionError=fP;bs.APIConnectionTimeoutError=HN;bs.APIUserAbortError=PI;bs.NotFoundError=cU;bs.ConflictError=dU;bs.RateLimitError=pU;bs.BadRequestError=sU;bs.AuthenticationError=uU;bs.InternalServerError=mU;bs.PermissionDeniedError=lU;bs.UnprocessableEntityError=fU;bs.toFile=Wje;bs.fileFromPath=Pae;var{GroqError:PGo,APIError:EGo,APIConnectionError:TGo,APIConnectionTimeoutError:AGo,APIUserAbortError:IGo,NotFoundError:MGo,ConflictError:RGo,RateLimitError:jGo,BadRequestError:NGo,AuthenticationError:DGo,InternalServerError:LGo,PermissionDeniedError:FGo,UnprocessableEntityError:kGo}=Uje;(function(t){t.Completions=AI,t.Chat=TI,t.Embeddings=II,t.Audio=EI,t.Models=MI})(bs||(bs={}));var WDt=bs;Sm();gy();aq();Km();function OXr(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 KDt(t){return t.map(e=>{if(typeof e.content!="string")throw new Error("Non string message content not supported");let r={role:OXr(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 Oi(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(Ox):(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 PXr(t,e){let r=t.tool_calls;switch(t.role){case"assistant":{let n=[],o=[];for(let i of r??[])try{n.push(Jp(i,{returnId:!0}))}catch(a){o.push(Xm(i,a.message))}return new gn({content:t.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:e})}default:return new Cs(t.content||"",t.role??"unknown")}}function EXr(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 TXr(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 Mf({content:o})};if(n==="assistant"){let u=EXr(t.tool_calls,e);return{message:new dr({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 Rd({content:o})}:{message:new If({content:o,role:n})}}var Nae=class extends Js{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||ot("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 WDt({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=>dx(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=KDt(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}=TXr({...d.delta,role:s},d.index,c.x_groq);if(p){let h=p.filter(b=>u.every(g=>g.id!==b.id));u.push(...h),yield new qn({message:new dr({content:"",tool_call_chunks:h}),text:""})}let m=new qn({message:f,text:d.delta.content??"",generationInfo:{finishReason:d.finish_reason}});yield m,n?.handleLLMNewToken(m.text??"")}if(l&&("choices"in l&&delete l.choices,yield new qn({message:new dr({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=KDt(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:PXr(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"}}),Gs(n)?u=Tc.fromZodSchema(n):u=new Ac;else if(Gs(n)){let p=So(n);l=this.bind({tools:[{type:"function",function:{name:s,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:s}}}),u=new Zc({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 Zc({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=go.assign({parsed:(p,m)=>u.invoke(p.raw,m)}),d=go.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return bi.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}};var td=[];for(Dae=0;Dae<256;++Dae)td.push((Dae+256).toString(16).slice(1));var Dae;function GDt(t,e=0){return(td[t[e+0]]+td[t[e+1]]+td[t[e+2]]+td[t[e+3]]+"-"+td[t[e+4]]+td[t[e+5]]+"-"+td[t[e+6]]+td[t[e+7]]+"-"+td[t[e+8]]+td[t[e+9]]+"-"+td[t[e+10]]+td[t[e+11]]+td[t[e+12]]+td[t[e+13]]+td[t[e+14]]+td[t[e+15]]).toLowerCase()}var Lae,AXr=new Uint8Array(16);function Zje(){if(!Lae&&(Lae=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Lae))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Lae(AXr)}var IXr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Xje={randomUUID:IXr};function MXr(t,e,r){if(Xje.randomUUID&&!e&&!t)return Xje.randomUUID();t=t||{};var n=t.random||(t.rng||Zje)();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 GDt(n)}var Fae=MXr;var o3t=F(e3t(),1),i3t=F(F5(),1);gs();fx();Qd();QL();Dn();gy();aq();Sm();Ec();var Rwn=/^[a-zA-Z0-9]{9}$/;function jwn(t){return Rwn.test(t)}function Nwn(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 Dwn(t){let e=0;for(let r=0;r=9?r.slice(0,9):r.padStart(9,"0")}}function kLe(t){return t?typeof t=="string"?t:t.map(e=>{if(e.type==="image_url"){if(typeof e.imageUrl!="string"&&e.imageUrl?.detail){let{detail:r}=e.imageUrl;if(r!=="high"&&r!=="auto"&&r!=="low")return{type:e.type,image_url:{url:e.imageUrl.url}}}return{type:e.type,image_url:e.imageUrl}}return e}):""}function t3t(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(Oi(o)&&o.tool_calls?.length)return o.tool_calls.map(i=>({...i,id:DLe(i.id??"")})).map(Ox)};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:DLe(o.tool_call_id)}:Oi(o)?i===void 0?{role:e(o.getType()),content:a}:{role:e(o.getType()),toolCalls:i}:{role:e(o.getType()),content:a}})}function Mwn(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=LLe(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=Jp(s,{returnId:!0});i.push({...u,id:u.id??Nae().replace(/-/g,"")})}catch(u){a.push(Xm(s,u.message))}return new gn({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 Os({content:o})}}function Rwn(t,e){if(!t.content&&!t.toolCalls)return e?new dr({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??Nae().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=LLe(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 Mf({content:o}):n==="assistant"?new dr({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 Th({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new ym({content:o,additional_kwargs:i}):new If({content:o,role:n})}function Z4t(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:So(e.schema)}}})}var Ble=class extends Js{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??ot("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?Z4t(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:Z4t(e),...r})}async completionWithRetry(e,r){let n=new _m({maxRetries:this.maxRetries}),o=new Q4t.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=Y4t(e),s={...i,messages:a},u=r.signal??!!r.timeout;if(this.streaming||u){let m=this._streamResponseChunks(e,r,n),h={};for await(let g of m){let y=g.generationInfo?.completion??0;h[y]===void 0?h[y]=g:h[y]=h[y].concat(g)}return{generations:Object.entries(h).sort(([g],[y])=>parseInt(g,10)-parseInt(y,10)).map(([g,y])=>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 m of l?.choices??[]){if("delta"in m)throw new Error("Delta not supported in non-streaming mode.");if(!("message"in m))throw new Error("No message found in the choice.");let h=m.message?.content??"";Array.isArray(h)&&(h=h[0].type==="text"?h[0].text:"");let b={text:h,message:Mwn(m,l?.usage)};m.finishReason&&(b.generationInfo={finishReason:m.finishReason}),p.push(b)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=Y4t(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=Rwn(c,f?u.usage:null);if(p===null)continue;let m=c.content??"";Array.isArray(m)&&(m=m[0].type==="text"?m[0].text:"");let h=new qn({message:p,text:m,generationInfo:d});yield h,n?.handleLLMNewToken(h.text??"",d,void 0,void 0,void 0,{chunk:h})}}addAllHooksToHttpClient(){try{if(this.removeAllHooksFromHttpClient(),[this.beforeRequestHooks,this.requestErrorHooks,this.responseHooks].some(r=>r&&r.length>0)&&!this.httpClient&&(this.httpClient=new e3t.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"}}),X4t(n)?u=Tc.fromZodSchema(n):u=new Ac;else{let f=o??"extract";if(X4t(n)){let p=So(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:"any"}),u=new Zc({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 Zc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=go.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=go.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return bi.from([{raw:s},d])}};function X4t(t){return typeof t?.parse=="function"}Dn();$O();dg();jj();Qd();Dn();dg();jAe();XMe();Dn();pg();gs();Qd();Dn();fx();Wm();Sm();gy();iq();Ec();sq();function CD(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}pg();Ec();Km();function pW(t,e){return t.lc_error_code=e,t.message=`${t.message} +Received: ${JSON.stringify(o,null,2)}`)},n=o=>{if(Oi(o)&&o.tool_calls?.length)return o.tool_calls.map(i=>({...i,id:FLe(i.id??"")})).map(Ox)};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:FLe(o.tool_call_id)}:Oi(o)?i===void 0?{role:e(o.getType()),content:a}:{role:e(o.getType()),toolCalls:i}:{role:e(o.getType()),content:a}})}function Lwn(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=kLe(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=Jp(s,{returnId:!0});i.push({...u,id:u.id??Fae().replace(/-/g,"")})}catch(u){a.push(Xm(s,u.message))}return new gn({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 Os({content:o})}}function Fwn(t,e){if(!t.content&&!t.toolCalls)return e?new dr({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??Fae().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=kLe(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 Mf({content:o}):n==="assistant"?new dr({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 Th({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new ym({content:o,additional_kwargs:i}):new If({content:o,role:n})}function r3t(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:So(e.schema)}}})}var zle=class extends Js{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??ot("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?r3t(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:r3t(e),...r})}async completionWithRetry(e,r){let n=new _m({maxRetries:this.maxRetries}),o=new o3t.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=t3t(e),s={...i,messages:a},u=r.signal??!!r.timeout;if(this.streaming||u){let m=this._streamResponseChunks(e,r,n),h={};for await(let g of m){let y=g.generationInfo?.completion??0;h[y]===void 0?h[y]=g:h[y]=h[y].concat(g)}return{generations:Object.entries(h).sort(([g],[y])=>parseInt(g,10)-parseInt(y,10)).map(([g,y])=>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 m of l?.choices??[]){if("delta"in m)throw new Error("Delta not supported in non-streaming mode.");if(!("message"in m))throw new Error("No message found in the choice.");let h=m.message?.content??"";Array.isArray(h)&&(h=h[0].type==="text"?h[0].text:"");let b={text:h,message:Lwn(m,l?.usage)};m.finishReason&&(b.generationInfo={finishReason:m.finishReason}),p.push(b)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=t3t(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=Fwn(c,f?u.usage:null);if(p===null)continue;let m=c.content??"";Array.isArray(m)&&(m=m[0].type==="text"?m[0].text:"");let h=new qn({message:p,text:m,generationInfo:d});yield h,n?.handleLLMNewToken(h.text??"",d,void 0,void 0,void 0,{chunk:h})}}addAllHooksToHttpClient(){try{if(this.removeAllHooksFromHttpClient(),[this.beforeRequestHooks,this.requestErrorHooks,this.responseHooks].some(r=>r&&r.length>0)&&!this.httpClient&&(this.httpClient=new i3t.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"}}),n3t(n)?u=Tc.fromZodSchema(n):u=new Ac;else{let f=o??"extract";if(n3t(n)){let p=So(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:"any"}),u=new Zc({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 Zc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=go.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=go.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return bi.from([{raw:s},d])}};function n3t(t){return typeof t?.parse=="function"}Dn();BO();dg();Nj();Qd();Dn();dg();LAe();Wne();Dn();pg();gs();Qd();Dn();fx();Wm();Sm();gy();aq();Ec();uq();function OD(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}pg();Ec();Km();function mW(t,e){return t.lc_error_code=e,t.message=`${t.message} Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/ -`,t}function OD(t){let e;return t.constructor.name===Xf.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Li.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=pW(t,"INVALID_TOOL_RESULTS"):t.status===401?e=pW(t,"MODEL_AUTHENTICATION"):t.status===429?e=pW(t,"MODEL_RATE_LIMIT"):t.status===404?e=pW(t,"MODEL_NOT_FOUND"):e=t,e}function FLe(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 jwn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function t3t(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(r3t(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(` -`)}function r3t(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}: ${qle(o,e)},`):r.push(`${n}?: ${qle(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(` -`)}function qle(t,e){if(jwn(t))return t.anyOf.map(r=>qle(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["{",r3t(t,e+2),"}"].join(` -`);case"array":return t.items?`${qle(t.items,e)}[]`:"any[]";default:return""}}Km();sq();function n3t(t,e){let r;if(rc(t)){let n=$ne({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:TA(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function Nwn(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 BLe(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(!Cs.isInstance(t))throw new Error("Invalid generic chat message");return Nwn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function $Le(t,e){return t.flatMap(r=>{let n=BLe(r);n==="system"&&qLe(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=""),Oi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(Ox),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}var zU="__openai_function_call_ids__";function o3t(t,e){return t.flatMap(r=>{let n=BLe(r);if(n==="system"&&qLe(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[zU];if(Oi(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 a3t(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(Jp(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Xm(s,l))}i[zU]??(i[zU]={}),i[zU][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 gn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function Dwn(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[zU]={[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=a3t(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 qn({text:e.map(u=>u.text).join(""),message:new dr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function kLe(t){return"type"in t&&t.type!=="function"}function Lwn(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function i3t(t,e){return Wc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:n3t(t,e)}function qLe(t){return t?.startsWith("o1")||t?.startsWith("o3")}var mW=class extends Js{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??ot("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ot("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=>kLe(o)?o:i3t(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&Ule(e.json_schema.schema)?aq(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=>kLe(l)?l:Wc(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:Lwn(e?.tool_choice)?e?.tool_choice:(()=>{let l=FLe(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=>i3t(s,{strict:n})):void 0,tool_choice:FLe(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),qLe(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(Jp(u,{returnId:!0}))}catch(l){i.push(Xm(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 gn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Cs(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 Mf({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 dr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Rd({content:i,response_metadata:s}):o==="developer"?new Rd({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new ym({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Th({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new If({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:o3t(e,this.model),stream:!0},r);for await(let c of l){let d=Dwn(c);d!=null&&(yield d)}return}let o=$Le(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new qn({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new qn({message:new dr({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=o3t(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:a3t(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(kLe),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=$Le(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let b={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};b.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},Oi(b.message)&&(b.message.usage_metadata=o),b.message=new gn(Object.fromEntries(Object.entries(b.message).filter(([g])=>!g.startsWith("lc_")))),p.push(b)}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=t3t(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(BLe(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 OD(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 OD(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 OD(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=CD(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Wt(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;Fwn(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"}}),Ule(n)?u=Tc.fromZodSchema(n):u=new Ac;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}}}),Ule(n)){let f=Tc.fromZodSchema(n);u=Nf.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Ac;else{let f=o??"extract";if(Ule(n)){let p=So(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 Zc({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 Zc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=go.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=go.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return bi.from([{raw:s},d])}};function Ule(t){return typeof t?.parse=="function"}function Fwn(t){return t!==void 0&&typeof t.schema=="object"}Dn();Wm();Qd();Dn();jj();dg();Dn();Dn();Dn();$O();dg();Dn();pg();ZA();var ULe=class extends ZO{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??ot("OPENAI_API_KEY"),n=e?.organization??ot("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Wt(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(ULe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var zle=class extends mW{static lc_name(){return"ChatXAI"}_llmType(){return"xai"}get lc_secrets(){return{apiKey:"XAI_API_KEY"}}constructor(e){let r=e?.apiKey||ot("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 Hle=require("obsidian"),kwn={openai:Px,"azure openai":Px,anthropic:bae,cohereai:kre,google:Vre,xai:zle,openrouterai:Px,ollama:Yre,"lm-studio":Px,groq:Mae,"3rd party (openai-format)":Px,"copilot-plus":Px,mistralai:Ble,deepseek:wae},PD=class t{constructor(){this.providerApiKeyMap={openai:()=>ue().openAIApiKey,google:()=>ue().googleApiKey,"azure openai":()=>ue().azureOpenAIApiKey,anthropic:()=>ue().anthropicApiKey,cohereai:()=>ue().cohereApiKey,openrouterai:()=>ue().openRouterAiApiKey,groq:()=>ue().groqApiKey,xai:()=>ue().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>ue().plusLicenseKey,mistralai:()=>ue().mistralApiKey,deepseek:()=>ue().deepseekApiKey};this.buildModelMap(),xa(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}async getModelConfig(e){let r=ue(),n=e.name,o=LR(n),i=n.startsWith("claude-3-7-sonnet")||n.startsWith("claude-sonnet-4"),a={modelName:n,streaming:e.stream??!0,maxRetries:3,maxConcurrency:3,enableCors:e.enableCors};i||(a.temperature=e.temperature??r.temperature);let u={openai:{modelName:n,openAIApiKey:await eo(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Us:void 0,organization:await eo(e.openAIOrgId||r.openAIOrgId)},...this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature)},anthropic:{anthropicApiKey:await eo(e.apiKey||r.anthropicApiKey),model:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?Us:void 0},...i&&{thinking:{type:"enabled",budget_tokens:1024}}},"azure openai":{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,openAIApiKey:await eo(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 eo(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?Us:void 0},...this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature)},cohereai:{apiKey:await eo(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await eo(e.apiKey||r.googleApiKey),modelName:n,safetySettings:[{category:Nj.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:Dj.BLOCK_NONE},{category:Nj.HARM_CATEGORY_HATE_SPEECH,threshold:Dj.BLOCK_NONE},{category:Nj.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:Dj.BLOCK_NONE},{category:Nj.HARM_CATEGORY_HARASSMENT,threshold:Dj.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await eo(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,openAIApiKey:await eo(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?Us:void 0,defaultHeaders:{"HTTP-Referer":"https://obsidiancopilot.com","X-Title":"Obsidian Copilot"}}},groq:{apiKey:await eo(e.apiKey||r.groqApiKey),modelName:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:new Headers({Authorization:`Bearer ${await eo(e.apiKey||"default-key")}`})},"lm-studio":{modelName:n,openAIApiKey:e.apiKey||"default-key",configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?Us:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await eo(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Us:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature)},"copilot-plus":{modelName:n,openAIApiKey:await eo(r.plusLicenseKey),configuration:{baseURL:VE,fetch:e.enableCors?Us:void 0}},mistralai:{model:n,apiKey:await eo(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await eo(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||hF.deepseek.host,fetch:e.enableCors?Us:void 0}}}[e.provider]||{},l=this.getProviderSpecificParams(e.provider,e),c=i?{maxTokens:e.maxTokens??r.maxTokens}:this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature),d={...a,...u,...l,...c};return i&&delete d.temperature,d}handleOpenAIExtraArgs(e,r,n){return e?{maxCompletionTokens:r,temperature:n===void 0?void 0:1}:{maxTokens:r,temperature:n}}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=ue().activeModels;t.modelMap={};let r=t.modelMap;(e??Zb).forEach(o=>{if(o.enabled){if(!Object.values(DC).contains(o.provider)){console.warn(`Unknown provider: ${o.provider} for model: ${o.name}`);return}let i=this.getProviderConstructor(o),a=this.providerApiKeyMap[o.provider],s=o.apiKey||a(),u=kr(o);r[u]={hasApiKey:!!(o.apiKey||s),AIConstructor:i,vendor:o.provider}}})}getProviderConstructor(e){let r=kwn[e.provider];if(!r)throw console.warn(`Unknown provider: ${e.provider} for model: ${e.name}`),new Error(`Unknown provider: ${e.provider} for model: ${e.name}`);return r}getChatModel(){if(!t.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return t.chatModel}async setChatModel(e){let r=kr(e);try{let n=await this.createModelInstance(e);t.chatModel=n}catch(n){fe(n),new Hle.Notice(`Error creating model: ${r}`)}}async createModelInstance(e){let r=kr(e),n=t.modelMap[r];if(!n)throw new Error(`No model found for: ${r}`);if(!n.hasApiKey){let a=`API key is not provided for the model: ${r}.`;throw new Hle.Notice(a),new Error(a)}let o=await this.getModelConfig(e);return new n.AIConstructor({...o})}validateChatModel(e){return e!=null}estimateTokens(e){return e?Math.ceil(e.length/4):0}async countTokens(e){try{return await yy(async()=>t.chatModel?.getNumTokens(e)??0)}catch(r){if(r instanceof Error&&r.message.includes("Unknown model"))return ie("Using estimated token count due to tokenizer error"),this.estimateTokens(e);throw r}}validateCurrentModel(){if(!t.chatModel)return;let e=mJ();if(!e)return;t.modelMap[e]?.hasApiKey||(t.chatModel=null,console.log("Failed to reinitialize model due to missing API key"))}async ping(e){let r=async n=>{let o={...e,enableCors:n},i=await this.getModelConfig(o),{streaming:a,maxTokens:s,maxCompletionTokens:u,...l}=i,c=LR(o.name),d=this.handleOpenAIExtraArgs(c,30,i.temperature);await new(this.getProviderConstructor(o))({...l,...d}).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 Hle.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=` +`,t}function PD(t){let e;return t.constructor.name===Xf.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Li.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=mW(t,"INVALID_TOOL_RESULTS"):t.status===401?e=mW(t,"MODEL_AUTHENTICATION"):t.status===429?e=mW(t,"MODEL_RATE_LIMIT"):t.status===404?e=mW(t,"MODEL_NOT_FOUND"):e=t,e}function $Le(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 kwn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function a3t(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(s3t(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(` +`)}function s3t(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}: ${Hle(o,e)},`):r.push(`${n}?: ${Hle(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(` +`)}function Hle(t,e){if(kwn(t))return t.anyOf.map(r=>Hle(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["{",s3t(t,e+2),"}"].join(` +`);case"array":return t.items?`${Hle(t.items,e)}[]`:"any[]";default:return""}}Km();uq();function u3t(t,e){let r;if(rc(t)){let n=Bne({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:TA(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function $wn(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 ULe(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(!Cs.isInstance(t))throw new Error("Invalid generic chat message");return $wn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function qLe(t,e){return t.flatMap(r=>{let n=ULe(r);n==="system"&&zLe(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=""),Oi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(Ox),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}var HU="__openai_function_call_ids__";function l3t(t,e){return t.flatMap(r=>{let n=ULe(r);if(n==="system"&&zLe(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[HU];if(Oi(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 d3t(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(Jp(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Xm(s,l))}i[HU]??(i[HU]={}),i[HU][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 gn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function Bwn(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[HU]={[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=d3t(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 qn({text:e.map(u=>u.text).join(""),message:new dr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function BLe(t){return"type"in t&&t.type!=="function"}function qwn(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function c3t(t,e){return Wc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:u3t(t,e)}function zLe(t){return t?.startsWith("o1")||t?.startsWith("o3")}var hW=class extends Js{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??ot("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ot("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=>BLe(o)?o:c3t(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&Vle(e.json_schema.schema)?sq(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=>BLe(l)?l:Wc(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:qwn(e?.tool_choice)?e?.tool_choice:(()=>{let l=$Le(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=>c3t(s,{strict:n})):void 0,tool_choice:$Le(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),zLe(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(Jp(u,{returnId:!0}))}catch(l){i.push(Xm(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 gn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Cs(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 Mf({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 dr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Rd({content:i,response_metadata:s}):o==="developer"?new Rd({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new ym({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Th({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new If({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:l3t(e,this.model),stream:!0},r);for await(let c of l){let d=Bwn(c);d!=null&&(yield d)}return}let o=qLe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new qn({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new qn({message:new dr({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=l3t(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:d3t(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(BLe),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=qLe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let b={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};b.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},Oi(b.message)&&(b.message.usage_metadata=o),b.message=new gn(Object.fromEntries(Object.entries(b.message).filter(([g])=>!g.startsWith("lc_")))),p.push(b)}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=a3t(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(ULe(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 PD(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 PD(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 PD(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=OD(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Wt(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;Uwn(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"}}),Vle(n)?u=Tc.fromZodSchema(n):u=new Ac;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}}}),Vle(n)){let f=Tc.fromZodSchema(n);u=Nf.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Ac;else{let f=o??"extract";if(Vle(n)){let p=So(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 Zc({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 Zc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=go.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=go.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return bi.from([{raw:s},d])}};function Vle(t){return typeof t?.parse=="function"}function Uwn(t){return t!==void 0&&typeof t.schema=="object"}Dn();Wm();Qd();Dn();Nj();dg();Dn();Dn();Dn();BO();dg();Dn();pg();ZA();var HLe=class extends ZO{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??ot("OPENAI_API_KEY"),n=e?.organization??ot("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Wt(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(HLe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var Wle=class extends hW{static lc_name(){return"ChatXAI"}_llmType(){return"xai"}get lc_secrets(){return{apiKey:"XAI_API_KEY"}}constructor(e){let r=e?.apiKey||ot("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 Kle=require("obsidian"),zwn={openai:Px,"azure openai":Px,anthropic:wae,cohereai:$re,google:Wre,xai:Wle,openrouterai:Px,ollama:Zre,"lm-studio":Px,groq:Nae,"3rd party (openai-format)":Px,"copilot-plus":Px,mistralai:zle,deepseek:Cae},ED=class t{constructor(){this.providerApiKeyMap={openai:()=>ue().openAIApiKey,google:()=>ue().googleApiKey,"azure openai":()=>ue().azureOpenAIApiKey,anthropic:()=>ue().anthropicApiKey,cohereai:()=>ue().cohereApiKey,openrouterai:()=>ue().openRouterAiApiKey,groq:()=>ue().groqApiKey,xai:()=>ue().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>ue().plusLicenseKey,mistralai:()=>ue().mistralApiKey,deepseek:()=>ue().deepseekApiKey};this.buildModelMap(),xa(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}async getModelConfig(e){let r=ue(),n=e.name,o=FR(n),i=n.startsWith("claude-3-7-sonnet")||n.startsWith("claude-sonnet-4"),a={modelName:n,streaming:e.stream??!0,maxRetries:3,maxConcurrency:3,enableCors:e.enableCors};i||(a.temperature=e.temperature??r.temperature);let u={openai:{modelName:n,openAIApiKey:await eo(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Us:void 0,organization:await eo(e.openAIOrgId||r.openAIOrgId)},...this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature)},anthropic:{anthropicApiKey:await eo(e.apiKey||r.anthropicApiKey),model:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?Us:void 0},...i&&{thinking:{type:"enabled",budget_tokens:1024}}},"azure openai":{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,openAIApiKey:await eo(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 eo(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?Us:void 0},...this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature)},cohereai:{apiKey:await eo(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await eo(e.apiKey||r.googleApiKey),modelName:n,safetySettings:[{category:Dj.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:Lj.BLOCK_NONE},{category:Dj.HARM_CATEGORY_HATE_SPEECH,threshold:Lj.BLOCK_NONE},{category:Dj.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:Lj.BLOCK_NONE},{category:Dj.HARM_CATEGORY_HARASSMENT,threshold:Lj.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await eo(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,openAIApiKey:await eo(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?Us:void 0,defaultHeaders:{"HTTP-Referer":"https://obsidiancopilot.com","X-Title":"Obsidian Copilot"}}},groq:{apiKey:await eo(e.apiKey||r.groqApiKey),modelName:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:new Headers({Authorization:`Bearer ${await eo(e.apiKey||"default-key")}`})},"lm-studio":{modelName:n,openAIApiKey:e.apiKey||"default-key",configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?Us:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await eo(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Us:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature)},"copilot-plus":{modelName:n,openAIApiKey:await eo(r.plusLicenseKey),configuration:{baseURL:VE,fetch:e.enableCors?Us:void 0}},mistralai:{model:n,apiKey:await eo(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await eo(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||gF.deepseek.host,fetch:e.enableCors?Us:void 0}}}[e.provider]||{},l=this.getProviderSpecificParams(e.provider,e),c=i?{maxTokens:e.maxTokens??r.maxTokens}:this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature),d={...a,...u,...l,...c};return i&&delete d.temperature,d}handleOpenAIExtraArgs(e,r,n){return e?{maxCompletionTokens:r,temperature:n===void 0?void 0:1}:{maxTokens:r,temperature:n}}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=ue().activeModels;t.modelMap={};let r=t.modelMap;(e??Zb).forEach(o=>{if(o.enabled){if(!Object.values(LC).contains(o.provider)){console.warn(`Unknown provider: ${o.provider} for model: ${o.name}`);return}let i=this.getProviderConstructor(o),a=this.providerApiKeyMap[o.provider],s=o.apiKey||a(),u=kr(o);r[u]={hasApiKey:!!(o.apiKey||s),AIConstructor:i,vendor:o.provider}}})}getProviderConstructor(e){let r=zwn[e.provider];if(!r)throw console.warn(`Unknown provider: ${e.provider} for model: ${e.name}`),new Error(`Unknown provider: ${e.provider} for model: ${e.name}`);return r}getChatModel(){if(!t.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return t.chatModel}async setChatModel(e){let r=kr(e);try{let n=await this.createModelInstance(e);t.chatModel=n}catch(n){fe(n),new Kle.Notice(`Error creating model: ${r}`)}}async createModelInstance(e){let r=kr(e),n=t.modelMap[r];if(!n)throw new Error(`No model found for: ${r}`);if(!n.hasApiKey){let a=`API key is not provided for the model: ${r}.`;throw new Kle.Notice(a),new Error(a)}let o=await this.getModelConfig(e);return new n.AIConstructor({...o})}validateChatModel(e){return e!=null}estimateTokens(e){return e?Math.ceil(e.length/4):0}async countTokens(e){try{return await yy(async()=>t.chatModel?.getNumTokens(e)??0)}catch(r){if(r instanceof Error&&r.message.includes("Unknown model"))return ie("Using estimated token count due to tokenizer error"),this.estimateTokens(e);throw r}}validateCurrentModel(){if(!t.chatModel)return;let e=hJ();if(!e)return;t.modelMap[e]?.hasApiKey||(t.chatModel=null,console.log("Failed to reinitialize model due to missing API key"))}async ping(e){let r=async n=>{let o={...e,enableCors:n},i=await this.getModelConfig(o),{streaming:a,maxTokens:s,maxCompletionTokens:u,...l}=i,c=FR(o.name),d=this.handleOpenAIExtraArgs(c,30,i.temperature);await new(this.getProviderConstructor(o))({...l,...d}).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 Kle.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: `+ei(n)+` -with CORS Error: `+ei(o);throw new Error(i)}}}findModelByName(e){return ue().activeModels.find(n=>n.name===e)}};nr();gs();var HU=class{},s3t=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},Vle=(t,e)=>{let r=s3t(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},zLe=(t,e)=>{let r=s3t(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};yR();OR();var HLe=class extends gp{addUserMessage(e){return this.addMessage(new Os(e))}addAIChatMessage(e){return this.addMessage(new gn(e))}addAIMessage(e){return this.addMessage(new gn(e))}async addMessages(e){for(let r of e)await this.addMessage(r)}clear(){throw new Error("Not implemented.")}},VU=class extends HLe{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 gb=class extends HU{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 VU,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(Vle(e,this.inputKey)),await this.chatHistory.addAIChatMessage(zLe(r,this.outputKey))}async clear(){await this.chatHistory.clear()}};var hW=class extends gb{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]:Rf(r,this.humanPrefix,this.aiPrefix)}}};gs();gs();VLe();qE();gs();var gW=class extends gb{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]:Rf(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}};rie();Mhe();gs();yR();VLe();gs();gs();var yW=class t{constructor(){this.initMemory(),xa(()=>{let e=this.memory?.chatHistory;this.initMemory(e)})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(e){let r=ue().contextTurns;this.memory=new gW({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)}};nr();qE();Cl();var bW=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),xa(()=>{this.initChatPrompt(),this.initQAPrompt()}),SF(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=Yb(),r=Mc();r&&zR()&&(e=r.systemPrompt);let n=this.escapeTemplateString(e);this.chatPrompt=xp.fromMessages([BE.fromTemplate(n),new Gb("history"),Jb.fromTemplate("{input}")])}initQAPrompt(){let e=`{system_message} +with CORS Error: `+ei(o);throw new Error(i)}}}findModelByName(e){return ue().activeModels.find(n=>n.name===e)}};nr();gs();var VU=class{},f3t=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},Gle=(t,e)=>{let r=f3t(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},VLe=(t,e)=>{let r=f3t(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};yR();OR();var WLe=class extends gp{addUserMessage(e){return this.addMessage(new Os(e))}addAIChatMessage(e){return this.addMessage(new gn(e))}addAIMessage(e){return this.addMessage(new gn(e))}async addMessages(e){for(let r of e)await this.addMessage(r)}clear(){throw new Error("Not implemented.")}},WU=class extends WLe{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 gb=class extends VU{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 WU,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(Gle(e,this.inputKey)),await this.chatHistory.addAIChatMessage(VLe(r,this.outputKey))}async clear(){await this.chatHistory.clear()}};var gW=class extends gb{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]:Rf(r,this.humanPrefix,this.aiPrefix)}}};gs();gs();KLe();qE();gs();var yW=class extends gb{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]:Rf(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}};iie();Nhe();gs();yR();KLe();gs();gs();var bW=class t{constructor(){this.initMemory(),xa(()=>{let e=this.memory?.chatHistory;this.initMemory(e)})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(e){let r=ue().contextTurns;this.memory=new yW({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)}};nr();qE();Cl();var _W=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),xa(()=>{this.initChatPrompt(),this.initQAPrompt()}),xF(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=Yb(),r=Mc();r&&HR()&&(e=r.systemPrompt);let n=this.escapeTemplateString(e);this.chatPrompt=xp.fromMessages([BE.fromTemplate(n),new Gb("history"),Jb.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=xp.fromMessages([BE.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 _W=class{constructor(e,r){this.retrievedDocuments=[];this.chatMessages=[];this.chatMessages=[],this.app=e,this.vectorStoreManager=r,this.memoryManager=yW.getInstance(),this.chatModelManager=PD.getInstance(),this.promptManager=bW.getInstance(),this.initialize(),xa(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 Wle.Notice(e),new Error(e)}}validateChainInitialization(){(!this.chain||!fVe(this.chain))&&(console.error("Chain is not initialized properly, re-initializing chain: ",Fh()),this.createChainWithNewModel({},!1))}storeRetrieverDocuments(e){this.retrievedDocuments=e}async createChainWithNewModel(e={},r=!0){let n=Fh(),o=Mc();if(n==="project"&&!o)return;let i=n==="project"?o?.projectModelKey:mJ();if(!i)throw new Wle.Notice("No model key found"),new Error("No model key found");try{if(r){let a=eJ(i,ue().activeModels);if(a||(console.error("Resetting default model. No model configuration found for: ",i),a=Zb[0],i=a.name+"|"+a.provider),n==="project"&&!a.projectEnabled){let u=ue().activeModels.find(l=>l.enabled&&l.projectEnabled);if(u)a=u,i=u.name+"|"+u.provider,new Wle.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),ie(`Setting model to ${i}`)}catch(a){fe(`createChainWithNewModel failed: ${a}`),ie(`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=c4.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),qR("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=new Rx({minSimilarityScore:.01,maxK:ue().maxSourceChunks,salientTerms:[]});this.retrievalChain=c4.createConversationalRetrievalChain({llm:n,retriever:a,systemMessage:Yb()},this.storeRetrieverDocuments.bind(this),ue().debug),qR("vault_qa"),ue().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=c4.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),qR("copilot_plus");break}case"project":{await this.initializeQAChain(r),this.chain=c4.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),qR("project");break}default:this.validateChainType(e);break}}getChainRunner(){let e=Fh();switch(e){case"llm_chain":return new qie(this);case"vault_qa":return new Uie(this);case"copilot_plus":return new e5(this);case"project":return new zie(this);default:throw new Error(`Unsupported chain type: ${e}`)}}async initializeQAChain(e){e.refreshIndex&&await this.vectorStoreManager.indexVaultToVectorStore()}async runChain(e,r,n,o,i={}){let{debug:a=!1,ignoreSystemMessage:s=!1}=i;a&&console.log(`==== Step 0: Initial user message ==== -`,e),this.validateChatModel(),this.validateChainInitialization();let u=this.chatModelManager.getChatModel();if(s||LR(u)){let c=xp.fromMessages([new Gb("history"),Jb.fromTemplate("{input}")]);LR(u)&&(c=xp.fromMessages([[Pi,Yb()||""],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{await this.getCurrentChainManager().createChainWithNewModel()}),XVe(async()=>{zR()||await this.getCurrentChainManager().createChainWithNewModel({refreshIndex:ue().indexVaultToVectorStore==="ON MODE SWITCH"&&(Fh()==="vault_qa"||Fh()==="copilot_plus")})}),SF(async o=>{await this.switchProject(o)}),this.setupProjectListChangeMonitor()}setupProjectListChangeMonitor(){xa(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,n){return t.instance||(t.instance=new t(e,r,n)),t.instance}getCurrentChainManager(){return this.chainMangerInstance}async switchProject(e){try{if(GE(!0),ie("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 oI(Fi.getInstance(),this.app.vault,!0,e),await this.loadProjectContext(e),this.refreshChatView(),ie(`Switched to project: ${e.name}`)}catch(r){throw fe(`Failed to switch project: ${r}`),r}finally{GE(!1)}}async saveCurrentProjectMessage(){this.chatMessageCache.set(this.currentProjectId?this.currentProjectId:this.defaultProjectKey,this.getCurrentChainManager().getChatMessages()),await this.plugin.autosaveCurrentChat()}async loadNextProjectMessage(){let e=this.getCurrentChainManager(),r=this.chatMessageCache.get(this.currentProjectId?this.currentProjectId:this.defaultProjectKey)??[];e.setChatMessages(r),await _N(r,e.memoryManager)}async loadProjectContext(e){try{if(!e.contextSource)return Mh(`[loadProjectContext] Project ${e.name}: No contextSource. Aborting.`),null;ie(`[loadProjectContext] Starting for project: ${e.name}`);let r=await this.projectContextCache.get(e),n=r||{markdownContext:"",webContexts:{},youtubeContexts:{},fileContexts:{},timestamp:Date.now(),markdownNeedsReload:!0};r?ie(`[loadProjectContext] Project ${e.name}: Existing cache found. MarkdownNeedsReload: ${n.markdownNeedsReload}`):ie(`[loadProjectContext] Project ${e.name}: No existing cache found, building fresh context.`);let[o]=await Promise.all([this.processMarkdownFiles(e,n),this.processWebUrls(e,n),this.processYoutubeUrls(e,n)]);if(o.fileContexts){let i=Object.keys(o.fileContexts).length;if(ie(`[loadProjectContext] Project ${e.name}: Checking ${i} fileContexts for non-markdown processing.`),i>0){this.fileParserManager=new oI(Fi.getInstance(),this.app.vault,!0,e);let a=0;for(let s in o.fileContexts){let u=this.app.vault.getAbstractFileByPath(s);if(u instanceof vW.TFile&&u.extension!=="md"&&this.fileParserManager.supportsExtension(u.extension))try{await this.projectContextCache.getFileContext(e,s)||(ie(`[loadProjectContext] Project ${e.name}: Parsing/caching new/updated file: ${s}`),await this.fileParserManager.parseFile(u,this.app.vault),a++)}catch(l){if(fe(`[loadProjectContext] Project ${e.name}: Error parsing file ${s}:`,l),SN(l))throw l}}a>0&&ie(`[loadProjectContext] Project ${e.name}: Processed and cached ${a} non-markdown files.`)}}return o.timestamp=Date.now(),await this.projectContextCache.set(e,o),ie(`[loadProjectContext] Completed for project: ${e.name}.`),o}catch(r){throw fe(`[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),ie(`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(` +`;this.qaPrompt=xp.fromMessages([BE.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 vW=class{constructor(e,r){this.retrievedDocuments=[];this.chatMessages=[];this.chatMessages=[],this.app=e,this.vectorStoreManager=r,this.memoryManager=bW.getInstance(),this.chatModelManager=ED.getInstance(),this.promptManager=_W.getInstance(),this.initialize(),xa(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 Jle.Notice(e),new Error(e)}}validateChainInitialization(){(!this.chain||!mVe(this.chain))&&(console.error("Chain is not initialized properly, re-initializing chain: ",Fh()),this.createChainWithNewModel({},!1))}storeRetrieverDocuments(e){this.retrievedDocuments=e}async createChainWithNewModel(e={},r=!0){let n=Fh(),o=Mc();if(n==="project"&&!o)return;let i=n==="project"?o?.projectModelKey:hJ();if(!i)throw new Jle.Notice("No model key found"),new Error("No model key found");try{if(r){let a=tJ(i,ue().activeModels);if(a||(console.error("Resetting default model. No model configuration found for: ",i),a=Zb[0],i=a.name+"|"+a.provider),n==="project"&&!a.projectEnabled){let u=ue().activeModels.find(l=>l.enabled&&l.projectEnabled);if(u)a=u,i=u.name+"|"+u.provider,new Jle.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),ie(`Setting model to ${i}`)}catch(a){fe(`createChainWithNewModel failed: ${a}`),ie(`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=d4.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),UR("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=new jx({minSimilarityScore:.01,maxK:ue().maxSourceChunks,salientTerms:[]});this.retrievalChain=d4.createConversationalRetrievalChain({llm:n,retriever:a,systemMessage:Yb()},this.storeRetrieverDocuments.bind(this),ue().debug),UR("vault_qa"),ue().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=d4.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),UR("copilot_plus");break}case"project":{await this.initializeQAChain(r),this.chain=d4.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),UR("project");break}default:this.validateChainType(e);break}}getChainRunner(){let e=Fh();switch(e){case"llm_chain":return new Hie(this);case"vault_qa":return new Vie(this);case"copilot_plus":return new t5(this);case"project":return new Wie(this);default:throw new Error(`Unsupported chain type: ${e}`)}}async initializeQAChain(e){e.refreshIndex&&await this.vectorStoreManager.indexVaultToVectorStore()}async runChain(e,r,n,o,i={}){let{debug:a=!1,ignoreSystemMessage:s=!1}=i;a&&console.log(`==== Step 0: Initial user message ==== +`,e),this.validateChatModel(),this.validateChainInitialization();let u=this.chatModelManager.getChatModel();if(s||FR(u)){let c=xp.fromMessages([new Gb("history"),Jb.fromTemplate("{input}")]);FR(u)&&(c=xp.fromMessages([[Pi,Yb()||""],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{await this.getCurrentChainManager().createChainWithNewModel()}),r8e(async()=>{HR()||await this.getCurrentChainManager().createChainWithNewModel({refreshIndex:ue().indexVaultToVectorStore==="ON MODE SWITCH"&&(Fh()==="vault_qa"||Fh()==="copilot_plus")})}),xF(async o=>{await this.switchProject(o)}),this.setupProjectListChangeMonitor()}setupProjectListChangeMonitor(){xa(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,n){return t.instance||(t.instance=new t(e,r,n)),t.instance}getCurrentChainManager(){return this.chainMangerInstance}async switchProject(e){try{if(GE(!0),ie("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 oI(Fi.getInstance(),this.app.vault,!0,e),await this.loadProjectContext(e),this.refreshChatView(),ie(`Switched to project: ${e.name}`)}catch(r){throw fe(`Failed to switch project: ${r}`),r}finally{GE(!1)}}async saveCurrentProjectMessage(){this.chatMessageCache.set(this.currentProjectId?this.currentProjectId:this.defaultProjectKey,this.getCurrentChainManager().getChatMessages()),await this.plugin.autosaveCurrentChat()}async loadNextProjectMessage(){let e=this.getCurrentChainManager(),r=this.chatMessageCache.get(this.currentProjectId?this.currentProjectId:this.defaultProjectKey)??[];e.setChatMessages(r),await vN(r,e.memoryManager)}async loadProjectContext(e){try{if(!e.contextSource)return Mh(`[loadProjectContext] Project ${e.name}: No contextSource. Aborting.`),null;ie(`[loadProjectContext] Starting for project: ${e.name}`);let r=await this.projectContextCache.get(e),n=r||{markdownContext:"",webContexts:{},youtubeContexts:{},fileContexts:{},timestamp:Date.now(),markdownNeedsReload:!0};r?ie(`[loadProjectContext] Project ${e.name}: Existing cache found. MarkdownNeedsReload: ${n.markdownNeedsReload}`):ie(`[loadProjectContext] Project ${e.name}: No existing cache found, building fresh context.`);let[o]=await Promise.all([this.processMarkdownFiles(e,n),this.processWebUrls(e,n),this.processYoutubeUrls(e,n)]);if(o.fileContexts){let i=Object.keys(o.fileContexts).length;if(ie(`[loadProjectContext] Project ${e.name}: Checking ${i} fileContexts for non-markdown processing.`),i>0){this.fileParserManager=new oI(Fi.getInstance(),this.app.vault,!0,e);let a=0;for(let s in o.fileContexts){let u=this.app.vault.getAbstractFileByPath(s);if(u instanceof wW.TFile&&u.extension!=="md"&&this.fileParserManager.supportsExtension(u.extension))try{await this.projectContextCache.getFileContext(e,s)||(ie(`[loadProjectContext] Project ${e.name}: Parsing/caching new/updated file: ${s}`),await this.fileParserManager.parseFile(u,this.app.vault),a++)}catch(l){if(fe(`[loadProjectContext] Project ${e.name}: Error parsing file ${s}:`,l),xN(l))throw l}}a>0&&ie(`[loadProjectContext] Project ${e.name}: Processed and cached ${a} non-markdown files.`)}}return o.timestamp=Date.now(),await this.projectContextCache.set(e,o),ie(`[loadProjectContext] Completed for project: ${e.name}.`),o}catch(r){throw fe(`[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),ie(`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(m=>m.trim()),p=l.split(` `).filter(m=>m.trim());for(let m of f)p.includes(m)||await this.projectContextCache.removeWebUrl(r,m)}let c=e.contextSource?.youtubeUrls||"",d=r.contextSource?.youtubeUrls||"";if(c!==d){let f=c.split(` `).filter(m=>m.trim()),p=d.split(` @@ -760,33 +760,33 @@ ${l}`}));return ie("All markdown files processed for project context"),s.join(` `)}async processWebUrls(e,r){ie(`[processWebUrls] Starting for project: ${e.name}`);let n=e.contextSource?.webUrls?.trim()||"";if(!n)return Object.keys(r.webContexts).length>0&&(ie(`[processWebUrls] Project ${e.name}: Clearing all Web contexts as none are configured.`),r.webContexts={}),r;let o=n.split(` `).filter(c=>c.trim());ie(`[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&&ie(`[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){ie(`[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.processWebUrlsContext(c);return d&&ie(`[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&&Mh(`[processWebUrls] Project ${e.name}: Fetched empty content for Web URL: ${c.url}`)}),ie(`[processWebUrls] Completed for project: ${e.name}. Total Web contexts: ${Object.keys(r.webContexts).length}`),r}async processYoutubeUrls(e,r){ie(`[processYoutubeUrls] Starting for project: ${e.name}`);let n=e.contextSource?.youtubeUrls?.trim()||"";if(!n)return Object.keys(r.youtubeContexts).length>0&&(ie(`[processYoutubeUrls] Project ${e.name}: Clearing all YouTube contexts as none are configured.`),r.youtubeContexts={}),r;let o=n.split(` -`).filter(c=>c.trim());ie(`[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&&ie(`[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){ie(`[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.processYoutubeUrlsContext(c);return d&&ie(`[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&&Mh(`[processYoutubeUrls] Project ${e.name}: Fetched empty transcript for YouTube URL: ${c.url}`)}),ie(`[processYoutubeUrls] Completed for project: ${e.name}. Total YouTube contexts: ${Object.keys(r.youtubeContexts).length}`),r}async processWebUrlsContext(e){if(!e?.trim())return"";try{let r=Cq.getInstance(),{urlContext:n}=await r.processUrls(e);return n||""}catch(r){return fe(`Failed to process web URLs: ${r}`),new vW.Notice(`Failed to process web URLs: ${ei(r)}`),""}}async processYoutubeUrlsContext(e){if(!e?.trim())return"";let n=e.split(` +`).filter(c=>c.trim());ie(`[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&&ie(`[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){ie(`[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.processYoutubeUrlsContext(c);return d&&ie(`[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&&Mh(`[processYoutubeUrls] Project ${e.name}: Fetched empty transcript for YouTube URL: ${c.url}`)}),ie(`[processYoutubeUrls] Completed for project: ${e.name}. Total YouTube contexts: ${Object.keys(r.youtubeContexts).length}`),r}async processWebUrlsContext(e){if(!e?.trim())return"";try{let r=Oq.getInstance(),{urlContext:n}=await r.processUrls(e);return n||""}catch(r){return fe(`Failed to process web URLs: ${r}`),new wW.Notice(`Failed to process web URLs: ${ei(r)}`),""}}async processYoutubeUrlsContext(e){if(!e?.trim())return"";let n=e.split(` `).filter(i=>i.trim()).map(async i=>{try{let a=await Fi.getInstance().youtube4llm(i);return a.response.transcript?` YouTube transcript from ${i}: -${a.response.transcript}`:""}catch(a){return fe(`Failed to process YouTube URL ${i}: ${a}`),new vW.Notice(`Failed to process YouTube URL ${i}: ${ei(a)}`),""}});return(await Promise.all(n)).join("")}onunload(){this.projectContextCache.cleanup()}};Cl();$r();yo();nr();WLe();$r();mg();yo();nr();var Vg=require("@codemirror/view"),QP=require("@codemirror/state");function f3t(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 Uwn=Object.defineProperty,zwn=(t,e,r)=>e in t?Uwn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,WU=(t,e,r)=>(zwn(t,typeof e!="symbol"?e+"":e,r),r),Kle=QP.StateField.define({create(){return{suggestion:null}},update(t,e){let r=e.effects.find(n=>n.is(ZLe));return e.state.doc&&r&&(r.value.doc==null||e.state.doc==r.value.doc)?{suggestion:r.value.suggestion}:{suggestion:null}}}),ZLe=QP.StateEffect.define();function Hwn(t,e){let r=t.state.selection.main.head,n=[],o=Vg.Decoration.widget({widget:new KLe(e),side:1});return n.push(o.range(r)),Vg.Decoration.set(n)}var KLe=class extends Vg.WidgetType{constructor(e){super(),WU(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}},GLe=t=>{let e=0;return Vg.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:ZLe.of({suggestion:i,doc:n})})}}})},JLe=class{constructor(){WU(this,"decorations"),this.decorations=Vg.Decoration.none}update(e){var r;let n=(r=e.state.field(Kle))==null?void 0:r.suggestion;if(!n){this.decorations=Vg.Decoration.none;return}this.decorations=Hwn(e.view,n.display_suggestion)}},p3t=Vg.ViewPlugin.fromClass(JLe,{decorations:t=>t.decorations}),YLe=class{constructor(e,r){WU(this,"suggestFn"),WU(this,"keymap"),WU(this,"completionId"),WU(this,"run",n=>{var o,i;let a=(o=n.state.field(Kle))==null?void 0:o.suggestion;return a?(n.dispatch({...Vwn(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:ZLe.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=QP.Prec.highest(Vg.keymap.of([{key:r,run:n=>this.run(n)}])),this.completionId=0}};function Vwn(t,e,r,n){return{...t.changeByRange(o=>{if(o==t.selection.main)return{changes:{from:r,to:n,insert:e},range:QP.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:QP.EditorSelection.cursor(o.from-i+e.length)}}),userEvent:"input.complete"}}function m3t(t){return typeof t=="string"?{complete_suggestion:t,display_suggestion:t}:t}function Wwn(t){return async function*(e){let r=await t(e);if(typeof r=="string"||"complete_suggestion"in r){yield m3t(r);return}for await(let n of r)yield m3t(n)}}function Gle(t){let{delay:e=500,accept_shortcut:r="Tab"}=t,n=Wwn(t.fetchFn),{debounced:o,force:i}=f3t(n,e);return{extension:r?[Kle,GLe(o),p3t,new YLe(t.continue_suggesting?n:null,r).keymap]:[Kle,GLe(o),p3t],force_fetch:i}}var rFe=require("obsidian");var XLe=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=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=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;o0&&(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#$]/.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"))}},QLe=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.response.transcript}`:""}catch(a){return fe(`Failed to process YouTube URL ${i}: ${a}`),new wW.Notice(`Failed to process YouTube URL ${i}: ${ei(a)}`),""}});return(await Promise.all(n)).join("")}onunload(){this.projectContextCache.cleanup()}};Cl();$r();yo();nr();GLe();$r();mg();yo();nr();var Vg=require("@codemirror/view"),QP=require("@codemirror/state");function y3t(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 Kwn=Object.defineProperty,Gwn=(t,e,r)=>e in t?Kwn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,KU=(t,e,r)=>(Gwn(t,typeof e!="symbol"?e+"":e,r),r),Yle=QP.StateField.define({create(){return{suggestion:null}},update(t,e){let r=e.effects.find(n=>n.is(QLe));return e.state.doc&&r&&(r.value.doc==null||e.state.doc==r.value.doc)?{suggestion:r.value.suggestion}:{suggestion:null}}}),QLe=QP.StateEffect.define();function Jwn(t,e){let r=t.state.selection.main.head,n=[],o=Vg.Decoration.widget({widget:new JLe(e),side:1});return n.push(o.range(r)),Vg.Decoration.set(n)}var JLe=class extends Vg.WidgetType{constructor(e){super(),KU(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}},YLe=t=>{let e=0;return Vg.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:QLe.of({suggestion:i,doc:n})})}}})},ZLe=class{constructor(){KU(this,"decorations"),this.decorations=Vg.Decoration.none}update(e){var r;let n=(r=e.state.field(Yle))==null?void 0:r.suggestion;if(!n){this.decorations=Vg.Decoration.none;return}this.decorations=Jwn(e.view,n.display_suggestion)}},b3t=Vg.ViewPlugin.fromClass(ZLe,{decorations:t=>t.decorations}),XLe=class{constructor(e,r){KU(this,"suggestFn"),KU(this,"keymap"),KU(this,"completionId"),KU(this,"run",n=>{var o,i;let a=(o=n.state.field(Yle))==null?void 0:o.suggestion;return a?(n.dispatch({...Ywn(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:QLe.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=QP.Prec.highest(Vg.keymap.of([{key:r,run:n=>this.run(n)}])),this.completionId=0}};function Ywn(t,e,r,n){return{...t.changeByRange(o=>{if(o==t.selection.main)return{changes:{from:r,to:n,insert:e},range:QP.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:QP.EditorSelection.cursor(o.from-i+e.length)}}),userEvent:"input.complete"}}function _3t(t){return typeof t=="string"?{complete_suggestion:t,display_suggestion:t}:t}function Zwn(t){return async function*(e){let r=await t(e);if(typeof r=="string"||"complete_suggestion"in r){yield _3t(r);return}for await(let n of r)yield _3t(n)}}function Zle(t){let{delay:e=500,accept_shortcut:r="Tab"}=t,n=Zwn(t.fetchFn),{debounced:o,force:i}=y3t(n,e);return{extension:r?[Yle,YLe(o),b3t,new XLe(t.continue_suggesting?n:null,r).keymap]:[Yle,YLe(o),b3t],force_fetch:i}}var oFe=require("obsidian");var eFe=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=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=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;o0&&(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#$]/.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"))}},tFe=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}},eFe=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}},Jle=class{constructor(){this.processors=[];this.processors.push(new eFe),this.processors.push(new XLe),this.processors.push(new QLe)}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}};d4();var h3t=require("obsidian");function g3t(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))break}return[...new Set(n)]}function y3t(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 h3t.TFile&&(r.push(i),r.length>=e))break}return r}Qoe();nr();var tFe=require("obsidian"),Kwn=.4,Gwn=20,b3t=.7,Yle=.3;async function Jwn(t,e){let r=ue().debug,n=await eP.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 Ywn(t){if(t.length===0)return[];let e=t[0].length,r=Array(e).fill(0);return t.forEach(n=>{n.forEach((o,i)=>{r[i]+=o/e})}),r}function Zwn(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 Xwn({db:t,filePath:e}){let r=ue().debug,n=await Jwn(e,t),o=Ywn(n);if(o.length===0)return r&&console.log("No embeddings found for note:",e),new Map;let i=await eP.getDocsByEmbedding(t,o,{limit:Gwn,similarity:Kwn});return Zwn(i,e)}function Qwn(t){let e=new Map,n=g3t(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=y3t(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 e0n(t,e){let r=new Map,n=b3t+Yle;for(let[o,i]of t)r.set(o,i*b3t/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=Yle:(i.links||i.backlinks)&&(a=Yle*.8),r.set(o,(r.get(o)??0)+a)}return r}async function Xle({db:t,filePath:e}){let r=app.vault.getAbstractFileByPath(e);if(!(r instanceof tFe.TFile))return[];let n=await Xwn({db:t,filePath:e}),o=Qwn(r),i=e0n(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=Zle(n.get(l)??0),f=Zle(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 tFe.TFile?{document:{path:s,title:l.basename},metadata:{score:u,similarityScore:n.get(s),hasOutgoingLinks:o.get(s)?.links??!1,hasBacklinks:o.get(s)?.backlinks??!1}}:null}).filter(s=>s!==null)}function Zle(t){return t>.7?3:t>.55?2:1}Ix();var _3t=require("obsidian"),t0n={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 r0n(t,e){let r=t.codePointAt(0);return r?e.some(([n,o])=>r>=n&&r<=o):!1}function v3t(t){let e=t.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"");if(!e)return!1;for(let r of e)if(Object.values(t0n).some(n=>r0n(r,n)))return!0;return!1}function w3t(t,e){let r="",n="",o=Math.max(0,e.line-5);for(let u=o;u=e))break}if(r?.embeds&&n.length=e))break}return[...new Set(n)]}function S3t(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 v3t.TFile&&(r.push(i),r.length>=e))break}return r}rie();nr();var nFe=require("obsidian"),Xwn=.4,Qwn=20,x3t=.7,Qle=.3;async function e0n(t,e){let r=ue().debug,n=await eP.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 t0n(t){if(t.length===0)return[];let e=t[0].length,r=Array(e).fill(0);return t.forEach(n=>{n.forEach((o,i)=>{r[i]+=o/e})}),r}function r0n(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 n0n({db:t,filePath:e}){let r=ue().debug,n=await e0n(e,t),o=t0n(n);if(o.length===0)return r&&console.log("No embeddings found for note:",e),new Map;let i=await eP.getDocsByEmbedding(t,o,{limit:Qwn,similarity:Xwn});return r0n(i,e)}function o0n(t){let e=new Map,n=w3t(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=S3t(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 i0n(t,e){let r=new Map,n=x3t+Qle;for(let[o,i]of t)r.set(o,i*x3t/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=Qle:(i.links||i.backlinks)&&(a=Qle*.8),r.set(o,(r.get(o)??0)+a)}return r}async function tce({db:t,filePath:e}){let r=app.vault.getAbstractFileByPath(e);if(!(r instanceof nFe.TFile))return[];let n=await n0n({db:t,filePath:e}),o=o0n(r),i=i0n(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=ece(n.get(l)??0),f=ece(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 nFe.TFile?{document:{path:s,title:l.basename},metadata:{score:u,similarityScore:n.get(s),hasOutgoingLinks:o.get(s)?.links??!1,hasBacklinks:o.get(s)?.backlinks??!1}}:null}).filter(s=>s!==null)}function ece(t){return t>.7?3:t>.55?2:1}Mx();var C3t=require("obsidian"),a0n={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 s0n(t,e){let r=t.codePointAt(0);return r?e.some(([n,o])=>r>=n&&r<=o):!1}function O3t(t){let e=t.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"");if(!e)return!1;for(let r of e)if(Object.values(a0n).some(n=>s0n(r,n)))return!0;return!1}function P3t(t,e){let r="",n="",o=Math.max(0,e.line-5);for(let u=o;ua.document.title);let i=await Promise.all(o.map(async a=>{let s=app.vault.getAbstractFileByPath(a.document.path);if(!(s instanceof _3t.TFile))return"";let u=await app.vault.cachedRead(s);if(!u)return"";let l=u.length>3e3?u.slice(0,3e3)+"...":u;return`[[${a.document.title}]]: +`;return{prefix:r,noteContext:n}}var YI=class YI{constructor(){this.currentNotePath=null;this.cachedNotes=null;this.cachedNoteTitles=[]}static getInstance(){return YI.instance||(YI.instance=new YI),YI.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=await ma.getInstance().getDb(),o=(await tce({db:r,filePath:e.path})).slice(0,YI.MAX_RELEVANT_NOTES);this.cachedNoteTitles=o.map(a=>a.document.title);let i=await Promise.all(o.map(async a=>{let s=app.vault.getAbstractFileByPath(a.document.path);if(!(s instanceof C3t.TFile))return"";let u=await app.vault.cachedRead(s);if(!u)return"";let l=u.length>3e3?u.slice(0,3e3)+"...":u;return`[[${a.document.title}]]: ${l}`}));return this.currentNotePath=e.path,this.cachedNotes=i.join(` -`),this.cachedNotes}clearCache(){this.currentNotePath=null,this.cachedNotes=null,this.cachedNoteTitles=[]}};YI.MAX_RELEVANT_NOTES=3;var Qle=YI;var ED=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.length4)}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 SW=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{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.frequencythis.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}`;fe(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 fe("[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 fe(`[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{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 S3t.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")}};yo();var yb=class yb{constructor(e){this.isInitialized=!1;this.lastScanTime=0;this.vault=e,this.settings={...yb.DEFAULT_SETTINGS},this.performance={...yb.DEFAULT_PERFORMANCE},this.tokenizer=new ED,this.trie=new SW(this.performance.maxTrieSize),this.scanner=new xW(this.vault,this.settings,this.performance,this.tokenizer)}static getInstance(e){return yb.instance||(yb.instance=new yb(e)),yb.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 fe("[Word Completion] Initialization failed:",r),r}}getSuggestions(e){if(!this.isInitialized||!this.settings.enabled)return[];if(!e||e.lengthi.word.toLowerCase()!==e.toLowerCase())}catch(r){return fe("[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.length0){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{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=wW.getInstance(),this.client=Fi.getInstance(),this.postProcessor=new Jle,this.wordCompletionManager=TD.getInstance(app.vault);let r=ue().autocompleteAcceptKey||Nh.KEYBIND;this.acceptKey=this.validateAcceptKey(r),this.recreateExtension(),this.setupGlobalKeyHandler(),this.unsubscribeFromSettings=xa(this.handleSettingsChange),this.initializeWordCompletion()}validateAcceptKey(e){return["Tab","Space","ArrowRight"].includes(e)?e:"Tab"}async initializeWordCompletion(){if(ue().enableWordCompletion)try{await this.wordCompletionManager.initialize()}catch(r){fe("[Copilot Autocomplete] Failed to initialize word completion:",r)}}recreateExtension(){let{extension:e,force_fetch:r}=Gle({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(rFe.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){fe(`[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(` +`),this.cachedNotes}clearCache(){this.currentNotePath=null,this.cachedNotes=null,this.cachedNoteTitles=[]}};YI.MAX_RELEVANT_NOTES=3;var rce=YI;var TD=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.length4)}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 xW=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{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.frequencythis.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}`;fe(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 fe("[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 fe(`[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{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 E3t.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")}};yo();var yb=class yb{constructor(e){this.isInitialized=!1;this.lastScanTime=0;this.vault=e,this.settings={...yb.DEFAULT_SETTINGS},this.performance={...yb.DEFAULT_PERFORMANCE},this.tokenizer=new TD,this.trie=new xW(this.performance.maxTrieSize),this.scanner=new CW(this.vault,this.settings,this.performance,this.tokenizer)}static getInstance(e){return yb.instance||(yb.instance=new yb(e)),yb.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 fe("[Word Completion] Initialization failed:",r),r}}getSuggestions(e){if(!this.isInitialized||!this.settings.enabled)return[];if(!e||e.lengthi.word.toLowerCase()!==e.toLowerCase())}catch(r){return fe("[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.length0){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{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=SW.getInstance(),this.client=Fi.getInstance(),this.postProcessor=new Xle,this.wordCompletionManager=AD.getInstance(app.vault);let r=ue().autocompleteAcceptKey||Nh.KEYBIND;this.acceptKey=this.validateAcceptKey(r),this.recreateExtension(),this.setupGlobalKeyHandler(),this.unsubscribeFromSettings=xa(this.handleSettingsChange),this.initializeWordCompletion()}validateAcceptKey(e){return["Tab","Space","ArrowRight"].includes(e)?e:"Tab"}async initializeWordCompletion(){if(ue().enableWordCompletion)try{await this.wordCompletionManager.initialize()}catch(r){fe("[Copilot Autocomplete] Failed to initialize word completion:",r)}}recreateExtension(){let{extension:e,force_fetch:r}=Zle({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(oFe.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){fe(`[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 v3t(s)?!0:e.endsWith(" ")}async*handleUnifiedCompletion(){if(!this.isActive)return;let e=app.workspace.getActiveViewOfType(rFe.MarkdownView);if(!e)return;await new Promise(c=>setTimeout(c,10));let r=e.editor,n=r.getCursor(),{prefix:o,noteContext:i}=w3t(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.lastRequestTimeb.word===c),m=f.some(b=>b.word.length-c.length>=2);if(p&&!m)return;let h=p?f.filter(b=>b.word!==c):f;if(h.length===0)return;try{let b=h.map(E=>E.word),g=o.slice(-1e3),y=a.slice(0,500),S,x,O;if(this.cacheEnabled&&(x=this.cache.generateWordKey(g,y,b),O=this.cache.get(x)),O)S=O;else{let E=this.client.wordcomplete(g,y,b);this.activeRequests.set(d,E),this.lastRequestTime=s,S=await E,this.cacheEnabled&&x&&this.cache.set(x,S),this.activeRequests.delete(d)}let P=S.response.selected_word;if(P&&P!==c){let E=this.generateCaseMatchedCompletion(P,c);E&&(yield{display_suggestion:E,complete_suggestion:E})}}catch(b){this.activeRequests.delete(d),fe("[Copilot Autocomplete] Error with LLM word selection, falling back to trie:",b);let g=h[0],y=this.generateCaseMatchedCompletion(g.word,c);y&&(yield{display_suggestion:y,complete_suggestion:y})}}else{if(!u.enableAutocomplete||!this.shouldContinueSuggesting(o,a))return;let c=o.slice(-this.options.maxContextLength);if(c.lengthu.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"").length>0),s=a[a.length-1]||"";return O3t(s)?!0:e.endsWith(" ")}async*handleUnifiedCompletion(){if(!this.isActive)return;let e=app.workspace.getActiveViewOfType(oFe.MarkdownView);if(!e)return;await new Promise(c=>setTimeout(c,10));let r=e.editor,n=r.getCursor(),{prefix:o,noteContext:i}=P3t(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.lastRequestTimeb.word===c),m=f.some(b=>b.word.length-c.length>=2);if(p&&!m)return;let h=p?f.filter(b=>b.word!==c):f;if(h.length===0)return;try{let b=h.map(E=>E.word),g=o.slice(-1e3),y=a.slice(0,500),S,x,O;if(this.cacheEnabled&&(x=this.cache.generateWordKey(g,y,b),O=this.cache.get(x)),O)S=O;else{let E=this.client.wordcomplete(g,y,b);this.activeRequests.set(d,E),this.lastRequestTime=s,S=await E,this.cacheEnabled&&x&&this.cache.set(x,S),this.activeRequests.delete(d)}let P=S.response.selected_word;if(P&&P!==c){let E=this.generateCaseMatchedCompletion(P,c);E&&(yield{display_suggestion:E,complete_suggestion:E})}}catch(b){this.activeRequests.delete(d),fe("[Copilot Autocomplete] Error with LLM word selection, falling back to trie:",b);let g=h[0],y=this.generateCaseMatchedCompletion(g.word,c);y&&(yield{display_suggestion:y,complete_suggestion:y})}}else{if(!u.enableAutocomplete||!this.shouldContinueSuggesting(o,a))return;let c=o.slice(-this.options.maxContextLength);if(c.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 tce=class t{constructor(e){this.plugin=e;let r=ue();this.cmIntegration=ece.getInstance({delay:Nh.DELAY_MS,minTriggerLength:Nh.MIN_TRIGGER_LENGTH,maxContextLength:Nh.MAX_CONTEXT_LENGTH}),this.unsubscribeSettings=xa((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){fe("[Copilot Autocomplete] Failed to register CodeMirror extension:",e)}}destroy(){this.unsubscribeSettings(),this.cmIntegration.setActive(!1),this.cmIntegration.destroy()}};Cl();Fd();var x3t=require("obsidian"),rce=class extends x3t.Modal{constructor(r,n){super(r);this.placeholderText="Please enter your custom ad-hoc prompt here, press enter to send.";this.onSubmit=n}onOpen(){let{contentEl:r}=this,n=createFragment(i=>{i.createEl("strong",{text:"- {} represents the selected text (not required). "}),i.createEl("br"),i.createEl("strong",{text:"- {[[Note Title]]} represents a note. "}),i.createEl("br"),i.createEl("strong",{text:"- {activeNote} represents the active note. "}),i.createEl("br"),i.createEl("strong",{text:"- {FolderPath} represents a folder of notes. "}),i.createEl("br"),i.createEl("strong",{text:"- {#tag1, #tag2} represents ALL notes with ANY of the specified tags in their property (an OR operation). "}),i.createEl("br"),i.createEl("br"),i.appendText("Tip: turn on debug mode to show the processed prompt in the chat window."),i.createEl("br"),i.createEl("br")});r.appendChild(n);let o=r.createEl("textarea",{attr:{placeholder:this.placeholderText}});o.style.width="100%",o.style.height="100px",o.style.padding="10px",o.style.resize="vertical",o.addEventListener("input",i=>{this.result=i.target.value}),o.addEventListener("keydown",i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),this.close(),this.onSubmit(this.result))})}onClose(){let{contentEl:r}=this;r.empty()}};L8();var ZI=require("obsidian"),nce=class extends ZI.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Debug: Search OramaDB"});let r=e.createEl("p");r.innerHTML='Enter a JSON search params object. Example:
{
"term": "#tag",
"mode": "hybrid",
"limit": 10,
"includeVectors": true
}
',this.searchInput=e.createEl("textarea",{attr:{placeholder:"Enter search params JSON...",rows:"10",style:"width: 100%; min-height: 200px; margin: 10px 0; padding: 10px; font-family: monospace;"}}),e.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Search",cls:"mod-cta"}).addEventListener("click",async()=>{try{let i=JSON.parse(this.searchInput.value);i.vector?.value&&!Array.isArray(i.vector.value)&&(i.vector.value=Object.values(i.vector.value));let a=await this.plugin.vectorStoreManager.getDb();if(!a){new ZI.Notice("Database not found");return}let s=await Xc(a,i),u=["## Search Parameters","```json",JSON.stringify(i,null,2),"```","","## Results",`Total hits: ${s.hits.length}`,"","### Hits","```json",JSON.stringify(s.hits,null,2),"```"].join(` -`),l="OramaDB-Debug-Search.md",c=this.app.vault.getAbstractFileByPath(l);c instanceof ZI.TFile?await this.app.vault.modify(c,u):await this.app.vault.create(l,u);let d=this.app.vault.getAbstractFileByPath(l);d instanceof ZI.TFile&&(await this.app.workspace.getLeaf().openFile(d),this.close())}catch(i){console.error("Error in debug search:",i),new ZI.Notice("Error executing search. Check console for details.")}})}onClose(){let{contentEl:e}=this;e.empty()}};Cn();var CW=require("obsidian"),oce=class extends CW.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Inspect Copilot Index by Note Paths"}),this.searchInput=e.createEl("textarea",{attr:{placeholder:`Enter note paths as markdown list: +`).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 oce=class t{constructor(e){this.plugin=e;let r=ue();this.cmIntegration=nce.getInstance({delay:Nh.DELAY_MS,minTriggerLength:Nh.MIN_TRIGGER_LENGTH,maxContextLength:Nh.MAX_CONTEXT_LENGTH}),this.unsubscribeSettings=xa((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){fe("[Copilot Autocomplete] Failed to register CodeMirror extension:",e)}}destroy(){this.unsubscribeSettings(),this.cmIntegration.setActive(!1),this.cmIntegration.destroy()}};Cl();Fd();var T3t=require("obsidian"),ice=class extends T3t.Modal{constructor(r,n){super(r);this.placeholderText="Please enter your custom ad-hoc prompt here, press enter to send.";this.onSubmit=n}onOpen(){let{contentEl:r}=this,n=createFragment(i=>{i.createEl("strong",{text:"- {} represents the selected text (not required). "}),i.createEl("br"),i.createEl("strong",{text:"- {[[Note Title]]} represents a note. "}),i.createEl("br"),i.createEl("strong",{text:"- {activeNote} represents the active note. "}),i.createEl("br"),i.createEl("strong",{text:"- {FolderPath} represents a folder of notes. "}),i.createEl("br"),i.createEl("strong",{text:"- {#tag1, #tag2} represents ALL notes with ANY of the specified tags in their property (an OR operation). "}),i.createEl("br"),i.createEl("br"),i.appendText("Tip: turn on debug mode to show the processed prompt in the chat window."),i.createEl("br"),i.createEl("br")});r.appendChild(n);let o=r.createEl("textarea",{attr:{placeholder:this.placeholderText}});o.style.width="100%",o.style.height="100px",o.style.padding="10px",o.style.resize="vertical",o.addEventListener("input",i=>{this.result=i.target.value}),o.addEventListener("keydown",i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),this.close(),this.onSubmit(this.result))})}onClose(){let{contentEl:r}=this;r.empty()}};F8();var ZI=require("obsidian"),ace=class extends ZI.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Debug: Search OramaDB"});let r=e.createEl("p");r.innerHTML='Enter a JSON search params object. Example:
{
"term": "#tag",
"mode": "hybrid",
"limit": 10,
"includeVectors": true
}
',this.searchInput=e.createEl("textarea",{attr:{placeholder:"Enter search params JSON...",rows:"10",style:"width: 100%; min-height: 200px; margin: 10px 0; padding: 10px; font-family: monospace;"}}),e.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Search",cls:"mod-cta"}).addEventListener("click",async()=>{try{let i=JSON.parse(this.searchInput.value);i.vector?.value&&!Array.isArray(i.vector.value)&&(i.vector.value=Object.values(i.vector.value));let a=await this.plugin.vectorStoreManager.getDb();if(!a){new ZI.Notice("Database not found");return}let s=await Xc(a,i),u=["## Search Parameters","```json",JSON.stringify(i,null,2),"```","","## Results",`Total hits: ${s.hits.length}`,"","### Hits","```json",JSON.stringify(s.hits,null,2),"```"].join(` +`),l="OramaDB-Debug-Search.md",c=this.app.vault.getAbstractFileByPath(l);c instanceof ZI.TFile?await this.app.vault.modify(c,u):await this.app.vault.create(l,u);let d=this.app.vault.getAbstractFileByPath(l);d instanceof ZI.TFile&&(await this.app.workspace.getLeaf().openFile(d),this.close())}catch(i){console.error("Error in debug search:",i),new ZI.Notice("Error executing search. Check console for details.")}})}onClose(){let{contentEl:e}=this;e.empty()}};yn();var OW=require("obsidian"),sce=class extends OW.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Inspect Copilot Index by Note Paths"}),this.searchInput=e.createEl("textarea",{attr:{placeholder:`Enter note paths as markdown list: - [[Note 1]] -- [[Note 2]]`,rows:"10",style:"width: 100%; min-height: 200px; margin: 10px 0; padding: 10px; font-family: monospace;"}}),e.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Show Index Data",cls:"mod-cta"}).addEventListener("click",async()=>{let o=this.searchInput.value,i=NC(o,this.app.vault).map(a=>a.path);if(i.length===0){new CW.Notice("No valid note paths found. Use format: - [[Note Name]]");return}try{let s=await(await this.plugin.vectorStoreManager.getDbOps()).getDocsJsonByPaths(i),u="CopilotDB-Search-Results.md",l=["## Searched Paths",...i.map(f=>`- [[${f}]]`),"","## Index Data","```json",JSON.stringify(s,null,2),"```"].join(` -`),c=this.app.vault.getAbstractFileByPath(u);c?await this.app.vault.modify(c,l):await this.app.vault.create(u,l);let d=this.app.vault.getAbstractFileByPath(u);d&&await this.app.workspace.getLeaf().openFile(d),this.close()}catch(a){console.error("Error searching DB:",a),new CW.Notice("Error searching database. Check console for details.")}})}onClose(){let{contentEl:e}=this;e.empty()}};var OW=require("obsidian"),ice=class extends OW.Modal{constructor(r,n){super(r);this.filePaths="";this.onSubmit=n}onOpen(){let{contentEl:r}=this;r.createEl("h2",{text:"Remove Files from Copilot Index"});let n=r.createDiv({cls:"remove-files-container"});new OW.Setting(n).setName("File paths").setDesc("Paste the markdown list of file paths to remove from the index. You can get the list by running the command `List all indexed files`.").setClass("remove-files-setting").addTextArea(o=>o.setPlaceholder(`- [[path/to/file1.md]] -- [[path/to/file2.md]]`).setValue(this.filePaths).onChange(i=>{this.filePaths=i})),new OW.Setting(n).addButton(o=>o.setButtonText("Remove").setCta().onClick(()=>{let i=this.filePaths.split(` +- [[Note 2]]`,rows:"10",style:"width: 100%; min-height: 200px; margin: 10px 0; padding: 10px; font-family: monospace;"}}),e.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Show Index Data",cls:"mod-cta"}).addEventListener("click",async()=>{let o=this.searchInput.value,i=DC(o,this.app.vault).map(a=>a.path);if(i.length===0){new OW.Notice("No valid note paths found. Use format: - [[Note Name]]");return}try{let s=await(await this.plugin.vectorStoreManager.getDbOps()).getDocsJsonByPaths(i),u="CopilotDB-Search-Results.md",l=["## Searched Paths",...i.map(f=>`- [[${f}]]`),"","## Index Data","```json",JSON.stringify(s,null,2),"```"].join(` +`),c=this.app.vault.getAbstractFileByPath(u);c?await this.app.vault.modify(c,l):await this.app.vault.create(u,l);let d=this.app.vault.getAbstractFileByPath(u);d&&await this.app.workspace.getLeaf().openFile(d),this.close()}catch(a){console.error("Error searching DB:",a),new OW.Notice("Error searching database. Check console for details.")}})}onClose(){let{contentEl:e}=this;e.empty()}};var PW=require("obsidian"),uce=class extends PW.Modal{constructor(r,n){super(r);this.filePaths="";this.onSubmit=n}onOpen(){let{contentEl:r}=this;r.createEl("h2",{text:"Remove Files from Copilot Index"});let n=r.createDiv({cls:"remove-files-container"});new PW.Setting(n).setName("File paths").setDesc("Paste the markdown list of file paths to remove from the index. You can get the list by running the command `List all indexed files`.").setClass("remove-files-setting").addTextArea(o=>o.setPlaceholder(`- [[path/to/file1.md]] +- [[path/to/file2.md]]`).setValue(this.filePaths).onChange(i=>{this.filePaths=i})),new PW.Setting(n).addButton(o=>o.setButtonText("Remove").setCta().onClick(()=>{let i=this.filePaths.split(` `).map(a=>{let s=a.match(/\[\[(.*?)\]\]/);return s?s[1].trim():""}).filter(a=>a.length>0);this.onSubmit(i),this.close()})),r.createEl("style",{text:` .remove-files-container { width: 100%; @@ -806,8 +806,8 @@ ${c}`:c,b,g,y;if(this.cacheEnabled&&(g=this.cache.generateSentenceKey(h,i,p),y=t .remove-files-setting textarea::placeholder { opacity: 0.5; } - `})}onClose(){let{contentEl:r}=this;r.empty()}};_g();nr();var Ji=require("obsidian");l2();$r();function df(t,e,r){t.addCommand({id:e,name:ige[e],callback:r})}function C3t(t,e,r){t.addCommand({id:e,name:ige[e],editorCallback:r})}function nFe(t,e,r){C3t(t,Br.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 Ji.Notice(`Selected text contains ${i} words and ${a} tokens.`)}),df(t,Br.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let n=await JRt(t.app),o=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(n);new Ji.Notice(`Total tokens in your vault: ${o}`)}catch(n){console.error("Error counting tokens: ",n),new Ji.Notice("An error occurred while counting tokens.")}}),df(t,Br.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),df(t,Br.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),df(t,Br.NEW_CHAT,()=>{t.newChat()}),df(t,Br.APPLY_ADHOC_PROMPT,async()=>{new rce(t.app,async o=>{try{t.processCustomPrompt(Br.APPLY_ADHOC_PROMPT,o)}catch(i){console.error(i),new Ji.Notice("An error occurred.")}}).open()}),df(t,Br.CLEAR_LOCAL_COPILOT_INDEX,async()=>{await t.vectorStoreManager.clearIndex()}),df(t,Br.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let n=await t.vectorStoreManager.garbageCollectVectorStore();new Ji.Notice(`${n} documents removed from Copilot index.`)}catch(n){console.error("Error garbage collecting the Copilot index:",n),new Ji.Notice("An error occurred while garbage collecting the Copilot index.")}}),df(t,Br.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let n=await t.vectorStoreManager.indexVaultToVectorStore();new Ji.Notice(`${n} vault files indexed to Copilot index.`)}catch(n){console.error("Error indexing vault to Copilot index:",n),new Ji.Notice("An error occurred while indexing vault to Copilot index.")}}),df(t,Br.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let n=await t.vectorStoreManager.indexVaultToVectorStore(!0);new Ji.Notice(`${n} vault files re-indexed to Copilot index.`)}catch(n){console.error("Error re-indexing vault to Copilot index:",n),new Ji.Notice("An error occurred while re-indexing vault to Copilot index.")}}),df(t,Br.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),df(t,Br.LIST_INDEXED_FILES,async()=>{try{let n=await t.vectorStoreManager.getIndexedFiles(),o=new Set(n),i=t.app.vault.getMarkdownFiles(),a=new Set,s=new Set,u=new Set,l=await t.vectorStoreManager.getDbOps();for(let h of i){let b=await t.app.vault.cachedRead(h);!b||b.trim().length===0?a.add(h.path):o.has(h.path)?await l.hasEmbeddings(h.path)||u.add(h.path):s.add(h.path)}if(n.length===0&&a.size===0&&s.size===0){new Ji.Notice("No files found to list.");return}let c=["# Copilot Files Status",`- Indexed files: ${n.length}`,` - Files missing embeddings: ${u.size}`,`- Unindexed files: ${s.size}`,`- Empty files: ${a.size}`,"","## Indexed Files",...n.map(h=>{let b=u.has(h);return`- [[${h}]]${b?" *(embedding missing)*":""}`}),"","## Unindexed Files",...s.size>0?Array.from(s).sort().map(h=>`- [[${h}]]`):["No unindexed files found."],"","## Empty Files",...a.size>0?Array.from(a).sort().map(h=>`- [[${h}]]`):["No empty files found."]].join(` -`),f=`${`Copilot-Indexed-Files-${new Date().toLocaleDateString().replace(/\//g,"-")}.md`}`,p=t.app.vault.getAbstractFileByPath(f);p instanceof Ji.TFile?await t.app.vault.modify(p,c):await t.app.vault.create(f,c);let m=t.app.vault.getAbstractFileByPath(f);m instanceof Ji.TFile&&(await t.app.workspace.getLeaf().openFile(m),new Ji.Notice(`Listed ${n.length} indexed files`))}catch(n){console.error("Error listing indexed files:",n),new Ji.Notice("Failed to list indexed files.")}}),r.debug&&(df(t,Br.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS,()=>{new oce(t.app,t).open()}),df(t,Br.SEARCH_ORAMA_DB,()=>{new nce(t.app,t).open()}),df(t,Br.REMOVE_FILES_FROM_COPILOT_INDEX,async()=>{new ice(t.app,async n=>{let o=await t.vectorStoreManager.getDbOps();try{for(let i of n)await o.removeDocs(i);await o.saveDB(),new Ji.Notice(`Successfully removed ${n.length} files from the index.`)}catch(i){console.error("Error removing files from index:",i),new Ji.Notice("An error occurred while removing files from the index.")}}).open()})),df(t,Br.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),await tb.getInstance().clearAllCache(),await xq.getInstance().clear();let{AutocompleteCache:o}=await Promise.resolve().then(()=>(WLe(),d3t));o.getInstance().clear(),new Ji.Notice("All Copilot caches cleared successfully")}catch(n){console.error("Error clearing Copilot caches:",n),new Ji.Notice("Failed to clear Copilot caches")}}),df(t,Br.TOGGLE_AUTOCOMPLETE,()=>{let o=!ue().enableAutocomplete;dt("enableAutocomplete",o),new Ji.Notice(`Copilot autocomplete ${o?"enabled":"disabled"}`)}),C3t(t,Br.ADD_SELECTION_TO_CHAT_CONTEXT,async n=>{let o=Fh();if(o!=="copilot_plus"&&o!=="project"){new Ji.Notice("Selected text context is only available in Copilot Plus and Project modes");return}let i=n.getSelection();if(!i){new Ji.Notice("No text selected");return}let a=t.app.workspace.getActiveFile();if(!a){new Ji.Notice("No active file");return}let s=n.listSelections()[0];if(!s){new Ji.Notice("Could not determine selection range");return}let u=s.anchor.line+1,l=s.head.line+1,c={id:yC(),content:i,noteTitle:a.basename,notePath:a.path,startLine:Math.min(u,l),endLine:Math.max(u,l)};e8e(c),t.activateView()})}Cl();Fd();var oFe="{copilot-selection}";var XI={title:"",content:"",showInContextMenu:!1,showInSlashMenu:!1,order:Number.MAX_SAFE_INTEGER,modelKey:"",lastUsedMs:0},AD="copilot-command-context-menu-enabled",ID="copilot-command-slash-enabled",MD="copilot-command-context-menu-order",RD="copilot-command-model-key",jD="copilot-command-last-used",O3t=[{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: + `})}onClose(){let{contentEl:r}=this;r.empty()}};_g();nr();var Ji=require("obsidian");c2();$r();function df(t,e,r){t.addCommand({id:e,name:uge[e],callback:r})}function A3t(t,e,r){t.addCommand({id:e,name:uge[e],editorCallback:r})}function iFe(t,e,r){A3t(t,Br.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 Ji.Notice(`Selected text contains ${i} words and ${a} tokens.`)}),df(t,Br.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let n=await e1t(t.app),o=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(n);new Ji.Notice(`Total tokens in your vault: ${o}`)}catch(n){console.error("Error counting tokens: ",n),new Ji.Notice("An error occurred while counting tokens.")}}),df(t,Br.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),df(t,Br.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),df(t,Br.NEW_CHAT,()=>{t.newChat()}),df(t,Br.APPLY_ADHOC_PROMPT,async()=>{new ice(t.app,async o=>{try{t.processCustomPrompt(Br.APPLY_ADHOC_PROMPT,o)}catch(i){console.error(i),new Ji.Notice("An error occurred.")}}).open()}),df(t,Br.CLEAR_LOCAL_COPILOT_INDEX,async()=>{await t.vectorStoreManager.clearIndex()}),df(t,Br.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let n=await t.vectorStoreManager.garbageCollectVectorStore();new Ji.Notice(`${n} documents removed from Copilot index.`)}catch(n){console.error("Error garbage collecting the Copilot index:",n),new Ji.Notice("An error occurred while garbage collecting the Copilot index.")}}),df(t,Br.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let n=await t.vectorStoreManager.indexVaultToVectorStore();new Ji.Notice(`${n} vault files indexed to Copilot index.`)}catch(n){console.error("Error indexing vault to Copilot index:",n),new Ji.Notice("An error occurred while indexing vault to Copilot index.")}}),df(t,Br.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let n=await t.vectorStoreManager.indexVaultToVectorStore(!0);new Ji.Notice(`${n} vault files re-indexed to Copilot index.`)}catch(n){console.error("Error re-indexing vault to Copilot index:",n),new Ji.Notice("An error occurred while re-indexing vault to Copilot index.")}}),df(t,Br.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),df(t,Br.LIST_INDEXED_FILES,async()=>{try{let n=await t.vectorStoreManager.getIndexedFiles(),o=new Set(n),i=t.app.vault.getMarkdownFiles(),a=new Set,s=new Set,u=new Set,l=await t.vectorStoreManager.getDbOps();for(let h of i){let b=await t.app.vault.cachedRead(h);!b||b.trim().length===0?a.add(h.path):o.has(h.path)?await l.hasEmbeddings(h.path)||u.add(h.path):s.add(h.path)}if(n.length===0&&a.size===0&&s.size===0){new Ji.Notice("No files found to list.");return}let c=["# Copilot Files Status",`- Indexed files: ${n.length}`,` - Files missing embeddings: ${u.size}`,`- Unindexed files: ${s.size}`,`- Empty files: ${a.size}`,"","## Indexed Files",...n.map(h=>{let b=u.has(h);return`- [[${h}]]${b?" *(embedding missing)*":""}`}),"","## Unindexed Files",...s.size>0?Array.from(s).sort().map(h=>`- [[${h}]]`):["No unindexed files found."],"","## Empty Files",...a.size>0?Array.from(a).sort().map(h=>`- [[${h}]]`):["No empty files found."]].join(` +`),f=`${`Copilot-Indexed-Files-${new Date().toLocaleDateString().replace(/\//g,"-")}.md`}`,p=t.app.vault.getAbstractFileByPath(f);p instanceof Ji.TFile?await t.app.vault.modify(p,c):await t.app.vault.create(f,c);let m=t.app.vault.getAbstractFileByPath(f);m instanceof Ji.TFile&&(await t.app.workspace.getLeaf().openFile(m),new Ji.Notice(`Listed ${n.length} indexed files`))}catch(n){console.error("Error listing indexed files:",n),new Ji.Notice("Failed to list indexed files.")}}),r.debug&&(df(t,Br.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS,()=>{new sce(t.app,t).open()}),df(t,Br.SEARCH_ORAMA_DB,()=>{new ace(t.app,t).open()}),df(t,Br.REMOVE_FILES_FROM_COPILOT_INDEX,async()=>{new uce(t.app,async n=>{let o=await t.vectorStoreManager.getDbOps();try{for(let i of n)await o.removeDocs(i);await o.saveDB(),new Ji.Notice(`Successfully removed ${n.length} files from the index.`)}catch(i){console.error("Error removing files from index:",i),new Ji.Notice("An error occurred while removing files from the index.")}}).open()})),df(t,Br.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),await tb.getInstance().clearAllCache(),await Cq.getInstance().clear();let{AutocompleteCache:o}=await Promise.resolve().then(()=>(GLe(),g3t));o.getInstance().clear(),new Ji.Notice("All Copilot caches cleared successfully")}catch(n){console.error("Error clearing Copilot caches:",n),new Ji.Notice("Failed to clear Copilot caches")}}),df(t,Br.TOGGLE_AUTOCOMPLETE,()=>{let o=!ue().enableAutocomplete;dt("enableAutocomplete",o),new Ji.Notice(`Copilot autocomplete ${o?"enabled":"disabled"}`)}),A3t(t,Br.ADD_SELECTION_TO_CHAT_CONTEXT,async n=>{let o=Fh();if(o!=="copilot_plus"&&o!=="project"){new Ji.Notice("Selected text context is only available in Copilot Plus and Project modes");return}let i=n.getSelection();if(!i){new Ji.Notice("No text selected");return}let a=t.app.workspace.getActiveFile();if(!a){new Ji.Notice("No active file");return}let s=n.listSelections()[0];if(!s){new Ji.Notice("Could not determine selection range");return}let u=s.anchor.line+1,l=s.head.line+1,c={id:bC(),content:i,noteTitle:a.basename,notePath:a.path,startLine:Math.min(u,l),endLine:Math.max(u,l)};o8e(c),t.activateView()})}Cl();Fd();var aFe="{copilot-selection}";var XI={title:"",content:"",showInContextMenu:!1,showInSlashMenu:!1,order:Number.MAX_SAFE_INTEGER,modelKey:"",lastUsedMs:0},ID="copilot-command-context-menu-enabled",MD="copilot-command-slash-enabled",RD="copilot-command-context-menu-order",jD="copilot-command-model-key",ND="copilot-command-last-used",I3t=[{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 @@ -842,23 +842,23 @@ ${c}`:c,b,g,y;if(this.cacheEnabled&&(g=this.cache.generateSentenceKey(h,i,p),y=t " 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 KU=require("obsidian");nr();s4();s4();var eE=lF(),tE=Ih([]);function ace(t){let e=eE.get(tE);e.some(r=>r.title===t)||eE.set(tE,[...e,{...XI,title:t}])}function PW(t){let e=eE.get(tE);eE.set(tE,e.filter(r=>r.title!==t))}function EW(t,e){let r=eE.get(tE),n;(e?r.findIndex(i=>i.title===e):-1)!==-1?n=r.map(i=>i.title===e?t:i):n=[...r,t],eE.set(tE,n)}function sce(t){eE.set(tE,t)}function P3t(){return i4(tE,{store:eE})}function Gx(){return eE.get(tE)}d4();Cn();$r();function GU(t,e,r){let n=t.trim();return r&&n===r?null:/[#<>:"/\\|?*[\]^\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}function JU(t){return encodeURIComponent(t.toLowerCase())}function QI(){return(0,KU.normalizePath)(ue().customPromptsFolder)}function ND(t){return`${QI()}/${t}.md`}function YU(t){if(!(t instanceof KU.TFile)||t.extension!=="md")return!1;let e=QI();return!(!t.path.startsWith(e+"/")||t.path.slice(e.length+1).includes("/"))}function o0n(t){if(t.startsWith("---")){let e=t.indexOf("---",3);if(e!==-1)return t.slice(e+3).trimStart()}return t}async function TW(t){let e=await app.vault.read(t),r=o0n(e),n=app.metadataCache.getFileCache(t),o=n?.frontmatter?.[AD]??XI.showInContextMenu,i=n?.frontmatter?.[ID]??XI.showInSlashMenu,a=n?.frontmatter?.[jD]??XI.lastUsedMs,s=n?.frontmatter?.[MD]??XI.order,u=n?.frontmatter?.[RD]??XI.modelKey;return{title:t.basename,modelKey:u,content:r,showInContextMenu:o,showInSlashMenu:i,order:s,lastUsedMs:a}}async function uce(){let t=app.vault.getFiles().filter(r=>YU(r)),e=await Promise.all(t.map(TW));return sce(e),e}function AW(t){return[...t].sort((e,r)=>e.order===r.order?e.title.localeCompare(r.title):e.order-r.order)}function i0n(t){return[...t].sort((e,r)=>e.lastUsedMs===r.lastUsedMs?e.title.localeCompare(r.title):r.lastUsedMs-e.lastUsedMs)}function a0n(t){return[...t].sort((e,r)=>e.title.localeCompare(r.title))}function E3t(t){switch(ue().promptSortStrategy){case"timestamp":return i0n(t);case"alphabetical":return a0n(t);case"manual":return AW(t);default:return t}}async function iFe(t,e,r=!1){let o=(await lce(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes("{selectedText}")||r)return o;let i=o.indexOf(oFe);return i===-1&&e.trim()?o+` + Return only the formatted thread.`,showInContextMenu:!1,showInSlashMenu:!1,order:1120,modelKey:"",lastUsedMs:0}];var GU=require("obsidian");nr();u4();u4();var eE=cF(),tE=Ih([]);function lce(t){let e=eE.get(tE);e.some(r=>r.title===t)||eE.set(tE,[...e,{...XI,title:t}])}function EW(t){let e=eE.get(tE);eE.set(tE,e.filter(r=>r.title!==t))}function TW(t,e){let r=eE.get(tE),n;(e?r.findIndex(i=>i.title===e):-1)!==-1?n=r.map(i=>i.title===e?t:i):n=[...r,t],eE.set(tE,n)}function cce(t){eE.set(tE,t)}function M3t(){return a4(tE,{store:eE})}function Jx(){return eE.get(tE)}f4();yn();$r();function JU(t,e,r){let n=t.trim();return r&&n===r?null:/[#<>:"/\\|?*[\]^\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}function YU(t){return encodeURIComponent(t.toLowerCase())}function QI(){return(0,GU.normalizePath)(ue().customPromptsFolder)}function DD(t){return`${QI()}/${t}.md`}function ZU(t){if(!(t instanceof GU.TFile)||t.extension!=="md")return!1;let e=QI();return!(!t.path.startsWith(e+"/")||t.path.slice(e.length+1).includes("/"))}function l0n(t){if(t.startsWith("---")){let e=t.indexOf("---",3);if(e!==-1)return t.slice(e+3).trimStart()}return t}async function AW(t){let e=await app.vault.read(t),r=l0n(e),n=app.metadataCache.getFileCache(t),o=n?.frontmatter?.[ID]??XI.showInContextMenu,i=n?.frontmatter?.[MD]??XI.showInSlashMenu,a=n?.frontmatter?.[ND]??XI.lastUsedMs,s=n?.frontmatter?.[RD]??XI.order,u=n?.frontmatter?.[jD]??XI.modelKey;return{title:t.basename,modelKey:u,content:r,showInContextMenu:o,showInSlashMenu:i,order:s,lastUsedMs:a}}async function dce(){let t=app.vault.getFiles().filter(r=>ZU(r)),e=await Promise.all(t.map(AW));return cce(e),e}function IW(t){return[...t].sort((e,r)=>e.order===r.order?e.title.localeCompare(r.title):e.order-r.order)}function c0n(t){return[...t].sort((e,r)=>e.lastUsedMs===r.lastUsedMs?e.title.localeCompare(r.title):r.lastUsedMs-e.lastUsedMs)}function d0n(t){return[...t].sort((e,r)=>e.title.localeCompare(r.title))}function R3t(t){switch(ue().promptSortStrategy){case"timestamp":return c0n(t);case"alphabetical":return d0n(t);case"manual":return IW(t);default:return t}}async function sFe(t,e,r=!1){let o=(await fce(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes("{selectedText}")||r)return o;let i=o.indexOf(aFe);return i===-1&&e.trim()?o+` -`+e+"":o.slice(0,i)+e+o.slice(i+oFe.length)}var s0n=/\{(?!copilot-selection\})([^}]+)\}/g;async function u0n(t,e,r){let n=new Map,o=new Set,i;for(;(i=s0n.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]};if(a.toLowerCase()==="activenote")if(r){let u=await pF(r,e);u&&(s.content=`## ${QG(r)} +`+e+"":o.slice(0,i)+e+o.slice(i+aFe.length)}var f0n=/\{(?!copilot-selection\})([^}]+)\}/g;async function p0n(t,e,r){let n=new Map,o=new Set,i;for(;(i=f0n.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]};if(a.toLowerCase()==="activenote")if(r){let u=await mF(r,e);u&&(s.content=`## ${eJ(r)} -${u}`,s.files.push(r))}else new KU.Notice("No active note found.");else if(a.startsWith("#")){let u=a.slice(1).split(",").map(d=>d.trim()),l=await dVe(e,u),c=[];for(let d of l){let f=await pF(d,e);f&&(c.push(`## ${QG(d)} +${u}`,s.files.push(r))}else new GU.Notice("No active note found.");else if(a.startsWith("#")){let u=a.slice(1).split(",").map(d=>d.trim()),l=await pVe(e,u),c=[];for(let d of l){let f=await mF(d,e);f&&(c.push(`## ${eJ(d)} ${f}`),s.files.push(d))}s.content=c.join(` -`)}else{let u=mVe(a),l=await Jhe(e,u),c=[];for(let d of l){let f=await pF(d,e);f&&(c.push(`## ${QG(d)} +`)}else{let u=gVe(a),l=await Xhe(e,u),c=[];for(let d of l){let f=await mF(d,e);f&&(c.push(`## ${eJ(d)} ${f}`),s.files.push(d))}s.content=c.join(` -`)}s.content?(n.set(a,s.content),s.files.forEach(u=>o.add(u))):a.toLowerCase()!=="activenote"&&(a.startsWith('"')||console.warn(`No notes found for variable: ${a}`))}return{variablesMap:n,includedFiles:o}}async function lce(t,e,r,n){let o=ue(),i=new Set;if(!o.enableCustomPromptTemplating)return t.includes("{}")&&!e&&n&&i.add(n),{processedPrompt:t+` +`)}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 fce(t,e,r,n){let o=ue(),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 u0n(t,r,n);s.forEach(f=>i.add(f));let u=t,l="",c=null;u.includes("{}")&&(u=u.replace(/\{\}/g,"{selectedText}"),e?l+=`selectedText: +`,includedFiles:Array.from(i)};let{variablesMap:a,includedFiles:s}=await p0n(t,r,n);s.forEach(f=>i.add(f));let u=t,l="",c=null;u.includes("{}")&&(u=u.replace(/\{\}/g,"{selectedText}"),e?l+=`selectedText: -${e}`:n?(c=await pF(n,r),l+=`selectedText (entire active note): +${e}`:n?(c=await mF(n,r),l+=`selectedText (entire active note): ${c}`,i.add(n)):l+=`selectedText: @@ -868,23 +868,23 @@ ${f}: ${p}`:l+=`${f}: -${p}`);let d=NC(u,r);for(let f of d)if(!i.has(f)){let p=await pF(f,r);if(p){let m=`<${f4}> +${p}`);let d=DC(u,r);for(let f of d)if(!i.has(f)){let p=await mF(f,r);if(p){let m=`<${p4}> Title: [[${f.basename}]] Path: ${f.path} ${p} -`;l&&(l+=` +`;l&&(l+=` `),l+=`${m}`,i.add(f)}}return{processedPrompt:l?`${u} ${l}`:`${u} -`,includedFiles:Array.from(i)}}Cl();Fd();ti();var T3t=require("obsidian"),DD=F(X()),A3t=F(Dc());function l0n({content:t,onConfirm:e,onCancel:r,confirmButtonText:n,cancelButtonText:o}){return DD.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-5"},DD.default.createElement("div",{className:"tw-whitespace-pre-wrap"},t),DD.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},o&&DD.default.createElement(ge,{variant:"secondary",onClick:r},o),n&&DD.default.createElement(ge,{variant:"default",onClick:e},n)))}var sd=class extends T3t.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,A3t.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(DD.default.createElement(l0n,{content:this.content,onConfirm:n,onCancel:o,confirmButtonText:this.confirmButtonText,cancelButtonText:this.cancelButtonText}))}onClose(){this.root.unmount()}};ti();var $i=F(X());var $l=F(X(),1);function IW(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var c0n=F(X(),1);function I3t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function cce(...t){return e=>{let r=!1,n=t.map(o=>{let i=I3t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:a,...s}=i,u=Wg.useMemo(()=>s,Object.values(s));return(0,aFe.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=Wg.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 Yi(t,e=[]){let r=[];function n(i,a){let s=Wg.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=Wg.useMemo(()=>m,Object.values(m));return(0,aFe.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=Wg.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>Wg.createContext(a));return function(s){let u=s?.[t]||i;return Wg.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,d0n(o,...e)]}function d0n(...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 Wg.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var eM=F(X(),1);var ZU=F(X(),1);function Ur(t){let e=ZU.useRef(t);return ZU.useEffect(()=>{e.current=t}),ZU.useMemo(()=>(...r)=>e.current?.(...r),[])}function ud({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=f0n({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=Ur(r),u=eM.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 f0n({defaultProp:t,onChange:e}){let r=eM.useState(t),[n]=r,o=eM.useRef(n),i=Ur(e);return eM.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var R3t=F(X(),1),y0n=F(ds(),1);var ld=F(X(),1);var XU=F(ft(),1),uFe=ld.forwardRef((t,e)=>{let{children:r,...n}=t,o=ld.Children.toArray(r),i=o.find(m0n);if(i){let a=i.props.children,s=o.map(u=>u===i?ld.Children.count(a)>1?ld.Children.only(null):ld.isValidElement(a)?a.props.children:null:u);return(0,XU.jsx)(sFe,{...n,ref:e,children:ld.isValidElement(a)?ld.cloneElement(a,void 0,s):null})}return(0,XU.jsx)(sFe,{...n,ref:e,children:r})});uFe.displayName="Slot";var sFe=ld.forwardRef((t,e)=>{let{children:r,...n}=t;if(ld.isValidElement(r)){let o=g0n(r);return ld.cloneElement(r,{...h0n(n,r.props),ref:e?cce(e,o):o})}return ld.Children.count(r)>1?ld.Children.only(null):null});sFe.displayName="SlotClone";var p0n=({children:t})=>(0,XU.jsx)(XU.Fragment,{children:t});function m0n(t){return ld.isValidElement(t)&&t.type===p0n}function h0n(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 g0n(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 j3t=F(ft(),1),b0n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],N3t=b0n.reduce((t,e)=>{let r=R3t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?uFe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,j3t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var zt=F(X(),1);function Zi(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var rM=F(X(),1);var L3t=F(X(),1);function D3t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function MW(...t){return e=>{let r=!1,n=t.map(o=>{let i=D3t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:r,...n}=t,o=dd.Children.toArray(r),i=o.find(v0n);if(i){let a=i.props.children,s=o.map(u=>u===i?dd.Children.count(a)>1?dd.Children.only(null):dd.isValidElement(a)?a.props.children:null:u);return(0,QU.jsx)(lFe,{...n,ref:e,children:dd.isValidElement(a)?dd.cloneElement(a,void 0,s):null})}return(0,QU.jsx)(lFe,{...n,ref:e,children:r})});tM.displayName="Slot";var lFe=dd.forwardRef((t,e)=>{let{children:r,...n}=t;if(dd.isValidElement(r)){let o=S0n(r);return dd.cloneElement(r,{...w0n(n,r.props),ref:e?MW(e,o):o})}return dd.Children.count(r)>1?dd.Children.only(null):null});lFe.displayName="SlotClone";var _0n=({children:t})=>(0,QU.jsx)(QU.Fragment,{children:t});function v0n(t){return dd.isValidElement(t)&&t.type===_0n}function w0n(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 S0n(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 dce=F(ft(),1);function F3t(t){let e=t+"CollectionProvider",[r,n]=Yi(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=rM.default.useRef(null),g=rM.default.useRef(new Map).current;return(0,dce.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=rM.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),y=cd(m,g.collectionRef);return(0,dce.jsx)(tM,{ref:y,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=rM.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,y=rM.default.useRef(null),S=cd(m,y),x=i(l,h);return rM.default.useEffect(()=>(x.itemMap.set(y,{ref:y,...g}),()=>void x.itemMap.delete(y))),(0,dce.jsx)(tM,{[c]:"",ref:S,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return rM.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,O)=>g.indexOf(x.ref.current)-g.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var fce=F(X(),1),x0n=F(ft(),1),C0n=fce.createContext(void 0);function nM(t){let e=fce.useContext(C0n);return t||e||"ltr"}var Qa=F(X(),1);var k3t=F(X(),1),$3t=F(ds(),1);var B3t=F(ft(),1),O0n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_c=O0n.reduce((t,e)=>{let r=k3t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?tM:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,B3t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function pce(t,e){t&&$3t.flushSync(()=>t.dispatchEvent(e))}var q3t=F(X(),1);function oM(t,e=globalThis?.document){let r=Ur(t);q3t.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 dFe=F(ft(),1),P0n="DismissableLayer",cFe="dismissableLayer.update",E0n="dismissableLayer.pointerDownOutside",T0n="dismissableLayer.focusOutside",U3t,H3t=Qa.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fFe=Qa.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Qa.useContext(H3t),[c,d]=Qa.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Qa.useState({}),m=cd(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=M0n(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=R0n(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return oM(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Qa.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(U3t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),z3t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=U3t)}},[c,f,r,l]),Qa.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),z3t())},[c,l]),Qa.useEffect(()=>{let E=()=>p({});return document.addEventListener(cFe,E),()=>document.removeEventListener(cFe,E)},[]),(0,dFe.jsx)(_c.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:Zi(t.onFocusCapture,P.onFocusCapture),onBlurCapture:Zi(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Zi(t.onPointerDownCapture,O.onPointerDownCapture)})});fFe.displayName=P0n;var A0n="DismissableLayerBranch",I0n=Qa.forwardRef((t,e)=>{let r=Qa.useContext(H3t),n=Qa.useRef(null),o=cd(e,n);return Qa.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,dFe.jsx)(_c.div,{...t,ref:o})});I0n.displayName=A0n;function M0n(t,e=globalThis?.document){let r=Ur(t),n=Qa.useRef(!1),o=Qa.useRef(()=>{});return Qa.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){V3t(E0n,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 R0n(t,e=globalThis?.document){let r=Ur(t),n=Qa.useRef(!1);return Qa.useEffect(()=>{let o=i=>{i.target&&!n.current&&V3t(T0n,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 z3t(){let t=new CustomEvent(cFe);document.dispatchEvent(t)}function V3t(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?pce(o,i):o.dispatchEvent(i)}var K3t=F(X(),1),pFe=0;function iM(){K3t.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??W3t()),document.body.insertAdjacentElement("beforeend",t[1]??W3t()),pFe++,()=>{pFe===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),pFe--}},[])}function W3t(){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 Kg=F(X(),1);var X3t=F(ft(),1),mFe="focusScope.autoFocusOnMount",hFe="focusScope.autoFocusOnUnmount",G3t={bubbles:!1,cancelable:!0},j0n="FocusScope",gFe=Kg.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Kg.useState(null),l=Ur(o),c=Ur(i),d=Kg.useRef(null),f=cd(e,h=>u(h)),p=Kg.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Kg.useEffect(()=>{if(n){let y=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:aM(d.current,{select:!0})},S=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||aM(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&aM(s)};var h=y,b=S,g=x;document.addEventListener("focusin",y),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),Kg.useEffect(()=>{if(s){Y3t.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(mFe,G3t);s.addEventListener(mFe,l),s.dispatchEvent(g),g.defaultPrevented||(N0n($0n(Q3t(s)),{select:!0}),document.activeElement===h&&aM(s))}return()=>{s.removeEventListener(mFe,l),setTimeout(()=>{let g=new CustomEvent(hFe,G3t);s.addEventListener(hFe,c),s.dispatchEvent(g),g.defaultPrevented||aM(h??document.body,{select:!0}),s.removeEventListener(hFe,c),Y3t.remove(p)},0)}}},[s,l,c,p]);let m=Kg.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let y=h.currentTarget,[S,x]=D0n(y);S&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&aM(S,{select:!0})):h.shiftKey&&g===S&&(h.preventDefault(),r&&aM(x,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,X3t.jsx)(_c.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});gFe.displayName=j0n;function N0n(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(aM(n,{select:e}),document.activeElement!==r)return}function D0n(t){let e=Q3t(t),r=J3t(e,t),n=J3t(e.reverse(),t);return[r,n]}function Q3t(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 J3t(t,e){for(let r of t)if(!L0n(r,{upTo:e}))return r}function L0n(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 F0n(t){return t instanceof HTMLInputElement&&"select"in t}function aM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&F0n(t)&&e&&t.select()}}var Y3t=k0n();function k0n(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Z3t(t,e),t.unshift(e)},remove(e){t=Z3t(t,e),t[0]?.resume()}}}function Z3t(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function $0n(t){return t.filter(e=>e.tagName!=="A")}var mce=F(X(),1);var eHt=F(X(),1),Jn=globalThis?.document?eHt.useLayoutEffect:()=>{};var B0n=mce.useId||(()=>{}),q0n=0;function hl(t){let[e,r]=mce.useState(B0n());return Jn(()=>{t||r(n=>n??String(q0n++))},[t]),t||(e?`radix-${e}`:"")}var lh=F(X(),1);var tHt=["top","right","bottom","left"];var Jx=Math.min,rp=Math.max,jW=Math.round,NW=Math.floor,bb=t=>({x:t,y:t}),U0n={left:"right",right:"left",bottom:"top",top:"bottom"},z0n={start:"end",end:"start"};function gce(t,e,r){return rp(t,Jx(e,r))}function Yx(t,e){return typeof t=="function"?t(e):t}function Zx(t){return t.split("-")[0]}function LD(t){return t.split("-")[1]}function yce(t){return t==="x"?"y":"x"}function bce(t){return t==="y"?"height":"width"}function rE(t){return["top","bottom"].includes(Zx(t))?"y":"x"}function _ce(t){return yce(rE(t))}function rHt(t,e,r){r===void 0&&(r=!1);let n=LD(t),o=_ce(t),i=bce(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=RW(a)),[a,RW(a)]}function nHt(t){let e=RW(t);return[hce(t),e,hce(e)]}function hce(t){return t.replace(/start|end/g,e=>z0n[e])}function H0n(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 oHt(t,e,r,n){let o=LD(t),i=H0n(Zx(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(hce)))),i}function RW(t){return t.replace(/left|right|bottom|top/g,e=>U0n[e])}function V0n(t){return{top:0,right:0,bottom:0,left:0,...t}}function yFe(t){return typeof t!="number"?V0n(t):{top:t,right:t,bottom:t,left:t}}function FD(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 iHt(t,e,r){let{reference:n,floating:o}=t,i=rE(e),a=_ce(e),s=bce(a),u=Zx(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(LD(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var uHt=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}=iHt(l,n,u),f=n,p={},m=0;for(let h=0;h({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}=Yx(t,e)||{};if(l==null)return{};let d=yFe(c),f={x:r,y:n},p=_ce(o),m=bce(p),h=await a.getDimensions(l),b=p==="y",g=b?"top":"left",y=b?"bottom":"right",S=b?"clientHeight":"clientWidth",x=i.reference[m]+i.reference[p]-f[p]-i.floating[m],O=f[p]-i.reference[p],P=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),E=P?P[S]:0;(!E||!await(a.isElement==null?void 0:a.isElement(P)))&&(E=s.floating[S]||i.floating[m]);let A=x/2-O/2,I=E/2-h[m]/2-1,R=Jx(d[g],I),N=Jx(d[y],I),j=R,$=E-h[m]-N,k=E/2-h[m]/2+A,z=gce(j,k,$),V=!u.arrow&&LD(o)!=null&&k!==z&&i.reference[m]/2-(kk<=0)){var N,j;let k=(((N=i.flip)==null?void 0:N.index)||0)+1,z=E[k];if(z)return{data:{index:k,overflows:R},reset:{placement:z}};let V=(j=R.filter(Q=>Q.overflows[0]<=0).sort((Q,J)=>Q.overflows[1]-J.overflows[1])[0])==null?void 0:j.placement;if(!V)switch(p){case"bestFit":{var $;let Q=($=R.filter(J=>{if(P){let D=rE(J.placement);return D===y||D==="y"}return!0}).map(J=>[J.placement,J.overflows.filter(D=>D>0).reduce((D,B)=>D+B,0)]).sort((J,D)=>J[1]-D[1])[0])==null?void 0:$[0];Q&&(V=Q);break}case"initialPlacement":V=s;break}if(o!==V)return{reset:{placement:V}}}return{}}}};function aHt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function sHt(t){return tHt.some(e=>t[e]>=0)}var dHt=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=Yx(t,e);switch(n){case"referenceHidden":{let i=await ez(e,{...o,elementContext:"reference"}),a=aHt(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:sHt(a)}}}case"escaped":{let i=await ez(e,{...o,altBoundary:!0}),a=aHt(i,r.floating);return{data:{escapedOffsets:a,escaped:sHt(a)}}}default:return{}}}}};async function W0n(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=Zx(r),s=LD(r),u=rE(r)==="y",l=["left","top"].includes(a)?-1:1,c=i&&u?-1:1,d=Yx(e,t),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m=="number"&&(p=s==="end"?m*-1:m),u?{x:p*c,y:f*l}:{x:f*l,y:p*c}}var fHt=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 W0n(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}}}}},pHt=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:b=>{let{x:g,y}=b;return{x:g,y}}},...u}=Yx(t,e),l={x:r,y:n},c=await ez(e,u),d=rE(Zx(o)),f=yce(d),p=l[f],m=l[d];if(i){let b=f==="y"?"top":"left",g=f==="y"?"bottom":"right",y=p+c[b],S=p-c[g];p=gce(y,p,S)}if(a){let b=d==="y"?"top":"left",g=d==="y"?"bottom":"right",y=m+c[b],S=m-c[g];m=gce(y,m,S)}let h=s.fn({...e,[f]:p,[d]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:i,[d]:a}}}}}},mHt=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}=Yx(t,e),c={x:r,y:n},d=rE(o),f=yce(d),p=c[f],m=c[d],h=Yx(s,e),b=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){let S=f==="y"?"height":"width",x=i.reference[f]-i.floating[S]+b.mainAxis,O=i.reference[f]+i.reference[S]-b.mainAxis;pO&&(p=O)}if(l){var g,y;let S=f==="y"?"width":"height",x=["top","left"].includes(Zx(o)),O=i.reference[d]-i.floating[S]+(x&&((g=a.offset)==null?void 0:g[d])||0)+(x?0:b.crossAxis),P=i.reference[d]+i.reference[S]+(x?0:((y=a.offset)==null?void 0:y[d])||0)-(x?b.crossAxis:0);mP&&(m=P)}return{[f]:p,[d]:m}}}},hHt=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}=Yx(t,e),c=await ez(e,l),d=Zx(o),f=LD(o),p=rE(o)==="y",{width:m,height:h}=i.floating,b,g;d==="top"||d==="bottom"?(b=d,g=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(g=d,b=f==="end"?"top":"bottom");let y=h-c.top-c.bottom,S=m-c.left-c.right,x=Jx(h-c[b],y),O=Jx(m-c[g],S),P=!e.middlewareData.shift,E=x,A=O;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(A=S),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(E=y),P&&!f){let R=rp(c.left,0),N=rp(c.right,0),j=rp(c.top,0),$=rp(c.bottom,0);p?A=m-2*(R!==0||N!==0?R+N:rp(c.left,c.right)):E=h-2*(j!==0||$!==0?j+$:rp(c.top,c.bottom))}await u({...e,availableWidth:A,availableHeight:E});let I=await a.getDimensions(s.floating);return m!==I.width||h!==I.height?{reset:{rects:!0}}:{}}}};function vce(){return typeof window<"u"}function $D(t){return yHt(t)?(t.nodeName||"").toLowerCase():"#document"}function im(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function _b(t){var e;return(e=(yHt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function yHt(t){return vce()?t instanceof Node||t instanceof im(t).Node:!1}function Gg(t){return vce()?t instanceof Element||t instanceof im(t).Element:!1}function vb(t){return vce()?t instanceof HTMLElement||t instanceof im(t).HTMLElement:!1}function gHt(t){return!vce()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof im(t).ShadowRoot}function tz(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=Jg(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(o)}function bHt(t){return["table","td","th"].includes($D(t))}function DW(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function wce(t){let e=Sce(),r=Gg(t)?Jg(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 _Ht(t){let e=nE(t);for(;vb(e)&&!BD(e);){if(wce(e))return e;if(DW(e))return null;e=nE(e)}return null}function Sce(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function BD(t){return["html","body","#document"].includes($D(t))}function Jg(t){return im(t).getComputedStyle(t)}function LW(t){return Gg(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function nE(t){if($D(t)==="html")return t;let e=t.assignedSlot||t.parentNode||gHt(t)&&t.host||_b(t);return gHt(e)?e.host:e}function vHt(t){let e=nE(t);return BD(e)?t.ownerDocument?t.ownerDocument.body:t.body:vb(e)&&tz(e)?e:vHt(e)}function kD(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=vHt(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=im(o);if(i){let s=xce(a);return e.concat(a,a.visualViewport||[],tz(o)?o:[],s&&r?kD(s):[])}return e.concat(o,kD(o,[],r))}function xce(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function xHt(t){let e=Jg(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=vb(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=jW(r)!==i||jW(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function _Fe(t){return Gg(t)?t:t.contextElement}function rz(t){let e=_Fe(t);if(!vb(e))return bb(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=xHt(e),a=(i?jW(r.width):r.width)/n,s=(i?jW(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var K0n=bb(0);function CHt(t){let e=im(t);return!Sce()||!e.visualViewport?K0n:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function G0n(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==im(t)?!1:e}function qD(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=_Fe(t),a=bb(1);e&&(n?Gg(n)&&(a=rz(n)):a=rz(t));let s=G0n(i,r,n)?CHt(i):bb(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=im(i),p=n&&Gg(n)?im(n):n,m=f,h=xce(m);for(;h&&n&&p!==m;){let b=rz(h),g=h.getBoundingClientRect(),y=Jg(h),S=g.left+(h.clientLeft+parseFloat(y.paddingLeft))*b.x,x=g.top+(h.clientTop+parseFloat(y.paddingTop))*b.y;u*=b.x,l*=b.y,c*=b.x,d*=b.y,u+=S,l+=x,m=im(h),h=xce(m)}}return FD({width:c,height:d,x:u,y:l})}function vFe(t,e){let r=LW(t).scrollLeft;return e?e.left+r:qD(_b(t)).left+r}function OHt(t,e,r){r===void 0&&(r=!1);let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-(r?0:vFe(t,n)),i=n.top+e.scrollTop;return{x:o,y:i}}function J0n(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=_b(n),s=e?DW(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=bb(1),c=bb(0),d=vb(n);if((d||!d&&!i)&&(($D(n)!=="body"||tz(a))&&(u=LW(n)),vb(n))){let p=qD(n);l=rz(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?OHt(a,u,!0):bb(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 Y0n(t){return Array.from(t.getClientRects())}function Z0n(t){let e=_b(t),r=LW(t),n=t.ownerDocument.body,o=rp(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=rp(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+vFe(t),s=-r.scrollTop;return Jg(n).direction==="rtl"&&(a+=rp(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function X0n(t,e){let r=im(t),n=_b(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let l=Sce();(!l||l&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:i,height:a,x:s,y:u}}function Q0n(t,e){let r=qD(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=vb(t)?rz(t):bb(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 wHt(t,e,r){let n;if(e==="viewport")n=X0n(t,r);else if(e==="document")n=Z0n(_b(t));else if(Gg(e))n=Q0n(e,r);else{let o=CHt(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return FD(n)}function PHt(t,e){let r=nE(t);return r===e||!Gg(r)||BD(r)?!1:Jg(r).position==="fixed"||PHt(r,e)}function eSn(t,e){let r=e.get(t);if(r)return r;let n=kD(t,[],!1).filter(s=>Gg(s)&&$D(s)!=="body"),o=null,i=Jg(t).position==="fixed",a=i?nE(t):t;for(;Gg(a)&&!BD(a);){let s=Jg(a),u=wce(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||tz(a)&&!u&&PHt(t,a))?n=n.filter(c=>c!==a):o=s,a=nE(a)}return e.set(t,n),n}function tSn(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?DW(e)?[]:eSn(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=wHt(e,c,o);return l.top=rp(d.top,l.top),l.right=Jx(d.right,l.right),l.bottom=Jx(d.bottom,l.bottom),l.left=rp(d.left,l.left),l},wHt(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function rSn(t){let{width:e,height:r}=xHt(t);return{width:e,height:r}}function nSn(t,e,r){let n=vb(e),o=_b(e),i=r==="fixed",a=qD(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=bb(0);if(n||!n&&!i)if(($D(e)!=="body"||tz(o))&&(s=LW(e)),n){let f=qD(e,!0,i,e);u.x=f.x+e.clientLeft,u.y=f.y+e.clientTop}else o&&(u.x=vFe(o));let l=o&&!n&&!i?OHt(o,s):bb(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 bFe(t){return Jg(t).position==="static"}function SHt(t,e){if(!vb(t)||Jg(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return _b(t)===r&&(r=r.ownerDocument.body),r}function EHt(t,e){let r=im(t);if(DW(t))return r;if(!vb(t)){let o=nE(t);for(;o&&!BD(o);){if(Gg(o)&&!bFe(o))return o;o=nE(o)}return r}let n=SHt(t,e);for(;n&&bHt(n)&&bFe(n);)n=SHt(n,e);return n&&BD(n)&&bFe(n)&&!wce(n)?r:n||_Ht(t)||r}var oSn=async function(t){let e=this.getOffsetParent||EHt,r=this.getDimensions,n=await r(t.floating);return{reference:nSn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function iSn(t){return Jg(t).direction==="rtl"}var THt={convertOffsetParentRelativeRectToViewportRelativeRect:J0n,getDocumentElement:_b,getClippingRect:tSn,getOffsetParent:EHt,getElementRects:oSn,getClientRects:Y0n,getDimensions:rSn,getScale:rz,isElement:Gg,isRTL:iSn};function aSn(t,e){let r=null,n,o=_b(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=NW(c),m=NW(o.clientWidth-(l+d)),h=NW(o.clientHeight-(c+f)),b=NW(l),y={rootMargin:-p+"px "+-m+"px "+-h+"px "+-b+"px",threshold:rp(0,Jx(1,u))||1},S=!0;function x(O){let P=O[0].intersectionRatio;if(P!==u){if(!S)return a();P?a(!1,P):n=setTimeout(()=>{a(!1,1e-7)},1e3)}S=!1}try{r=new IntersectionObserver(x,{...y,root:o.ownerDocument})}catch{r=new IntersectionObserver(x,y)}r.observe(t)}return a(!0),i}function oE(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=_Fe(t),c=o||i?[...l?kD(l):[],...kD(e)]:[];c.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});let d=l&&s?aSn(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(g=>{let[y]=g;y&&y.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var S;(S=p)==null||S.observe(e)})),r()}),l&&!u&&p.observe(l),p.observe(e));let m,h=u?qD(t):null;u&&b();function b(){let g=qD(t);h&&(g.x!==h.x||g.y!==h.y||g.width!==h.width||g.height!==h.height)&&r(),h=g,m=requestAnimationFrame(b)}return r(),()=>{var g;c.forEach(y=>{o&&y.removeEventListener("scroll",r),i&&y.removeEventListener("resize",r)}),d?.(),(g=p)==null||g.disconnect(),p=null,u&&cancelAnimationFrame(m)}}var AHt=fHt;var IHt=pHt,MHt=cHt,RHt=hHt,jHt=dHt,wFe=lHt;var NHt=mHt,SFe=(t,e,r)=>{let n=new Map,o={platform:THt,...r},i={...o.platform,_c:n};return uHt(t,e,{...o,platform:i})};var gl=F(X(),1),Pce=F(X(),1),LHt=F(ds(),1),Cce=typeof document<"u"?Pce.useLayoutEffect:Pce.useEffect;function Oce(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(!Oce(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)&&!Oce(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function FHt(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function DHt(t,e){let r=FHt(t);return Math.round(e*r)/r}function xFe(t){let e=gl.useRef(t);return Cce(()=>{e.current=t}),e}function sM(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]=gl.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=gl.useState(n);Oce(f,n)||p(n);let[m,h]=gl.useState(null),[b,g]=gl.useState(null),y=gl.useCallback(J=>{J!==P.current&&(P.current=J,h(J))},[]),S=gl.useCallback(J=>{J!==E.current&&(E.current=J,g(J))},[]),x=i||m,O=a||b,P=gl.useRef(null),E=gl.useRef(null),A=gl.useRef(c),I=u!=null,R=xFe(u),N=xFe(o),j=xFe(l),$=gl.useCallback(()=>{if(!P.current||!E.current)return;let J={placement:e,strategy:r,middleware:f};N.current&&(J.platform=N.current),SFe(P.current,E.current,J).then(D=>{let B={...D,isPositioned:j.current!==!1};k.current&&!Oce(A.current,B)&&(A.current=B,LHt.flushSync(()=>{d(B)}))})},[f,e,r,N,j]);Cce(()=>{l===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,d(J=>({...J,isPositioned:!1})))},[l]);let k=gl.useRef(!1);Cce(()=>(k.current=!0,()=>{k.current=!1}),[]),Cce(()=>{if(x&&(P.current=x),O&&(E.current=O),x&&O){if(R.current)return R.current(x,O,$);$()}},[x,O,$,R,I]);let z=gl.useMemo(()=>({reference:P,floating:E,setReference:y,setFloating:S}),[y,S]),V=gl.useMemo(()=>({reference:x,floating:O}),[x,O]),Q=gl.useMemo(()=>{let J={position:r,left:0,top:0};if(!V.floating)return J;let D=DHt(V.floating,c.x),B=DHt(V.floating,c.y);return s?{...J,transform:"translate("+D+"px, "+B+"px)",...FHt(V.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:D,top:B}},[r,s,V.floating,c.x,c.y]);return gl.useMemo(()=>({...c,update:$,refs:z,elements:V,floatingStyles:Q}),[c,$,z,V,Q])}var sSn=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?wFe({element:n.current,padding:o}).fn(r):{}:n?wFe({element:n,padding:o}).fn(r):{}}}},uM=(t,e)=>({...AHt(t),options:[t,e]}),lM=(t,e)=>({...IHt(t),options:[t,e]}),cM=(t,e)=>({...NHt(t),options:[t,e]}),dM=(t,e)=>({...MHt(t),options:[t,e]}),fM=(t,e)=>({...RHt(t),options:[t,e]});var pM=(t,e)=>({...jHt(t),options:[t,e]});var mM=(t,e)=>({...sSn(t),options:[t,e]});var kHt=F(X(),1);var CFe=F(ft(),1),uSn="Arrow",$Ht=kHt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,CFe.jsx)(_c.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,CFe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});$Ht.displayName=uSn;var BHt=$Ht;var qHt=F(X(),1);function Xx(t){let[e,r]=qHt.useState(void 0);return Jn(()=>{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 hM=F(ft(),1);var OFe="Popper",[UHt,PFe]=Yi(OFe),[cSn,zHt]=UHt(OFe),HHt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=lh.useState(null);return(0,hM.jsx)(cSn,{scope:e,anchor:n,onAnchorChange:o,children:r})};HHt.displayName=OFe;var VHt="PopperAnchor",WHt=lh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=zHt(VHt,r),a=lh.useRef(null),s=cd(e,a);return lh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,hM.jsx)(_c.div,{...o,ref:s})});WHt.displayName=VHt;var EFe="PopperContent",[dSn,fSn]=UHt(EFe),KHt=lh.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=zHt(EFe,r),[g,y]=lh.useState(null),S=cd(e,Y=>y(Y)),[x,O]=lh.useState(null),P=Xx(x),E=P?.width??0,A=P?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],j=N.length>0,$={padding:R,boundary:N.filter(mSn),altBoundary:j},{refs:k,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:J}=sM({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>oE(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[uM({mainAxis:o+A,alignmentAxis:a}),u&&lM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cM():void 0,...$}),u&&dM({...$}),fM({...$,apply:({elements:Y,rects:ae,availableWidth:Oe,availableHeight:le})=>{let{width:Be,height:ze}=ae.reference,rt=Y.floating.style;rt.setProperty("--radix-popper-available-width",`${Oe}px`),rt.setProperty("--radix-popper-available-height",`${le}px`),rt.setProperty("--radix-popper-anchor-width",`${Be}px`),rt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),x&&mM({element:x,padding:s}),hSn({arrowWidth:E,arrowHeight:A}),f&&pM({strategy:"referenceHidden",...$})]}),[D,B]=YHt(V),q=Ur(m);Jn(()=>{Q&&q?.()},[Q,q]);let K=J.arrow?.x,H=J.arrow?.y,ee=J.arrow?.centerOffset!==0,[U,W]=lh.useState();return Jn(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,hM.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,hM.jsx)(dSn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:H,shouldHideArrow:ee,children:(0,hM.jsx)(_c.div,{"data-side":D,"data-align":B,...h,ref:S,style:{...h.style,animation:Q?void 0:"none"}})})})});KHt.displayName=EFe;var GHt="PopperArrow",pSn={top:"bottom",right:"left",bottom:"top",left:"right"},JHt=lh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=fSn(GHt,n),a=pSn[i.placedSide];return(0,hM.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,hM.jsx)(BHt,{...o,ref:r,style:{...o.style,display:"block"}})})});JHt.displayName=GHt;function mSn(t){return t!==null}var hSn=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]=YHt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function YHt(t){let[e,r="center"]=t.split("-");return[e,r]}var TFe=HHt,ZHt=WHt,XHt=KHt,QHt=JHt;var Ece=F(X(),1),eVt=F(ds(),1);var tVt=F(ft(),1),ySn="Portal",AFe=Ece.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Ece.useState(!1);Jn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?eVt.default.createPortal((0,tVt.jsx)(_c.div,{...n,ref:e}),a):null});AFe.displayName=ySn;var am=F(X(),1);var nVt=F(X(),1);function rVt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function bSn(...t){return e=>{let r=!1,n=t.map(o=>{let i=rVt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;oe[r][n]??r,t)}var fd=t=>{let{present:e,children:r}=t,n=vSn(e),o=typeof r=="function"?r({present:n.isPresent}):am.Children.only(r),i=oVt(n.ref,wSn(o));return typeof r=="function"||n.isPresent?am.cloneElement(o,{ref:i}):null};fd.displayName="Presence";function vSn(t){let[e,r]=am.useState(),n=am.useRef({}),o=am.useRef(t),i=am.useRef("none"),a=t?"mounted":"unmounted",[s,u]=_Sn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return am.useEffect(()=>{let l=Tce(n.current);i.current=s==="mounted"?l:"none"},[s]),Jn(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Tce(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),Jn(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Tce(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let b=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},f=p=>{p.target===e&&(i.current=Tce(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:am.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function Tce(t){return t?.animationName||"none"}function wSn(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 vc=F(X(),1);function UD(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var gM=F(X(),1);var sVt=F(X(),1);function aVt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function IFe(...t){return e=>{let r=!1,n=t.map(o=>{let i=aVt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:r,...n}=t,o=pd.Children.toArray(r),i=o.find(xSn);if(i){let a=i.props.children,s=o.map(u=>u===i?pd.Children.count(a)>1?pd.Children.only(null):pd.isValidElement(a)?a.props.children:null:u);return(0,nz.jsx)(MFe,{...n,ref:e,children:pd.isValidElement(a)?pd.cloneElement(a,void 0,s):null})}return(0,nz.jsx)(MFe,{...n,ref:e,children:r})});oz.displayName="Slot";var MFe=pd.forwardRef((t,e)=>{let{children:r,...n}=t;if(pd.isValidElement(r)){let o=OSn(r);return pd.cloneElement(r,{...CSn(n,r.props),ref:e?IFe(e,o):o})}return pd.Children.count(r)>1?pd.Children.only(null):null});MFe.displayName="SlotClone";var SSn=({children:t})=>(0,nz.jsx)(nz.Fragment,{children:t});function xSn(t){return pd.isValidElement(t)&&t.type===SSn}function CSn(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 OSn(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 Ace=F(ft(),1);function uVt(t){let e=t+"CollectionProvider",[r,n]=Yi(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=gM.default.useRef(null),g=gM.default.useRef(new Map).current;return(0,Ace.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=gM.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),y=FW(m,g.collectionRef);return(0,Ace.jsx)(oz,{ref:y,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=gM.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,y=gM.default.useRef(null),S=FW(m,y),x=i(l,h);return gM.default.useEffect(()=>(x.itemMap.set(y,{ref:y,...g}),()=>void x.itemMap.delete(y))),(0,Ace.jsx)(oz,{[c]:"",ref:S,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return gM.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,O)=>g.indexOf(x.ref.current)-g.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var lVt=F(X(),1),PSn=F(ds(),1);var cVt=F(ft(),1),ESn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],RFe=ESn.reduce((t,e)=>{let r=lVt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?oz:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,cVt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var yM=F(ft(),1),jFe="rovingFocusGroup.onEntryFocus",TSn={bubbles:!1,cancelable:!0},Ice="RovingFocusGroup",[NFe,dVt,ASn]=uVt(Ice),[ISn,DFe]=Yi(Ice,[ASn]),[MSn,RSn]=ISn(Ice),fVt=vc.forwardRef((t,e)=>(0,yM.jsx)(NFe.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,yM.jsx)(NFe.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,yM.jsx)(jSn,{...t,ref:e})})}));fVt.displayName=Ice;var jSn=vc.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=vc.useRef(null),p=FW(e,f),m=nM(i),[h=null,b]=ud({prop:a,defaultProp:s,onChange:u}),[g,y]=vc.useState(!1),S=Ur(l),x=dVt(r),O=vc.useRef(!1),[P,E]=vc.useState(0);return vc.useEffect(()=>{let A=f.current;if(A)return A.addEventListener(jFe,S),()=>A.removeEventListener(jFe,S)},[S]),(0,yM.jsx)(MSn,{scope:r,orientation:n,dir:m,loop:o,currentTabStopId:h,onItemFocus:vc.useCallback(A=>b(A),[b]),onItemShiftTab:vc.useCallback(()=>y(!0),[]),onFocusableItemAdd:vc.useCallback(()=>E(A=>A+1),[]),onFocusableItemRemove:vc.useCallback(()=>E(A=>A-1),[]),children:(0,yM.jsx)(RFe.div,{tabIndex:g||P===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:UD(t.onMouseDown,()=>{O.current=!0}),onFocus:UD(t.onFocus,A=>{let I=!O.current;if(A.target===A.currentTarget&&I&&!g){let R=new CustomEvent(jFe,TSn);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){let N=x().filter(V=>V.focusable),j=N.find(V=>V.active),$=N.find(V=>V.id===h),z=[j,$,...N].filter(Boolean).map(V=>V.ref.current);hVt(z,c)}}O.current=!1}),onBlur:UD(t.onBlur,()=>y(!1))})})}),pVt="RovingFocusGroupItem",mVt=vc.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...a}=t,s=hl(),u=i||s,l=RSn(pVt,r),c=l.currentTabStopId===u,d=dVt(r),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return vc.useEffect(()=>{if(n)return f(),()=>p()},[n,f,p]),(0,yM.jsx)(NFe.ItemSlot,{scope:r,id:u,focusable:n,active:o,children:(0,yM.jsx)(RFe.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...a,ref:e,onMouseDown:UD(t.onMouseDown,m=>{n?l.onItemFocus(u):m.preventDefault()}),onFocus:UD(t.onFocus,()=>l.onItemFocus(u)),onKeyDown:UD(t.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){l.onItemShiftTab();return}if(m.target!==m.currentTarget)return;let h=LSn(m,l.orientation,l.dir);if(h!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let g=d().filter(y=>y.focusable).map(y=>y.ref.current);if(h==="last")g.reverse();else if(h==="prev"||h==="next"){h==="prev"&&g.reverse();let y=g.indexOf(m.currentTarget);g=l.loop?FSn(g,y+1):g.slice(y+1)}setTimeout(()=>hVt(g))}})})})});mVt.displayName=pVt;var NSn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function DSn(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function LSn(t,e,r){let n=DSn(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return NSn[n]}function hVt(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function FSn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var gVt=fVt,yVt=mVt;var $Sn=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},iz=new WeakMap,Mce=new WeakMap,Rce={},LFe=0,bVt=function(t){return t&&(t.host||bVt(t.parentNode))},BSn=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=bVt(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})},qSn=function(t,e,r,n){var o=BSn(e,Array.isArray(t)?t:[t]);Rce[r]||(Rce[r]=new WeakMap);var i=Rce[r],a=[],s=new Set,u=new Set(o),l=function(d){!d||s.has(d)||(s.add(d),l(d.parentNode))};o.forEach(l);var c=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else try{var p=f.getAttribute(n),m=p!==null&&p!=="false",h=(iz.get(f)||0)+1,b=(i.get(f)||0)+1;iz.set(f,h),i.set(f,b),a.push(f),h===1&&m&&Mce.set(f,!0),b===1&&f.setAttribute(r,"true"),m||f.setAttribute(n,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return c(e),s.clear(),LFe++,function(){a.forEach(function(d){var f=iz.get(d)-1,p=i.get(d)-1;iz.set(d,f),i.set(d,p),f||(Mce.has(d)||d.removeAttribute(n),Mce.delete(d)),p||d.removeAttribute(r)}),LFe--,LFe||(iz=new WeakMap,iz=new WeakMap,Mce=new WeakMap,Rce={})}},bM=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||$Sn(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),qSn(n,o,r,"aria-hidden")):function(){return null}};var yi=function(){return yi=Object.assign||function(e){for(var r,n=1,o=arguments.length;n"u")return GSn;var e=JSn(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 YSn=iE(),sz="data-scroll-locked",ZSn=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(FFe,` { +`,includedFiles:Array.from(i)}}Cl();Fd();ti();var j3t=require("obsidian"),LD=F(X()),N3t=F(Dc());function m0n({content:t,onConfirm:e,onCancel:r,confirmButtonText:n,cancelButtonText:o}){return LD.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-5"},LD.default.createElement("div",{className:"tw-whitespace-pre-wrap"},t),LD.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},o&&LD.default.createElement(ge,{variant:"secondary",onClick:r},o),n&&LD.default.createElement(ge,{variant:"default",onClick:e},n)))}var sd=class extends j3t.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,N3t.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(LD.default.createElement(m0n,{content:this.content,onConfirm:n,onCancel:o,confirmButtonText:this.confirmButtonText,cancelButtonText:this.cancelButtonText}))}onClose(){this.root.unmount()}};ti();var $i=F(X());var $l=F(X(),1);function MW(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var h0n=F(X(),1);function D3t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function pce(...t){return e=>{let r=!1,n=t.map(o=>{let i=D3t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:a,...s}=i,u=Wg.useMemo(()=>s,Object.values(s));return(0,uFe.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=Wg.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 Yi(t,e=[]){let r=[];function n(i,a){let s=Wg.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=Wg.useMemo(()=>m,Object.values(m));return(0,uFe.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=Wg.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>Wg.createContext(a));return function(s){let u=s?.[t]||i;return Wg.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,g0n(o,...e)]}function g0n(...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 Wg.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var eM=F(X(),1);var XU=F(X(),1);function Ur(t){let e=XU.useRef(t);return XU.useEffect(()=>{e.current=t}),XU.useMemo(()=>(...r)=>e.current?.(...r),[])}function ud({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=y0n({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=Ur(r),u=eM.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 y0n({defaultProp:t,onChange:e}){let r=eM.useState(t),[n]=r,o=eM.useRef(n),i=Ur(e);return eM.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var F3t=F(X(),1),S0n=F(ds(),1);var ld=F(X(),1);var QU=F(pt(),1),cFe=ld.forwardRef((t,e)=>{let{children:r,...n}=t,o=ld.Children.toArray(r),i=o.find(_0n);if(i){let a=i.props.children,s=o.map(u=>u===i?ld.Children.count(a)>1?ld.Children.only(null):ld.isValidElement(a)?a.props.children:null:u);return(0,QU.jsx)(lFe,{...n,ref:e,children:ld.isValidElement(a)?ld.cloneElement(a,void 0,s):null})}return(0,QU.jsx)(lFe,{...n,ref:e,children:r})});cFe.displayName="Slot";var lFe=ld.forwardRef((t,e)=>{let{children:r,...n}=t;if(ld.isValidElement(r)){let o=w0n(r);return ld.cloneElement(r,{...v0n(n,r.props),ref:e?pce(e,o):o})}return ld.Children.count(r)>1?ld.Children.only(null):null});lFe.displayName="SlotClone";var b0n=({children:t})=>(0,QU.jsx)(QU.Fragment,{children:t});function _0n(t){return ld.isValidElement(t)&&t.type===b0n}function v0n(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 w0n(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 k3t=F(pt(),1),x0n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],$3t=x0n.reduce((t,e)=>{let r=F3t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?cFe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,k3t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var zt=F(X(),1);function Zi(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var rM=F(X(),1);var q3t=F(X(),1);function B3t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function RW(...t){return e=>{let r=!1,n=t.map(o=>{let i=B3t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:r,...n}=t,o=dd.Children.toArray(r),i=o.find(O0n);if(i){let a=i.props.children,s=o.map(u=>u===i?dd.Children.count(a)>1?dd.Children.only(null):dd.isValidElement(a)?a.props.children:null:u);return(0,ez.jsx)(dFe,{...n,ref:e,children:dd.isValidElement(a)?dd.cloneElement(a,void 0,s):null})}return(0,ez.jsx)(dFe,{...n,ref:e,children:r})});tM.displayName="Slot";var dFe=dd.forwardRef((t,e)=>{let{children:r,...n}=t;if(dd.isValidElement(r)){let o=E0n(r);return dd.cloneElement(r,{...P0n(n,r.props),ref:e?RW(e,o):o})}return dd.Children.count(r)>1?dd.Children.only(null):null});dFe.displayName="SlotClone";var C0n=({children:t})=>(0,ez.jsx)(ez.Fragment,{children:t});function O0n(t){return dd.isValidElement(t)&&t.type===C0n}function P0n(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 E0n(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 mce=F(pt(),1);function U3t(t){let e=t+"CollectionProvider",[r,n]=Yi(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=rM.default.useRef(null),g=rM.default.useRef(new Map).current;return(0,mce.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=rM.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),y=cd(m,g.collectionRef);return(0,mce.jsx)(tM,{ref:y,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=rM.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,y=rM.default.useRef(null),S=cd(m,y),x=i(l,h);return rM.default.useEffect(()=>(x.itemMap.set(y,{ref:y,...g}),()=>void x.itemMap.delete(y))),(0,mce.jsx)(tM,{[c]:"",ref:S,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return rM.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,O)=>g.indexOf(x.ref.current)-g.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var hce=F(X(),1),T0n=F(pt(),1),A0n=hce.createContext(void 0);function nM(t){let e=hce.useContext(A0n);return t||e||"ltr"}var Qa=F(X(),1);var z3t=F(X(),1),H3t=F(ds(),1);var V3t=F(pt(),1),I0n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_c=I0n.reduce((t,e)=>{let r=z3t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?tM:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,V3t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function gce(t,e){t&&H3t.flushSync(()=>t.dispatchEvent(e))}var W3t=F(X(),1);function oM(t,e=globalThis?.document){let r=Ur(t);W3t.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 pFe=F(pt(),1),M0n="DismissableLayer",fFe="dismissableLayer.update",R0n="dismissableLayer.pointerDownOutside",j0n="dismissableLayer.focusOutside",K3t,J3t=Qa.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),mFe=Qa.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Qa.useContext(J3t),[c,d]=Qa.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Qa.useState({}),m=cd(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=L0n(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=F0n(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return oM(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Qa.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(K3t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),G3t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=K3t)}},[c,f,r,l]),Qa.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),G3t())},[c,l]),Qa.useEffect(()=>{let E=()=>p({});return document.addEventListener(fFe,E),()=>document.removeEventListener(fFe,E)},[]),(0,pFe.jsx)(_c.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:Zi(t.onFocusCapture,P.onFocusCapture),onBlurCapture:Zi(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Zi(t.onPointerDownCapture,O.onPointerDownCapture)})});mFe.displayName=M0n;var N0n="DismissableLayerBranch",D0n=Qa.forwardRef((t,e)=>{let r=Qa.useContext(J3t),n=Qa.useRef(null),o=cd(e,n);return Qa.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,pFe.jsx)(_c.div,{...t,ref:o})});D0n.displayName=N0n;function L0n(t,e=globalThis?.document){let r=Ur(t),n=Qa.useRef(!1),o=Qa.useRef(()=>{});return Qa.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Y3t(R0n,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 F0n(t,e=globalThis?.document){let r=Ur(t),n=Qa.useRef(!1);return Qa.useEffect(()=>{let o=i=>{i.target&&!n.current&&Y3t(j0n,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 G3t(){let t=new CustomEvent(fFe);document.dispatchEvent(t)}function Y3t(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?gce(o,i):o.dispatchEvent(i)}var X3t=F(X(),1),hFe=0;function iM(){X3t.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Z3t()),document.body.insertAdjacentElement("beforeend",t[1]??Z3t()),hFe++,()=>{hFe===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),hFe--}},[])}function Z3t(){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 Kg=F(X(),1);var nHt=F(pt(),1),gFe="focusScope.autoFocusOnMount",yFe="focusScope.autoFocusOnUnmount",Q3t={bubbles:!1,cancelable:!0},k0n="FocusScope",bFe=Kg.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Kg.useState(null),l=Ur(o),c=Ur(i),d=Kg.useRef(null),f=cd(e,h=>u(h)),p=Kg.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Kg.useEffect(()=>{if(n){let y=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:aM(d.current,{select:!0})},S=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||aM(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&aM(s)};var h=y,b=S,g=x;document.addEventListener("focusin",y),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),Kg.useEffect(()=>{if(s){tHt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(gFe,Q3t);s.addEventListener(gFe,l),s.dispatchEvent(g),g.defaultPrevented||($0n(H0n(oHt(s)),{select:!0}),document.activeElement===h&&aM(s))}return()=>{s.removeEventListener(gFe,l),setTimeout(()=>{let g=new CustomEvent(yFe,Q3t);s.addEventListener(yFe,c),s.dispatchEvent(g),g.defaultPrevented||aM(h??document.body,{select:!0}),s.removeEventListener(yFe,c),tHt.remove(p)},0)}}},[s,l,c,p]);let m=Kg.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let y=h.currentTarget,[S,x]=B0n(y);S&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&aM(S,{select:!0})):h.shiftKey&&g===S&&(h.preventDefault(),r&&aM(x,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,nHt.jsx)(_c.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});bFe.displayName=k0n;function $0n(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(aM(n,{select:e}),document.activeElement!==r)return}function B0n(t){let e=oHt(t),r=eHt(e,t),n=eHt(e.reverse(),t);return[r,n]}function oHt(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 eHt(t,e){for(let r of t)if(!q0n(r,{upTo:e}))return r}function q0n(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 U0n(t){return t instanceof HTMLInputElement&&"select"in t}function aM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&U0n(t)&&e&&t.select()}}var tHt=z0n();function z0n(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=rHt(t,e),t.unshift(e)},remove(e){t=rHt(t,e),t[0]?.resume()}}}function rHt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function H0n(t){return t.filter(e=>e.tagName!=="A")}var yce=F(X(),1);var iHt=F(X(),1),Jn=globalThis?.document?iHt.useLayoutEffect:()=>{};var V0n=yce.useId||(()=>{}),W0n=0;function hl(t){let[e,r]=yce.useState(V0n());return Jn(()=>{t||r(n=>n??String(W0n++))},[t]),t||(e?`radix-${e}`:"")}var lh=F(X(),1);var aHt=["top","right","bottom","left"];var Yx=Math.min,rp=Math.max,NW=Math.round,DW=Math.floor,bb=t=>({x:t,y:t}),K0n={left:"right",right:"left",bottom:"top",top:"bottom"},G0n={start:"end",end:"start"};function _ce(t,e,r){return rp(t,Yx(e,r))}function Zx(t,e){return typeof t=="function"?t(e):t}function Xx(t){return t.split("-")[0]}function FD(t){return t.split("-")[1]}function vce(t){return t==="x"?"y":"x"}function wce(t){return t==="y"?"height":"width"}function rE(t){return["top","bottom"].includes(Xx(t))?"y":"x"}function Sce(t){return vce(rE(t))}function sHt(t,e,r){r===void 0&&(r=!1);let n=FD(t),o=Sce(t),i=wce(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=jW(a)),[a,jW(a)]}function uHt(t){let e=jW(t);return[bce(t),e,bce(e)]}function bce(t){return t.replace(/start|end/g,e=>G0n[e])}function J0n(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 lHt(t,e,r,n){let o=FD(t),i=J0n(Xx(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(bce)))),i}function jW(t){return t.replace(/left|right|bottom|top/g,e=>K0n[e])}function Y0n(t){return{top:0,right:0,bottom:0,left:0,...t}}function _Fe(t){return typeof t!="number"?Y0n(t):{top:t,right:t,bottom:t,left:t}}function kD(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 cHt(t,e,r){let{reference:n,floating:o}=t,i=rE(e),a=Sce(e),s=wce(a),u=Xx(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(FD(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var pHt=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}=cHt(l,n,u),f=n,p={},m=0;for(let h=0;h({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}=Zx(t,e)||{};if(l==null)return{};let d=_Fe(c),f={x:r,y:n},p=Sce(o),m=wce(p),h=await a.getDimensions(l),b=p==="y",g=b?"top":"left",y=b?"bottom":"right",S=b?"clientHeight":"clientWidth",x=i.reference[m]+i.reference[p]-f[p]-i.floating[m],O=f[p]-i.reference[p],P=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),E=P?P[S]:0;(!E||!await(a.isElement==null?void 0:a.isElement(P)))&&(E=s.floating[S]||i.floating[m]);let A=x/2-O/2,I=E/2-h[m]/2-1,R=Yx(d[g],I),N=Yx(d[y],I),j=R,$=E-h[m]-N,k=E/2-h[m]/2+A,z=_ce(j,k,$),V=!u.arrow&&FD(o)!=null&&k!==z&&i.reference[m]/2-(kk<=0)){var N,j;let k=(((N=i.flip)==null?void 0:N.index)||0)+1,z=E[k];if(z)return{data:{index:k,overflows:R},reset:{placement:z}};let V=(j=R.filter(Q=>Q.overflows[0]<=0).sort((Q,J)=>Q.overflows[1]-J.overflows[1])[0])==null?void 0:j.placement;if(!V)switch(p){case"bestFit":{var $;let Q=($=R.filter(J=>{if(P){let D=rE(J.placement);return D===y||D==="y"}return!0}).map(J=>[J.placement,J.overflows.filter(D=>D>0).reduce((D,B)=>D+B,0)]).sort((J,D)=>J[1]-D[1])[0])==null?void 0:$[0];Q&&(V=Q);break}case"initialPlacement":V=s;break}if(o!==V)return{reset:{placement:V}}}return{}}}};function dHt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function fHt(t){return aHt.some(e=>t[e]>=0)}var gHt=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=Zx(t,e);switch(n){case"referenceHidden":{let i=await tz(e,{...o,elementContext:"reference"}),a=dHt(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:fHt(a)}}}case"escaped":{let i=await tz(e,{...o,altBoundary:!0}),a=dHt(i,r.floating);return{data:{escapedOffsets:a,escaped:fHt(a)}}}default:return{}}}}};async function Z0n(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=Xx(r),s=FD(r),u=rE(r)==="y",l=["left","top"].includes(a)?-1:1,c=i&&u?-1:1,d=Zx(e,t),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m=="number"&&(p=s==="end"?m*-1:m),u?{x:p*c,y:f*l}:{x:f*l,y:p*c}}var yHt=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 Z0n(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}}}}},bHt=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:b=>{let{x:g,y}=b;return{x:g,y}}},...u}=Zx(t,e),l={x:r,y:n},c=await tz(e,u),d=rE(Xx(o)),f=vce(d),p=l[f],m=l[d];if(i){let b=f==="y"?"top":"left",g=f==="y"?"bottom":"right",y=p+c[b],S=p-c[g];p=_ce(y,p,S)}if(a){let b=d==="y"?"top":"left",g=d==="y"?"bottom":"right",y=m+c[b],S=m-c[g];m=_ce(y,m,S)}let h=s.fn({...e,[f]:p,[d]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:i,[d]:a}}}}}},_Ht=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}=Zx(t,e),c={x:r,y:n},d=rE(o),f=vce(d),p=c[f],m=c[d],h=Zx(s,e),b=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){let S=f==="y"?"height":"width",x=i.reference[f]-i.floating[S]+b.mainAxis,O=i.reference[f]+i.reference[S]-b.mainAxis;pO&&(p=O)}if(l){var g,y;let S=f==="y"?"width":"height",x=["top","left"].includes(Xx(o)),O=i.reference[d]-i.floating[S]+(x&&((g=a.offset)==null?void 0:g[d])||0)+(x?0:b.crossAxis),P=i.reference[d]+i.reference[S]+(x?0:((y=a.offset)==null?void 0:y[d])||0)-(x?b.crossAxis:0);mP&&(m=P)}return{[f]:p,[d]:m}}}},vHt=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}=Zx(t,e),c=await tz(e,l),d=Xx(o),f=FD(o),p=rE(o)==="y",{width:m,height:h}=i.floating,b,g;d==="top"||d==="bottom"?(b=d,g=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(g=d,b=f==="end"?"top":"bottom");let y=h-c.top-c.bottom,S=m-c.left-c.right,x=Yx(h-c[b],y),O=Yx(m-c[g],S),P=!e.middlewareData.shift,E=x,A=O;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(A=S),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(E=y),P&&!f){let R=rp(c.left,0),N=rp(c.right,0),j=rp(c.top,0),$=rp(c.bottom,0);p?A=m-2*(R!==0||N!==0?R+N:rp(c.left,c.right)):E=h-2*(j!==0||$!==0?j+$:rp(c.top,c.bottom))}await u({...e,availableWidth:A,availableHeight:E});let I=await a.getDimensions(s.floating);return m!==I.width||h!==I.height?{reset:{rects:!0}}:{}}}};function xce(){return typeof window<"u"}function BD(t){return SHt(t)?(t.nodeName||"").toLowerCase():"#document"}function im(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function _b(t){var e;return(e=(SHt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function SHt(t){return xce()?t instanceof Node||t instanceof im(t).Node:!1}function Gg(t){return xce()?t instanceof Element||t instanceof im(t).Element:!1}function vb(t){return xce()?t instanceof HTMLElement||t instanceof im(t).HTMLElement:!1}function wHt(t){return!xce()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof im(t).ShadowRoot}function rz(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=Jg(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(o)}function xHt(t){return["table","td","th"].includes(BD(t))}function LW(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Cce(t){let e=Oce(),r=Gg(t)?Jg(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 CHt(t){let e=nE(t);for(;vb(e)&&!qD(e);){if(Cce(e))return e;if(LW(e))return null;e=nE(e)}return null}function Oce(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function qD(t){return["html","body","#document"].includes(BD(t))}function Jg(t){return im(t).getComputedStyle(t)}function FW(t){return Gg(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function nE(t){if(BD(t)==="html")return t;let e=t.assignedSlot||t.parentNode||wHt(t)&&t.host||_b(t);return wHt(e)?e.host:e}function OHt(t){let e=nE(t);return qD(e)?t.ownerDocument?t.ownerDocument.body:t.body:vb(e)&&rz(e)?e:OHt(e)}function $D(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=OHt(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=im(o);if(i){let s=Pce(a);return e.concat(a,a.visualViewport||[],rz(o)?o:[],s&&r?$D(s):[])}return e.concat(o,$D(o,[],r))}function Pce(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function THt(t){let e=Jg(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=vb(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=NW(r)!==i||NW(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function wFe(t){return Gg(t)?t:t.contextElement}function nz(t){let e=wFe(t);if(!vb(e))return bb(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=THt(e),a=(i?NW(r.width):r.width)/n,s=(i?NW(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var X0n=bb(0);function AHt(t){let e=im(t);return!Oce()||!e.visualViewport?X0n:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Q0n(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==im(t)?!1:e}function UD(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=wFe(t),a=bb(1);e&&(n?Gg(n)&&(a=nz(n)):a=nz(t));let s=Q0n(i,r,n)?AHt(i):bb(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=im(i),p=n&&Gg(n)?im(n):n,m=f,h=Pce(m);for(;h&&n&&p!==m;){let b=nz(h),g=h.getBoundingClientRect(),y=Jg(h),S=g.left+(h.clientLeft+parseFloat(y.paddingLeft))*b.x,x=g.top+(h.clientTop+parseFloat(y.paddingTop))*b.y;u*=b.x,l*=b.y,c*=b.x,d*=b.y,u+=S,l+=x,m=im(h),h=Pce(m)}}return kD({width:c,height:d,x:u,y:l})}function SFe(t,e){let r=FW(t).scrollLeft;return e?e.left+r:UD(_b(t)).left+r}function IHt(t,e,r){r===void 0&&(r=!1);let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-(r?0:SFe(t,n)),i=n.top+e.scrollTop;return{x:o,y:i}}function eSn(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=_b(n),s=e?LW(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=bb(1),c=bb(0),d=vb(n);if((d||!d&&!i)&&((BD(n)!=="body"||rz(a))&&(u=FW(n)),vb(n))){let p=UD(n);l=nz(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?IHt(a,u,!0):bb(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 tSn(t){return Array.from(t.getClientRects())}function rSn(t){let e=_b(t),r=FW(t),n=t.ownerDocument.body,o=rp(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=rp(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+SFe(t),s=-r.scrollTop;return Jg(n).direction==="rtl"&&(a+=rp(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function nSn(t,e){let r=im(t),n=_b(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let l=Oce();(!l||l&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:i,height:a,x:s,y:u}}function oSn(t,e){let r=UD(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=vb(t)?nz(t):bb(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 PHt(t,e,r){let n;if(e==="viewport")n=nSn(t,r);else if(e==="document")n=rSn(_b(t));else if(Gg(e))n=oSn(e,r);else{let o=AHt(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return kD(n)}function MHt(t,e){let r=nE(t);return r===e||!Gg(r)||qD(r)?!1:Jg(r).position==="fixed"||MHt(r,e)}function iSn(t,e){let r=e.get(t);if(r)return r;let n=$D(t,[],!1).filter(s=>Gg(s)&&BD(s)!=="body"),o=null,i=Jg(t).position==="fixed",a=i?nE(t):t;for(;Gg(a)&&!qD(a);){let s=Jg(a),u=Cce(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||rz(a)&&!u&&MHt(t,a))?n=n.filter(c=>c!==a):o=s,a=nE(a)}return e.set(t,n),n}function aSn(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?LW(e)?[]:iSn(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=PHt(e,c,o);return l.top=rp(d.top,l.top),l.right=Yx(d.right,l.right),l.bottom=Yx(d.bottom,l.bottom),l.left=rp(d.left,l.left),l},PHt(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function sSn(t){let{width:e,height:r}=THt(t);return{width:e,height:r}}function uSn(t,e,r){let n=vb(e),o=_b(e),i=r==="fixed",a=UD(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=bb(0);if(n||!n&&!i)if((BD(e)!=="body"||rz(o))&&(s=FW(e)),n){let f=UD(e,!0,i,e);u.x=f.x+e.clientLeft,u.y=f.y+e.clientTop}else o&&(u.x=SFe(o));let l=o&&!n&&!i?IHt(o,s):bb(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 vFe(t){return Jg(t).position==="static"}function EHt(t,e){if(!vb(t)||Jg(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return _b(t)===r&&(r=r.ownerDocument.body),r}function RHt(t,e){let r=im(t);if(LW(t))return r;if(!vb(t)){let o=nE(t);for(;o&&!qD(o);){if(Gg(o)&&!vFe(o))return o;o=nE(o)}return r}let n=EHt(t,e);for(;n&&xHt(n)&&vFe(n);)n=EHt(n,e);return n&&qD(n)&&vFe(n)&&!Cce(n)?r:n||CHt(t)||r}var lSn=async function(t){let e=this.getOffsetParent||RHt,r=this.getDimensions,n=await r(t.floating);return{reference:uSn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function cSn(t){return Jg(t).direction==="rtl"}var jHt={convertOffsetParentRelativeRectToViewportRelativeRect:eSn,getDocumentElement:_b,getClippingRect:aSn,getOffsetParent:RHt,getElementRects:lSn,getClientRects:tSn,getDimensions:sSn,getScale:nz,isElement:Gg,isRTL:cSn};function dSn(t,e){let r=null,n,o=_b(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=DW(c),m=DW(o.clientWidth-(l+d)),h=DW(o.clientHeight-(c+f)),b=DW(l),y={rootMargin:-p+"px "+-m+"px "+-h+"px "+-b+"px",threshold:rp(0,Yx(1,u))||1},S=!0;function x(O){let P=O[0].intersectionRatio;if(P!==u){if(!S)return a();P?a(!1,P):n=setTimeout(()=>{a(!1,1e-7)},1e3)}S=!1}try{r=new IntersectionObserver(x,{...y,root:o.ownerDocument})}catch{r=new IntersectionObserver(x,y)}r.observe(t)}return a(!0),i}function oE(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=wFe(t),c=o||i?[...l?$D(l):[],...$D(e)]:[];c.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});let d=l&&s?dSn(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(g=>{let[y]=g;y&&y.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var S;(S=p)==null||S.observe(e)})),r()}),l&&!u&&p.observe(l),p.observe(e));let m,h=u?UD(t):null;u&&b();function b(){let g=UD(t);h&&(g.x!==h.x||g.y!==h.y||g.width!==h.width||g.height!==h.height)&&r(),h=g,m=requestAnimationFrame(b)}return r(),()=>{var g;c.forEach(y=>{o&&y.removeEventListener("scroll",r),i&&y.removeEventListener("resize",r)}),d?.(),(g=p)==null||g.disconnect(),p=null,u&&cancelAnimationFrame(m)}}var NHt=yHt;var DHt=bHt,LHt=hHt,FHt=vHt,kHt=gHt,xFe=mHt;var $Ht=_Ht,CFe=(t,e,r)=>{let n=new Map,o={platform:jHt,...r},i={...o.platform,_c:n};return pHt(t,e,{...o,platform:i})};var gl=F(X(),1),Ace=F(X(),1),qHt=F(ds(),1),Ece=typeof document<"u"?Ace.useLayoutEffect:Ace.useEffect;function Tce(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(!Tce(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)&&!Tce(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function UHt(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function BHt(t,e){let r=UHt(t);return Math.round(e*r)/r}function OFe(t){let e=gl.useRef(t);return Ece(()=>{e.current=t}),e}function sM(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]=gl.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=gl.useState(n);Tce(f,n)||p(n);let[m,h]=gl.useState(null),[b,g]=gl.useState(null),y=gl.useCallback(J=>{J!==P.current&&(P.current=J,h(J))},[]),S=gl.useCallback(J=>{J!==E.current&&(E.current=J,g(J))},[]),x=i||m,O=a||b,P=gl.useRef(null),E=gl.useRef(null),A=gl.useRef(c),I=u!=null,R=OFe(u),N=OFe(o),j=OFe(l),$=gl.useCallback(()=>{if(!P.current||!E.current)return;let J={placement:e,strategy:r,middleware:f};N.current&&(J.platform=N.current),CFe(P.current,E.current,J).then(D=>{let B={...D,isPositioned:j.current!==!1};k.current&&!Tce(A.current,B)&&(A.current=B,qHt.flushSync(()=>{d(B)}))})},[f,e,r,N,j]);Ece(()=>{l===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,d(J=>({...J,isPositioned:!1})))},[l]);let k=gl.useRef(!1);Ece(()=>(k.current=!0,()=>{k.current=!1}),[]),Ece(()=>{if(x&&(P.current=x),O&&(E.current=O),x&&O){if(R.current)return R.current(x,O,$);$()}},[x,O,$,R,I]);let z=gl.useMemo(()=>({reference:P,floating:E,setReference:y,setFloating:S}),[y,S]),V=gl.useMemo(()=>({reference:x,floating:O}),[x,O]),Q=gl.useMemo(()=>{let J={position:r,left:0,top:0};if(!V.floating)return J;let D=BHt(V.floating,c.x),B=BHt(V.floating,c.y);return s?{...J,transform:"translate("+D+"px, "+B+"px)",...UHt(V.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:D,top:B}},[r,s,V.floating,c.x,c.y]);return gl.useMemo(()=>({...c,update:$,refs:z,elements:V,floatingStyles:Q}),[c,$,z,V,Q])}var fSn=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?xFe({element:n.current,padding:o}).fn(r):{}:n?xFe({element:n,padding:o}).fn(r):{}}}},uM=(t,e)=>({...NHt(t),options:[t,e]}),lM=(t,e)=>({...DHt(t),options:[t,e]}),cM=(t,e)=>({...$Ht(t),options:[t,e]}),dM=(t,e)=>({...LHt(t),options:[t,e]}),fM=(t,e)=>({...FHt(t),options:[t,e]});var pM=(t,e)=>({...kHt(t),options:[t,e]});var mM=(t,e)=>({...fSn(t),options:[t,e]});var zHt=F(X(),1);var PFe=F(pt(),1),pSn="Arrow",HHt=zHt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,PFe.jsx)(_c.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,PFe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});HHt.displayName=pSn;var VHt=HHt;var WHt=F(X(),1);function Qx(t){let[e,r]=WHt.useState(void 0);return Jn(()=>{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 hM=F(pt(),1);var EFe="Popper",[KHt,TFe]=Yi(EFe),[hSn,GHt]=KHt(EFe),JHt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=lh.useState(null);return(0,hM.jsx)(hSn,{scope:e,anchor:n,onAnchorChange:o,children:r})};JHt.displayName=EFe;var YHt="PopperAnchor",ZHt=lh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=GHt(YHt,r),a=lh.useRef(null),s=cd(e,a);return lh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,hM.jsx)(_c.div,{...o,ref:s})});ZHt.displayName=YHt;var AFe="PopperContent",[gSn,ySn]=KHt(AFe),XHt=lh.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=GHt(AFe,r),[g,y]=lh.useState(null),S=cd(e,Y=>y(Y)),[x,O]=lh.useState(null),P=Qx(x),E=P?.width??0,A=P?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],j=N.length>0,$={padding:R,boundary:N.filter(_Sn),altBoundary:j},{refs:k,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:J}=sM({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>oE(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[uM({mainAxis:o+A,alignmentAxis:a}),u&&lM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cM():void 0,...$}),u&&dM({...$}),fM({...$,apply:({elements:Y,rects:ae,availableWidth:Oe,availableHeight:le})=>{let{width:Be,height:ze}=ae.reference,rt=Y.floating.style;rt.setProperty("--radix-popper-available-width",`${Oe}px`),rt.setProperty("--radix-popper-available-height",`${le}px`),rt.setProperty("--radix-popper-anchor-width",`${Be}px`),rt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),x&&mM({element:x,padding:s}),vSn({arrowWidth:E,arrowHeight:A}),f&&pM({strategy:"referenceHidden",...$})]}),[D,B]=tVt(V),q=Ur(m);Jn(()=>{Q&&q?.()},[Q,q]);let K=J.arrow?.x,H=J.arrow?.y,ee=J.arrow?.centerOffset!==0,[U,W]=lh.useState();return Jn(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,hM.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,hM.jsx)(gSn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:H,shouldHideArrow:ee,children:(0,hM.jsx)(_c.div,{"data-side":D,"data-align":B,...h,ref:S,style:{...h.style,animation:Q?void 0:"none"}})})})});XHt.displayName=AFe;var QHt="PopperArrow",bSn={top:"bottom",right:"left",bottom:"top",left:"right"},eVt=lh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=ySn(QHt,n),a=bSn[i.placedSide];return(0,hM.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,hM.jsx)(VHt,{...o,ref:r,style:{...o.style,display:"block"}})})});eVt.displayName=QHt;function _Sn(t){return t!==null}var vSn=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]=tVt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function tVt(t){let[e,r="center"]=t.split("-");return[e,r]}var IFe=JHt,rVt=ZHt,nVt=XHt,oVt=eVt;var Ice=F(X(),1),iVt=F(ds(),1);var aVt=F(pt(),1),SSn="Portal",MFe=Ice.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Ice.useState(!1);Jn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?iVt.default.createPortal((0,aVt.jsx)(_c.div,{...n,ref:e}),a):null});MFe.displayName=SSn;var am=F(X(),1);var uVt=F(X(),1);function sVt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function xSn(...t){return e=>{let r=!1,n=t.map(o=>{let i=sVt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;oe[r][n]??r,t)}var fd=t=>{let{present:e,children:r}=t,n=OSn(e),o=typeof r=="function"?r({present:n.isPresent}):am.Children.only(r),i=lVt(n.ref,PSn(o));return typeof r=="function"||n.isPresent?am.cloneElement(o,{ref:i}):null};fd.displayName="Presence";function OSn(t){let[e,r]=am.useState(),n=am.useRef({}),o=am.useRef(t),i=am.useRef("none"),a=t?"mounted":"unmounted",[s,u]=CSn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return am.useEffect(()=>{let l=Mce(n.current);i.current=s==="mounted"?l:"none"},[s]),Jn(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Mce(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),Jn(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Mce(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let b=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},f=p=>{p.target===e&&(i.current=Mce(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:am.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function Mce(t){return t?.animationName||"none"}function PSn(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 vc=F(X(),1);function zD(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var gM=F(X(),1);var fVt=F(X(),1);function dVt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function RFe(...t){return e=>{let r=!1,n=t.map(o=>{let i=dVt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:r,...n}=t,o=pd.Children.toArray(r),i=o.find(TSn);if(i){let a=i.props.children,s=o.map(u=>u===i?pd.Children.count(a)>1?pd.Children.only(null):pd.isValidElement(a)?a.props.children:null:u);return(0,oz.jsx)(jFe,{...n,ref:e,children:pd.isValidElement(a)?pd.cloneElement(a,void 0,s):null})}return(0,oz.jsx)(jFe,{...n,ref:e,children:r})});iz.displayName="Slot";var jFe=pd.forwardRef((t,e)=>{let{children:r,...n}=t;if(pd.isValidElement(r)){let o=ISn(r);return pd.cloneElement(r,{...ASn(n,r.props),ref:e?RFe(e,o):o})}return pd.Children.count(r)>1?pd.Children.only(null):null});jFe.displayName="SlotClone";var ESn=({children:t})=>(0,oz.jsx)(oz.Fragment,{children:t});function TSn(t){return pd.isValidElement(t)&&t.type===ESn}function ASn(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 ISn(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 Rce=F(pt(),1);function pVt(t){let e=t+"CollectionProvider",[r,n]=Yi(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=gM.default.useRef(null),g=gM.default.useRef(new Map).current;return(0,Rce.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=gM.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),y=kW(m,g.collectionRef);return(0,Rce.jsx)(iz,{ref:y,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=gM.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,y=gM.default.useRef(null),S=kW(m,y),x=i(l,h);return gM.default.useEffect(()=>(x.itemMap.set(y,{ref:y,...g}),()=>void x.itemMap.delete(y))),(0,Rce.jsx)(iz,{[c]:"",ref:S,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return gM.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,O)=>g.indexOf(x.ref.current)-g.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var mVt=F(X(),1),MSn=F(ds(),1);var hVt=F(pt(),1),RSn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],NFe=RSn.reduce((t,e)=>{let r=mVt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?iz:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,hVt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var yM=F(pt(),1),DFe="rovingFocusGroup.onEntryFocus",jSn={bubbles:!1,cancelable:!0},jce="RovingFocusGroup",[LFe,gVt,NSn]=pVt(jce),[DSn,FFe]=Yi(jce,[NSn]),[LSn,FSn]=DSn(jce),yVt=vc.forwardRef((t,e)=>(0,yM.jsx)(LFe.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,yM.jsx)(LFe.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,yM.jsx)(kSn,{...t,ref:e})})}));yVt.displayName=jce;var kSn=vc.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=vc.useRef(null),p=kW(e,f),m=nM(i),[h=null,b]=ud({prop:a,defaultProp:s,onChange:u}),[g,y]=vc.useState(!1),S=Ur(l),x=gVt(r),O=vc.useRef(!1),[P,E]=vc.useState(0);return vc.useEffect(()=>{let A=f.current;if(A)return A.addEventListener(DFe,S),()=>A.removeEventListener(DFe,S)},[S]),(0,yM.jsx)(LSn,{scope:r,orientation:n,dir:m,loop:o,currentTabStopId:h,onItemFocus:vc.useCallback(A=>b(A),[b]),onItemShiftTab:vc.useCallback(()=>y(!0),[]),onFocusableItemAdd:vc.useCallback(()=>E(A=>A+1),[]),onFocusableItemRemove:vc.useCallback(()=>E(A=>A-1),[]),children:(0,yM.jsx)(NFe.div,{tabIndex:g||P===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:zD(t.onMouseDown,()=>{O.current=!0}),onFocus:zD(t.onFocus,A=>{let I=!O.current;if(A.target===A.currentTarget&&I&&!g){let R=new CustomEvent(DFe,jSn);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){let N=x().filter(V=>V.focusable),j=N.find(V=>V.active),$=N.find(V=>V.id===h),z=[j,$,...N].filter(Boolean).map(V=>V.ref.current);vVt(z,c)}}O.current=!1}),onBlur:zD(t.onBlur,()=>y(!1))})})}),bVt="RovingFocusGroupItem",_Vt=vc.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...a}=t,s=hl(),u=i||s,l=FSn(bVt,r),c=l.currentTabStopId===u,d=gVt(r),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return vc.useEffect(()=>{if(n)return f(),()=>p()},[n,f,p]),(0,yM.jsx)(LFe.ItemSlot,{scope:r,id:u,focusable:n,active:o,children:(0,yM.jsx)(NFe.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...a,ref:e,onMouseDown:zD(t.onMouseDown,m=>{n?l.onItemFocus(u):m.preventDefault()}),onFocus:zD(t.onFocus,()=>l.onItemFocus(u)),onKeyDown:zD(t.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){l.onItemShiftTab();return}if(m.target!==m.currentTarget)return;let h=qSn(m,l.orientation,l.dir);if(h!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let g=d().filter(y=>y.focusable).map(y=>y.ref.current);if(h==="last")g.reverse();else if(h==="prev"||h==="next"){h==="prev"&&g.reverse();let y=g.indexOf(m.currentTarget);g=l.loop?USn(g,y+1):g.slice(y+1)}setTimeout(()=>vVt(g))}})})})});_Vt.displayName=bVt;var $Sn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function BSn(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function qSn(t,e,r){let n=BSn(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return $Sn[n]}function vVt(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function USn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var wVt=yVt,SVt=_Vt;var HSn=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},az=new WeakMap,Nce=new WeakMap,Dce={},kFe=0,xVt=function(t){return t&&(t.host||xVt(t.parentNode))},VSn=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=xVt(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})},WSn=function(t,e,r,n){var o=VSn(e,Array.isArray(t)?t:[t]);Dce[r]||(Dce[r]=new WeakMap);var i=Dce[r],a=[],s=new Set,u=new Set(o),l=function(d){!d||s.has(d)||(s.add(d),l(d.parentNode))};o.forEach(l);var c=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else try{var p=f.getAttribute(n),m=p!==null&&p!=="false",h=(az.get(f)||0)+1,b=(i.get(f)||0)+1;az.set(f,h),i.set(f,b),a.push(f),h===1&&m&&Nce.set(f,!0),b===1&&f.setAttribute(r,"true"),m||f.setAttribute(n,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return c(e),s.clear(),kFe++,function(){a.forEach(function(d){var f=az.get(d)-1,p=i.get(d)-1;az.set(d,f),i.set(d,p),f||(Nce.has(d)||d.removeAttribute(n),Nce.delete(d)),p||d.removeAttribute(r)}),kFe--,kFe||(az=new WeakMap,az=new WeakMap,Nce=new WeakMap,Dce={})}},bM=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||HSn(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),WSn(n,o,r,"aria-hidden")):function(){return null}};var yi=function(){return yi=Object.assign||function(e){for(var r,n=1,o=arguments.length;n"u")return QSn;var e=exn(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 txn=iE(),uz="data-scroll-locked",rxn=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($Fe,` { overflow: hidden `).concat(n,`; padding-right: `).concat(s,"px ").concat(n,`; } - body[`).concat(sz,`] { + body[`).concat(uz,`] { overflow: hidden `).concat(n,`; overscroll-behavior: contain; `).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&` @@ -913,13 +913,13 @@ ${l}`:`${u} margin-right: 0 `).concat(n,`; } - body[`).concat(sz,`] { - `).concat(kFe,": ").concat(s,`px; + body[`).concat(uz,`] { + `).concat(BFe,": ").concat(s,`px; } -`)},EVt=function(){var t=parseInt(document.body.getAttribute(sz)||"0",10);return isFinite(t)?t:0},XSn=function(){uz.useEffect(function(){return document.body.setAttribute(sz,(EVt()+1).toString()),function(){var t=EVt()-1;t<=0?document.body.removeAttribute(sz):document.body.setAttribute(sz,t.toString())}},[])},WD=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;XSn();var i=uz.useMemo(function(){return zFe(o)},[o]);return uz.createElement(YSn,{styles:ZSn(i,!e,o,r?"":"!important")})};var HFe=!1;if(typeof window<"u")try{$W=Object.defineProperty({},"passive",{get:function(){return HFe=!0,!0}}),window.addEventListener("test",$W,$W),window.removeEventListener("test",$W,$W)}catch{HFe=!1}var $W,KD=HFe?{passive:!1}:!1;var QSn=function(t){return t.tagName==="TEXTAREA"},TVt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!QSn(t)&&r[e]==="visible")},exn=function(t){return TVt(t,"overflowY")},txn=function(t){return TVt(t,"overflowX")},VFe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=AVt(t,n);if(o){var i=IVt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},rxn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},nxn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},AVt=function(t,e){return t==="v"?exn(e):txn(e)},IVt=function(t,e){return t==="v"?rxn(e):nxn(e)},oxn=function(t,e){return t==="h"&&e==="rtl"?-1:1},MVt=function(t,e,r,n,o){var i=oxn(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=IVt(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&AVt(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var Lce=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},RVt=function(t){return[t.deltaX,t.deltaY]},jVt=function(t){return t&&"current"in t?t.current:t},ixn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},axn=function(t){return` +`)},RVt=function(){var t=parseInt(document.body.getAttribute(uz)||"0",10);return isFinite(t)?t:0},nxn=function(){lz.useEffect(function(){return document.body.setAttribute(uz,(RVt()+1).toString()),function(){var t=RVt()-1;t<=0?document.body.removeAttribute(uz):document.body.setAttribute(uz,t.toString())}},[])},KD=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;nxn();var i=lz.useMemo(function(){return VFe(o)},[o]);return lz.createElement(txn,{styles:rxn(i,!e,o,r?"":"!important")})};var WFe=!1;if(typeof window<"u")try{BW=Object.defineProperty({},"passive",{get:function(){return WFe=!0,!0}}),window.addEventListener("test",BW,BW),window.removeEventListener("test",BW,BW)}catch{WFe=!1}var BW,GD=WFe?{passive:!1}:!1;var oxn=function(t){return t.tagName==="TEXTAREA"},jVt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!oxn(t)&&r[e]==="visible")},ixn=function(t){return jVt(t,"overflowY")},axn=function(t){return jVt(t,"overflowX")},KFe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=NVt(t,n);if(o){var i=DVt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},sxn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},uxn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},NVt=function(t,e){return t==="v"?ixn(e):axn(e)},DVt=function(t,e){return t==="v"?sxn(e):uxn(e)},lxn=function(t,e){return t==="h"&&e==="rtl"?-1:1},LVt=function(t,e,r,n,o){var i=lxn(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=DVt(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&NVt(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var $ce=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},FVt=function(t){return[t.deltaX,t.deltaY]},kVt=function(t){return t&&"current"in t?t.current:t},cxn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},dxn=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},sxn=0,lz=[];function NVt(t){var e=ya.useRef([]),r=ya.useRef([0,0]),n=ya.useRef(),o=ya.useState(sxn++)[0],i=ya.useState(iE)[0],a=ya.useRef(t);ya.useEffect(function(){a.current=t},[t]),ya.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=az([t.lockRef.current],(t.shards||[]).map(jVt),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=ya.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=Lce(h),y=r.current,S="deltaX"in h?h.deltaX:y[0]-g[0],x="deltaY"in h?h.deltaY:y[1]-g[1],O,P=h.target,E=Math.abs(S)>Math.abs(x)?"h":"v";if("touches"in h&&E==="h"&&P.type==="range")return!1;var A=VFe(E,P);if(!A)return!0;if(A?O=E:(O=E==="v"?"h":"v",A=VFe(E,P)),!A)return!1;if(!n.current&&"changedTouches"in h&&(S||x)&&(n.current=O),!O)return!0;var I=n.current||O;return MVt(I,b,h,I==="h"?S:x,!0)},[]),u=ya.useCallback(function(h){var b=h;if(!(!lz.length||lz[lz.length-1]!==i)){var g="deltaY"in b?RVt(b):Lce(b),y=e.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&ixn(O.delta,g)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var S=(a.current.shards||[]).map(jVt).filter(Boolean).filter(function(O){return O.contains(b.target)}),x=S.length>0?s(b,S[0]):!a.current.noIsolation;x&&b.cancelable&&b.preventDefault()}}},[]),l=ya.useCallback(function(h,b,g,y){var S={name:h,delta:b,target:g,should:y,shadowParent:uxn(g)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(x){return x!==S})},1)},[]),c=ya.useCallback(function(h){r.current=Lce(h),n.current=void 0},[]),d=ya.useCallback(function(h){l(h.type,RVt(h),h.target,s(h,t.lockRef.current))},[]),f=ya.useCallback(function(h){l(h.type,Lce(h),h.target,s(h,t.lockRef.current))},[]);ya.useEffect(function(){return lz.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,KD),document.addEventListener("touchmove",u,KD),document.addEventListener("touchstart",c,KD),function(){lz=lz.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,KD),document.removeEventListener("touchmove",u,KD),document.removeEventListener("touchstart",c,KD)}},[]);var p=t.removeScrollBar,m=t.inert;return ya.createElement(ya.Fragment,null,m?ya.createElement(i,{styles:axn(o)}):null,p?ya.createElement(WD,{gapMode:t.gapMode}):null)}function uxn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var DVt=VD(Dce,NVt);var LVt=Fce.forwardRef(function(t,e){return Fce.createElement(kW,yi({},t,{ref:e,sideCar:DVt}))});LVt.classNames=kW.classNames;var WFe=LVt;var Mr=F(ft(),1),KFe=["Enter"," "],lxn=["ArrowDown","PageUp","Home"],kVt=["ArrowUp","PageDown","End"],cxn=[...lxn,...kVt],dxn={ltr:[...KFe,"ArrowRight"],rtl:[...KFe,"ArrowLeft"]},fxn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},zW="Menu",[qW,pxn,mxn]=F3t(zW),[GD,GFe]=Yi(zW,[mxn,PFe,DFe]),HW=PFe(),$Vt=DFe(),[BVt,vM]=GD(zW),[hxn,VW]=GD(zW),qVt=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=HW(e),[u,l]=zt.useState(null),c=zt.useRef(!1),d=Ur(i),f=nM(o);return zt.useEffect(()=>{let p=()=>{c.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),(0,Mr.jsx)(TFe,{...s,children:(0,Mr.jsx)(BVt,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,Mr.jsx)(hxn,{scope:e,onClose:zt.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};qVt.displayName=zW;var gxn="MenuAnchor",JFe=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=HW(r);return(0,Mr.jsx)(ZHt,{...o,...n,ref:e})});JFe.displayName=gxn;var YFe="MenuPortal",[yxn,UVt]=GD(YFe,{forceMount:void 0}),zVt=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=vM(YFe,e);return(0,Mr.jsx)(yxn,{scope:e,forceMount:r,children:(0,Mr.jsx)(fd,{present:r||i.open,children:(0,Mr.jsx)(AFe,{asChild:!0,container:o,children:n})})})};zVt.displayName=YFe;var Yg="MenuContent",[bxn,ZFe]=GD(Yg),HVt=zt.forwardRef((t,e)=>{let r=UVt(Yg,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=vM(Yg,t.__scopeMenu),a=VW(Yg,t.__scopeMenu);return(0,Mr.jsx)(qW.Provider,{scope:t.__scopeMenu,children:(0,Mr.jsx)(fd,{present:n||i.open,children:(0,Mr.jsx)(qW.Slot,{scope:t.__scopeMenu,children:a.modal?(0,Mr.jsx)(_xn,{...o,ref:e}):(0,Mr.jsx)(vxn,{...o,ref:e})})})})}),_xn=zt.forwardRef((t,e)=>{let r=vM(Yg,t.__scopeMenu),n=zt.useRef(null),o=cd(e,n);return zt.useEffect(()=>{let i=n.current;if(i)return bM(i)},[]),(0,Mr.jsx)(XFe,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Zi(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),vxn=zt.forwardRef((t,e)=>{let r=vM(Yg,t.__scopeMenu);return(0,Mr.jsx)(XFe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),XFe=zt.forwardRef((t,e)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=t,b=vM(Yg,r),g=VW(Yg,r),y=HW(r),S=$Vt(r),x=pxn(r),[O,P]=zt.useState(null),E=zt.useRef(null),A=cd(e,E,b.onContentChange),I=zt.useRef(0),R=zt.useRef(""),N=zt.useRef(0),j=zt.useRef(null),$=zt.useRef("right"),k=zt.useRef(0),z=m?WFe:zt.Fragment,V=m?{as:tM,allowPinchZoom:!0}:void 0,Q=D=>{let B=R.current+D,q=x().filter(Y=>!Y.disabled),K=document.activeElement,H=q.find(Y=>Y.ref.current===K)?.textValue,ee=q.map(Y=>Y.textValue),U=jxn(ee,B,H),W=q.find(Y=>Y.textValue===U)?.ref.current;(function Y(ae){R.current=ae,window.clearTimeout(I.current),ae!==""&&(I.current=window.setTimeout(()=>Y(""),1e3))})(B),W&&setTimeout(()=>W.focus())};zt.useEffect(()=>()=>window.clearTimeout(I.current),[]),iM();let J=zt.useCallback(D=>$.current===j.current?.side&&Dxn(D,j.current?.area),[]);return(0,Mr.jsx)(bxn,{scope:r,searchRef:R,onItemEnter:zt.useCallback(D=>{J(D)&&D.preventDefault()},[J]),onItemLeave:zt.useCallback(D=>{J(D)||(E.current?.focus(),P(null))},[J]),onTriggerLeave:zt.useCallback(D=>{J(D)&&D.preventDefault()},[J]),pointerGraceTimerRef:N,onPointerGraceIntentChange:zt.useCallback(D=>{j.current=D},[]),children:(0,Mr.jsx)(z,{...V,children:(0,Mr.jsx)(gFe,{asChild:!0,trapped:o,onMountAutoFocus:Zi(i,D=>{D.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,Mr.jsx)(fFe,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Mr.jsx)(gVt,{asChild:!0,...S,dir:g.dir,orientation:"vertical",loop:n,currentTabStopId:O,onCurrentTabStopIdChange:P,onEntryFocus:Zi(u,D=>{g.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Mr.jsx)(XHt,{role:"menu","aria-orientation":"vertical","data-state":a8t(b.open),"data-radix-menu-content":"",dir:g.dir,...y,...h,ref:A,style:{outline:"none",...h.style},onKeyDown:Zi(h.onKeyDown,D=>{let q=D.target.closest("[data-radix-menu-content]")===D.currentTarget,K=D.ctrlKey||D.altKey||D.metaKey,H=D.key.length===1;q&&(D.key==="Tab"&&D.preventDefault(),!K&&H&&Q(D.key));let ee=E.current;if(D.target!==ee||!cxn.includes(D.key))return;D.preventDefault();let W=x().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);kVt.includes(D.key)&&W.reverse(),Mxn(W)}),onBlur:Zi(t.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(I.current),R.current="")}),onPointerMove:Zi(t.onPointerMove,UW(D=>{let B=D.target,q=k.current!==D.clientX;if(D.currentTarget.contains(B)&&q){let K=D.clientX>k.current?"right":"left";$.current=K,k.current=D.clientX}}))})})})})})})});HVt.displayName=Yg;var wxn="MenuGroup",QFe=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Mr.jsx)(_c.div,{role:"group",...n,ref:e})});QFe.displayName=wxn;var Sxn="MenuLabel",VVt=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Mr.jsx)(_c.div,{...n,ref:e})});VVt.displayName=Sxn;var kce="MenuItem",FVt="menu.itemSelect",Bce=zt.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=zt.useRef(null),a=VW(kce,t.__scopeMenu),s=ZFe(kce,t.__scopeMenu),u=cd(e,i),l=zt.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(FVt,{bubbles:!0,cancelable:!0});d.addEventListener(FVt,p=>n?.(p),{once:!0}),pce(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,Mr.jsx)(WVt,{...o,ref:u,disabled:r,onClick:Zi(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:Zi(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:Zi(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||KFe.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Bce.displayName=kce;var WVt=zt.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=ZFe(kce,r),s=$Vt(r),u=zt.useRef(null),l=cd(e,u),[c,d]=zt.useState(!1),[f,p]=zt.useState("");return zt.useEffect(()=>{let m=u.current;m&&p((m.textContent??"").trim())},[i.children]),(0,Mr.jsx)(qW.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,Mr.jsx)(yVt,{asChild:!0,...s,focusable:!n,children:(0,Mr.jsx)(_c.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:Zi(t.onPointerMove,UW(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Zi(t.onPointerLeave,UW(m=>a.onItemLeave(m))),onFocus:Zi(t.onFocus,()=>d(!0)),onBlur:Zi(t.onBlur,()=>d(!1))})})})}),xxn="MenuCheckboxItem",KVt=zt.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,Mr.jsx)(XVt,{scope:t.__scopeMenu,checked:r,children:(0,Mr.jsx)(Bce,{role:"menuitemcheckbox","aria-checked":$ce(r)?"mixed":r,...o,ref:e,"data-state":rke(r),onSelect:Zi(o.onSelect,()=>n?.($ce(r)?!0:!r),{checkForDefaultPrevented:!1})})})});KVt.displayName=xxn;var GVt="MenuRadioGroup",[Cxn,Oxn]=GD(GVt,{value:void 0,onValueChange:()=>{}}),JVt=zt.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=Ur(n);return(0,Mr.jsx)(Cxn,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,Mr.jsx)(QFe,{...o,ref:e})})});JVt.displayName=GVt;var YVt="MenuRadioItem",ZVt=zt.forwardRef((t,e)=>{let{value:r,...n}=t,o=Oxn(YVt,t.__scopeMenu),i=r===o.value;return(0,Mr.jsx)(XVt,{scope:t.__scopeMenu,checked:i,children:(0,Mr.jsx)(Bce,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":rke(i),onSelect:Zi(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});ZVt.displayName=YVt;var eke="MenuItemIndicator",[XVt,Pxn]=GD(eke,{checked:!1}),QVt=zt.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=Pxn(eke,r);return(0,Mr.jsx)(fd,{present:n||$ce(i.checked)||i.checked===!0,children:(0,Mr.jsx)(_c.span,{...o,ref:e,"data-state":rke(i.checked)})})});QVt.displayName=eke;var Exn="MenuSeparator",e8t=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Mr.jsx)(_c.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});e8t.displayName=Exn;var Txn="MenuArrow",t8t=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=HW(r);return(0,Mr.jsx)(QHt,{...o,...n,ref:e})});t8t.displayName=Txn;var tke="MenuSub",[Axn,r8t]=GD(tke),Ixn=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=vM(tke,e),a=HW(e),[s,u]=zt.useState(null),[l,c]=zt.useState(null),d=Ur(o);return zt.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,Mr.jsx)(TFe,{...a,children:(0,Mr.jsx)(BVt,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,Mr.jsx)(Axn,{scope:e,contentId:hl(),triggerId:hl(),trigger:s,onTriggerChange:u,children:r})})})};Ixn.displayName=tke;var BW="MenuSubTrigger",n8t=zt.forwardRef((t,e)=>{let r=vM(BW,t.__scopeMenu),n=VW(BW,t.__scopeMenu),o=r8t(BW,t.__scopeMenu),i=ZFe(BW,t.__scopeMenu),a=zt.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=zt.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return zt.useEffect(()=>c,[c]),zt.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,Mr.jsx)(JFe,{asChild:!0,...l,children:(0,Mr.jsx)(WVt,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":a8t(r.open),...t,ref:MW(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Zi(t.onPointerMove,UW(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:Zi(t.onPointerLeave,UW(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,m=p==="right",h=m?-5:5,b=f[m?"left":"right"],g=f[m?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+h,y:d.clientY},{x:b,y:f.top},{x:g,y:f.top},{x:g,y:f.bottom},{x:b,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:Zi(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||dxn[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});n8t.displayName=BW;var o8t="MenuSubContent",i8t=zt.forwardRef((t,e)=>{let r=UVt(Yg,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=vM(Yg,t.__scopeMenu),a=VW(Yg,t.__scopeMenu),s=r8t(o8t,t.__scopeMenu),u=zt.useRef(null),l=cd(e,u);return(0,Mr.jsx)(qW.Provider,{scope:t.__scopeMenu,children:(0,Mr.jsx)(fd,{present:n||i.open,children:(0,Mr.jsx)(qW.Slot,{scope:t.__scopeMenu,children:(0,Mr.jsx)(XFe,{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:Zi(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Zi(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:Zi(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=fxn[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});i8t.displayName=o8t;function a8t(t){return t?"open":"closed"}function $ce(t){return t==="indeterminate"}function rke(t){return $ce(t)?"indeterminate":t?"checked":"unchecked"}function Mxn(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function Rxn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function jxn(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=Rxn(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 Nxn(t,e){let{x:r,y:n}=t,o=!1;for(let i=0,a=e.length-1;in!=c>n&&r<(l-s)*(n-u)/(c-u)+s&&(o=!o)}return o}function Dxn(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return Nxn(r,e)}function UW(t){return e=>e.pointerType==="mouse"?t(e):void 0}var s8t=qVt,u8t=JFe,l8t=zVt,c8t=HVt,d8t=QFe,f8t=VVt,p8t=Bce,m8t=KVt,h8t=JVt,g8t=ZVt,y8t=QVt,b8t=e8t,_8t=t8t;var v8t=n8t,w8t=i8t;var wc=F(ft(),1),nke="DropdownMenu",[Fxn,Rui]=Yi(nke,[GFe]),np=GFe(),[kxn,S8t]=Fxn(nke),WW=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=np(e),l=$l.useRef(null),[c=!1,d]=ud({prop:o,defaultProp:i,onChange:a});return(0,wc.jsx)(kxn,{scope:e,triggerId:hl(),triggerRef:l,contentId:hl(),open:c,onOpenChange:d,onOpenToggle:$l.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,wc.jsx)(s8t,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};WW.displayName=nke;var x8t="DropdownMenuTrigger",KW=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=S8t(x8t,r),a=np(r);return(0,wc.jsx)(u8t,{asChild:!0,...a,children:(0,wc.jsx)(N3t.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:cce(e,i.triggerRef),onPointerDown:IW(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:IW(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});KW.displayName=x8t;var $xn="DropdownMenuPortal",C8t=t=>{let{__scopeDropdownMenu:e,...r}=t,n=np(e);return(0,wc.jsx)(l8t,{...n,...r})};C8t.displayName=$xn;var O8t="DropdownMenuContent",P8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=S8t(O8t,r),i=np(r),a=$l.useRef(!1);return(0,wc.jsx)(c8t,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:IW(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:IW(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)"}})});P8t.displayName=O8t;var Bxn="DropdownMenuGroup",qxn=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(d8t,{...o,...n,ref:e})});qxn.displayName=Bxn;var Uxn="DropdownMenuLabel",E8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(f8t,{...o,...n,ref:e})});E8t.displayName=Uxn;var zxn="DropdownMenuItem",T8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(p8t,{...o,...n,ref:e})});T8t.displayName=zxn;var Hxn="DropdownMenuCheckboxItem",A8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(m8t,{...o,...n,ref:e})});A8t.displayName=Hxn;var Vxn="DropdownMenuRadioGroup",Wxn=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(h8t,{...o,...n,ref:e})});Wxn.displayName=Vxn;var Kxn="DropdownMenuRadioItem",I8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(g8t,{...o,...n,ref:e})});I8t.displayName=Kxn;var Gxn="DropdownMenuItemIndicator",M8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(y8t,{...o,...n,ref:e})});M8t.displayName=Gxn;var Jxn="DropdownMenuSeparator",R8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(b8t,{...o,...n,ref:e})});R8t.displayName=Jxn;var Yxn="DropdownMenuArrow",Zxn=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(_8t,{...o,...n,ref:e})});Zxn.displayName=Yxn;var Xxn="DropdownMenuSubTrigger",j8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(v8t,{...o,...n,ref:e})});j8t.displayName=Xxn;var Qxn="DropdownMenuSubContent",N8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(w8t,{...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)"}})});N8t.displayName=Qxn;var D8t=WW,L8t=KW,F8t=C8t,oke=P8t;var ike=E8t,ake=T8t,ske=A8t;var uke=I8t,lke=M8t,cke=R8t;var dke=j8t,fke=N8t;yn();Tn();var JD=D8t,YD=L8t;var tCn=$i.forwardRef(({className:t,inset:e,children:r,...n},o)=>$i.createElement(dke,{ref:o,className:_e("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,$i.createElement(ZC,{className:"tw-ml-auto"})));tCn.displayName=dke.displayName;var rCn=$i.forwardRef(({className:t,...e},r)=>$i.createElement(fke,{ref:r,className:_e("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}));rCn.displayName=fke.displayName;var xb=$i.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>$i.createElement(F8t,{container:r??activeDocument.body},$i.createElement(oke,{ref:o,sideOffset:e,className:_e("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})));xb.displayName=oke.displayName;var Si=$i.forwardRef(({className:t,inset:e,...r},n)=>$i.createElement(ake,{ref:n,className:_e("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}));Si.displayName=ake.displayName;var nCn=$i.forwardRef(({className:t,children:e,checked:r,...n},o)=>$i.createElement(ske,{ref:o,className:_e("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},$i.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},$i.createElement(lke,null,$i.createElement(Jl,{className:"tw-size-4"}))),e));nCn.displayName=ske.displayName;var oCn=$i.forwardRef(({className:t,children:e,...r},n)=>$i.createElement(uke,{ref:n,className:_e("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},$i.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},$i.createElement(lke,null,$i.createElement(d3,{className:"tw-size-2 tw-fill-current"}))),e));oCn.displayName=uke.displayName;var iCn=$i.forwardRef(({className:t,inset:e,...r},n)=>$i.createElement(ike,{ref:n,className:_e("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",e&&"tw-pl-8",t),...r}));iCn.displayName=ike.displayName;var aCn=$i.forwardRef(({className:t,...e},r)=>$i.createElement(cke,{ref:r,className:_e("-tw-mx-1 tw-my-1 tw-h-px",t),...e}));aCn.displayName=cke.displayName;var sCn=({className:t,...e})=>$i.createElement("span",{className:_e("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",t),...e});sCn.displayName="DropdownMenuShortcut";var GW=F(X());Tn();var cz=GW.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 GW.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:_e("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},GW.createElement("div",{className:_e("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")}))});cz.displayName="SettingSwitch";var ZW=F(X());var en=F(X(),1);function Cb(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var $8t=F(X(),1);function k8t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function uCn(...t){return e=>{let r=!1,n=t.map(o=>{let i=k8t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=aE.useMemo(()=>m,Object.values(m));return(0,B8t.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=aE.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>aE.createContext(a));return function(s){let u=s?.[t]||i;return aE.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,lCn(o,...e)]}function lCn(...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 aE.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var es=F(X(),1);var q8t=F(X(),1),U8t=F(ds(),1);i1();var z8t=F(ft(),1),cCn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Zg=cCn.reduce((t,e)=>{let r=GC(`Primitive.${e}`),n=q8t.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,z8t.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function H8t(t,e){t&&U8t.flushSync(()=>t.dispatchEvent(e))}var dz=F(X(),1);function ZD(t){let e=dz.useRef(t);return dz.useEffect(()=>{e.current=t}),dz.useMemo(()=>(...r)=>e.current?.(...r),[])}var V8t=F(X(),1);function W8t(t,e=globalThis?.document){let r=ZD(t);V8t.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 mke=F(ft(),1),dCn="DismissableLayer",pke="dismissableLayer.update",fCn="dismissableLayer.pointerDownOutside",pCn="dismissableLayer.focusOutside",K8t,J8t=es.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hke=es.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=es.useContext(J8t),[c,d]=es.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=es.useState({}),m=Ob(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=gCn(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=yCn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return W8t(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),es.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(K8t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),G8t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=K8t)}},[c,f,r,l]),es.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),G8t())},[c,l]),es.useEffect(()=>{let E=()=>p({});return document.addEventListener(pke,E),()=>document.removeEventListener(pke,E)},[]),(0,mke.jsx)(Zg.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:Cb(t.onFocusCapture,P.onFocusCapture),onBlurCapture:Cb(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Cb(t.onPointerDownCapture,O.onPointerDownCapture)})});hke.displayName=dCn;var mCn="DismissableLayerBranch",hCn=es.forwardRef((t,e)=>{let r=es.useContext(J8t),n=es.useRef(null),o=Ob(e,n);return es.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,mke.jsx)(Zg.div,{...t,ref:o})});hCn.displayName=mCn;function gCn(t,e=globalThis?.document){let r=ZD(t),n=es.useRef(!1),o=es.useRef(()=>{});return es.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Y8t(fCn,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 yCn(t,e=globalThis?.document){let r=ZD(t),n=es.useRef(!1);return es.useEffect(()=>{let o=i=>{i.target&&!n.current&&Y8t(pCn,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 G8t(){let t=new CustomEvent(pke);document.dispatchEvent(t)}function Y8t(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?H8t(o,i):o.dispatchEvent(i)}var gke=F(X(),1);var Z8t=F(X(),1),sm=globalThis?.document?Z8t.useLayoutEffect:()=>{};var bCn=gke[" useId ".trim().toString()]||(()=>{}),_Cn=0;function X8t(t){let[e,r]=gke.useState(bCn());return sm(()=>{t||r(n=>n??String(_Cn++))},[t]),t||(e?`radix-${e}`:"")}var ch=F(X(),1);var Q8t=F(X(),1);var yke=F(ft(),1),vCn="Arrow",e6t=Q8t.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,yke.jsx)(Zg.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,yke.jsx)("polygon",{points:"0,0 30,0 15,10"})})});e6t.displayName=vCn;var t6t=e6t;var r6t=F(X(),1);function n6t(t){let[e,r]=r6t.useState(void 0);return sm(()=>{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 wM=F(ft(),1);var bke="Popper",[o6t,_ke]=qce(bke),[SCn,i6t]=o6t(bke),a6t=t=>{let{__scopePopper:e,children:r}=t,[n,o]=ch.useState(null);return(0,wM.jsx)(SCn,{scope:e,anchor:n,onAnchorChange:o,children:r})};a6t.displayName=bke;var s6t="PopperAnchor",u6t=ch.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=i6t(s6t,r),a=ch.useRef(null),s=Ob(e,a);return ch.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,wM.jsx)(Zg.div,{...o,ref:s})});u6t.displayName=s6t;var vke="PopperContent",[xCn,CCn]=o6t(vke),l6t=ch.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=i6t(vke,r),[g,y]=ch.useState(null),S=Ob(e,Y=>y(Y)),[x,O]=ch.useState(null),P=n6t(x),E=P?.width??0,A=P?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],j=N.length>0,$={padding:R,boundary:N.filter(PCn),altBoundary:j},{refs:k,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:J}=sM({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>oE(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[uM({mainAxis:o+A,alignmentAxis:a}),u&&lM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cM():void 0,...$}),u&&dM({...$}),fM({...$,apply:({elements:Y,rects:ae,availableWidth:Oe,availableHeight:le})=>{let{width:Be,height:ze}=ae.reference,rt=Y.floating.style;rt.setProperty("--radix-popper-available-width",`${Oe}px`),rt.setProperty("--radix-popper-available-height",`${le}px`),rt.setProperty("--radix-popper-anchor-width",`${Be}px`),rt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),x&&mM({element:x,padding:s}),ECn({arrowWidth:E,arrowHeight:A}),f&&pM({strategy:"referenceHidden",...$})]}),[D,B]=f6t(V),q=ZD(m);sm(()=>{Q&&q?.()},[Q,q]);let K=J.arrow?.x,H=J.arrow?.y,ee=J.arrow?.centerOffset!==0,[U,W]=ch.useState();return sm(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,wM.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,wM.jsx)(xCn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:H,shouldHideArrow:ee,children:(0,wM.jsx)(Zg.div,{"data-side":D,"data-align":B,...h,ref:S,style:{...h.style,animation:Q?void 0:"none"}})})})});l6t.displayName=vke;var c6t="PopperArrow",OCn={top:"bottom",right:"left",bottom:"top",left:"right"},d6t=ch.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=CCn(c6t,n),a=OCn[i.placedSide];return(0,wM.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,wM.jsx)(t6t,{...o,ref:r,style:{...o.style,display:"block"}})})});d6t.displayName=c6t;function PCn(t){return t!==null}var ECn=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]=f6t(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function f6t(t){let[e,r="center"]=t.split("-");return[e,r]}var p6t=a6t,m6t=u6t,h6t=l6t,g6t=d6t;var Uce=F(X(),1),y6t=F(ds(),1);var b6t=F(ft(),1),ACn="Portal",wke=Uce.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Uce.useState(!1);sm(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?y6t.default.createPortal((0,b6t.jsx)(Zg.div,{...n,ref:e}),a):null});wke.displayName=ACn;var um=F(X(),1);var _6t=F(X(),1);function ICn(t,e){return _6t.useReducer((r,n)=>e[r][n]??r,t)}var Hce=t=>{let{present:e,children:r}=t,n=MCn(e),o=typeof r=="function"?r({present:n.isPresent}):um.Children.only(r),i=Ob(n.ref,RCn(o));return typeof r=="function"||n.isPresent?um.cloneElement(o,{ref:i}):null};Hce.displayName="Presence";function MCn(t){let[e,r]=um.useState(),n=um.useRef(null),o=um.useRef(t),i=um.useRef("none"),a=t?"mounted":"unmounted",[s,u]=ICn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return um.useEffect(()=>{let l=zce(n.current);i.current=s==="mounted"?l:"none"},[s]),sm(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=zce(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),sm(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=zce(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let b=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},f=p=>{p.target===e&&(i.current=zce(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:um.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function zce(t){return t?.animationName||"none"}function RCn(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)}i1();var Xg=F(X(),1);var Vce=F(X(),1);var jCn=Xg[" useInsertionEffect ".trim().toString()]||sm;function v6t({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=NCn({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=Xg.useRef(t!==void 0);Xg.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=Xg.useCallback(c=>{if(s){let d=DCn(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function NCn({defaultProp:t,onChange:e}){let[r,n]=Xg.useState(t),o=Xg.useRef(r),i=Xg.useRef(e);return jCn(()=>{i.current=e},[e]),Xg.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function DCn(t){return typeof t=="function"}var wli=Symbol("RADIX:SYNC_STATE");var C6t=F(X(),1);var w6t=F(X(),1),LCn=F(ds(),1);i1();var S6t=F(ft(),1),FCn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],x6t=FCn.reduce((t,e)=>{let r=GC(`Primitive.${e}`),n=w6t.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,S6t.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var O6t=F(ft(),1),kCn=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"}),$Cn="VisuallyHidden",P6t=C6t.forwardRef((t,e)=>(0,O6t.jsx)(x6t.span,{...t,ref:e,style:{...kCn,...t.style}}));P6t.displayName=$Cn;var E6t=P6t;var yl=F(ft(),1),[Wce,Fli]=qce("Tooltip",[_ke]),Kce=_ke(),T6t="TooltipProvider",qCn=700,Ske="tooltip.open",[UCn,Cke]=Wce(T6t),A6t=t=>{let{__scopeTooltip:e,delayDuration:r=qCn,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,a=en.useRef(!0),s=en.useRef(!1),u=en.useRef(0);return en.useEffect(()=>{let l=u.current;return()=>window.clearTimeout(l)},[]),(0,yl.jsx)(UCn,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:en.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:en.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:en.useCallback(l=>{s.current=l},[]),disableHoverableContent:o,children:i})};A6t.displayName=T6t;var JW="Tooltip",[zCn,YW]=Wce(JW),I6t=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=Cke(JW,t.__scopeTooltip),l=Kce(e),[c,d]=en.useState(null),f=X8t(),p=en.useRef(0),m=a??u.disableHoverableContent,h=s??u.delayDuration,b=en.useRef(!1),[g,y]=v6t({prop:n,defaultProp:o??!1,onChange:E=>{E?(u.onOpen(),document.dispatchEvent(new CustomEvent(Ske))):u.onClose(),i?.(E)},caller:JW}),S=en.useMemo(()=>g?b.current?"delayed-open":"instant-open":"closed",[g]),x=en.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,y(!0)},[y]),O=en.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),P=en.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,y(!0),p.current=0},h)},[h,y]);return en.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,yl.jsx)(p6t,{...l,children:(0,yl.jsx)(zCn,{scope:e,contentId:f,open:g,stateAttribute:S,trigger:c,onTriggerChange:d,onTriggerEnter:en.useCallback(()=>{u.isOpenDelayedRef.current?P():x()},[u.isOpenDelayedRef,P,x]),onTriggerLeave:en.useCallback(()=>{m?O():(window.clearTimeout(p.current),p.current=0)},[O,m]),onOpen:x,onClose:O,disableHoverableContent:m,children:r})})};I6t.displayName=JW;var xke="TooltipTrigger",M6t=en.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=YW(xke,r),i=Cke(xke,r),a=Kce(r),s=en.useRef(null),u=Ob(e,s,o.onTriggerChange),l=en.useRef(!1),c=en.useRef(!1),d=en.useCallback(()=>l.current=!1,[]);return en.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,yl.jsx)(m6t,{asChild:!0,...a,children:(0,yl.jsx)(Zg.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:Cb(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:Cb(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:Cb(t.onPointerDown,()=>{o.open&&o.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Cb(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:Cb(t.onBlur,o.onClose),onClick:Cb(t.onClick,o.onClose)})})});M6t.displayName=xke;var Oke="TooltipPortal",[HCn,VCn]=Wce(Oke,{forceMount:void 0}),R6t=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=YW(Oke,e);return(0,yl.jsx)(HCn,{scope:e,forceMount:r,children:(0,yl.jsx)(Hce,{present:r||i.open,children:(0,yl.jsx)(wke,{asChild:!0,container:o,children:n})})})};R6t.displayName=Oke;var fz="TooltipContent",j6t=en.forwardRef((t,e)=>{let r=VCn(fz,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=YW(fz,t.__scopeTooltip);return(0,yl.jsx)(Hce,{present:n||a.open,children:a.disableHoverableContent?(0,yl.jsx)(N6t,{side:o,...i,ref:e}):(0,yl.jsx)(WCn,{side:o,...i,ref:e})})}),WCn=en.forwardRef((t,e)=>{let r=YW(fz,t.__scopeTooltip),n=Cke(fz,t.__scopeTooltip),o=en.useRef(null),i=Ob(e,o),[a,s]=en.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=en.useCallback(()=>{s(null),d(!1)},[d]),p=en.useCallback((m,h)=>{let b=m.currentTarget,g={x:m.clientX,y:m.clientY},y=ZCn(g,b.getBoundingClientRect()),S=XCn(g,y),x=QCn(h.getBoundingClientRect()),O=tOn([...S,...x]);s(O),d(!0)},[d]);return en.useEffect(()=>()=>f(),[f]),en.useEffect(()=>{if(u&&c){let m=b=>p(b,c),h=b=>p(b,u);return u.addEventListener("pointerleave",m),c.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",h)}}},[u,c,p,f]),en.useEffect(()=>{if(a){let m=h=>{let b=h.target,g={x:h.clientX,y:h.clientY},y=u?.contains(b)||c?.contains(b),S=!eOn(g,a);y?f():S&&(f(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[u,c,a,l,f]),(0,yl.jsx)(N6t,{...t,ref:i})}),[KCn,GCn]=Wce(JW,{isInside:!1}),JCn=jWe("TooltipContent"),N6t=en.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=YW(fz,r),l=Kce(r),{onClose:c}=u;return en.useEffect(()=>(document.addEventListener(Ske,c),()=>document.removeEventListener(Ske,c)),[c]),en.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,yl.jsx)(hke,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,yl.jsxs)(h6t,{"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,yl.jsx)(JCn,{children:n}),(0,yl.jsx)(KCn,{scope:r,isInside:!0,children:(0,yl.jsx)(E6t,{id:u.contentId,role:"tooltip",children:o||n})})]})})});j6t.displayName=fz;var D6t="TooltipArrow",YCn=en.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=Kce(r);return GCn(D6t,r).isInside?null:(0,yl.jsx)(g6t,{...o,...n,ref:e})});YCn.displayName=D6t;function ZCn(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 XCn(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 QCn(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 eOn(t,e){let{x:r,y:n}=t,o=!1;for(let i=0,a=e.length-1;in!=f>n&&r<(d-l)*(n-c)/(f-c)+l&&(o=!o)}return o}function tOn(t){let e=t.slice();return e.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),rOn(e)}function rOn(t){if(t.length<=1)return t.slice();let e=[];for(let n=0;n=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 Gce=A6t,L6t=I6t,F6t=M6t,k6t=R6t,Pke=j6t;Tn();var vo=Gce,Rt=L6t,jt=F6t,Mt=ZW.forwardRef(({className:t,sideOffset:e=4,...r},n)=>ZW.createElement(k6t,{container:activeDocument.body},ZW.createElement(Pke,{ref:n,sideOffset:e,className:_e("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})));Mt.displayName=Pke.displayName;$r();yo();nO();Ix();nr();yn();var dh=require("obsidian"),Ft=F(X());async function nOn(){try{await ma.getInstance().indexVaultToVectorStore(),new dh.Notice("Vault index refreshed.")}catch(t){console.error("Error refreshing vault index:",t),new dh.Notice("Failed to refresh vault index. Check console for details.")}}async function oOn(){try{await ma.getInstance().indexVaultToVectorStore(!0),new dh.Notice("Vault force reindexed.")}catch(t){console.error("Error force reindexing vault:",t),new dh.Notice("Failed to force reindex vault. Check console for details.")}}async function Jce(){let t=Mc();if(!t){new dh.Notice("No project is currently selected to reload.");return}try{GE(!0),await tb.getInstance().invalidateMarkdownContext(t,!0);let e=app.plugins.getPlugin("copilot");if(e&&e.projectManager)await e.projectManager.getProjectContext(t.id),new dh.Notice(`Project context for "${t.name}" reloaded successfully.`);else throw new Error("Copilot plugin or ProjectManager not available.")}catch(e){fe("Error reloading project context:",e),SN(e)||new dh.Notice("Failed to reload project context. Check console for details.")}finally{GE(!1)}}async function iOn(){let t=Mc();if(!t){new dh.Notice("No project is currently selected to rebuild.");return}new sd(app,async()=>{try{GE(!0),new dh.Notice(`Force rebuilding context for project: ${t.name}... This will take some time and re-fetch all data.`,1e4),z8.resetRateLimitNoticeTimer(),await tb.getInstance().clearForProject(t),new dh.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 dh.Notice(`Project context for "${t.name}" rebuilt successfully from scratch.`);else throw new Error("Copilot plugin or ProjectManager not available for rebuild.")}catch(r){fe("Error force rebuilding project context:",r),SN(r)||new dh.Notice("Failed to force rebuild project context. Check console for details.")}finally{GE(!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 B6t({onNewChat:t,onSaveAsNote:e,onLoadHistory:r,onModeChange:n,onCloseProject:o}){let i=Rn(),[a,s]=by(),u=Sq(),l=c=>{s(c),n(c),c!=="project"&&(UR(null),o?.())};return Ft.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-p-1"},Ft.default.createElement("div",{className:"tw-flex-1"},Ft.default.createElement(WW,null,Ft.default.createElement(KW,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-ml-1"},a==="llm_chain"&&"chat (free)",a==="vault_qa"&&"vault QA (free)",a==="copilot_plus"&&Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ft.default.createElement(Vh,{className:"tw-size-4"}),"copilot plus (beta)"),a==="project"&&"projects (alpha)",Ft.default.createElement(Hi,{className:"tw-mt-0.5 tw-size-5"}))),Ft.default.createElement(xb,{align:"start"},Ft.default.createElement(Si,{onSelect:()=>{l("llm_chain")}},"chat (free)"),Ft.default.createElement(Si,{onSelect:()=>{l("vault_qa")}},"vault QA (free)"),u?Ft.default.createElement(Si,{onSelect:()=>{l("copilot_plus")}},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ft.default.createElement(Vh,{className:"tw-size-4"}),"copilot plus (beta)")):Ft.default.createElement(Si,{onSelect:()=>{p1(LC.CHAT_MODE_SELECT),o?.()}},"copilot plus (beta)",Ft.default.createElement(rO,{className:"tw-size-3"})),u?Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-1",onSelect:()=>{l("project")}},Ft.default.createElement(l1,{className:"tw-size-4"}),"projects (alpha)"):Ft.default.createElement(Si,{onSelect:()=>{p1(LC.CHAT_MODE_SELECT),o?.()}},"copilot plus (beta)",Ft.default.createElement(rO,{className:"tw-size-3"}))))),Ft.default.createElement("div",null,Ft.default.createElement(Rt,null,Ft.default.createElement(jt,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},Ft.default.createElement(E3,{className:"tw-size-4"}))),Ft.default.createElement(Mt,null,"New Chat")),!i.autosaveChat&&Ft.default.createElement(Rt,null,Ft.default.createElement(jt,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},Ft.default.createElement(g3,{className:"tw-size-4"}))),Ft.default.createElement(Mt,null,"Save Chat as Note")),Ft.default.createElement(Rt,null,Ft.default.createElement(jt,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"icon",title:"Chat History",onClick:r},Ft.default.createElement(C3,{className:"tw-size-4"}))),Ft.default.createElement(Mt,null,"Chat History")),Ft.default.createElement(WW,null,Ft.default.createElement(KW,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"icon",title:"Advanced Settings"},Ft.default.createElement(vT,{className:"tw-size-4"}))),Ft.default.createElement(xb,{align:"end",className:"tw-w-64"},Ft.default.createElement(Si,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),dt("showSuggestedPrompts",!i.showSuggestedPrompts)}},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ft.default.createElement(Vh,{className:"tw-size-4"}),"Suggested Prompt"),Ft.default.createElement(cz,{checked:i.showSuggestedPrompts})),Ft.default.createElement(Si,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),dt("showRelevantNotes",!i.showRelevantNotes)}},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ft.default.createElement(Ay,{className:"tw-size-4"}),"Relevant Note"),Ft.default.createElement(cz,{checked:i.showRelevantNotes})),a==="project"?Ft.default.createElement(Ft.default.Fragment,null,Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>Jce()},Ft.default.createElement(m_,{className:"tw-size-4"}),"Reload Current Project"),Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>iOn()},Ft.default.createElement(Uf,{className:"tw-size-4"}),"Force Rebuild Context")):Ft.default.createElement(Ft.default.Fragment,null,Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>nOn()},Ft.default.createElement(m_,{className:"tw-size-4"}),"Refresh Vault Index"),Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>{new sd(app,()=>oOn(),"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()}},Ft.default.createElement(Uf,{className:"tw-size-4"}),"Force Reindex Vault"))))))}Cl();Fd();var q6t=require("obsidian");var Yce=require("obsidian"),pz=class extends Yce.FuzzySuggestModal{constructor(e){super(e),this.activeNote=e.workspace.getActiveFile()}getOrderedNotes(e=[]){let r=this.app.workspace.getLastOpenFiles().map(i=>this.app.vault.getAbstractFileByPath(i)).filter(i=>i instanceof Yce.TFile&&(i.extension==="md"||i.extension==="pdf"||i.extension==="canvas")&&!e.includes(i.path)&&i.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(i=>i.extension==="md"||i.extension==="pdf"||i.extension==="canvas").filter(i=>!r.some(a=>a.path===i.path)&&!e.includes(i.path)&&i.path!==this.activeNote?.path);return[...this.activeNote?[this.activeNote]:[],...r,...o]}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n==="pdf"?o+=" (PDF)":n==="canvas"&&(o+=" (Canvas)"),o}};var SM=class extends pz{constructor({app:e,onNoteSelect:r,excludeNotePaths:n,titleOnly:o=!1}){super(e),this.onNoteSelect=r,this.availableNotes=this.getOrderedNotes(n),this.titleOnly=o}getItems(){if(this.titleOnly){let e=new Map;return this.availableNotes.forEach(r=>{e.set(r.basename,r)}),Array.from(e.values())}return this.availableNotes}getItemText(e){let r=e.path===this.activeNote?.path;return this.formatNoteTitle(e.basename,r,e.extension)}onChooseItem(e,r){this.onNoteSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof q6t.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 Zce=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 U6t=require("obsidian"),XW=class extends U6t.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)}};ti();var Qx=F(X());Cn();yn();$r();var Eke=({capabilities:t=[],iconSize:e=16})=>Qx.default.createElement(Qx.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return Qx.default.createElement(eO,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return Qx.default.createElement(QC,{key:n,className:"tw-text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return Qx.default.createElement(u1,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),Tke=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return Qx.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Qx.default.createElement("span",null,r),t.capabilities&&t.capabilities.length>0&&Qx.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5"},Qx.default.createElement(Eke,{capabilities:t.capabilities,iconSize:e})))},Xce=t=>{let e=t.displayName||t.name,r=`(${kf(t.provider)})`;return`${e} ${r}`},QW=t=>{let e=t.displayName||t.name,r=`(${kf(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}`};Cl();Fd();var z6t=require("obsidian");$r();var mz=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 z6t.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],` +`)},fxn=0,cz=[];function $Vt(t){var e=ya.useRef([]),r=ya.useRef([0,0]),n=ya.useRef(),o=ya.useState(fxn++)[0],i=ya.useState(iE)[0],a=ya.useRef(t);ya.useEffect(function(){a.current=t},[t]),ya.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=sz([t.lockRef.current],(t.shards||[]).map(kVt),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=ya.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=$ce(h),y=r.current,S="deltaX"in h?h.deltaX:y[0]-g[0],x="deltaY"in h?h.deltaY:y[1]-g[1],O,P=h.target,E=Math.abs(S)>Math.abs(x)?"h":"v";if("touches"in h&&E==="h"&&P.type==="range")return!1;var A=KFe(E,P);if(!A)return!0;if(A?O=E:(O=E==="v"?"h":"v",A=KFe(E,P)),!A)return!1;if(!n.current&&"changedTouches"in h&&(S||x)&&(n.current=O),!O)return!0;var I=n.current||O;return LVt(I,b,h,I==="h"?S:x,!0)},[]),u=ya.useCallback(function(h){var b=h;if(!(!cz.length||cz[cz.length-1]!==i)){var g="deltaY"in b?FVt(b):$ce(b),y=e.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&cxn(O.delta,g)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var S=(a.current.shards||[]).map(kVt).filter(Boolean).filter(function(O){return O.contains(b.target)}),x=S.length>0?s(b,S[0]):!a.current.noIsolation;x&&b.cancelable&&b.preventDefault()}}},[]),l=ya.useCallback(function(h,b,g,y){var S={name:h,delta:b,target:g,should:y,shadowParent:pxn(g)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(x){return x!==S})},1)},[]),c=ya.useCallback(function(h){r.current=$ce(h),n.current=void 0},[]),d=ya.useCallback(function(h){l(h.type,FVt(h),h.target,s(h,t.lockRef.current))},[]),f=ya.useCallback(function(h){l(h.type,$ce(h),h.target,s(h,t.lockRef.current))},[]);ya.useEffect(function(){return cz.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,GD),document.addEventListener("touchmove",u,GD),document.addEventListener("touchstart",c,GD),function(){cz=cz.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,GD),document.removeEventListener("touchmove",u,GD),document.removeEventListener("touchstart",c,GD)}},[]);var p=t.removeScrollBar,m=t.inert;return ya.createElement(ya.Fragment,null,m?ya.createElement(i,{styles:dxn(o)}):null,p?ya.createElement(KD,{gapMode:t.gapMode}):null)}function pxn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var BVt=WD(kce,$Vt);var qVt=Bce.forwardRef(function(t,e){return Bce.createElement($W,yi({},t,{ref:e,sideCar:BVt}))});qVt.classNames=$W.classNames;var GFe=qVt;var Mr=F(pt(),1),JFe=["Enter"," "],mxn=["ArrowDown","PageUp","Home"],zVt=["ArrowUp","PageDown","End"],hxn=[...mxn,...zVt],gxn={ltr:[...JFe,"ArrowRight"],rtl:[...JFe,"ArrowLeft"]},yxn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},HW="Menu",[UW,bxn,_xn]=U3t(HW),[JD,YFe]=Yi(HW,[_xn,TFe,FFe]),VW=TFe(),HVt=FFe(),[VVt,vM]=JD(HW),[vxn,WW]=JD(HW),WVt=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=VW(e),[u,l]=zt.useState(null),c=zt.useRef(!1),d=Ur(i),f=nM(o);return zt.useEffect(()=>{let p=()=>{c.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),(0,Mr.jsx)(IFe,{...s,children:(0,Mr.jsx)(VVt,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,Mr.jsx)(vxn,{scope:e,onClose:zt.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};WVt.displayName=HW;var wxn="MenuAnchor",ZFe=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=VW(r);return(0,Mr.jsx)(rVt,{...o,...n,ref:e})});ZFe.displayName=wxn;var XFe="MenuPortal",[Sxn,KVt]=JD(XFe,{forceMount:void 0}),GVt=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=vM(XFe,e);return(0,Mr.jsx)(Sxn,{scope:e,forceMount:r,children:(0,Mr.jsx)(fd,{present:r||i.open,children:(0,Mr.jsx)(MFe,{asChild:!0,container:o,children:n})})})};GVt.displayName=XFe;var Yg="MenuContent",[xxn,QFe]=JD(Yg),JVt=zt.forwardRef((t,e)=>{let r=KVt(Yg,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=vM(Yg,t.__scopeMenu),a=WW(Yg,t.__scopeMenu);return(0,Mr.jsx)(UW.Provider,{scope:t.__scopeMenu,children:(0,Mr.jsx)(fd,{present:n||i.open,children:(0,Mr.jsx)(UW.Slot,{scope:t.__scopeMenu,children:a.modal?(0,Mr.jsx)(Cxn,{...o,ref:e}):(0,Mr.jsx)(Oxn,{...o,ref:e})})})})}),Cxn=zt.forwardRef((t,e)=>{let r=vM(Yg,t.__scopeMenu),n=zt.useRef(null),o=cd(e,n);return zt.useEffect(()=>{let i=n.current;if(i)return bM(i)},[]),(0,Mr.jsx)(eke,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Zi(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Oxn=zt.forwardRef((t,e)=>{let r=vM(Yg,t.__scopeMenu);return(0,Mr.jsx)(eke,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),eke=zt.forwardRef((t,e)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=t,b=vM(Yg,r),g=WW(Yg,r),y=VW(r),S=HVt(r),x=bxn(r),[O,P]=zt.useState(null),E=zt.useRef(null),A=cd(e,E,b.onContentChange),I=zt.useRef(0),R=zt.useRef(""),N=zt.useRef(0),j=zt.useRef(null),$=zt.useRef("right"),k=zt.useRef(0),z=m?GFe:zt.Fragment,V=m?{as:tM,allowPinchZoom:!0}:void 0,Q=D=>{let B=R.current+D,q=x().filter(Y=>!Y.disabled),K=document.activeElement,H=q.find(Y=>Y.ref.current===K)?.textValue,ee=q.map(Y=>Y.textValue),U=kxn(ee,B,H),W=q.find(Y=>Y.textValue===U)?.ref.current;(function Y(ae){R.current=ae,window.clearTimeout(I.current),ae!==""&&(I.current=window.setTimeout(()=>Y(""),1e3))})(B),W&&setTimeout(()=>W.focus())};zt.useEffect(()=>()=>window.clearTimeout(I.current),[]),iM();let J=zt.useCallback(D=>$.current===j.current?.side&&Bxn(D,j.current?.area),[]);return(0,Mr.jsx)(xxn,{scope:r,searchRef:R,onItemEnter:zt.useCallback(D=>{J(D)&&D.preventDefault()},[J]),onItemLeave:zt.useCallback(D=>{J(D)||(E.current?.focus(),P(null))},[J]),onTriggerLeave:zt.useCallback(D=>{J(D)&&D.preventDefault()},[J]),pointerGraceTimerRef:N,onPointerGraceIntentChange:zt.useCallback(D=>{j.current=D},[]),children:(0,Mr.jsx)(z,{...V,children:(0,Mr.jsx)(bFe,{asChild:!0,trapped:o,onMountAutoFocus:Zi(i,D=>{D.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,Mr.jsx)(mFe,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Mr.jsx)(wVt,{asChild:!0,...S,dir:g.dir,orientation:"vertical",loop:n,currentTabStopId:O,onCurrentTabStopIdChange:P,onEntryFocus:Zi(u,D=>{g.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Mr.jsx)(nVt,{role:"menu","aria-orientation":"vertical","data-state":d8t(b.open),"data-radix-menu-content":"",dir:g.dir,...y,...h,ref:A,style:{outline:"none",...h.style},onKeyDown:Zi(h.onKeyDown,D=>{let q=D.target.closest("[data-radix-menu-content]")===D.currentTarget,K=D.ctrlKey||D.altKey||D.metaKey,H=D.key.length===1;q&&(D.key==="Tab"&&D.preventDefault(),!K&&H&&Q(D.key));let ee=E.current;if(D.target!==ee||!hxn.includes(D.key))return;D.preventDefault();let W=x().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);zVt.includes(D.key)&&W.reverse(),Lxn(W)}),onBlur:Zi(t.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(I.current),R.current="")}),onPointerMove:Zi(t.onPointerMove,zW(D=>{let B=D.target,q=k.current!==D.clientX;if(D.currentTarget.contains(B)&&q){let K=D.clientX>k.current?"right":"left";$.current=K,k.current=D.clientX}}))})})})})})})});JVt.displayName=Yg;var Pxn="MenuGroup",tke=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Mr.jsx)(_c.div,{role:"group",...n,ref:e})});tke.displayName=Pxn;var Exn="MenuLabel",YVt=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Mr.jsx)(_c.div,{...n,ref:e})});YVt.displayName=Exn;var qce="MenuItem",UVt="menu.itemSelect",zce=zt.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=zt.useRef(null),a=WW(qce,t.__scopeMenu),s=QFe(qce,t.__scopeMenu),u=cd(e,i),l=zt.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(UVt,{bubbles:!0,cancelable:!0});d.addEventListener(UVt,p=>n?.(p),{once:!0}),gce(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,Mr.jsx)(ZVt,{...o,ref:u,disabled:r,onClick:Zi(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:Zi(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:Zi(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||JFe.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});zce.displayName=qce;var ZVt=zt.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=QFe(qce,r),s=HVt(r),u=zt.useRef(null),l=cd(e,u),[c,d]=zt.useState(!1),[f,p]=zt.useState("");return zt.useEffect(()=>{let m=u.current;m&&p((m.textContent??"").trim())},[i.children]),(0,Mr.jsx)(UW.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,Mr.jsx)(SVt,{asChild:!0,...s,focusable:!n,children:(0,Mr.jsx)(_c.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:Zi(t.onPointerMove,zW(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Zi(t.onPointerLeave,zW(m=>a.onItemLeave(m))),onFocus:Zi(t.onFocus,()=>d(!0)),onBlur:Zi(t.onBlur,()=>d(!1))})})})}),Txn="MenuCheckboxItem",XVt=zt.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,Mr.jsx)(n8t,{scope:t.__scopeMenu,checked:r,children:(0,Mr.jsx)(zce,{role:"menuitemcheckbox","aria-checked":Uce(r)?"mixed":r,...o,ref:e,"data-state":oke(r),onSelect:Zi(o.onSelect,()=>n?.(Uce(r)?!0:!r),{checkForDefaultPrevented:!1})})})});XVt.displayName=Txn;var QVt="MenuRadioGroup",[Axn,Ixn]=JD(QVt,{value:void 0,onValueChange:()=>{}}),e8t=zt.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=Ur(n);return(0,Mr.jsx)(Axn,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,Mr.jsx)(tke,{...o,ref:e})})});e8t.displayName=QVt;var t8t="MenuRadioItem",r8t=zt.forwardRef((t,e)=>{let{value:r,...n}=t,o=Ixn(t8t,t.__scopeMenu),i=r===o.value;return(0,Mr.jsx)(n8t,{scope:t.__scopeMenu,checked:i,children:(0,Mr.jsx)(zce,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":oke(i),onSelect:Zi(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});r8t.displayName=t8t;var rke="MenuItemIndicator",[n8t,Mxn]=JD(rke,{checked:!1}),o8t=zt.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=Mxn(rke,r);return(0,Mr.jsx)(fd,{present:n||Uce(i.checked)||i.checked===!0,children:(0,Mr.jsx)(_c.span,{...o,ref:e,"data-state":oke(i.checked)})})});o8t.displayName=rke;var Rxn="MenuSeparator",i8t=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Mr.jsx)(_c.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});i8t.displayName=Rxn;var jxn="MenuArrow",a8t=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=VW(r);return(0,Mr.jsx)(oVt,{...o,...n,ref:e})});a8t.displayName=jxn;var nke="MenuSub",[Nxn,s8t]=JD(nke),Dxn=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=vM(nke,e),a=VW(e),[s,u]=zt.useState(null),[l,c]=zt.useState(null),d=Ur(o);return zt.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,Mr.jsx)(IFe,{...a,children:(0,Mr.jsx)(VVt,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,Mr.jsx)(Nxn,{scope:e,contentId:hl(),triggerId:hl(),trigger:s,onTriggerChange:u,children:r})})})};Dxn.displayName=nke;var qW="MenuSubTrigger",u8t=zt.forwardRef((t,e)=>{let r=vM(qW,t.__scopeMenu),n=WW(qW,t.__scopeMenu),o=s8t(qW,t.__scopeMenu),i=QFe(qW,t.__scopeMenu),a=zt.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=zt.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return zt.useEffect(()=>c,[c]),zt.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,Mr.jsx)(ZFe,{asChild:!0,...l,children:(0,Mr.jsx)(ZVt,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":d8t(r.open),...t,ref:RW(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Zi(t.onPointerMove,zW(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:Zi(t.onPointerLeave,zW(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,m=p==="right",h=m?-5:5,b=f[m?"left":"right"],g=f[m?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+h,y:d.clientY},{x:b,y:f.top},{x:g,y:f.top},{x:g,y:f.bottom},{x:b,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:Zi(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||gxn[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});u8t.displayName=qW;var l8t="MenuSubContent",c8t=zt.forwardRef((t,e)=>{let r=KVt(Yg,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=vM(Yg,t.__scopeMenu),a=WW(Yg,t.__scopeMenu),s=s8t(l8t,t.__scopeMenu),u=zt.useRef(null),l=cd(e,u);return(0,Mr.jsx)(UW.Provider,{scope:t.__scopeMenu,children:(0,Mr.jsx)(fd,{present:n||i.open,children:(0,Mr.jsx)(UW.Slot,{scope:t.__scopeMenu,children:(0,Mr.jsx)(eke,{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:Zi(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Zi(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:Zi(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=yxn[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});c8t.displayName=l8t;function d8t(t){return t?"open":"closed"}function Uce(t){return t==="indeterminate"}function oke(t){return Uce(t)?"indeterminate":t?"checked":"unchecked"}function Lxn(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function Fxn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function kxn(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=Fxn(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 $xn(t,e){let{x:r,y:n}=t,o=!1;for(let i=0,a=e.length-1;in!=c>n&&r<(l-s)*(n-u)/(c-u)+s&&(o=!o)}return o}function Bxn(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return $xn(r,e)}function zW(t){return e=>e.pointerType==="mouse"?t(e):void 0}var f8t=WVt,p8t=ZFe,m8t=GVt,h8t=JVt,g8t=tke,y8t=YVt,b8t=zce,_8t=XVt,v8t=e8t,w8t=r8t,S8t=o8t,x8t=i8t,C8t=a8t;var O8t=u8t,P8t=c8t;var wc=F(pt(),1),ike="DropdownMenu",[Uxn,Bui]=Yi(ike,[YFe]),np=YFe(),[zxn,E8t]=Uxn(ike),KW=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=np(e),l=$l.useRef(null),[c=!1,d]=ud({prop:o,defaultProp:i,onChange:a});return(0,wc.jsx)(zxn,{scope:e,triggerId:hl(),triggerRef:l,contentId:hl(),open:c,onOpenChange:d,onOpenToggle:$l.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,wc.jsx)(f8t,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};KW.displayName=ike;var T8t="DropdownMenuTrigger",GW=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=E8t(T8t,r),a=np(r);return(0,wc.jsx)(p8t,{asChild:!0,...a,children:(0,wc.jsx)($3t.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:pce(e,i.triggerRef),onPointerDown:MW(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:MW(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});GW.displayName=T8t;var Hxn="DropdownMenuPortal",A8t=t=>{let{__scopeDropdownMenu:e,...r}=t,n=np(e);return(0,wc.jsx)(m8t,{...n,...r})};A8t.displayName=Hxn;var I8t="DropdownMenuContent",M8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=E8t(I8t,r),i=np(r),a=$l.useRef(!1);return(0,wc.jsx)(h8t,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:MW(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:MW(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)"}})});M8t.displayName=I8t;var Vxn="DropdownMenuGroup",Wxn=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(g8t,{...o,...n,ref:e})});Wxn.displayName=Vxn;var Kxn="DropdownMenuLabel",R8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(y8t,{...o,...n,ref:e})});R8t.displayName=Kxn;var Gxn="DropdownMenuItem",j8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(b8t,{...o,...n,ref:e})});j8t.displayName=Gxn;var Jxn="DropdownMenuCheckboxItem",N8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(_8t,{...o,...n,ref:e})});N8t.displayName=Jxn;var Yxn="DropdownMenuRadioGroup",Zxn=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(v8t,{...o,...n,ref:e})});Zxn.displayName=Yxn;var Xxn="DropdownMenuRadioItem",D8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(w8t,{...o,...n,ref:e})});D8t.displayName=Xxn;var Qxn="DropdownMenuItemIndicator",L8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(S8t,{...o,...n,ref:e})});L8t.displayName=Qxn;var eCn="DropdownMenuSeparator",F8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(x8t,{...o,...n,ref:e})});F8t.displayName=eCn;var tCn="DropdownMenuArrow",rCn=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(C8t,{...o,...n,ref:e})});rCn.displayName=tCn;var nCn="DropdownMenuSubTrigger",k8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(O8t,{...o,...n,ref:e})});k8t.displayName=nCn;var oCn="DropdownMenuSubContent",$8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(P8t,{...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)"}})});$8t.displayName=oCn;var B8t=KW,q8t=GW,U8t=A8t,ake=M8t;var ske=R8t,uke=j8t,lke=N8t;var cke=D8t,dke=L8t,fke=F8t;var pke=k8t,mke=$8t;bn();Tn();var YD=B8t,ZD=q8t;var aCn=$i.forwardRef(({className:t,inset:e,children:r,...n},o)=>$i.createElement(pke,{ref:o,className:_e("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,$i.createElement(XC,{className:"tw-ml-auto"})));aCn.displayName=pke.displayName;var sCn=$i.forwardRef(({className:t,...e},r)=>$i.createElement(mke,{ref:r,className:_e("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}));sCn.displayName=mke.displayName;var xb=$i.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>$i.createElement(U8t,{container:r??activeDocument.body},$i.createElement(ake,{ref:o,sideOffset:e,className:_e("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})));xb.displayName=ake.displayName;var Si=$i.forwardRef(({className:t,inset:e,...r},n)=>$i.createElement(uke,{ref:n,className:_e("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}));Si.displayName=uke.displayName;var uCn=$i.forwardRef(({className:t,children:e,checked:r,...n},o)=>$i.createElement(lke,{ref:o,className:_e("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},$i.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},$i.createElement(dke,null,$i.createElement(Jl,{className:"tw-size-4"}))),e));uCn.displayName=lke.displayName;var lCn=$i.forwardRef(({className:t,children:e,...r},n)=>$i.createElement(cke,{ref:n,className:_e("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},$i.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},$i.createElement(dke,null,$i.createElement(f3,{className:"tw-size-2 tw-fill-current"}))),e));lCn.displayName=cke.displayName;var cCn=$i.forwardRef(({className:t,inset:e,...r},n)=>$i.createElement(ske,{ref:n,className:_e("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",e&&"tw-pl-8",t),...r}));cCn.displayName=ske.displayName;var dCn=$i.forwardRef(({className:t,...e},r)=>$i.createElement(fke,{ref:r,className:_e("-tw-mx-1 tw-my-1 tw-h-px",t),...e}));dCn.displayName=fke.displayName;var fCn=({className:t,...e})=>$i.createElement("span",{className:_e("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",t),...e});fCn.displayName="DropdownMenuShortcut";var JW=F(X());Tn();var dz=JW.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 JW.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:_e("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},JW.createElement("div",{className:_e("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")}))});dz.displayName="SettingSwitch";var XW=F(X());var en=F(X(),1);function Cb(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var H8t=F(X(),1);function z8t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function pCn(...t){return e=>{let r=!1,n=t.map(o=>{let i=z8t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=aE.useMemo(()=>m,Object.values(m));return(0,V8t.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=aE.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>aE.createContext(a));return function(s){let u=s?.[t]||i;return aE.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,mCn(o,...e)]}function mCn(...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 aE.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var es=F(X(),1);var W8t=F(X(),1),K8t=F(ds(),1);a1();var G8t=F(pt(),1),hCn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Zg=hCn.reduce((t,e)=>{let r=JC(`Primitive.${e}`),n=W8t.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,G8t.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function J8t(t,e){t&&K8t.flushSync(()=>t.dispatchEvent(e))}var fz=F(X(),1);function XD(t){let e=fz.useRef(t);return fz.useEffect(()=>{e.current=t}),fz.useMemo(()=>(...r)=>e.current?.(...r),[])}var Y8t=F(X(),1);function Z8t(t,e=globalThis?.document){let r=XD(t);Y8t.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 gke=F(pt(),1),gCn="DismissableLayer",hke="dismissableLayer.update",yCn="dismissableLayer.pointerDownOutside",bCn="dismissableLayer.focusOutside",X8t,e6t=es.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yke=es.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=es.useContext(e6t),[c,d]=es.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=es.useState({}),m=Ob(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=wCn(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=SCn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return Z8t(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),es.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(X8t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Q8t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=X8t)}},[c,f,r,l]),es.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Q8t())},[c,l]),es.useEffect(()=>{let E=()=>p({});return document.addEventListener(hke,E),()=>document.removeEventListener(hke,E)},[]),(0,gke.jsx)(Zg.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:Cb(t.onFocusCapture,P.onFocusCapture),onBlurCapture:Cb(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Cb(t.onPointerDownCapture,O.onPointerDownCapture)})});yke.displayName=gCn;var _Cn="DismissableLayerBranch",vCn=es.forwardRef((t,e)=>{let r=es.useContext(e6t),n=es.useRef(null),o=Ob(e,n);return es.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,gke.jsx)(Zg.div,{...t,ref:o})});vCn.displayName=_Cn;function wCn(t,e=globalThis?.document){let r=XD(t),n=es.useRef(!1),o=es.useRef(()=>{});return es.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){t6t(yCn,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 SCn(t,e=globalThis?.document){let r=XD(t),n=es.useRef(!1);return es.useEffect(()=>{let o=i=>{i.target&&!n.current&&t6t(bCn,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 Q8t(){let t=new CustomEvent(hke);document.dispatchEvent(t)}function t6t(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?J8t(o,i):o.dispatchEvent(i)}var bke=F(X(),1);var r6t=F(X(),1),sm=globalThis?.document?r6t.useLayoutEffect:()=>{};var xCn=bke[" useId ".trim().toString()]||(()=>{}),CCn=0;function n6t(t){let[e,r]=bke.useState(xCn());return sm(()=>{t||r(n=>n??String(CCn++))},[t]),t||(e?`radix-${e}`:"")}var ch=F(X(),1);var o6t=F(X(),1);var _ke=F(pt(),1),OCn="Arrow",i6t=o6t.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,_ke.jsx)(Zg.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,_ke.jsx)("polygon",{points:"0,0 30,0 15,10"})})});i6t.displayName=OCn;var a6t=i6t;var s6t=F(X(),1);function u6t(t){let[e,r]=s6t.useState(void 0);return sm(()=>{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 wM=F(pt(),1);var vke="Popper",[l6t,wke]=Hce(vke),[ECn,c6t]=l6t(vke),d6t=t=>{let{__scopePopper:e,children:r}=t,[n,o]=ch.useState(null);return(0,wM.jsx)(ECn,{scope:e,anchor:n,onAnchorChange:o,children:r})};d6t.displayName=vke;var f6t="PopperAnchor",p6t=ch.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=c6t(f6t,r),a=ch.useRef(null),s=Ob(e,a);return ch.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,wM.jsx)(Zg.div,{...o,ref:s})});p6t.displayName=f6t;var Ske="PopperContent",[TCn,ACn]=l6t(Ske),m6t=ch.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=c6t(Ske,r),[g,y]=ch.useState(null),S=Ob(e,Y=>y(Y)),[x,O]=ch.useState(null),P=u6t(x),E=P?.width??0,A=P?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],j=N.length>0,$={padding:R,boundary:N.filter(MCn),altBoundary:j},{refs:k,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:J}=sM({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>oE(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[uM({mainAxis:o+A,alignmentAxis:a}),u&&lM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cM():void 0,...$}),u&&dM({...$}),fM({...$,apply:({elements:Y,rects:ae,availableWidth:Oe,availableHeight:le})=>{let{width:Be,height:ze}=ae.reference,rt=Y.floating.style;rt.setProperty("--radix-popper-available-width",`${Oe}px`),rt.setProperty("--radix-popper-available-height",`${le}px`),rt.setProperty("--radix-popper-anchor-width",`${Be}px`),rt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),x&&mM({element:x,padding:s}),RCn({arrowWidth:E,arrowHeight:A}),f&&pM({strategy:"referenceHidden",...$})]}),[D,B]=y6t(V),q=XD(m);sm(()=>{Q&&q?.()},[Q,q]);let K=J.arrow?.x,H=J.arrow?.y,ee=J.arrow?.centerOffset!==0,[U,W]=ch.useState();return sm(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,wM.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,wM.jsx)(TCn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:H,shouldHideArrow:ee,children:(0,wM.jsx)(Zg.div,{"data-side":D,"data-align":B,...h,ref:S,style:{...h.style,animation:Q?void 0:"none"}})})})});m6t.displayName=Ske;var h6t="PopperArrow",ICn={top:"bottom",right:"left",bottom:"top",left:"right"},g6t=ch.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=ACn(h6t,n),a=ICn[i.placedSide];return(0,wM.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,wM.jsx)(a6t,{...o,ref:r,style:{...o.style,display:"block"}})})});g6t.displayName=h6t;function MCn(t){return t!==null}var RCn=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]=y6t(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function y6t(t){let[e,r="center"]=t.split("-");return[e,r]}var b6t=d6t,_6t=p6t,v6t=m6t,w6t=g6t;var Vce=F(X(),1),S6t=F(ds(),1);var x6t=F(pt(),1),NCn="Portal",xke=Vce.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Vce.useState(!1);sm(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?S6t.default.createPortal((0,x6t.jsx)(Zg.div,{...n,ref:e}),a):null});xke.displayName=NCn;var um=F(X(),1);var C6t=F(X(),1);function DCn(t,e){return C6t.useReducer((r,n)=>e[r][n]??r,t)}var Kce=t=>{let{present:e,children:r}=t,n=LCn(e),o=typeof r=="function"?r({present:n.isPresent}):um.Children.only(r),i=Ob(n.ref,FCn(o));return typeof r=="function"||n.isPresent?um.cloneElement(o,{ref:i}):null};Kce.displayName="Presence";function LCn(t){let[e,r]=um.useState(),n=um.useRef(null),o=um.useRef(t),i=um.useRef("none"),a=t?"mounted":"unmounted",[s,u]=DCn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return um.useEffect(()=>{let l=Wce(n.current);i.current=s==="mounted"?l:"none"},[s]),sm(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Wce(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),sm(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Wce(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let b=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},f=p=>{p.target===e&&(i.current=Wce(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:um.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function Wce(t){return t?.animationName||"none"}function FCn(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)}a1();var Xg=F(X(),1);var Gce=F(X(),1);var kCn=Xg[" useInsertionEffect ".trim().toString()]||sm;function O6t({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=$Cn({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=Xg.useRef(t!==void 0);Xg.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=Xg.useCallback(c=>{if(s){let d=BCn(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function $Cn({defaultProp:t,onChange:e}){let[r,n]=Xg.useState(t),o=Xg.useRef(r),i=Xg.useRef(e);return kCn(()=>{i.current=e},[e]),Xg.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function BCn(t){return typeof t=="function"}var Ali=Symbol("RADIX:SYNC_STATE");var A6t=F(X(),1);var P6t=F(X(),1),qCn=F(ds(),1);a1();var E6t=F(pt(),1),UCn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],T6t=UCn.reduce((t,e)=>{let r=JC(`Primitive.${e}`),n=P6t.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,E6t.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var I6t=F(pt(),1),zCn=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"}),HCn="VisuallyHidden",M6t=A6t.forwardRef((t,e)=>(0,I6t.jsx)(T6t.span,{...t,ref:e,style:{...zCn,...t.style}}));M6t.displayName=HCn;var R6t=M6t;var yl=F(pt(),1),[Jce,Vli]=Hce("Tooltip",[wke]),Yce=wke(),j6t="TooltipProvider",WCn=700,Cke="tooltip.open",[KCn,Pke]=Jce(j6t),N6t=t=>{let{__scopeTooltip:e,delayDuration:r=WCn,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,a=en.useRef(!0),s=en.useRef(!1),u=en.useRef(0);return en.useEffect(()=>{let l=u.current;return()=>window.clearTimeout(l)},[]),(0,yl.jsx)(KCn,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:en.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:en.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:en.useCallback(l=>{s.current=l},[]),disableHoverableContent:o,children:i})};N6t.displayName=j6t;var YW="Tooltip",[GCn,ZW]=Jce(YW),D6t=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=Pke(YW,t.__scopeTooltip),l=Yce(e),[c,d]=en.useState(null),f=n6t(),p=en.useRef(0),m=a??u.disableHoverableContent,h=s??u.delayDuration,b=en.useRef(!1),[g,y]=O6t({prop:n,defaultProp:o??!1,onChange:E=>{E?(u.onOpen(),document.dispatchEvent(new CustomEvent(Cke))):u.onClose(),i?.(E)},caller:YW}),S=en.useMemo(()=>g?b.current?"delayed-open":"instant-open":"closed",[g]),x=en.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,y(!0)},[y]),O=en.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),P=en.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,y(!0),p.current=0},h)},[h,y]);return en.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,yl.jsx)(b6t,{...l,children:(0,yl.jsx)(GCn,{scope:e,contentId:f,open:g,stateAttribute:S,trigger:c,onTriggerChange:d,onTriggerEnter:en.useCallback(()=>{u.isOpenDelayedRef.current?P():x()},[u.isOpenDelayedRef,P,x]),onTriggerLeave:en.useCallback(()=>{m?O():(window.clearTimeout(p.current),p.current=0)},[O,m]),onOpen:x,onClose:O,disableHoverableContent:m,children:r})})};D6t.displayName=YW;var Oke="TooltipTrigger",L6t=en.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=ZW(Oke,r),i=Pke(Oke,r),a=Yce(r),s=en.useRef(null),u=Ob(e,s,o.onTriggerChange),l=en.useRef(!1),c=en.useRef(!1),d=en.useCallback(()=>l.current=!1,[]);return en.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,yl.jsx)(_6t,{asChild:!0,...a,children:(0,yl.jsx)(Zg.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:Cb(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:Cb(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:Cb(t.onPointerDown,()=>{o.open&&o.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Cb(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:Cb(t.onBlur,o.onClose),onClick:Cb(t.onClick,o.onClose)})})});L6t.displayName=Oke;var Eke="TooltipPortal",[JCn,YCn]=Jce(Eke,{forceMount:void 0}),F6t=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=ZW(Eke,e);return(0,yl.jsx)(JCn,{scope:e,forceMount:r,children:(0,yl.jsx)(Kce,{present:r||i.open,children:(0,yl.jsx)(xke,{asChild:!0,container:o,children:n})})})};F6t.displayName=Eke;var pz="TooltipContent",k6t=en.forwardRef((t,e)=>{let r=YCn(pz,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=ZW(pz,t.__scopeTooltip);return(0,yl.jsx)(Kce,{present:n||a.open,children:a.disableHoverableContent?(0,yl.jsx)($6t,{side:o,...i,ref:e}):(0,yl.jsx)(ZCn,{side:o,...i,ref:e})})}),ZCn=en.forwardRef((t,e)=>{let r=ZW(pz,t.__scopeTooltip),n=Pke(pz,t.__scopeTooltip),o=en.useRef(null),i=Ob(e,o),[a,s]=en.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=en.useCallback(()=>{s(null),d(!1)},[d]),p=en.useCallback((m,h)=>{let b=m.currentTarget,g={x:m.clientX,y:m.clientY},y=rOn(g,b.getBoundingClientRect()),S=nOn(g,y),x=oOn(h.getBoundingClientRect()),O=aOn([...S,...x]);s(O),d(!0)},[d]);return en.useEffect(()=>()=>f(),[f]),en.useEffect(()=>{if(u&&c){let m=b=>p(b,c),h=b=>p(b,u);return u.addEventListener("pointerleave",m),c.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",h)}}},[u,c,p,f]),en.useEffect(()=>{if(a){let m=h=>{let b=h.target,g={x:h.clientX,y:h.clientY},y=u?.contains(b)||c?.contains(b),S=!iOn(g,a);y?f():S&&(f(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[u,c,a,l,f]),(0,yl.jsx)($6t,{...t,ref:i})}),[XCn,QCn]=Jce(YW,{isInside:!1}),eOn=FWe("TooltipContent"),$6t=en.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=ZW(pz,r),l=Yce(r),{onClose:c}=u;return en.useEffect(()=>(document.addEventListener(Cke,c),()=>document.removeEventListener(Cke,c)),[c]),en.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,yl.jsx)(yke,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,yl.jsxs)(v6t,{"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,yl.jsx)(eOn,{children:n}),(0,yl.jsx)(XCn,{scope:r,isInside:!0,children:(0,yl.jsx)(R6t,{id:u.contentId,role:"tooltip",children:o||n})})]})})});k6t.displayName=pz;var B6t="TooltipArrow",tOn=en.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=Yce(r);return QCn(B6t,r).isInside?null:(0,yl.jsx)(w6t,{...o,...n,ref:e})});tOn.displayName=B6t;function rOn(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 nOn(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 oOn(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 iOn(t,e){let{x:r,y:n}=t,o=!1;for(let i=0,a=e.length-1;in!=f>n&&r<(d-l)*(n-c)/(f-c)+l&&(o=!o)}return o}function aOn(t){let e=t.slice();return e.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),sOn(e)}function sOn(t){if(t.length<=1)return t.slice();let e=[];for(let n=0;n=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 Zce=N6t,q6t=D6t,U6t=L6t,z6t=F6t,Tke=k6t;Tn();var vo=Zce,Rt=q6t,jt=U6t,Mt=XW.forwardRef(({className:t,sideOffset:e=4,...r},n)=>XW.createElement(z6t,{container:activeDocument.body},XW.createElement(Tke,{ref:n,sideOffset:e,className:_e("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})));Mt.displayName=Tke.displayName;$r();yo();oO();Mx();nr();bn();var dh=require("obsidian"),Ft=F(X());async function uOn(){try{await ma.getInstance().indexVaultToVectorStore(),new dh.Notice("Vault index refreshed.")}catch(t){console.error("Error refreshing vault index:",t),new dh.Notice("Failed to refresh vault index. Check console for details.")}}async function lOn(){try{await ma.getInstance().indexVaultToVectorStore(!0),new dh.Notice("Vault force reindexed.")}catch(t){console.error("Error force reindexing vault:",t),new dh.Notice("Failed to force reindex vault. Check console for details.")}}async function Xce(){let t=Mc();if(!t){new dh.Notice("No project is currently selected to reload.");return}try{GE(!0),await tb.getInstance().invalidateMarkdownContext(t,!0);let e=app.plugins.getPlugin("copilot");if(e&&e.projectManager)await e.projectManager.getProjectContext(t.id),new dh.Notice(`Project context for "${t.name}" reloaded successfully.`);else throw new Error("Copilot plugin or ProjectManager not available.")}catch(e){fe("Error reloading project context:",e),xN(e)||new dh.Notice("Failed to reload project context. Check console for details.")}finally{GE(!1)}}async function cOn(){let t=Mc();if(!t){new dh.Notice("No project is currently selected to rebuild.");return}new sd(app,async()=>{try{GE(!0),new dh.Notice(`Force rebuilding context for project: ${t.name}... This will take some time and re-fetch all data.`,1e4),H8.resetRateLimitNoticeTimer(),await tb.getInstance().clearForProject(t),new dh.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 dh.Notice(`Project context for "${t.name}" rebuilt successfully from scratch.`);else throw new Error("Copilot plugin or ProjectManager not available for rebuild.")}catch(r){fe("Error force rebuilding project context:",r),xN(r)||new dh.Notice("Failed to force rebuild project context. Check console for details.")}finally{GE(!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 V6t({onNewChat:t,onSaveAsNote:e,onLoadHistory:r,onModeChange:n,onCloseProject:o}){let i=Rn(),[a,s]=by(),u=xq(),l=c=>{s(c),n(c),c!=="project"&&(zR(null),o?.())};return Ft.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-p-1"},Ft.default.createElement("div",{className:"tw-flex-1"},Ft.default.createElement(KW,null,Ft.default.createElement(GW,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-ml-1"},a==="llm_chain"&&"chat (free)",a==="vault_qa"&&"vault QA (free)",a==="copilot_plus"&&Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ft.default.createElement(Vh,{className:"tw-size-4"}),"copilot plus (beta)"),a==="project"&&"projects (alpha)",Ft.default.createElement(Hi,{className:"tw-mt-0.5 tw-size-5"}))),Ft.default.createElement(xb,{align:"start"},Ft.default.createElement(Si,{onSelect:()=>{l("llm_chain")}},"chat (free)"),Ft.default.createElement(Si,{onSelect:()=>{l("vault_qa")}},"vault QA (free)"),u?Ft.default.createElement(Si,{onSelect:()=>{l("copilot_plus")}},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ft.default.createElement(Vh,{className:"tw-size-4"}),"copilot plus (beta)")):Ft.default.createElement(Si,{onSelect:()=>{m1(FC.CHAT_MODE_SELECT),o?.()}},"copilot plus (beta)",Ft.default.createElement(nO,{className:"tw-size-3"})),u?Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-1",onSelect:()=>{l("project")}},Ft.default.createElement(c1,{className:"tw-size-4"}),"projects (alpha)"):Ft.default.createElement(Si,{onSelect:()=>{m1(FC.CHAT_MODE_SELECT),o?.()}},"copilot plus (beta)",Ft.default.createElement(nO,{className:"tw-size-3"}))))),Ft.default.createElement("div",null,Ft.default.createElement(Rt,null,Ft.default.createElement(jt,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},Ft.default.createElement(T3,{className:"tw-size-4"}))),Ft.default.createElement(Mt,null,"New Chat")),!i.autosaveChat&&Ft.default.createElement(Rt,null,Ft.default.createElement(jt,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},Ft.default.createElement(y3,{className:"tw-size-4"}))),Ft.default.createElement(Mt,null,"Save Chat as Note")),Ft.default.createElement(Rt,null,Ft.default.createElement(jt,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"icon",title:"Chat History",onClick:r},Ft.default.createElement(O3,{className:"tw-size-4"}))),Ft.default.createElement(Mt,null,"Chat History")),Ft.default.createElement(KW,null,Ft.default.createElement(GW,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"icon",title:"Advanced Settings"},Ft.default.createElement(vT,{className:"tw-size-4"}))),Ft.default.createElement(xb,{align:"end",className:"tw-w-64"},Ft.default.createElement(Si,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),dt("showSuggestedPrompts",!i.showSuggestedPrompts)}},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ft.default.createElement(Vh,{className:"tw-size-4"}),"Suggested Prompt"),Ft.default.createElement(dz,{checked:i.showSuggestedPrompts})),Ft.default.createElement(Si,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),dt("showRelevantNotes",!i.showRelevantNotes)}},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ft.default.createElement(Ay,{className:"tw-size-4"}),"Relevant Note"),Ft.default.createElement(dz,{checked:i.showRelevantNotes})),a==="project"?Ft.default.createElement(Ft.default.Fragment,null,Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>Xce()},Ft.default.createElement(m_,{className:"tw-size-4"}),"Reload Current Project"),Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>cOn()},Ft.default.createElement(Uf,{className:"tw-size-4"}),"Force Rebuild Context")):Ft.default.createElement(Ft.default.Fragment,null,Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>uOn()},Ft.default.createElement(m_,{className:"tw-size-4"}),"Refresh Vault Index"),Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>{new sd(app,()=>lOn(),"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()}},Ft.default.createElement(Uf,{className:"tw-size-4"}),"Force Reindex Vault"))))))}Cl();Fd();var W6t=require("obsidian");var Qce=require("obsidian");yn();var mz=class extends Qce.FuzzySuggestModal{constructor(e){super(e),this.activeNote=e.workspace.getActiveFile()}getOrderedNotes(e=[]){let r=this.app.workspace.getLastOpenFiles().map(a=>this.app.vault.getAbstractFileByPath(a)).filter(a=>a instanceof Qce.TFile&&DR(a)&&!e.includes(a.path)&&a.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(a=>DR(a)).filter(a=>!r.some(s=>s.path===a.path)&&!e.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote&&DR(this.activeNote)?[this.activeNote]:[],...r,...o]}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n==="pdf"?o+=" (PDF)":n==="canvas"&&(o+=" (Canvas)"),o}};var SM=class extends mz{constructor({app:e,onNoteSelect:r,excludeNotePaths:n,titleOnly:o=!1}){super(e),this.onNoteSelect=r,this.availableNotes=this.getOrderedNotes(n),this.titleOnly=o}getItems(){if(this.titleOnly){let e=new Map;return this.availableNotes.forEach(r=>{e.set(r.basename,r)}),Array.from(e.values())}return this.availableNotes}getItemText(e){let r=e.path===this.activeNote?.path;return this.formatNoteTitle(e.basename,r,e.extension)}onChooseItem(e,r){this.onNoteSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof W6t.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 ede=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 K6t=require("obsidian"),QW=class extends K6t.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)}};ti();var eC=F(X());yn();bn();$r();var Ake=({capabilities:t=[],iconSize:e=16})=>eC.default.createElement(eC.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return eC.default.createElement(tO,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return eC.default.createElement(eO,{key:n,className:"tw-text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return eC.default.createElement(l1,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),Ike=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return eC.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},eC.default.createElement("span",null,r),t.capabilities&&t.capabilities.length>0&&eC.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5"},eC.default.createElement(Ake,{capabilities:t.capabilities,iconSize:e})))},tde=t=>{let e=t.displayName||t.name,r=`(${kf(t.provider)})`;return`${e} ${r}`},e9=t=>{let e=t.displayName||t.name,r=`(${kf(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}`};Cl();Fd();var G6t=require("obsidian");$r();var hz=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 G6t.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],` Embedded PDF (${s}): ${l} @@ -928,7 +928,7 @@ ${l} Embedded PDF (${s}): [Error: Could not process PDF] -`)}}return e}async processContextNotes(e,r,n,o,i,a,s){let u="",l=async(d,f=f4)=>{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(s!=="copilot_plus"&&d.extension!=="md"&&d.extension!=="canvas"){console.warn(`File type ${d.extension} requires Copilot Plus mode for context processing.`);return}let p=await r.parseFile(d,n);d.extension==="md"&&s==="copilot_plus"&&(p=await this.processEmbeddedPDFs(p,n,r)),u+=` +`)}}return e}async processContextNotes(e,r,n,o,i,a,s){let u="",l=async(d,f=p4)=>{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(s!=="copilot_plus"&&d.extension!=="md"&&d.extension!=="canvas"){console.warn(`File type ${d.extension} requires Copilot Plus mode for context processing.`);return}let p=await r.parseFile(d,n);d.extension==="md"&&s==="copilot_plus"&&(p=await this.processEmbeddedPDFs(p,n,r)),u+=` <${f}> Title: [[${d.basename}]] @@ -942,7 +942,7 @@ ${p} Path: ${d.path} [Error: Could not process file] -`}},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=hJ();if(!e||e.length===0)return"";let r="";for(let n of e){let o=n.startLine===n.endLine?`L${n.startLine}`:`L${n.startLine}-${n.endLine}`;r+=` +`}},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=gJ();if(!e||e.length===0)return"";let r="";for(let n of e){let o=n.startLine===n.endLine?`L${n.startLine}`:`L${n.startLine}-${n.endLine}`;r+=` Title: [[${n.noteTitle}]] @@ -950,22 +950,22 @@ Path: ${n.notePath} Lines: ${o} ${n.content} -`}return r}};var Qce=require("obsidian");wT();var lm=class t{static getInstance(){return t.instance||(t.instance=new t),t.instance}async createCommand(e,r,n=!1){n||ace(e);let o=QI(),i=ND(e);await app.vault.adapter.exists(o)||await app.vault.createFolder(o);let s=await app.vault.create(i,r);await app.fileManager.processFrontMatter(s,u=>{u[AD]=!1,u[ID]=!1,u[MD]=Number.MAX_SAFE_INTEGER,u[RD]="",u[jD]=0})}async recordUsage(e){this.updateCommand({...e,lastUsedMs:Date.now()},e.title)}async updateCommand(e,r,n=!1){n||EW(e,r);let o=app.vault.getAbstractFileByPath(ND(e.title));if(e.title!==r){let i=ND(e.title);if(app.vault.getAbstractFileByPath(i))throw new Rr("Error saving custom prompt. Please check if the title already exists.");let s=ND(r),u=app.vault.getAbstractFileByPath(s);u instanceof Qce.TFile&&(await app.vault.rename(u,i),o=u)}o||(await this.createCommand(e.title,e.content,n),o=app.vault.getAbstractFileByPath(ND(e.title))),o instanceof Qce.TFile&&(await app.vault.modify(o,e.content),await app.fileManager.processFrontMatter(o,i=>{i[AD]=e.showInContextMenu,i[ID]=e.showInSlashMenu,i[MD]=e.order,i[RD]=e.modelKey,i[jD]=e.lastUsedMs}))}async updateCommands(e){sce(e),await Promise.all(e.map(r=>this.updateCommand(r,r.title,!0)))}async deleteCommand(e){PW(e.title);let r=app.vault.getAbstractFileByPath(ND(e.title));r instanceof Qce.TFile&&await app.vault.delete(r)}};nr();Cn();yn();var CM=require("obsidian"),at=F(X());var vn=F(X()),Mi=F(Z6t());function xM(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 uOn=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 XD(t,e,r){let n=lOn(t),{webkitRelativePath:o}=t,i=typeof e=="string"?e:typeof o=="string"&&o.length>0?o:`./${t.name}`;return typeof n.path!="string"&&X6t(n,"path",i),r!==void 0&&Object.defineProperty(n,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),X6t(n,"relativePath",i),n}function lOn(t){let{name:e}=t;if(e&&e.lastIndexOf(".")!==-1&&!t.type){let n=e.split(".").pop().toLowerCase(),o=uOn.get(n);o&&Object.defineProperty(t,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return t}function X6t(t,e,r){Object.defineProperty(t,e,{value:r,writable:!1,configurable:!1,enumerable:!0})}var cOn=[".DS_Store","Thumbs.db"];function Ike(t){return xM(this,void 0,void 0,function*(){return ede(t)&&dOn(t.dataTransfer)?hOn(t.dataTransfer,t.type):fOn(t)?pOn(t):Array.isArray(t)&&t.every(e=>"getFile"in e&&typeof e.getFile=="function")?mOn(t):[]})}function dOn(t){return ede(t)}function fOn(t){return ede(t)&&ede(t.target)}function ede(t){return typeof t=="object"&&t!==null}function pOn(t){return Ake(t.target.files).map(e=>XD(e))}function mOn(t){return xM(this,void 0,void 0,function*(){return(yield Promise.all(t.map(r=>r.getFile()))).map(r=>XD(r))})}function hOn(t,e){return xM(this,void 0,void 0,function*(){if(t.items){let r=Ake(t.items).filter(o=>o.kind==="file");if(e!=="drop")return r;let n=yield Promise.all(r.map(gOn));return Q6t(t5t(n))}return Q6t(Ake(t.files).map(r=>XD(r)))})}function Q6t(t){return t.filter(e=>cOn.indexOf(e.name)===-1)}function Ake(t){if(t===null)return[];let e=[];for(let r=0;r[...e,...Array.isArray(r)?t5t(r):[r]],[])}function e5t(t,e){return xM(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,XD(a)}}let n=t.getAsFile();if(!n)throw new Error(`${t} is not a File`);return XD(n,(r=e?.fullPath)!==null&&r!==void 0?r:void 0)})}function yOn(t){return xM(this,void 0,void 0,function*(){return t.isDirectory?r5t(t):bOn(t)})}function r5t(t){let e=t.createReader();return new Promise((r,n)=>{let o=[];function i(){e.readEntries(a=>xM(this,void 0,void 0,function*(){if(a.length){let s=Promise.all(a.map(yOn));o.push(s),i()}else try{let s=yield Promise.all(o);r(s)}catch(s){n(s)}}),a=>{n(a)})}i()})}function bOn(t){return xM(this,void 0,void 0,function*(){return new Promise((e,r)=>{t.file(n=>{let o=XD(n,t.fullPath);e(o)},n=>{r(n)})})})}var tde=F(n5t());function o5t(t){return wOn(t)||vOn(t)||c5t(t)||_On()}function _On(){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 vOn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function wOn(t){if(Array.isArray(t))return Rke(t)}function i5t(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 a5t(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&arguments[0]!==void 0?arguments[0]:"",r=e.split(","),n=r.length>1?"one of ".concat(r.join(", ")):r[0];return{code:POn,message:"File type must be ".concat(n)}},s5t=function(e){return{code:EOn,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},u5t=function(e){return{code:TOn,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},d5t={code:AOn,message:"Too many files"};function jke(t,e){var r=t.type==="application/x-moz-file"||OOn(t,e);return[r,r?null:IOn(e)]}function Nke(t,e,r){if(QD(t.size))if(QD(e)&&QD(r)){if(t.size>r)return[!1,s5t(r)];if(t.sizer)return[!1,s5t(r)]}return[!0,null]}function QD(t){return t!=null}function f5t(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=jke(u,r),c=e9(l,1),d=c[0],f=Nke(u,n,o),p=e9(f,1),m=p[0],h=s?s(u):null;return d&&m&&!h})}function t9(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function r9(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 Dke(t){t.preventDefault()}function MOn(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function ROn(t){return t.indexOf("Edge/")!==-1}function p5t(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return MOn(t)||ROn(t)}function Pb(){for(var t=arguments.length,e=new Array(t),r=0;r1?o-1:0),a=1;at.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function HOn(t,e){if(t==null)return{};var r={},n=Object.keys(t),o,i;for(i=0;i=0)&&(r[o]=t[o]);return r}var Bke=(0,vn.forwardRef)(function(t,e){var r=t.children,n=rde(t,jOn),o=qke(n),i=o.open,a=rde(o,NOn);return(0,vn.useImperativeHandle)(e,function(){return{open:i}},[i]),vn.default.createElement(vn.Fragment,null,r(ts(ts({},a),{},{open:i})))});Bke.displayName="Dropzone";var C5t={disabled:!1,getFilesFromEvent:Ike,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};Bke.defaultProps=C5t;Bke.propTypes={children:Mi.default.func,accept:Mi.default.objectOf(Mi.default.arrayOf(Mi.default.string)),multiple:Mi.default.bool,preventDropOnDocument:Mi.default.bool,noClick:Mi.default.bool,noKeyboard:Mi.default.bool,noDrag:Mi.default.bool,noDragEventsBubbling:Mi.default.bool,minSize:Mi.default.number,maxSize:Mi.default.number,maxFiles:Mi.default.number,disabled:Mi.default.bool,getFilesFromEvent:Mi.default.func,onFileDialogCancel:Mi.default.func,onFileDialogOpen:Mi.default.func,useFsAccessApi:Mi.default.bool,autoFocus:Mi.default.bool,onDragEnter:Mi.default.func,onDragLeave:Mi.default.func,onDragOver:Mi.default.func,onDrop:Mi.default.func,onDropAccepted:Mi.default.func,onDropRejected:Mi.default.func,onError:Mi.default.func,validator:Mi.default.func};var $ke={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function qke(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=ts(ts({},C5t),t),r=e.accept,n=e.disabled,o=e.getFilesFromEvent,i=e.maxSize,a=e.minSize,s=e.multiple,u=e.maxFiles,l=e.onDragEnter,c=e.onDragLeave,d=e.onDragOver,f=e.onDrop,p=e.onDropAccepted,m=e.onDropRejected,h=e.onFileDialogCancel,b=e.onFileDialogOpen,g=e.useFsAccessApi,y=e.autoFocus,S=e.preventDropOnDocument,x=e.noClick,O=e.noKeyboard,P=e.noDrag,E=e.noDragEventsBubbling,A=e.onError,I=e.validator,R=(0,vn.useMemo)(function(){return g5t(r)},[r]),N=(0,vn.useMemo)(function(){return h5t(r)},[r]),j=(0,vn.useMemo)(function(){return typeof b=="function"?b:S5t},[b]),$=(0,vn.useMemo)(function(){return typeof h=="function"?h:S5t},[h]),k=(0,vn.useRef)(null),z=(0,vn.useRef)(null),V=(0,vn.useReducer)(VOn,$ke),Q=Lke(V,2),J=Q[0],D=Q[1],B=J.isFocused,q=J.isFileDialogActive,K=(0,vn.useRef)(typeof window<"u"&&window.isSecureContext&&g&&m5t()),H=function(){!K.current&&q&&setTimeout(function(){if(z.current){var se=z.current.files;se.length||(D({type:"closeDialog"}),$())}},300)};(0,vn.useEffect)(function(){return window.addEventListener("focus",H,!1),function(){window.removeEventListener("focus",H,!1)}},[z,q,$,K]);var ee=(0,vn.useRef)([]),U=function(se){k.current&&k.current.contains(se.target)||(se.preventDefault(),ee.current=[])};(0,vn.useEffect)(function(){return S&&(document.addEventListener("dragover",Dke,!1),document.addEventListener("drop",U,!1)),function(){S&&(document.removeEventListener("dragover",Dke),document.removeEventListener("drop",U))}},[k,S]),(0,vn.useEffect)(function(){return!n&&y&&k.current&&k.current.focus(),function(){}},[k,y,n]);var W=(0,vn.useCallback)(function(oe){A?A(oe):console.error(oe)},[A]),Y=(0,vn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),te(oe),ee.current=[].concat(FOn(ee.current),[oe.target]),r9(oe)&&Promise.resolve(o(oe)).then(function(se){if(!(t9(oe)&&!E)){var ce=se.length,Ce=ce>0&&f5t({files:se,accept:R,minSize:a,maxSize:i,multiple:s,maxFiles:u,validator:I}),Je=ce>0&&!Ce;D({isDragAccept:Ce,isDragReject:Je,isDragActive:!0,type:"setDraggedFiles"}),l&&l(oe)}}).catch(function(se){return W(se)})},[o,l,W,E,R,a,i,s,u,I]),ae=(0,vn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),te(oe);var se=r9(oe);if(se&&oe.dataTransfer)try{oe.dataTransfer.dropEffect="copy"}catch{}return se&&d&&d(oe),!1},[d,E]),Oe=(0,vn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),te(oe);var se=ee.current.filter(function(Ce){return k.current&&k.current.contains(Ce)}),ce=se.indexOf(oe.target);ce!==-1&&se.splice(ce,1),ee.current=se,!(se.length>0)&&(D({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),r9(oe)&&c&&c(oe))},[k,c,E]),le=(0,vn.useCallback)(function(oe,se){var ce=[],Ce=[];oe.forEach(function(Je){var ir=jke(Je,R),ea=Lke(ir,2),ta=ea[0],xc=ea[1],Cd=Nke(Je,a,i),qi=Lke(Cd,2),lp=qi[0],yf=qi[1],bf=I?I(Je):null;if(ta&&lp&&!bf)ce.push(Je);else{var Sn=[xc,yf];bf&&(Sn=Sn.concat(bf)),Ce.push({file:Je,errors:Sn.filter(function(_f){return _f})})}}),(!s&&ce.length>1||s&&u>=1&&ce.length>u)&&(ce.forEach(function(Je){Ce.push({file:Je,errors:[d5t]})}),ce.splice(0)),D({acceptedFiles:ce,fileRejections:Ce,isDragReject:Ce.length>0,type:"setFiles"}),f&&f(ce,Ce,se),Ce.length>0&&m&&m(Ce,se),ce.length>0&&p&&p(ce,se)},[D,s,R,a,i,u,f,p,m,I]),Be=(0,vn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),te(oe),ee.current=[],r9(oe)&&Promise.resolve(o(oe)).then(function(se){t9(oe)&&!E||le(se,oe)}).catch(function(se){return W(se)}),D({type:"reset"})},[o,le,W,E]),ze=(0,vn.useCallback)(function(){if(K.current){D({type:"openDialog"}),j();var oe={multiple:s,types:N};window.showOpenFilePicker(oe).then(function(se){return o(se)}).then(function(se){le(se,null),D({type:"closeDialog"})}).catch(function(se){y5t(se)?($(se),D({type:"closeDialog"})):b5t(se)?(K.current=!1,z.current?(z.current.value=null,z.current.click()):W(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 was provided."))):W(se)});return}z.current&&(D({type:"openDialog"}),j(),z.current.value=null,z.current.click())},[D,j,$,g,le,W,N,s]),rt=(0,vn.useCallback)(function(oe){!k.current||!k.current.isEqualNode(oe.target)||(oe.key===" "||oe.key==="Enter"||oe.keyCode===32||oe.keyCode===13)&&(oe.preventDefault(),ze())},[k,ze]),cr=(0,vn.useCallback)(function(){D({type:"focus"})},[]),wn=(0,vn.useCallback)(function(){D({type:"blur"})},[]),Le=(0,vn.useCallback)(function(){x||(p5t()?setTimeout(ze,0):ze())},[x,ze]),pt=function(se){return n?null:se},mt=function(se){return O?null:pt(se)},ht=function(se){return P?null:pt(se)},te=function(se){E&&se.stopPropagation()},et=(0,vn.useMemo)(function(){return function(){var oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},se=oe.refKey,ce=se===void 0?"ref":se,Ce=oe.role,Je=oe.onKeyDown,ir=oe.onFocus,ea=oe.onBlur,ta=oe.onClick,xc=oe.onDragEnter,Cd=oe.onDragOver,qi=oe.onDragLeave,lp=oe.onDrop,yf=rde(oe,DOn);return ts(ts(kke({onKeyDown:mt(Pb(Je,rt)),onFocus:mt(Pb(ir,cr)),onBlur:mt(Pb(ea,wn)),onClick:pt(Pb(ta,Le)),onDragEnter:ht(Pb(xc,Y)),onDragOver:ht(Pb(Cd,ae)),onDragLeave:ht(Pb(qi,Oe)),onDrop:ht(Pb(lp,Be)),role:typeof Ce=="string"&&Ce!==""?Ce:"presentation"},ce,k),!n&&!O?{tabIndex:0}:{}),yf)}},[k,rt,cr,wn,Le,Y,ae,Oe,Be,O,P,n]),Re=(0,vn.useCallback)(function(oe){oe.stopPropagation()},[]),Pe=(0,vn.useMemo)(function(){return function(){var oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},se=oe.refKey,ce=se===void 0?"ref":se,Ce=oe.onChange,Je=oe.onClick,ir=rde(oe,LOn),ea=kke({accept:R,multiple:s,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:pt(Pb(Ce,Be)),onClick:pt(Pb(Je,Re)),tabIndex:-1},ce,z);return ts(ts({},ea),ir)}},[z,r,s,Be,n]);return ts(ts({},J),{},{isFocused:B&&!n,getRootProps:et,getInputProps:Pe,rootRef:k,inputRef:z,open:pt(ze)})}function VOn(t,e){switch(e.type){case"focus":return ts(ts({},t),{},{isFocused:!0});case"blur":return ts(ts({},t),{},{isFocused:!1});case"openDialog":return ts(ts({},$ke),{},{isFileDialogActive:!0});case"closeDialog":return ts(ts({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return ts(ts({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return ts(ts({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return ts({},$ke);default:return t}}function S5t(){}Cl();var E5t=F(X());Fd();yn();var Xo=F(X());ti();var nde=F(X());F7();Tn();var WOn=QF("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"}}),cm=nde.forwardRef(({className:t,variant:e,...r},n)=>nde.createElement("div",{ref:n,className:_e(WOn({variant:e}),t),...r}));cm.displayName="Badge";function O5t({note:t,isActive:e=!1,onRemoveContext:r}){return Xo.default.createElement(cm,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Xo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xo.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.basename),e&&Xo.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),t.extension==="pdf"&&Xo.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")),Xo.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>r(t.path),"aria-label":"Remove from context"},Xo.default.createElement(Vi,{className:"tw-size-4"})))}function KOn({url:t,onRemoveUrl:e}){return Xo.default.createElement(cm,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Xo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xo.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t),Xo.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Link")),Xo.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>e(t),"aria-label":"Remove from context"},Xo.default.createElement(Vi,{className:"tw-size-4"})))}function GOn({selectedText:t,onRemoveSelectedText:e}){let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`;return Xo.default.createElement(cm,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Xo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xo.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.noteTitle),Xo.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r)),Xo.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>e(t.id),"aria-label":"Remove from context"},Xo.default.createElement(Vi,{className:"tw-size-4"})))}var P5t=({activeNote:t,contextNotes:e,contextUrls:r,selectedTextContexts:n=[],onAddContext:o,onRemoveContext:i,onRemoveUrl:a,onRemoveSelectedText:s})=>{let u=Xo.default.useMemo(()=>{let d=new Map(e.map(f=>[f.path,f]));return Array.from(d.values()).filter(f=>f.wasAddedManually?!0:!(t&&f.path===t.path))},[e,t]),l=Xo.default.useMemo(()=>Array.from(new Set(r)),[r]),c=u.length>0||l.length>0||n.length>0||!!t;return Xo.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-gap-1"},Xo.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},Xo.default.createElement(ge,{onClick:o,variant:"ghost2",size:"fit",className:"tw-ml-1 tw-rounded-sm tw-border tw-border-solid tw-border-border"},Xo.default.createElement(Mm,{className:"tw-size-4"}),!c&&Xo.default.createElement("span",{className:"tw-pr-1 tw-text-xs tw-leading-4"},"Add context"))),Xo.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-wrap tw-gap-1"},t&&Xo.default.createElement(O5t,{key:t.path,note:t,isActive:!0,onRemoveContext:i}),u.map(d=>Xo.default.createElement(O5t,{key:d.path,note:d,isActive:!1,onRemoveContext:i})),l.map(d=>Xo.default.createElement(KOn,{key:d,url:d,onRemoveUrl:a})),n.map(d=>Xo.default.createElement(GOn,{key:d.id,selectedText:d,onRemoveSelectedText:s||(()=>{})}))))};var JOn=({app:t,excludeNotePaths:e,contextNotes:r,setContextNotes:n,includeActiveNote:o,setIncludeActiveNote:i,activeNote:a,contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c})=>{let[d]=by(),f=()=>{new SM({app:t,onNoteSelect:m=>{a&&m.path===a.path?(i(!0),n(h=>h.filter(b=>b.path!==m.path))):n(h=>[...h,Object.assign(m,{wasAddedManually:!0})])},excludeNotePaths:e}).open()},p=m=>{let h=r.find(g=>g.path===m);h&&h.wasAddedManually?n(g=>g.filter(y=>y.path!==m)):(i(!1),n(g=>g.filter(y=>y.path!==m)))};return d!=="copilot_plus"&&d!=="project"?null:E5t.default.createElement(P5t,{activeNote:o?a:null,contextNotes:r,onAddContext:f,onRemoveContext:p,contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c})},T5t=JOn;var A5t=(0,at.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:m,selectedTextContexts:h,onRemoveSelectedText:b},g)=>{let[y,S]=(0,at.useState)(!1),[x,O]=(0,at.useState)([]),P=(0,at.useRef)(null),E=(0,at.useRef)(null),[A,I]=wF(),[R,N]=(0,at.useState)(null),[j]=by(),[$]=QVe(),[k,z]=(0,at.useState)(i.workspace.getActiveFile()),[V,Q]=(0,at.useState)(null),J=Rn(),D=j==="copilot_plus"||j==="project",[B,q]=(0,at.useState)(0),K=["Loading the project context...","Processing context files...","If you have many files in context, this can take a while..."];(0,at.useImperativeHandle)(g,()=>({focus:()=>{P.current?.focus()}})),(0,at.useEffect)(()=>{if(j==="project"){Q(Mc());let Le=SF(pt=>{Q(pt)});return()=>{Le()}}else Q(null)},[j]),(0,at.useEffect)(()=>{if(!$)return;let Le=setInterval(()=>{q(pt=>(pt+1)%K.length)},3e3);return()=>clearInterval(Le)},[$,K.length]);let H=()=>V&&j==="project"&&V.projectModelKey?V.projectModelKey:A,ee=Le=>{if(!D){r();return}r({toolCalls:Le?["@vault"]:[],contextNotes:a,urls:x})},U=async Le=>{let pt=Le.target.value,mt=Le.target.selectionStart,ht=mt>0&&pt[mt-1]==="/"&&(mt===1||pt[mt-2]===" ");e(pt),W();let et=c.extractAllUrls(pt).filter(Re=>!x.includes(Re));et.length>0&&O(Re=>Array.from(new Set([...Re,...et]))),mt>=2&&pt.slice(mt-2,mt)==="[["?Y(mt):ht?ae(mt,pt):pt.slice(-1)==="@"&&D&&Oe()},W=()=>{P.current&&(P.current.style.height="auto",P.current.style.height=`${P.current.scrollHeight}px`)};(0,at.useEffect)(()=>{W()},[t]);let Y=Le=>{(async()=>{let mt=mz.getInstance();new SM({app:i,onNoteSelect:async ht=>{let te=t.slice(0,Le-2),et=t.slice(Le-1),Pe=Zhe(ht.basename,i.vault)?ht.basename:ht.path,oe=`${te}[[${Pe}]]${et}`;e(oe);let se=i.workspace.getActiveFile();ht&&await mt.addNoteToContext(ht,i.vault,a,se,s,l),setTimeout(()=>{if(P.current){let ce=Le+Pe.length+2;P.current.setSelectionRange(ce,ce)}},0)},excludeNotePaths:wn}).open()})()},ae=(Le,pt)=>{let mt=lm.getInstance(),ht=Gx(),te=E3t(ht.filter(oe=>oe.showInSlashMenu)),et=te.map(oe=>oe.title),Re=Le-1;new XW(i,et,oe=>{let se=te.find(ce=>ce.title===oe);if(se){mt.recordUsage(se);let ce="",Ce="";Re>=0&&pt[Re]==="/"&&(ce=pt.slice(0,Re),Ce=pt.slice(Re+1));let Je=ce+se.content+Ce;e(Je),setTimeout(()=>{if(P.current){let ir=ce.length+se.content.length;P.current.setSelectionRange(ir,ir),P.current.focus()}},0)}}).open()},Oe=()=>{let Le=Z6.map(pt=>({title:pt,description:A1t(pt)}));new XW(i,Le.map(pt=>pt.title),pt=>{e(t+pt+" ")},Le.map(pt=>pt.description)).open()},le=Le=>{if(!Le.nativeEvent.isComposing){if(Le.key==="Enter"&&Le.shiftKey&&(CM.Platform.isMacOS?Le.metaKey:Le.ctrlKey)){Le.preventDefault(),Le.stopPropagation(),ee(!0);return}if(Le.key==="Enter"){if(!(!Le.shiftKey&&!CM.Platform.isMobile||Le.shiftKey&&CM.Platform.isMobile))return;Le.preventDefault(),ee(!1)}}},Be=(0,at.useCallback)(async Le=>{let pt=Le.clipboardData?.items;if(!pt||!D)return;let mt=Array.from(pt).filter(ht=>ht.type.indexOf("image")!==-1);if(mt.length>0){Le.preventDefault();let te=(await Promise.all(mt.map(et=>{let Re=et.getAsFile();return Re||null}))).filter(et=>et!==null);te.length>0&&f(te)}},[f,D]);(0,at.useEffect)(()=>{let Le=new Set(NC(t,i.vault)),pt=c.extractAllUrls(t);s(mt=>mt.filter(ht=>{if(ht.wasAddedManually===!0)return!0;let et=ht.wasAddedViaReference===!0;return ht.path===k?.path?et?Le.has(ht):u:et?Le.has(ht):!0})),O(mt=>mt.filter(ht=>pt.includes(ht)))},[t,u,k,c,s,i.vault]),(0,at.useEffect)(()=>{let Le,pt=()=>{clearTimeout(Le),Le=setTimeout(()=>{let ht=i.workspace.getActiveFile();z(ht)},100)},mt=i.workspace.on("active-leaf-change",pt);return()=>{clearTimeout(Le),i.workspace.offref(mt)}},[i.workspace]);let{getRootProps:ze,getInputProps:rt,isDragActive:cr}=qke({accept:{"image/*":[".png",".gif",".jpeg",".jpg",".webp"]},onDrop:Le=>{f(Le)},noClick:!0,noDragEventsBubbling:!0}),wn=(0,at.useMemo)(()=>[...a.map(Le=>Le.path),...u&&k?[k.path]:[]].filter(Le=>Le!=null),[a,u,k]);return at.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},at.default.createElement(T5t,{app:i,excludeNotePaths:wn,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,activeNote:k,contextUrls:x,onRemoveUrl:Le=>O(pt=>pt.filter(mt=>mt!==Le)),selectedTextContexts:h,onRemoveSelectedText:b}),d.length>0&&at.default.createElement("div",{className:"selected-images"},d.map((Le,pt)=>at.default.createElement("div",{key:pt,className:"image-preview-container"},at.default.createElement("img",{src:URL.createObjectURL(Le),alt:Le.name,className:"selected-image-preview"}),at.default.createElement("button",{className:"remove-image-button",onClick:()=>p(mt=>mt.filter((ht,te)=>te!==pt)),title:"Remove image"},at.default.createElement(Vi,{className:"tw-size-4"}))))),at.default.createElement("div",{className:"tw-relative",...D?ze():{}},$&&at.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"},at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},at.default.createElement(Yl,{className:"tw-size-4 tw-animate-spin"}),at.default.createElement("span",{className:"tw-text-sm"},K[B]))),at.default.createElement("textarea",{ref:P,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 focus-visible:tw-ring-0",placeholder:"Ask anything. [[ for notes. / for custom prompts. "+(D?"@ for tools.":""),value:t,onChange:U,onKeyDown:le,onPaste:Be,disabled:$}),D&&at.default.createElement(at.default.Fragment,null,at.default.createElement("input",{...rt()}),cr&&at.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"},at.default.createElement("span",null,"Drop images here...")))),at.default.createElement("div",{className:"tw-flex tw-h-6 tw-justify-between tw-gap-1 tw-px-1"},n?at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-px-1 tw-text-sm tw-text-faint"},at.default.createElement(Yl,{className:"tw-size-3 tw-animate-spin"}),at.default.createElement("span",null,"Generating...")):at.default.createElement(JD,{open:y,onOpenChange:S},at.default.createElement(YD,{asChild:!0},at.default.createElement(ge,{variant:"ghost2",size:"fit",disabled:m},R?at.default.createElement("span",{className:"tw-text-error"},"Model Load Failed"):J.activeModels.find(Le=>Le.enabled&&kr(Le)===H())?at.default.createElement(Tke,{model:J.activeModels.find(Le=>Le.enabled&&kr(Le)===H()),iconSize:8}):"Select Model",!m&&at.default.createElement(Hi,{className:"tw-mt-0.5 tw-size-5"}))),at.default.createElement(xb,{align:"start"},!m&&J.activeModels.filter(Le=>Le.enabled).map(Le=>{let{hasApiKey:pt,errorNotice:mt}=mF(Le,J);return at.default.createElement(Si,{key:kr(Le),onSelect:async ht=>{if(!pt&&mt){ht.preventDefault(),new CM.Notice(mt);return}try{N(null),I(kr(Le))}catch(te){let et="Model switch failed: "+ei(te);N(et),new CM.Notice(et);let Re=J.activeModels.find(Pe=>Pe.enabled&&kr(Pe)===A);Re&&I(kr(Re))}},className:pt?"":"tw-cursor-not-allowed tw-opacity-50"},at.default.createElement(Tke,{model:Le,iconSize:12}))}))),at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},n?at.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>o()},at.default.createElement(bT,{className:"tw-size-4"}),"Stop"):at.default.createElement(at.default.Fragment,null,D&&at.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>{new Zce(i,f).open()}},at.default.createElement(O3,{className:"tw-size-4"})),at.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>ee(!1)},at.default.createElement(Im,{className:"!tw-size-3"}),at.default.createElement("span",null,"chat")),j==="copilot_plus"&&at.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-hidden tw-text-muted @xs/chat-input:tw-inline-flex",onClick:()=>ee(!0)},at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},CM.Platform.isMacOS?at.default.createElement("div",{className:"tw-flex tw-items-center"},at.default.createElement(c_,{className:"!tw-size-3"}),at.default.createElement(YC,{className:"!tw-size-3"}),at.default.createElement(Im,{className:"!tw-size-3"})):at.default.createElement("div",{className:"tw-flex tw-items-center"},at.default.createElement("span",null,"Ctrl"),at.default.createElement(YC,{className:"tw-size-4"}),at.default.createElement(Im,{className:"!tw-size-3"})),at.default.createElement("span",null,"vault")))))))});A5t.displayName="ChatInput";var I5t=A5t;ti();$r();Tn();yn();var M5t=require("obsidian"),vr=F(X()),R5t=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>vr.default.createElement("div",{className:_e("tw-flex tw-gap-1",{"group-hover:opacity-100 opacity-0":!M5t.Platform.isMobile})},t.sender===Pi?vr.default.createElement(vr.default.Fragment,null,vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?vr.default.createElement(Jl,{className:"tw-size-4"}):vr.default.createElement(Ty,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Copy")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},vr.default.createElement(Rp,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Edit")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},vr.default.createElement(Rm,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Delete"))):vr.default.createElement(vr.default.Fragment,null,u&&vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},vr.default.createElement(l1,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Show Sources")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},vr.default.createElement(I3,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Insert / Replace at cursor")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?vr.default.createElement(Jl,{className:"tw-size-4"}):vr.default.createElement(Ty,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Copy")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},vr.default.createElement(A3,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Regenerate")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},vr.default.createElement(Rm,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Delete"))));$r();var j5t=require("obsidian"),ode=class extends j5t.Modal{constructor(e,r){super(e),this.sources=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Sources"});let r=this.sources.filter(o=>o.score>=rge),n=this.sources.filter(o=>o.score0&&(e.createEl("h3",{text:"High Relevance Sources"}),this.createSourceList(e,r)),n.length>0&&(e.createEl("h3",{text:"Lower Relevance Sources"}),this.createSourceList(e,n))}createSourceList(e,r){let n=e.createEl("ul");n.style.listStyleType="none",n.style.padding="0",r.forEach(o=>{let i=n.createEl("li");i.style.marginBottom="1em",i.createEl("a",{href:`obsidian://open?vault=${encodeURIComponent(this.app.vault.getName())}&file=${encodeURIComponent(o.title)}`,text:o.title}).addEventListener("click",s=>{s.preventDefault(),this.app.workspace.openLinkText(o.title,"")}),o.score&&o.score<=1&&i.appendChild(document.createTextNode(` - Relevance score: ${o.score.toFixed(3)}`))})}onClose(){let{contentEl:e}=this;e.empty()}};$r();Tn();Cn();yn();var lE=require("obsidian");function Eb(){}Eb.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(x){return x=a.postProcess(x,o),i?(setTimeout(function(){i(x)},0),!0):x}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,m=[{oldPos:-1,lastComponent:void 0}],h=this.extractCommon(m[0],r,e,0,o);if(m[0].oldPos+1>=l&&h+1>=u)return s(N5t(a,m[0].lastComponent,r,e,a.useLongestToken));var b=-1/0,g=1/0;function y(){for(var x=Math.max(b,-c);x<=Math.min(g,c);x+=2){var O=void 0,P=m[x-1],E=m[x+1];P&&(m[x-1]=void 0);var A=!1;if(E){var I=E.oldPos-x;A=E&&0<=I&&I=l&&h+1>=u)return s(N5t(a,O.lastComponent,r,e,a.useLongestToken));m[x]=O,O.oldPos+1>=l&&(g=Math.min(g,x-1)),h+1>=u&&(b=Math.max(b,x+1))}c++}if(i)(function x(){setTimeout(function(){if(c>d||Date.now()>p)return i();y()||x()},0)})();else for(;c<=d&&Date.now()<=p;){var S=y();if(S)return S}},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+1p.length?h: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}var Ndi=new Eb;function D5t(t,e){var r;for(r=0;re.length&&(r=t.length-e.length);var n=e.length;t.length0&&e[a]!=e[i];)i=o[i];e[a]==e[i]&&i++}i=0;for(var s=r;s0&&t[s]!=e[i];)i=o[i];t[s]==e[i]&&i++}return i}var ade="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}",ZOn=new RegExp("[".concat(ade,"]+|\\s+|[^").concat(ade,"]"),"ug"),i9=new Eb;i9.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};i9.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(ZOn)||[];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};i9.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};i9.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)&&k5t(r,o,n,i),r=i,n=null,o=null)}),(n||o)&&k5t(r,o,n,null),t};function $5t(t,e,r){return r?.ignoreWhitespace!=null&&!r.ignoreWhitespace?XOn(t,e,r):i9.diff(t,e,r)}function k5t(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=D5t(o,a);t.value=zke(t.value,a,u),e.value=n9(e.value,u),r.value=n9(r.value,u)}if(n){var l=L5t(i,s);n.value=Uke(n.value,s,l),e.value=ide(e.value,l),r.value=ide(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=D5t(c,d);e.value=n9(e.value,p);var m=L5t(n9(c,p),f);e.value=ide(e.value,m),n.value=Uke(n.value,c,m),t.value=zke(t.value,c,c.slice(0,c.length-m.length))}else if(n){var h=n.value.match(/^\s*/)[0],b=e.value.match(/\s*$/)[0],g=F5t(b,h);e.value=ide(e.value,g)}else if(t){var y=t.value.match(/\s*$/)[0],S=e.value.match(/^\s*/)[0],x=F5t(y,S);e.value=n9(e.value,x)}}var B5t=new Eb;B5t.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(ade,"]+|[^\\S\\n\\r]+|[^").concat(ade,"]"),"ug");return t.match(e)||[]};function XOn(t,e,r){return B5t.diff(t,e,r)}function QOn(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}var sde=new Eb;sde.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`}return r}};var rde=require("obsidian");wT();var lm=class t{static getInstance(){return t.instance||(t.instance=new t),t.instance}async createCommand(e,r,n=!1){n||lce(e);let o=QI(),i=DD(e);await app.vault.adapter.exists(o)||await app.vault.createFolder(o);let s=await app.vault.create(i,r);await app.fileManager.processFrontMatter(s,u=>{u[ID]=!1,u[MD]=!1,u[RD]=Number.MAX_SAFE_INTEGER,u[jD]="",u[ND]=0})}async recordUsage(e){this.updateCommand({...e,lastUsedMs:Date.now()},e.title)}async updateCommand(e,r,n=!1){n||TW(e,r);let o=app.vault.getAbstractFileByPath(DD(e.title));if(e.title!==r){let i=DD(e.title);if(app.vault.getAbstractFileByPath(i))throw new Rr("Error saving custom prompt. Please check if the title already exists.");let s=DD(r),u=app.vault.getAbstractFileByPath(s);u instanceof rde.TFile&&(await app.vault.rename(u,i),o=u)}o||(await this.createCommand(e.title,e.content,n),o=app.vault.getAbstractFileByPath(DD(e.title))),o instanceof rde.TFile&&(await app.vault.modify(o,e.content),await app.fileManager.processFrontMatter(o,i=>{i[ID]=e.showInContextMenu,i[MD]=e.showInSlashMenu,i[RD]=e.order,i[jD]=e.modelKey,i[ND]=e.lastUsedMs}))}async updateCommands(e){cce(e),await Promise.all(e.map(r=>this.updateCommand(r,r.title,!0)))}async deleteCommand(e){EW(e.title);let r=app.vault.getAbstractFileByPath(DD(e.title));r instanceof rde.TFile&&await app.vault.delete(r)}};nr();yn();bn();var CM=require("obsidian"),at=F(X());var wn=F(X()),Mi=F(r5t());function xM(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 pOn=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 QD(t,e,r){let n=mOn(t),{webkitRelativePath:o}=t,i=typeof e=="string"?e:typeof o=="string"&&o.length>0?o:`./${t.name}`;return typeof n.path!="string"&&n5t(n,"path",i),r!==void 0&&Object.defineProperty(n,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),n5t(n,"relativePath",i),n}function mOn(t){let{name:e}=t;if(e&&e.lastIndexOf(".")!==-1&&!t.type){let n=e.split(".").pop().toLowerCase(),o=pOn.get(n);o&&Object.defineProperty(t,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return t}function n5t(t,e,r){Object.defineProperty(t,e,{value:r,writable:!1,configurable:!1,enumerable:!0})}var hOn=[".DS_Store","Thumbs.db"];function Rke(t){return xM(this,void 0,void 0,function*(){return nde(t)&&gOn(t.dataTransfer)?vOn(t.dataTransfer,t.type):yOn(t)?bOn(t):Array.isArray(t)&&t.every(e=>"getFile"in e&&typeof e.getFile=="function")?_On(t):[]})}function gOn(t){return nde(t)}function yOn(t){return nde(t)&&nde(t.target)}function nde(t){return typeof t=="object"&&t!==null}function bOn(t){return Mke(t.target.files).map(e=>QD(e))}function _On(t){return xM(this,void 0,void 0,function*(){return(yield Promise.all(t.map(r=>r.getFile()))).map(r=>QD(r))})}function vOn(t,e){return xM(this,void 0,void 0,function*(){if(t.items){let r=Mke(t.items).filter(o=>o.kind==="file");if(e!=="drop")return r;let n=yield Promise.all(r.map(wOn));return o5t(a5t(n))}return o5t(Mke(t.files).map(r=>QD(r)))})}function o5t(t){return t.filter(e=>hOn.indexOf(e.name)===-1)}function Mke(t){if(t===null)return[];let e=[];for(let r=0;r[...e,...Array.isArray(r)?a5t(r):[r]],[])}function i5t(t,e){return xM(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,QD(a)}}let n=t.getAsFile();if(!n)throw new Error(`${t} is not a File`);return QD(n,(r=e?.fullPath)!==null&&r!==void 0?r:void 0)})}function SOn(t){return xM(this,void 0,void 0,function*(){return t.isDirectory?s5t(t):xOn(t)})}function s5t(t){let e=t.createReader();return new Promise((r,n)=>{let o=[];function i(){e.readEntries(a=>xM(this,void 0,void 0,function*(){if(a.length){let s=Promise.all(a.map(SOn));o.push(s),i()}else try{let s=yield Promise.all(o);r(s)}catch(s){n(s)}}),a=>{n(a)})}i()})}function xOn(t){return xM(this,void 0,void 0,function*(){return new Promise((e,r)=>{t.file(n=>{let o=QD(n,t.fullPath);e(o)},n=>{r(n)})})})}var ode=F(u5t());function l5t(t){return POn(t)||OOn(t)||h5t(t)||COn()}function COn(){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 OOn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function POn(t){if(Array.isArray(t))return Nke(t)}function c5t(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 d5t(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&arguments[0]!==void 0?arguments[0]:"",r=e.split(","),n=r.length>1?"one of ".concat(r.join(", ")):r[0];return{code:MOn,message:"File type must be ".concat(n)}},f5t=function(e){return{code:ROn,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},p5t=function(e){return{code:jOn,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},g5t={code:NOn,message:"Too many files"};function Dke(t,e){var r=t.type==="application/x-moz-file"||IOn(t,e);return[r,r?null:DOn(e)]}function Lke(t,e,r){if(eL(t.size))if(eL(e)&&eL(r)){if(t.size>r)return[!1,f5t(r)];if(t.sizer)return[!1,f5t(r)]}return[!0,null]}function eL(t){return t!=null}function y5t(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=Dke(u,r),c=t9(l,1),d=c[0],f=Lke(u,n,o),p=t9(f,1),m=p[0],h=s?s(u):null;return d&&m&&!h})}function r9(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function n9(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 Fke(t){t.preventDefault()}function LOn(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function FOn(t){return t.indexOf("Edge/")!==-1}function b5t(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return LOn(t)||FOn(t)}function Pb(){for(var t=arguments.length,e=new Array(t),r=0;r1?o-1:0),a=1;at.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function JOn(t,e){if(t==null)return{};var r={},n=Object.keys(t),o,i;for(i=0;i=0)&&(r[o]=t[o]);return r}var Uke=(0,wn.forwardRef)(function(t,e){var r=t.children,n=ide(t,kOn),o=zke(n),i=o.open,a=ide(o,$On);return(0,wn.useImperativeHandle)(e,function(){return{open:i}},[i]),wn.default.createElement(wn.Fragment,null,r(ts(ts({},a),{},{open:i})))});Uke.displayName="Dropzone";var A5t={disabled:!1,getFilesFromEvent:Rke,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};Uke.defaultProps=A5t;Uke.propTypes={children:Mi.default.func,accept:Mi.default.objectOf(Mi.default.arrayOf(Mi.default.string)),multiple:Mi.default.bool,preventDropOnDocument:Mi.default.bool,noClick:Mi.default.bool,noKeyboard:Mi.default.bool,noDrag:Mi.default.bool,noDragEventsBubbling:Mi.default.bool,minSize:Mi.default.number,maxSize:Mi.default.number,maxFiles:Mi.default.number,disabled:Mi.default.bool,getFilesFromEvent:Mi.default.func,onFileDialogCancel:Mi.default.func,onFileDialogOpen:Mi.default.func,useFsAccessApi:Mi.default.bool,autoFocus:Mi.default.bool,onDragEnter:Mi.default.func,onDragLeave:Mi.default.func,onDragOver:Mi.default.func,onDrop:Mi.default.func,onDropAccepted:Mi.default.func,onDropRejected:Mi.default.func,onError:Mi.default.func,validator:Mi.default.func};var qke={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function zke(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=ts(ts({},A5t),t),r=e.accept,n=e.disabled,o=e.getFilesFromEvent,i=e.maxSize,a=e.minSize,s=e.multiple,u=e.maxFiles,l=e.onDragEnter,c=e.onDragLeave,d=e.onDragOver,f=e.onDrop,p=e.onDropAccepted,m=e.onDropRejected,h=e.onFileDialogCancel,b=e.onFileDialogOpen,g=e.useFsAccessApi,y=e.autoFocus,S=e.preventDropOnDocument,x=e.noClick,O=e.noKeyboard,P=e.noDrag,E=e.noDragEventsBubbling,A=e.onError,I=e.validator,R=(0,wn.useMemo)(function(){return w5t(r)},[r]),N=(0,wn.useMemo)(function(){return v5t(r)},[r]),j=(0,wn.useMemo)(function(){return typeof b=="function"?b:E5t},[b]),$=(0,wn.useMemo)(function(){return typeof h=="function"?h:E5t},[h]),k=(0,wn.useRef)(null),z=(0,wn.useRef)(null),V=(0,wn.useReducer)(YOn,qke),Q=kke(V,2),J=Q[0],D=Q[1],B=J.isFocused,q=J.isFileDialogActive,K=(0,wn.useRef)(typeof window<"u"&&window.isSecureContext&&g&&_5t()),H=function(){!K.current&&q&&setTimeout(function(){if(z.current){var se=z.current.files;se.length||(D({type:"closeDialog"}),$())}},300)};(0,wn.useEffect)(function(){return window.addEventListener("focus",H,!1),function(){window.removeEventListener("focus",H,!1)}},[z,q,$,K]);var ee=(0,wn.useRef)([]),U=function(se){k.current&&k.current.contains(se.target)||(se.preventDefault(),ee.current=[])};(0,wn.useEffect)(function(){return S&&(document.addEventListener("dragover",Fke,!1),document.addEventListener("drop",U,!1)),function(){S&&(document.removeEventListener("dragover",Fke),document.removeEventListener("drop",U))}},[k,S]),(0,wn.useEffect)(function(){return!n&&y&&k.current&&k.current.focus(),function(){}},[k,y,n]);var W=(0,wn.useCallback)(function(oe){A?A(oe):console.error(oe)},[A]),Y=(0,wn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),te(oe),ee.current=[].concat(UOn(ee.current),[oe.target]),n9(oe)&&Promise.resolve(o(oe)).then(function(se){if(!(r9(oe)&&!E)){var ce=se.length,Ce=ce>0&&y5t({files:se,accept:R,minSize:a,maxSize:i,multiple:s,maxFiles:u,validator:I}),Je=ce>0&&!Ce;D({isDragAccept:Ce,isDragReject:Je,isDragActive:!0,type:"setDraggedFiles"}),l&&l(oe)}}).catch(function(se){return W(se)})},[o,l,W,E,R,a,i,s,u,I]),ae=(0,wn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),te(oe);var se=n9(oe);if(se&&oe.dataTransfer)try{oe.dataTransfer.dropEffect="copy"}catch{}return se&&d&&d(oe),!1},[d,E]),Oe=(0,wn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),te(oe);var se=ee.current.filter(function(Ce){return k.current&&k.current.contains(Ce)}),ce=se.indexOf(oe.target);ce!==-1&&se.splice(ce,1),ee.current=se,!(se.length>0)&&(D({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),n9(oe)&&c&&c(oe))},[k,c,E]),le=(0,wn.useCallback)(function(oe,se){var ce=[],Ce=[];oe.forEach(function(Je){var ir=Dke(Je,R),ea=kke(ir,2),ta=ea[0],xc=ea[1],Cd=Lke(Je,a,i),qi=kke(Cd,2),lp=qi[0],yf=qi[1],bf=I?I(Je):null;if(ta&&lp&&!bf)ce.push(Je);else{var xn=[xc,yf];bf&&(xn=xn.concat(bf)),Ce.push({file:Je,errors:xn.filter(function(_f){return _f})})}}),(!s&&ce.length>1||s&&u>=1&&ce.length>u)&&(ce.forEach(function(Je){Ce.push({file:Je,errors:[g5t]})}),ce.splice(0)),D({acceptedFiles:ce,fileRejections:Ce,isDragReject:Ce.length>0,type:"setFiles"}),f&&f(ce,Ce,se),Ce.length>0&&m&&m(Ce,se),ce.length>0&&p&&p(ce,se)},[D,s,R,a,i,u,f,p,m,I]),Be=(0,wn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),te(oe),ee.current=[],n9(oe)&&Promise.resolve(o(oe)).then(function(se){r9(oe)&&!E||le(se,oe)}).catch(function(se){return W(se)}),D({type:"reset"})},[o,le,W,E]),ze=(0,wn.useCallback)(function(){if(K.current){D({type:"openDialog"}),j();var oe={multiple:s,types:N};window.showOpenFilePicker(oe).then(function(se){return o(se)}).then(function(se){le(se,null),D({type:"closeDialog"})}).catch(function(se){S5t(se)?($(se),D({type:"closeDialog"})):x5t(se)?(K.current=!1,z.current?(z.current.value=null,z.current.click()):W(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 was provided."))):W(se)});return}z.current&&(D({type:"openDialog"}),j(),z.current.value=null,z.current.click())},[D,j,$,g,le,W,N,s]),rt=(0,wn.useCallback)(function(oe){!k.current||!k.current.isEqualNode(oe.target)||(oe.key===" "||oe.key==="Enter"||oe.keyCode===32||oe.keyCode===13)&&(oe.preventDefault(),ze())},[k,ze]),cr=(0,wn.useCallback)(function(){D({type:"focus"})},[]),Sn=(0,wn.useCallback)(function(){D({type:"blur"})},[]),je=(0,wn.useCallback)(function(){x||(b5t()?setTimeout(ze,0):ze())},[x,ze]),mt=function(se){return n?null:se},ht=function(se){return O?null:mt(se)},ft=function(se){return P?null:mt(se)},te=function(se){E&&se.stopPropagation()},et=(0,wn.useMemo)(function(){return function(){var oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},se=oe.refKey,ce=se===void 0?"ref":se,Ce=oe.role,Je=oe.onKeyDown,ir=oe.onFocus,ea=oe.onBlur,ta=oe.onClick,xc=oe.onDragEnter,Cd=oe.onDragOver,qi=oe.onDragLeave,lp=oe.onDrop,yf=ide(oe,BOn);return ts(ts(Bke({onKeyDown:ht(Pb(Je,rt)),onFocus:ht(Pb(ir,cr)),onBlur:ht(Pb(ea,Sn)),onClick:mt(Pb(ta,je)),onDragEnter:ft(Pb(xc,Y)),onDragOver:ft(Pb(Cd,ae)),onDragLeave:ft(Pb(qi,Oe)),onDrop:ft(Pb(lp,Be)),role:typeof Ce=="string"&&Ce!==""?Ce:"presentation"},ce,k),!n&&!O?{tabIndex:0}:{}),yf)}},[k,rt,cr,Sn,je,Y,ae,Oe,Be,O,P,n]),Re=(0,wn.useCallback)(function(oe){oe.stopPropagation()},[]),Pe=(0,wn.useMemo)(function(){return function(){var oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},se=oe.refKey,ce=se===void 0?"ref":se,Ce=oe.onChange,Je=oe.onClick,ir=ide(oe,qOn),ea=Bke({accept:R,multiple:s,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:mt(Pb(Ce,Be)),onClick:mt(Pb(Je,Re)),tabIndex:-1},ce,z);return ts(ts({},ea),ir)}},[z,r,s,Be,n]);return ts(ts({},J),{},{isFocused:B&&!n,getRootProps:et,getInputProps:Pe,rootRef:k,inputRef:z,open:mt(ze)})}function YOn(t,e){switch(e.type){case"focus":return ts(ts({},t),{},{isFocused:!0});case"blur":return ts(ts({},t),{},{isFocused:!1});case"openDialog":return ts(ts({},qke),{},{isFileDialogActive:!0});case"closeDialog":return ts(ts({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return ts(ts({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return ts(ts({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return ts({},qke);default:return t}}function E5t(){}Cl();var R5t=F(X());Fd();bn();var Xo=F(X());ti();var ade=F(X());k7();Tn();var ZOn=ek("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"}}),cm=ade.forwardRef(({className:t,variant:e,...r},n)=>ade.createElement("div",{ref:n,className:_e(ZOn({variant:e}),t),...r}));cm.displayName="Badge";function I5t({note:t,isActive:e=!1,onRemoveContext:r}){return Xo.default.createElement(cm,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Xo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xo.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.basename),e&&Xo.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),t.extension==="pdf"&&Xo.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")),Xo.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>r(t.path),"aria-label":"Remove from context"},Xo.default.createElement(Vi,{className:"tw-size-4"})))}function XOn({url:t,onRemoveUrl:e}){return Xo.default.createElement(cm,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Xo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xo.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t),Xo.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Link")),Xo.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>e(t),"aria-label":"Remove from context"},Xo.default.createElement(Vi,{className:"tw-size-4"})))}function QOn({selectedText:t,onRemoveSelectedText:e}){let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`;return Xo.default.createElement(cm,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Xo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xo.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.noteTitle),Xo.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r)),Xo.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>e(t.id),"aria-label":"Remove from context"},Xo.default.createElement(Vi,{className:"tw-size-4"})))}var M5t=({activeNote:t,contextNotes:e,contextUrls:r,selectedTextContexts:n=[],onAddContext:o,onRemoveContext:i,onRemoveUrl:a,onRemoveSelectedText:s})=>{let u=Xo.default.useMemo(()=>{let d=new Map(e.map(f=>[f.path,f]));return Array.from(d.values()).filter(f=>f.wasAddedManually?!0:!(t&&f.path===t.path))},[e,t]),l=Xo.default.useMemo(()=>Array.from(new Set(r)),[r]),c=u.length>0||l.length>0||n.length>0||!!t;return Xo.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-gap-1"},Xo.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},Xo.default.createElement(ge,{onClick:o,variant:"ghost2",size:"fit",className:"tw-ml-1 tw-rounded-sm tw-border tw-border-solid tw-border-border"},Xo.default.createElement(Mm,{className:"tw-size-4"}),!c&&Xo.default.createElement("span",{className:"tw-pr-1 tw-text-xs tw-leading-4"},"Add context"))),Xo.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-wrap tw-gap-1"},t&&Xo.default.createElement(I5t,{key:t.path,note:t,isActive:!0,onRemoveContext:i}),u.map(d=>Xo.default.createElement(I5t,{key:d.path,note:d,isActive:!1,onRemoveContext:i})),l.map(d=>Xo.default.createElement(XOn,{key:d,url:d,onRemoveUrl:a})),n.map(d=>Xo.default.createElement(QOn,{key:d.id,selectedText:d,onRemoveSelectedText:s||(()=>{})}))))};var ePn=({app:t,excludeNotePaths:e,contextNotes:r,setContextNotes:n,includeActiveNote:o,setIncludeActiveNote:i,activeNote:a,contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c})=>{let[d]=by(),f=()=>{new SM({app:t,onNoteSelect:m=>{a&&m.path===a.path?(i(!0),n(h=>h.filter(b=>b.path!==m.path))):n(h=>[...h,Object.assign(m,{wasAddedManually:!0})])},excludeNotePaths:e}).open()},p=m=>{let h=r.find(g=>g.path===m);h&&h.wasAddedManually?n(g=>g.filter(y=>y.path!==m)):(i(!1),n(g=>g.filter(y=>y.path!==m)))};return d!=="copilot_plus"&&d!=="project"?null:R5t.default.createElement(M5t,{activeNote:o?a:null,contextNotes:r,onAddContext:f,onRemoveContext:p,contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c})},j5t=ePn;var N5t=(0,at.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:m,selectedTextContexts:h,onRemoveSelectedText:b},g)=>{let[y,S]=(0,at.useState)(!1),[x,O]=(0,at.useState)([]),P=(0,at.useRef)(null),E=(0,at.useRef)(null),[A,I]=SF(),[R,N]=(0,at.useState)(null),[j]=by(),[$]=n8e(),[k,z]=(0,at.useState)(()=>{let je=i.workspace.getActiveFile();return DR(je)?je:null}),[V,Q]=(0,at.useState)(null),J=Rn(),D=j==="copilot_plus"||j==="project",[B,q]=(0,at.useState)(0),K=["Loading the project context...","Processing context files...","If you have many files in context, this can take a while..."];(0,at.useImperativeHandle)(g,()=>({focus:()=>{P.current?.focus()}})),(0,at.useEffect)(()=>{if(j==="project"){Q(Mc());let je=xF(mt=>{Q(mt)});return()=>{je()}}else Q(null)},[j]),(0,at.useEffect)(()=>{if(!$)return;let je=setInterval(()=>{q(mt=>(mt+1)%K.length)},3e3);return()=>clearInterval(je)},[$,K.length]);let H=()=>V&&j==="project"&&V.projectModelKey?V.projectModelKey:A,ee=je=>{if(!D){r();return}r({toolCalls:je?["@vault"]:[],contextNotes:a,urls:x})},U=async je=>{let mt=je.target.value,ht=je.target.selectionStart,ft=ht>0&&mt[ht-1]==="/"&&(ht===1||mt[ht-2]===" ");e(mt),W();let et=c.extractAllUrls(mt).filter(Re=>!x.includes(Re));et.length>0&&O(Re=>Array.from(new Set([...Re,...et]))),ht>=2&&mt.slice(ht-2,ht)==="[["?Y(ht):ft?ae(ht,mt):mt.slice(-1)==="@"&&D&&Oe()},W=()=>{P.current&&(P.current.style.height="auto",P.current.style.height=`${P.current.scrollHeight}px`)};(0,at.useEffect)(()=>{W()},[t]);let Y=je=>{(async()=>{let ht=hz.getInstance();new SM({app:i,onNoteSelect:async ft=>{let te=t.slice(0,je-2),et=t.slice(je-1),Pe=ege(ft.basename,i.vault)?ft.basename:ft.path,oe=`${te}[[${Pe}]]${et}`;e(oe);let se=i.workspace.getActiveFile();ft&&await ht.addNoteToContext(ft,i.vault,a,se,s,l),setTimeout(()=>{if(P.current){let ce=je+Pe.length+2;P.current.setSelectionRange(ce,ce)}},0)},excludeNotePaths:Sn}).open()})()},ae=(je,mt)=>{let ht=lm.getInstance(),ft=Jx(),te=R3t(ft.filter(oe=>oe.showInSlashMenu)),et=te.map(oe=>oe.title),Re=je-1;new QW(i,et,oe=>{let se=te.find(ce=>ce.title===oe);if(se){ht.recordUsage(se);let ce="",Ce="";Re>=0&&mt[Re]==="/"&&(ce=mt.slice(0,Re),Ce=mt.slice(Re+1));let Je=ce+se.content+Ce;e(Je),setTimeout(()=>{if(P.current){let ir=ce.length+se.content.length;P.current.setSelectionRange(ir,ir),P.current.focus()}},0)}}).open()},Oe=()=>{let je=X6.map(mt=>({title:mt,description:N1t(mt)}));new QW(i,je.map(mt=>mt.title),mt=>{e(t+mt+" ")},je.map(mt=>mt.description)).open()},le=je=>{if(!je.nativeEvent.isComposing){if(je.key==="Enter"&&je.shiftKey&&(CM.Platform.isMacOS?je.metaKey:je.ctrlKey)){je.preventDefault(),je.stopPropagation(),ee(!0);return}if(je.key==="Enter"){if(!(!je.shiftKey&&!CM.Platform.isMobile||je.shiftKey&&CM.Platform.isMobile))return;je.preventDefault(),ee(!1)}}},Be=(0,at.useCallback)(async je=>{let mt=je.clipboardData?.items;if(!mt||!D)return;let ht=Array.from(mt).filter(ft=>ft.type.indexOf("image")!==-1);if(ht.length>0){je.preventDefault();let te=(await Promise.all(ht.map(et=>{let Re=et.getAsFile();return Re||null}))).filter(et=>et!==null);te.length>0&&f(te)}},[f,D]);(0,at.useEffect)(()=>{let je=new Set(DC(t,i.vault)),mt=c.extractAllUrls(t);s(ht=>ht.filter(ft=>{if(ft.wasAddedManually===!0)return!0;let et=ft.wasAddedViaReference===!0;return ft.path===k?.path?et?je.has(ft):u:et?je.has(ft):!0})),O(ht=>ht.filter(ft=>mt.includes(ft)))},[t,u,k,c,s,i.vault]),(0,at.useEffect)(()=>{let je,mt=()=>{clearTimeout(je),je=setTimeout(()=>{let ft=i.workspace.getActiveFile();z(DR(ft)?ft:null)},100)},ht=i.workspace.on("active-leaf-change",mt);return()=>{clearTimeout(je),i.workspace.offref(ht)}},[i.workspace]);let{getRootProps:ze,getInputProps:rt,isDragActive:cr}=zke({accept:{"image/*":[".png",".gif",".jpeg",".jpg",".webp"]},onDrop:je=>{f(je)},noClick:!0,noDragEventsBubbling:!0}),Sn=(0,at.useMemo)(()=>[...a.map(je=>je.path),...u&&k?[k.path]:[]].filter(je=>je!=null),[a,u,k]);return at.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},at.default.createElement(j5t,{app:i,excludeNotePaths:Sn,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,activeNote:k,contextUrls:x,onRemoveUrl:je=>O(mt=>mt.filter(ht=>ht!==je)),selectedTextContexts:h,onRemoveSelectedText:b}),d.length>0&&at.default.createElement("div",{className:"selected-images"},d.map((je,mt)=>at.default.createElement("div",{key:mt,className:"image-preview-container"},at.default.createElement("img",{src:URL.createObjectURL(je),alt:je.name,className:"selected-image-preview"}),at.default.createElement("button",{className:"remove-image-button",onClick:()=>p(ht=>ht.filter((ft,te)=>te!==mt)),title:"Remove image"},at.default.createElement(Vi,{className:"tw-size-4"}))))),at.default.createElement("div",{className:"tw-relative",...D?ze():{}},$&&at.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"},at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},at.default.createElement(Yl,{className:"tw-size-4 tw-animate-spin"}),at.default.createElement("span",{className:"tw-text-sm"},K[B]))),at.default.createElement("textarea",{ref:P,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 focus-visible:tw-ring-0",placeholder:"Ask anything. [[ for notes. / for custom prompts. "+(D?"@ for tools.":""),value:t,onChange:U,onKeyDown:le,onPaste:Be,disabled:$}),D&&at.default.createElement(at.default.Fragment,null,at.default.createElement("input",{...rt()}),cr&&at.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"},at.default.createElement("span",null,"Drop images here...")))),at.default.createElement("div",{className:"tw-flex tw-h-6 tw-justify-between tw-gap-1 tw-px-1"},n?at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-px-1 tw-text-sm tw-text-faint"},at.default.createElement(Yl,{className:"tw-size-3 tw-animate-spin"}),at.default.createElement("span",null,"Generating...")):at.default.createElement(YD,{open:y,onOpenChange:S},at.default.createElement(ZD,{asChild:!0},at.default.createElement(ge,{variant:"ghost2",size:"fit",disabled:m},R?at.default.createElement("span",{className:"tw-text-error"},"Model Load Failed"):J.activeModels.find(je=>je.enabled&&kr(je)===H())?at.default.createElement(Ike,{model:J.activeModels.find(je=>je.enabled&&kr(je)===H()),iconSize:8}):"Select Model",!m&&at.default.createElement(Hi,{className:"tw-mt-0.5 tw-size-5"}))),at.default.createElement(xb,{align:"start"},!m&&J.activeModels.filter(je=>je.enabled).map(je=>{let{hasApiKey:mt,errorNotice:ht}=hF(je,J);return at.default.createElement(Si,{key:kr(je),onSelect:async ft=>{if(!mt&&ht){ft.preventDefault(),new CM.Notice(ht);return}try{N(null),I(kr(je))}catch(te){let et="Model switch failed: "+ei(te);N(et),new CM.Notice(et);let Re=J.activeModels.find(Pe=>Pe.enabled&&kr(Pe)===A);Re&&I(kr(Re))}},className:mt?"":"tw-cursor-not-allowed tw-opacity-50"},at.default.createElement(Ike,{model:je,iconSize:12}))}))),at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},n?at.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>o()},at.default.createElement(bT,{className:"tw-size-4"}),"Stop"):at.default.createElement(at.default.Fragment,null,D&&at.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>{new ede(i,f).open()}},at.default.createElement(P3,{className:"tw-size-4"})),at.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>ee(!1)},at.default.createElement(Im,{className:"!tw-size-3"}),at.default.createElement("span",null,"chat")),j==="copilot_plus"&&at.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-hidden tw-text-muted @xs/chat-input:tw-inline-flex",onClick:()=>ee(!0)},at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},CM.Platform.isMacOS?at.default.createElement("div",{className:"tw-flex tw-items-center"},at.default.createElement(c_,{className:"!tw-size-3"}),at.default.createElement(ZC,{className:"!tw-size-3"}),at.default.createElement(Im,{className:"!tw-size-3"})):at.default.createElement("div",{className:"tw-flex tw-items-center"},at.default.createElement("span",null,"Ctrl"),at.default.createElement(ZC,{className:"tw-size-4"}),at.default.createElement(Im,{className:"!tw-size-3"})),at.default.createElement("span",null,"vault")))))))});N5t.displayName="ChatInput";var D5t=N5t;ti();$r();Tn();bn();var L5t=require("obsidian"),vr=F(X()),F5t=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>vr.default.createElement("div",{className:_e("tw-flex tw-gap-1",{"group-hover:opacity-100 opacity-0":!L5t.Platform.isMobile})},t.sender===Pi?vr.default.createElement(vr.default.Fragment,null,vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?vr.default.createElement(Jl,{className:"tw-size-4"}):vr.default.createElement(Ty,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Copy")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},vr.default.createElement(Rp,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Edit")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},vr.default.createElement(Rm,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Delete"))):vr.default.createElement(vr.default.Fragment,null,u&&vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},vr.default.createElement(c1,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Show Sources")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},vr.default.createElement(M3,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Insert / Replace at cursor")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?vr.default.createElement(Jl,{className:"tw-size-4"}):vr.default.createElement(Ty,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Copy")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},vr.default.createElement(I3,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Regenerate")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},vr.default.createElement(Rm,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Delete"))));$r();var k5t=require("obsidian"),sde=class extends k5t.Modal{constructor(e,r){super(e),this.sources=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Sources"});let r=this.sources.filter(o=>o.score>=ige),n=this.sources.filter(o=>o.score0&&(e.createEl("h3",{text:"High Relevance Sources"}),this.createSourceList(e,r)),n.length>0&&(e.createEl("h3",{text:"Lower Relevance Sources"}),this.createSourceList(e,n))}createSourceList(e,r){let n=e.createEl("ul");n.style.listStyleType="none",n.style.padding="0",r.forEach(o=>{let i=n.createEl("li");i.style.marginBottom="1em",i.createEl("a",{href:`obsidian://open?vault=${encodeURIComponent(this.app.vault.getName())}&file=${encodeURIComponent(o.title)}`,text:o.title}).addEventListener("click",s=>{s.preventDefault(),this.app.workspace.openLinkText(o.title,"")}),o.score&&o.score<=1&&i.appendChild(document.createTextNode(` - Relevance score: ${o.score.toFixed(3)}`))})}onClose(){let{contentEl:e}=this;e.empty()}};$r();Tn();yn();bn();var lE=require("obsidian");function Eb(){}Eb.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(x){return x=a.postProcess(x,o),i?(setTimeout(function(){i(x)},0),!0):x}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,m=[{oldPos:-1,lastComponent:void 0}],h=this.extractCommon(m[0],r,e,0,o);if(m[0].oldPos+1>=l&&h+1>=u)return s($5t(a,m[0].lastComponent,r,e,a.useLongestToken));var b=-1/0,g=1/0;function y(){for(var x=Math.max(b,-c);x<=Math.min(g,c);x+=2){var O=void 0,P=m[x-1],E=m[x+1];P&&(m[x-1]=void 0);var A=!1;if(E){var I=E.oldPos-x;A=E&&0<=I&&I=l&&h+1>=u)return s($5t(a,O.lastComponent,r,e,a.useLongestToken));m[x]=O,O.oldPos+1>=l&&(g=Math.min(g,x-1)),h+1>=u&&(b=Math.max(b,x+1))}c++}if(i)(function x(){setTimeout(function(){if(c>d||Date.now()>p)return i();y()||x()},0)})();else for(;c<=d&&Date.now()<=p;){var S=y();if(S)return S}},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+1p.length?h: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}var zdi=new Eb;function B5t(t,e){var r;for(r=0;re.length&&(r=t.length-e.length);var n=e.length;t.length0&&e[a]!=e[i];)i=o[i];e[a]==e[i]&&i++}i=0;for(var s=r;s0&&t[s]!=e[i];)i=o[i];t[s]==e[i]&&i++}return i}var lde="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}",rPn=new RegExp("[".concat(lde,"]+|\\s+|[^").concat(lde,"]"),"ug"),a9=new Eb;a9.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};a9.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(rPn)||[];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};a9.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};a9.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)&&z5t(r,o,n,i),r=i,n=null,o=null)}),(n||o)&&z5t(r,o,n,null),t};function H5t(t,e,r){return r?.ignoreWhitespace!=null&&!r.ignoreWhitespace?nPn(t,e,r):a9.diff(t,e,r)}function z5t(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=B5t(o,a);t.value=Vke(t.value,a,u),e.value=o9(e.value,u),r.value=o9(r.value,u)}if(n){var l=q5t(i,s);n.value=Hke(n.value,s,l),e.value=ude(e.value,l),r.value=ude(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=B5t(c,d);e.value=o9(e.value,p);var m=q5t(o9(c,p),f);e.value=ude(e.value,m),n.value=Hke(n.value,c,m),t.value=Vke(t.value,c,c.slice(0,c.length-m.length))}else if(n){var h=n.value.match(/^\s*/)[0],b=e.value.match(/\s*$/)[0],g=U5t(b,h);e.value=ude(e.value,g)}else if(t){var y=t.value.match(/\s*$/)[0],S=e.value.match(/^\s*/)[0],x=U5t(y,S);e.value=o9(e.value,x)}}var V5t=new Eb;V5t.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(lde,"]+|[^\\S\\n\\r]+|[^").concat(lde,"]"),"ug");return t.match(e)||[]};function nPn(t,e,r){return V5t.diff(t,e,r)}function oPn(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}var cde=new Eb;cde.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"u"?r:a}:n;return typeof t=="string"?t:JSON.stringify(Vke(t,null,null,o),o," ")};o9.equals=function(t,e,r){return Eb.prototype.equals.call(o9,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};function Vke(t,e,r,n,o){e=e||[],r=r||[],n&&(t=n(o,t));var i;for(i=0;i"u"?r:a}:n;return typeof t=="string"?t:JSON.stringify(Kke(t,null,null,o),o," ")};i9.equals=function(t,e,r){return Eb.prototype.equals.call(i9,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};function Kke(t,e,r,n,o){e=e||[],r=r||[],n&&(t=n(o,t));var i;for(i=0;i"- "+r).join(` -`)}function Kke(t){return t.map(r=>{let n=r.some(a=>a.added),o=r.some(a=>a.removed),i="";return n?i=r.map(a=>a.added?a.value:"").join(` -`):o?i=r.map(a=>a.removed?rPn(a.value):"").join(` +`)}function Jke(t){return t.map(r=>{let n=r.some(a=>a.added),o=r.some(a=>a.removed),i="";return n?i=r.map(a=>a.added?a.value:"").join(` +`):o?i=r.map(a=>a.removed?sPn(a.value):"").join(` `):r.map(s=>s.value).join(` `).trim().length>0&&(i="..."),i}).join(` -`)}function a9(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 s9="obsidian-copilot-apply-view",ude=class extends sE.ItemView{constructor(r){super(r);this.root=null;this.state=null}getViewType(){return s9}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)}render(){if(!this.state)return;let r=this.containerEl.children[1];r.empty();let n=r.createDiv();this.root||(this.root=(0,U5t.createRoot)(n)),this.root.render(wr.default.createElement(nPn,{app:this.app,state:this.state,close:()=>this.leaf.detach()}))}},H5t=(0,wr.memo)(({oldLine:t,newLine:e})=>{let r=$5t(t,e);return wr.default.createElement(wr.default.Fragment,null,r.map((n,o)=>n.added?wr.default.createElement("span",{key:o,className:"tw-text-success"},n.value):n.removed?wr.default.createElement("span",{key:o,className:"tw-text-error tw-line-through"},n.value):wr.default.createElement("span",{key:o},n.value)))});H5t.displayName="WordDiff";var nPn=({app:t,state:e,close:r})=>{let[n,o]=(0,z5t.useState)(()=>e.changes.map(p=>({...p,accepted:null}))),i=a9(n),a=(0,wr.useRef)([]);if(!e||!e.changes)return fe("Invalid state:",e),wr.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col tw-items-center tw-justify-center"},wr.default.createElement("div",{className:"tw-text-error"},"Error: Invalid state - missing changes"),wr.default.createElement(ge,{onClick:r,className:"tw-mt-4"},"Close"));let s=async()=>{try{let p=n.map(m=>m.accepted===null?{...m,accepted:!0}:m);await l(p)}catch(p){fe("Error applying changes:",p),new sE.Notice(`Error applying changes: ${p.message}`)}},u=async()=>{try{let p=n.map(m=>m.accepted===null?{...m,accepted:!1}:m);await l(p)}catch(p){fe("Error applying changes:",p),new sE.Notice(`Error applying changes: ${p.message}`)}},l=async p=>{let m=p.filter(b=>b.added?b.accepted===!0:b.removed?b.accepted===!1:!0).map(b=>b.value).join(""),h=t.vault.getAbstractFileByPath(e.path);if(!h||!(h instanceof sE.TFile)){new sE.Notice("File not found:"+e.path),r();return}await t.vault.modify(h,m),new sE.Notice("Changes applied successfully"),r()},c=p=>{if(!i)return;let m=-1;for(let h=p+1;hS.added||S.removed),y=b.some(S=>(S.added||S.removed)&&S.accepted===null);if(g&&y){m=h;break}}m!==-1&&a.current[m]&&a.current[m]?.scrollIntoView({behavior:"smooth",block:"center"})},d=p=>{o(m=>{let h=[...m],b=i?.[p];return b&&b.forEach(g=>{let y=h.findIndex(S=>S===g);y!==-1&&(h[y]={...h[y],accepted:!0})}),h}),setTimeout(()=>c(p),0)},f=p=>{o(m=>{let h=[...m],b=i?.[p];return b&&b.forEach(g=>{let y=h.findIndex(S=>S===g);y!==-1&&(h[y]={...h[y],accepted:!1})}),h}),setTimeout(()=>c(p),0)};return wr.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},wr.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"},wr.default.createElement(ge,{variant:"destructive",size:"sm",onClick:u},wr.default.createElement(Vi,{className:"tw-size-4"}),"Reject"),wr.default.createElement(ge,{variant:"success",size:"sm",onClick:s},wr.default.createElement(Jl,{className:"tw-size-4"}),"Accept")),wr.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),wr.default.createElement("div",{className:"tw-flex-1 tw-overflow-auto tw-p-2"},i?.map((p,m)=>{let h=p.some(g=>g.added||g.removed),b=h?p.every(g=>!g.added&&!g.removed||g.accepted===!0)?"accepted":p.every(g=>!g.added&&!g.removed||g.accepted===!1)?"rejected":"undecided":"unchanged";return wr.default.createElement("div",{key:m,ref:g=>a.current[m]=g,className:_e("tw-mb-4 tw-overflow-hidden tw-rounded-md")},b==="accepted"?wr.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"},p.filter(g=>!g.removed).map((g,y)=>wr.default.createElement("div",{key:y},g.value))):b==="rejected"?wr.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"},p.filter(g=>!g.added).map((g,y)=>wr.default.createElement("div",{key:y},g.value))):p.map((g,y)=>{if(g.added){let S=p.findIndex((x,O)=>x.removed&&O!==y);if(S!==-1){let x=p[S].value;return wr.default.createElement("div",{key:`${m}-${y}`,className:"tw-relative"},wr.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm"},wr.default.createElement(H5t,{oldLine:x,newLine:g.value})))}}return g.removed&&p.findIndex((x,O)=>x.added&&O!==y)!==-1?null:wr.default.createElement("div",{key:`${m}-${y}`,className:"tw-relative"},wr.default.createElement("div",{className:_e("tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm",{"tw-text-success":g.added,"tw-text-error":g.removed,"tw-text-normal":!g.added&&!g.removed,"tw-line-through":g.removed})},g.value))}),h&&b==="undecided"&&wr.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"},wr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wr.default.createElement(ge,{variant:"destructive",size:"sm",onClick:()=>f(m)},wr.default.createElement(Vi,{className:"tw-size-4"}),"Reject"),wr.default.createElement(ge,{variant:"success",size:"sm",onClick:()=>d(m)},wr.default.createElement(Jl,{className:"tw-size-4"}),"Accept"))),h&&(b==="accepted"||b==="rejected")&&wr.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"},wr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wr.default.createElement("div",{className:"tw-mr-2 tw-text-sm tw-font-medium"},b==="accepted"?wr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-success"},wr.default.createElement(Jl,{className:"tw-size-4"}),wr.default.createElement("div",null,"Accepted")):wr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-error"},wr.default.createElement(Vi,{className:"tw-size-4"}),wr.default.createElement("div",null,"Rejected"))),wr.default.createElement(ge,{variant:"secondary",size:"sm",onClick:()=>{o(g=>{let y=[...g],S=i?.[m];return S&&S.forEach(x=>{let O=y.findIndex(P=>P===x);O!==-1&&(y[O]={...y[O],accepted:null})}),y})}},"Revert"))))})))};yo();var uE=require("obsidian"),V5t=require("obsidian");var W5t=({note_path:t,note_content:e,note_changes:r})=>Tb.default.createElement("div",{className:"tw-my-2 tw-flex tw-flex-col tw-overflow-hidden tw-rounded-md tw-border tw-border-solid tw-border-border"},t&&Tb.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-overflow-hidden tw-border-[0px] tw-border-b tw-border-solid tw-border-border tw-p-2"},Tb.default.createElement("div",{className:"tw-flex-1 tw-truncate tw-p-1 tw-text-xs tw-text-muted"},t),Tb.default.createElement("div",{className:"tw-flex tw-gap-2"},Tb.default.createElement(ge,{className:"tw-text-muted",variant:"ghost2",size:"fit",onClick:()=>{try{let i=r.length>0?Kke(a9(r)):e;navigator.clipboard.writeText(i),new uE.Notice("Content copied to clipboard")}catch(i){fe("Error copying to clipboard:",i),new uE.Notice(`Failed to copy: ${i.message}`)}}},Tb.default.createElement(f3,{className:"tw-size-4"}),"Copy"),Tb.default.createElement(ge,{className:"tw-text-muted",variant:"ghost2",size:"fit",onClick:async()=>{if(t)try{let i=app.vault.getAbstractFileByPath(t),a=!1;if(!i)try{if(t.includes("/")){let l=t.split("/").slice(0,-1).join("/");app.vault.getAbstractFileByPath(l)||await app.vault.createFolder(l)}if(i=await app.vault.create(t,e),i)new uE.Notice(`Created new file: ${t}`),a=!0;else{new uE.Notice(`Failed to create file: ${t}`);return}a=!0}catch(l){fe("Error creating file:",l),new uE.Notice(`Failed to create file: ${l.message}`);return}if(!(i instanceof V5t.TFile)){new uE.Notice(`Path is not a file: ${t}`);return}let s=app.workspace.getActiveFile();if((!s||s.path!==t)&&(await app.workspace.getLeaf().openFile(i),new uE.Notice(`Switched to ${i.name}`)),a)return;await app.workspace.getLeaf(!0).setViewState({type:s9,active:!0,state:{changes:r,path:t}})}catch(i){fe("Error calling composer apply:",i),new uE.Notice(`Error processing code: ${i.message}`)}}},Tb.default.createElement(Jl,{className:"tw-size-4"}),app.vault.getAbstractFileByPath(t)?"Preview":"Apply"))),Tb.default.createElement("pre",{className:"tw-m-0 tw-border-none"},Tb.default.createElement("code",null,r.length>0?Kke(a9(r)):e)));function oPn({context:t}){return!t||t.notes.length===0&&t.urls.length===0?null:Sr.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-2"},t.notes.map(e=>Sr.default.createElement(Rt,{key:e.path},Sr.default.createElement(jt,{asChild:!0},Sr.default.createElement(cm,{variant:"secondary"},Sr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e.basename))),Sr.default.createElement(Mt,null,e.path))),t.urls.map(e=>Sr.default.createElement(Rt,{key:e},Sr.default.createElement(jt,{asChild:!0},Sr.default.createElement(cm,{variant:"secondary"},Sr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e))),Sr.default.createElement(Mt,null,e))))}var iPn=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i,chatHistory:a=[]})=>{let[s,u]=(0,Sr.useState)(!1),[l,c]=(0,Sr.useState)(!1),[d,f]=(0,Sr.useState)(t.message),p=(0,Sr.useRef)(null),m=(0,Sr.useRef)(null),h=(0,Sr.useRef)(null),b=()=>{!navigator.clipboard||!navigator.clipboard.writeText||navigator.clipboard.writeText(t.message).then(()=>{u(!0),setTimeout(()=>{u(!1)},2e3)})},g=(0,Sr.useCallback)(j=>{let $=e.workspace.getActiveFile(),k=$?$.path:"",z=ee=>{let U="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",W="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",Y="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)";if(r&&ee.includes(""))return ee=ee.replace(/([\s\S]*?)<\/think>/g,(Oe,le)=>`
+`)}function s9(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 u9="obsidian-copilot-apply-view",dde=class extends sE.ItemView{constructor(r){super(r);this.root=null;this.state=null}getViewType(){return u9}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)}render(){if(!this.state)return;let r=this.containerEl.children[1];r.empty();let n=r.createDiv();this.root||(this.root=(0,K5t.createRoot)(n)),this.root.render(wr.default.createElement(uPn,{app:this.app,state:this.state,close:()=>this.leaf.detach()}))}},J5t=(0,wr.memo)(({oldLine:t,newLine:e})=>{let r=H5t(t,e);return wr.default.createElement(wr.default.Fragment,null,r.map((n,o)=>n.added?wr.default.createElement("span",{key:o,className:"tw-text-success"},n.value):n.removed?wr.default.createElement("span",{key:o,className:"tw-text-error tw-line-through"},n.value):wr.default.createElement("span",{key:o},n.value)))});J5t.displayName="WordDiff";var uPn=({app:t,state:e,close:r})=>{let[n,o]=(0,G5t.useState)(()=>e.changes.map(p=>({...p,accepted:null}))),i=s9(n),a=(0,wr.useRef)([]);if(!e||!e.changes)return fe("Invalid state:",e),wr.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col tw-items-center tw-justify-center"},wr.default.createElement("div",{className:"tw-text-error"},"Error: Invalid state - missing changes"),wr.default.createElement(ge,{onClick:r,className:"tw-mt-4"},"Close"));let s=async()=>{try{let p=n.map(m=>m.accepted===null?{...m,accepted:!0}:m);await l(p)}catch(p){fe("Error applying changes:",p),new sE.Notice(`Error applying changes: ${p.message}`)}},u=async()=>{try{let p=n.map(m=>m.accepted===null?{...m,accepted:!1}:m);await l(p)}catch(p){fe("Error applying changes:",p),new sE.Notice(`Error applying changes: ${p.message}`)}},l=async p=>{let m=p.filter(b=>b.added?b.accepted===!0:b.removed?b.accepted===!1:!0).map(b=>b.value).join(""),h=t.vault.getAbstractFileByPath(e.path);if(!h||!(h instanceof sE.TFile)){new sE.Notice("File not found:"+e.path),r();return}await t.vault.modify(h,m),new sE.Notice("Changes applied successfully"),r()},c=p=>{if(!i)return;let m=-1;for(let h=p+1;hS.added||S.removed),y=b.some(S=>(S.added||S.removed)&&S.accepted===null);if(g&&y){m=h;break}}m!==-1&&a.current[m]&&a.current[m]?.scrollIntoView({behavior:"smooth",block:"center"})},d=p=>{o(m=>{let h=[...m],b=i?.[p];return b&&b.forEach(g=>{let y=h.findIndex(S=>S===g);y!==-1&&(h[y]={...h[y],accepted:!0})}),h}),setTimeout(()=>c(p),0)},f=p=>{o(m=>{let h=[...m],b=i?.[p];return b&&b.forEach(g=>{let y=h.findIndex(S=>S===g);y!==-1&&(h[y]={...h[y],accepted:!1})}),h}),setTimeout(()=>c(p),0)};return wr.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},wr.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"},wr.default.createElement(ge,{variant:"destructive",size:"sm",onClick:u},wr.default.createElement(Vi,{className:"tw-size-4"}),"Reject"),wr.default.createElement(ge,{variant:"success",size:"sm",onClick:s},wr.default.createElement(Jl,{className:"tw-size-4"}),"Accept")),wr.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),wr.default.createElement("div",{className:"tw-flex-1 tw-overflow-auto tw-p-2"},i?.map((p,m)=>{let h=p.some(g=>g.added||g.removed),b=h?p.every(g=>!g.added&&!g.removed||g.accepted===!0)?"accepted":p.every(g=>!g.added&&!g.removed||g.accepted===!1)?"rejected":"undecided":"unchanged";return wr.default.createElement("div",{key:m,ref:g=>a.current[m]=g,className:_e("tw-mb-4 tw-overflow-hidden tw-rounded-md")},b==="accepted"?wr.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"},p.filter(g=>!g.removed).map((g,y)=>wr.default.createElement("div",{key:y},g.value))):b==="rejected"?wr.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"},p.filter(g=>!g.added).map((g,y)=>wr.default.createElement("div",{key:y},g.value))):p.map((g,y)=>{if(g.added){let S=p.findIndex((x,O)=>x.removed&&O!==y);if(S!==-1){let x=p[S].value;return wr.default.createElement("div",{key:`${m}-${y}`,className:"tw-relative"},wr.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm"},wr.default.createElement(J5t,{oldLine:x,newLine:g.value})))}}return g.removed&&p.findIndex((x,O)=>x.added&&O!==y)!==-1?null:wr.default.createElement("div",{key:`${m}-${y}`,className:"tw-relative"},wr.default.createElement("div",{className:_e("tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm",{"tw-text-success":g.added,"tw-text-error":g.removed,"tw-text-normal":!g.added&&!g.removed,"tw-line-through":g.removed})},g.value))}),h&&b==="undecided"&&wr.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"},wr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wr.default.createElement(ge,{variant:"destructive",size:"sm",onClick:()=>f(m)},wr.default.createElement(Vi,{className:"tw-size-4"}),"Reject"),wr.default.createElement(ge,{variant:"success",size:"sm",onClick:()=>d(m)},wr.default.createElement(Jl,{className:"tw-size-4"}),"Accept"))),h&&(b==="accepted"||b==="rejected")&&wr.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"},wr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wr.default.createElement("div",{className:"tw-mr-2 tw-text-sm tw-font-medium"},b==="accepted"?wr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-success"},wr.default.createElement(Jl,{className:"tw-size-4"}),wr.default.createElement("div",null,"Accepted")):wr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-error"},wr.default.createElement(Vi,{className:"tw-size-4"}),wr.default.createElement("div",null,"Rejected"))),wr.default.createElement(ge,{variant:"secondary",size:"sm",onClick:()=>{o(g=>{let y=[...g],S=i?.[m];return S&&S.forEach(x=>{let O=y.findIndex(P=>P===x);O!==-1&&(y[O]={...y[O],accepted:null})}),y})}},"Revert"))))})))};yo();var uE=require("obsidian"),Y5t=require("obsidian");var Z5t=({note_path:t,note_content:e,note_changes:r})=>Tb.default.createElement("div",{className:"tw-my-2 tw-flex tw-flex-col tw-overflow-hidden tw-rounded-md tw-border tw-border-solid tw-border-border"},t&&Tb.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-overflow-hidden tw-border-[0px] tw-border-b tw-border-solid tw-border-border tw-p-2"},Tb.default.createElement("div",{className:"tw-flex-1 tw-truncate tw-p-1 tw-text-xs tw-text-muted"},t),Tb.default.createElement("div",{className:"tw-flex tw-gap-2"},Tb.default.createElement(ge,{className:"tw-text-muted",variant:"ghost2",size:"fit",onClick:()=>{try{let i=r.length>0?Jke(s9(r)):e;navigator.clipboard.writeText(i),new uE.Notice("Content copied to clipboard")}catch(i){fe("Error copying to clipboard:",i),new uE.Notice(`Failed to copy: ${i.message}`)}}},Tb.default.createElement(p3,{className:"tw-size-4"}),"Copy"),Tb.default.createElement(ge,{className:"tw-text-muted",variant:"ghost2",size:"fit",onClick:async()=>{if(t)try{let i=app.vault.getAbstractFileByPath(t),a=!1;if(!i)try{if(t.includes("/")){let l=t.split("/").slice(0,-1).join("/");app.vault.getAbstractFileByPath(l)||await app.vault.createFolder(l)}if(i=await app.vault.create(t,e),i)new uE.Notice(`Created new file: ${t}`),a=!0;else{new uE.Notice(`Failed to create file: ${t}`);return}a=!0}catch(l){fe("Error creating file:",l),new uE.Notice(`Failed to create file: ${l.message}`);return}if(!(i instanceof Y5t.TFile)){new uE.Notice(`Path is not a file: ${t}`);return}let s=app.workspace.getActiveFile();if((!s||s.path!==t)&&(await app.workspace.getLeaf().openFile(i),new uE.Notice(`Switched to ${i.name}`)),a)return;await app.workspace.getLeaf(!0).setViewState({type:u9,active:!0,state:{changes:r,path:t}})}catch(i){fe("Error calling composer apply:",i),new uE.Notice(`Error processing code: ${i.message}`)}}},Tb.default.createElement(Jl,{className:"tw-size-4"}),app.vault.getAbstractFileByPath(t)?"Preview":"Apply"))),Tb.default.createElement("pre",{className:"tw-m-0 tw-border-none"},Tb.default.createElement("code",null,r.length>0?Jke(s9(r)):e)));function lPn({context:t}){return!t||t.notes.length===0&&t.urls.length===0?null:Sr.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-2"},t.notes.map(e=>Sr.default.createElement(Rt,{key:e.path},Sr.default.createElement(jt,{asChild:!0},Sr.default.createElement(cm,{variant:"secondary"},Sr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e.basename))),Sr.default.createElement(Mt,null,e.path))),t.urls.map(e=>Sr.default.createElement(Rt,{key:e},Sr.default.createElement(jt,{asChild:!0},Sr.default.createElement(cm,{variant:"secondary"},Sr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e))),Sr.default.createElement(Mt,null,e))))}var cPn=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i,chatHistory:a=[]})=>{let[s,u]=(0,Sr.useState)(!1),[l,c]=(0,Sr.useState)(!1),[d,f]=(0,Sr.useState)(t.message),p=(0,Sr.useRef)(null),m=(0,Sr.useRef)(null),h=(0,Sr.useRef)(null),b=()=>{!navigator.clipboard||!navigator.clipboard.writeText||navigator.clipboard.writeText(t.message).then(()=>{u(!0),setTimeout(()=>{u(!1)},2e3)})},g=(0,Sr.useCallback)(j=>{let $=e.workspace.getActiveFile(),k=$?$.path:"",z=ee=>{let U="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",W="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",Y="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)";if(r&&ee.includes(""))return ee=ee.replace(/([\s\S]*?)<\/think>/g,(Oe,le)=>`
Thought for a second
${le.trim()}
@@ -991,25 +991,25 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
    `+V+`
-
`};(0,Sr.useEffect)(()=>{let j=[],$=!1;if(p.current&&t.sender!==Pi){p.current.innerHTML="",m.current||(m.current=new lE.Component);let k=g(t.message);if(!$&&(lE.MarkdownRenderer.renderMarkdown(k,p.current,"",m.current),!r)){let z=p.current.querySelectorAll("pre");z.length>0&&z.forEach(V=>{if($)return;let Q=V.querySelector("code");if(!Q)return;let J=Q.textContent||"";try{if(J.trim().startsWith("{")&&J.trim().endsWith("}")){let D=JSON.parse(J);if(D.type==="composer"&&D.path&&(typeof D.content=="string"||typeof D.canvas_json=="string")){let B;typeof D.content=="string"?B=D.content:B=JSON.stringify(D.canvas_json);let q=D.path.trim();q.startsWith("/")&&(q=q.slice(1));let K=document.createElement("div");V.parentNode?.replaceChild(K,V);let H=(0,K5t.createRoot)(K);j.push(H);let ee=e.vault.getAbstractFileByPath(q),U=[];(async()=>{if(ee instanceof lE.TFile){let W=await e.vault.read(ee);U=q5t(W,B,{newlineIsToken:!0})}else{let W=q.split("/").pop()?.split(".")[0],Y=B.split(` +`};(0,Sr.useEffect)(()=>{let j=[],$=!1;if(p.current&&t.sender!==Pi){p.current.innerHTML="",m.current||(m.current=new lE.Component);let k=g(t.message);if(!$&&(lE.MarkdownRenderer.renderMarkdown(k,p.current,"",m.current),!r)){let z=p.current.querySelectorAll("pre");z.length>0&&z.forEach(V=>{if($)return;let Q=V.querySelector("code");if(!Q)return;let J=Q.textContent||"";try{if(J.trim().startsWith("{")&&J.trim().endsWith("}")){let D=JSON.parse(J);if(D.type==="composer"&&D.path&&(typeof D.content=="string"||typeof D.canvas_json=="object")){let B;typeof D.content=="string"?B=D.content:B=JSON.stringify(D.canvas_json);let q=D.path.trim();q.startsWith("/")&&(q=q.slice(1));let K=document.createElement("div");V.parentNode?.replaceChild(K,V);let H=(0,X5t.createRoot)(K);j.push(H);let ee=e.vault.getAbstractFileByPath(q),U=[];(async()=>{if(ee instanceof lE.TFile){let W=await e.vault.read(ee);U=W5t(W,B,{newlineIsToken:!0})}else{let W=q.split("/").pop()?.split(".")[0],Y=B.split(` `);(Y[0]===`# ${W} `||Y[0]===`## ${W}`)&&Y.shift(),B=Y.join(` -`)}$||H.render(Sr.default.createElement(W5t,{note_path:q,note_content:B,note_changes:U}))})()}}}catch(D){console.error("Failed to parse composer JSON:",D)}})}}return()=>{$=!0,setTimeout(()=>{m.current&&(m.current.unload(),m.current=null),j.forEach(k=>{try{k.unmount()}catch{}})},0)}},[t,e,m,r,g]),(0,Sr.useEffect)(()=>{l&&h.current&&S(h.current)},[l]),(0,Sr.useEffect)(()=>{f(t.message)},[t.message]);let S=j=>{j.style.height="auto",j.style.height=`${j.scrollHeight}px`},x=j=>{f(j.target.value),S(j.target)},O=j=>{j.nativeEvent.isComposing||(j.key==="Enter"&&!j.shiftKey?(j.preventDefault(),A()):j.key==="Escape"&&(j.preventDefault(),P()))},P=()=>{c(!1),f(t.message)},E=()=>{c(!0)},A=()=>{c(!1),o&&o(d)},I=()=>{t.sources&&t.sources.length>0&&new ode(e,t.sources).open()},R=()=>{let j=e.workspace.getMostRecentLeaf();if((!j||!(j.view instanceof lE.MarkdownView))&&(j=e.workspace.getLeaf(!1),!j||!(j.view instanceof lE.MarkdownView)))return;let k=j.view.editor.getSelection().length>0;l4(t.message,k)},N=()=>t.content?Sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3"},t.content.map((j,$)=>j.type==="text"?Sr.default.createElement("div",{key:$},t.sender===Pi&&l?Sr.default.createElement("textarea",{ref:h,value:d,onChange:x,onKeyDown:O,autoFocus:!0,className:"edit-textarea"}):t.sender===Pi?Sr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):Sr.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""})):j.type==="image_url"?Sr.default.createElement("div",{key:$,className:"message-image-content"},Sr.default.createElement("img",{src:j.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===Pi&&l?Sr.default.createElement("textarea",{ref:h,value:d,onChange:x,onKeyDown:O,autoFocus:!0,className:"edit-textarea"}):t.sender===Pi?Sr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):Sr.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""});return Sr.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},Sr.default.createElement("div",{className:_e("tw-group tw-mx-2 tw-flex tw-gap-2 tw-rounded-md tw-p-2",t.sender===Pi&&"tw-border tw-border-solid tw-border-border")},Sr.default.createElement("div",{className:"tw-w-6 tw-shrink-0"},t.sender===Pi?Sr.default.createElement(M3,null):Sr.default.createElement(a1,null)),Sr.default.createElement("div",{className:"tw-flex tw-max-w-full tw-grow tw-flex-col tw-gap-2 tw-overflow-hidden"},!l&&Sr.default.createElement(oPn,{context:t.context}),Sr.default.createElement("div",{className:"message-content"},N()),!r&&Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},Sr.default.createElement("div",{className:"tw-text-xs tw-text-faint"},t.timestamp?.display),Sr.default.createElement(R5t,{message:t,onCopy:b,isCopied:s,onInsertIntoEditor:R,onRegenerate:n,onEdit:E,onDelete:i,onShowSources:I,hasSources:!!(t.sources&&t.sources.length>0)})))))},Gke=iPn;ti();var hd=F(X(),1);function G5t(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Y5t=F(X(),1);function J5t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Jke(...t){return e=>{let r=!1,n=t.map(o=>{let i=J5t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:r,...n}=t,o=md.Children.toArray(r),i=o.find(sPn);if(i){let a=i.props.children,s=o.map(u=>u===i?md.Children.count(a)>1?md.Children.only(null):md.isValidElement(a)?a.props.children:null:u);return(0,hz.jsx)(Yke,{...n,ref:e,children:md.isValidElement(a)?md.cloneElement(a,void 0,s):null})}return(0,hz.jsx)(Yke,{...n,ref:e,children:r})});Zke.displayName="Slot";var Yke=md.forwardRef((t,e)=>{let{children:r,...n}=t;if(md.isValidElement(r)){let o=lPn(r);return md.cloneElement(r,{...uPn(n,r.props),ref:e?Jke(e,o):o})}return md.Children.count(r)>1?md.Children.only(null):null});Yke.displayName="SlotClone";var aPn=({children:t})=>(0,hz.jsx)(hz.Fragment,{children:t});function sPn(t){return md.isValidElement(t)&&t.type===aPn}function uPn(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 lPn(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 Q5t=F(ft(),1),dPn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],lde=dPn.reduce((t,e)=>{let r=X5t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Zke:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Q5t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var eL=F(ft(),1),Xke="Collapsible",[fPn,Efi]=Yi(Xke),[pPn,Qke]=fPn(Xke),eWt=hd.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=ud({prop:n,defaultProp:o,onChange:a});return(0,eL.jsx)(pPn,{scope:r,disabled:i,contentId:hl(),open:u,onOpenToggle:hd.useCallback(()=>l(c=>!c),[l]),children:(0,eL.jsx)(lde.div,{"data-state":n$e(u),"data-disabled":i?"":void 0,...s,ref:e})})});eWt.displayName=Xke;var tWt="CollapsibleTrigger",e$e=hd.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=Qke(tWt,r);return(0,eL.jsx)(lde.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":n$e(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:G5t(t.onClick,o.onOpenToggle)})});e$e.displayName=tWt;var t$e="CollapsibleContent",r$e=hd.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=Qke(t$e,t.__scopeCollapsible);return(0,eL.jsx)(fd,{present:r||o.open,children:({present:i})=>(0,eL.jsx)(mPn,{...n,ref:e,present:i})})});r$e.displayName=t$e;var mPn=hd.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=Qke(t$e,r),[s,u]=hd.useState(n),l=hd.useRef(null),c=Z5t(e,l),d=hd.useRef(0),f=d.current,p=hd.useRef(0),m=p.current,h=a.open||s,b=hd.useRef(h),g=hd.useRef(void 0);return hd.useEffect(()=>{let y=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(y)},[]),Jn(()=>{let y=l.current;if(y){g.current=g.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";let S=y.getBoundingClientRect();d.current=S.height,p.current=S.width,b.current||(y.style.transitionDuration=g.current.transitionDuration,y.style.animationName=g.current.animationName),u(n)}},[a.open,n]),(0,eL.jsx)(lde.div,{"data-state":n$e(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!h,...i,ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:h&&o})});function n$e(t){return t?"open":"closed"}var rWt=eWt;var cE=rWt,tL=e$e,dE=r$e;var f9=F(X());var Da=F(X(),1);function eC(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var oWt=F(X(),1);function nWt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function o$e(...t){return e=>{let r=!1,n=t.map(o=>{let i=nWt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:r,...n}=t,o=gd.Children.toArray(r),i=o.find(yPn);if(i){let a=i.props.children,s=o.map(u=>u===i?gd.Children.count(a)>1?gd.Children.only(null):gd.isValidElement(a)?a.props.children:null:u);return(0,gz.jsx)(i$e,{...n,ref:e,children:gd.isValidElement(a)?gd.cloneElement(a,void 0,s):null})}return(0,gz.jsx)(i$e,{...n,ref:e,children:r})});u9.displayName="Slot";var i$e=gd.forwardRef((t,e)=>{let{children:r,...n}=t;if(gd.isValidElement(r)){let o=_Pn(r);return gd.cloneElement(r,{...bPn(n,r.props),ref:e?o$e(e,o):o})}return gd.Children.count(r)>1?gd.Children.only(null):null});i$e.displayName="SlotClone";var gPn=({children:t})=>(0,gz.jsx)(gz.Fragment,{children:t});function yPn(t){return gd.isValidElement(t)&&t.type===gPn}function bPn(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 _Pn(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 sWt=F(ft(),1),vPn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],op=vPn.reduce((t,e)=>{let r=iWt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?u9:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,sWt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function uWt(t,e){t&&aWt.flushSync(()=>t.dispatchEvent(e))}var s$e=F(ft(),1),wPn="DismissableLayer",a$e="dismissableLayer.update",SPn="dismissableLayer.pointerDownOutside",xPn="dismissableLayer.focusOutside",lWt,dWt=rs.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),u$e=rs.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=rs.useContext(dWt),[c,d]=rs.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=rs.useState({}),m=Ab(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=PPn(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=EPn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return oM(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),rs.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(lWt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),cWt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=lWt)}},[c,f,r,l]),rs.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),cWt())},[c,l]),rs.useEffect(()=>{let E=()=>p({});return document.addEventListener(a$e,E),()=>document.removeEventListener(a$e,E)},[]),(0,s$e.jsx)(op.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:eC(t.onFocusCapture,P.onFocusCapture),onBlurCapture:eC(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:eC(t.onPointerDownCapture,O.onPointerDownCapture)})});u$e.displayName=wPn;var CPn="DismissableLayerBranch",OPn=rs.forwardRef((t,e)=>{let r=rs.useContext(dWt),n=rs.useRef(null),o=Ab(e,n);return rs.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,s$e.jsx)(op.div,{...t,ref:o})});OPn.displayName=CPn;function PPn(t,e=globalThis?.document){let r=Ur(t),n=rs.useRef(!1),o=rs.useRef(()=>{});return rs.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){fWt(SPn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function EPn(t,e=globalThis?.document){let r=Ur(t),n=rs.useRef(!1);return rs.useEffect(()=>{let o=i=>{i.target&&!n.current&&fWt(xPn,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 cWt(){let t=new CustomEvent(a$e);document.dispatchEvent(t)}function fWt(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?uWt(o,i):o.dispatchEvent(i)}var Qg=F(X(),1);var yWt=F(ft(),1),l$e="focusScope.autoFocusOnMount",c$e="focusScope.autoFocusOnUnmount",pWt={bubbles:!1,cancelable:!0},TPn="FocusScope",d$e=Qg.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Qg.useState(null),l=Ur(o),c=Ur(i),d=Qg.useRef(null),f=Ab(e,h=>u(h)),p=Qg.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Qg.useEffect(()=>{if(n){let y=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:OM(d.current,{select:!0})},S=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||OM(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&OM(s)};var h=y,b=S,g=x;document.addEventListener("focusin",y),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),Qg.useEffect(()=>{if(s){hWt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(l$e,pWt);s.addEventListener(l$e,l),s.dispatchEvent(g),g.defaultPrevented||(APn(NPn(bWt(s)),{select:!0}),document.activeElement===h&&OM(s))}return()=>{s.removeEventListener(l$e,l),setTimeout(()=>{let g=new CustomEvent(c$e,pWt);s.addEventListener(c$e,c),s.dispatchEvent(g),g.defaultPrevented||OM(h??document.body,{select:!0}),s.removeEventListener(c$e,c),hWt.remove(p)},0)}}},[s,l,c,p]);let m=Qg.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let y=h.currentTarget,[S,x]=IPn(y);S&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&OM(S,{select:!0})):h.shiftKey&&g===S&&(h.preventDefault(),r&&OM(x,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,yWt.jsx)(op.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});d$e.displayName=TPn;function APn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(OM(n,{select:e}),document.activeElement!==r)return}function IPn(t){let e=bWt(t),r=mWt(e,t),n=mWt(e.reverse(),t);return[r,n]}function bWt(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 mWt(t,e){for(let r of t)if(!MPn(r,{upTo:e}))return r}function MPn(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 RPn(t){return t instanceof HTMLInputElement&&"select"in t}function OM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&RPn(t)&&e&&t.select()}}var hWt=jPn();function jPn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=gWt(t,e),t.unshift(e)},remove(e){t=gWt(t,e),t[0]?.resume()}}}function gWt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function NPn(t){return t.filter(e=>e.tagName!=="A")}var fh=F(X(),1);var _Wt=F(X(),1);var f$e=F(ft(),1),DPn="Arrow",vWt=_Wt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,f$e.jsx)(op.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,f$e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});vWt.displayName=DPn;var wWt=vWt;var PM=F(ft(),1);var p$e="Popper",[SWt,m$e]=Yi(p$e),[FPn,xWt]=SWt(p$e),CWt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=fh.useState(null);return(0,PM.jsx)(FPn,{scope:e,anchor:n,onAnchorChange:o,children:r})};CWt.displayName=p$e;var OWt="PopperAnchor",PWt=fh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=xWt(OWt,r),a=fh.useRef(null),s=Ab(e,a);return fh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,PM.jsx)(op.div,{...o,ref:s})});PWt.displayName=OWt;var h$e="PopperContent",[kPn,$Pn]=SWt(h$e),EWt=fh.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=xWt(h$e,r),[g,y]=fh.useState(null),S=Ab(e,Y=>y(Y)),[x,O]=fh.useState(null),P=Xx(x),E=P?.width??0,A=P?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],j=N.length>0,$={padding:R,boundary:N.filter(qPn),altBoundary:j},{refs:k,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:J}=sM({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>oE(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[uM({mainAxis:o+A,alignmentAxis:a}),u&&lM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cM():void 0,...$}),u&&dM({...$}),fM({...$,apply:({elements:Y,rects:ae,availableWidth:Oe,availableHeight:le})=>{let{width:Be,height:ze}=ae.reference,rt=Y.floating.style;rt.setProperty("--radix-popper-available-width",`${Oe}px`),rt.setProperty("--radix-popper-available-height",`${le}px`),rt.setProperty("--radix-popper-anchor-width",`${Be}px`),rt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),x&&mM({element:x,padding:s}),UPn({arrowWidth:E,arrowHeight:A}),f&&pM({strategy:"referenceHidden",...$})]}),[D,B]=IWt(V),q=Ur(m);Jn(()=>{Q&&q?.()},[Q,q]);let K=J.arrow?.x,H=J.arrow?.y,ee=J.arrow?.centerOffset!==0,[U,W]=fh.useState();return Jn(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,PM.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,PM.jsx)(kPn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:H,shouldHideArrow:ee,children:(0,PM.jsx)(op.div,{"data-side":D,"data-align":B,...h,ref:S,style:{...h.style,animation:Q?void 0:"none"}})})})});EWt.displayName=h$e;var TWt="PopperArrow",BPn={top:"bottom",right:"left",bottom:"top",left:"right"},AWt=fh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=$Pn(TWt,n),a=BPn[i.placedSide];return(0,PM.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,PM.jsx)(wWt,{...o,ref:r,style:{...o.style,display:"block"}})})});AWt.displayName=TWt;function qPn(t){return t!==null}var UPn=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]=IWt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function IWt(t){let[e,r="center"]=t.split("-");return[e,r]}var MWt=CWt,g$e=PWt,RWt=EWt,jWt=AWt;var cde=F(X(),1),NWt=F(ds(),1);var DWt=F(ft(),1),HPn="Portal",y$e=cde.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=cde.useState(!1);Jn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?NWt.default.createPortal((0,DWt.jsx)(op.div,{...n,ref:e}),a):null});y$e.displayName=HPn;var pde=F(X());var pf=F(X());var dde=HD();var b$e=function(){},l9=pf.forwardRef(function(t,e){var r=pf.useRef(null),n=pf.useState({onScrollCapture:b$e,onWheelCapture:b$e,onTouchMoveCapture:b$e}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,b=t.as,g=b===void 0?"div":b,y=t.gapMode,S=_M(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=zD([r,e]),P=yi(yi({},S),o);return pf.createElement(pf.Fragment,null,c&&pf.createElement(x,{sideCar:dde,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:y}),a?pf.cloneElement(pf.Children.only(s),yi(yi({},P),{ref:O})):pf.createElement(g,yi({},P,{className:u,ref:O}),s))});l9.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};l9.classNames={fullWidth:Sb,zeroRight:wb};var ba=F(X());var _$e=!1;if(typeof window<"u")try{c9=Object.defineProperty({},"passive",{get:function(){return _$e=!0,!0}}),window.addEventListener("test",c9,c9),window.removeEventListener("test",c9,c9)}catch{_$e=!1}var c9,rL=_$e?{passive:!1}:!1;var VPn=function(t){return t.tagName==="TEXTAREA"},LWt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!VPn(t)&&r[e]==="visible")},WPn=function(t){return LWt(t,"overflowY")},KPn=function(t){return LWt(t,"overflowX")},v$e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=FWt(t,n);if(o){var i=kWt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},GPn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},JPn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},FWt=function(t,e){return t==="v"?WPn(e):KPn(e)},kWt=function(t,e){return t==="v"?GPn(e):JPn(e)},YPn=function(t,e){return t==="h"&&e==="rtl"?-1:1},$Wt=function(t,e,r,n,o){var i=YPn(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=kWt(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&FWt(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var fde=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},BWt=function(t){return[t.deltaX,t.deltaY]},qWt=function(t){return t&&"current"in t?t.current:t},ZPn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},XPn=function(t){return` +`)}$||H.render(Sr.default.createElement(Z5t,{note_path:q,note_content:B,note_changes:U}))})()}}}catch(D){console.error("Failed to parse composer JSON:",D)}})}}return()=>{$=!0,setTimeout(()=>{m.current&&(m.current.unload(),m.current=null),j.forEach(k=>{try{k.unmount()}catch{}})},0)}},[t,e,m,r,g]),(0,Sr.useEffect)(()=>{l&&h.current&&S(h.current)},[l]),(0,Sr.useEffect)(()=>{f(t.message)},[t.message]);let S=j=>{j.style.height="auto",j.style.height=`${j.scrollHeight}px`},x=j=>{f(j.target.value),S(j.target)},O=j=>{j.nativeEvent.isComposing||(j.key==="Enter"&&!j.shiftKey?(j.preventDefault(),A()):j.key==="Escape"&&(j.preventDefault(),P()))},P=()=>{c(!1),f(t.message)},E=()=>{c(!0)},A=()=>{c(!1),o&&o(d)},I=()=>{t.sources&&t.sources.length>0&&new sde(e,t.sources).open()},R=()=>{let j=e.workspace.getMostRecentLeaf();if((!j||!(j.view instanceof lE.MarkdownView))&&(j=e.workspace.getLeaf(!1),!j||!(j.view instanceof lE.MarkdownView)))return;let k=j.view.editor.getSelection().length>0;c4(t.message,k)},N=()=>t.content?Sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3"},t.content.map((j,$)=>j.type==="text"?Sr.default.createElement("div",{key:$},t.sender===Pi&&l?Sr.default.createElement("textarea",{ref:h,value:d,onChange:x,onKeyDown:O,autoFocus:!0,className:"edit-textarea"}):t.sender===Pi?Sr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):Sr.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""})):j.type==="image_url"?Sr.default.createElement("div",{key:$,className:"message-image-content"},Sr.default.createElement("img",{src:j.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===Pi&&l?Sr.default.createElement("textarea",{ref:h,value:d,onChange:x,onKeyDown:O,autoFocus:!0,className:"edit-textarea"}):t.sender===Pi?Sr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):Sr.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""});return Sr.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},Sr.default.createElement("div",{className:_e("tw-group tw-mx-2 tw-flex tw-gap-2 tw-rounded-md tw-p-2",t.sender===Pi&&"tw-border tw-border-solid tw-border-border")},Sr.default.createElement("div",{className:"tw-w-6 tw-shrink-0"},t.sender===Pi?Sr.default.createElement(R3,null):Sr.default.createElement(s1,null)),Sr.default.createElement("div",{className:"tw-flex tw-max-w-full tw-grow tw-flex-col tw-gap-2 tw-overflow-hidden"},!l&&Sr.default.createElement(lPn,{context:t.context}),Sr.default.createElement("div",{className:"message-content"},N()),!r&&Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},Sr.default.createElement("div",{className:"tw-text-xs tw-text-faint"},t.timestamp?.display),Sr.default.createElement(F5t,{message:t,onCopy:b,isCopied:s,onInsertIntoEditor:R,onRegenerate:n,onEdit:E,onDelete:i,onShowSources:I,hasSources:!!(t.sources&&t.sources.length>0)})))))},Yke=cPn;ti();var hd=F(X(),1);function Q5t(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var tWt=F(X(),1);function eWt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Zke(...t){return e=>{let r=!1,n=t.map(o=>{let i=eWt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:r,...n}=t,o=md.Children.toArray(r),i=o.find(fPn);if(i){let a=i.props.children,s=o.map(u=>u===i?md.Children.count(a)>1?md.Children.only(null):md.isValidElement(a)?a.props.children:null:u);return(0,gz.jsx)(Xke,{...n,ref:e,children:md.isValidElement(a)?md.cloneElement(a,void 0,s):null})}return(0,gz.jsx)(Xke,{...n,ref:e,children:r})});Qke.displayName="Slot";var Xke=md.forwardRef((t,e)=>{let{children:r,...n}=t;if(md.isValidElement(r)){let o=mPn(r);return md.cloneElement(r,{...pPn(n,r.props),ref:e?Zke(e,o):o})}return md.Children.count(r)>1?md.Children.only(null):null});Xke.displayName="SlotClone";var dPn=({children:t})=>(0,gz.jsx)(gz.Fragment,{children:t});function fPn(t){return md.isValidElement(t)&&t.type===dPn}function pPn(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 mPn(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 oWt=F(pt(),1),gPn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],fde=gPn.reduce((t,e)=>{let r=nWt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Qke:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,oWt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var tL=F(pt(),1),e$e="Collapsible",[yPn,Lfi]=Yi(e$e),[bPn,t$e]=yPn(e$e),iWt=hd.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=ud({prop:n,defaultProp:o,onChange:a});return(0,tL.jsx)(bPn,{scope:r,disabled:i,contentId:hl(),open:u,onOpenToggle:hd.useCallback(()=>l(c=>!c),[l]),children:(0,tL.jsx)(fde.div,{"data-state":i$e(u),"data-disabled":i?"":void 0,...s,ref:e})})});iWt.displayName=e$e;var aWt="CollapsibleTrigger",r$e=hd.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=t$e(aWt,r);return(0,tL.jsx)(fde.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":i$e(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:Q5t(t.onClick,o.onOpenToggle)})});r$e.displayName=aWt;var n$e="CollapsibleContent",o$e=hd.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=t$e(n$e,t.__scopeCollapsible);return(0,tL.jsx)(fd,{present:r||o.open,children:({present:i})=>(0,tL.jsx)(_Pn,{...n,ref:e,present:i})})});o$e.displayName=n$e;var _Pn=hd.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=t$e(n$e,r),[s,u]=hd.useState(n),l=hd.useRef(null),c=rWt(e,l),d=hd.useRef(0),f=d.current,p=hd.useRef(0),m=p.current,h=a.open||s,b=hd.useRef(h),g=hd.useRef(void 0);return hd.useEffect(()=>{let y=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(y)},[]),Jn(()=>{let y=l.current;if(y){g.current=g.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";let S=y.getBoundingClientRect();d.current=S.height,p.current=S.width,b.current||(y.style.transitionDuration=g.current.transitionDuration,y.style.animationName=g.current.animationName),u(n)}},[a.open,n]),(0,tL.jsx)(fde.div,{"data-state":i$e(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!h,...i,ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:h&&o})});function i$e(t){return t?"open":"closed"}var sWt=iWt;var cE=sWt,rL=r$e,dE=o$e;var p9=F(X());var Da=F(X(),1);function tC(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var lWt=F(X(),1);function uWt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function a$e(...t){return e=>{let r=!1,n=t.map(o=>{let i=uWt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:r,...n}=t,o=gd.Children.toArray(r),i=o.find(SPn);if(i){let a=i.props.children,s=o.map(u=>u===i?gd.Children.count(a)>1?gd.Children.only(null):gd.isValidElement(a)?a.props.children:null:u);return(0,yz.jsx)(s$e,{...n,ref:e,children:gd.isValidElement(a)?gd.cloneElement(a,void 0,s):null})}return(0,yz.jsx)(s$e,{...n,ref:e,children:r})});l9.displayName="Slot";var s$e=gd.forwardRef((t,e)=>{let{children:r,...n}=t;if(gd.isValidElement(r)){let o=CPn(r);return gd.cloneElement(r,{...xPn(n,r.props),ref:e?a$e(e,o):o})}return gd.Children.count(r)>1?gd.Children.only(null):null});s$e.displayName="SlotClone";var wPn=({children:t})=>(0,yz.jsx)(yz.Fragment,{children:t});function SPn(t){return gd.isValidElement(t)&&t.type===wPn}function xPn(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 CPn(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 fWt=F(pt(),1),OPn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],op=OPn.reduce((t,e)=>{let r=cWt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?l9:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,fWt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function pWt(t,e){t&&dWt.flushSync(()=>t.dispatchEvent(e))}var l$e=F(pt(),1),PPn="DismissableLayer",u$e="dismissableLayer.update",EPn="dismissableLayer.pointerDownOutside",TPn="dismissableLayer.focusOutside",mWt,gWt=rs.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),c$e=rs.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=rs.useContext(gWt),[c,d]=rs.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=rs.useState({}),m=Ab(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=MPn(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=RPn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return oM(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),rs.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(mWt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),hWt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=mWt)}},[c,f,r,l]),rs.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),hWt())},[c,l]),rs.useEffect(()=>{let E=()=>p({});return document.addEventListener(u$e,E),()=>document.removeEventListener(u$e,E)},[]),(0,l$e.jsx)(op.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:tC(t.onFocusCapture,P.onFocusCapture),onBlurCapture:tC(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:tC(t.onPointerDownCapture,O.onPointerDownCapture)})});c$e.displayName=PPn;var APn="DismissableLayerBranch",IPn=rs.forwardRef((t,e)=>{let r=rs.useContext(gWt),n=rs.useRef(null),o=Ab(e,n);return rs.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,l$e.jsx)(op.div,{...t,ref:o})});IPn.displayName=APn;function MPn(t,e=globalThis?.document){let r=Ur(t),n=rs.useRef(!1),o=rs.useRef(()=>{});return rs.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){yWt(EPn,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 RPn(t,e=globalThis?.document){let r=Ur(t),n=rs.useRef(!1);return rs.useEffect(()=>{let o=i=>{i.target&&!n.current&&yWt(TPn,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 hWt(){let t=new CustomEvent(u$e);document.dispatchEvent(t)}function yWt(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?pWt(o,i):o.dispatchEvent(i)}var Qg=F(X(),1);var SWt=F(pt(),1),d$e="focusScope.autoFocusOnMount",f$e="focusScope.autoFocusOnUnmount",bWt={bubbles:!1,cancelable:!0},jPn="FocusScope",p$e=Qg.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Qg.useState(null),l=Ur(o),c=Ur(i),d=Qg.useRef(null),f=Ab(e,h=>u(h)),p=Qg.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Qg.useEffect(()=>{if(n){let y=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:OM(d.current,{select:!0})},S=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||OM(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&OM(s)};var h=y,b=S,g=x;document.addEventListener("focusin",y),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),Qg.useEffect(()=>{if(s){vWt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(d$e,bWt);s.addEventListener(d$e,l),s.dispatchEvent(g),g.defaultPrevented||(NPn($Pn(xWt(s)),{select:!0}),document.activeElement===h&&OM(s))}return()=>{s.removeEventListener(d$e,l),setTimeout(()=>{let g=new CustomEvent(f$e,bWt);s.addEventListener(f$e,c),s.dispatchEvent(g),g.defaultPrevented||OM(h??document.body,{select:!0}),s.removeEventListener(f$e,c),vWt.remove(p)},0)}}},[s,l,c,p]);let m=Qg.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let y=h.currentTarget,[S,x]=DPn(y);S&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&OM(S,{select:!0})):h.shiftKey&&g===S&&(h.preventDefault(),r&&OM(x,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,SWt.jsx)(op.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});p$e.displayName=jPn;function NPn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(OM(n,{select:e}),document.activeElement!==r)return}function DPn(t){let e=xWt(t),r=_Wt(e,t),n=_Wt(e.reverse(),t);return[r,n]}function xWt(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 _Wt(t,e){for(let r of t)if(!LPn(r,{upTo:e}))return r}function LPn(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 FPn(t){return t instanceof HTMLInputElement&&"select"in t}function OM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&FPn(t)&&e&&t.select()}}var vWt=kPn();function kPn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=wWt(t,e),t.unshift(e)},remove(e){t=wWt(t,e),t[0]?.resume()}}}function wWt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function $Pn(t){return t.filter(e=>e.tagName!=="A")}var fh=F(X(),1);var CWt=F(X(),1);var m$e=F(pt(),1),BPn="Arrow",OWt=CWt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,m$e.jsx)(op.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,m$e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});OWt.displayName=BPn;var PWt=OWt;var PM=F(pt(),1);var h$e="Popper",[EWt,g$e]=Yi(h$e),[UPn,TWt]=EWt(h$e),AWt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=fh.useState(null);return(0,PM.jsx)(UPn,{scope:e,anchor:n,onAnchorChange:o,children:r})};AWt.displayName=h$e;var IWt="PopperAnchor",MWt=fh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=TWt(IWt,r),a=fh.useRef(null),s=Ab(e,a);return fh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,PM.jsx)(op.div,{...o,ref:s})});MWt.displayName=IWt;var y$e="PopperContent",[zPn,HPn]=EWt(y$e),RWt=fh.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=TWt(y$e,r),[g,y]=fh.useState(null),S=Ab(e,Y=>y(Y)),[x,O]=fh.useState(null),P=Qx(x),E=P?.width??0,A=P?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],j=N.length>0,$={padding:R,boundary:N.filter(WPn),altBoundary:j},{refs:k,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:J}=sM({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>oE(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[uM({mainAxis:o+A,alignmentAxis:a}),u&&lM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cM():void 0,...$}),u&&dM({...$}),fM({...$,apply:({elements:Y,rects:ae,availableWidth:Oe,availableHeight:le})=>{let{width:Be,height:ze}=ae.reference,rt=Y.floating.style;rt.setProperty("--radix-popper-available-width",`${Oe}px`),rt.setProperty("--radix-popper-available-height",`${le}px`),rt.setProperty("--radix-popper-anchor-width",`${Be}px`),rt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),x&&mM({element:x,padding:s}),KPn({arrowWidth:E,arrowHeight:A}),f&&pM({strategy:"referenceHidden",...$})]}),[D,B]=DWt(V),q=Ur(m);Jn(()=>{Q&&q?.()},[Q,q]);let K=J.arrow?.x,H=J.arrow?.y,ee=J.arrow?.centerOffset!==0,[U,W]=fh.useState();return Jn(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,PM.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,PM.jsx)(zPn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:H,shouldHideArrow:ee,children:(0,PM.jsx)(op.div,{"data-side":D,"data-align":B,...h,ref:S,style:{...h.style,animation:Q?void 0:"none"}})})})});RWt.displayName=y$e;var jWt="PopperArrow",VPn={top:"bottom",right:"left",bottom:"top",left:"right"},NWt=fh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=HPn(jWt,n),a=VPn[i.placedSide];return(0,PM.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,PM.jsx)(PWt,{...o,ref:r,style:{...o.style,display:"block"}})})});NWt.displayName=jWt;function WPn(t){return t!==null}var KPn=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]=DWt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function DWt(t){let[e,r="center"]=t.split("-");return[e,r]}var LWt=AWt,b$e=MWt,FWt=RWt,kWt=NWt;var pde=F(X(),1),$Wt=F(ds(),1);var BWt=F(pt(),1),JPn="Portal",_$e=pde.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=pde.useState(!1);Jn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?$Wt.default.createPortal((0,BWt.jsx)(op.div,{...n,ref:e}),a):null});_$e.displayName=JPn;var gde=F(X());var pf=F(X());var mde=VD();var v$e=function(){},c9=pf.forwardRef(function(t,e){var r=pf.useRef(null),n=pf.useState({onScrollCapture:v$e,onWheelCapture:v$e,onTouchMoveCapture:v$e}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,b=t.as,g=b===void 0?"div":b,y=t.gapMode,S=_M(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=HD([r,e]),P=yi(yi({},S),o);return pf.createElement(pf.Fragment,null,c&&pf.createElement(x,{sideCar:mde,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:y}),a?pf.cloneElement(pf.Children.only(s),yi(yi({},P),{ref:O})):pf.createElement(g,yi({},P,{className:u,ref:O}),s))});c9.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};c9.classNames={fullWidth:Sb,zeroRight:wb};var ba=F(X());var w$e=!1;if(typeof window<"u")try{d9=Object.defineProperty({},"passive",{get:function(){return w$e=!0,!0}}),window.addEventListener("test",d9,d9),window.removeEventListener("test",d9,d9)}catch{w$e=!1}var d9,nL=w$e?{passive:!1}:!1;var YPn=function(t){return t.tagName==="TEXTAREA"},qWt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!YPn(t)&&r[e]==="visible")},ZPn=function(t){return qWt(t,"overflowY")},XPn=function(t){return qWt(t,"overflowX")},S$e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=UWt(t,n);if(o){var i=zWt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},QPn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},eEn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},UWt=function(t,e){return t==="v"?ZPn(e):XPn(e)},zWt=function(t,e){return t==="v"?QPn(e):eEn(e)},tEn=function(t,e){return t==="h"&&e==="rtl"?-1:1},HWt=function(t,e,r,n,o){var i=tEn(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=zWt(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&UWt(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var hde=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},VWt=function(t){return[t.deltaX,t.deltaY]},WWt=function(t){return t&&"current"in t?t.current:t},rEn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},nEn=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},QPn=0,yz=[];function UWt(t){var e=ba.useRef([]),r=ba.useRef([0,0]),n=ba.useRef(),o=ba.useState(QPn++)[0],i=ba.useState(iE)[0],a=ba.useRef(t);ba.useEffect(function(){a.current=t},[t]),ba.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=az([t.lockRef.current],(t.shards||[]).map(qWt),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=ba.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=fde(h),y=r.current,S="deltaX"in h?h.deltaX:y[0]-g[0],x="deltaY"in h?h.deltaY:y[1]-g[1],O,P=h.target,E=Math.abs(S)>Math.abs(x)?"h":"v";if("touches"in h&&E==="h"&&P.type==="range")return!1;var A=v$e(E,P);if(!A)return!0;if(A?O=E:(O=E==="v"?"h":"v",A=v$e(E,P)),!A)return!1;if(!n.current&&"changedTouches"in h&&(S||x)&&(n.current=O),!O)return!0;var I=n.current||O;return $Wt(I,b,h,I==="h"?S:x,!0)},[]),u=ba.useCallback(function(h){var b=h;if(!(!yz.length||yz[yz.length-1]!==i)){var g="deltaY"in b?BWt(b):fde(b),y=e.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&ZPn(O.delta,g)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var S=(a.current.shards||[]).map(qWt).filter(Boolean).filter(function(O){return O.contains(b.target)}),x=S.length>0?s(b,S[0]):!a.current.noIsolation;x&&b.cancelable&&b.preventDefault()}}},[]),l=ba.useCallback(function(h,b,g,y){var S={name:h,delta:b,target:g,should:y,shadowParent:eEn(g)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(x){return x!==S})},1)},[]),c=ba.useCallback(function(h){r.current=fde(h),n.current=void 0},[]),d=ba.useCallback(function(h){l(h.type,BWt(h),h.target,s(h,t.lockRef.current))},[]),f=ba.useCallback(function(h){l(h.type,fde(h),h.target,s(h,t.lockRef.current))},[]);ba.useEffect(function(){return yz.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,rL),document.addEventListener("touchmove",u,rL),document.addEventListener("touchstart",c,rL),function(){yz=yz.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,rL),document.removeEventListener("touchmove",u,rL),document.removeEventListener("touchstart",c,rL)}},[]);var p=t.removeScrollBar,m=t.inert;return ba.createElement(ba.Fragment,null,m?ba.createElement(i,{styles:XPn(o)}):null,p?ba.createElement(WD,{gapMode:t.gapMode}):null)}function eEn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var zWt=VD(dde,UWt);var HWt=pde.forwardRef(function(t,e){return pde.createElement(l9,yi({},t,{ref:e,sideCar:zWt}))});HWt.classNames=l9.classNames;var w$e=HWt;var bl=F(ft(),1),S$e="Popover",[VWt,Upi]=Yi(S$e,[m$e]),d9=m$e(),[tEn,EM]=VWt(S$e),WWt=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=d9(e),u=Da.useRef(null),[l,c]=Da.useState(!1),[d=!1,f]=ud({prop:n,defaultProp:o,onChange:i});return(0,bl.jsx)(MWt,{...s,children:(0,bl.jsx)(tEn,{scope:e,contentId:hl(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:Da.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Da.useCallback(()=>c(!0),[]),onCustomAnchorRemove:Da.useCallback(()=>c(!1),[]),modal:a,children:r})})};WWt.displayName=S$e;var KWt="PopoverAnchor",rEn=Da.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=EM(KWt,r),i=d9(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return Da.useEffect(()=>(a(),()=>s()),[a,s]),(0,bl.jsx)(g$e,{...i,...n,ref:e})});rEn.displayName=KWt;var GWt="PopoverTrigger",JWt=Da.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=EM(GWt,r),i=d9(r),a=Ab(e,o.triggerRef),s=(0,bl.jsx)(op.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":t9t(o.open),...n,ref:a,onClick:eC(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,bl.jsx)(g$e,{asChild:!0,...i,children:s})});JWt.displayName=GWt;var x$e="PopoverPortal",[nEn,oEn]=VWt(x$e,{forceMount:void 0}),YWt=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=EM(x$e,e);return(0,bl.jsx)(nEn,{scope:e,forceMount:r,children:(0,bl.jsx)(fd,{present:r||i.open,children:(0,bl.jsx)(y$e,{asChild:!0,container:o,children:n})})})};YWt.displayName=x$e;var bz="PopoverContent",ZWt=Da.forwardRef((t,e)=>{let r=oEn(bz,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=EM(bz,t.__scopePopover);return(0,bl.jsx)(fd,{present:n||i.open,children:i.modal?(0,bl.jsx)(iEn,{...o,ref:e}):(0,bl.jsx)(aEn,{...o,ref:e})})});ZWt.displayName=bz;var iEn=Da.forwardRef((t,e)=>{let r=EM(bz,t.__scopePopover),n=Da.useRef(null),o=Ab(e,n),i=Da.useRef(!1);return Da.useEffect(()=>{let a=n.current;if(a)return bM(a)},[]),(0,bl.jsx)(w$e,{as:u9,allowPinchZoom:!0,children:(0,bl.jsx)(XWt,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:eC(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:eC(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:eC(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),aEn=Da.forwardRef((t,e)=>{let r=EM(bz,t.__scopePopover),n=Da.useRef(!1),o=Da.useRef(!1);return(0,bl.jsx)(XWt,{...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()}})}),XWt=Da.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=EM(bz,r),p=d9(r);return iM(),(0,bl.jsx)(d$e,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,bl.jsx)(u$e,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,bl.jsx)(RWt,{"data-state":t9t(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)"}})})})}),QWt="PopoverClose",e9t=Da.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=EM(QWt,r);return(0,bl.jsx)(op.button,{type:"button",...n,ref:e,onClick:eC(t.onClick,()=>o.onOpenChange(!1))})});e9t.displayName=QWt;var sEn="PopoverArrow",uEn=Da.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=d9(r);return(0,bl.jsx)(jWt,{...o,...n,ref:e})});uEn.displayName=sEn;function t9t(t){return t?"open":"closed"}var r9t=WWt;var n9t=JWt,o9t=YWt,C$e=ZWt,i9t=e9t;Tn();var mde=r9t,hde=n9t;var p9=f9.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>f9.createElement(o9t,{container:n??activeDocument.body},f9.createElement(C$e,{ref:i,align:e,sideOffset:r,className:_e("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})));p9.displayName=C$e.displayName;var O$e=i9t;$r();var P$e=F(X()),gde=P$e.createContext(void 0),_z=P$e.createContext(void 0);var vz=F(X());function E$e(){let[t,e]=(0,vz.useState)(null),r=(0,vz.useContext)(_z);return(0,vz.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(Dh.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(Dh.ACTIVE_LEAF_CHANGE,n)}},[r]),t}Tn();Ix();yn();var m9=require("obsidian"),Ke=F(X());function cEn(t){let[e,r]=(0,Ke.useState)([]),n=E$e();return(0,Ke.useEffect)(()=>{async function o(){if(!n?.path)return;let i=await ma.getInstance().getDb(),a=await Xle({db:i,filePath:n.path});r(a)}o()},[n?.path,t]),e}function dEn(t,e){let[r,n]=(0,Ke.useState)(!0);return(0,Ke.useEffect)(()=>{if(!t)return;async function o(){let i=await ma.getInstance().hasIndex(t);n(i)}o()},[t,e]),r}function fEn({score:t}){let e=Zle(t),r="\u{1F534}";return e===2&&(r="\u{1F7E0}"),e===3&&(r="\u{1F7E2}"),Ke.default.createElement("span",{className:"tw-text-sm"},r)}function pEn({note:t,onAddToChat:e,onNavigateToNote:r}){let[n,o]=(0,Ke.useState)(!1),[i,a]=(0,Ke.useState)(null),s=(0,Ke.useCallback)(async()=>{if(i)return;let u=app.vault.getAbstractFileByPath(t.document.path);if(u instanceof m9.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,Ke.useEffect)(()=>{n&&s()},[n,s]),Ke.default.createElement(cE,{open:n,onOpenChange:o,className:"tw-rounded-md tw-border tw-border-solid tw-border-border"},Ke.default.createElement("div",{className:_e("tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-2")},Ke.default.createElement(ge,{variant:"ghost2",size:"icon",className:"tw-shrink-0",asChild:!0},Ke.default.createElement(tL,null,Ke.default.createElement(ZC,{className:_e("tw-size-4 tw-transition-transform tw-duration-200",{"rotate-90":n})}))),Ke.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-2"},Ke.default.createElement(fEn,{score:t.metadata.similarityScore??0})),Ke.default.createElement("div",{className:"tw-flex-1 tw-overflow-hidden"},Ke.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"},t.document.title)),Ke.default.createElement(Rt,null,Ke.default.createElement(jt,{asChild:!0},Ke.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:e,className:"tw-shrink-0"},Ke.default.createElement(Am,{className:"tw-size-4"}))),Ke.default.createElement(Mt,null,"Add to Chat"))),Ke.default.createElement(dE,null,Ke.default.createElement("div",{className:"tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2"},Ke.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&&Ke.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)),Ke.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&&Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ke.default.createElement("span",null,"Similarity: ",(t.metadata.similarityScore*100).toFixed(1),"%")),t.metadata.hasOutgoingLinks&&Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ke.default.createElement(w3,{className:"tw-size-4"}),Ke.default.createElement("span",null,"Outgoing links")),t.metadata.hasBacklinks&&Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ke.default.createElement(v3,{className:"tw-size-4"}),Ke.default.createElement("span",null,"Backlinks")))))}function mEn({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return Ke.default.createElement(mde,{key:t.document.path},Ke.default.createElement(hde,{asChild:!0},n),Ke.default.createElement(p9,{className:"tw-flex tw-w-fit tw-min-w-72 tw-max-w-96 tw-flex-col tw-gap-2 tw-overflow-hidden"},Ke.default.createElement("span",{className:"tw-text-sm tw-text-normal"},t.document.title),Ke.default.createElement("span",{className:"tw-text-xs tw-text-muted"},t.document.path),Ke.default.createElement("div",{className:"tw-flex tw-gap-2"},Ke.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 ",Ke.default.createElement(Am,{className:"tw-size-4"})),Ke.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 ",Ke.default.createElement(c3,{className:"tw-size-4"})))))}var yde=(0,Ke.memo)(({className:t,onInsertToChat:e,defaultOpen:r=!1})=>{let[n,o]=(0,Ke.useState)(0),[i,a]=(0,Ke.useState)(r),s=cEn(n),u=E$e(),l=dEn(u?.path??"",n),c=(p,m=!1)=>{let h=app.vault.getAbstractFileByPath(p);h instanceof m9.TFile&&app.workspace.getLeaf(m).openFile(h)},d=p=>{e(`[[${p}]]`)},f=async()=>{u&&(await ma.getInstance().reindexFile(u),new m9.Notice(`Reindexed ${u.name}`),o(n+1))};return Ke.default.createElement("div",{className:_e("tw-w-full tw-border tw-border-solid tw-border-transparent tw-border-b-border tw-pb-2",t)},Ke.default.createElement(cE,{open:i,onOpenChange:a},Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-pb-2 tw-pl-1"},Ke.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},Ke.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Relevant Notes"),Ke.default.createElement(Rt,null,Ke.default.createElement(jt,{asChild:!0},Ke.default.createElement(f_,{className:"tw-size-4 tw-text-muted"})),Ke.default.createElement(Mt,{side:"bottom",className:"tw-w-64"},"Relevance is a combination of semantic similarity and links.")),!l&&Ke.default.createElement(Rt,null,Ke.default.createElement(jt,{asChild:!0},Ke.default.createElement(Uf,{className:"tw-size-4 tw-text-warning"})),Ke.default.createElement(Mt,{side:"bottom"},"Note has not been indexed"))),Ke.default.createElement("div",{className:"tw-flex tw-items-center"},Ke.default.createElement(Rt,null,Ke.default.createElement(jt,{asChild:!0},Ke.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:f},Ke.default.createElement(T3,{className:"tw-size-4"}))),Ke.default.createElement(Mt,{side:"bottom"},"Reindex Current Note")),s.length>0&&Ke.default.createElement(tL,{asChild:!0},Ke.default.createElement(ge,{variant:"ghost2",size:"icon"},i?Ke.default.createElement(Ey,{className:"tw-size-5"}):Ke.default.createElement(Hi,{className:"tw-size-5"}))))),s.length===0&&Ke.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"},Ke.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"No relevant notes found")),!i&&s.length>0&&Ke.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=>Ke.default.createElement(mEn,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)},Ke.default.createElement(cm,{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"},Ke.default.createElement("span",{className:"tw-truncate"},p.document.title))))),Ke.default.createElement(dE,null,Ke.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=>Ke.default.createElement(pEn,{note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)}))))))});yde.displayName="RelevantNotes";Cl();Fd();ti();var dm=F(X());Tn();var h9=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-rounded-xl tw-border tw-border-border tw-bg-primary tw-text-normal tw-shadow",t),...e}));h9.displayName="Card";var g9=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-flex tw-flex-col tw-space-y-1.5 tw-p-6",t),...e}));g9.displayName="CardHeader";var T$e=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));T$e.displayName="CardTitle";var hEn=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-text-sm tw-text-muted",t),...e}));hEn.displayName="CardDescription";var y9=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-p-6 tw-pt-0",t),...e}));y9.displayName="CardContent";var gEn=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-flex tw-items-center tw-p-6 tw-pt-0",t),...e}));gEn.displayName="CardFooter";$r();nr();yn();var Xi=F(X()),A$e={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 [[]], what improvements should we focus on next?","Summarize the key points from [[]].","Summarize the recent updates from [[]].","Roast my writing in [[]] 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 from my notes?","Explain based on my stored notes.","Highlight important details on from my notes.","Based on my notes on , 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 @vault","Summarize in under 10 bullet points","@youtube ","@websearch what are most recent updates in the AI industry","What are the key insights from this paper ","What new methods are proposed in this paper [[]]"]}},a9t={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"],project:["copilotPlus","copilotPlus","copilotPlus"]};function yEn(t="llm_chain"){let e=a9t[t]||a9t.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...A$e[n].prompts].sort(()=>Math.random()-.5)),{title:A$e[n].title,text:r[n].pop()||A$e[n].prompts[0]}))}var s9t=({onClick:t})=>{let[e]=by(),r=(0,Xi.useMemo)(()=>yEn(e),[e]),o=Rn().indexVaultToVectorStore;return Xi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Xi.default.createElement(h9,{className:"tw-w-full tw-bg-transparent"},Xi.default.createElement(g9,{className:"tw-px-2"},Xi.default.createElement(T$e,null,"Suggested Prompts")),Xi.default.createElement(y9,{className:"tw-p-2 tw-pt-0"},Xi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},r.map((i,a)=>Xi.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"},Xi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},Xi.default.createElement("div",{className:"tw-text-muted"},i.title),Xi.default.createElement("div",null,i.text)),Xi.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},Xi.default.createElement(Rt,null,Xi.default.createElement(jt,{asChild:!0},Xi.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>t(i.text)},Xi.default.createElement(Am,{className:"tw-size-4"}))),Xi.default.createElement(Mt,null,"Add to Chat")))))))),e==="vault_qa"&&Xi.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"&&Xi.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},Xi.default.createElement("div",null,Xi.default.createElement(Uf,{className:"tw-size-4"})," Your auto-index strategy is set to"," ",Xi.default.createElement("b",null,"NEVER"),". Before proceeding, click the"," ",Xi.default.createElement("span",{className:"tw-text-accent"},"Refresh Index")," button below or run the"," ",Xi.default.createElement("span",{className:"tw-text-accent"},"Copilot command: Index (refresh) vault for QA")," ","to update the index.")))};nr();var mf=F(X()),u9t=(0,mf.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,mf.useState)(""),p=Rn(),m=()=>{let b=document.querySelector("[data-testid='chat-messages']");b&&(b.scrollTop=b.scrollHeight)};if((0,mf.useEffect)(()=>{r||m()},[r]),(0,mf.useEffect)(()=>{let b;return r?b=setInterval(()=>{f(g=>g.length<6?g+".":"")},200):f(""),()=>clearInterval(b)},[r]),!t.filter(b=>b.isVisible).length&&!e)return mf.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-gap-2 tw-overflow-y-auto"},c&&p.showRelevantNotes&&mf.default.createElement(yde,{onInsertToChat:u,defaultOpen:!0,key:"relevant-notes-before-chat"}),c&&p.showSuggestedPrompts&&mf.default.createElement(s9t,{onClick:l}));let h=()=>n?`${n} ${d}`:d;return mf.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-1 tw-flex-col tw-overflow-hidden"},c&&p.showRelevantNotes&&mf.default.createElement(yde,{className:"tw-mb-4",onInsertToChat:u,defaultOpen:!1,key:"relevant-notes-in-chat"}),mf.default.createElement("div",{"data-testid":"chat-messages",className:"tw-mt-auto tw-box-border 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((b,g)=>b.isVisible&&mf.default.createElement(Gke,{key:g,message:b,app:o,isStreaming:!1,onRegenerate:()=>i(g),onEdit:y=>a(g,y),onDelete:()=>s(g),chatHistory:t})),(e||r)&&mf.default.createElement(Gke,{key:`ai_message_${e}`,message:{sender:"AI",message:e||h(),isVisible:!0,timestamp:null},app:o,isStreaming:!0,onDelete:()=>{},chatHistory:t})))});u9t.displayName="ChatMessages";var l9t=u9t;ti();Cn();var bde=F(X());function _de(t){let[e,r]=(0,bde.useState)(null);(0,bde.useEffect)(()=>{(async()=>{let i=await bVe();i.version&&r(i.version)})()},[]);let n=e!==null&&rJ(e,t);return{latestVersion:e,hasUpdate:n}}Tn();nr();Cn();yn();var ey=F(X());function c9t({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=_de(t),n=Rn().lastDismissedVersion,[o,i]=(0,ey.useState)(!0),a=r&&e&&rJ(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{dt("lastDismissedVersion",e)},300))};return a?ey.default.createElement("div",{className:_e("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")},ey.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"},ey.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ey.default.createElement("span",{className:"tw-font-medium"},"Update available:"),ey.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"tw-text-normal"},"v",e)),ey.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ey.default.createElement(ge,{size:"fit",variant:"ghost2",className:"tw-text-accent hover:tw-text-accent-hover",onClick:()=>{window.open("obsidian://show-plugin?id=copilot","_blank"),s()}},"Update"),ey.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:s},ey.default.createElement(Vi,{className:"tw-size-4"}))))):null}Cl();var d9t=require("obsidian");_g();var wz=class extends d9t.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=Zoe(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 I$e=require("obsidian");var b9=class extends pz{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 I$e.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 I$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)}}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n&&(o+=` (${n.toUpperCase()})`),o}};Cn();var f9t=require("obsidian"),Sz=class extends f9t.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)NR(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};var xz=F(X());Tn();var vde=F(X()),bEn=2;function _En(t,e){return e&&e>1?t.current?t.current.offsetHeight{let i=(0,vde.useRef)(null),[a,s]=(0,vde.useState)(!1);return xz.default.createElement(vo,{delayDuration:0},xz.default.createElement(Rt,{open:a,onOpenChange:l=>{s(l&&_En(i,r))}},xz.default.createElement(jt,{asChild:!0},xz.default.createElement("div",{...o,ref:i,className:_e("tw-max-w-full tw-text-normal",(!r||r<=1)&&"tw-truncate",r&&vEn(r),e),"data-testid":"truncatedText"},t)),xz.default.createElement(Mt,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},n??t)))};ti();var x9=F(X());yn();var w9t=F(X(),1),xt=F(X(),1),Ode=(0,xt.createContext)(null);Ode.displayName="PanelGroupContext";var vs={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"},F$e=10,oL=xt.useLayoutEffect,p9t=w9t.useId,wEn=typeof p9t=="function"?p9t:()=>null,SEn=0;function k$e(t=null){let e=wEn(),r=(0,xt.useRef)(t||e||null);return r.current===null&&(r.current=""+SEn++),t??r.current}function S9t({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:m="div",...h}){let b=(0,xt.useContext)(Ode);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:g,expandPanel:y,getPanelSize:S,getPanelStyle:x,groupId:O,isPanelCollapsed:P,reevaluatePanelConstraints:E,registerPanel:A,resizePanel:I,unregisterPanel:R}=b,N=k$e(a),j=(0,xt.useRef)({callbacks:{onCollapse:l,onExpand:c,onResize:d},constraints:{collapsedSize:r,collapsible:n,defaultSize:o,maxSize:s,minSize:u},id:N,idIsFromProps:a!==void 0,order:f});(0,xt.useRef)({didLogMissingDefaultSizeWarning:!1}),oL(()=>{let{callbacks:k,constraints:z}=j.current,V={...z};j.current.id=N,j.current.idIsFromProps=a!==void 0,j.current.order=f,k.onCollapse=l,k.onExpand=c,k.onResize=d,z.collapsedSize=r,z.collapsible=n,z.defaultSize=o,z.maxSize=s,z.minSize=u,(V.collapsedSize!==z.collapsedSize||V.collapsible!==z.collapsible||V.maxSize!==z.maxSize||V.minSize!==z.minSize)&&E(j.current,V)}),oL(()=>{let k=j.current;return A(k),()=>{R(k)}},[f,N,A,R]),(0,xt.useImperativeHandle)(i,()=>({collapse:()=>{g(j.current)},expand:k=>{y(j.current,k)},getId(){return N},getSize(){return S(j.current)},isCollapsed(){return P(j.current)},isExpanded(){return!P(j.current)},resize:k=>{I(j.current,k)}}),[g,y,S,P,N,I]);let $=x(j.current,o);return(0,xt.createElement)(m,{...h,children:t,className:e,id:N,style:{...$,...p},[vs.groupId]:O,[vs.panel]:"",[vs.panelCollapsible]:n||void 0,[vs.panelId]:N,[vs.panelSize]:parseFloat(""+$.flexGrow).toFixed(1)})}var $$e=(0,xt.forwardRef)((t,e)=>(0,xt.createElement)(S9t,{...t,forwardedRef:e}));S9t.displayName="Panel";$$e.displayName="forwardRef(Panel)";var xEn;function CEn(){return xEn}var L$e=null,OEn=!0,Sde=-1,fE=null;function PEn(t,e){if(e){let r=(e&E9t)!==0,n=(e&T9t)!==0,o=(e&A9t)!==0,i=(e&I9t)!==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 EEn(){fE!==null&&(document.head.removeChild(fE),L$e=null,fE=null,Sde=-1)}function M$e(t,e){var r,n;if(!OEn)return;let o=PEn(t,e);if(L$e!==o){if(L$e=o,fE===null){fE=document.createElement("style");let a=CEn();a&&fE.setAttribute("nonce",a),document.head.appendChild(fE)}if(Sde>=0){var i;(i=fE.sheet)===null||i===void 0||i.removeRule(Sde)}Sde=(r=(n=fE.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function x9t(t){return t.type==="keydown"}function C9t(t){return t.type.startsWith("pointer")}function O9t(t){return t.type.startsWith("mouse")}function Pde(t){if(C9t(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(O9t(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function TEn(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function AEn(t,e,r){return r?t.xe.x&&t.ye.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 IEn(t,e){if(t===e)throw new Error("Cannot compare node with itself");let r={a:g9t(t),b:g9t(e)},n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;mn(n,"Stacking order can only be calculated for elements with a common ancestor");let o={a:h9t(m9t(r.a)),b:h9t(m9t(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 MEn=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function REn(t){var e;let r=getComputedStyle((e=P9t(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function jEn(t){let e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||REn(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"||MEn.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function m9t(t){let e=t.length;for(;e--;){let r=t[e];if(mn(r,"Missing node"),jEn(r))return r}return null}function h9t(t){return t&&Number(getComputedStyle(t).zIndex)||0}function g9t(t){let e=[];for(;t;)e.push(t),t=P9t(t);return e}function P9t(t){let{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}var E9t=1,T9t=2,A9t=4,I9t=8,NEn=TEn()==="coarse",Ib=[],Ez=!1,AM=new Map,Ede=new Map,w9=new Set;function DEn(t,e,r,n,o){var i;let{ownerDocument:a}=e,s={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:o},u=(i=AM.get(a))!==null&&i!==void 0?i:0;return AM.set(a,u+1),w9.add(s),xde(),function(){var c;Ede.delete(t),w9.delete(s);let d=(c=AM.get(a))!==null&&c!==void 0?c:1;if(AM.set(a,d-1),xde(),d===1&&AM.delete(a),Ib.includes(s)){let f=Ib.indexOf(s);f>=0&&Ib.splice(f,1),q$e(),o("up",!0,null)}}}function LEn(t){let{target:e}=t,{x:r,y:n}=Pde(t);Ez=!0,B$e({target:e,x:r,y:n}),xde(),Ib.length>0&&(Cde("down",t),t.preventDefault(),M9t(e)||t.stopImmediatePropagation())}function R$e(t){let{x:e,y:r}=Pde(t);if(Ez&&t.buttons===0&&(Ez=!1,Cde("up",t)),!Ez){let{target:n}=t;B$e({target:n,x:e,y:r})}Cde("move",t),q$e(),Ib.length>0&&t.preventDefault()}function j$e(t){let{target:e}=t,{x:r,y:n}=Pde(t);Ede.clear(),Ez=!1,Ib.length>0&&(t.preventDefault(),M9t(e)||t.stopImmediatePropagation()),Cde("up",t),B$e({target:e,x:r,y:n}),q$e(),xde()}function M9t(t){let e=t;for(;e;){if(e.hasAttribute(vs.resizeHandle))return!0;e=e.parentElement}return!1}function B$e({target:t,x:e,y:r}){Ib.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),w9.forEach(o=>{let{element:i,hitAreaMargins:a}=o,s=i.getBoundingClientRect(),{bottom:u,left:l,right:c,top:d}=s,f=NEn?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)&&IEn(n,i)>0){let m=n,h=!1;for(;m&&!m.contains(i);){if(AEn(m.getBoundingClientRect(),s,!0)){h=!0;break}m=m.parentElement}if(h)return}Ib.push(o)}})}function N$e(t,e){Ede.set(t,e)}function q$e(){let t=!1,e=!1;Ib.forEach(n=>{let{direction:o}=n;o==="horizontal"?t=!0:e=!0});let r=0;Ede.forEach(n=>{r|=n}),t&&e?M$e("intersection",r):t?M$e("horizontal",r):e?M$e("vertical",r):EEn()}var D$e=new AbortController;function xde(){D$e.abort(),D$e=new AbortController;let t={capture:!0,signal:D$e.signal};w9.size&&(Ez?(Ib.length>0&&AM.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",j$e,t),n.addEventListener("pointerleave",R$e,t),n.addEventListener("pointermove",R$e,t))}),AM.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",j$e,t),n.addEventListener("pointercancel",j$e,t)})):AM.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",LEn,t),n.addEventListener("pointermove",R$e,t))}))}function Cde(t,e){w9.forEach(r=>{let{setResizeHandlerState:n}=r,o=Ib.includes(r);n(t,o,e)})}function FEn(){let[t,e]=(0,xt.useState)(0);return(0,xt.useCallback)(()=>e(r=>r+1),[])}function mn(t,e){if(!t)throw console.error(e),Error(e)}function iL(t,e,r=F$e){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function pE(t,e,r=F$e){return iL(t,e,r)===0}function ph(t,e,r){return iL(t,e,r)===0}function kEn(t,e,r){if(t.length!==e.length)return!1;for(let n=0;n0&&(t=t<0?0-g:g)}}}{let d=t<0?s:u,f=r[d];mn(f,`No panel constraints found for index ${d}`);let{collapsedSize:p=0,collapsible:m,minSize:h=0}=f;if(m){let b=e[d];if(mn(b!=null,`Previous layout not found for panel index ${d}`),ph(b,h)){let g=b-p;iL(g,Math.abs(t))>0&&(t=t<0?0-g:g)}}}}{let d=t<0?1:-1,f=t<0?u:s,p=0;for(;;){let h=e[f];mn(h!=null,`Previous layout not found for panel index ${f}`);let g=Pz({panelConstraints:r,panelIndex:f,size:100})-h;if(p+=g,f+=d,f<0||f>=r.length)break}let m=Math.min(Math.abs(t),Math.abs(p));t=t<0?0-m:m}{let f=t<0?s:u;for(;f>=0&&f=0))break;t<0?f--:f++}}if(kEn(o,a))return o;{let d=t<0?u:s,f=e[d];mn(f!=null,`Previous layout not found for panel index ${d}`);let p=f+l,m=Pz({panelConstraints:r,panelIndex:d,size:p});if(a[d]=m,!ph(m,p)){let h=p-m,g=t<0?u:s;for(;g>=0&&g0?g--:g++}}}let c=a.reduce((d,f)=>f+d,0);return ph(c,100)?a:o}function $En({layout:t,panelsArray:e,pivotIndices:r}){let n=0,o=100,i=0,a=0,s=r[0];mn(s!=null,"No pivot index found"),e.forEach((d,f)=>{let{constraints:p}=d,{maxSize:m=100,minSize:h=0}=p;f===s?(n=h,o=m):(i+=h,a+=m)});let u=Math.min(o,100-i),l=Math.max(n,100-a),c=t[s];return{valueMax:u,valueMin:l,valueNow:c}}function S9(t,e=document){return Array.from(e.querySelectorAll(`[${vs.resizeHandleId}][data-panel-group-id="${t}"]`))}function R9t(t,e,r=document){let o=S9(t,r).findIndex(i=>i.getAttribute(vs.resizeHandleId)===e);return o??null}function j9t(t,e,r){let n=R9t(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function BEn(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function N9t(t,e=document){if(BEn(e)&&e.dataset.panelGroupId==t)return e;let r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function Tde(t,e=document){let r=e.querySelector(`[${vs.resizeHandleId}="${t}"]`);return r||null}function qEn(t,e,r,n=document){var o,i,a,s;let u=Tde(e,n),l=S9(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 UEn({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:o,panelGroupElement:i,setLayout:a}){(0,xt.useRef)({didWarnAboutMissingResizeHandle:!1}),oL(()=>{if(!i)return;let s=S9(r,i);for(let u=0;u{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,xt.useEffect)(()=>{if(!i)return;let s=e.current;mn(s,"Eager values not found");let{panelDataArray:u}=s,l=N9t(r,i);mn(l!=null,`No group found for id "${r}"`);let c=S9(r,i);mn(c,`No resize handles found for group id "${r}"`);let d=c.map(f=>{let p=f.getAttribute(vs.resizeHandleId);mn(p,"Resize handle element has no handle id attribute");let[m,h]=qEn(r,p,u,i);if(m==null||h==null)return()=>{};let b=g=>{if(!g.defaultPrevented)switch(g.key){case"Enter":{g.preventDefault();let y=u.findIndex(S=>S.id===m);if(y>=0){let S=u[y];mn(S,`No panel data found for index ${y}`);let x=n[y],{collapsedSize:O=0,collapsible:P,minSize:E=0}=S.constraints;if(x!=null&&P){let A=_9({delta:ph(x,O)?E-O:O-x,initialLayout:n,panelConstraints:u.map(I=>I.constraints),pivotIndices:j9t(r,p,i),prevLayout:n,trigger:"keyboard"});n!==A&&a(A)}}break}}};return f.addEventListener("keydown",b),()=>{f.removeEventListener("keydown",b)}});return()=>{d.forEach(f=>f())}},[i,t,e,r,n,o,a])}function y9t(t,e){if(t.length!==e.length)return!1;for(let r=0;ri.constraints),n=0,o=100;for(let i=0;i{let i=t[o];mn(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:m}=a;m&&m(n,d),c&&(f||p)&&(p&&(d==null||pE(d,l))&&!pE(n,l)&&p(),f&&(d==null||!pE(d,l))&&pE(n,l)&&f())}})}function wde(t,e){if(t.length!==e.length)return!1;for(let r=0;r{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...o)},e)}}function b9t(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 L9t(t){return`react-resizable-panels:${t}`}function F9t(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 k9t(t,e){try{let r=L9t(t),n=e.getItem(r);if(n){let o=JSON.parse(n);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function GEn(t,e,r){var n,o;let i=(n=k9t(t,r))!==null&&n!==void 0?n:{},a=F9t(e);return(o=i[a])!==null&&o!==void 0?o:null}function JEn(t,e,r,n,o){var i;let a=L9t(t),s=F9t(e),u=(i=k9t(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 _9t({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(!ph(n,100)&&r.length>0)for(let i=0;i(b9t(v9),v9.getItem(t)),setItem:(t,e)=>{b9t(v9),v9.setItem(t,e)}},v9t={};function $9t({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:o,id:i=null,onLayout:a=null,keyboardResizeBy:s=null,storage:u=v9,style:l,tagName:c="div",...d}){let f=k$e(i),p=(0,xt.useRef)(null),[m,h]=(0,xt.useState)(null),[b,g]=(0,xt.useState)([]),y=FEn(),S=(0,xt.useRef)({}),x=(0,xt.useRef)(new Map),O=(0,xt.useRef)(0),P=(0,xt.useRef)({autoSaveId:t,direction:n,dragState:m,id:f,keyboardResizeBy:s,onLayout:a,storage:u}),E=(0,xt.useRef)({layout:b,panelDataArray:[],panelDataArrayChanged:!1});(0,xt.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,xt.useImperativeHandle)(o,()=>({getId:()=>P.current.id,getLayout:()=>{let{layout:H}=E.current;return H},setLayout:H=>{let{onLayout:ee}=P.current,{layout:U,panelDataArray:W}=E.current,Y=_9t({layout:H,panelConstraints:W.map(ae=>ae.constraints)});y9t(U,Y)||(g(Y),E.current.layout=Y,ee&&ee(Y),Cz(W,Y,S.current))}}),[]),oL(()=>{P.current.autoSaveId=t,P.current.direction=n,P.current.dragState=m,P.current.id=f,P.current.onLayout=a,P.current.storage=u}),UEn({committedValuesRef:P,eagerValuesRef:E,groupId:f,layout:b,panelDataArray:E.current.panelDataArray,setLayout:g,panelGroupElement:p.current}),(0,xt.useEffect)(()=>{let{panelDataArray:H}=E.current;if(t){if(b.length===0||b.length!==H.length)return;let ee=v9t[t];ee==null&&(ee=KEn(JEn,YEn),v9t[t]=ee);let U=[...H],W=new Map(x.current);ee(t,U,W,b,u)}},[t,b,u]),(0,xt.useEffect)(()=>{});let A=(0,xt.useCallback)(H=>{let{onLayout:ee}=P.current,{layout:U,panelDataArray:W}=E.current;if(H.constraints.collapsible){let Y=W.map(Be=>Be.constraints),{collapsedSize:ae=0,panelSize:Oe,pivotIndices:le}=nL(W,H,U);if(mn(Oe!=null,`Panel size not found for panel "${H.id}"`),!pE(Oe,ae)){x.current.set(H.id,Oe);let ze=Oz(W,H)===W.length-1?Oe-ae:ae-Oe,rt=_9({delta:ze,initialLayout:U,panelConstraints:Y,pivotIndices:le,prevLayout:U,trigger:"imperative-api"});wde(U,rt)||(g(rt),E.current.layout=rt,ee&&ee(rt),Cz(W,rt,S.current))}}},[]),I=(0,xt.useCallback)((H,ee)=>{let{onLayout:U}=P.current,{layout:W,panelDataArray:Y}=E.current;if(H.constraints.collapsible){let ae=Y.map(cr=>cr.constraints),{collapsedSize:Oe=0,panelSize:le=0,minSize:Be=0,pivotIndices:ze}=nL(Y,H,W),rt=ee??Be;if(pE(le,Oe)){let cr=x.current.get(H.id),wn=cr!=null&&cr>=rt?cr:rt,pt=Oz(Y,H)===Y.length-1?le-wn:wn-le,mt=_9({delta:pt,initialLayout:W,panelConstraints:ae,pivotIndices:ze,prevLayout:W,trigger:"imperative-api"});wde(W,mt)||(g(mt),E.current.layout=mt,U&&U(mt),Cz(Y,mt,S.current))}}},[]),R=(0,xt.useCallback)(H=>{let{layout:ee,panelDataArray:U}=E.current,{panelSize:W}=nL(U,H,ee);return mn(W!=null,`Panel size not found for panel "${H.id}"`),W},[]),N=(0,xt.useCallback)((H,ee)=>{let{panelDataArray:U}=E.current,W=Oz(U,H);return WEn({defaultSize:ee,dragState:m,layout:b,panelData:U,panelIndex:W})},[m,b]),j=(0,xt.useCallback)(H=>{let{layout:ee,panelDataArray:U}=E.current,{collapsedSize:W=0,collapsible:Y,panelSize:ae}=nL(U,H,ee);return mn(ae!=null,`Panel size not found for panel "${H.id}"`),Y===!0&&pE(ae,W)},[]),$=(0,xt.useCallback)(H=>{let{layout:ee,panelDataArray:U}=E.current,{collapsedSize:W=0,collapsible:Y,panelSize:ae}=nL(U,H,ee);return mn(ae!=null,`Panel size not found for panel "${H.id}"`),!Y||iL(ae,W)>0},[]),k=(0,xt.useCallback)(H=>{let{panelDataArray:ee}=E.current;ee.push(H),ee.sort((U,W)=>{let Y=U.order,ae=W.order;return Y==null&&ae==null?0:Y==null?-1:ae==null?1:Y-ae}),E.current.panelDataArrayChanged=!0,y()},[y]);oL(()=>{if(E.current.panelDataArrayChanged){E.current.panelDataArrayChanged=!1;let{autoSaveId:H,onLayout:ee,storage:U}=P.current,{layout:W,panelDataArray:Y}=E.current,ae=null;if(H){let le=GEn(H,Y,U);le&&(x.current=new Map(Object.entries(le.expandToSizes)),ae=le.layout)}ae==null&&(ae=VEn({panelDataArray:Y}));let Oe=_9t({layout:ae,panelConstraints:Y.map(le=>le.constraints)});y9t(W,Oe)||(g(Oe),E.current.layout=Oe,ee&&ee(Oe),Cz(Y,Oe,S.current))}}),oL(()=>{let H=E.current;return()=>{H.layout=[]}},[]);let z=(0,xt.useCallback)(H=>{let ee=!1,U=p.current;return U&&window.getComputedStyle(U,null).getPropertyValue("direction")==="rtl"&&(ee=!0),function(Y){Y.preventDefault();let ae=p.current;if(!ae)return()=>null;let{direction:Oe,dragState:le,id:Be,keyboardResizeBy:ze,onLayout:rt}=P.current,{layout:cr,panelDataArray:wn}=E.current,{initialLayout:Le}=le??{},pt=j9t(Be,H,ae),mt=HEn(Y,H,Oe,le,ze,ae),ht=Oe==="horizontal";ht&&ee&&(mt=-mt);let te=wn.map(Pe=>Pe.constraints),et=_9({delta:mt,initialLayout:Le??cr,panelConstraints:te,pivotIndices:pt,prevLayout:cr,trigger:x9t(Y)?"keyboard":"mouse-or-touch"}),Re=!wde(cr,et);(C9t(Y)||O9t(Y))&&O.current!=mt&&(O.current=mt,!Re&&mt!==0?ht?N$e(H,mt<0?E9t:T9t):N$e(H,mt<0?A9t:I9t):N$e(H,0)),Re&&(g(et),E.current.layout=et,rt&&rt(et),Cz(wn,et,S.current))}},[]),V=(0,xt.useCallback)((H,ee)=>{let{onLayout:U}=P.current,{layout:W,panelDataArray:Y}=E.current,ae=Y.map(cr=>cr.constraints),{panelSize:Oe,pivotIndices:le}=nL(Y,H,W);mn(Oe!=null,`Panel size not found for panel "${H.id}"`);let ze=Oz(Y,H)===Y.length-1?Oe-ee:ee-Oe,rt=_9({delta:ze,initialLayout:W,panelConstraints:ae,pivotIndices:le,prevLayout:W,trigger:"imperative-api"});wde(W,rt)||(g(rt),E.current.layout=rt,U&&U(rt),Cz(Y,rt,S.current))},[]),Q=(0,xt.useCallback)((H,ee)=>{let{layout:U,panelDataArray:W}=E.current,{collapsedSize:Y=0,collapsible:ae}=ee,{collapsedSize:Oe=0,collapsible:le,maxSize:Be=100,minSize:ze=0}=H.constraints,{panelSize:rt}=nL(W,H,U);rt!=null&&(ae&&le&&pE(rt,Y)?pE(Y,Oe)||V(H,Oe):rtBe&&V(H,Be))},[V]),J=(0,xt.useCallback)((H,ee)=>{let{direction:U}=P.current,{layout:W}=E.current;if(!p.current)return;let Y=Tde(H,p.current);mn(Y,`Drag handle element not found for id "${H}"`);let ae=D9t(U,ee);h({dragHandleId:H,dragHandleRect:Y.getBoundingClientRect(),initialCursorPosition:ae,initialLayout:W})},[]),D=(0,xt.useCallback)(()=>{h(null)},[]),B=(0,xt.useCallback)(H=>{let{panelDataArray:ee}=E.current,U=Oz(ee,H);U>=0&&(ee.splice(U,1),delete S.current[H.id],E.current.panelDataArrayChanged=!0,y())},[y]),q=(0,xt.useMemo)(()=>({collapsePanel:A,direction:n,dragState:m,expandPanel:I,getPanelSize:R,getPanelStyle:N,groupId:f,isPanelCollapsed:j,isPanelExpanded:$,reevaluatePanelConstraints:Q,registerPanel:k,registerResizeHandle:z,resizePanel:V,startDragging:J,stopDragging:D,unregisterPanel:B,panelGroupElement:p.current}),[A,m,n,I,R,N,f,j,$,Q,k,z,V,J,D,B]),K={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return(0,xt.createElement)(Ode.Provider,{value:q},(0,xt.createElement)(c,{...d,children:e,className:r,id:i,ref:p,style:{...K,...l},[vs.group]:"",[vs.groupDirection]:n,[vs.groupId]:f}))}var U$e=(0,xt.forwardRef)((t,e)=>(0,xt.createElement)($9t,{...t,forwardedRef:e}));$9t.displayName="PanelGroup";U$e.displayName="forwardRef(PanelGroup)";function Oz(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function nL(t,e,r){let n=Oz(t,e),i=n===t.length-1?[n-1,n]:[n,n+1],a=r[n];return{...e.constraints,panelSize:a,pivotIndices:i}}function ZEn({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){(0,xt.useEffect)(()=>{if(t||r==null||n==null)return;let o=Tde(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(vs.groupId);mn(s,`No group element found for id "${s}"`);let u=S9(s,n),l=R9t(s,e,n);mn(l!==null,`No resize element found for id "${e}"`);let c=a.shiftKey?l>0?l-1:u.length-1:l+1{o.removeEventListener("keydown",i)}},[n,t,e,r])}function z$e({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",...m}){var h,b;let g=(0,xt.useRef)(null),y=(0,xt.useRef)({onClick:a,onDragging:s,onPointerDown:l,onPointerUp:c});(0,xt.useEffect)(()=>{y.current.onClick=a,y.current.onDragging=s,y.current.onPointerDown=l,y.current.onPointerUp=c});let S=(0,xt.useContext)(Ode);if(S===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:x,groupId:O,registerResizeHandle:P,startDragging:E,stopDragging:A,panelGroupElement:I}=S,R=k$e(o),[N,j]=(0,xt.useState)("inactive"),[$,k]=(0,xt.useState)(!1),[z,V]=(0,xt.useState)(null),Q=(0,xt.useRef)({state:N});oL(()=>{Q.current.state=N}),(0,xt.useEffect)(()=>{if(r)V(null);else{let q=P(R);V(()=>q)}},[r,R,P]);let J=(h=n?.coarse)!==null&&h!==void 0?h:15,D=(b=n?.fine)!==null&&b!==void 0?b:5;return(0,xt.useEffect)(()=>{if(r||z==null)return;let q=g.current;mn(q,"Element ref not attached");let K=!1;return DEn(R,q,x,{coarse:J,fine:D},(ee,U,W)=>{if(!U){j("inactive");return}switch(ee){case"down":{j("drag"),K=!1,mn(W,'Expected event to be defined for "down" action'),E(R,W);let{onDragging:Y,onPointerDown:ae}=y.current;Y?.(!0),ae?.();break}case"move":{let{state:Y}=Q.current;K=!0,Y!=="drag"&&j("hover"),mn(W,'Expected event to be defined for "move" action'),z(W);break}case"up":{j("hover"),A();let{onClick:Y,onDragging:ae,onPointerUp:Oe}=y.current;ae?.(!1),Oe?.(),K||Y?.();break}}})},[J,x,r,D,P,R,z,E,A]),ZEn({disabled:r,handleId:R,resizeHandler:z,panelGroupElement:I}),(0,xt.createElement)(p,{...m,children:t,className:e,id:o,onBlur:()=>{k(!1),i?.()},onFocus:()=>{k(!0),u?.()},ref:g,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...d},tabIndex:f,[vs.groupDirection]:x,[vs.groupId]:O,[vs.resizeHandle]:"",[vs.resizeHandleActive]:N==="drag"?"pointer":$?"keyboard":void 0,[vs.resizeHandleEnabled]:!r,[vs.resizeHandleId]:R,[vs.resizeHandleState]:N})}z$e.displayName="PanelResizeHandle";Tn();var B9t=({className:t,...e})=>x9.createElement(U$e,{className:_e("tw-flex tw-size-full data-[panel-group-direction=vertical]:tw-flex-col",t),...e}),H$e=$$e,q9t=({withHandle:t,className:e,...r})=>x9.createElement(z$e,{className:_e("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&&x9.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"},x9.createElement(d_,{className:"tw-size-2.5"})));var rC=F(X());var er=F(X(),1);var U9t=F(X(),1),QEn=F(ds(),1);i1();var z9t=F(ft(),1),eTn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Tz=eTn.reduce((t,e)=>{let r=GC(`Primitive.${e}`),n=U9t.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,z9t.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var fm=F(X(),1);var V9t=F(X(),1);function H9t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function tTn(...t){return e=>{let r=!1,n=t.map(o=>{let i=H9t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{};var K9t=F(X(),1);function rTn(t,e){return K9t.useReducer((r,n)=>e[r][n]??r,t)}var Az=t=>{let{present:e,children:r}=t,n=nTn(e),o=typeof r=="function"?r({present:n.isPresent}):fm.Children.only(r),i=mE(n.ref,oTn(o));return typeof r=="function"||n.isPresent?fm.cloneElement(o,{ref:i}):null};Az.displayName="Presence";function nTn(t){let[e,r]=fm.useState(),n=fm.useRef(null),o=fm.useRef(t),i=fm.useRef("none"),a=t?"mounted":"unmounted",[s,u]=rTn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return fm.useEffect(()=>{let l=Ade(n.current);i.current=s==="mounted"?l:"none"},[s]),C9(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Ade(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),C9(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Ade(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let b=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},f=p=>{p.target===e&&(i.current=Ade(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:fm.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function Ade(t){return t?.animationName||"none"}function oTn(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 hE=F(X(),1),G9t=F(ft(),1);function J9t(t,e=[]){let r=[];function n(i,a){let s=hE.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=hE.useMemo(()=>m,Object.values(m));return(0,G9t.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=hE.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>hE.createContext(a));return function(s){let u=s?.[t]||i;return hE.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,iTn(o,...e)]}function iTn(...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 hE.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Iz=F(X(),1);function IM(t){let e=Iz.useRef(t);return Iz.useEffect(()=>{e.current=t}),Iz.useMemo(()=>(...r)=>e.current?.(...r),[])}var Ide=F(X(),1),aTn=F(ft(),1),sTn=Ide.createContext(void 0);function Y9t(t){let e=Ide.useContext(sTn);return t||e||"ltr"}function Z9t(t,[e,r]){return Math.min(r,Math.max(e,t))}function MM(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Q9t=F(X(),1),ci=F(ft(),1);function uTn(t,e){return Q9t.useReducer((r,n)=>e[r][n]??r,t)}var V$e="ScrollArea",[eKt,yhi]=J9t(V$e),[lTn,ty]=eKt(V$e),tKt=er.forwardRef((t,e)=>{let{__scopeScrollArea:r,type:n="hover",dir:o,scrollHideDelay:i=600,...a}=t,[s,u]=er.useState(null),[l,c]=er.useState(null),[d,f]=er.useState(null),[p,m]=er.useState(null),[h,b]=er.useState(null),[g,y]=er.useState(0),[S,x]=er.useState(0),[O,P]=er.useState(!1),[E,A]=er.useState(!1),I=mE(e,N=>u(N)),R=Y9t(o);return(0,ci.jsx)(lTn,{scope:r,type:n,dir:R,scrollHideDelay:i,scrollArea:s,viewport:l,onViewportChange:c,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:O,onScrollbarXEnabledChange:P,scrollbarY:h,onScrollbarYChange:b,scrollbarYEnabled:E,onScrollbarYEnabledChange:A,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,ci.jsx)(Tz.div,{dir:R,...a,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":S+"px",...t.style}})})});tKt.displayName=V$e;var rKt="ScrollAreaViewport",nKt=er.forwardRef((t,e)=>{let{__scopeScrollArea:r,children:n,nonce:o,...i}=t,a=ty(rKt,r),s=er.useRef(null),u=mE(e,s,a.onViewportChange);return(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.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,ci.jsx)(Tz.div,{"data-radix-scroll-area-viewport":"",...i,ref:u,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,ci.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});nKt.displayName=rKt;var tC="ScrollAreaScrollbar",jde=er.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=ty(tC,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,s=t.orientation==="horizontal";return er.useEffect(()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)}),[s,i,a]),o.type==="hover"?(0,ci.jsx)(cTn,{...n,ref:e,forceMount:r}):o.type==="scroll"?(0,ci.jsx)(dTn,{...n,ref:e,forceMount:r}):o.type==="auto"?(0,ci.jsx)(oKt,{...n,ref:e,forceMount:r}):o.type==="always"?(0,ci.jsx)(W$e,{...n,ref:e}):null});jde.displayName=tC;var cTn=er.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=ty(tC,t.__scopeScrollArea),[i,a]=er.useState(!1);return er.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,ci.jsx)(Az,{present:r||i,children:(0,ci.jsx)(oKt,{"data-state":i?"visible":"hidden",...n,ref:e})})}),dTn=er.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=ty(tC,t.__scopeScrollArea),i=t.orientation==="horizontal",a=Dde(()=>u("SCROLL_END"),100),[s,u]=uTn("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 er.useEffect(()=>{if(s==="idle"){let l=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(l)}},[s,o.scrollHideDelay,u]),er.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,ci.jsx)(Az,{present:r||s!=="hidden",children:(0,ci.jsx)(W$e,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:MM(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:MM(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),oKt=er.forwardRef((t,e)=>{let r=ty(tC,t.__scopeScrollArea),{forceMount:n,...o}=t,[i,a]=er.useState(!1),s=t.orientation==="horizontal",u=Dde(()=>{if(r.viewport){let l=r.viewport.offsetWidth{let{orientation:r="vertical",...n}=t,o=ty(tC,t.__scopeScrollArea),i=er.useRef(null),a=er.useRef(0),[s,u]=er.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=uKt(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 yTn(f,a.current,s,p)}return r==="horizontal"?(0,ci.jsx)(fTn,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollLeft,p=X9t(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,ci.jsx)(pTn,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollTop,p=X9t(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}),fTn=er.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=ty(tC,t.__scopeScrollArea),[a,s]=er.useState(),u=er.useRef(null),l=mE(e,u,i.onScrollbarXChange);return er.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,ci.jsx)(aKt,{"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":Nde(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),cKt(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:Rde(a.paddingLeft),paddingEnd:Rde(a.paddingRight)}})}})}),pTn=er.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=ty(tC,t.__scopeScrollArea),[a,s]=er.useState(),u=er.useRef(null),l=mE(e,u,i.onScrollbarYChange);return er.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,ci.jsx)(aKt,{"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":Nde(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),cKt(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:Rde(a.paddingTop),paddingEnd:Rde(a.paddingBottom)}})}})}),[mTn,iKt]=eKt(tC),aKt=er.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=ty(tC,r),[m,h]=er.useState(null),b=mE(e,I=>h(I)),g=er.useRef(null),y=er.useRef(""),S=p.viewport,x=n.content-n.viewport,O=IM(c),P=IM(u),E=Dde(d,10);function A(I){if(g.current){let R=I.clientX-g.current.left,N=I.clientY-g.current.top;l({x:R,y:N})}}return er.useEffect(()=>{let I=R=>{let N=R.target;m?.contains(N)&&O(R,x)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[S,m,x,O]),er.useEffect(P,[n,P]),Mz(m,E),Mz(p.content,E),(0,ci.jsx)(mTn,{scope:r,scrollbar:m,hasThumb:o,onThumbChange:IM(i),onThumbPointerUp:IM(a),onThumbPositionChange:P,onThumbPointerDown:IM(s),children:(0,ci.jsx)(Tz.div,{...f,ref:b,style:{position:"absolute",...f.style},onPointerDown:MM(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),g.current=m.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),A(I))}),onPointerMove:MM(t.onPointerMove,A),onPointerUp:MM(t.onPointerUp,I=>{let R=I.target;R.hasPointerCapture(I.pointerId)&&R.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=y.current,p.viewport&&(p.viewport.style.scrollBehavior=""),g.current=null})})})}),Mde="ScrollAreaThumb",K$e=er.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=iKt(Mde,t.__scopeScrollArea);return(0,ci.jsx)(Az,{present:r||o.hasThumb,children:(0,ci.jsx)(hTn,{ref:e,...n})})}),hTn=er.forwardRef((t,e)=>{let{__scopeScrollArea:r,style:n,...o}=t,i=ty(Mde,r),a=iKt(Mde,r),{onThumbPositionChange:s}=a,u=mE(e,d=>a.onThumbChange(d)),l=er.useRef(void 0),c=Dde(()=>{l.current&&(l.current(),l.current=void 0)},100);return er.useEffect(()=>{let d=i.viewport;if(d){let f=()=>{if(c(),!l.current){let p=bTn(d,s);l.current=p,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),(0,ci.jsx)(Tz.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:MM(t.onPointerDownCapture,d=>{let p=d.target.getBoundingClientRect(),m=d.clientX-p.left,h=d.clientY-p.top;a.onThumbPointerDown({x:m,y:h})}),onPointerUp:MM(t.onPointerUp,a.onThumbPointerUp)})});K$e.displayName=Mde;var G$e="ScrollAreaCorner",sKt=er.forwardRef((t,e)=>{let r=ty(G$e,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?(0,ci.jsx)(gTn,{...t,ref:e}):null});sKt.displayName=G$e;var gTn=er.forwardRef((t,e)=>{let{__scopeScrollArea:r,...n}=t,o=ty(G$e,r),[i,a]=er.useState(0),[s,u]=er.useState(0),l=!!(i&&s);return Mz(o.scrollbarX,()=>{let c=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(c),u(c)}),Mz(o.scrollbarY,()=>{let c=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(c),a(c)}),l?(0,ci.jsx)(Tz.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 Rde(t){return t?parseInt(t,10):0}function uKt(t,e){let r=t/e;return isNaN(r)?0:r}function Nde(t){let e=uKt(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function yTn(t,e,r,n="ltr"){let o=Nde(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 lKt([u,l],d)(t)}function X9t(t,e,r="ltr"){let n=Nde(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=Z9t(t,u);return lKt([0,a],[0,s])(l)}function lKt(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 cKt(t,e){return t>0&&t{})=>{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 Dde(t,e){let r=IM(t),n=er.useRef(0);return er.useEffect(()=>()=>window.clearTimeout(n.current),[]),er.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function Mz(t,e){let r=IM(e);C9(()=>{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 J$e=tKt,dKt=nKt;var fKt=sKt;Tn();var Lde=rC.forwardRef(({className:t,children:e,...r},n)=>rC.createElement(J$e,{ref:n,className:_e("tw-relative tw-overflow-hidden",t),...r},rC.createElement(dKt,{className:"tw-size-full tw-rounded-[inherit] [&>div:first-child]:!tw-block"},e),rC.createElement(pKt,null),rC.createElement(fKt,null)));Lde.displayName=J$e.displayName;var pKt=rC.forwardRef(({className:t,orientation:e="vertical",...r},n)=>rC.createElement(jde,{ref:n,orientation:e,className:_e("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},rC.createElement(K$e,{className:"tw-relative tw-flex-1 tw-rounded-full tw-bg-[var(--background-modifier-border)]"})));pKt.displayName=jde.displayName;var Rz=F(X());var Fde=F(X());Tn();var mo=Fde.forwardRef(({className:t,type:e,...r},n)=>Fde.createElement("input",{type:e,className:_e("!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}));mo.displayName="Input";ti();yn();var kde=({value:t,onChange:e,placeholder:r="Search..."})=>Rz.default.createElement("div",{className:"tw-relative"},Rz.default.createElement(mo,{type:"text",placeholder:r,value:t,onChange:n=>e(n.target.value),className:"tw-pr-10"}),t&&Rz.default.createElement(ge,{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"},Rz.default.createElement(_T,{className:"tw-size-4 tw-text-muted/60 hover:tw-text-accent-hover"})),Rz.default.createElement(c1,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-text-muted"}));var $de=F(X());var bKt=F(X(),1);var mKt=F(X(),1),vTn=F(ds(),1);i1();var hKt=F(ft(),1),wTn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],gKt=wTn.reduce((t,e)=>{let r=GC(`Primitive.${e}`),n=mKt.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,hKt.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var _Kt=F(ft(),1),STn="Separator",yKt="horizontal",xTn=["horizontal","vertical"],vKt=bKt.forwardRef((t,e)=>{let{decorative:r,orientation:n=yKt,...o}=t,i=CTn(n)?n:yKt,s=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return(0,_Kt.jsx)(gKt.div,{"data-orientation":i,...s,...o,ref:e})});vKt.displayName=STn;function CTn(t){return xTn.includes(t)}var Y$e=vKt;Tn();var O9=$de.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},o)=>$de.createElement(Y$e,{ref:o,decorative:r,orientation:e,className:_e("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}));O9.displayName=Y$e.displayName;Tn();_g();Cn();yn();var qde=require("obsidian"),je=F(X()),SKt=F(Dc());function PTn({extension:t,size:e="tw-size-4"}){let r=t.toLowerCase().replace("*.","");return["jpg","jpeg","png","gif","svg"].includes(r)?je.default.createElement(_3,{className:`tw-text-context-manager-blue ${e}`}):["mp3","wav","ogg"].includes(r)?je.default.createElement(b3,{className:`tw-text-context-manager-purple ${e}`}):["mp4","mov","avi"].includes(r)?je.default.createElement(S3,{className:`tw-text-context-manager-orange ${e}`}):["md","txt","mdx","markdown"].includes(r)?je.default.createElement(Ay,{className:`${e}`}):je.default.createElement(Ay,{className:`tw-text-faint ${e}`})}var Z$e=({IconComponent:t,title:e,iconColorClassName:r,onAddClick:n,tooltip:o})=>je.default.createElement("div",{className:"tw-mb-3 tw-flex tw-items-center tw-justify-between"},je.default.createElement("div",{className:"tw-flex tw-items-center"},je.default.createElement(t,{className:`tw-mr-2 tw-size-4 ${r}`}),je.default.createElement("h3",{className:`tw-text-sm tw-font-semibold ${r}`},e),o&&je.default.createElement(vo,{delayDuration:0},je.default.createElement(Rt,null,je.default.createElement(jt,{asChild:!0},je.default.createElement(di,{className:"tw-ml-2 tw-size-4 tw-text-muted"})),je.default.createElement(Mt,null,je.default.createElement("div",{className:"tw-max-w-80"},o))))),je.default.createElement(ge,{variant:"ghost",size:"fit",className:"tw-text-muted hover:tw-bg-secondary",title:`Add new ${e.toLowerCase()}`,onClick:n},je.default.createElement(Am,{className:`tw-size-4 ${r}`}))),wKt=({title:t,IconComponent:e,iconColorClassName:r,items:n,activeItem:o,activeSection:i,sectionType:a,renderIcon:s,onItemClick:u,onAddClick:l,onDeleteItem:c,tooltip:d})=>je.default.createElement("div",null,je.default.createElement(Z$e,{IconComponent:e,title:t,iconColorClassName:r,onAddClick:l,tooltip:d}),je.default.createElement("div",{className:"tw-space-y-1"},n.map(f=>je.default.createElement("div",{key:f.id,className:_e("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)},je.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center"},s?s(f):je.default.createElement(e,{className:`tw-mr-2 tw-size-4 ${r}`}),je.default.createElement(TM,{className:"tw-flex-1 tw-text-sm"},f.name)),je.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},je.default.createElement("span",{className:"tw-text-xs tw-text-muted group-hover:tw-hidden"},f.count||0),je.default.createElement(Vi,{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 ETn({item:t,viewMode:e,onDelete:r}){let n=t.id.split(".").pop()||"",o=t.isIgnored?Mm:Vi;return je.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"},je.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},je.default.createElement(PTn,{extension:n,size:"tw-size-8"})),je.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},je.default.createElement(TM,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.isIgnored&&je.default.createElement("span",{className:"tw-text-sm tw-text-error"}," (Ignored files)"),t.name),t.id&&je.default.createElement(TM,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.id)),je.default.createElement("div",{className:"tw-ml-auto tw-flex tw-min-w-[24px] tw-items-center tw-justify-end tw-gap-2"},je.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 TTn({initialProject:t,onSave:e,onCancel:r,app:n}){let{inclusions:o,exclusions:i}=(0,je.useMemo)(()=>rf({inclusions:t?.contextSource.inclusions,exclusions:t?.contextSource.exclusions,isProject:!0}),[t.contextSource]),a=(0,je.useMemo)(()=>n.vault.getFiles(),[n.vault]),s=(0,je.useCallback)((B,q,K)=>{let H=B.filter(Oe=>eu(Oe,q,K)),ee=(Oe,le,Be,ze)=>{le&&le.forEach(rt=>{let cr={[Be]:[rt]};eu(Oe,cr,null)&&!ze[rt].some(wn=>wn.id===Oe.path)&&ze[rt].push({id:Oe.path,name:Oe.basename})})},U={},W={},Y={},ae=[];return(q?.tagPatterns??[]).forEach(Oe=>{U[Oe]=[]}),(q?.folderPatterns??[]).forEach(Oe=>{W[Oe]=[]}),(q?.extensionPatterns??[]).forEach(Oe=>{Y[Oe]=[]}),H.forEach(Oe=>{ee(Oe,q?.tagPatterns,"tagPatterns",U),ee(Oe,q?.folderPatterns,"folderPatterns",W),ee(Oe,q?.extensionPatterns,"extensionPatterns",Y),q?.notePatterns&&eu(Oe,{notePatterns:q.notePatterns},null)&&!ae.some(le=>le.id===Oe.path)&&ae.push({id:Oe.path,name:Oe.basename})}),{tags:U,folders:W,extensions:Y,notes:ae}},[]),[u,l]=(0,je.useState)(()=>s(a,o,i)),[c,d]=(0,je.useState)(()=>{let B=a.filter(q=>i&&eu(q,i,null));return{files:new Set(B)}}),f=(0,je.useRef)(u),p=(0,je.useRef)(c),[m,h]=(0,je.useState)(""),[b,g]=(0,je.useState)(null),[y,S]=(0,je.useState)(null),x=(0,je.useCallback)((B,q)=>{let K=Object.keys(B.tags),H=Object.keys(B.folders),ee=Object.keys(B.extensions),U=B.notes.map(W=>{let Y=q.find(ae=>ae.path===W.id);if(Y)return B8(Y)}).filter(Boolean);return $8({tagPatterns:K,folderPatterns:H,extensionPatterns:ee,notePatterns:U})},[]),O=(0,je.useCallback)(B=>{let q=new Array(...B.files).map(K=>B8(K));return $8({notePatterns:q})||""},[]);(0,je.useEffect)(()=>{f.current=u,p.current=c},[u,c]);let P=(0,je.useMemo)(()=>{let B=[],q=(H,ee)=>{ee.forEach(U=>{H.some(W=>W.id===U.id)||H.push({id:U.id,name:U.name})})};return[u.tags,u.folders,u.extensions,{notes:u.notes}].forEach(H=>{Object.values(H).forEach(ee=>{q(B,ee)})}),B},[u]),E=(0,je.useCallback)(B=>{let q=[],K=[],H=[];return B.split(",").map(U=>U.trim()).filter(U=>U).forEach(U=>{U.startsWith("#")?q.push(U.substring(1)):U.startsWith(".")||U.startsWith("*.")?H.push(U.replace("*","")):K.push(U)}),{tags:q,titles:K,extensions:H}},[]),A=(0,je.useMemo)(()=>{if(m){let B=E(m);return P.filter(q=>{let K=a.find(ae=>ae.path===q.id);if(!K)return!1;let H=K.extension==="md",ee=B.tags.length>0&&H&&B.tags.some(ae=>NR(K).some(le=>(le.startsWith("#")?le.substring(1):le).toLowerCase().includes(ae.toLowerCase()))),U=B.titles.length>0&&B.titles.some(ae=>K.basename.toLowerCase().includes(ae.toLowerCase())),W=B.extensions.length>0&&B.extensions.some(ae=>`.${K.extension}`.toLowerCase()===ae.toLowerCase());return B.tags.length>0||B.titles.length>0||B.extensions.length>0?ee||U||W:!1}).map(q=>({id:q.id,name:q.name}))}if(b==="tags"&&y){let B=u.tags[y];return B||[]}if(b==="folders"&&y){let B=u.folders[y];return B||[]}if(b==="files")return u.notes;if(b==="extensions"&&y){let B=u.extensions[y];return B||[]}return b==="ignoreFiles"?Array.from(c.files).map(B=>({id:B.path,name:B.basename})):[]},[m,b,y,E,P,a,u.tags,u.folders,u.notes,u.extensions,c.files]),I=(0,je.useCallback)(B=>[...B].sort((q,K)=>q.name.toLowerCase().localeCompare(K.name.toLowerCase())),[]),R=(0,je.useCallback)((B,q)=>Object.entries(B).sort(([K],[H])=>K.localeCompare(H)).map(([K,H])=>({id:K,name:q?q(K):K,count:H.length})),[]),N=(0,je.useCallback)((B,q,K)=>{let H=W=>a.filter(Y=>eu(Y,W,null)).map(Y=>({id:Y.path,name:Y.basename})),ee=[...p.current.files],U=H(K).map(W=>({...W,isIgnored:ee.some(Y=>Y.path===W.id)}));l(W=>({...W,[B]:{...W[B],[q]:U}}))},[a]),j=(0,je.useCallback)((B,q)=>{let K={tags:{...B.tags},folders:{...B.folders},extensions:{...B.extensions},notes:[...B.notes]},H=ee=>{Object.keys(ee).forEach(U=>{ee[U]=ee[U].filter(W=>W.id!==q)})};return H(K.tags),H(K.folders),H(K.extensions),K.notes=K.notes.filter(ee=>ee.id!==q),K},[]),$=(0,je.useCallback)((B,q=null,K=!0)=>{g(B),S(q),K&&h("")},[]),k=(0,je.useMemo)(()=>{let B=q=>(K,H)=>{K.stopPropagation(),l(ee=>{let U={...ee[q]};return delete U[H.id],{...ee,[q]:U}})};return{delete:{tag:B("tags"),folder:B("folders"),extension:B("extensions")},add:{tag:()=>{new Sz(n,q=>{let K=Xoe(q);N("tags",K,{tagPatterns:[K]})}).open()},folder:()=>{new wz(n,q=>{N("folders",q,{folderPatterns:[q]})}).open()},file:()=>{new b9({app:n,onFileSelect:q=>{u.notes.find(H=>H.id===q.path)||(d(H=>{let ee=new Set(H.files);return ee.delete(q),{...H,files:ee}}),l(H=>({...H,notes:[...H.notes,{id:q.path,name:q.basename}]})))},excludeFilePaths:[],titleOnly:!1}).open()},extension:()=>{new qde.Notice("Adding extension is temporarily not supported.")},ignoreFile:()=>{new b9({app:n,onFileSelect:q=>{c.files.has(q)||(d(H=>{let ee=new Set(H.files);return ee.add(q),{...H,files:ee}}),l(H=>j(H,q.path)))},excludeFilePaths:[],titleOnly:!1}).open()}},click:{tag:q=>{$("tags",q)},folder:q=>{$("folders",q)},extension:q=>{$("extensions",q)},files:()=>{$("files")},ignoreFiles:()=>{$("ignoreFiles")}}}},[n,u.notes,c.files,N,j,$]),z=()=>m?`Search Results for: "${m}"`:b==="tags"&&y?`Tag: ${y}`:b==="folders"&&y?`Folder: ${y}`:b==="files"?"Files":b==="extensions"&&y?`Extension: ${y}`:b==="ignoreFiles"?"Ignore Files":"Select a category to view items",V=(B,q)=>{B.stopPropagation();let K=a.find(H=>H.path===q.id);K&&(d(H=>{let ee=new Set(H.files);return ee.add(K),{...H,files:ee}}),l(H=>j(H,q.id)))},Q=(0,je.useCallback)(()=>{let B=x(f.current,a),q=O(p.current),{inclusions:K,exclusions:H}=rf({inclusions:B,exclusions:q,isProject:!0}),ee=s(a,K,H);l(ee)},[a,O,x,s]),J=(B,q)=>{B.stopPropagation();let K=a.find(H=>H.path===q.id);K&&(d(H=>{let ee=new Set(H.files);return ee.delete(K),{...H,files:ee}}),Q())},D=()=>{let B=x(u,a),q=O(c);e({...t,contextSource:{...t.contextSource,inclusions:B,exclusions:q}})};return je.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},je.default.createElement(B9t,{direction:"horizontal",className:"tw-flex-1"},je.default.createElement(H$e,{defaultSize:30,minSize:20,maxSize:40},je.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},je.default.createElement("div",{className:"tw-border-b tw-p-4"},je.default.createElement("h2",{className:"tw-text-lg tw-font-semibold"},"File Context")),je.default.createElement(Lde,{className:"tw-max-h-[500px] tw-flex-1"},je.default.createElement("div",{className:"tw-space-y-6 tw-p-4"},je.default.createElement(wKt,{title:"Tags",IconComponent:d1,iconColorClassName:"tw-text-context-manager-orange",items:R(u.tags,B=>B.slice(1)),activeItem:y,activeSection:b,sectionType:"tags",renderIcon:B=>je.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),onItemClick:k.click.tag,onAddClick:k.add.tag,onDeleteItem:(B,q)=>k.delete.tag(B,q),tooltip:"must be in note property"}),je.default.createElement(O9,null),je.default.createElement(wKt,{title:"Folders",IconComponent:Iy,iconColorClassName:"tw-text-context-manager-yellow",items:R(u.folders),activeItem:y,activeSection:b,sectionType:"folders",onItemClick:k.click.folder,onAddClick:k.add.folder,onDeleteItem:(B,q)=>k.delete.folder(B,q)}),je.default.createElement(O9,null),je.default.createElement("div",null,je.default.createElement(Z$e,{IconComponent:Ay,title:"Files",iconColorClassName:"tw-text-context-manager-blue",onAddClick:k.add.file}),je.default.createElement("div",{className:_e("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",b==="files"&&"tw-bg-secondary tw-text-normal"),onClick:k.click.files},"Files (",u.notes.length,")")),je.default.createElement(O9,null),je.default.createElement("div",null,je.default.createElement(Z$e,{IconComponent:Vi,title:"Ignore Files",iconColorClassName:"tw-text-context-manager-red",onAddClick:k.add.ignoreFile}),je.default.createElement("div",{className:_e("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",b==="ignoreFiles"&&"tw-bg-secondary tw-text-normal"),onClick:k.click.ignoreFiles},"Ignore Files (",c.files.size,")")))))),je.default.createElement(q9t,{withHandle:!0}),je.default.createElement(H$e,{defaultSize:70},je.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},je.default.createElement("div",{className:"tw-border-b tw-p-4"},je.default.createElement(kde,{placeholder:"Custom search: title, #tag1, .jpg",value:m,onChange:B=>{h(B),B&&$("search",null,!1)}})),je.default.createElement("div",{className:"tw-p-4"},je.default.createElement("h3",{className:"tw-text-lg tw-font-medium tw-text-muted"},z())),je.default.createElement(Lde,{className:"tw-max-h-[400px] tw-flex-1 tw-p-4 tw-pt-0"},A.length===0?je.default.createElement("div",{className:"tw-mt-10 tw-text-center tw-text-muted"},b?"No items found.":"Select a category from the sidebar to view items."):je.default.createElement("div",{className:"tw-space-y-2",style:{display:"block"}},I(A).map(B=>je.default.createElement(ETn,{key:B.id,item:B,viewMode:"list",onDelete:b==="ignoreFiles"||B.isIgnored?J:V}))))))),je.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2 tw-border-t tw-p-1"},je.default.createElement(ge,{variant:"ghost",onClick:r},"Cancel"),je.default.createElement(ge,{onClick:D},"Save")))}var Bde=class extends qde.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r,modalEl:n}=this;this.root=(0,SKt.createRoot)(r),n.style.minWidth="50vw";let o=a=>{this.onSave(a),this.close()},i=()=>{this.close()};this.root.render(je.default.createElement(TTn,{initialProject:this.initialProject,onSave:o,onCancel:i,app:this.app}))}onClose(){this.root&&this.root.unmount()}};ti();var Nz=F(X());var Ude=F(X());var TKt=F(X(),1);var CKt=F(X(),1),OKt=F(ds(),1);var yd=F(X(),1);var xKt=F(X(),1);function ATn(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function aL(...t){return e=>t.forEach(r=>ATn(r,e))}function Ri(...t){return xKt.useCallback(aL(...t),t)}var jz=F(ft(),1),Q$e=yd.forwardRef((t,e)=>{let{children:r,...n}=t,o=yd.Children.toArray(r),i=o.find(MTn);if(i){let a=i.props.children,s=o.map(u=>u===i?yd.Children.count(a)>1?yd.Children.only(null):yd.isValidElement(a)?a.props.children:null:u);return(0,jz.jsx)(X$e,{...n,ref:e,children:yd.isValidElement(a)?yd.cloneElement(a,void 0,s):null})}return(0,jz.jsx)(X$e,{...n,ref:e,children:r})});Q$e.displayName="Slot";var X$e=yd.forwardRef((t,e)=>{let{children:r,...n}=t;if(yd.isValidElement(r)){let o=jTn(r);return yd.cloneElement(r,{...RTn(n,r.props),ref:e?aL(e,o):o})}return yd.Children.count(r)>1?yd.Children.only(null):null});X$e.displayName="SlotClone";var ITn=({children:t})=>(0,jz.jsx)(jz.Fragment,{children:t});function MTn(t){return yd.isValidElement(t)&&t.type===ITn}function RTn(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 jTn(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 PKt=F(ft(),1),NTn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ho=NTn.reduce((t,e)=>{let r=CKt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Q$e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,PKt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function EKt(t,e){t&&OKt.flushSync(()=>t.dispatchEvent(e))}var AKt=F(ft(),1),DTn="Label",IKt=TKt.forwardRef((t,e)=>(0,AKt.jsx)(ho.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));IKt.displayName=DTn;var eBe=IKt;F7();Tn();var FTn=QF("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),ip=Ude.forwardRef(({className:t,...e},r)=>Ude.createElement(eBe,{ref:r,className:_e(FTn(),t),...e}));ip.displayName=eBe.displayName;var Yn=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>Nz.default.createElement("div",{className:"tw-space-y-2"},Nz.default.createElement(ip,{className:r?"tw-text-error":""},t," ",e&&Nz.default.createElement("span",{className:"tw-text-error"},"*")),n&&Nz.default.createElement("p",{className:"tw-text-sm tw-text-muted"},n),i,r&&Nz.default.createElement("p",{className:"tw-text-xs tw-text-error"},o));var sL=F(X());Tn();yn();function zde({options:t,placeholder:e,containerClassName:r,className:n,...o}){return sL.default.createElement("div",{className:_e("tw-group tw-relative tw-w-full",r)},sL.default.createElement("select",{className:_e("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&&sL.default.createElement("option",{value:"",disabled:!0},e),t.map(i=>sL.default.createElement("option",{key:i.value,value:i.value},i.label))),sL.default.createElement("div",{className:_e("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")},sL.default.createElement(Hi,{className:"tw-size-4"})))}var jM=F(X());Tn();var uL=F(X());var Bi=F(X(),1);function Dz(t,[e,r]){return Math.min(r,Math.max(e,t))}function xi(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Hde=F(X(),1);function Lz(t){let e=Hde.useRef({value:t,previous:t});return Hde.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var RM=F(X(),1);var gE=F(X(),1),MKt=F(ft(),1);function RKt(t,e=[]){let r=[];function n(i,a){let s=gE.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,b=gE.useMemo(()=>m,Object.values(m));return(0,MKt.jsx)(h.Provider,{value:b,children:p})}function c(d,f){let p=f?.[t][u]||s,m=gE.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>gE.createContext(a));return function(s){let u=s?.[t]||i;return gE.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,kTn(o,...e)]}function kTn(...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 gE.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var bd=F(X(),1);var Fz=F(ft(),1),Vde=bd.forwardRef((t,e)=>{let{children:r,...n}=t,o=bd.Children.toArray(r),i=o.find(BTn);if(i){let a=i.props.children,s=o.map(u=>u===i?bd.Children.count(a)>1?bd.Children.only(null):bd.isValidElement(a)?a.props.children:null:u);return(0,Fz.jsx)(tBe,{...n,ref:e,children:bd.isValidElement(a)?bd.cloneElement(a,void 0,s):null})}return(0,Fz.jsx)(tBe,{...n,ref:e,children:r})});Vde.displayName="Slot";var tBe=bd.forwardRef((t,e)=>{let{children:r,...n}=t;if(bd.isValidElement(r)){let o=UTn(r);return bd.cloneElement(r,{...qTn(n,r.props),ref:e?aL(e,o):o})}return bd.Children.count(r)>1?bd.Children.only(null):null});tBe.displayName="SlotClone";var $Tn=({children:t})=>(0,Fz.jsx)(Fz.Fragment,{children:t});function BTn(t){return bd.isValidElement(t)&&t.type===$Tn}function qTn(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 UTn(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 Wde=F(ft(),1);function Kde(t){let e=t+"CollectionProvider",[r,n]=RKt(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=RM.default.useRef(null),g=RM.default.useRef(new Map).current;return(0,Wde.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=RM.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),y=Ri(m,g.collectionRef);return(0,Wde.jsx)(Vde,{ref:y,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=RM.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,y=RM.default.useRef(null),S=Ri(m,y),x=i(l,h);return RM.default.useEffect(()=>(x.itemMap.set(y,{ref:y,...g}),()=>void x.itemMap.delete(y))),(0,Wde.jsx)(Vde,{[c]:"",ref:S,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return RM.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,O)=>g.indexOf(x.ref.current)-g.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Bl=F(ft(),1),jKt=["PageUp","PageDown"],NKt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],DKt={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},kz="Slider",[rBe,zTn,HTn]=Kde(kz),[LKt,Igi]=Yi(kz,[HTn]),[VTn,Gde]=LKt(kz),FKt=Bi.forwardRef((t,e)=>{let{name:r,min:n=0,max:o=100,step:i=1,orientation:a="horizontal",disabled:s=!1,minStepsBetweenThumbs:u=0,defaultValue:l=[n],value:c,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:m,...h}=t,b=Bi.useRef(new Set),g=Bi.useRef(0),S=a==="horizontal"?WTn:KTn,[x=[],O]=ud({prop:c,defaultProp:l,onChange:N=>{[...b.current][g.current]?.focus(),d(N)}}),P=Bi.useRef(x);function E(N){let j=XTn(x,N);R(N,j)}function A(N){R(N,g.current)}function I(){let N=P.current[g.current];x[g.current]!==N&&f(x)}function R(N,j,{commit:$}={commit:!1}){let k=rAn(i),z=nAn(Math.round((N-n)/i)*i+n,k),V=Dz(z,[n,o]);O((Q=[])=>{let J=YTn(Q,V,j);if(tAn(J,u*i)){g.current=J.indexOf(V);let D=String(J)!==String(Q);return D&&$&&f(J),D?J:Q}else return Q})}return(0,Bl.jsx)(VTn,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:b.current,values:x,orientation:a,form:m,children:(0,Bl.jsx)(rBe.Provider,{scope:t.__scopeSlider,children:(0,Bl.jsx)(rBe.Slot,{scope:t.__scopeSlider,children:(0,Bl.jsx)(S,{"aria-disabled":s,"data-disabled":s?"":void 0,...h,ref:e,onPointerDown:xi(h.onPointerDown,()=>{s||(P.current=x)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:E,onSlideMove:s?void 0:A,onSlideEnd:s?void 0:I,onHomeKeyDown:()=>!s&&R(n,0,{commit:!0}),onEndKeyDown:()=>!s&&R(o,x.length-1,{commit:!0}),onStepKeyDown:({event:N,direction:j})=>{if(!s){let z=jKt.includes(N.key)||N.shiftKey&&NKt.includes(N.key)?10:1,V=g.current,Q=x[V],J=i*z*j;R(Q+J,V,{commit:!0})}}})})})})});FKt.displayName=kz;var[kKt,$Kt]=LKt(kz,{startEdge:"left",endEdge:"right",size:"width",direction:1}),WTn=Bi.forwardRef((t,e)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=t,[d,f]=Bi.useState(null),p=Ri(e,S=>f(S)),m=Bi.useRef(),h=nM(o),b=h==="ltr",g=b&&!i||!b&&i;function y(S){let x=m.current||d.getBoundingClientRect(),O=[0,x.width],E=iBe(O,g?[r,n]:[n,r]);return m.current=x,E(S-x.left)}return(0,Bl.jsx)(kKt,{scope:t.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:(0,Bl.jsx)(BKt,{dir:h,"data-orientation":"horizontal",...c,ref:p,style:{...c.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:S=>{let x=y(S.clientX);a?.(x)},onSlideMove:S=>{let x=y(S.clientX);s?.(x)},onSlideEnd:()=>{m.current=void 0,u?.()},onStepKeyDown:S=>{let O=DKt[g?"from-left":"from-right"].includes(S.key);l?.({event:S,direction:O?-1:1})}})})}),KTn=Bi.forwardRef((t,e)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=t,c=Bi.useRef(null),d=Ri(e,c),f=Bi.useRef(),p=!o;function m(h){let b=f.current||c.current.getBoundingClientRect(),g=[0,b.height],S=iBe(g,p?[n,r]:[r,n]);return f.current=b,S(h-b.top)}return(0,Bl.jsx)(kKt,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,Bl.jsx)(BKt,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{let b=m(h.clientY);i?.(b)},onSlideMove:h=>{let b=m(h.clientY);a?.(b)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:h=>{let g=DKt[p?"from-bottom":"from-top"].includes(h.key);u?.({event:h,direction:g?-1:1})}})})}),BKt=Bi.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=Gde(kz,r);return(0,Bl.jsx)(ho.span,{...l,ref:e,onKeyDown:xi(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):jKt.concat(NKt).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:xi(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:xi(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:xi(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),qKt="SliderTrack",UKt=Bi.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=Gde(qKt,r);return(0,Bl.jsx)(ho.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});UKt.displayName=qKt;var nBe="SliderRange",zKt=Bi.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=Gde(nBe,r),i=$Kt(nBe,r),a=Bi.useRef(null),s=Ri(e,a),u=o.values.length,l=o.values.map(f=>VKt(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,Bl.jsx)(ho.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});zKt.displayName=nBe;var oBe="SliderThumb",HKt=Bi.forwardRef((t,e)=>{let r=zTn(t.__scopeSlider),[n,o]=Bi.useState(null),i=Ri(e,s=>o(s)),a=Bi.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,Bl.jsx)(GTn,{...t,ref:i,index:a})}),GTn=Bi.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=Gde(oBe,r),s=$Kt(oBe,r),[u,l]=Bi.useState(null),c=Ri(e,y=>l(y)),d=u?a.form||!!u.closest("form"):!0,f=Xx(u),p=a.values[n],m=p===void 0?0:VKt(p,a.min,a.max),h=ZTn(n,a.values.length),b=f?.[s.size],g=b?QTn(b,m,s.direction):0;return Bi.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,Bl.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${m}% + ${g}px)`},children:[(0,Bl.jsx)(rBe.ItemSlot,{scope:t.__scopeSlider,children:(0,Bl.jsx)(ho.span,{role:"slider","aria-label":t["aria-label"]||h,"aria-valuemin":a.min,"aria-valuenow":p,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:c,style:p===void 0?{display:"none"}:t.style,onFocus:xi(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,Bl.jsx)(JTn,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});HKt.displayName=oBe;var JTn=t=>{let{value:e,...r}=t,n=Bi.useRef(null),o=Lz(e);return Bi.useEffect(()=>{let i=n.current,a=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(a,"value").set;if(o!==e&&u){let l=new Event("input",{bubbles:!0});u.call(i,e),i.dispatchEvent(l)}},[o,e]),(0,Bl.jsx)("input",{style:{display:"none"},...r,ref:n,defaultValue:e})};function YTn(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function VKt(t,e,r){let i=100/(r-e)*(t-e);return Dz(i,[0,100])}function ZTn(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function XTn(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 QTn(t,e,r){let n=t/2,i=iBe([0,50],[0,n]);return(n-i(e)*r)*r}function eAn(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function tAn(t,e){if(e>0){let r=eAn(t);return Math.min(...r)>=e}return!0}function iBe(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 rAn(t){return(String(t).split(".")[1]||"").length}function nAn(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var aBe=FKt,WKt=UKt,KKt=zKt,GKt=HKt;Tn();var sBe=uL.forwardRef(({className:t,...e},r)=>uL.createElement(aBe,{ref:r,className:_e("tw-relative tw-flex tw-w-full tw-touch-none tw-select-none tw-items-center",t),...e},uL.createElement(WKt,{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"},uL.createElement(KKt,{className:"tw-absolute tw-h-full tw-bg-interactive-accent"})),uL.createElement(GKt,{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"})));sBe.displayName=aBe.displayName;function nC({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a}){let[s,u]=(0,jM.useState)(t);return(0,jM.useEffect)(()=>{u(t)},[t]),jM.default.createElement("div",{className:_e("tw-flex tw-items-center tw-gap-4",a)},jM.default.createElement(sBe,{value:[s],onValueChange:([l])=>u(l),onValueCommit:([l])=>e?.(l),min:r,max:n,step:o,disabled:i,className:"tw-flex-1"}),jM.default.createElement("div",{className:"tw-min-w-[40px] tw-text-right tw-text-sm"},s))}var ry=F(X());Tn();var yE=ry.forwardRef(({className:t,value:e,...r},n)=>{let o=ry.useRef(null),i=ry.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);ry.useLayoutEffect(()=>{i()},[e,i]),ry.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 ry.createElement("textarea",{className:_e("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})});yE.displayName="Textarea";$r();_g();nr();Cn();yn();var $z=require("obsidian"),Kt=F(X()),JKt=F(Dc());function iAn({initialProject:t,onSave:e,onCancel:r}){let n=Rn(),[o,i]=(0,Kt.useState)(!1),[a,s]=(0,Kt.useState)({name:!1,systemPrompt:!1,projectModelKey:!1,inclusions:!1}),[u,l]=(0,Kt.useState)(t||{id:_Ve(),name:"",description:"",systemPrompt:"",projectModelKey:"",modelConfigs:{temperature:jh.TEMPERATURE,maxTokens:jh.MAX_TOKENS},contextSource:{inclusions:"",exclusions:"",webUrls:"",youtubeUrls:""},created:Date.now(),UsageTimestamps:Date.now()}),c=bg(u.contextSource.inclusions||u.contextSource.exclusions||"nothing").reverse().join(","),d=h=>{new Bde(app,async g=>{l(g)},h).open()},f=()=>u.name&&u.projectModelKey,p=(h,b)=>{l(g=>{if(typeof b=="string"&&h==="projectModelKey"&&(b=b.trim()),Array.isArray(b)&&b.every(y=>typeof y=="string")&&(b=b.map(y=>y.trim()).filter(Boolean)),h.includes(".")){let[y,S]=h.split("."),O=g[y];if(typeof O=="object"&&O!==null)return{...g,[y]:{...O,[S]:b}}}return{...g,[h]:b}})},m=async()=>{u.name&&(u.name=u.name.trim());let b=["name","projectModelKey"].filter(g=>!u[g]);if(b.length>0){s(g=>({...g,...Object.fromEntries(b.map(y=>[y,!0]))})),new $z.Notice("Please fill in all required fields");return}try{i(!0),await e(u)}catch(g){new $z.Notice(ei(g)),s(y=>({...y,name:!0}))}finally{i(!1)}};return Kt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-p-4"},Kt.default.createElement("div",{className:"tw-mb-2 tw-text-xl tw-font-bold tw-text-normal"},t?"Edit Project":"New Project"),Kt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Kt.default.createElement(Yn,{label:"Project Name",required:!0,error:a.name&&!u.name,errorMessage:"Project name is required"},Kt.default.createElement(mo,{type:"text",value:u.name,onChange:h=>p("name",h.target.value),onBlur:()=>s(h=>({...h,name:!0})),className:"tw-w-full"})),Kt.default.createElement(Yn,{label:"Description",description:"Briefly describe the purpose and goals of the project"},Kt.default.createElement(mo,{type:"text",value:u.description,onChange:h=>p("description",h.target.value),className:"tw-w-full"})),Kt.default.createElement(Yn,{label:"Project System Prompt",description:"Custom instructions for how the AI should behave in this project context"},Kt.default.createElement(yE,{value:u.systemPrompt,onChange:h=>p("systemPrompt",h.target.value),onBlur:()=>s(h=>({...h,systemPrompt:!0})),className:"tw-min-h-32"})),Kt.default.createElement(Yn,{label:"Default Model",required:!0,error:a.projectModelKey&&!u.projectModelKey,errorMessage:"Default model is required"},Kt.default.createElement(zde,{value:u.projectModelKey,onChange:h=>{let b=h.target.value,g=n.activeModels.find(x=>x.enabled&&kr(x)===b);if(!g)return;let{hasApiKey:y,errorNotice:S}=mF(g,n);if(!y&&S){new $z.Notice(S);return}p("projectModelKey",b)},onBlur:()=>s(h=>({...h,projectModelKey:!0})),placeholder:"Select a model",options:n.activeModels.filter(h=>h.enabled&&h.projectEnabled).map(h=>({label:QW(h),value:kr(h)}))})),Kt.default.createElement("div",{className:"tw-space-y-4"},Kt.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Model Configuration"),Kt.default.createElement("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4"},Kt.default.createElement(Yn,{label:"Temperature"},Kt.default.createElement(nC,{value:u.modelConfigs?.temperature??jh.TEMPERATURE,onChange:h=>p("modelConfigs.temperature",h),min:0,max:2,step:.01,className:"tw-w-full"})),Kt.default.createElement(Yn,{label:"Token Limit"},Kt.default.createElement(nC,{value:u.modelConfigs?.maxTokens??jh.MAX_TOKENS,onChange:h=>p("modelConfigs.maxTokens",h),min:1,max:65e3,step:1,className:"tw-w-full"})))),Kt.default.createElement("div",{className:"tw-space-y-4"},Kt.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Context Sources"),Kt.default.createElement(Yn,{label:Kt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Kt.default.createElement("span",null,"File Context"),Kt.default.createElement(vo,{delayDuration:0},Kt.default.createElement(Rt,null,Kt.default.createElement(jt,{asChild:!0},Kt.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Kt.default.createElement(Mt,null,Kt.default.createElement("div",{className:"tw-max-w-80"},Kt.default.createElement("strong",null,"Supported File Types:"),Kt.default.createElement("br",null),Kt.default.createElement("strong",null,"\u2022 Documents:")," pdf, doc, docx, ppt, pptx, epub, txt, rtf and many more",Kt.default.createElement("br",null),Kt.default.createElement("strong",null,"\u2022 Images:")," jpg, png, svg, gif, bmp, webp, tiff",Kt.default.createElement("br",null),Kt.default.createElement("strong",null,"\u2022 Spreadsheets:")," xlsx, xls, csv, numbers",Kt.default.createElement("br",null),Kt.default.createElement("br",null),"Non-markdown files are converted to markdown in the background.",Kt.default.createElement("br",null),Kt.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."},Kt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Kt.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-row"},Kt.default.createElement(TM,{className:"tw-max-w-[100px] tw-text-sm tw-text-accent"},c)),Kt.default.createElement(ge,{variant:"secondary",onClick:()=>{d(u)}},"Manage Context"))),Kt.default.createElement(Yn,{label:"Web URLs"},Kt.default.createElement(yE,{value:u.contextSource?.webUrls,onChange:h=>{let g=h.target.value.split(` +`)},oEn=0,bz=[];function KWt(t){var e=ba.useRef([]),r=ba.useRef([0,0]),n=ba.useRef(),o=ba.useState(oEn++)[0],i=ba.useState(iE)[0],a=ba.useRef(t);ba.useEffect(function(){a.current=t},[t]),ba.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=sz([t.lockRef.current],(t.shards||[]).map(WWt),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=ba.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=hde(h),y=r.current,S="deltaX"in h?h.deltaX:y[0]-g[0],x="deltaY"in h?h.deltaY:y[1]-g[1],O,P=h.target,E=Math.abs(S)>Math.abs(x)?"h":"v";if("touches"in h&&E==="h"&&P.type==="range")return!1;var A=S$e(E,P);if(!A)return!0;if(A?O=E:(O=E==="v"?"h":"v",A=S$e(E,P)),!A)return!1;if(!n.current&&"changedTouches"in h&&(S||x)&&(n.current=O),!O)return!0;var I=n.current||O;return HWt(I,b,h,I==="h"?S:x,!0)},[]),u=ba.useCallback(function(h){var b=h;if(!(!bz.length||bz[bz.length-1]!==i)){var g="deltaY"in b?VWt(b):hde(b),y=e.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&rEn(O.delta,g)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var S=(a.current.shards||[]).map(WWt).filter(Boolean).filter(function(O){return O.contains(b.target)}),x=S.length>0?s(b,S[0]):!a.current.noIsolation;x&&b.cancelable&&b.preventDefault()}}},[]),l=ba.useCallback(function(h,b,g,y){var S={name:h,delta:b,target:g,should:y,shadowParent:iEn(g)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(x){return x!==S})},1)},[]),c=ba.useCallback(function(h){r.current=hde(h),n.current=void 0},[]),d=ba.useCallback(function(h){l(h.type,VWt(h),h.target,s(h,t.lockRef.current))},[]),f=ba.useCallback(function(h){l(h.type,hde(h),h.target,s(h,t.lockRef.current))},[]);ba.useEffect(function(){return bz.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,nL),document.addEventListener("touchmove",u,nL),document.addEventListener("touchstart",c,nL),function(){bz=bz.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,nL),document.removeEventListener("touchmove",u,nL),document.removeEventListener("touchstart",c,nL)}},[]);var p=t.removeScrollBar,m=t.inert;return ba.createElement(ba.Fragment,null,m?ba.createElement(i,{styles:nEn(o)}):null,p?ba.createElement(KD,{gapMode:t.gapMode}):null)}function iEn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var GWt=WD(mde,KWt);var JWt=gde.forwardRef(function(t,e){return gde.createElement(c9,yi({},t,{ref:e,sideCar:GWt}))});JWt.classNames=c9.classNames;var x$e=JWt;var bl=F(pt(),1),C$e="Popover",[YWt,Zpi]=Yi(C$e,[g$e]),f9=g$e(),[aEn,EM]=YWt(C$e),ZWt=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=f9(e),u=Da.useRef(null),[l,c]=Da.useState(!1),[d=!1,f]=ud({prop:n,defaultProp:o,onChange:i});return(0,bl.jsx)(LWt,{...s,children:(0,bl.jsx)(aEn,{scope:e,contentId:hl(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:Da.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Da.useCallback(()=>c(!0),[]),onCustomAnchorRemove:Da.useCallback(()=>c(!1),[]),modal:a,children:r})})};ZWt.displayName=C$e;var XWt="PopoverAnchor",sEn=Da.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=EM(XWt,r),i=f9(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return Da.useEffect(()=>(a(),()=>s()),[a,s]),(0,bl.jsx)(b$e,{...i,...n,ref:e})});sEn.displayName=XWt;var QWt="PopoverTrigger",e9t=Da.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=EM(QWt,r),i=f9(r),a=Ab(e,o.triggerRef),s=(0,bl.jsx)(op.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":a9t(o.open),...n,ref:a,onClick:tC(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,bl.jsx)(b$e,{asChild:!0,...i,children:s})});e9t.displayName=QWt;var O$e="PopoverPortal",[uEn,lEn]=YWt(O$e,{forceMount:void 0}),t9t=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=EM(O$e,e);return(0,bl.jsx)(uEn,{scope:e,forceMount:r,children:(0,bl.jsx)(fd,{present:r||i.open,children:(0,bl.jsx)(_$e,{asChild:!0,container:o,children:n})})})};t9t.displayName=O$e;var _z="PopoverContent",r9t=Da.forwardRef((t,e)=>{let r=lEn(_z,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=EM(_z,t.__scopePopover);return(0,bl.jsx)(fd,{present:n||i.open,children:i.modal?(0,bl.jsx)(cEn,{...o,ref:e}):(0,bl.jsx)(dEn,{...o,ref:e})})});r9t.displayName=_z;var cEn=Da.forwardRef((t,e)=>{let r=EM(_z,t.__scopePopover),n=Da.useRef(null),o=Ab(e,n),i=Da.useRef(!1);return Da.useEffect(()=>{let a=n.current;if(a)return bM(a)},[]),(0,bl.jsx)(x$e,{as:l9,allowPinchZoom:!0,children:(0,bl.jsx)(n9t,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:tC(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:tC(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:tC(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),dEn=Da.forwardRef((t,e)=>{let r=EM(_z,t.__scopePopover),n=Da.useRef(!1),o=Da.useRef(!1);return(0,bl.jsx)(n9t,{...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()}})}),n9t=Da.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=EM(_z,r),p=f9(r);return iM(),(0,bl.jsx)(p$e,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,bl.jsx)(c$e,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,bl.jsx)(FWt,{"data-state":a9t(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)"}})})})}),o9t="PopoverClose",i9t=Da.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=EM(o9t,r);return(0,bl.jsx)(op.button,{type:"button",...n,ref:e,onClick:tC(t.onClick,()=>o.onOpenChange(!1))})});i9t.displayName=o9t;var fEn="PopoverArrow",pEn=Da.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=f9(r);return(0,bl.jsx)(kWt,{...o,...n,ref:e})});pEn.displayName=fEn;function a9t(t){return t?"open":"closed"}var s9t=ZWt;var u9t=e9t,l9t=t9t,P$e=r9t,c9t=i9t;Tn();var yde=s9t,bde=u9t;var m9=p9.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>p9.createElement(l9t,{container:n??activeDocument.body},p9.createElement(P$e,{ref:i,align:e,sideOffset:r,className:_e("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})));m9.displayName=P$e.displayName;var E$e=c9t;$r();var T$e=F(X()),_de=T$e.createContext(void 0),vz=T$e.createContext(void 0);var wz=F(X());function A$e(){let[t,e]=(0,wz.useState)(null),r=(0,wz.useContext)(vz);return(0,wz.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(Dh.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(Dh.ACTIVE_LEAF_CHANGE,n)}},[r]),t}Tn();Mx();bn();var h9=require("obsidian"),Ke=F(X());function hEn(t){let[e,r]=(0,Ke.useState)([]),n=A$e();return(0,Ke.useEffect)(()=>{async function o(){if(!n?.path)return;let i=await ma.getInstance().getDb(),a=await tce({db:i,filePath:n.path});r(a)}o()},[n?.path,t]),e}function gEn(t,e){let[r,n]=(0,Ke.useState)(!0);return(0,Ke.useEffect)(()=>{if(!t)return;async function o(){let i=await ma.getInstance().hasIndex(t);n(i)}o()},[t,e]),r}function yEn({score:t}){let e=ece(t),r="\u{1F534}";return e===2&&(r="\u{1F7E0}"),e===3&&(r="\u{1F7E2}"),Ke.default.createElement("span",{className:"tw-text-sm"},r)}function bEn({note:t,onAddToChat:e,onNavigateToNote:r}){let[n,o]=(0,Ke.useState)(!1),[i,a]=(0,Ke.useState)(null),s=(0,Ke.useCallback)(async()=>{if(i)return;let u=app.vault.getAbstractFileByPath(t.document.path);if(u instanceof h9.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,Ke.useEffect)(()=>{n&&s()},[n,s]),Ke.default.createElement(cE,{open:n,onOpenChange:o,className:"tw-rounded-md tw-border tw-border-solid tw-border-border"},Ke.default.createElement("div",{className:_e("tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-2")},Ke.default.createElement(ge,{variant:"ghost2",size:"icon",className:"tw-shrink-0",asChild:!0},Ke.default.createElement(rL,null,Ke.default.createElement(XC,{className:_e("tw-size-4 tw-transition-transform tw-duration-200",{"rotate-90":n})}))),Ke.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-2"},Ke.default.createElement(yEn,{score:t.metadata.similarityScore??0})),Ke.default.createElement("div",{className:"tw-flex-1 tw-overflow-hidden"},Ke.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"},t.document.title)),Ke.default.createElement(Rt,null,Ke.default.createElement(jt,{asChild:!0},Ke.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:e,className:"tw-shrink-0"},Ke.default.createElement(Am,{className:"tw-size-4"}))),Ke.default.createElement(Mt,null,"Add to Chat"))),Ke.default.createElement(dE,null,Ke.default.createElement("div",{className:"tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2"},Ke.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&&Ke.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)),Ke.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&&Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ke.default.createElement("span",null,"Similarity: ",(t.metadata.similarityScore*100).toFixed(1),"%")),t.metadata.hasOutgoingLinks&&Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ke.default.createElement(S3,{className:"tw-size-4"}),Ke.default.createElement("span",null,"Outgoing links")),t.metadata.hasBacklinks&&Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ke.default.createElement(w3,{className:"tw-size-4"}),Ke.default.createElement("span",null,"Backlinks")))))}function _En({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return Ke.default.createElement(yde,{key:t.document.path},Ke.default.createElement(bde,{asChild:!0},n),Ke.default.createElement(m9,{className:"tw-flex tw-w-fit tw-min-w-72 tw-max-w-96 tw-flex-col tw-gap-2 tw-overflow-hidden"},Ke.default.createElement("span",{className:"tw-text-sm tw-text-normal"},t.document.title),Ke.default.createElement("span",{className:"tw-text-xs tw-text-muted"},t.document.path),Ke.default.createElement("div",{className:"tw-flex tw-gap-2"},Ke.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 ",Ke.default.createElement(Am,{className:"tw-size-4"})),Ke.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 ",Ke.default.createElement(d3,{className:"tw-size-4"})))))}var vde=(0,Ke.memo)(({className:t,onInsertToChat:e,defaultOpen:r=!1})=>{let[n,o]=(0,Ke.useState)(0),[i,a]=(0,Ke.useState)(r),s=hEn(n),u=A$e(),l=gEn(u?.path??"",n),c=(p,m=!1)=>{let h=app.vault.getAbstractFileByPath(p);h instanceof h9.TFile&&app.workspace.getLeaf(m).openFile(h)},d=p=>{e(`[[${p}]]`)},f=async()=>{u&&(await ma.getInstance().reindexFile(u),new h9.Notice(`Reindexed ${u.name}`),o(n+1))};return Ke.default.createElement("div",{className:_e("tw-w-full tw-border tw-border-solid tw-border-transparent tw-border-b-border tw-pb-2",t)},Ke.default.createElement(cE,{open:i,onOpenChange:a},Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-pb-2 tw-pl-1"},Ke.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},Ke.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Relevant Notes"),Ke.default.createElement(Rt,null,Ke.default.createElement(jt,{asChild:!0},Ke.default.createElement(f_,{className:"tw-size-4 tw-text-muted"})),Ke.default.createElement(Mt,{side:"bottom",className:"tw-w-64"},"Relevance is a combination of semantic similarity and links.")),!l&&Ke.default.createElement(Rt,null,Ke.default.createElement(jt,{asChild:!0},Ke.default.createElement(Uf,{className:"tw-size-4 tw-text-warning"})),Ke.default.createElement(Mt,{side:"bottom"},"Note has not been indexed"))),Ke.default.createElement("div",{className:"tw-flex tw-items-center"},Ke.default.createElement(Rt,null,Ke.default.createElement(jt,{asChild:!0},Ke.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:f},Ke.default.createElement(A3,{className:"tw-size-4"}))),Ke.default.createElement(Mt,{side:"bottom"},"Reindex Current Note")),s.length>0&&Ke.default.createElement(rL,{asChild:!0},Ke.default.createElement(ge,{variant:"ghost2",size:"icon"},i?Ke.default.createElement(Ey,{className:"tw-size-5"}):Ke.default.createElement(Hi,{className:"tw-size-5"}))))),s.length===0&&Ke.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"},Ke.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"No relevant notes found")),!i&&s.length>0&&Ke.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=>Ke.default.createElement(_En,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)},Ke.default.createElement(cm,{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"},Ke.default.createElement("span",{className:"tw-truncate"},p.document.title))))),Ke.default.createElement(dE,null,Ke.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=>Ke.default.createElement(bEn,{note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)}))))))});vde.displayName="RelevantNotes";Cl();Fd();ti();var dm=F(X());Tn();var g9=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-rounded-xl tw-border tw-border-border tw-bg-primary tw-text-normal tw-shadow",t),...e}));g9.displayName="Card";var y9=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-flex tw-flex-col tw-space-y-1.5 tw-p-6",t),...e}));y9.displayName="CardHeader";var I$e=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));I$e.displayName="CardTitle";var vEn=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-text-sm tw-text-muted",t),...e}));vEn.displayName="CardDescription";var b9=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-p-6 tw-pt-0",t),...e}));b9.displayName="CardContent";var wEn=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-flex tw-items-center tw-p-6 tw-pt-0",t),...e}));wEn.displayName="CardFooter";$r();nr();bn();var Xi=F(X()),M$e={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 [[]], what improvements should we focus on next?","Summarize the key points from [[]].","Summarize the recent updates from [[]].","Roast my writing in [[]] 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 from my notes?","Explain based on my stored notes.","Highlight important details on from my notes.","Based on my notes on , 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 @vault","Summarize in under 10 bullet points","@youtube ","@websearch what are most recent updates in the AI industry","What are the key insights from this paper ","What new methods are proposed in this paper [[]]"]}},d9t={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"],project:["copilotPlus","copilotPlus","copilotPlus"]};function SEn(t="llm_chain"){let e=d9t[t]||d9t.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...M$e[n].prompts].sort(()=>Math.random()-.5)),{title:M$e[n].title,text:r[n].pop()||M$e[n].prompts[0]}))}var f9t=({onClick:t})=>{let[e]=by(),r=(0,Xi.useMemo)(()=>SEn(e),[e]),o=Rn().indexVaultToVectorStore;return Xi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Xi.default.createElement(g9,{className:"tw-w-full tw-bg-transparent"},Xi.default.createElement(y9,{className:"tw-px-2"},Xi.default.createElement(I$e,null,"Suggested Prompts")),Xi.default.createElement(b9,{className:"tw-p-2 tw-pt-0"},Xi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},r.map((i,a)=>Xi.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"},Xi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},Xi.default.createElement("div",{className:"tw-text-muted"},i.title),Xi.default.createElement("div",null,i.text)),Xi.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},Xi.default.createElement(Rt,null,Xi.default.createElement(jt,{asChild:!0},Xi.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>t(i.text)},Xi.default.createElement(Am,{className:"tw-size-4"}))),Xi.default.createElement(Mt,null,"Add to Chat")))))))),e==="vault_qa"&&Xi.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"&&Xi.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},Xi.default.createElement("div",null,Xi.default.createElement(Uf,{className:"tw-size-4"})," Your auto-index strategy is set to"," ",Xi.default.createElement("b",null,"NEVER"),". Before proceeding, click the"," ",Xi.default.createElement("span",{className:"tw-text-accent"},"Refresh Index")," button below or run the"," ",Xi.default.createElement("span",{className:"tw-text-accent"},"Copilot command: Index (refresh) vault for QA")," ","to update the index.")))};nr();var mf=F(X()),p9t=(0,mf.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,mf.useState)(""),p=Rn(),m=()=>{let b=document.querySelector("[data-testid='chat-messages']");b&&(b.scrollTop=b.scrollHeight)};if((0,mf.useEffect)(()=>{r||m()},[r]),(0,mf.useEffect)(()=>{let b;return r?b=setInterval(()=>{f(g=>g.length<6?g+".":"")},200):f(""),()=>clearInterval(b)},[r]),!t.filter(b=>b.isVisible).length&&!e)return mf.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-gap-2 tw-overflow-y-auto"},c&&p.showRelevantNotes&&mf.default.createElement(vde,{onInsertToChat:u,defaultOpen:!0,key:"relevant-notes-before-chat"}),c&&p.showSuggestedPrompts&&mf.default.createElement(f9t,{onClick:l}));let h=()=>n?`${n} ${d}`:d;return mf.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-1 tw-flex-col tw-overflow-hidden"},c&&p.showRelevantNotes&&mf.default.createElement(vde,{className:"tw-mb-4",onInsertToChat:u,defaultOpen:!1,key:"relevant-notes-in-chat"}),mf.default.createElement("div",{"data-testid":"chat-messages",className:"tw-mt-auto tw-box-border 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((b,g)=>b.isVisible&&mf.default.createElement(Yke,{key:g,message:b,app:o,isStreaming:!1,onRegenerate:()=>i(g),onEdit:y=>a(g,y),onDelete:()=>s(g),chatHistory:t})),(e||r)&&mf.default.createElement(Yke,{key:`ai_message_${e}`,message:{sender:"AI",message:e||h(),isVisible:!0,timestamp:null},app:o,isStreaming:!0,onDelete:()=>{},chatHistory:t})))});p9t.displayName="ChatMessages";var m9t=p9t;ti();yn();var wde=F(X());function Sde(t){let[e,r]=(0,wde.useState)(null);(0,wde.useEffect)(()=>{(async()=>{let i=await vVe();i.version&&r(i.version)})()},[]);let n=e!==null&&nJ(e,t);return{latestVersion:e,hasUpdate:n}}Tn();nr();yn();bn();var ey=F(X());function h9t({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=Sde(t),n=Rn().lastDismissedVersion,[o,i]=(0,ey.useState)(!0),a=r&&e&&nJ(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{dt("lastDismissedVersion",e)},300))};return a?ey.default.createElement("div",{className:_e("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")},ey.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"},ey.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ey.default.createElement("span",{className:"tw-font-medium"},"Update available:"),ey.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"tw-text-normal"},"v",e)),ey.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ey.default.createElement(ge,{size:"fit",variant:"ghost2",className:"tw-text-accent hover:tw-text-accent-hover",onClick:()=>{window.open("obsidian://show-plugin?id=copilot","_blank"),s()}},"Update"),ey.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:s},ey.default.createElement(Vi,{className:"tw-size-4"}))))):null}Cl();var g9t=require("obsidian");_g();var Sz=class extends g9t.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=eie(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 R$e=require("obsidian");var _9=class extends mz{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 R$e.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 R$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)}}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n&&(o+=` (${n.toUpperCase()})`),o}};yn();var y9t=require("obsidian"),xz=class extends y9t.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)NR(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};var Cz=F(X());Tn();var xde=F(X()),xEn=2;function CEn(t,e){return e&&e>1?t.current?t.current.offsetHeight{let i=(0,xde.useRef)(null),[a,s]=(0,xde.useState)(!1);return Cz.default.createElement(vo,{delayDuration:0},Cz.default.createElement(Rt,{open:a,onOpenChange:l=>{s(l&&CEn(i,r))}},Cz.default.createElement(jt,{asChild:!0},Cz.default.createElement("div",{...o,ref:i,className:_e("tw-max-w-full tw-text-normal",(!r||r<=1)&&"tw-truncate",r&&OEn(r),e),"data-testid":"truncatedText"},t)),Cz.default.createElement(Mt,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},n??t)))};ti();var C9=F(X());bn();var P9t=F(X(),1),xt=F(X(),1),Tde=(0,xt.createContext)(null);Tde.displayName="PanelGroupContext";var vs={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"},$$e=10,iL=xt.useLayoutEffect,b9t=P9t.useId,PEn=typeof b9t=="function"?b9t:()=>null,EEn=0;function B$e(t=null){let e=PEn(),r=(0,xt.useRef)(t||e||null);return r.current===null&&(r.current=""+EEn++),t??r.current}function E9t({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:m="div",...h}){let b=(0,xt.useContext)(Tde);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:g,expandPanel:y,getPanelSize:S,getPanelStyle:x,groupId:O,isPanelCollapsed:P,reevaluatePanelConstraints:E,registerPanel:A,resizePanel:I,unregisterPanel:R}=b,N=B$e(a),j=(0,xt.useRef)({callbacks:{onCollapse:l,onExpand:c,onResize:d},constraints:{collapsedSize:r,collapsible:n,defaultSize:o,maxSize:s,minSize:u},id:N,idIsFromProps:a!==void 0,order:f});(0,xt.useRef)({didLogMissingDefaultSizeWarning:!1}),iL(()=>{let{callbacks:k,constraints:z}=j.current,V={...z};j.current.id=N,j.current.idIsFromProps=a!==void 0,j.current.order=f,k.onCollapse=l,k.onExpand=c,k.onResize=d,z.collapsedSize=r,z.collapsible=n,z.defaultSize=o,z.maxSize=s,z.minSize=u,(V.collapsedSize!==z.collapsedSize||V.collapsible!==z.collapsible||V.maxSize!==z.maxSize||V.minSize!==z.minSize)&&E(j.current,V)}),iL(()=>{let k=j.current;return A(k),()=>{R(k)}},[f,N,A,R]),(0,xt.useImperativeHandle)(i,()=>({collapse:()=>{g(j.current)},expand:k=>{y(j.current,k)},getId(){return N},getSize(){return S(j.current)},isCollapsed(){return P(j.current)},isExpanded(){return!P(j.current)},resize:k=>{I(j.current,k)}}),[g,y,S,P,N,I]);let $=x(j.current,o);return(0,xt.createElement)(m,{...h,children:t,className:e,id:N,style:{...$,...p},[vs.groupId]:O,[vs.panel]:"",[vs.panelCollapsible]:n||void 0,[vs.panelId]:N,[vs.panelSize]:parseFloat(""+$.flexGrow).toFixed(1)})}var q$e=(0,xt.forwardRef)((t,e)=>(0,xt.createElement)(E9t,{...t,forwardedRef:e}));E9t.displayName="Panel";q$e.displayName="forwardRef(Panel)";var TEn;function AEn(){return TEn}var k$e=null,IEn=!0,Ode=-1,fE=null;function MEn(t,e){if(e){let r=(e&R9t)!==0,n=(e&j9t)!==0,o=(e&N9t)!==0,i=(e&D9t)!==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 REn(){fE!==null&&(document.head.removeChild(fE),k$e=null,fE=null,Ode=-1)}function j$e(t,e){var r,n;if(!IEn)return;let o=MEn(t,e);if(k$e!==o){if(k$e=o,fE===null){fE=document.createElement("style");let a=AEn();a&&fE.setAttribute("nonce",a),document.head.appendChild(fE)}if(Ode>=0){var i;(i=fE.sheet)===null||i===void 0||i.removeRule(Ode)}Ode=(r=(n=fE.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function T9t(t){return t.type==="keydown"}function A9t(t){return t.type.startsWith("pointer")}function I9t(t){return t.type.startsWith("mouse")}function Ade(t){if(A9t(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(I9t(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function jEn(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function NEn(t,e,r){return r?t.xe.x&&t.ye.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 DEn(t,e){if(t===e)throw new Error("Cannot compare node with itself");let r={a:w9t(t),b:w9t(e)},n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;mn(n,"Stacking order can only be calculated for elements with a common ancestor");let o={a:v9t(_9t(r.a)),b:v9t(_9t(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 LEn=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function FEn(t){var e;let r=getComputedStyle((e=M9t(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function kEn(t){let e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||FEn(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"||LEn.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function _9t(t){let e=t.length;for(;e--;){let r=t[e];if(mn(r,"Missing node"),kEn(r))return r}return null}function v9t(t){return t&&Number(getComputedStyle(t).zIndex)||0}function w9t(t){let e=[];for(;t;)e.push(t),t=M9t(t);return e}function M9t(t){let{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}var R9t=1,j9t=2,N9t=4,D9t=8,$En=jEn()==="coarse",Ib=[],Tz=!1,AM=new Map,Ide=new Map,S9=new Set;function BEn(t,e,r,n,o){var i;let{ownerDocument:a}=e,s={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:o},u=(i=AM.get(a))!==null&&i!==void 0?i:0;return AM.set(a,u+1),S9.add(s),Pde(),function(){var c;Ide.delete(t),S9.delete(s);let d=(c=AM.get(a))!==null&&c!==void 0?c:1;if(AM.set(a,d-1),Pde(),d===1&&AM.delete(a),Ib.includes(s)){let f=Ib.indexOf(s);f>=0&&Ib.splice(f,1),z$e(),o("up",!0,null)}}}function qEn(t){let{target:e}=t,{x:r,y:n}=Ade(t);Tz=!0,U$e({target:e,x:r,y:n}),Pde(),Ib.length>0&&(Ede("down",t),t.preventDefault(),L9t(e)||t.stopImmediatePropagation())}function N$e(t){let{x:e,y:r}=Ade(t);if(Tz&&t.buttons===0&&(Tz=!1,Ede("up",t)),!Tz){let{target:n}=t;U$e({target:n,x:e,y:r})}Ede("move",t),z$e(),Ib.length>0&&t.preventDefault()}function D$e(t){let{target:e}=t,{x:r,y:n}=Ade(t);Ide.clear(),Tz=!1,Ib.length>0&&(t.preventDefault(),L9t(e)||t.stopImmediatePropagation()),Ede("up",t),U$e({target:e,x:r,y:n}),z$e(),Pde()}function L9t(t){let e=t;for(;e;){if(e.hasAttribute(vs.resizeHandle))return!0;e=e.parentElement}return!1}function U$e({target:t,x:e,y:r}){Ib.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),S9.forEach(o=>{let{element:i,hitAreaMargins:a}=o,s=i.getBoundingClientRect(),{bottom:u,left:l,right:c,top:d}=s,f=$En?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)&&DEn(n,i)>0){let m=n,h=!1;for(;m&&!m.contains(i);){if(NEn(m.getBoundingClientRect(),s,!0)){h=!0;break}m=m.parentElement}if(h)return}Ib.push(o)}})}function L$e(t,e){Ide.set(t,e)}function z$e(){let t=!1,e=!1;Ib.forEach(n=>{let{direction:o}=n;o==="horizontal"?t=!0:e=!0});let r=0;Ide.forEach(n=>{r|=n}),t&&e?j$e("intersection",r):t?j$e("horizontal",r):e?j$e("vertical",r):REn()}var F$e=new AbortController;function Pde(){F$e.abort(),F$e=new AbortController;let t={capture:!0,signal:F$e.signal};S9.size&&(Tz?(Ib.length>0&&AM.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",D$e,t),n.addEventListener("pointerleave",N$e,t),n.addEventListener("pointermove",N$e,t))}),AM.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",D$e,t),n.addEventListener("pointercancel",D$e,t)})):AM.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",qEn,t),n.addEventListener("pointermove",N$e,t))}))}function Ede(t,e){S9.forEach(r=>{let{setResizeHandlerState:n}=r,o=Ib.includes(r);n(t,o,e)})}function UEn(){let[t,e]=(0,xt.useState)(0);return(0,xt.useCallback)(()=>e(r=>r+1),[])}function mn(t,e){if(!t)throw console.error(e),Error(e)}function aL(t,e,r=$$e){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function pE(t,e,r=$$e){return aL(t,e,r)===0}function ph(t,e,r){return aL(t,e,r)===0}function zEn(t,e,r){if(t.length!==e.length)return!1;for(let n=0;n0&&(t=t<0?0-g:g)}}}{let d=t<0?s:u,f=r[d];mn(f,`No panel constraints found for index ${d}`);let{collapsedSize:p=0,collapsible:m,minSize:h=0}=f;if(m){let b=e[d];if(mn(b!=null,`Previous layout not found for panel index ${d}`),ph(b,h)){let g=b-p;aL(g,Math.abs(t))>0&&(t=t<0?0-g:g)}}}}{let d=t<0?1:-1,f=t<0?u:s,p=0;for(;;){let h=e[f];mn(h!=null,`Previous layout not found for panel index ${f}`);let g=Ez({panelConstraints:r,panelIndex:f,size:100})-h;if(p+=g,f+=d,f<0||f>=r.length)break}let m=Math.min(Math.abs(t),Math.abs(p));t=t<0?0-m:m}{let f=t<0?s:u;for(;f>=0&&f=0))break;t<0?f--:f++}}if(zEn(o,a))return o;{let d=t<0?u:s,f=e[d];mn(f!=null,`Previous layout not found for panel index ${d}`);let p=f+l,m=Ez({panelConstraints:r,panelIndex:d,size:p});if(a[d]=m,!ph(m,p)){let h=p-m,g=t<0?u:s;for(;g>=0&&g0?g--:g++}}}let c=a.reduce((d,f)=>f+d,0);return ph(c,100)?a:o}function HEn({layout:t,panelsArray:e,pivotIndices:r}){let n=0,o=100,i=0,a=0,s=r[0];mn(s!=null,"No pivot index found"),e.forEach((d,f)=>{let{constraints:p}=d,{maxSize:m=100,minSize:h=0}=p;f===s?(n=h,o=m):(i+=h,a+=m)});let u=Math.min(o,100-i),l=Math.max(n,100-a),c=t[s];return{valueMax:u,valueMin:l,valueNow:c}}function x9(t,e=document){return Array.from(e.querySelectorAll(`[${vs.resizeHandleId}][data-panel-group-id="${t}"]`))}function F9t(t,e,r=document){let o=x9(t,r).findIndex(i=>i.getAttribute(vs.resizeHandleId)===e);return o??null}function k9t(t,e,r){let n=F9t(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function VEn(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function $9t(t,e=document){if(VEn(e)&&e.dataset.panelGroupId==t)return e;let r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function Mde(t,e=document){let r=e.querySelector(`[${vs.resizeHandleId}="${t}"]`);return r||null}function WEn(t,e,r,n=document){var o,i,a,s;let u=Mde(e,n),l=x9(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 KEn({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:o,panelGroupElement:i,setLayout:a}){(0,xt.useRef)({didWarnAboutMissingResizeHandle:!1}),iL(()=>{if(!i)return;let s=x9(r,i);for(let u=0;u{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,xt.useEffect)(()=>{if(!i)return;let s=e.current;mn(s,"Eager values not found");let{panelDataArray:u}=s,l=$9t(r,i);mn(l!=null,`No group found for id "${r}"`);let c=x9(r,i);mn(c,`No resize handles found for group id "${r}"`);let d=c.map(f=>{let p=f.getAttribute(vs.resizeHandleId);mn(p,"Resize handle element has no handle id attribute");let[m,h]=WEn(r,p,u,i);if(m==null||h==null)return()=>{};let b=g=>{if(!g.defaultPrevented)switch(g.key){case"Enter":{g.preventDefault();let y=u.findIndex(S=>S.id===m);if(y>=0){let S=u[y];mn(S,`No panel data found for index ${y}`);let x=n[y],{collapsedSize:O=0,collapsible:P,minSize:E=0}=S.constraints;if(x!=null&&P){let A=v9({delta:ph(x,O)?E-O:O-x,initialLayout:n,panelConstraints:u.map(I=>I.constraints),pivotIndices:k9t(r,p,i),prevLayout:n,trigger:"keyboard"});n!==A&&a(A)}}break}}};return f.addEventListener("keydown",b),()=>{f.removeEventListener("keydown",b)}});return()=>{d.forEach(f=>f())}},[i,t,e,r,n,o,a])}function S9t(t,e){if(t.length!==e.length)return!1;for(let r=0;ri.constraints),n=0,o=100;for(let i=0;i{let i=t[o];mn(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:m}=a;m&&m(n,d),c&&(f||p)&&(p&&(d==null||pE(d,l))&&!pE(n,l)&&p(),f&&(d==null||!pE(d,l))&&pE(n,l)&&f())}})}function Cde(t,e){if(t.length!==e.length)return!1;for(let r=0;r{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...o)},e)}}function x9t(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 q9t(t){return`react-resizable-panels:${t}`}function U9t(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 z9t(t,e){try{let r=q9t(t),n=e.getItem(r);if(n){let o=JSON.parse(n);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function QEn(t,e,r){var n,o;let i=(n=z9t(t,r))!==null&&n!==void 0?n:{},a=U9t(e);return(o=i[a])!==null&&o!==void 0?o:null}function eTn(t,e,r,n,o){var i;let a=q9t(t),s=U9t(e),u=(i=z9t(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 C9t({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(!ph(n,100)&&r.length>0)for(let i=0;i(x9t(w9),w9.getItem(t)),setItem:(t,e)=>{x9t(w9),w9.setItem(t,e)}},O9t={};function H9t({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:o,id:i=null,onLayout:a=null,keyboardResizeBy:s=null,storage:u=w9,style:l,tagName:c="div",...d}){let f=B$e(i),p=(0,xt.useRef)(null),[m,h]=(0,xt.useState)(null),[b,g]=(0,xt.useState)([]),y=UEn(),S=(0,xt.useRef)({}),x=(0,xt.useRef)(new Map),O=(0,xt.useRef)(0),P=(0,xt.useRef)({autoSaveId:t,direction:n,dragState:m,id:f,keyboardResizeBy:s,onLayout:a,storage:u}),E=(0,xt.useRef)({layout:b,panelDataArray:[],panelDataArrayChanged:!1});(0,xt.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,xt.useImperativeHandle)(o,()=>({getId:()=>P.current.id,getLayout:()=>{let{layout:H}=E.current;return H},setLayout:H=>{let{onLayout:ee}=P.current,{layout:U,panelDataArray:W}=E.current,Y=C9t({layout:H,panelConstraints:W.map(ae=>ae.constraints)});S9t(U,Y)||(g(Y),E.current.layout=Y,ee&&ee(Y),Oz(W,Y,S.current))}}),[]),iL(()=>{P.current.autoSaveId=t,P.current.direction=n,P.current.dragState=m,P.current.id=f,P.current.onLayout=a,P.current.storage=u}),KEn({committedValuesRef:P,eagerValuesRef:E,groupId:f,layout:b,panelDataArray:E.current.panelDataArray,setLayout:g,panelGroupElement:p.current}),(0,xt.useEffect)(()=>{let{panelDataArray:H}=E.current;if(t){if(b.length===0||b.length!==H.length)return;let ee=O9t[t];ee==null&&(ee=XEn(eTn,tTn),O9t[t]=ee);let U=[...H],W=new Map(x.current);ee(t,U,W,b,u)}},[t,b,u]),(0,xt.useEffect)(()=>{});let A=(0,xt.useCallback)(H=>{let{onLayout:ee}=P.current,{layout:U,panelDataArray:W}=E.current;if(H.constraints.collapsible){let Y=W.map(Be=>Be.constraints),{collapsedSize:ae=0,panelSize:Oe,pivotIndices:le}=oL(W,H,U);if(mn(Oe!=null,`Panel size not found for panel "${H.id}"`),!pE(Oe,ae)){x.current.set(H.id,Oe);let ze=Pz(W,H)===W.length-1?Oe-ae:ae-Oe,rt=v9({delta:ze,initialLayout:U,panelConstraints:Y,pivotIndices:le,prevLayout:U,trigger:"imperative-api"});Cde(U,rt)||(g(rt),E.current.layout=rt,ee&&ee(rt),Oz(W,rt,S.current))}}},[]),I=(0,xt.useCallback)((H,ee)=>{let{onLayout:U}=P.current,{layout:W,panelDataArray:Y}=E.current;if(H.constraints.collapsible){let ae=Y.map(cr=>cr.constraints),{collapsedSize:Oe=0,panelSize:le=0,minSize:Be=0,pivotIndices:ze}=oL(Y,H,W),rt=ee??Be;if(pE(le,Oe)){let cr=x.current.get(H.id),Sn=cr!=null&&cr>=rt?cr:rt,mt=Pz(Y,H)===Y.length-1?le-Sn:Sn-le,ht=v9({delta:mt,initialLayout:W,panelConstraints:ae,pivotIndices:ze,prevLayout:W,trigger:"imperative-api"});Cde(W,ht)||(g(ht),E.current.layout=ht,U&&U(ht),Oz(Y,ht,S.current))}}},[]),R=(0,xt.useCallback)(H=>{let{layout:ee,panelDataArray:U}=E.current,{panelSize:W}=oL(U,H,ee);return mn(W!=null,`Panel size not found for panel "${H.id}"`),W},[]),N=(0,xt.useCallback)((H,ee)=>{let{panelDataArray:U}=E.current,W=Pz(U,H);return ZEn({defaultSize:ee,dragState:m,layout:b,panelData:U,panelIndex:W})},[m,b]),j=(0,xt.useCallback)(H=>{let{layout:ee,panelDataArray:U}=E.current,{collapsedSize:W=0,collapsible:Y,panelSize:ae}=oL(U,H,ee);return mn(ae!=null,`Panel size not found for panel "${H.id}"`),Y===!0&&pE(ae,W)},[]),$=(0,xt.useCallback)(H=>{let{layout:ee,panelDataArray:U}=E.current,{collapsedSize:W=0,collapsible:Y,panelSize:ae}=oL(U,H,ee);return mn(ae!=null,`Panel size not found for panel "${H.id}"`),!Y||aL(ae,W)>0},[]),k=(0,xt.useCallback)(H=>{let{panelDataArray:ee}=E.current;ee.push(H),ee.sort((U,W)=>{let Y=U.order,ae=W.order;return Y==null&&ae==null?0:Y==null?-1:ae==null?1:Y-ae}),E.current.panelDataArrayChanged=!0,y()},[y]);iL(()=>{if(E.current.panelDataArrayChanged){E.current.panelDataArrayChanged=!1;let{autoSaveId:H,onLayout:ee,storage:U}=P.current,{layout:W,panelDataArray:Y}=E.current,ae=null;if(H){let le=QEn(H,Y,U);le&&(x.current=new Map(Object.entries(le.expandToSizes)),ae=le.layout)}ae==null&&(ae=YEn({panelDataArray:Y}));let Oe=C9t({layout:ae,panelConstraints:Y.map(le=>le.constraints)});S9t(W,Oe)||(g(Oe),E.current.layout=Oe,ee&&ee(Oe),Oz(Y,Oe,S.current))}}),iL(()=>{let H=E.current;return()=>{H.layout=[]}},[]);let z=(0,xt.useCallback)(H=>{let ee=!1,U=p.current;return U&&window.getComputedStyle(U,null).getPropertyValue("direction")==="rtl"&&(ee=!0),function(Y){Y.preventDefault();let ae=p.current;if(!ae)return()=>null;let{direction:Oe,dragState:le,id:Be,keyboardResizeBy:ze,onLayout:rt}=P.current,{layout:cr,panelDataArray:Sn}=E.current,{initialLayout:je}=le??{},mt=k9t(Be,H,ae),ht=JEn(Y,H,Oe,le,ze,ae),ft=Oe==="horizontal";ft&&ee&&(ht=-ht);let te=Sn.map(Pe=>Pe.constraints),et=v9({delta:ht,initialLayout:je??cr,panelConstraints:te,pivotIndices:mt,prevLayout:cr,trigger:T9t(Y)?"keyboard":"mouse-or-touch"}),Re=!Cde(cr,et);(A9t(Y)||I9t(Y))&&O.current!=ht&&(O.current=ht,!Re&&ht!==0?ft?L$e(H,ht<0?R9t:j9t):L$e(H,ht<0?N9t:D9t):L$e(H,0)),Re&&(g(et),E.current.layout=et,rt&&rt(et),Oz(Sn,et,S.current))}},[]),V=(0,xt.useCallback)((H,ee)=>{let{onLayout:U}=P.current,{layout:W,panelDataArray:Y}=E.current,ae=Y.map(cr=>cr.constraints),{panelSize:Oe,pivotIndices:le}=oL(Y,H,W);mn(Oe!=null,`Panel size not found for panel "${H.id}"`);let ze=Pz(Y,H)===Y.length-1?Oe-ee:ee-Oe,rt=v9({delta:ze,initialLayout:W,panelConstraints:ae,pivotIndices:le,prevLayout:W,trigger:"imperative-api"});Cde(W,rt)||(g(rt),E.current.layout=rt,U&&U(rt),Oz(Y,rt,S.current))},[]),Q=(0,xt.useCallback)((H,ee)=>{let{layout:U,panelDataArray:W}=E.current,{collapsedSize:Y=0,collapsible:ae}=ee,{collapsedSize:Oe=0,collapsible:le,maxSize:Be=100,minSize:ze=0}=H.constraints,{panelSize:rt}=oL(W,H,U);rt!=null&&(ae&&le&&pE(rt,Y)?pE(Y,Oe)||V(H,Oe):rtBe&&V(H,Be))},[V]),J=(0,xt.useCallback)((H,ee)=>{let{direction:U}=P.current,{layout:W}=E.current;if(!p.current)return;let Y=Mde(H,p.current);mn(Y,`Drag handle element not found for id "${H}"`);let ae=B9t(U,ee);h({dragHandleId:H,dragHandleRect:Y.getBoundingClientRect(),initialCursorPosition:ae,initialLayout:W})},[]),D=(0,xt.useCallback)(()=>{h(null)},[]),B=(0,xt.useCallback)(H=>{let{panelDataArray:ee}=E.current,U=Pz(ee,H);U>=0&&(ee.splice(U,1),delete S.current[H.id],E.current.panelDataArrayChanged=!0,y())},[y]),q=(0,xt.useMemo)(()=>({collapsePanel:A,direction:n,dragState:m,expandPanel:I,getPanelSize:R,getPanelStyle:N,groupId:f,isPanelCollapsed:j,isPanelExpanded:$,reevaluatePanelConstraints:Q,registerPanel:k,registerResizeHandle:z,resizePanel:V,startDragging:J,stopDragging:D,unregisterPanel:B,panelGroupElement:p.current}),[A,m,n,I,R,N,f,j,$,Q,k,z,V,J,D,B]),K={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return(0,xt.createElement)(Tde.Provider,{value:q},(0,xt.createElement)(c,{...d,children:e,className:r,id:i,ref:p,style:{...K,...l},[vs.group]:"",[vs.groupDirection]:n,[vs.groupId]:f}))}var H$e=(0,xt.forwardRef)((t,e)=>(0,xt.createElement)(H9t,{...t,forwardedRef:e}));H9t.displayName="PanelGroup";H$e.displayName="forwardRef(PanelGroup)";function Pz(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function oL(t,e,r){let n=Pz(t,e),i=n===t.length-1?[n-1,n]:[n,n+1],a=r[n];return{...e.constraints,panelSize:a,pivotIndices:i}}function rTn({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){(0,xt.useEffect)(()=>{if(t||r==null||n==null)return;let o=Mde(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(vs.groupId);mn(s,`No group element found for id "${s}"`);let u=x9(s,n),l=F9t(s,e,n);mn(l!==null,`No resize element found for id "${e}"`);let c=a.shiftKey?l>0?l-1:u.length-1:l+1{o.removeEventListener("keydown",i)}},[n,t,e,r])}function V$e({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",...m}){var h,b;let g=(0,xt.useRef)(null),y=(0,xt.useRef)({onClick:a,onDragging:s,onPointerDown:l,onPointerUp:c});(0,xt.useEffect)(()=>{y.current.onClick=a,y.current.onDragging=s,y.current.onPointerDown=l,y.current.onPointerUp=c});let S=(0,xt.useContext)(Tde);if(S===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:x,groupId:O,registerResizeHandle:P,startDragging:E,stopDragging:A,panelGroupElement:I}=S,R=B$e(o),[N,j]=(0,xt.useState)("inactive"),[$,k]=(0,xt.useState)(!1),[z,V]=(0,xt.useState)(null),Q=(0,xt.useRef)({state:N});iL(()=>{Q.current.state=N}),(0,xt.useEffect)(()=>{if(r)V(null);else{let q=P(R);V(()=>q)}},[r,R,P]);let J=(h=n?.coarse)!==null&&h!==void 0?h:15,D=(b=n?.fine)!==null&&b!==void 0?b:5;return(0,xt.useEffect)(()=>{if(r||z==null)return;let q=g.current;mn(q,"Element ref not attached");let K=!1;return BEn(R,q,x,{coarse:J,fine:D},(ee,U,W)=>{if(!U){j("inactive");return}switch(ee){case"down":{j("drag"),K=!1,mn(W,'Expected event to be defined for "down" action'),E(R,W);let{onDragging:Y,onPointerDown:ae}=y.current;Y?.(!0),ae?.();break}case"move":{let{state:Y}=Q.current;K=!0,Y!=="drag"&&j("hover"),mn(W,'Expected event to be defined for "move" action'),z(W);break}case"up":{j("hover"),A();let{onClick:Y,onDragging:ae,onPointerUp:Oe}=y.current;ae?.(!1),Oe?.(),K||Y?.();break}}})},[J,x,r,D,P,R,z,E,A]),rTn({disabled:r,handleId:R,resizeHandler:z,panelGroupElement:I}),(0,xt.createElement)(p,{...m,children:t,className:e,id:o,onBlur:()=>{k(!1),i?.()},onFocus:()=>{k(!0),u?.()},ref:g,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...d},tabIndex:f,[vs.groupDirection]:x,[vs.groupId]:O,[vs.resizeHandle]:"",[vs.resizeHandleActive]:N==="drag"?"pointer":$?"keyboard":void 0,[vs.resizeHandleEnabled]:!r,[vs.resizeHandleId]:R,[vs.resizeHandleState]:N})}V$e.displayName="PanelResizeHandle";Tn();var V9t=({className:t,...e})=>C9.createElement(H$e,{className:_e("tw-flex tw-size-full data-[panel-group-direction=vertical]:tw-flex-col",t),...e}),W$e=q$e,W9t=({withHandle:t,className:e,...r})=>C9.createElement(V$e,{className:_e("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&&C9.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"},C9.createElement(d_,{className:"tw-size-2.5"})));var nC=F(X());var er=F(X(),1);var K9t=F(X(),1),oTn=F(ds(),1);a1();var G9t=F(pt(),1),iTn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Az=iTn.reduce((t,e)=>{let r=JC(`Primitive.${e}`),n=K9t.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,G9t.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var fm=F(X(),1);var Y9t=F(X(),1);function J9t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function aTn(...t){return e=>{let r=!1,n=t.map(o=>{let i=J9t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{};var X9t=F(X(),1);function sTn(t,e){return X9t.useReducer((r,n)=>e[r][n]??r,t)}var Iz=t=>{let{present:e,children:r}=t,n=uTn(e),o=typeof r=="function"?r({present:n.isPresent}):fm.Children.only(r),i=mE(n.ref,lTn(o));return typeof r=="function"||n.isPresent?fm.cloneElement(o,{ref:i}):null};Iz.displayName="Presence";function uTn(t){let[e,r]=fm.useState(),n=fm.useRef(null),o=fm.useRef(t),i=fm.useRef("none"),a=t?"mounted":"unmounted",[s,u]=sTn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return fm.useEffect(()=>{let l=Rde(n.current);i.current=s==="mounted"?l:"none"},[s]),O9(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Rde(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),O9(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Rde(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let b=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},f=p=>{p.target===e&&(i.current=Rde(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:fm.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function Rde(t){return t?.animationName||"none"}function lTn(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 hE=F(X(),1),Q9t=F(pt(),1);function eKt(t,e=[]){let r=[];function n(i,a){let s=hE.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=hE.useMemo(()=>m,Object.values(m));return(0,Q9t.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=hE.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>hE.createContext(a));return function(s){let u=s?.[t]||i;return hE.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,cTn(o,...e)]}function cTn(...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 hE.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Mz=F(X(),1);function IM(t){let e=Mz.useRef(t);return Mz.useEffect(()=>{e.current=t}),Mz.useMemo(()=>(...r)=>e.current?.(...r),[])}var jde=F(X(),1),dTn=F(pt(),1),fTn=jde.createContext(void 0);function tKt(t){let e=jde.useContext(fTn);return t||e||"ltr"}function rKt(t,[e,r]){return Math.min(r,Math.max(e,t))}function MM(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var oKt=F(X(),1),ci=F(pt(),1);function pTn(t,e){return oKt.useReducer((r,n)=>e[r][n]??r,t)}var K$e="ScrollArea",[iKt,Phi]=eKt(K$e),[mTn,ty]=iKt(K$e),aKt=er.forwardRef((t,e)=>{let{__scopeScrollArea:r,type:n="hover",dir:o,scrollHideDelay:i=600,...a}=t,[s,u]=er.useState(null),[l,c]=er.useState(null),[d,f]=er.useState(null),[p,m]=er.useState(null),[h,b]=er.useState(null),[g,y]=er.useState(0),[S,x]=er.useState(0),[O,P]=er.useState(!1),[E,A]=er.useState(!1),I=mE(e,N=>u(N)),R=tKt(o);return(0,ci.jsx)(mTn,{scope:r,type:n,dir:R,scrollHideDelay:i,scrollArea:s,viewport:l,onViewportChange:c,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:O,onScrollbarXEnabledChange:P,scrollbarY:h,onScrollbarYChange:b,scrollbarYEnabled:E,onScrollbarYEnabledChange:A,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,ci.jsx)(Az.div,{dir:R,...a,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":S+"px",...t.style}})})});aKt.displayName=K$e;var sKt="ScrollAreaViewport",uKt=er.forwardRef((t,e)=>{let{__scopeScrollArea:r,children:n,nonce:o,...i}=t,a=ty(sKt,r),s=er.useRef(null),u=mE(e,s,a.onViewportChange);return(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.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,ci.jsx)(Az.div,{"data-radix-scroll-area-viewport":"",...i,ref:u,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,ci.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});uKt.displayName=sKt;var rC="ScrollAreaScrollbar",Lde=er.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=ty(rC,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,s=t.orientation==="horizontal";return er.useEffect(()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)}),[s,i,a]),o.type==="hover"?(0,ci.jsx)(hTn,{...n,ref:e,forceMount:r}):o.type==="scroll"?(0,ci.jsx)(gTn,{...n,ref:e,forceMount:r}):o.type==="auto"?(0,ci.jsx)(lKt,{...n,ref:e,forceMount:r}):o.type==="always"?(0,ci.jsx)(G$e,{...n,ref:e}):null});Lde.displayName=rC;var hTn=er.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=ty(rC,t.__scopeScrollArea),[i,a]=er.useState(!1);return er.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,ci.jsx)(Iz,{present:r||i,children:(0,ci.jsx)(lKt,{"data-state":i?"visible":"hidden",...n,ref:e})})}),gTn=er.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=ty(rC,t.__scopeScrollArea),i=t.orientation==="horizontal",a=kde(()=>u("SCROLL_END"),100),[s,u]=pTn("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 er.useEffect(()=>{if(s==="idle"){let l=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(l)}},[s,o.scrollHideDelay,u]),er.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,ci.jsx)(Iz,{present:r||s!=="hidden",children:(0,ci.jsx)(G$e,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:MM(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:MM(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),lKt=er.forwardRef((t,e)=>{let r=ty(rC,t.__scopeScrollArea),{forceMount:n,...o}=t,[i,a]=er.useState(!1),s=t.orientation==="horizontal",u=kde(()=>{if(r.viewport){let l=r.viewport.offsetWidth{let{orientation:r="vertical",...n}=t,o=ty(rC,t.__scopeScrollArea),i=er.useRef(null),a=er.useRef(0),[s,u]=er.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=pKt(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 STn(f,a.current,s,p)}return r==="horizontal"?(0,ci.jsx)(yTn,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollLeft,p=nKt(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,ci.jsx)(bTn,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollTop,p=nKt(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}),yTn=er.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=ty(rC,t.__scopeScrollArea),[a,s]=er.useState(),u=er.useRef(null),l=mE(e,u,i.onScrollbarXChange);return er.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,ci.jsx)(dKt,{"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":Fde(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),hKt(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:Dde(a.paddingLeft),paddingEnd:Dde(a.paddingRight)}})}})}),bTn=er.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=ty(rC,t.__scopeScrollArea),[a,s]=er.useState(),u=er.useRef(null),l=mE(e,u,i.onScrollbarYChange);return er.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,ci.jsx)(dKt,{"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":Fde(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),hKt(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:Dde(a.paddingTop),paddingEnd:Dde(a.paddingBottom)}})}})}),[_Tn,cKt]=iKt(rC),dKt=er.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=ty(rC,r),[m,h]=er.useState(null),b=mE(e,I=>h(I)),g=er.useRef(null),y=er.useRef(""),S=p.viewport,x=n.content-n.viewport,O=IM(c),P=IM(u),E=kde(d,10);function A(I){if(g.current){let R=I.clientX-g.current.left,N=I.clientY-g.current.top;l({x:R,y:N})}}return er.useEffect(()=>{let I=R=>{let N=R.target;m?.contains(N)&&O(R,x)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[S,m,x,O]),er.useEffect(P,[n,P]),Rz(m,E),Rz(p.content,E),(0,ci.jsx)(_Tn,{scope:r,scrollbar:m,hasThumb:o,onThumbChange:IM(i),onThumbPointerUp:IM(a),onThumbPositionChange:P,onThumbPointerDown:IM(s),children:(0,ci.jsx)(Az.div,{...f,ref:b,style:{position:"absolute",...f.style},onPointerDown:MM(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),g.current=m.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),A(I))}),onPointerMove:MM(t.onPointerMove,A),onPointerUp:MM(t.onPointerUp,I=>{let R=I.target;R.hasPointerCapture(I.pointerId)&&R.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=y.current,p.viewport&&(p.viewport.style.scrollBehavior=""),g.current=null})})})}),Nde="ScrollAreaThumb",J$e=er.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=cKt(Nde,t.__scopeScrollArea);return(0,ci.jsx)(Iz,{present:r||o.hasThumb,children:(0,ci.jsx)(vTn,{ref:e,...n})})}),vTn=er.forwardRef((t,e)=>{let{__scopeScrollArea:r,style:n,...o}=t,i=ty(Nde,r),a=cKt(Nde,r),{onThumbPositionChange:s}=a,u=mE(e,d=>a.onThumbChange(d)),l=er.useRef(void 0),c=kde(()=>{l.current&&(l.current(),l.current=void 0)},100);return er.useEffect(()=>{let d=i.viewport;if(d){let f=()=>{if(c(),!l.current){let p=xTn(d,s);l.current=p,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),(0,ci.jsx)(Az.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:MM(t.onPointerDownCapture,d=>{let p=d.target.getBoundingClientRect(),m=d.clientX-p.left,h=d.clientY-p.top;a.onThumbPointerDown({x:m,y:h})}),onPointerUp:MM(t.onPointerUp,a.onThumbPointerUp)})});J$e.displayName=Nde;var Y$e="ScrollAreaCorner",fKt=er.forwardRef((t,e)=>{let r=ty(Y$e,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?(0,ci.jsx)(wTn,{...t,ref:e}):null});fKt.displayName=Y$e;var wTn=er.forwardRef((t,e)=>{let{__scopeScrollArea:r,...n}=t,o=ty(Y$e,r),[i,a]=er.useState(0),[s,u]=er.useState(0),l=!!(i&&s);return Rz(o.scrollbarX,()=>{let c=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(c),u(c)}),Rz(o.scrollbarY,()=>{let c=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(c),a(c)}),l?(0,ci.jsx)(Az.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 Dde(t){return t?parseInt(t,10):0}function pKt(t,e){let r=t/e;return isNaN(r)?0:r}function Fde(t){let e=pKt(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function STn(t,e,r,n="ltr"){let o=Fde(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 mKt([u,l],d)(t)}function nKt(t,e,r="ltr"){let n=Fde(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=rKt(t,u);return mKt([0,a],[0,s])(l)}function mKt(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 hKt(t,e){return t>0&&t{})=>{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 kde(t,e){let r=IM(t),n=er.useRef(0);return er.useEffect(()=>()=>window.clearTimeout(n.current),[]),er.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function Rz(t,e){let r=IM(e);O9(()=>{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 Z$e=aKt,gKt=uKt;var yKt=fKt;Tn();var $de=nC.forwardRef(({className:t,children:e,...r},n)=>nC.createElement(Z$e,{ref:n,className:_e("tw-relative tw-overflow-hidden",t),...r},nC.createElement(gKt,{className:"tw-size-full tw-rounded-[inherit] [&>div:first-child]:!tw-block"},e),nC.createElement(bKt,null),nC.createElement(yKt,null)));$de.displayName=Z$e.displayName;var bKt=nC.forwardRef(({className:t,orientation:e="vertical",...r},n)=>nC.createElement(Lde,{ref:n,orientation:e,className:_e("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},nC.createElement(J$e,{className:"tw-relative tw-flex-1 tw-rounded-full tw-bg-[var(--background-modifier-border)]"})));bKt.displayName=Lde.displayName;var jz=F(X());var Bde=F(X());Tn();var mo=Bde.forwardRef(({className:t,type:e,...r},n)=>Bde.createElement("input",{type:e,className:_e("!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}));mo.displayName="Input";ti();bn();var qde=({value:t,onChange:e,placeholder:r="Search..."})=>jz.default.createElement("div",{className:"tw-relative"},jz.default.createElement(mo,{type:"text",placeholder:r,value:t,onChange:n=>e(n.target.value),className:"tw-pr-10"}),t&&jz.default.createElement(ge,{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"},jz.default.createElement(_T,{className:"tw-size-4 tw-text-muted/60 hover:tw-text-accent-hover"})),jz.default.createElement(d1,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-text-muted"}));var Ude=F(X());var xKt=F(X(),1);var _Kt=F(X(),1),OTn=F(ds(),1);a1();var vKt=F(pt(),1),PTn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wKt=PTn.reduce((t,e)=>{let r=JC(`Primitive.${e}`),n=_Kt.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,vKt.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var CKt=F(pt(),1),ETn="Separator",SKt="horizontal",TTn=["horizontal","vertical"],OKt=xKt.forwardRef((t,e)=>{let{decorative:r,orientation:n=SKt,...o}=t,i=ATn(n)?n:SKt,s=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return(0,CKt.jsx)(wKt.div,{"data-orientation":i,...s,...o,ref:e})});OKt.displayName=ETn;function ATn(t){return TTn.includes(t)}var X$e=OKt;Tn();var P9=Ude.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},o)=>Ude.createElement(X$e,{ref:o,decorative:r,orientation:e,className:_e("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}));P9.displayName=X$e.displayName;Tn();_g();yn();bn();var Hde=require("obsidian"),Ne=F(X()),EKt=F(Dc());function MTn({extension:t,size:e="tw-size-4"}){let r=t.toLowerCase().replace("*.","");return["jpg","jpeg","png","gif","svg"].includes(r)?Ne.default.createElement(v3,{className:`tw-text-context-manager-blue ${e}`}):["mp3","wav","ogg"].includes(r)?Ne.default.createElement(_3,{className:`tw-text-context-manager-purple ${e}`}):["mp4","mov","avi"].includes(r)?Ne.default.createElement(x3,{className:`tw-text-context-manager-orange ${e}`}):["md","txt","mdx","markdown"].includes(r)?Ne.default.createElement(Ay,{className:`${e}`}):Ne.default.createElement(Ay,{className:`tw-text-faint ${e}`})}var Q$e=({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(vo,{delayDuration:0},Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(di,{className:"tw-ml-2 tw-size-4 tw-text-muted"})),Ne.default.createElement(Mt,null,Ne.default.createElement("div",{className:"tw-max-w-80"},o))))),Ne.default.createElement(ge,{variant:"ghost",size:"fit",className:"tw-text-muted hover:tw-bg-secondary",title:`Add new ${e.toLowerCase()}`,onClick:n},Ne.default.createElement(Am,{className:`tw-size-4 ${r}`}))),PKt=({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(Q$e,{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:_e("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(TM,{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(Vi,{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 RTn({item:t,viewMode:e,onDelete:r}){let n=t.id.split(".").pop()||"",o=t.isIgnored?Mm:Vi;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(MTn,{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(TM,{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(TM,{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 jTn({initialProject:t,onSave:e,onCancel:r,app:n}){let{inclusions:o,exclusions:i}=(0,Ne.useMemo)(()=>rf({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)((B,q,K)=>{let H=B.filter(Oe=>eu(Oe,q,K)),ee=(Oe,le,Be,ze)=>{le&&le.forEach(rt=>{let cr={[Be]:[rt]};eu(Oe,cr,null)&&!ze[rt].some(Sn=>Sn.id===Oe.path)&&ze[rt].push({id:Oe.path,name:Oe.basename})})},U={},W={},Y={},ae=[];return(q?.tagPatterns??[]).forEach(Oe=>{U[Oe]=[]}),(q?.folderPatterns??[]).forEach(Oe=>{W[Oe]=[]}),(q?.extensionPatterns??[]).forEach(Oe=>{Y[Oe]=[]}),H.forEach(Oe=>{ee(Oe,q?.tagPatterns,"tagPatterns",U),ee(Oe,q?.folderPatterns,"folderPatterns",W),ee(Oe,q?.extensionPatterns,"extensionPatterns",Y),q?.notePatterns&&eu(Oe,{notePatterns:q.notePatterns},null)&&!ae.some(le=>le.id===Oe.path)&&ae.push({id:Oe.path,name:Oe.basename})}),{tags:U,folders:W,extensions:Y,notes:ae}},[]),[u,l]=(0,Ne.useState)(()=>s(a,o,i)),[c,d]=(0,Ne.useState)(()=>{let B=a.filter(q=>i&&eu(q,i,null));return{files:new Set(B)}}),f=(0,Ne.useRef)(u),p=(0,Ne.useRef)(c),[m,h]=(0,Ne.useState)(""),[b,g]=(0,Ne.useState)(null),[y,S]=(0,Ne.useState)(null),x=(0,Ne.useCallback)((B,q)=>{let K=Object.keys(B.tags),H=Object.keys(B.folders),ee=Object.keys(B.extensions),U=B.notes.map(W=>{let Y=q.find(ae=>ae.path===W.id);if(Y)return q8(Y)}).filter(Boolean);return B8({tagPatterns:K,folderPatterns:H,extensionPatterns:ee,notePatterns:U})},[]),O=(0,Ne.useCallback)(B=>{let q=new Array(...B.files).map(K=>q8(K));return B8({notePatterns:q})||""},[]);(0,Ne.useEffect)(()=>{f.current=u,p.current=c},[u,c]);let P=(0,Ne.useMemo)(()=>{let B=[],q=(H,ee)=>{ee.forEach(U=>{H.some(W=>W.id===U.id)||H.push({id:U.id,name:U.name})})};return[u.tags,u.folders,u.extensions,{notes:u.notes}].forEach(H=>{Object.values(H).forEach(ee=>{q(B,ee)})}),B},[u]),E=(0,Ne.useCallback)(B=>{let q=[],K=[],H=[];return B.split(",").map(U=>U.trim()).filter(U=>U).forEach(U=>{U.startsWith("#")?q.push(U.substring(1)):U.startsWith(".")||U.startsWith("*.")?H.push(U.replace("*","")):K.push(U)}),{tags:q,titles:K,extensions:H}},[]),A=(0,Ne.useMemo)(()=>{if(m){let B=E(m);return P.filter(q=>{let K=a.find(ae=>ae.path===q.id);if(!K)return!1;let H=K.extension==="md",ee=B.tags.length>0&&H&&B.tags.some(ae=>NR(K).some(le=>(le.startsWith("#")?le.substring(1):le).toLowerCase().includes(ae.toLowerCase()))),U=B.titles.length>0&&B.titles.some(ae=>K.basename.toLowerCase().includes(ae.toLowerCase())),W=B.extensions.length>0&&B.extensions.some(ae=>`.${K.extension}`.toLowerCase()===ae.toLowerCase());return B.tags.length>0||B.titles.length>0||B.extensions.length>0?ee||U||W:!1}).map(q=>({id:q.id,name:q.name}))}if(b==="tags"&&y){let B=u.tags[y];return B||[]}if(b==="folders"&&y){let B=u.folders[y];return B||[]}if(b==="files")return u.notes;if(b==="extensions"&&y){let B=u.extensions[y];return B||[]}return b==="ignoreFiles"?Array.from(c.files).map(B=>({id:B.path,name:B.basename})):[]},[m,b,y,E,P,a,u.tags,u.folders,u.notes,u.extensions,c.files]),I=(0,Ne.useCallback)(B=>[...B].sort((q,K)=>q.name.toLowerCase().localeCompare(K.name.toLowerCase())),[]),R=(0,Ne.useCallback)((B,q)=>Object.entries(B).sort(([K],[H])=>K.localeCompare(H)).map(([K,H])=>({id:K,name:q?q(K):K,count:H.length})),[]),N=(0,Ne.useCallback)((B,q,K)=>{let H=W=>a.filter(Y=>eu(Y,W,null)).map(Y=>({id:Y.path,name:Y.basename})),ee=[...p.current.files],U=H(K).map(W=>({...W,isIgnored:ee.some(Y=>Y.path===W.id)}));l(W=>({...W,[B]:{...W[B],[q]:U}}))},[a]),j=(0,Ne.useCallback)((B,q)=>{let K={tags:{...B.tags},folders:{...B.folders},extensions:{...B.extensions},notes:[...B.notes]},H=ee=>{Object.keys(ee).forEach(U=>{ee[U]=ee[U].filter(W=>W.id!==q)})};return H(K.tags),H(K.folders),H(K.extensions),K.notes=K.notes.filter(ee=>ee.id!==q),K},[]),$=(0,Ne.useCallback)((B,q=null,K=!0)=>{g(B),S(q),K&&h("")},[]),k=(0,Ne.useMemo)(()=>{let B=q=>(K,H)=>{K.stopPropagation(),l(ee=>{let U={...ee[q]};return delete U[H.id],{...ee,[q]:U}})};return{delete:{tag:B("tags"),folder:B("folders"),extension:B("extensions")},add:{tag:()=>{new xz(n,q=>{let K=tie(q);N("tags",K,{tagPatterns:[K]})}).open()},folder:()=>{new Sz(n,q=>{N("folders",q,{folderPatterns:[q]})}).open()},file:()=>{new _9({app:n,onFileSelect:q=>{u.notes.find(H=>H.id===q.path)||(d(H=>{let ee=new Set(H.files);return ee.delete(q),{...H,files:ee}}),l(H=>({...H,notes:[...H.notes,{id:q.path,name:q.basename}]})))},excludeFilePaths:[],titleOnly:!1}).open()},extension:()=>{new Hde.Notice("Adding extension is temporarily not supported.")},ignoreFile:()=>{new _9({app:n,onFileSelect:q=>{c.files.has(q)||(d(H=>{let ee=new Set(H.files);return ee.add(q),{...H,files:ee}}),l(H=>j(H,q.path)))},excludeFilePaths:[],titleOnly:!1}).open()}},click:{tag:q=>{$("tags",q)},folder:q=>{$("folders",q)},extension:q=>{$("extensions",q)},files:()=>{$("files")},ignoreFiles:()=>{$("ignoreFiles")}}}},[n,u.notes,c.files,N,j,$]),z=()=>m?`Search Results for: "${m}"`:b==="tags"&&y?`Tag: ${y}`:b==="folders"&&y?`Folder: ${y}`:b==="files"?"Files":b==="extensions"&&y?`Extension: ${y}`:b==="ignoreFiles"?"Ignore Files":"Select a category to view items",V=(B,q)=>{B.stopPropagation();let K=a.find(H=>H.path===q.id);K&&(d(H=>{let ee=new Set(H.files);return ee.add(K),{...H,files:ee}}),l(H=>j(H,q.id)))},Q=(0,Ne.useCallback)(()=>{let B=x(f.current,a),q=O(p.current),{inclusions:K,exclusions:H}=rf({inclusions:B,exclusions:q,isProject:!0}),ee=s(a,K,H);l(ee)},[a,O,x,s]),J=(B,q)=>{B.stopPropagation();let K=a.find(H=>H.path===q.id);K&&(d(H=>{let ee=new Set(H.files);return ee.delete(K),{...H,files:ee}}),Q())},D=()=>{let B=x(u,a),q=O(c);e({...t,contextSource:{...t.contextSource,inclusions:B,exclusions:q}})};return Ne.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ne.default.createElement(V9t,{direction:"horizontal",className:"tw-flex-1"},Ne.default.createElement(W$e,{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($de,{className:"tw-max-h-[500px] tw-flex-1"},Ne.default.createElement("div",{className:"tw-space-y-6 tw-p-4"},Ne.default.createElement(PKt,{title:"Tags",IconComponent:f1,iconColorClassName:"tw-text-context-manager-orange",items:R(u.tags,B=>B.slice(1)),activeItem:y,activeSection:b,sectionType:"tags",renderIcon:B=>Ne.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),onItemClick:k.click.tag,onAddClick:k.add.tag,onDeleteItem:(B,q)=>k.delete.tag(B,q),tooltip:"must be in note property"}),Ne.default.createElement(P9,null),Ne.default.createElement(PKt,{title:"Folders",IconComponent:Iy,iconColorClassName:"tw-text-context-manager-yellow",items:R(u.folders),activeItem:y,activeSection:b,sectionType:"folders",onItemClick:k.click.folder,onAddClick:k.add.folder,onDeleteItem:(B,q)=>k.delete.folder(B,q)}),Ne.default.createElement(P9,null),Ne.default.createElement("div",null,Ne.default.createElement(Q$e,{IconComponent:Ay,title:"Files",iconColorClassName:"tw-text-context-manager-blue",onAddClick:k.add.file}),Ne.default.createElement("div",{className:_e("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",b==="files"&&"tw-bg-secondary tw-text-normal"),onClick:k.click.files},"Files (",u.notes.length,")")),Ne.default.createElement(P9,null),Ne.default.createElement("div",null,Ne.default.createElement(Q$e,{IconComponent:Vi,title:"Ignore Files",iconColorClassName:"tw-text-context-manager-red",onAddClick:k.add.ignoreFile}),Ne.default.createElement("div",{className:_e("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",b==="ignoreFiles"&&"tw-bg-secondary tw-text-normal"),onClick:k.click.ignoreFiles},"Ignore Files (",c.files.size,")")))))),Ne.default.createElement(W9t,{withHandle:!0}),Ne.default.createElement(W$e,{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(qde,{placeholder:"Custom search: title, #tag1, .jpg",value:m,onChange:B=>{h(B),B&&$("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"},z())),Ne.default.createElement($de,{className:"tw-max-h-[400px] tw-flex-1 tw-p-4 tw-pt-0"},A.length===0?Ne.default.createElement("div",{className:"tw-mt-10 tw-text-center tw-text-muted"},b?"No items found.":"Select a category from the sidebar to view items."):Ne.default.createElement("div",{className:"tw-space-y-2",style:{display:"block"}},I(A).map(B=>Ne.default.createElement(RTn,{key:B.id,item:B,viewMode:"list",onDelete:b==="ignoreFiles"||B.isIgnored?J:V}))))))),Ne.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2 tw-border-t tw-p-1"},Ne.default.createElement(ge,{variant:"ghost",onClick:r},"Cancel"),Ne.default.createElement(ge,{onClick:D},"Save")))}var zde=class extends Hde.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r,modalEl:n}=this;this.root=(0,EKt.createRoot)(r),n.style.minWidth="50vw";let o=a=>{this.onSave(a),this.close()},i=()=>{this.close()};this.root.render(Ne.default.createElement(jTn,{initialProject:this.initialProject,onSave:o,onCancel:i,app:this.app}))}onClose(){this.root&&this.root.unmount()}};ti();var Dz=F(X());var Vde=F(X());var jKt=F(X(),1);var AKt=F(X(),1),IKt=F(ds(),1);var yd=F(X(),1);var TKt=F(X(),1);function NTn(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function sL(...t){return e=>t.forEach(r=>NTn(r,e))}function Ri(...t){return TKt.useCallback(sL(...t),t)}var Nz=F(pt(),1),tBe=yd.forwardRef((t,e)=>{let{children:r,...n}=t,o=yd.Children.toArray(r),i=o.find(LTn);if(i){let a=i.props.children,s=o.map(u=>u===i?yd.Children.count(a)>1?yd.Children.only(null):yd.isValidElement(a)?a.props.children:null:u);return(0,Nz.jsx)(eBe,{...n,ref:e,children:yd.isValidElement(a)?yd.cloneElement(a,void 0,s):null})}return(0,Nz.jsx)(eBe,{...n,ref:e,children:r})});tBe.displayName="Slot";var eBe=yd.forwardRef((t,e)=>{let{children:r,...n}=t;if(yd.isValidElement(r)){let o=kTn(r);return yd.cloneElement(r,{...FTn(n,r.props),ref:e?sL(e,o):o})}return yd.Children.count(r)>1?yd.Children.only(null):null});eBe.displayName="SlotClone";var DTn=({children:t})=>(0,Nz.jsx)(Nz.Fragment,{children:t});function LTn(t){return yd.isValidElement(t)&&t.type===DTn}function FTn(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 kTn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var MKt=F(pt(),1),$Tn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ho=$Tn.reduce((t,e)=>{let r=AKt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?tBe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,MKt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function RKt(t,e){t&&IKt.flushSync(()=>t.dispatchEvent(e))}var NKt=F(pt(),1),BTn="Label",DKt=jKt.forwardRef((t,e)=>(0,NKt.jsx)(ho.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));DKt.displayName=BTn;var rBe=DKt;k7();Tn();var UTn=ek("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),ip=Vde.forwardRef(({className:t,...e},r)=>Vde.createElement(rBe,{ref:r,className:_e(UTn(),t),...e}));ip.displayName=rBe.displayName;var Yn=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>Dz.default.createElement("div",{className:"tw-space-y-2"},Dz.default.createElement(ip,{className:r?"tw-text-error":""},t," ",e&&Dz.default.createElement("span",{className:"tw-text-error"},"*")),n&&Dz.default.createElement("p",{className:"tw-text-sm tw-text-muted"},n),i,r&&Dz.default.createElement("p",{className:"tw-text-xs tw-text-error"},o));var uL=F(X());Tn();bn();function Wde({options:t,placeholder:e,containerClassName:r,className:n,...o}){return uL.default.createElement("div",{className:_e("tw-group tw-relative tw-w-full",r)},uL.default.createElement("select",{className:_e("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&&uL.default.createElement("option",{value:"",disabled:!0},e),t.map(i=>uL.default.createElement("option",{key:i.value,value:i.value},i.label))),uL.default.createElement("div",{className:_e("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")},uL.default.createElement(Hi,{className:"tw-size-4"})))}var jM=F(X());Tn();var lL=F(X());var Bi=F(X(),1);function Lz(t,[e,r]){return Math.min(r,Math.max(e,t))}function xi(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Kde=F(X(),1);function Fz(t){let e=Kde.useRef({value:t,previous:t});return Kde.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var RM=F(X(),1);var gE=F(X(),1),LKt=F(pt(),1);function FKt(t,e=[]){let r=[];function n(i,a){let s=gE.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,b=gE.useMemo(()=>m,Object.values(m));return(0,LKt.jsx)(h.Provider,{value:b,children:p})}function c(d,f){let p=f?.[t][u]||s,m=gE.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>gE.createContext(a));return function(s){let u=s?.[t]||i;return gE.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,zTn(o,...e)]}function zTn(...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 gE.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var bd=F(X(),1);var kz=F(pt(),1),Gde=bd.forwardRef((t,e)=>{let{children:r,...n}=t,o=bd.Children.toArray(r),i=o.find(VTn);if(i){let a=i.props.children,s=o.map(u=>u===i?bd.Children.count(a)>1?bd.Children.only(null):bd.isValidElement(a)?a.props.children:null:u);return(0,kz.jsx)(nBe,{...n,ref:e,children:bd.isValidElement(a)?bd.cloneElement(a,void 0,s):null})}return(0,kz.jsx)(nBe,{...n,ref:e,children:r})});Gde.displayName="Slot";var nBe=bd.forwardRef((t,e)=>{let{children:r,...n}=t;if(bd.isValidElement(r)){let o=KTn(r);return bd.cloneElement(r,{...WTn(n,r.props),ref:e?sL(e,o):o})}return bd.Children.count(r)>1?bd.Children.only(null):null});nBe.displayName="SlotClone";var HTn=({children:t})=>(0,kz.jsx)(kz.Fragment,{children:t});function VTn(t){return bd.isValidElement(t)&&t.type===HTn}function WTn(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 KTn(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 Jde=F(pt(),1);function Yde(t){let e=t+"CollectionProvider",[r,n]=FKt(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=RM.default.useRef(null),g=RM.default.useRef(new Map).current;return(0,Jde.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=RM.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),y=Ri(m,g.collectionRef);return(0,Jde.jsx)(Gde,{ref:y,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=RM.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,y=RM.default.useRef(null),S=Ri(m,y),x=i(l,h);return RM.default.useEffect(()=>(x.itemMap.set(y,{ref:y,...g}),()=>void x.itemMap.delete(y))),(0,Jde.jsx)(Gde,{[c]:"",ref:S,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return RM.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,O)=>g.indexOf(x.ref.current)-g.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Bl=F(pt(),1),kKt=["PageUp","PageDown"],$Kt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],BKt={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},$z="Slider",[oBe,GTn,JTn]=Yde($z),[qKt,$gi]=Yi($z,[JTn]),[YTn,Zde]=qKt($z),UKt=Bi.forwardRef((t,e)=>{let{name:r,min:n=0,max:o=100,step:i=1,orientation:a="horizontal",disabled:s=!1,minStepsBetweenThumbs:u=0,defaultValue:l=[n],value:c,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:m,...h}=t,b=Bi.useRef(new Set),g=Bi.useRef(0),S=a==="horizontal"?ZTn:XTn,[x=[],O]=ud({prop:c,defaultProp:l,onChange:N=>{[...b.current][g.current]?.focus(),d(N)}}),P=Bi.useRef(x);function E(N){let j=nAn(x,N);R(N,j)}function A(N){R(N,g.current)}function I(){let N=P.current[g.current];x[g.current]!==N&&f(x)}function R(N,j,{commit:$}={commit:!1}){let k=sAn(i),z=uAn(Math.round((N-n)/i)*i+n,k),V=Lz(z,[n,o]);O((Q=[])=>{let J=tAn(Q,V,j);if(aAn(J,u*i)){g.current=J.indexOf(V);let D=String(J)!==String(Q);return D&&$&&f(J),D?J:Q}else return Q})}return(0,Bl.jsx)(YTn,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:b.current,values:x,orientation:a,form:m,children:(0,Bl.jsx)(oBe.Provider,{scope:t.__scopeSlider,children:(0,Bl.jsx)(oBe.Slot,{scope:t.__scopeSlider,children:(0,Bl.jsx)(S,{"aria-disabled":s,"data-disabled":s?"":void 0,...h,ref:e,onPointerDown:xi(h.onPointerDown,()=>{s||(P.current=x)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:E,onSlideMove:s?void 0:A,onSlideEnd:s?void 0:I,onHomeKeyDown:()=>!s&&R(n,0,{commit:!0}),onEndKeyDown:()=>!s&&R(o,x.length-1,{commit:!0}),onStepKeyDown:({event:N,direction:j})=>{if(!s){let z=kKt.includes(N.key)||N.shiftKey&&$Kt.includes(N.key)?10:1,V=g.current,Q=x[V],J=i*z*j;R(Q+J,V,{commit:!0})}}})})})})});UKt.displayName=$z;var[zKt,HKt]=qKt($z,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ZTn=Bi.forwardRef((t,e)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=t,[d,f]=Bi.useState(null),p=Ri(e,S=>f(S)),m=Bi.useRef(),h=nM(o),b=h==="ltr",g=b&&!i||!b&&i;function y(S){let x=m.current||d.getBoundingClientRect(),O=[0,x.width],E=sBe(O,g?[r,n]:[n,r]);return m.current=x,E(S-x.left)}return(0,Bl.jsx)(zKt,{scope:t.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:(0,Bl.jsx)(VKt,{dir:h,"data-orientation":"horizontal",...c,ref:p,style:{...c.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:S=>{let x=y(S.clientX);a?.(x)},onSlideMove:S=>{let x=y(S.clientX);s?.(x)},onSlideEnd:()=>{m.current=void 0,u?.()},onStepKeyDown:S=>{let O=BKt[g?"from-left":"from-right"].includes(S.key);l?.({event:S,direction:O?-1:1})}})})}),XTn=Bi.forwardRef((t,e)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=t,c=Bi.useRef(null),d=Ri(e,c),f=Bi.useRef(),p=!o;function m(h){let b=f.current||c.current.getBoundingClientRect(),g=[0,b.height],S=sBe(g,p?[n,r]:[r,n]);return f.current=b,S(h-b.top)}return(0,Bl.jsx)(zKt,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,Bl.jsx)(VKt,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{let b=m(h.clientY);i?.(b)},onSlideMove:h=>{let b=m(h.clientY);a?.(b)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:h=>{let g=BKt[p?"from-bottom":"from-top"].includes(h.key);u?.({event:h,direction:g?-1:1})}})})}),VKt=Bi.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=Zde($z,r);return(0,Bl.jsx)(ho.span,{...l,ref:e,onKeyDown:xi(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):kKt.concat($Kt).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:xi(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:xi(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:xi(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),WKt="SliderTrack",KKt=Bi.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=Zde(WKt,r);return(0,Bl.jsx)(ho.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});KKt.displayName=WKt;var iBe="SliderRange",GKt=Bi.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=Zde(iBe,r),i=HKt(iBe,r),a=Bi.useRef(null),s=Ri(e,a),u=o.values.length,l=o.values.map(f=>YKt(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,Bl.jsx)(ho.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});GKt.displayName=iBe;var aBe="SliderThumb",JKt=Bi.forwardRef((t,e)=>{let r=GTn(t.__scopeSlider),[n,o]=Bi.useState(null),i=Ri(e,s=>o(s)),a=Bi.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,Bl.jsx)(QTn,{...t,ref:i,index:a})}),QTn=Bi.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=Zde(aBe,r),s=HKt(aBe,r),[u,l]=Bi.useState(null),c=Ri(e,y=>l(y)),d=u?a.form||!!u.closest("form"):!0,f=Qx(u),p=a.values[n],m=p===void 0?0:YKt(p,a.min,a.max),h=rAn(n,a.values.length),b=f?.[s.size],g=b?oAn(b,m,s.direction):0;return Bi.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,Bl.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${m}% + ${g}px)`},children:[(0,Bl.jsx)(oBe.ItemSlot,{scope:t.__scopeSlider,children:(0,Bl.jsx)(ho.span,{role:"slider","aria-label":t["aria-label"]||h,"aria-valuemin":a.min,"aria-valuenow":p,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:c,style:p===void 0?{display:"none"}:t.style,onFocus:xi(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,Bl.jsx)(eAn,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});JKt.displayName=aBe;var eAn=t=>{let{value:e,...r}=t,n=Bi.useRef(null),o=Fz(e);return Bi.useEffect(()=>{let i=n.current,a=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(a,"value").set;if(o!==e&&u){let l=new Event("input",{bubbles:!0});u.call(i,e),i.dispatchEvent(l)}},[o,e]),(0,Bl.jsx)("input",{style:{display:"none"},...r,ref:n,defaultValue:e})};function tAn(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function YKt(t,e,r){let i=100/(r-e)*(t-e);return Lz(i,[0,100])}function rAn(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function nAn(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 oAn(t,e,r){let n=t/2,i=sBe([0,50],[0,n]);return(n-i(e)*r)*r}function iAn(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function aAn(t,e){if(e>0){let r=iAn(t);return Math.min(...r)>=e}return!0}function sBe(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 sAn(t){return(String(t).split(".")[1]||"").length}function uAn(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var uBe=UKt,ZKt=KKt,XKt=GKt,QKt=JKt;Tn();var lBe=lL.forwardRef(({className:t,...e},r)=>lL.createElement(uBe,{ref:r,className:_e("tw-relative tw-flex tw-w-full tw-touch-none tw-select-none tw-items-center",t),...e},lL.createElement(ZKt,{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"},lL.createElement(XKt,{className:"tw-absolute tw-h-full tw-bg-interactive-accent"})),lL.createElement(QKt,{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"})));lBe.displayName=uBe.displayName;function oC({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a}){let[s,u]=(0,jM.useState)(t);return(0,jM.useEffect)(()=>{u(t)},[t]),jM.default.createElement("div",{className:_e("tw-flex tw-items-center tw-gap-4",a)},jM.default.createElement(lBe,{value:[s],onValueChange:([l])=>u(l),onValueCommit:([l])=>e?.(l),min:r,max:n,step:o,disabled:i,className:"tw-flex-1"}),jM.default.createElement("div",{className:"tw-min-w-[40px] tw-text-right tw-text-sm"},s))}var ry=F(X());Tn();var yE=ry.forwardRef(({className:t,value:e,...r},n)=>{let o=ry.useRef(null),i=ry.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);ry.useLayoutEffect(()=>{i()},[e,i]),ry.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 ry.createElement("textarea",{className:_e("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})});yE.displayName="Textarea";$r();_g();nr();yn();bn();var Bz=require("obsidian"),Kt=F(X()),eGt=F(Dc());function cAn({initialProject:t,onSave:e,onCancel:r}){let n=Rn(),[o,i]=(0,Kt.useState)(!1),[a,s]=(0,Kt.useState)({name:!1,systemPrompt:!1,projectModelKey:!1,inclusions:!1}),[u,l]=(0,Kt.useState)(t||{id:wVe(),name:"",description:"",systemPrompt:"",projectModelKey:"",modelConfigs:{temperature:jh.TEMPERATURE,maxTokens:jh.MAX_TOKENS},contextSource:{inclusions:"",exclusions:"",webUrls:"",youtubeUrls:""},created:Date.now(),UsageTimestamps:Date.now()}),c=bg(u.contextSource.inclusions||u.contextSource.exclusions||"nothing").reverse().join(","),d=h=>{new zde(app,async g=>{l(g)},h).open()},f=()=>u.name&&u.projectModelKey,p=(h,b)=>{l(g=>{if(typeof b=="string"&&h==="projectModelKey"&&(b=b.trim()),Array.isArray(b)&&b.every(y=>typeof y=="string")&&(b=b.map(y=>y.trim()).filter(Boolean)),h.includes(".")){let[y,S]=h.split("."),O=g[y];if(typeof O=="object"&&O!==null)return{...g,[y]:{...O,[S]:b}}}return{...g,[h]:b}})},m=async()=>{u.name&&(u.name=u.name.trim());let b=["name","projectModelKey"].filter(g=>!u[g]);if(b.length>0){s(g=>({...g,...Object.fromEntries(b.map(y=>[y,!0]))})),new Bz.Notice("Please fill in all required fields");return}try{i(!0),await e(u)}catch(g){new Bz.Notice(ei(g)),s(y=>({...y,name:!0}))}finally{i(!1)}};return Kt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-p-4"},Kt.default.createElement("div",{className:"tw-mb-2 tw-text-xl tw-font-bold tw-text-normal"},t?"Edit Project":"New Project"),Kt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Kt.default.createElement(Yn,{label:"Project Name",required:!0,error:a.name&&!u.name,errorMessage:"Project name is required"},Kt.default.createElement(mo,{type:"text",value:u.name,onChange:h=>p("name",h.target.value),onBlur:()=>s(h=>({...h,name:!0})),className:"tw-w-full"})),Kt.default.createElement(Yn,{label:"Description",description:"Briefly describe the purpose and goals of the project"},Kt.default.createElement(mo,{type:"text",value:u.description,onChange:h=>p("description",h.target.value),className:"tw-w-full"})),Kt.default.createElement(Yn,{label:"Project System Prompt",description:"Custom instructions for how the AI should behave in this project context"},Kt.default.createElement(yE,{value:u.systemPrompt,onChange:h=>p("systemPrompt",h.target.value),onBlur:()=>s(h=>({...h,systemPrompt:!0})),className:"tw-min-h-32"})),Kt.default.createElement(Yn,{label:"Default Model",required:!0,error:a.projectModelKey&&!u.projectModelKey,errorMessage:"Default model is required"},Kt.default.createElement(Wde,{value:u.projectModelKey,onChange:h=>{let b=h.target.value,g=n.activeModels.find(x=>x.enabled&&kr(x)===b);if(!g)return;let{hasApiKey:y,errorNotice:S}=hF(g,n);if(!y&&S){new Bz.Notice(S);return}p("projectModelKey",b)},onBlur:()=>s(h=>({...h,projectModelKey:!0})),placeholder:"Select a model",options:n.activeModels.filter(h=>h.enabled&&h.projectEnabled).map(h=>({label:e9(h),value:kr(h)}))})),Kt.default.createElement("div",{className:"tw-space-y-4"},Kt.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Model Configuration"),Kt.default.createElement("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4"},Kt.default.createElement(Yn,{label:"Temperature"},Kt.default.createElement(oC,{value:u.modelConfigs?.temperature??jh.TEMPERATURE,onChange:h=>p("modelConfigs.temperature",h),min:0,max:2,step:.01,className:"tw-w-full"})),Kt.default.createElement(Yn,{label:"Token Limit"},Kt.default.createElement(oC,{value:u.modelConfigs?.maxTokens??jh.MAX_TOKENS,onChange:h=>p("modelConfigs.maxTokens",h),min:1,max:65e3,step:1,className:"tw-w-full"})))),Kt.default.createElement("div",{className:"tw-space-y-4"},Kt.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Context Sources"),Kt.default.createElement(Yn,{label:Kt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Kt.default.createElement("span",null,"File Context"),Kt.default.createElement(vo,{delayDuration:0},Kt.default.createElement(Rt,null,Kt.default.createElement(jt,{asChild:!0},Kt.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Kt.default.createElement(Mt,null,Kt.default.createElement("div",{className:"tw-max-w-80"},Kt.default.createElement("strong",null,"Supported File Types:"),Kt.default.createElement("br",null),Kt.default.createElement("strong",null,"\u2022 Documents:")," pdf, doc, docx, ppt, pptx, epub, txt, rtf and many more",Kt.default.createElement("br",null),Kt.default.createElement("strong",null,"\u2022 Images:")," jpg, png, svg, gif, bmp, webp, tiff",Kt.default.createElement("br",null),Kt.default.createElement("strong",null,"\u2022 Spreadsheets:")," xlsx, xls, csv, numbers",Kt.default.createElement("br",null),Kt.default.createElement("br",null),"Non-markdown files are converted to markdown in the background.",Kt.default.createElement("br",null),Kt.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."},Kt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Kt.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-row"},Kt.default.createElement(TM,{className:"tw-max-w-[100px] tw-text-sm tw-text-accent"},c)),Kt.default.createElement(ge,{variant:"secondary",onClick:()=>{d(u)}},"Manage Context"))),Kt.default.createElement(Yn,{label:"Web URLs"},Kt.default.createElement(yE,{value:u.contextSource?.webUrls,onChange:h=>{let g=h.target.value.split(` `).map(y=>{if(!y.trim())return y;try{return new URL(y.trim()),y}catch{return y}});p("contextSource.webUrls",g.join(` `))},placeholder:"Enter web URLs, one per line",className:"tw-min-h-20 tw-w-full"})),Kt.default.createElement(Yn,{label:"YouTube URLs"},Kt.default.createElement(yE,{value:u.contextSource?.youtubeUrls,onChange:h=>{let g=h.target.value.split(` `).map(y=>{if(!y.trim())return y;try{let S=new URL(y.trim());return S.hostname.includes("youtube.com")||S.hostname.includes("youtu.be"),y}catch{return y}});p("contextSource.youtubeUrls",g.join(` -`))},placeholder:"Enter YouTube URLs, one per line",className:"tw-min-h-20 tw-w-full"})))),Kt.default.createElement("div",{className:"tw-mt-4 tw-flex tw-items-center tw-justify-end tw-gap-2"},Kt.default.createElement(ge,{variant:"ghost",onClick:r,disabled:o},"Cancel"),Kt.default.createElement(ge,{onClick:m,disabled:o||!f()},o?"Saving...":"Save")))}var P9=class extends $z.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r}=this;this.root=(0,JKt.createRoot)(r);let n=async i=>{await this.onSave(i),this.close()},o=()=>{this.close()};this.root.render(Kt.default.createElement(iAn,{initialProject:this.initialProject,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};ti();var ji=F(X());var ct=F(X(),1),IBe=F(ds(),1);var ns=F(X(),1);var lBe=F(ft(),1),aAn="DismissableLayer",uBe="dismissableLayer.update",sAn="dismissableLayer.pointerDownOutside",uAn="dismissableLayer.focusOutside",YKt,XKt=ns.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),cBe=ns.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=ns.useContext(XKt),[c,d]=ns.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=ns.useState({}),m=Ri(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=dAn(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=fAn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return oM(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),ns.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(YKt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),ZKt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=YKt)}},[c,f,r,l]),ns.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),ZKt())},[c,l]),ns.useEffect(()=>{let E=()=>p({});return document.addEventListener(uBe,E),()=>document.removeEventListener(uBe,E)},[]),(0,lBe.jsx)(ho.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:xi(t.onFocusCapture,P.onFocusCapture),onBlurCapture:xi(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:xi(t.onPointerDownCapture,O.onPointerDownCapture)})});cBe.displayName=aAn;var lAn="DismissableLayerBranch",cAn=ns.forwardRef((t,e)=>{let r=ns.useContext(XKt),n=ns.useRef(null),o=Ri(e,n);return ns.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,lBe.jsx)(ho.div,{...t,ref:o})});cAn.displayName=lAn;function dAn(t,e=globalThis?.document){let r=Ur(t),n=ns.useRef(!1),o=ns.useRef(()=>{});return ns.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){QKt(sAn,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 fAn(t,e=globalThis?.document){let r=Ur(t),n=ns.useRef(!1);return ns.useEffect(()=>{let o=i=>{i.target&&!n.current&&QKt(uAn,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 ZKt(){let t=new CustomEvent(uBe);document.dispatchEvent(t)}function QKt(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?EKt(o,i):o.dispatchEvent(i)}var ny=F(X(),1);var oGt=F(ft(),1),dBe="focusScope.autoFocusOnMount",fBe="focusScope.autoFocusOnUnmount",eGt={bubbles:!1,cancelable:!0},pAn="FocusScope",pBe=ny.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=ny.useState(null),l=Ur(o),c=Ur(i),d=ny.useRef(null),f=Ri(e,h=>u(h)),p=ny.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;ny.useEffect(()=>{if(n){let y=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:NM(d.current,{select:!0})},S=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||NM(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&NM(s)};var h=y,b=S,g=x;document.addEventListener("focusin",y),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),ny.useEffect(()=>{if(s){rGt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(dBe,eGt);s.addEventListener(dBe,l),s.dispatchEvent(g),g.defaultPrevented||(mAn(_An(iGt(s)),{select:!0}),document.activeElement===h&&NM(s))}return()=>{s.removeEventListener(dBe,l),setTimeout(()=>{let g=new CustomEvent(fBe,eGt);s.addEventListener(fBe,c),s.dispatchEvent(g),g.defaultPrevented||NM(h??document.body,{select:!0}),s.removeEventListener(fBe,c),rGt.remove(p)},0)}}},[s,l,c,p]);let m=ny.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let y=h.currentTarget,[S,x]=hAn(y);S&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&NM(S,{select:!0})):h.shiftKey&&g===S&&(h.preventDefault(),r&&NM(x,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,oGt.jsx)(ho.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});pBe.displayName=pAn;function mAn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(NM(n,{select:e}),document.activeElement!==r)return}function hAn(t){let e=iGt(t),r=tGt(e,t),n=tGt(e.reverse(),t);return[r,n]}function iGt(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 tGt(t,e){for(let r of t)if(!gAn(r,{upTo:e}))return r}function gAn(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 yAn(t){return t instanceof HTMLInputElement&&"select"in t}function NM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&yAn(t)&&e&&t.select()}}var rGt=bAn();function bAn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=nGt(t,e),t.unshift(e)},remove(e){t=nGt(t,e),t[0]?.resume()}}}function nGt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function _An(t){return t.filter(e=>e.tagName!=="A")}var mh=F(X(),1);var aGt=F(X(),1);var mBe=F(ft(),1),vAn="Arrow",sGt=aGt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,mBe.jsx)(ho.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,mBe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});sGt.displayName=vAn;var uGt=sGt;var bE=F(X(),1),lGt=F(ft(),1);function cGt(t,e=[]){let r=[];function n(i,a){let s=bE.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,b=bE.useMemo(()=>m,Object.values(m));return(0,lGt.jsx)(h.Provider,{value:b,children:p})}function c(d,f){let p=f?.[t][u]||s,m=bE.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>bE.createContext(a));return function(s){let u=s?.[t]||i;return bE.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,SAn(o,...e)]}function SAn(...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 bE.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var DM=F(ft(),1);var hBe="Popper",[dGt,gBe]=cGt(hBe),[xAn,fGt]=dGt(hBe),pGt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=mh.useState(null);return(0,DM.jsx)(xAn,{scope:e,anchor:n,onAnchorChange:o,children:r})};pGt.displayName=hBe;var mGt="PopperAnchor",hGt=mh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=fGt(mGt,r),a=mh.useRef(null),s=Ri(e,a);return mh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,DM.jsx)(ho.div,{...o,ref:s})});hGt.displayName=mGt;var yBe="PopperContent",[CAn,OAn]=dGt(yBe),gGt=mh.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=fGt(yBe,r),[g,y]=mh.useState(null),S=Ri(e,Y=>y(Y)),[x,O]=mh.useState(null),P=Xx(x),E=P?.width??0,A=P?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],j=N.length>0,$={padding:R,boundary:N.filter(EAn),altBoundary:j},{refs:k,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:J}=sM({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>oE(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[uM({mainAxis:o+A,alignmentAxis:a}),u&&lM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cM():void 0,...$}),u&&dM({...$}),fM({...$,apply:({elements:Y,rects:ae,availableWidth:Oe,availableHeight:le})=>{let{width:Be,height:ze}=ae.reference,rt=Y.floating.style;rt.setProperty("--radix-popper-available-width",`${Oe}px`),rt.setProperty("--radix-popper-available-height",`${le}px`),rt.setProperty("--radix-popper-anchor-width",`${Be}px`),rt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),x&&mM({element:x,padding:s}),TAn({arrowWidth:E,arrowHeight:A}),f&&pM({strategy:"referenceHidden",...$})]}),[D,B]=_Gt(V),q=Ur(m);Jn(()=>{Q&&q?.()},[Q,q]);let K=J.arrow?.x,H=J.arrow?.y,ee=J.arrow?.centerOffset!==0,[U,W]=mh.useState();return Jn(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,DM.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,DM.jsx)(CAn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:H,shouldHideArrow:ee,children:(0,DM.jsx)(ho.div,{"data-side":D,"data-align":B,...h,ref:S,style:{...h.style,animation:Q?void 0:"none"}})})})});gGt.displayName=yBe;var yGt="PopperArrow",PAn={top:"bottom",right:"left",bottom:"top",left:"right"},bGt=mh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=OAn(yGt,n),a=PAn[i.placedSide];return(0,DM.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,DM.jsx)(uGt,{...o,ref:r,style:{...o.style,display:"block"}})})});bGt.displayName=yGt;function EAn(t){return t!==null}var TAn=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]=_Gt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function _Gt(t){let[e,r="center"]=t.split("-");return[e,r]}var vGt=pGt,wGt=hGt,SGt=gGt,xGt=bGt;var Jde=F(X(),1),CGt=F(ds(),1);var OGt=F(ft(),1),IAn="Portal",bBe=Jde.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Jde.useState(!1);Jn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?CGt.default.createPortal((0,OGt.jsx)(ho.div,{...n,ref:e}),a):null});bBe.displayName=IAn;var _d=F(X(),1);var Bz=F(ft(),1),vBe=_d.forwardRef((t,e)=>{let{children:r,...n}=t,o=_d.Children.toArray(r),i=o.find(RAn);if(i){let a=i.props.children,s=o.map(u=>u===i?_d.Children.count(a)>1?_d.Children.only(null):_d.isValidElement(a)?a.props.children:null:u);return(0,Bz.jsx)(_Be,{...n,ref:e,children:_d.isValidElement(a)?_d.cloneElement(a,void 0,s):null})}return(0,Bz.jsx)(_Be,{...n,ref:e,children:r})});vBe.displayName="Slot";var _Be=_d.forwardRef((t,e)=>{let{children:r,...n}=t;if(_d.isValidElement(r)){let o=NAn(r);return _d.cloneElement(r,{...jAn(n,r.props),ref:e?aL(e,o):o})}return _d.Children.count(r)>1?_d.Children.only(null):null});_Be.displayName="SlotClone";var MAn=({children:t})=>(0,Bz.jsx)(Bz.Fragment,{children:t});function RAn(t){return _d.isValidElement(t)&&t.type===MAn}function jAn(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 NAn(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 PGt=F(X(),1);var EGt=F(ft(),1),DAn="VisuallyHidden",wBe=PGt.forwardRef((t,e)=>(0,EGt.jsx)(ho.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}}));wBe.displayName=DAn;var Xde=F(X());var hf=F(X());var Yde=HD();var SBe=function(){},E9=hf.forwardRef(function(t,e){var r=hf.useRef(null),n=hf.useState({onScrollCapture:SBe,onWheelCapture:SBe,onTouchMoveCapture:SBe}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,b=t.as,g=b===void 0?"div":b,y=t.gapMode,S=_M(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=zD([r,e]),P=yi(yi({},S),o);return hf.createElement(hf.Fragment,null,c&&hf.createElement(x,{sideCar:Yde,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:y}),a?hf.cloneElement(hf.Children.only(s),yi(yi({},P),{ref:O})):hf.createElement(g,yi({},P,{className:u,ref:O}),s))});E9.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};E9.classNames={fullWidth:Sb,zeroRight:wb};var _a=F(X());var xBe=!1;if(typeof window<"u")try{T9=Object.defineProperty({},"passive",{get:function(){return xBe=!0,!0}}),window.addEventListener("test",T9,T9),window.removeEventListener("test",T9,T9)}catch{xBe=!1}var T9,lL=xBe?{passive:!1}:!1;var LAn=function(t){return t.tagName==="TEXTAREA"},TGt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!LAn(t)&&r[e]==="visible")},FAn=function(t){return TGt(t,"overflowY")},kAn=function(t){return TGt(t,"overflowX")},CBe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=AGt(t,n);if(o){var i=IGt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},$An=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},BAn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},AGt=function(t,e){return t==="v"?FAn(e):kAn(e)},IGt=function(t,e){return t==="v"?$An(e):BAn(e)},qAn=function(t,e){return t==="h"&&e==="rtl"?-1:1},MGt=function(t,e,r,n,o){var i=qAn(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=IGt(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&AGt(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var Zde=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},RGt=function(t){return[t.deltaX,t.deltaY]},jGt=function(t){return t&&"current"in t?t.current:t},UAn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},zAn=function(t){return` +`))},placeholder:"Enter YouTube URLs, one per line",className:"tw-min-h-20 tw-w-full"})))),Kt.default.createElement("div",{className:"tw-mt-4 tw-flex tw-items-center tw-justify-end tw-gap-2"},Kt.default.createElement(ge,{variant:"ghost",onClick:r,disabled:o},"Cancel"),Kt.default.createElement(ge,{onClick:m,disabled:o||!f()},o?"Saving...":"Save")))}var E9=class extends Bz.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r}=this;this.root=(0,eGt.createRoot)(r);let n=async i=>{await this.onSave(i),this.close()},o=()=>{this.close()};this.root.render(Kt.default.createElement(cAn,{initialProject:this.initialProject,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};ti();var ji=F(X());var ct=F(X(),1),RBe=F(ds(),1);var ns=F(X(),1);var dBe=F(pt(),1),dAn="DismissableLayer",cBe="dismissableLayer.update",fAn="dismissableLayer.pointerDownOutside",pAn="dismissableLayer.focusOutside",tGt,nGt=ns.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fBe=ns.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=ns.useContext(nGt),[c,d]=ns.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=ns.useState({}),m=Ri(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=gAn(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=yAn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return oM(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),ns.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(tGt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),rGt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=tGt)}},[c,f,r,l]),ns.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),rGt())},[c,l]),ns.useEffect(()=>{let E=()=>p({});return document.addEventListener(cBe,E),()=>document.removeEventListener(cBe,E)},[]),(0,dBe.jsx)(ho.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:xi(t.onFocusCapture,P.onFocusCapture),onBlurCapture:xi(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:xi(t.onPointerDownCapture,O.onPointerDownCapture)})});fBe.displayName=dAn;var mAn="DismissableLayerBranch",hAn=ns.forwardRef((t,e)=>{let r=ns.useContext(nGt),n=ns.useRef(null),o=Ri(e,n);return ns.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,dBe.jsx)(ho.div,{...t,ref:o})});hAn.displayName=mAn;function gAn(t,e=globalThis?.document){let r=Ur(t),n=ns.useRef(!1),o=ns.useRef(()=>{});return ns.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){oGt(fAn,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 yAn(t,e=globalThis?.document){let r=Ur(t),n=ns.useRef(!1);return ns.useEffect(()=>{let o=i=>{i.target&&!n.current&&oGt(pAn,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 rGt(){let t=new CustomEvent(cBe);document.dispatchEvent(t)}function oGt(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?RKt(o,i):o.dispatchEvent(i)}var ny=F(X(),1);var lGt=F(pt(),1),pBe="focusScope.autoFocusOnMount",mBe="focusScope.autoFocusOnUnmount",iGt={bubbles:!1,cancelable:!0},bAn="FocusScope",hBe=ny.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=ny.useState(null),l=Ur(o),c=Ur(i),d=ny.useRef(null),f=Ri(e,h=>u(h)),p=ny.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;ny.useEffect(()=>{if(n){let y=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:NM(d.current,{select:!0})},S=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||NM(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&NM(s)};var h=y,b=S,g=x;document.addEventListener("focusin",y),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),ny.useEffect(()=>{if(s){sGt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(pBe,iGt);s.addEventListener(pBe,l),s.dispatchEvent(g),g.defaultPrevented||(_An(CAn(cGt(s)),{select:!0}),document.activeElement===h&&NM(s))}return()=>{s.removeEventListener(pBe,l),setTimeout(()=>{let g=new CustomEvent(mBe,iGt);s.addEventListener(mBe,c),s.dispatchEvent(g),g.defaultPrevented||NM(h??document.body,{select:!0}),s.removeEventListener(mBe,c),sGt.remove(p)},0)}}},[s,l,c,p]);let m=ny.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let y=h.currentTarget,[S,x]=vAn(y);S&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&NM(S,{select:!0})):h.shiftKey&&g===S&&(h.preventDefault(),r&&NM(x,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,lGt.jsx)(ho.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});hBe.displayName=bAn;function _An(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(NM(n,{select:e}),document.activeElement!==r)return}function vAn(t){let e=cGt(t),r=aGt(e,t),n=aGt(e.reverse(),t);return[r,n]}function cGt(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 aGt(t,e){for(let r of t)if(!wAn(r,{upTo:e}))return r}function wAn(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 SAn(t){return t instanceof HTMLInputElement&&"select"in t}function NM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&SAn(t)&&e&&t.select()}}var sGt=xAn();function xAn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=uGt(t,e),t.unshift(e)},remove(e){t=uGt(t,e),t[0]?.resume()}}}function uGt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function CAn(t){return t.filter(e=>e.tagName!=="A")}var mh=F(X(),1);var dGt=F(X(),1);var gBe=F(pt(),1),OAn="Arrow",fGt=dGt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,gBe.jsx)(ho.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,gBe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});fGt.displayName=OAn;var pGt=fGt;var bE=F(X(),1),mGt=F(pt(),1);function hGt(t,e=[]){let r=[];function n(i,a){let s=bE.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,b=bE.useMemo(()=>m,Object.values(m));return(0,mGt.jsx)(h.Provider,{value:b,children:p})}function c(d,f){let p=f?.[t][u]||s,m=bE.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>bE.createContext(a));return function(s){let u=s?.[t]||i;return bE.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,EAn(o,...e)]}function EAn(...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 bE.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var DM=F(pt(),1);var yBe="Popper",[gGt,bBe]=hGt(yBe),[TAn,yGt]=gGt(yBe),bGt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=mh.useState(null);return(0,DM.jsx)(TAn,{scope:e,anchor:n,onAnchorChange:o,children:r})};bGt.displayName=yBe;var _Gt="PopperAnchor",vGt=mh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=yGt(_Gt,r),a=mh.useRef(null),s=Ri(e,a);return mh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,DM.jsx)(ho.div,{...o,ref:s})});vGt.displayName=_Gt;var _Be="PopperContent",[AAn,IAn]=gGt(_Be),wGt=mh.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=yGt(_Be,r),[g,y]=mh.useState(null),S=Ri(e,Y=>y(Y)),[x,O]=mh.useState(null),P=Qx(x),E=P?.width??0,A=P?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],j=N.length>0,$={padding:R,boundary:N.filter(RAn),altBoundary:j},{refs:k,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:J}=sM({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>oE(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[uM({mainAxis:o+A,alignmentAxis:a}),u&&lM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cM():void 0,...$}),u&&dM({...$}),fM({...$,apply:({elements:Y,rects:ae,availableWidth:Oe,availableHeight:le})=>{let{width:Be,height:ze}=ae.reference,rt=Y.floating.style;rt.setProperty("--radix-popper-available-width",`${Oe}px`),rt.setProperty("--radix-popper-available-height",`${le}px`),rt.setProperty("--radix-popper-anchor-width",`${Be}px`),rt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),x&&mM({element:x,padding:s}),jAn({arrowWidth:E,arrowHeight:A}),f&&pM({strategy:"referenceHidden",...$})]}),[D,B]=CGt(V),q=Ur(m);Jn(()=>{Q&&q?.()},[Q,q]);let K=J.arrow?.x,H=J.arrow?.y,ee=J.arrow?.centerOffset!==0,[U,W]=mh.useState();return Jn(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,DM.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,DM.jsx)(AAn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:H,shouldHideArrow:ee,children:(0,DM.jsx)(ho.div,{"data-side":D,"data-align":B,...h,ref:S,style:{...h.style,animation:Q?void 0:"none"}})})})});wGt.displayName=_Be;var SGt="PopperArrow",MAn={top:"bottom",right:"left",bottom:"top",left:"right"},xGt=mh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=IAn(SGt,n),a=MAn[i.placedSide];return(0,DM.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,DM.jsx)(pGt,{...o,ref:r,style:{...o.style,display:"block"}})})});xGt.displayName=SGt;function RAn(t){return t!==null}var jAn=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]=CGt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function CGt(t){let[e,r="center"]=t.split("-");return[e,r]}var OGt=bGt,PGt=vGt,EGt=wGt,TGt=xGt;var Xde=F(X(),1),AGt=F(ds(),1);var IGt=F(pt(),1),DAn="Portal",vBe=Xde.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Xde.useState(!1);Jn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?AGt.default.createPortal((0,IGt.jsx)(ho.div,{...n,ref:e}),a):null});vBe.displayName=DAn;var _d=F(X(),1);var qz=F(pt(),1),SBe=_d.forwardRef((t,e)=>{let{children:r,...n}=t,o=_d.Children.toArray(r),i=o.find(FAn);if(i){let a=i.props.children,s=o.map(u=>u===i?_d.Children.count(a)>1?_d.Children.only(null):_d.isValidElement(a)?a.props.children:null:u);return(0,qz.jsx)(wBe,{...n,ref:e,children:_d.isValidElement(a)?_d.cloneElement(a,void 0,s):null})}return(0,qz.jsx)(wBe,{...n,ref:e,children:r})});SBe.displayName="Slot";var wBe=_d.forwardRef((t,e)=>{let{children:r,...n}=t;if(_d.isValidElement(r)){let o=$An(r);return _d.cloneElement(r,{...kAn(n,r.props),ref:e?sL(e,o):o})}return _d.Children.count(r)>1?_d.Children.only(null):null});wBe.displayName="SlotClone";var LAn=({children:t})=>(0,qz.jsx)(qz.Fragment,{children:t});function FAn(t){return _d.isValidElement(t)&&t.type===LAn}function kAn(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 $An(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 MGt=F(X(),1);var RGt=F(pt(),1),BAn="VisuallyHidden",xBe=MGt.forwardRef((t,e)=>(0,RGt.jsx)(ho.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}}));xBe.displayName=BAn;var tfe=F(X());var hf=F(X());var Qde=VD();var CBe=function(){},T9=hf.forwardRef(function(t,e){var r=hf.useRef(null),n=hf.useState({onScrollCapture:CBe,onWheelCapture:CBe,onTouchMoveCapture:CBe}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,b=t.as,g=b===void 0?"div":b,y=t.gapMode,S=_M(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=HD([r,e]),P=yi(yi({},S),o);return hf.createElement(hf.Fragment,null,c&&hf.createElement(x,{sideCar:Qde,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:y}),a?hf.cloneElement(hf.Children.only(s),yi(yi({},P),{ref:O})):hf.createElement(g,yi({},P,{className:u,ref:O}),s))});T9.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};T9.classNames={fullWidth:Sb,zeroRight:wb};var _a=F(X());var OBe=!1;if(typeof window<"u")try{A9=Object.defineProperty({},"passive",{get:function(){return OBe=!0,!0}}),window.addEventListener("test",A9,A9),window.removeEventListener("test",A9,A9)}catch{OBe=!1}var A9,cL=OBe?{passive:!1}:!1;var qAn=function(t){return t.tagName==="TEXTAREA"},jGt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!qAn(t)&&r[e]==="visible")},UAn=function(t){return jGt(t,"overflowY")},zAn=function(t){return jGt(t,"overflowX")},PBe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=NGt(t,n);if(o){var i=DGt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},HAn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},VAn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},NGt=function(t,e){return t==="v"?UAn(e):zAn(e)},DGt=function(t,e){return t==="v"?HAn(e):VAn(e)},WAn=function(t,e){return t==="h"&&e==="rtl"?-1:1},LGt=function(t,e,r,n,o){var i=WAn(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=DGt(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&NGt(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var efe=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},FGt=function(t){return[t.deltaX,t.deltaY]},kGt=function(t){return t&&"current"in t?t.current:t},KAn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},GAn=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},HAn=0,qz=[];function NGt(t){var e=_a.useRef([]),r=_a.useRef([0,0]),n=_a.useRef(),o=_a.useState(HAn++)[0],i=_a.useState(iE)[0],a=_a.useRef(t);_a.useEffect(function(){a.current=t},[t]),_a.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=az([t.lockRef.current],(t.shards||[]).map(jGt),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=_a.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=Zde(h),y=r.current,S="deltaX"in h?h.deltaX:y[0]-g[0],x="deltaY"in h?h.deltaY:y[1]-g[1],O,P=h.target,E=Math.abs(S)>Math.abs(x)?"h":"v";if("touches"in h&&E==="h"&&P.type==="range")return!1;var A=CBe(E,P);if(!A)return!0;if(A?O=E:(O=E==="v"?"h":"v",A=CBe(E,P)),!A)return!1;if(!n.current&&"changedTouches"in h&&(S||x)&&(n.current=O),!O)return!0;var I=n.current||O;return MGt(I,b,h,I==="h"?S:x,!0)},[]),u=_a.useCallback(function(h){var b=h;if(!(!qz.length||qz[qz.length-1]!==i)){var g="deltaY"in b?RGt(b):Zde(b),y=e.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&UAn(O.delta,g)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var S=(a.current.shards||[]).map(jGt).filter(Boolean).filter(function(O){return O.contains(b.target)}),x=S.length>0?s(b,S[0]):!a.current.noIsolation;x&&b.cancelable&&b.preventDefault()}}},[]),l=_a.useCallback(function(h,b,g,y){var S={name:h,delta:b,target:g,should:y,shadowParent:VAn(g)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(x){return x!==S})},1)},[]),c=_a.useCallback(function(h){r.current=Zde(h),n.current=void 0},[]),d=_a.useCallback(function(h){l(h.type,RGt(h),h.target,s(h,t.lockRef.current))},[]),f=_a.useCallback(function(h){l(h.type,Zde(h),h.target,s(h,t.lockRef.current))},[]);_a.useEffect(function(){return qz.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,lL),document.addEventListener("touchmove",u,lL),document.addEventListener("touchstart",c,lL),function(){qz=qz.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,lL),document.removeEventListener("touchmove",u,lL),document.removeEventListener("touchstart",c,lL)}},[]);var p=t.removeScrollBar,m=t.inert;return _a.createElement(_a.Fragment,null,m?_a.createElement(i,{styles:zAn(o)}):null,p?_a.createElement(WD,{gapMode:t.gapMode}):null)}function VAn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var DGt=VD(Yde,NGt);var LGt=Xde.forwardRef(function(t,e){return Xde.createElement(E9,yi({},t,{ref:e,sideCar:DGt}))});LGt.classNames=E9.classNames;var A9=LGt;var lr=F(ft(),1),WAn=[" ","Enter","ArrowUp","ArrowDown"],KAn=[" ","Enter"],M9="Select",[efe,tfe,GAn]=Kde(M9),[Uz,vbi]=Yi(M9,[GAn,gBe]),rfe=gBe(),[JAn,LM]=Uz(M9),[YAn,ZAn]=Uz(M9),FGt=t=>{let{__scopeSelect:e,children:r,open:n,defaultOpen:o,onOpenChange:i,value:a,defaultValue:s,onValueChange:u,dir:l,name:c,autoComplete:d,disabled:f,required:p,form:m}=t,h=rfe(e),[b,g]=ct.useState(null),[y,S]=ct.useState(null),[x,O]=ct.useState(!1),P=nM(l),[E=!1,A]=ud({prop:n,defaultProp:o,onChange:i}),[I,R]=ud({prop:a,defaultProp:s,onChange:u}),N=ct.useRef(null),j=b?m||!!b.closest("form"):!0,[$,k]=ct.useState(new Set),z=Array.from($).map(V=>V.props.value).join(";");return(0,lr.jsx)(vGt,{...h,children:(0,lr.jsxs)(JAn,{required:p,scope:e,trigger:b,onTriggerChange:g,valueNode:y,onValueNodeChange:S,valueNodeHasChildren:x,onValueNodeHasChildrenChange:O,contentId:hl(),value:I,onValueChange:R,open:E,onOpenChange:A,dir:P,triggerPointerDownPosRef:N,disabled:f,children:[(0,lr.jsx)(efe.Provider,{scope:e,children:(0,lr.jsx)(YAn,{scope:t.__scopeSelect,onNativeOptionAdd:ct.useCallback(V=>{k(Q=>new Set(Q).add(V))},[]),onNativeOptionRemove:ct.useCallback(V=>{k(Q=>{let J=new Set(Q);return J.delete(V),J})},[]),children:r})}),j?(0,lr.jsxs)(uJt,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:I,onChange:V=>R(V.target.value),disabled:f,form:m,children:[I===void 0?(0,lr.jsx)("option",{value:""}):null,Array.from($)]},z):null]})})};FGt.displayName=M9;var kGt="SelectTrigger",$Gt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=rfe(r),a=LM(kGt,r),s=a.disabled||n,u=Ri(e,a.onTriggerChange),l=tfe(r),c=ct.useRef("touch"),[d,f,p]=lJt(h=>{let b=l().filter(S=>!S.disabled),g=b.find(S=>S.value===a.value),y=cJt(b,h,g);y!==void 0&&a.onValueChange(y.value)}),m=h=>{s||(a.onOpenChange(!0),p()),h&&(a.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return(0,lr.jsx)(wGt,{asChild:!0,...i,children:(0,lr.jsx)(ho.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":sJt(a.value)?"":void 0,...o,ref:u,onClick:xi(o.onClick,h=>{h.currentTarget.focus(),c.current!=="mouse"&&m(h)}),onPointerDown:xi(o.onPointerDown,h=>{c.current=h.pointerType;let b=h.target;b.hasPointerCapture(h.pointerId)&&b.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(m(h),h.preventDefault())}),onKeyDown:xi(o.onKeyDown,h=>{let b=d.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(b&&h.key===" ")&&WAn.includes(h.key)&&(m(),h.preventDefault())})})})});$Gt.displayName=kGt;var BGt="SelectValue",qGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=LM(BGt,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=Ri(e,u.onValueNodeChange);return Jn(()=>{l(c)},[l,c]),(0,lr.jsx)(ho.span,{...s,ref:d,style:{pointerEvents:"none"},children:sJt(u.value)?(0,lr.jsx)(lr.Fragment,{children:a}):i})});qGt.displayName=BGt;var XAn="SelectIcon",UGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,lr.jsx)(ho.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});UGt.displayName=XAn;var QAn="SelectPortal",zGt=t=>(0,lr.jsx)(bBe,{asChild:!0,...t});zGt.displayName=QAn;var cL="SelectContent",HGt=ct.forwardRef((t,e)=>{let r=LM(cL,t.__scopeSelect),[n,o]=ct.useState();if(Jn(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?IBe.createPortal((0,lr.jsx)(VGt,{scope:t.__scopeSelect,children:(0,lr.jsx)(efe.Slot,{scope:t.__scopeSelect,children:(0,lr.jsx)("div",{children:t.children})})}),i):null}return(0,lr.jsx)(WGt,{...t,ref:e})});HGt.displayName=cL;var Mb=10,[VGt,FM]=Uz(cL),eIn="SelectContentImpl",WGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:b,...g}=t,y=LM(cL,r),[S,x]=ct.useState(null),[O,P]=ct.useState(null),E=Ri(e,Y=>x(Y)),[A,I]=ct.useState(null),[R,N]=ct.useState(null),j=tfe(r),[$,k]=ct.useState(!1),z=ct.useRef(!1);ct.useEffect(()=>{if(S)return bM(S)},[S]),iM();let V=ct.useCallback(Y=>{let[ae,...Oe]=j().map(ze=>ze.ref.current),[le]=Oe.slice(-1),Be=document.activeElement;for(let ze of Y)if(ze===Be||(ze?.scrollIntoView({block:"nearest"}),ze===ae&&O&&(O.scrollTop=0),ze===le&&O&&(O.scrollTop=O.scrollHeight),ze?.focus(),document.activeElement!==Be))return},[j,O]),Q=ct.useCallback(()=>V([A,S]),[V,A,S]);ct.useEffect(()=>{$&&Q()},[$,Q]);let{onOpenChange:J,triggerPointerDownPosRef:D}=y;ct.useEffect(()=>{if(S){let Y={x:0,y:0},ae=le=>{Y={x:Math.abs(Math.round(le.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(le.pageY)-(D.current?.y??0))}},Oe=le=>{Y.x<=10&&Y.y<=10?le.preventDefault():S.contains(le.target)||J(!1),document.removeEventListener("pointermove",ae),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",ae),document.addEventListener("pointerup",Oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ae),document.removeEventListener("pointerup",Oe,{capture:!0})}}},[S,J,D]),ct.useEffect(()=>{let Y=()=>J(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[J]);let[B,q]=lJt(Y=>{let ae=j().filter(Be=>!Be.disabled),Oe=ae.find(Be=>Be.ref.current===document.activeElement),le=cJt(ae,Y,Oe);le&&setTimeout(()=>le.ref.current.focus())}),K=ct.useCallback((Y,ae,Oe)=>{let le=!z.current&&!Oe;(y.value!==void 0&&y.value===ae||le)&&(I(Y),le&&(z.current=!0))},[y.value]),H=ct.useCallback(()=>S?.focus(),[S]),ee=ct.useCallback((Y,ae,Oe)=>{let le=!z.current&&!Oe;(y.value!==void 0&&y.value===ae||le)&&N(Y)},[y.value]),U=n==="popper"?OBe:KGt,W=U===OBe?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:b}:{};return(0,lr.jsx)(VGt,{scope:r,content:S,viewport:O,onViewportChange:P,itemRefCallback:K,selectedItem:A,onItemLeave:H,itemTextRefCallback:ee,focusSelectedItem:Q,selectedItemText:R,position:n,isPositioned:$,searchRef:B,children:(0,lr.jsx)(A9,{as:vBe,allowPinchZoom:!0,children:(0,lr.jsx)(pBe,{asChild:!0,trapped:y.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:xi(o,Y=>{y.trigger?.focus({preventScroll:!0}),Y.preventDefault()}),children:(0,lr.jsx)(cBe,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,lr.jsx)(U,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:Y=>Y.preventDefault(),...g,...W,onPlaced:()=>k(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:xi(g.onKeyDown,Y=>{let ae=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!ae&&Y.key.length===1&&q(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let le=j().filter(Be=>!Be.disabled).map(Be=>Be.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){let Be=Y.target,ze=le.indexOf(Be);le=le.slice(ze+1)}setTimeout(()=>V(le)),Y.preventDefault()}})})})})})})});WGt.displayName=eIn;var tIn="SelectItemAlignedPosition",KGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=LM(cL,r),a=FM(cL,r),[s,u]=ct.useState(null),[l,c]=ct.useState(null),d=Ri(e,E=>c(E)),f=tfe(r),p=ct.useRef(!1),m=ct.useRef(!0),{viewport:h,selectedItem:b,selectedItemText:g,focusSelectedItem:y}=a,S=ct.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&h&&b&&g){let E=i.trigger.getBoundingClientRect(),A=l.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),R=g.getBoundingClientRect();if(i.dir!=="rtl"){let Be=R.left-A.left,ze=I.left-Be,rt=E.left-ze,cr=E.width+rt,wn=Math.max(cr,A.width),Le=window.innerWidth-Mb,pt=Dz(ze,[Mb,Math.max(Mb,Le-wn)]);s.style.minWidth=cr+"px",s.style.left=pt+"px"}else{let Be=A.right-R.right,ze=window.innerWidth-I.right-Be,rt=window.innerWidth-E.right-ze,cr=E.width+rt,wn=Math.max(cr,A.width),Le=window.innerWidth-Mb,pt=Dz(ze,[Mb,Math.max(Mb,Le-wn)]);s.style.minWidth=cr+"px",s.style.right=pt+"px"}let N=f(),j=window.innerHeight-Mb*2,$=h.scrollHeight,k=window.getComputedStyle(l),z=parseInt(k.borderTopWidth,10),V=parseInt(k.paddingTop,10),Q=parseInt(k.borderBottomWidth,10),J=parseInt(k.paddingBottom,10),D=z+V+$+J+Q,B=Math.min(b.offsetHeight*5,D),q=window.getComputedStyle(h),K=parseInt(q.paddingTop,10),H=parseInt(q.paddingBottom,10),ee=E.top+E.height/2-Mb,U=j-ee,W=b.offsetHeight/2,Y=b.offsetTop+W,ae=z+V+Y,Oe=D-ae;if(ae<=ee){let Be=N.length>0&&b===N[N.length-1].ref.current;s.style.bottom="0px";let ze=l.clientHeight-h.offsetTop-h.offsetHeight,rt=Math.max(U,W+(Be?H:0)+ze+Q),cr=ae+rt;s.style.height=cr+"px"}else{let Be=N.length>0&&b===N[0].ref.current;s.style.top="0px";let rt=Math.max(ee,z+h.offsetTop+(Be?K:0)+W)+Oe;s.style.height=rt+"px",h.scrollTop=ae-ee+h.offsetTop}s.style.margin=`${Mb}px 0`,s.style.minHeight=B+"px",s.style.maxHeight=j+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,h,b,g,i.dir,n]);Jn(()=>S(),[S]);let[x,O]=ct.useState();Jn(()=>{l&&O(window.getComputedStyle(l).zIndex)},[l]);let P=ct.useCallback(E=>{E&&m.current===!0&&(S(),y?.(),m.current=!1)},[S,y]);return(0,lr.jsx)(nIn,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:P,children:(0,lr.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:(0,lr.jsx)(ho.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});KGt.displayName=tIn;var rIn="SelectPopperPosition",OBe=ct.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=Mb,...i}=t,a=rfe(r);return(0,lr.jsx)(SGt,{...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)"}})});OBe.displayName=rIn;var[nIn,MBe]=Uz(cL,{}),PBe="SelectViewport",GGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=FM(PBe,r),a=MBe(PBe,r),s=Ri(e,i.onViewportChange),u=ct.useRef(0);return(0,lr.jsxs)(lr.Fragment,{children:[(0,lr.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,lr.jsx)(efe.Slot,{scope:r,children:(0,lr.jsx)(ho.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:xi(o.onScroll,l=>{let c=l.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=a;if(f?.current&&d){let p=Math.abs(u.current-c.scrollTop);if(p>0){let m=window.innerHeight-Mb*2,h=parseFloat(d.style.minHeight),b=parseFloat(d.style.height),g=Math.max(h,b);if(g0?x:0,d.style.justifyContent="flex-end")}}}u.current=c.scrollTop})})})]})});GGt.displayName=PBe;var JGt="SelectGroup",[oIn,iIn]=Uz(JGt),aIn=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=hl();return(0,lr.jsx)(oIn,{scope:r,id:o,children:(0,lr.jsx)(ho.div,{role:"group","aria-labelledby":o,...n,ref:e})})});aIn.displayName=JGt;var YGt="SelectLabel",ZGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=iIn(YGt,r);return(0,lr.jsx)(ho.div,{id:o.id,...n,ref:e})});ZGt.displayName=YGt;var Qde="SelectItem",[sIn,XGt]=Uz(Qde),QGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=LM(Qde,r),u=FM(Qde,r),l=s.value===n,[c,d]=ct.useState(i??""),[f,p]=ct.useState(!1),m=Ri(e,y=>u.itemRefCallback?.(y,n,o)),h=hl(),b=ct.useRef("touch"),g=()=>{o||(s.onValueChange(n),s.onOpenChange(!1))};if(n==="")throw new Error("A 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,lr.jsx)(sIn,{scope:r,value:n,disabled:o,textId:h,isSelected:l,onItemTextChange:ct.useCallback(y=>{d(S=>S||(y?.textContent??"").trim())},[]),children:(0,lr.jsx)(efe.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,lr.jsx)(ho.div,{role:"option","aria-labelledby":h,"data-highlighted":f?"":void 0,"aria-selected":l&&f,"data-state":l?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:m,onFocus:xi(a.onFocus,()=>p(!0)),onBlur:xi(a.onBlur,()=>p(!1)),onClick:xi(a.onClick,()=>{b.current!=="mouse"&&g()}),onPointerUp:xi(a.onPointerUp,()=>{b.current==="mouse"&&g()}),onPointerDown:xi(a.onPointerDown,y=>{b.current=y.pointerType}),onPointerMove:xi(a.onPointerMove,y=>{b.current=y.pointerType,o?u.onItemLeave?.():b.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:xi(a.onPointerLeave,y=>{y.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:xi(a.onKeyDown,y=>{u.searchRef?.current!==""&&y.key===" "||(KAn.includes(y.key)&&g(),y.key===" "&&y.preventDefault())})})})})});QGt.displayName=Qde;var I9="SelectItemText",eJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=LM(I9,r),s=FM(I9,r),u=XGt(I9,r),l=ZAn(I9,r),[c,d]=ct.useState(null),f=Ri(e,g=>d(g),u.onItemTextChange,g=>s.itemTextRefCallback?.(g,u.value,u.disabled)),p=c?.textContent,m=ct.useMemo(()=>(0,lr.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:b}=l;return Jn(()=>(h(m),()=>b(m)),[h,b,m]),(0,lr.jsxs)(lr.Fragment,{children:[(0,lr.jsx)(ho.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?IBe.createPortal(i.children,a.valueNode):null]})});eJt.displayName=I9;var tJt="SelectItemIndicator",rJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return XGt(tJt,r).isSelected?(0,lr.jsx)(ho.span,{"aria-hidden":!0,...n,ref:e}):null});rJt.displayName=tJt;var EBe="SelectScrollUpButton",nJt=ct.forwardRef((t,e)=>{let r=FM(EBe,t.__scopeSelect),n=MBe(EBe,t.__scopeSelect),[o,i]=ct.useState(!1),a=Ri(e,n.onScrollButtonChange);return Jn(()=>{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,lr.jsx)(iJt,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});nJt.displayName=EBe;var TBe="SelectScrollDownButton",oJt=ct.forwardRef((t,e)=>{let r=FM(TBe,t.__scopeSelect),n=MBe(TBe,t.__scopeSelect),[o,i]=ct.useState(!1),a=Ri(e,n.onScrollButtonChange);return Jn(()=>{if(r.viewport&&r.isPositioned){let u=function(){let c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)l.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),o?(0,lr.jsx)(iJt,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});oJt.displayName=TBe;var iJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=FM("SelectScrollButton",r),a=ct.useRef(null),s=tfe(r),u=ct.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return ct.useEffect(()=>()=>u(),[u]),Jn(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,lr.jsx)(ho.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:xi(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:xi(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:xi(o.onPointerLeave,()=>{u()})})}),uIn="SelectSeparator",aJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,lr.jsx)(ho.div,{"aria-hidden":!0,...n,ref:e})});aJt.displayName=uIn;var ABe="SelectArrow",lIn=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=rfe(r),i=LM(ABe,r),a=FM(ABe,r);return i.open&&a.position==="popper"?(0,lr.jsx)(xGt,{...o,...n,ref:e}):null});lIn.displayName=ABe;function sJt(t){return t===""||t===void 0}var uJt=ct.forwardRef((t,e)=>{let{value:r,...n}=t,o=ct.useRef(null),i=Ri(e,o),a=Lz(r);return ct.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,lr.jsx)(wBe,{asChild:!0,children:(0,lr.jsx)("select",{...n,ref:i,defaultValue:r})})});uJt.displayName="BubbleSelect";function lJt(t){let e=Ur(t),r=ct.useRef(""),n=ct.useRef(0),o=ct.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=ct.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return ct.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function cJt(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=cIn(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 cIn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var dJt=FGt,RBe=$Gt,fJt=qGt,pJt=UGt,mJt=zGt,jBe=HGt,hJt=GGt;var NBe=ZGt,DBe=QGt,gJt=eJt,yJt=rJt,LBe=nJt,FBe=oJt,kBe=aJt;yn();Tn();var zz=dJt;var Hz=fJt,dL=ji.forwardRef(({className:t,children:e,...r},n)=>ji.createElement(RBe,{ref:n,className:_e("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,ji.createElement(pJt,{asChild:!0},ji.createElement(Hi,{className:"tw-size-4"}))));dL.displayName=RBe.displayName;var bJt=ji.forwardRef(({className:t,...e},r)=>ji.createElement(LBe,{ref:r,className:_e("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},ji.createElement(Ey,{className:"tw-size-4"})));bJt.displayName=LBe.displayName;var _Jt=ji.forwardRef(({className:t,...e},r)=>ji.createElement(FBe,{ref:r,className:_e("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},ji.createElement(Hi,{className:"tw-size-4"})));_Jt.displayName=FBe.displayName;var fL=ji.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>ji.createElement(mJt,{container:n},ji.createElement(jBe,{ref:i,className:_e("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},ji.createElement(bJt,null),ji.createElement(hJt,{className:_e("tw-p-1",r==="popper"&&"tw-h-[var(--radix-select-trigger-height)] tw-w-full tw-min-w-[var(--radix-select-trigger-width)]")},e),ji.createElement(_Jt,null))));fL.displayName=jBe.displayName;var fIn=ji.forwardRef(({className:t,...e},r)=>ji.createElement(NBe,{ref:r,className:_e("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t),...e}));fIn.displayName=NBe.displayName;var pL=ji.forwardRef(({className:t,children:e,...r},n)=>ji.createElement(DBe,{ref:n,className:_e("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},ji.createElement("span",{className:"tw-absolute tw-right-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},ji.createElement(yJt,null,ji.createElement(Jl,{className:"tw-size-4"}))),ji.createElement(gJt,null,e)));pL.displayName=DBe.displayName;var pIn=ji.forwardRef(({className:t,...e},r)=>ji.createElement(kBe,{ref:r,className:_e("-tw-mx-1 tw-my-1 tw-h-px tw-bg-primary-alt",t),...e}));pIn.displayName=kBe.displayName;Tn();yo();nr();yn();var wJt=require("obsidian"),Ne=F(X());function mIn(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 vJt(t,e,r={}){return!t||t.length===0?[]:e.trim()?t.filter(n=>mIn(n,e,r)):t}function hIn({project:t,loadContext:e,onEdit:r,onDelete:n}){return Ne.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)},Ne.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2 tw-overflow-hidden"},Ne.default.createElement("div",{className:"tw-text-accent"},Ne.default.createElement(Iy,{className:"tw-size-4"})),Ne.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-col tw-gap-1.5 tw-overflow-hidden"},Ne.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[13px] tw-font-medium tw-text-normal"},t.name),t.description&&Ne.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[12px] tw-text-muted/80"},t.description))),Ne.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-1 tw-opacity-100 tw-transition-opacity tw-duration-200"},Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),r(t)}},Ne.default.createElement(tO,{className:"tw-size-4"}))),Ne.default.createElement(Mt,{side:"bottom"},"Edit Project")),Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),e(t)}},Ne.default.createElement(rk,{className:"tw-size-4"}))),Ne.default.createElement(Mt,{side:"bottom"},"Start Chat")),Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),new sd(app,()=>n(t),`Are you sure you want to delete project "${t.name}"?`,"Delete Project").open()}},Ne.default.createElement(Rm,{className:"tw-size-4"}))),Ne.default.createElement(Mt,{side:"bottom"},"Delete Project"))))}var $Be=(0,Ne.memo)(({className:t,projects:e,defaultOpen:r=!1,app:n,onProjectAdded:o,onEditProject:i,hasMessages:a=!1,showChatUI:s,onClose:u,inputRef:l})=>{let[c,d]=(0,Ne.useState)(r),[f,p]=(0,Ne.useState)(!1),[m,h]=(0,Ne.useState)(null),[b,g]=(0,Ne.useState)("");(0,Ne.useEffect)(()=>{a&&d(!1)},[a]);let y=(0,Ne.useMemo)(()=>vJt(e,b),[e,b]),S=()=>{new P9(n,async I=>{o(I)}).open()},x=A=>{new P9(n,async R=>{i(A,R),m&&m.name===A.name&&h(R)},A).open()},O=A=>{let R=(e||[]).filter(N=>N.name!==A.name);m?.name===A.name&&P(!1),dt("projectList",R),new wJt.Notice(`Project "${A.name}" deleted successfully`)},P=(A,I)=>{if(A){if(!I){fe("Must be exist one project.");return}h(I),p(!0),d(!1)}else{h(null),p(!1),d(!0),s(!1),UR(null);return}},E=A=>{h(A),p(!0),d(!1),s(!0),UR(A),setTimeout(()=>{l.current&&l.current.focus()},0)};return Ne.default.createElement("div",{className:_e("tw-flex tw-flex-col",t)},Ne.default.createElement("div",{className:"tw-overflow-y-auto"},Ne.default.createElement("div",{className:"tw-flex tw-flex-col"},f&&m?Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-py-3"},Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),Ne.default.createElement(zz,{value:m.name,onValueChange:A=>{let I=e.find(R=>R.name===A);I&&E(I)}},Ne.default.createElement(dL,{className:"tw-w-[200px]"},Ne.default.createElement(Hz,null,Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement(Iy,{className:"tw-size-4 tw-text-accent/70"}),Ne.default.createElement("span",null,m.name)))),Ne.default.createElement(fL,null,e.map(A=>Ne.default.createElement(pL,{key:A.name,value:A.name,className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement(Iy,{className:"tw-size-4"}),A.name)))))),Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement(ge,{variant:"secondary",onClick:()=>x(m),className:"hover:tw-text-on-accent hover:tw-bg-accent/50"},Ne.default.createElement(tO,{className:"tw-mr-1 tw-size-4"}),"Edit"),Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:()=>{P(!1)},"aria-label":"Close Current Project"},Ne.default.createElement(Vi,{className:"tw-size-4"}))),Ne.default.createElement(Mt,{side:"bottom"},"Close Current Project")))):Ne.default.createElement(cE,{open:c,onOpenChange:d,className:"tw-transition-all tw-duration-200 tw-ease-in-out"},Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-4 tw-py-3"},Ne.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},Ne.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(f_,{className:"tw-size-4 tw-text-muted"})),Ne.default.createElement(Mt,{side:"bottom",className:"tw-w-64"},"Manage your projects with different contexts and configurations."))),Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement(ge,{className:"tw-px-2",variant:"secondary",onClick:S},"Create",Ne.default.createElement(Mm,{className:"tw-size-3"})),e.length>0&&Ne.default.createElement(tL,{asChild:!0},Ne.default.createElement(ge,{variant:"ghost2",size:"icon"},c?Ne.default.createElement(Ey,{className:"tw-size-5"}):Ne.default.createElement(Hi,{className:"tw-size-5"}))),Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:()=>u(),"aria-label":"close project mode"},Ne.default.createElement(Vi,{className:"tw-size-4"}))),Ne.default.createElement(Mt,{side:"bottom"},"Close Project Mode")))),e.length===0&&Ne.default.createElement("div",{className:"tw-px-4 tw-py-2 tw-text-xs tw-text-muted tw-bg-secondary/30"},"No projects available"),Ne.default.createElement(dE,{className:"tw-transition-all tw-duration-200 tw-ease-in-out"},Ne.default.createElement("div",{className:"tw-relative tw-bg-secondary/30"},e.length>0&&Ne.default.createElement("div",{className:"tw-px-4 tw-pb-2 tw-pt-3"},Ne.default.createElement("div",{className:"tw-relative"},Ne.default.createElement(kde,{value:b,onChange:g,placeholder:"Search projects..."}))),Ne.default.createElement("div",{className:"tw-max-h-[calc(3*5.7rem)] tw-overflow-y-auto tw-px-4 tw-pb-6 tw-pt-3"},Ne.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"},y.map(A=>Ne.default.createElement(hIn,{key:A.name,project:A,loadContext:E,onEdit:x,onDelete:O}))),b.trim()&&y.length===0&&Ne.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-8 tw-text-muted"},Ne.default.createElement(c1,{className:"tw-mb-3 tw-size-12 tw-text-muted/50"}),Ne.default.createElement("p",{className:"tw-text-base tw-font-medium"},"No matching projects found"),Ne.default.createElement("p",{className:"tw-mt-1 tw-text-sm"},"Try searching with different keywords"))),e.length>0&&Ne.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%)]"}))))),!f&&Ne.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"},Ne.default.createElement("div",{className:"tw-max-w-[600px] tw-space-y-4"},Ne.default.createElement("p",{className:"tw-text-center tw-text-base"},"Create your project-based AI assistants with custom instructions, context, and model configurations."),Ne.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-text-sm"},Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement(rk,{className:"tw-size-4"}),Ne.default.createElement("span",null,"Click a project card to start chatting")))))))});$Be.displayName="ProjectList";$r();$r();Cn();yo();var BBe=async(t,e,r,n,o,i={})=>{let a=new AbortController;o(a);try{await e.runChain(t,a,n,r,i)}catch(s){fe("Model request failed:",s);let u="Model request failed: "+ei(s);r({sender:e_,isErrorMessage:!0,message:`Error: ${u}`,isVisible:!0,timestamp:Vl(new Date)})}};nO();nr();var mL=F(X()),qBe=class{constructor(e){this.plugin=e;this.chatHistory=[];this.plugin=e}addMessage(e){this.chatHistory.push(e),this.plugin.projectManager.getCurrentChainManager().addChatMessage(e)}getMessages(){return this.chatHistory}clearChatHistory(){this.chatHistory=[],this.plugin.projectManager.getCurrentChainManager().clearHistory()}replaceMessages(e){this.chatHistory=[...e]}};function SJt(t){let[e,r]=(0,mL.useState)(t.getMessages());(0,mL.useEffect)(()=>{r([...t.getMessages()])},[t,t.chatHistory]);let n=(0,mL.useCallback)(i=>{t.addMessage(i),r([...t.getMessages()])},[t]),o=(0,mL.useCallback)(()=>{t.clearChatHistory(),r([])},[t]);return[e,n,o]}var xJt=qBe;Cn();var CJt=F(Pp()),pm=require("obsidian"),xr=F(X()),gIn=({sharedState:t,chainManager:e,onSaveChat:r,updateUserMessageHistory:n,fileParserManager:o,plugin:i})=>{let a=Rn(),s=(0,xr.useContext)(_z),[u,l,c]=SJt(t),[d]=wF(),[f]=by(),[p,m]=(0,xr.useState)(""),[h,b]=(0,xr.useState)(""),[g,y]=(0,xr.useState)(null),[S,x]=(0,xr.useState)(!1),[O,P]=(0,xr.useState)(t_.DEFAULT),[E,A]=(0,xr.useState)([]),[I,R]=(0,xr.useState)(!1),[N,j]=(0,xr.useState)([]),[$,k]=(0,xr.useState)(!1),[z]=n8e(),[V,Q]=(0,xr.useState)(null),[J,D]=by(),B=Sq(),q=Cq.getInstance(),K=mz.getInstance(),H=(0,xr.useRef)(null);(0,xr.useEffect)(()=>{let te=()=>{H.current&&H.current.focus()};return s?.addEventListener(Dh.CHAT_IS_VISIBLE,te),()=>{s?.removeEventListener(Dh.CHAT_IS_VISIBLE,te)}},[s]);let ee=(0,xr.useContext)(gde),U=i.app||ee,W=async({toolCalls:te,urls:et,contextNotes:Re}={})=>{if(!h&&N.length===0)return;let Pe=Vl(new Date),oe=[];h&&oe.push({type:"text",text:h});for(let _f of N){let sC=await _f.arrayBuffer(),kb=CJt.Buffer.from(sC).toString("base64");oe.push({type:"image_url",image_url:{url:`data:${_f.type};base64,${kb}`}})}let se=[...Re||[]],ce=U.workspace.getActiveFile();I&&J!=="project"&&ce&&!se.some(_f=>_f.path===ce.path)&&se.push(ce);let Ce={message:h||"Image message",originalMessage:h,sender:Pi,isVisible:!0,timestamp:Pe,content:oe,context:{notes:se,urls:et||[],selectedTextContexts:z}};b(""),j([]),l(Ce),x(!0),P(t_.DEFAULT);let Je=h,ir=await iVe();h.includes("@composer")&&ir!==""&&(Je=h+` +`)},JAn=0,Uz=[];function $Gt(t){var e=_a.useRef([]),r=_a.useRef([0,0]),n=_a.useRef(),o=_a.useState(JAn++)[0],i=_a.useState(iE)[0],a=_a.useRef(t);_a.useEffect(function(){a.current=t},[t]),_a.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=sz([t.lockRef.current],(t.shards||[]).map(kGt),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=_a.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=efe(h),y=r.current,S="deltaX"in h?h.deltaX:y[0]-g[0],x="deltaY"in h?h.deltaY:y[1]-g[1],O,P=h.target,E=Math.abs(S)>Math.abs(x)?"h":"v";if("touches"in h&&E==="h"&&P.type==="range")return!1;var A=PBe(E,P);if(!A)return!0;if(A?O=E:(O=E==="v"?"h":"v",A=PBe(E,P)),!A)return!1;if(!n.current&&"changedTouches"in h&&(S||x)&&(n.current=O),!O)return!0;var I=n.current||O;return LGt(I,b,h,I==="h"?S:x,!0)},[]),u=_a.useCallback(function(h){var b=h;if(!(!Uz.length||Uz[Uz.length-1]!==i)){var g="deltaY"in b?FGt(b):efe(b),y=e.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&KAn(O.delta,g)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var S=(a.current.shards||[]).map(kGt).filter(Boolean).filter(function(O){return O.contains(b.target)}),x=S.length>0?s(b,S[0]):!a.current.noIsolation;x&&b.cancelable&&b.preventDefault()}}},[]),l=_a.useCallback(function(h,b,g,y){var S={name:h,delta:b,target:g,should:y,shadowParent:YAn(g)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(x){return x!==S})},1)},[]),c=_a.useCallback(function(h){r.current=efe(h),n.current=void 0},[]),d=_a.useCallback(function(h){l(h.type,FGt(h),h.target,s(h,t.lockRef.current))},[]),f=_a.useCallback(function(h){l(h.type,efe(h),h.target,s(h,t.lockRef.current))},[]);_a.useEffect(function(){return Uz.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,cL),document.addEventListener("touchmove",u,cL),document.addEventListener("touchstart",c,cL),function(){Uz=Uz.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,cL),document.removeEventListener("touchmove",u,cL),document.removeEventListener("touchstart",c,cL)}},[]);var p=t.removeScrollBar,m=t.inert;return _a.createElement(_a.Fragment,null,m?_a.createElement(i,{styles:GAn(o)}):null,p?_a.createElement(KD,{gapMode:t.gapMode}):null)}function YAn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var BGt=WD(Qde,$Gt);var qGt=tfe.forwardRef(function(t,e){return tfe.createElement(T9,yi({},t,{ref:e,sideCar:BGt}))});qGt.classNames=T9.classNames;var I9=qGt;var lr=F(pt(),1),ZAn=[" ","Enter","ArrowUp","ArrowDown"],XAn=[" ","Enter"],R9="Select",[nfe,ofe,QAn]=Yde(R9),[zz,Abi]=Yi(R9,[QAn,bBe]),ife=bBe(),[eIn,LM]=zz(R9),[tIn,rIn]=zz(R9),UGt=t=>{let{__scopeSelect:e,children:r,open:n,defaultOpen:o,onOpenChange:i,value:a,defaultValue:s,onValueChange:u,dir:l,name:c,autoComplete:d,disabled:f,required:p,form:m}=t,h=ife(e),[b,g]=ct.useState(null),[y,S]=ct.useState(null),[x,O]=ct.useState(!1),P=nM(l),[E=!1,A]=ud({prop:n,defaultProp:o,onChange:i}),[I,R]=ud({prop:a,defaultProp:s,onChange:u}),N=ct.useRef(null),j=b?m||!!b.closest("form"):!0,[$,k]=ct.useState(new Set),z=Array.from($).map(V=>V.props.value).join(";");return(0,lr.jsx)(OGt,{...h,children:(0,lr.jsxs)(eIn,{required:p,scope:e,trigger:b,onTriggerChange:g,valueNode:y,onValueNodeChange:S,valueNodeHasChildren:x,onValueNodeHasChildrenChange:O,contentId:hl(),value:I,onValueChange:R,open:E,onOpenChange:A,dir:P,triggerPointerDownPosRef:N,disabled:f,children:[(0,lr.jsx)(nfe.Provider,{scope:e,children:(0,lr.jsx)(tIn,{scope:t.__scopeSelect,onNativeOptionAdd:ct.useCallback(V=>{k(Q=>new Set(Q).add(V))},[]),onNativeOptionRemove:ct.useCallback(V=>{k(Q=>{let J=new Set(Q);return J.delete(V),J})},[]),children:r})}),j?(0,lr.jsxs)(pJt,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:I,onChange:V=>R(V.target.value),disabled:f,form:m,children:[I===void 0?(0,lr.jsx)("option",{value:""}):null,Array.from($)]},z):null]})})};UGt.displayName=R9;var zGt="SelectTrigger",HGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=ife(r),a=LM(zGt,r),s=a.disabled||n,u=Ri(e,a.onTriggerChange),l=ofe(r),c=ct.useRef("touch"),[d,f,p]=mJt(h=>{let b=l().filter(S=>!S.disabled),g=b.find(S=>S.value===a.value),y=hJt(b,h,g);y!==void 0&&a.onValueChange(y.value)}),m=h=>{s||(a.onOpenChange(!0),p()),h&&(a.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return(0,lr.jsx)(PGt,{asChild:!0,...i,children:(0,lr.jsx)(ho.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":fJt(a.value)?"":void 0,...o,ref:u,onClick:xi(o.onClick,h=>{h.currentTarget.focus(),c.current!=="mouse"&&m(h)}),onPointerDown:xi(o.onPointerDown,h=>{c.current=h.pointerType;let b=h.target;b.hasPointerCapture(h.pointerId)&&b.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(m(h),h.preventDefault())}),onKeyDown:xi(o.onKeyDown,h=>{let b=d.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(b&&h.key===" ")&&ZAn.includes(h.key)&&(m(),h.preventDefault())})})})});HGt.displayName=zGt;var VGt="SelectValue",WGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=LM(VGt,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=Ri(e,u.onValueNodeChange);return Jn(()=>{l(c)},[l,c]),(0,lr.jsx)(ho.span,{...s,ref:d,style:{pointerEvents:"none"},children:fJt(u.value)?(0,lr.jsx)(lr.Fragment,{children:a}):i})});WGt.displayName=VGt;var nIn="SelectIcon",KGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,lr.jsx)(ho.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});KGt.displayName=nIn;var oIn="SelectPortal",GGt=t=>(0,lr.jsx)(vBe,{asChild:!0,...t});GGt.displayName=oIn;var dL="SelectContent",JGt=ct.forwardRef((t,e)=>{let r=LM(dL,t.__scopeSelect),[n,o]=ct.useState();if(Jn(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?RBe.createPortal((0,lr.jsx)(YGt,{scope:t.__scopeSelect,children:(0,lr.jsx)(nfe.Slot,{scope:t.__scopeSelect,children:(0,lr.jsx)("div",{children:t.children})})}),i):null}return(0,lr.jsx)(ZGt,{...t,ref:e})});JGt.displayName=dL;var Mb=10,[YGt,FM]=zz(dL),iIn="SelectContentImpl",ZGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:b,...g}=t,y=LM(dL,r),[S,x]=ct.useState(null),[O,P]=ct.useState(null),E=Ri(e,Y=>x(Y)),[A,I]=ct.useState(null),[R,N]=ct.useState(null),j=ofe(r),[$,k]=ct.useState(!1),z=ct.useRef(!1);ct.useEffect(()=>{if(S)return bM(S)},[S]),iM();let V=ct.useCallback(Y=>{let[ae,...Oe]=j().map(ze=>ze.ref.current),[le]=Oe.slice(-1),Be=document.activeElement;for(let ze of Y)if(ze===Be||(ze?.scrollIntoView({block:"nearest"}),ze===ae&&O&&(O.scrollTop=0),ze===le&&O&&(O.scrollTop=O.scrollHeight),ze?.focus(),document.activeElement!==Be))return},[j,O]),Q=ct.useCallback(()=>V([A,S]),[V,A,S]);ct.useEffect(()=>{$&&Q()},[$,Q]);let{onOpenChange:J,triggerPointerDownPosRef:D}=y;ct.useEffect(()=>{if(S){let Y={x:0,y:0},ae=le=>{Y={x:Math.abs(Math.round(le.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(le.pageY)-(D.current?.y??0))}},Oe=le=>{Y.x<=10&&Y.y<=10?le.preventDefault():S.contains(le.target)||J(!1),document.removeEventListener("pointermove",ae),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",ae),document.addEventListener("pointerup",Oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ae),document.removeEventListener("pointerup",Oe,{capture:!0})}}},[S,J,D]),ct.useEffect(()=>{let Y=()=>J(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[J]);let[B,q]=mJt(Y=>{let ae=j().filter(Be=>!Be.disabled),Oe=ae.find(Be=>Be.ref.current===document.activeElement),le=hJt(ae,Y,Oe);le&&setTimeout(()=>le.ref.current.focus())}),K=ct.useCallback((Y,ae,Oe)=>{let le=!z.current&&!Oe;(y.value!==void 0&&y.value===ae||le)&&(I(Y),le&&(z.current=!0))},[y.value]),H=ct.useCallback(()=>S?.focus(),[S]),ee=ct.useCallback((Y,ae,Oe)=>{let le=!z.current&&!Oe;(y.value!==void 0&&y.value===ae||le)&&N(Y)},[y.value]),U=n==="popper"?EBe:XGt,W=U===EBe?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:b}:{};return(0,lr.jsx)(YGt,{scope:r,content:S,viewport:O,onViewportChange:P,itemRefCallback:K,selectedItem:A,onItemLeave:H,itemTextRefCallback:ee,focusSelectedItem:Q,selectedItemText:R,position:n,isPositioned:$,searchRef:B,children:(0,lr.jsx)(I9,{as:SBe,allowPinchZoom:!0,children:(0,lr.jsx)(hBe,{asChild:!0,trapped:y.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:xi(o,Y=>{y.trigger?.focus({preventScroll:!0}),Y.preventDefault()}),children:(0,lr.jsx)(fBe,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,lr.jsx)(U,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:Y=>Y.preventDefault(),...g,...W,onPlaced:()=>k(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:xi(g.onKeyDown,Y=>{let ae=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!ae&&Y.key.length===1&&q(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let le=j().filter(Be=>!Be.disabled).map(Be=>Be.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){let Be=Y.target,ze=le.indexOf(Be);le=le.slice(ze+1)}setTimeout(()=>V(le)),Y.preventDefault()}})})})})})})});ZGt.displayName=iIn;var aIn="SelectItemAlignedPosition",XGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=LM(dL,r),a=FM(dL,r),[s,u]=ct.useState(null),[l,c]=ct.useState(null),d=Ri(e,E=>c(E)),f=ofe(r),p=ct.useRef(!1),m=ct.useRef(!0),{viewport:h,selectedItem:b,selectedItemText:g,focusSelectedItem:y}=a,S=ct.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&h&&b&&g){let E=i.trigger.getBoundingClientRect(),A=l.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),R=g.getBoundingClientRect();if(i.dir!=="rtl"){let Be=R.left-A.left,ze=I.left-Be,rt=E.left-ze,cr=E.width+rt,Sn=Math.max(cr,A.width),je=window.innerWidth-Mb,mt=Lz(ze,[Mb,Math.max(Mb,je-Sn)]);s.style.minWidth=cr+"px",s.style.left=mt+"px"}else{let Be=A.right-R.right,ze=window.innerWidth-I.right-Be,rt=window.innerWidth-E.right-ze,cr=E.width+rt,Sn=Math.max(cr,A.width),je=window.innerWidth-Mb,mt=Lz(ze,[Mb,Math.max(Mb,je-Sn)]);s.style.minWidth=cr+"px",s.style.right=mt+"px"}let N=f(),j=window.innerHeight-Mb*2,$=h.scrollHeight,k=window.getComputedStyle(l),z=parseInt(k.borderTopWidth,10),V=parseInt(k.paddingTop,10),Q=parseInt(k.borderBottomWidth,10),J=parseInt(k.paddingBottom,10),D=z+V+$+J+Q,B=Math.min(b.offsetHeight*5,D),q=window.getComputedStyle(h),K=parseInt(q.paddingTop,10),H=parseInt(q.paddingBottom,10),ee=E.top+E.height/2-Mb,U=j-ee,W=b.offsetHeight/2,Y=b.offsetTop+W,ae=z+V+Y,Oe=D-ae;if(ae<=ee){let Be=N.length>0&&b===N[N.length-1].ref.current;s.style.bottom="0px";let ze=l.clientHeight-h.offsetTop-h.offsetHeight,rt=Math.max(U,W+(Be?H:0)+ze+Q),cr=ae+rt;s.style.height=cr+"px"}else{let Be=N.length>0&&b===N[0].ref.current;s.style.top="0px";let rt=Math.max(ee,z+h.offsetTop+(Be?K:0)+W)+Oe;s.style.height=rt+"px",h.scrollTop=ae-ee+h.offsetTop}s.style.margin=`${Mb}px 0`,s.style.minHeight=B+"px",s.style.maxHeight=j+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,h,b,g,i.dir,n]);Jn(()=>S(),[S]);let[x,O]=ct.useState();Jn(()=>{l&&O(window.getComputedStyle(l).zIndex)},[l]);let P=ct.useCallback(E=>{E&&m.current===!0&&(S(),y?.(),m.current=!1)},[S,y]);return(0,lr.jsx)(uIn,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:P,children:(0,lr.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:(0,lr.jsx)(ho.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});XGt.displayName=aIn;var sIn="SelectPopperPosition",EBe=ct.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=Mb,...i}=t,a=ife(r);return(0,lr.jsx)(EGt,{...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)"}})});EBe.displayName=sIn;var[uIn,jBe]=zz(dL,{}),TBe="SelectViewport",QGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=FM(TBe,r),a=jBe(TBe,r),s=Ri(e,i.onViewportChange),u=ct.useRef(0);return(0,lr.jsxs)(lr.Fragment,{children:[(0,lr.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,lr.jsx)(nfe.Slot,{scope:r,children:(0,lr.jsx)(ho.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:xi(o.onScroll,l=>{let c=l.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=a;if(f?.current&&d){let p=Math.abs(u.current-c.scrollTop);if(p>0){let m=window.innerHeight-Mb*2,h=parseFloat(d.style.minHeight),b=parseFloat(d.style.height),g=Math.max(h,b);if(g0?x:0,d.style.justifyContent="flex-end")}}}u.current=c.scrollTop})})})]})});QGt.displayName=TBe;var eJt="SelectGroup",[lIn,cIn]=zz(eJt),dIn=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=hl();return(0,lr.jsx)(lIn,{scope:r,id:o,children:(0,lr.jsx)(ho.div,{role:"group","aria-labelledby":o,...n,ref:e})})});dIn.displayName=eJt;var tJt="SelectLabel",rJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=cIn(tJt,r);return(0,lr.jsx)(ho.div,{id:o.id,...n,ref:e})});rJt.displayName=tJt;var rfe="SelectItem",[fIn,nJt]=zz(rfe),oJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=LM(rfe,r),u=FM(rfe,r),l=s.value===n,[c,d]=ct.useState(i??""),[f,p]=ct.useState(!1),m=Ri(e,y=>u.itemRefCallback?.(y,n,o)),h=hl(),b=ct.useRef("touch"),g=()=>{o||(s.onValueChange(n),s.onOpenChange(!1))};if(n==="")throw new Error("A 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,lr.jsx)(fIn,{scope:r,value:n,disabled:o,textId:h,isSelected:l,onItemTextChange:ct.useCallback(y=>{d(S=>S||(y?.textContent??"").trim())},[]),children:(0,lr.jsx)(nfe.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,lr.jsx)(ho.div,{role:"option","aria-labelledby":h,"data-highlighted":f?"":void 0,"aria-selected":l&&f,"data-state":l?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:m,onFocus:xi(a.onFocus,()=>p(!0)),onBlur:xi(a.onBlur,()=>p(!1)),onClick:xi(a.onClick,()=>{b.current!=="mouse"&&g()}),onPointerUp:xi(a.onPointerUp,()=>{b.current==="mouse"&&g()}),onPointerDown:xi(a.onPointerDown,y=>{b.current=y.pointerType}),onPointerMove:xi(a.onPointerMove,y=>{b.current=y.pointerType,o?u.onItemLeave?.():b.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:xi(a.onPointerLeave,y=>{y.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:xi(a.onKeyDown,y=>{u.searchRef?.current!==""&&y.key===" "||(XAn.includes(y.key)&&g(),y.key===" "&&y.preventDefault())})})})})});oJt.displayName=rfe;var M9="SelectItemText",iJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=LM(M9,r),s=FM(M9,r),u=nJt(M9,r),l=rIn(M9,r),[c,d]=ct.useState(null),f=Ri(e,g=>d(g),u.onItemTextChange,g=>s.itemTextRefCallback?.(g,u.value,u.disabled)),p=c?.textContent,m=ct.useMemo(()=>(0,lr.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:b}=l;return Jn(()=>(h(m),()=>b(m)),[h,b,m]),(0,lr.jsxs)(lr.Fragment,{children:[(0,lr.jsx)(ho.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?RBe.createPortal(i.children,a.valueNode):null]})});iJt.displayName=M9;var aJt="SelectItemIndicator",sJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return nJt(aJt,r).isSelected?(0,lr.jsx)(ho.span,{"aria-hidden":!0,...n,ref:e}):null});sJt.displayName=aJt;var ABe="SelectScrollUpButton",uJt=ct.forwardRef((t,e)=>{let r=FM(ABe,t.__scopeSelect),n=jBe(ABe,t.__scopeSelect),[o,i]=ct.useState(!1),a=Ri(e,n.onScrollButtonChange);return Jn(()=>{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,lr.jsx)(cJt,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});uJt.displayName=ABe;var IBe="SelectScrollDownButton",lJt=ct.forwardRef((t,e)=>{let r=FM(IBe,t.__scopeSelect),n=jBe(IBe,t.__scopeSelect),[o,i]=ct.useState(!1),a=Ri(e,n.onScrollButtonChange);return Jn(()=>{if(r.viewport&&r.isPositioned){let u=function(){let c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)l.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),o?(0,lr.jsx)(cJt,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});lJt.displayName=IBe;var cJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=FM("SelectScrollButton",r),a=ct.useRef(null),s=ofe(r),u=ct.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return ct.useEffect(()=>()=>u(),[u]),Jn(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,lr.jsx)(ho.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:xi(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:xi(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:xi(o.onPointerLeave,()=>{u()})})}),pIn="SelectSeparator",dJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,lr.jsx)(ho.div,{"aria-hidden":!0,...n,ref:e})});dJt.displayName=pIn;var MBe="SelectArrow",mIn=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=ife(r),i=LM(MBe,r),a=FM(MBe,r);return i.open&&a.position==="popper"?(0,lr.jsx)(TGt,{...o,...n,ref:e}):null});mIn.displayName=MBe;function fJt(t){return t===""||t===void 0}var pJt=ct.forwardRef((t,e)=>{let{value:r,...n}=t,o=ct.useRef(null),i=Ri(e,o),a=Fz(r);return ct.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,lr.jsx)(xBe,{asChild:!0,children:(0,lr.jsx)("select",{...n,ref:i,defaultValue:r})})});pJt.displayName="BubbleSelect";function mJt(t){let e=Ur(t),r=ct.useRef(""),n=ct.useRef(0),o=ct.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=ct.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return ct.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function hJt(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=hIn(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 hIn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var gJt=UGt,NBe=HGt,yJt=WGt,bJt=KGt,_Jt=GGt,DBe=JGt,vJt=QGt;var LBe=rJt,FBe=oJt,wJt=iJt,SJt=sJt,kBe=uJt,$Be=lJt,BBe=dJt;bn();Tn();var Hz=gJt;var Vz=yJt,fL=ji.forwardRef(({className:t,children:e,...r},n)=>ji.createElement(NBe,{ref:n,className:_e("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,ji.createElement(bJt,{asChild:!0},ji.createElement(Hi,{className:"tw-size-4"}))));fL.displayName=NBe.displayName;var xJt=ji.forwardRef(({className:t,...e},r)=>ji.createElement(kBe,{ref:r,className:_e("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},ji.createElement(Ey,{className:"tw-size-4"})));xJt.displayName=kBe.displayName;var CJt=ji.forwardRef(({className:t,...e},r)=>ji.createElement($Be,{ref:r,className:_e("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},ji.createElement(Hi,{className:"tw-size-4"})));CJt.displayName=$Be.displayName;var pL=ji.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>ji.createElement(_Jt,{container:n},ji.createElement(DBe,{ref:i,className:_e("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},ji.createElement(xJt,null),ji.createElement(vJt,{className:_e("tw-p-1",r==="popper"&&"tw-h-[var(--radix-select-trigger-height)] tw-w-full tw-min-w-[var(--radix-select-trigger-width)]")},e),ji.createElement(CJt,null))));pL.displayName=DBe.displayName;var yIn=ji.forwardRef(({className:t,...e},r)=>ji.createElement(LBe,{ref:r,className:_e("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t),...e}));yIn.displayName=LBe.displayName;var mL=ji.forwardRef(({className:t,children:e,...r},n)=>ji.createElement(FBe,{ref:n,className:_e("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},ji.createElement("span",{className:"tw-absolute tw-right-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},ji.createElement(SJt,null,ji.createElement(Jl,{className:"tw-size-4"}))),ji.createElement(wJt,null,e)));mL.displayName=FBe.displayName;var bIn=ji.forwardRef(({className:t,...e},r)=>ji.createElement(BBe,{ref:r,className:_e("-tw-mx-1 tw-my-1 tw-h-px tw-bg-primary-alt",t),...e}));bIn.displayName=BBe.displayName;Tn();yo();nr();bn();var PJt=require("obsidian"),De=F(X());function _In(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 OJt(t,e,r={}){return!t||t.length===0?[]:e.trim()?t.filter(n=>_In(n,e,r)):t}function vIn({project:t,loadContext:e,onEdit:r,onDelete:n}){return De.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)},De.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2 tw-overflow-hidden"},De.default.createElement("div",{className:"tw-text-accent"},De.default.createElement(Iy,{className:"tw-size-4"})),De.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-col tw-gap-1.5 tw-overflow-hidden"},De.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[13px] tw-font-medium tw-text-normal"},t.name),t.description&&De.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[12px] tw-text-muted/80"},t.description))),De.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-1 tw-opacity-100 tw-transition-opacity tw-duration-200"},De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),r(t)}},De.default.createElement(rO,{className:"tw-size-4"}))),De.default.createElement(Mt,{side:"bottom"},"Edit Project")),De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),e(t)}},De.default.createElement(nk,{className:"tw-size-4"}))),De.default.createElement(Mt,{side:"bottom"},"Start Chat")),De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),new sd(app,()=>n(t),`Are you sure you want to delete project "${t.name}"?`,"Delete Project").open()}},De.default.createElement(Rm,{className:"tw-size-4"}))),De.default.createElement(Mt,{side:"bottom"},"Delete Project"))))}var qBe=(0,De.memo)(({className:t,projects:e,defaultOpen:r=!1,app:n,onProjectAdded:o,onEditProject:i,hasMessages:a=!1,showChatUI:s,onClose:u,inputRef:l})=>{let[c,d]=(0,De.useState)(r),[f,p]=(0,De.useState)(!1),[m,h]=(0,De.useState)(null),[b,g]=(0,De.useState)("");(0,De.useEffect)(()=>{a&&d(!1)},[a]);let y=(0,De.useMemo)(()=>OJt(e,b),[e,b]),S=()=>{new E9(n,async I=>{o(I)}).open()},x=A=>{new E9(n,async R=>{i(A,R),m&&m.name===A.name&&h(R)},A).open()},O=A=>{let R=(e||[]).filter(N=>N.name!==A.name);m?.name===A.name&&P(!1),dt("projectList",R),new PJt.Notice(`Project "${A.name}" deleted successfully`)},P=(A,I)=>{if(A){if(!I){fe("Must be exist one project.");return}h(I),p(!0),d(!1)}else{h(null),p(!1),d(!0),s(!1),zR(null);return}},E=A=>{h(A),p(!0),d(!1),s(!0),zR(A),setTimeout(()=>{l.current&&l.current.focus()},0)};return De.default.createElement("div",{className:_e("tw-flex tw-flex-col",t)},De.default.createElement("div",{className:"tw-overflow-y-auto"},De.default.createElement("div",{className:"tw-flex tw-flex-col"},f&&m?De.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-py-3"},De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),De.default.createElement(Hz,{value:m.name,onValueChange:A=>{let I=e.find(R=>R.name===A);I&&E(I)}},De.default.createElement(fL,{className:"tw-w-[200px]"},De.default.createElement(Vz,null,De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(Iy,{className:"tw-size-4 tw-text-accent/70"}),De.default.createElement("span",null,m.name)))),De.default.createElement(pL,null,e.map(A=>De.default.createElement(mL,{key:A.name,value:A.name,className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(Iy,{className:"tw-size-4"}),A.name)))))),De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(ge,{variant:"secondary",onClick:()=>x(m),className:"hover:tw-text-on-accent hover:tw-bg-accent/50"},De.default.createElement(rO,{className:"tw-mr-1 tw-size-4"}),"Edit"),De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:()=>{P(!1)},"aria-label":"Close Current Project"},De.default.createElement(Vi,{className:"tw-size-4"}))),De.default.createElement(Mt,{side:"bottom"},"Close Current Project")))):De.default.createElement(cE,{open:c,onOpenChange:d,className:"tw-transition-all tw-duration-200 tw-ease-in-out"},De.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-4 tw-py-3"},De.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},De.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement(f_,{className:"tw-size-4 tw-text-muted"})),De.default.createElement(Mt,{side:"bottom",className:"tw-w-64"},"Manage your projects with different contexts and configurations."))),De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(ge,{className:"tw-px-2",variant:"secondary",onClick:S},"Create",De.default.createElement(Mm,{className:"tw-size-3"})),e.length>0&&De.default.createElement(rL,{asChild:!0},De.default.createElement(ge,{variant:"ghost2",size:"icon"},c?De.default.createElement(Ey,{className:"tw-size-5"}):De.default.createElement(Hi,{className:"tw-size-5"}))),De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:()=>u(),"aria-label":"close project mode"},De.default.createElement(Vi,{className:"tw-size-4"}))),De.default.createElement(Mt,{side:"bottom"},"Close Project Mode")))),e.length===0&&De.default.createElement("div",{className:"tw-px-4 tw-py-2 tw-text-xs tw-text-muted tw-bg-secondary/30"},"No projects available"),De.default.createElement(dE,{className:"tw-transition-all tw-duration-200 tw-ease-in-out"},De.default.createElement("div",{className:"tw-relative tw-bg-secondary/30"},e.length>0&&De.default.createElement("div",{className:"tw-px-4 tw-pb-2 tw-pt-3"},De.default.createElement("div",{className:"tw-relative"},De.default.createElement(qde,{value:b,onChange:g,placeholder:"Search projects..."}))),De.default.createElement("div",{className:"tw-max-h-[calc(3*5.7rem)] tw-overflow-y-auto tw-px-4 tw-pb-6 tw-pt-3"},De.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"},y.map(A=>De.default.createElement(vIn,{key:A.name,project:A,loadContext:E,onEdit:x,onDelete:O}))),b.trim()&&y.length===0&&De.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-8 tw-text-muted"},De.default.createElement(d1,{className:"tw-mb-3 tw-size-12 tw-text-muted/50"}),De.default.createElement("p",{className:"tw-text-base tw-font-medium"},"No matching projects found"),De.default.createElement("p",{className:"tw-mt-1 tw-text-sm"},"Try searching with different keywords"))),e.length>0&&De.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%)]"}))))),!f&&De.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"},De.default.createElement("div",{className:"tw-max-w-[600px] tw-space-y-4"},De.default.createElement("p",{className:"tw-text-center tw-text-base"},"Create your project-based AI assistants with custom instructions, context, and model configurations."),De.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-text-sm"},De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(nk,{className:"tw-size-4"}),De.default.createElement("span",null,"Click a project card to start chatting")))))))});qBe.displayName="ProjectList";$r();$r();yn();yo();var UBe=async(t,e,r,n,o,i={})=>{let a=new AbortController;o(a);try{await e.runChain(t,a,n,r,i)}catch(s){fe("Model request failed:",s);let u="Model request failed: "+ei(s);r({sender:e_,isErrorMessage:!0,message:`Error: ${u}`,isVisible:!0,timestamp:Vl(new Date)})}};oO();nr();var hL=F(X()),zBe=class{constructor(e){this.plugin=e;this.chatHistory=[];this.plugin=e}addMessage(e){this.chatHistory.push(e),this.plugin.projectManager.getCurrentChainManager().addChatMessage(e)}getMessages(){return this.chatHistory}clearChatHistory(){this.chatHistory=[],this.plugin.projectManager.getCurrentChainManager().clearHistory()}replaceMessages(e){this.chatHistory=[...e]}};function EJt(t){let[e,r]=(0,hL.useState)(t.getMessages());(0,hL.useEffect)(()=>{r([...t.getMessages()])},[t,t.chatHistory]);let n=(0,hL.useCallback)(i=>{t.addMessage(i),r([...t.getMessages()])},[t]),o=(0,hL.useCallback)(()=>{t.clearChatHistory(),r([])},[t]);return[e,n,o]}var TJt=zBe;yn();var AJt=F(Pp()),pm=require("obsidian"),xr=F(X()),wIn=({sharedState:t,chainManager:e,onSaveChat:r,updateUserMessageHistory:n,fileParserManager:o,plugin:i})=>{let a=Rn(),s=(0,xr.useContext)(vz),[u,l,c]=EJt(t),[d]=SF(),[f]=by(),[p,m]=(0,xr.useState)(""),[h,b]=(0,xr.useState)(""),[g,y]=(0,xr.useState)(null),[S,x]=(0,xr.useState)(!1),[O,P]=(0,xr.useState)(t_.DEFAULT),[E,A]=(0,xr.useState)([]),[I,R]=(0,xr.useState)(!1),[N,j]=(0,xr.useState)([]),[$,k]=(0,xr.useState)(!1),[z]=s8e(),[V,Q]=(0,xr.useState)(null),[J,D]=by(),B=xq(),q=Oq.getInstance(),K=hz.getInstance(),H=(0,xr.useRef)(null);(0,xr.useEffect)(()=>{let te=()=>{H.current&&H.current.focus()};return s?.addEventListener(Dh.CHAT_IS_VISIBLE,te),()=>{s?.removeEventListener(Dh.CHAT_IS_VISIBLE,te)}},[s]);let ee=(0,xr.useContext)(_de),U=i.app||ee,W=async({toolCalls:te,urls:et,contextNotes:Re}={})=>{if(!h&&N.length===0)return;let Pe=Vl(new Date),oe=[];h&&oe.push({type:"text",text:h});for(let _f of N){let uC=await _f.arrayBuffer(),kb=AJt.Buffer.from(uC).toString("base64");oe.push({type:"image_url",image_url:{url:`data:${_f.type};base64,${kb}`}})}let se=[...Re||[]],ce=U.workspace.getActiveFile();I&&J!=="project"&&ce&&!se.some(_f=>_f.path===ce.path)&&se.push(ce);let Ce={message:h||"Image message",originalMessage:h,sender:Pi,isVisible:!0,timestamp:Pe,content:oe,context:{notes:se,urls:et||[],selectedTextContexts:z}};b(""),j([]),l(Ce),x(!0),P(t_.DEFAULT);let Je=h,ir=await sVe();h.includes("@composer")&&ir!==""&&(Je=h+` `+ir+` -`);let{processedPrompt:ea,includedFiles:ta}=await lce(Je||"","",U.vault,U.workspace.getActiveFile()),xc=f==="copilot_plus"?await q.processUrls(h||""):{urlContext:"",imageUrls:[]},Cd=new Set(ta.map(_f=>_f.path)),qi=await K.processContextNotes(Cd,o,U.vault,se,I,ce,f),lp=K.processSelectedTextContexts(),yf=ea+xc.urlContext+qi+lp,bf=h;te&&(bf+=" "+te.join(` -`));let Sn={message:yf,originalMessage:bf,sender:Pi,isVisible:!1,timestamp:Pe,content:oe,context:{notes:se,urls:f==="copilot_plus"?[...et||[],...xc.imageUrls]:et||[],selectedTextContexts:z}};l(Sn),h&&n(h),a.autosaveChat&&Y(),await BBe(Sn,e,l,m,y,{debug:a.debug,updateLoadingMessage:P}),a.autosaveChat&&Y(),x(!1),P(t_.DEFAULT)},Y=(0,xr.useCallback)(async()=>{if(!U){console.error("App instance is not available.");return}let te=t.getMessages().filter(Pe=>Pe.isVisible);if(te.length===0){new pm.Notice("No messages to save.");return}let et=te[0].timestamp?.epoch||Date.now(),Re=te.map(Pe=>`**${Pe.sender}**: ${Pe.message} +`);let{processedPrompt:ea,includedFiles:ta}=await fce(Je||"","",U.vault,U.workspace.getActiveFile()),xc=f==="copilot_plus"?await q.processUrls(h||""):{urlContext:"",imageUrls:[]},Cd=new Set(ta.map(_f=>_f.path)),qi=await K.processContextNotes(Cd,o,U.vault,se,I,ce,f),lp=K.processSelectedTextContexts(),yf=ea+xc.urlContext+qi+lp,bf=h;te&&(bf+=" "+te.join(` +`));let xn={message:yf,originalMessage:bf,sender:Pi,isVisible:!1,timestamp:Pe,content:oe,context:{notes:se,urls:f==="copilot_plus"?[...et||[],...xc.imageUrls]:et||[],selectedTextContexts:z}};l(xn),h&&n(h),a.autosaveChat&&Y(),await UBe(xn,e,l,m,y,{debug:a.debug,updateLoadingMessage:P}),a.autosaveChat&&Y(),x(!1),P(t_.DEFAULT)},Y=(0,xr.useCallback)(async()=>{if(!U){console.error("App instance is not available.");return}let te=t.getMessages().filter(Pe=>Pe.isVisible);if(te.length===0){new pm.Notice("No messages to save.");return}let et=te[0].timestamp?.epoch||Date.now(),Re=te.map(Pe=>`**${Pe.sender}**: ${Pe.message} [Timestamp: ${Pe.timestamp?.display}]`).join(` `);try{U.vault.getAbstractFileByPath(a.defaultSaveFolder)||await U.vault.createFolder(a.defaultSaveFolder);let{fileName:oe}=Vl(new Date(et)),se=te.find(qi=>qi.sender===Pi),ce=se?se.message.split(/\s+/).slice(0,10).join(" ").replace(/[\\/:*?"<>|]/g,"").trim():"Untitled Chat",Ce=a.defaultConversationNoteName||"{$date}_{$time}__{$topic}";Ce=Ce.replace("{$topic}",ce.slice(0,100).replace(/\s+/g,"_")).replace("{$date}",oe.split("_")[0]).replace("{$time}",oe.split("_")[1]);let Je=Ce.replace(/[\\/:*?"<>|]/g,"_"),ir=Mc(),ea=ir?`${ir.id}__`:"",ta=`${a.defaultSaveFolder}/${ea}${Je}.md`,xc=`--- @@ -1022,24 +1022,24 @@ tags: ${ir?` - project-${ir.name}`:""} --- -${Re}`,Cd=U.vault.getAbstractFileByPath(ta);Cd instanceof pm.TFile?await U.vault.modify(Cd,xc):(await U.vault.create(ta,xc),new pm.Notice(`Chat saved as note: ${ta}`))}catch(Pe){console.error("Error saving chat as note:",ei(Pe)),new pm.Notice("Failed to save chat as note. Check console for details.")}},[U,t,d,a.defaultConversationTag,a.defaultSaveFolder,a.defaultConversationNoteName]),ae=(0,xr.useCallback)(te=>{g&&(a.debug&&console.log(`stopping generation..., reason: ${te}`),g.abort(te),x(!1),P(t_.DEFAULT))},[g,a.debug]),Oe=(0,xr.useCallback)(async te=>{let et=te-1;if(et<0||u[et].sender!==Pi){new pm.Notice("Cannot regenerate the first message or a user message.");return}let Re=u[et],Pe=u.slice(0,te);c(),Pe.forEach(l),e.memoryManager.clearChatMemory();for(let oe=0;oe{let Re=u[te].message;if(Re===et)return;let Pe=[...u];for(let oe=te;oe()=>{let Re=ue().debug,Pe=async oe=>{let ce={message:await et(oe.detail.selectedText,oe.detail.eventSubtype),sender:Pi,isVisible:Re,timestamp:Vl(new Date)};Re&&l(ce),x(!0),await BBe(ce,e,l,m,y,{debug:Re,ignoreSystemMessage:!0}),x(!1)};return s?.addEventListener(te,Pe),()=>{s?.removeEventListener(te,Pe)}})(Br.APPLY_ADHOC_PROMPT,async(te,et)=>et?(await lce(et,te,U.vault,U.workspace.getActiveFile())).processedPrompt:te),[]),(0,xr.useEffect)(()=>{r&&r(Y)},[r,Y]);let ze=(0,xr.useCallback)(async te=>{let et=[...u];et.splice(te,1),c(),et.forEach(l),await _N(et,e.memoryManager)},[l,e.memoryManager,u,c]),rt=(0,xr.useCallback)(te=>{let et=a.projectList||[];if(et.findIndex(se=>se.name===te.name)>=0)throw new Error(`Project "${te.name}" already exists, please use a different name`);let Pe=[...et,te];return dt("projectList",Pe),Mc()?.id===te.id?Jce().then(()=>{new pm.Notice(`${te.name} added and context loaded`)}).catch(se=>{console.error("Error loading project context:",se),new pm.Notice(`${te.name} added but context loading failed`)}):new pm.Notice(`${te.name} added successfully`),!0},[a.projectList]),cr=(0,xr.useCallback)((te,et)=>{let Re=a.projectList||[];if(!Re.find(ce=>ce.name===te.name))throw new Error(`Project "${te.name}" does not exist`);let oe=Re.map(ce=>ce.name===te.name?et:ce);return dt("projectList",oe),Mc()?.id===te.id?(UR(et),Jce().then(()=>{new pm.Notice(`${te.name} updated and context reloaded`)}).catch(ce=>{console.error("Error reloading project context:",ce),new pm.Notice(`${te.name} updated but context reload failed`)})):new pm.Notice(`${te.name} updated successfully`),!0},[a.projectList]),wn=(0,xr.useCallback)(te=>{b(et=>`${et} ${te} `)},[]),Le=(0,xr.useCallback)(te=>{t8e(te)},[]),pt=(0,xr.useCallback)(async()=>{ae("new-chat"),await i.handleNewChat(),m(""),A([]),r8e(),J!=="copilot_plus"?R(!1):R(a.includeActiveNoteAsContext)},[ae,i,a.includeActiveNoteAsContext,J]),mt=(0,xr.useCallback)(()=>{i.loadCopilotChatHistory()},[i]);(0,xr.useEffect)(()=>{let te=et=>{let Re=et.detail?.reason||"new-chat";ae(Re)};return s?.addEventListener(Dh.ABORT_STREAM,te),()=>{s?.removeEventListener(Dh.ABORT_STREAM,te)}},[s,ae]),(0,xr.useEffect)(()=>{a.includeActiveNoteAsContext!==void 0&&(J==="copilot_plus"?R(a.includeActiveNoteAsContext):R(!1))},[a.includeActiveNoteAsContext,J]);let ht=()=>xr.default.createElement(xr.default.Fragment,null,xr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},xr.default.createElement(c9t,{currentVersion:i.manifest.version}),xr.default.createElement(l9t,{chatHistory:u,currentAiMessage:p,loading:S,loadingMessage:O,app:U,onRegenerate:Oe,onEdit:le,onDelete:ze,onInsertToChat:wn,onReplaceChat:b,showHelperComponents:J!=="project"}),xr.default.createElement(B6t,{onNewChat:pt,onSaveAsNote:()=>Y(),onLoadHistory:mt,onModeChange:te=>{Q(J),te==="project"&&k(!1)}}),xr.default.createElement(I5t,{ref:H,inputMessage:h,setInputMessage:b,handleSendMessage:W,isGenerating:S,onStopGenerating:()=>ae("user-stopped"),app:U,contextNotes:E,setContextNotes:A,includeActiveNote:I,setIncludeActiveNote:R,mention:q,selectedImages:N,onAddImage:te=>j(et=>[...et,...te]),setSelectedImages:j,disableModelSwitch:J==="project",selectedTextContexts:z,onRemoveSelectedText:Le})));return xr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},xr.default.createElement("div",{className:"tw-h-full"},xr.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},J==="project"&&xr.default.createElement("div",{className:`${J==="project"?"tw-z-modal":""}`},xr.default.createElement($Be,{projects:a.projectList||[],defaultOpen:!0,app:U,hasMessages:!1,onProjectAdded:rt,onEditProject:cr,inputRef:H,onClose:()=>{V?(D(V),Q(null)):D(B?"copilot_plus":"llm_chain")},showChatUI:te=>k(te)})),(J!=="project"||J==="project"&&$)&&ht())))},OJt=gIn;$r();var PJt=require("obsidian"),kM=F(X()),EJt=F(Dc()),$M=class extends PJt.ItemView{constructor(r,n){super(r);this.plugin=n;this.root=null;this.handleSaveAsNote=null;this.sharedState=n.sharedState,this.app=n.app,this.fileParserManager=n.fileParserManager,this.eventTarget=new EventTarget,this.plugin=n}get chainManager(){return this.plugin.projectManager.getCurrentChainManager()}getViewType(){return Es}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){this.root=(0,EJt.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(kM.createElement(gde.Provider,{value:this.app},kM.createElement(_z.Provider,{value:this.eventTarget},kM.createElement(kM.StrictMode,null,kM.createElement(Gce,{delayDuration:0},kM.createElement(OJt,{sharedState:this.sharedState,chainManager:this.chainManager,updateUserMessageHistory:n,fileParserManager:this.fileParserManager,plugin:this.plugin,onSaveChat:r}))))))}async saveChat(){this.handleSaveAsNote&&await this.handleSaveAsNote()}updateView(){this.sharedState.replaceMessages(this.plugin.projectManager.getCurrentChainManager().getChatMessages());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)}};Cn();var TJt=require("obsidian"),nfe=class extends TJt.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 o=r.basename.replace(/^[a-zA-Z0-9-]+__/,"").replace(/\{\$date}|\d{8}/g,"").replace(/\{\$time}|\d{6}/g,"").replace(/[@_]/g," ").replace(/\s+/g," ").trim(),i,a=this.app.metadataCache.getFileCache(r)?.frontmatter;return a&&a.epoch?i=Vl(new Date(a.epoch)):i=Vl(new Date(r.stat.ctime)),`${o} - ${i.display}`}onChooseItem(r,n){this.onChooseFile(r)}};$r();$r();function AJt(t){t.addItem(n=>{n.setTitle("Copilot: Add selection to chat context").onClick(()=>{app.commands.executeCommandById(`copilot:${Br.ADD_SELECTION_TO_CHAT_CONTEXT}`)})});let e=Gx();e.filter(n=>n.showInContextMenu).length>0&&t.addSeparator(),AW(e.filter(n=>n.showInContextMenu)).forEach(n=>{t.addItem(o=>{o.setTitle(`Copilot: ${n.title}`).onClick(()=>{app.commands.executeCommandById(`copilot:${JU(n.title)}`)})})})}BR();yo();nO();Ix();$r();nr();var oK=require("obsidian"),Eqe=F(X()),KYt=F(Dc());var ofe=class extends sd{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")}};ti();var R9=F(X());Tn();var IJt=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>R9.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:_e("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")},R9.default.createElement("div",{className:_e("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),R9.default.createElement("span",{className:_e("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)),MJt=({id:t,children:e,isSelected:r})=>r?R9.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:_e("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 hh=F(X()),RJt=(0,hh.createContext)(void 0),jJt=({children:t})=>{let[e,r]=(0,hh.useState)("basic"),[n,o]=(0,hh.useState)(null),i=(0,hh.useRef)(!1);return(0,hh.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),hh.default.createElement(RJt.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},Vz=()=>{let t=(0,hh.useContext)(RJt);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};nr();var it=F(X());ti();yn();var ql=F(X());Tn();var j9=ql.forwardRef(({className:t,...e},r)=>ql.createElement("div",{className:"tw-relative tw-w-full tw-overflow-auto"},ql.createElement("table",{ref:r,className:_e("tw-w-full tw-caption-bottom tw-border-collapse tw-text-sm",t),...e})));j9.displayName="Table";var N9=ql.forwardRef(({className:t,...e},r)=>ql.createElement("thead",{ref:r,className:_e("[&_tr]:tw-border-b",t),...e}));N9.displayName="TableHeader";var D9=ql.forwardRef(({className:t,...e},r)=>ql.createElement("tbody",{ref:r,className:t,...e}));D9.displayName="TableBody";var yIn=ql.forwardRef(({className:t,...e},r)=>ql.createElement("tfoot",{ref:r,className:_e("tw-border-t tw-font-medium tw-bg-primary-alt/50",t),...e}));yIn.displayName="TableFooter";var BM=ql.forwardRef(({className:t,...e},r)=>ql.createElement("tr",{ref:r,className:_e("tw-border-b tw-transition-colors hover:tw-bg-primary-alt/50 data-[state=selected]:tw-bg-primary-alt",t),...e}));BM.displayName="TableRow";var ap=ql.forwardRef(({className:t,...e},r)=>ql.createElement("th",{ref:r,className:_e("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}));ap.displayName="TableHead";var gf=ql.forwardRef(({className:t,...e},r)=>ql.createElement("td",{ref:r,className:_e("tw-p-2 tw-align-middle [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));gf.displayName="TableCell";var bIn=ql.forwardRef(({className:t,...e},r)=>ql.createElement("caption",{ref:r,className:_e("tw-mt-4 tw-text-sm tw-text-muted",t),...e}));bIn.displayName="TableCaption";var Kz=F(X());var gh=F(X(),1);var DJt=F(X(),1);function NJt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function UBe(...t){return e=>{let r=!1,n=t.map(o=>{let i=NJt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:r,...n}=t,o=vd.Children.toArray(r),i=o.find(vIn);if(i){let a=i.props.children,s=o.map(u=>u===i?vd.Children.count(a)>1?vd.Children.only(null):vd.isValidElement(a)?a.props.children:null:u);return(0,Wz.jsx)(HBe,{...n,ref:e,children:vd.isValidElement(a)?vd.cloneElement(a,void 0,s):null})}return(0,Wz.jsx)(HBe,{...n,ref:e,children:r})});VBe.displayName="Slot";var HBe=vd.forwardRef((t,e)=>{let{children:r,...n}=t;if(vd.isValidElement(r)){let o=SIn(r);return vd.cloneElement(r,{...wIn(n,r.props),ref:e?UBe(e,o):o})}return vd.Children.count(r)>1?vd.Children.only(null):null});HBe.displayName="SlotClone";var _In=({children:t})=>(0,Wz.jsx)(Wz.Fragment,{children:t});function vIn(t){return vd.isValidElement(t)&&t.type===_In}function wIn(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 SIn(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 kJt=F(ft(),1),CIn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],WBe=CIn.reduce((t,e)=>{let r=FJt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?VBe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,kJt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var UM=F(ft(),1),KBe="Checkbox",[OIn,Z_i]=Yi(KBe),[PIn,EIn]=OIn(KBe),$Jt=gh.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]=gh.useState(null),m=LJt(e,x=>p(x)),h=gh.useRef(!1),b=f?c||!!f.closest("form"):!0,[g=!1,y]=ud({prop:o,defaultProp:i,onChange:l}),S=gh.useRef(g);return gh.useEffect(()=>{let x=f?.form;if(x){let O=()=>y(S.current);return x.addEventListener("reset",O),()=>x.removeEventListener("reset",O)}},[f,y]),(0,UM.jsxs)(PIn,{scope:r,state:g,disabled:s,children:[(0,UM.jsx)(WBe.button,{type:"button",role:"checkbox","aria-checked":qM(g)?"mixed":g,"aria-required":a,"data-state":UJt(g),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:m,onKeyDown:zBe(t.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:zBe(t.onClick,x=>{y(O=>qM(O)?!0:!O),b&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})}),b&&(0,UM.jsx)(TIn,{control:f,bubbles:!h.current,name:n,value:u,checked:g,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:qM(i)?!1:i})]})});$Jt.displayName=KBe;var BJt="CheckboxIndicator",qJt=gh.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=EIn(BJt,r);return(0,UM.jsx)(fd,{present:n||qM(i.state)||i.state===!0,children:(0,UM.jsx)(WBe.span,{"data-state":UJt(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});qJt.displayName=BJt;var TIn=t=>{let{control:e,checked:r,bubbles:n=!0,defaultChecked:o,...i}=t,a=gh.useRef(null),s=Lz(r),u=Xx(e);gh.useEffect(()=>{let c=a.current,d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(s!==r&&p){let m=new Event("click",{bubbles:n});c.indeterminate=qM(r),p.call(c,qM(r)?!1:r),c.dispatchEvent(m)}},[s,r,n]);let l=gh.useRef(qM(r)?!1:r);return(0,UM.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 qM(t){return t==="indeterminate"}function UJt(t){return qM(t)?"indeterminate":t?"checked":"unchecked"}var GBe=$Jt,zJt=qJt;yn();Tn();var wd=Kz.forwardRef(({className:t,...e},r)=>Kz.createElement(GBe,{ref:r,className:_e("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},Kz.createElement(zJt,{className:_e("tw-flex tw-items-center tw-justify-center tw-text-current")},Kz.createElement(Jl,{className:"tw-size-4"}))));wd.displayName=GBe.displayName;var Ae=F(X()),wL=F(ds());var Ls=F(X());function VJt(){for(var t=arguments.length,e=new Array(t),r=0;rn=>{e.forEach(o=>o(n))},e)}var L9=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hL(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function ife(t){return"nodeType"in t}function sp(t){var e,r;return t?hL(t)?t:ife(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function afe(t){let{Document:e}=sp(t);return t instanceof e}function Gz(t){return hL(t)?!1:t instanceof sp(t).HTMLElement}function YBe(t){return t instanceof sp(t).SVGElement}function gL(t){return t?hL(t)?t.document:ife(t)?afe(t)?t:Gz(t)||YBe(t)?t.ownerDocument:document:document:document}var oy=L9?Ls.useLayoutEffect:Ls.useEffect;function sfe(t){let e=(0,Ls.useRef)(t);return oy(()=>{e.current=t}),(0,Ls.useCallback)(function(){for(var r=arguments.length,n=new Array(r),o=0;o{t.current=setInterval(n,o)},[]),r=(0,Ls.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function Jz(t,e){e===void 0&&(e=[t]);let r=(0,Ls.useRef)(t);return oy(()=>{r.current!==t&&(r.current=t)},e),r}function Yz(t,e){let r=(0,Ls.useRef)();return(0,Ls.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function F9(t){let e=sfe(t),r=(0,Ls.useRef)(null),n=(0,Ls.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function ufe(t){let e=(0,Ls.useRef)();return(0,Ls.useEffect)(()=>{e.current=t},[t]),e.current}var JBe={};function yL(t,e){return(0,Ls.useMemo)(()=>{if(e)return e;let r=JBe[t]==null?0:JBe[t]+1;return JBe[t]=r,t+"-"+r},[t,e])}function KJt(t){return function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o{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 bL=KJt(1),_L=KJt(-1);function IIn(t){return"clientX"in t&&"clientY"in t}function k9(t){if(!t)return!1;let{KeyboardEvent:e}=sp(t.target);return e&&t instanceof e}function MIn(t){if(!t)return!1;let{TouchEvent:e}=sp(t.target);return e&&t instanceof e}function lfe(t){if(MIn(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 IIn(t)?{x:t.clientX,y:t.clientY}:null}var Rb=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[Rb.Translate.toString(t),Rb.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),HJt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function GJt(t){return t.matches(HJt)?t:t.querySelector(HJt)}var vL=F(X()),RIn={display:"none"};function JJt(t){let{id:e,value:r}=t;return vL.default.createElement("div",{id:e,style:RIn},r)}function YJt(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 vL.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function ZJt(){let[t,e]=(0,vL.useState)("");return{announce:(0,vL.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var c7t=(0,Ae.createContext)(null);function jIn(t){let e=(0,Ae.useContext)(c7t);(0,Ae.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function NIn(){let[t]=(0,Ae.useState)(()=>new Set),e=(0,Ae.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,Ae.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 DIn={draggable:` +${Re}`,Cd=U.vault.getAbstractFileByPath(ta);Cd instanceof pm.TFile?await U.vault.modify(Cd,xc):(await U.vault.create(ta,xc),new pm.Notice(`Chat saved as note: ${ta}`))}catch(Pe){console.error("Error saving chat as note:",ei(Pe)),new pm.Notice("Failed to save chat as note. Check console for details.")}},[U,t,d,a.defaultConversationTag,a.defaultSaveFolder,a.defaultConversationNoteName]),ae=(0,xr.useCallback)(te=>{g&&(a.debug&&console.log(`stopping generation..., reason: ${te}`),g.abort(te),x(!1),P(t_.DEFAULT))},[g,a.debug]),Oe=(0,xr.useCallback)(async te=>{let et=te-1;if(et<0||u[et].sender!==Pi){new pm.Notice("Cannot regenerate the first message or a user message.");return}let Re=u[et],Pe=u.slice(0,te);c(),Pe.forEach(l),e.memoryManager.clearChatMemory();for(let oe=0;oe{let Re=u[te].message;if(Re===et)return;let Pe=[...u];for(let oe=te;oe()=>{let Re=ue().debug,Pe=async oe=>{let ce={message:await et(oe.detail.selectedText,oe.detail.eventSubtype),sender:Pi,isVisible:Re,timestamp:Vl(new Date)};Re&&l(ce),x(!0),await UBe(ce,e,l,m,y,{debug:Re,ignoreSystemMessage:!0}),x(!1)};return s?.addEventListener(te,Pe),()=>{s?.removeEventListener(te,Pe)}})(Br.APPLY_ADHOC_PROMPT,async(te,et)=>et?(await fce(et,te,U.vault,U.workspace.getActiveFile())).processedPrompt:te),[]),(0,xr.useEffect)(()=>{r&&r(Y)},[r,Y]);let ze=(0,xr.useCallback)(async te=>{let et=[...u];et.splice(te,1),c(),et.forEach(l),await vN(et,e.memoryManager)},[l,e.memoryManager,u,c]),rt=(0,xr.useCallback)(te=>{let et=a.projectList||[];if(et.findIndex(se=>se.name===te.name)>=0)throw new Error(`Project "${te.name}" already exists, please use a different name`);let Pe=[...et,te];return dt("projectList",Pe),Mc()?.id===te.id?Xce().then(()=>{new pm.Notice(`${te.name} added and context loaded`)}).catch(se=>{console.error("Error loading project context:",se),new pm.Notice(`${te.name} added but context loading failed`)}):new pm.Notice(`${te.name} added successfully`),!0},[a.projectList]),cr=(0,xr.useCallback)((te,et)=>{let Re=a.projectList||[];if(!Re.find(ce=>ce.name===te.name))throw new Error(`Project "${te.name}" does not exist`);let oe=Re.map(ce=>ce.name===te.name?et:ce);return dt("projectList",oe),Mc()?.id===te.id?(zR(et),Xce().then(()=>{new pm.Notice(`${te.name} updated and context reloaded`)}).catch(ce=>{console.error("Error reloading project context:",ce),new pm.Notice(`${te.name} updated but context reload failed`)})):new pm.Notice(`${te.name} updated successfully`),!0},[a.projectList]),Sn=(0,xr.useCallback)(te=>{b(et=>`${et} ${te} `)},[]),je=(0,xr.useCallback)(te=>{i8e(te)},[]),mt=(0,xr.useCallback)(async()=>{ae("new-chat"),await i.handleNewChat(),m(""),A([]),a8e(),J!=="copilot_plus"?R(!1):R(a.includeActiveNoteAsContext)},[ae,i,a.includeActiveNoteAsContext,J]),ht=(0,xr.useCallback)(()=>{i.loadCopilotChatHistory()},[i]);(0,xr.useEffect)(()=>{let te=et=>{let Re=et.detail?.reason||"new-chat";ae(Re)};return s?.addEventListener(Dh.ABORT_STREAM,te),()=>{s?.removeEventListener(Dh.ABORT_STREAM,te)}},[s,ae]),(0,xr.useEffect)(()=>{a.includeActiveNoteAsContext!==void 0&&(J==="copilot_plus"?R(a.includeActiveNoteAsContext):R(!1))},[a.includeActiveNoteAsContext,J]);let ft=()=>xr.default.createElement(xr.default.Fragment,null,xr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},xr.default.createElement(h9t,{currentVersion:i.manifest.version}),xr.default.createElement(m9t,{chatHistory:u,currentAiMessage:p,loading:S,loadingMessage:O,app:U,onRegenerate:Oe,onEdit:le,onDelete:ze,onInsertToChat:Sn,onReplaceChat:b,showHelperComponents:J!=="project"}),xr.default.createElement(V6t,{onNewChat:mt,onSaveAsNote:()=>Y(),onLoadHistory:ht,onModeChange:te=>{Q(J),te==="project"&&k(!1)}}),xr.default.createElement(D5t,{ref:H,inputMessage:h,setInputMessage:b,handleSendMessage:W,isGenerating:S,onStopGenerating:()=>ae("user-stopped"),app:U,contextNotes:E,setContextNotes:A,includeActiveNote:I,setIncludeActiveNote:R,mention:q,selectedImages:N,onAddImage:te=>j(et=>[...et,...te]),setSelectedImages:j,disableModelSwitch:J==="project",selectedTextContexts:z,onRemoveSelectedText:je})));return xr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},xr.default.createElement("div",{className:"tw-h-full"},xr.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},J==="project"&&xr.default.createElement("div",{className:`${J==="project"?"tw-z-modal":""}`},xr.default.createElement(qBe,{projects:a.projectList||[],defaultOpen:!0,app:U,hasMessages:!1,onProjectAdded:rt,onEditProject:cr,inputRef:H,onClose:()=>{V?(D(V),Q(null)):D(B?"copilot_plus":"llm_chain")},showChatUI:te=>k(te)})),(J!=="project"||J==="project"&&$)&&ft())))},IJt=wIn;$r();var MJt=require("obsidian"),kM=F(X()),RJt=F(Dc()),$M=class extends MJt.ItemView{constructor(r,n){super(r);this.plugin=n;this.root=null;this.handleSaveAsNote=null;this.sharedState=n.sharedState,this.app=n.app,this.fileParserManager=n.fileParserManager,this.eventTarget=new EventTarget,this.plugin=n}get chainManager(){return this.plugin.projectManager.getCurrentChainManager()}getViewType(){return Es}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){this.root=(0,RJt.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(kM.createElement(_de.Provider,{value:this.app},kM.createElement(vz.Provider,{value:this.eventTarget},kM.createElement(kM.StrictMode,null,kM.createElement(Zce,{delayDuration:0},kM.createElement(IJt,{sharedState:this.sharedState,chainManager:this.chainManager,updateUserMessageHistory:n,fileParserManager:this.fileParserManager,plugin:this.plugin,onSaveChat:r}))))))}async saveChat(){this.handleSaveAsNote&&await this.handleSaveAsNote()}updateView(){this.sharedState.replaceMessages(this.plugin.projectManager.getCurrentChainManager().getChatMessages());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)}};yn();var jJt=require("obsidian"),afe=class extends jJt.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 o=r.basename.replace(/^[a-zA-Z0-9-]+__/,"").replace(/\{\$date}|\d{8}/g,"").replace(/\{\$time}|\d{6}/g,"").replace(/[@_]/g," ").replace(/\s+/g," ").trim(),i,a=this.app.metadataCache.getFileCache(r)?.frontmatter;return a&&a.epoch?i=Vl(new Date(a.epoch)):i=Vl(new Date(r.stat.ctime)),`${o} - ${i.display}`}onChooseItem(r,n){this.onChooseFile(r)}};$r();$r();function NJt(t){t.addItem(n=>{n.setTitle("Copilot: Add selection to chat context").onClick(()=>{app.commands.executeCommandById(`copilot:${Br.ADD_SELECTION_TO_CHAT_CONTEXT}`)})});let e=Jx();e.filter(n=>n.showInContextMenu).length>0&&t.addSeparator(),IW(e.filter(n=>n.showInContextMenu)).forEach(n=>{t.addItem(o=>{o.setTitle(`Copilot: ${n.title}`).onClick(()=>{app.commands.executeCommandById(`copilot:${YU(n.title)}`)})})})}qR();yo();oO();Mx();$r();nr();var iK=require("obsidian"),Aqe=F(X()),XYt=F(Dc());var sfe=class extends sd{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")}};ti();var j9=F(X());Tn();var DJt=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>j9.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:_e("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")},j9.default.createElement("div",{className:_e("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),j9.default.createElement("span",{className:_e("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)),LJt=({id:t,children:e,isSelected:r})=>r?j9.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:_e("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 hh=F(X()),FJt=(0,hh.createContext)(void 0),kJt=({children:t})=>{let[e,r]=(0,hh.useState)("basic"),[n,o]=(0,hh.useState)(null),i=(0,hh.useRef)(!1);return(0,hh.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),hh.default.createElement(FJt.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},Wz=()=>{let t=(0,hh.useContext)(FJt);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};nr();var it=F(X());ti();bn();var ql=F(X());Tn();var N9=ql.forwardRef(({className:t,...e},r)=>ql.createElement("div",{className:"tw-relative tw-w-full tw-overflow-auto"},ql.createElement("table",{ref:r,className:_e("tw-w-full tw-caption-bottom tw-border-collapse tw-text-sm",t),...e})));N9.displayName="Table";var D9=ql.forwardRef(({className:t,...e},r)=>ql.createElement("thead",{ref:r,className:_e("[&_tr]:tw-border-b",t),...e}));D9.displayName="TableHeader";var L9=ql.forwardRef(({className:t,...e},r)=>ql.createElement("tbody",{ref:r,className:t,...e}));L9.displayName="TableBody";var SIn=ql.forwardRef(({className:t,...e},r)=>ql.createElement("tfoot",{ref:r,className:_e("tw-border-t tw-font-medium tw-bg-primary-alt/50",t),...e}));SIn.displayName="TableFooter";var BM=ql.forwardRef(({className:t,...e},r)=>ql.createElement("tr",{ref:r,className:_e("tw-border-b tw-transition-colors hover:tw-bg-primary-alt/50 data-[state=selected]:tw-bg-primary-alt",t),...e}));BM.displayName="TableRow";var ap=ql.forwardRef(({className:t,...e},r)=>ql.createElement("th",{ref:r,className:_e("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}));ap.displayName="TableHead";var gf=ql.forwardRef(({className:t,...e},r)=>ql.createElement("td",{ref:r,className:_e("tw-p-2 tw-align-middle [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));gf.displayName="TableCell";var xIn=ql.forwardRef(({className:t,...e},r)=>ql.createElement("caption",{ref:r,className:_e("tw-mt-4 tw-text-sm tw-text-muted",t),...e}));xIn.displayName="TableCaption";var Gz=F(X());var gh=F(X(),1);var BJt=F(X(),1);function $Jt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function HBe(...t){return e=>{let r=!1,n=t.map(o=>{let i=$Jt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:r,...n}=t,o=vd.Children.toArray(r),i=o.find(OIn);if(i){let a=i.props.children,s=o.map(u=>u===i?vd.Children.count(a)>1?vd.Children.only(null):vd.isValidElement(a)?a.props.children:null:u);return(0,Kz.jsx)(WBe,{...n,ref:e,children:vd.isValidElement(a)?vd.cloneElement(a,void 0,s):null})}return(0,Kz.jsx)(WBe,{...n,ref:e,children:r})});KBe.displayName="Slot";var WBe=vd.forwardRef((t,e)=>{let{children:r,...n}=t;if(vd.isValidElement(r)){let o=EIn(r);return vd.cloneElement(r,{...PIn(n,r.props),ref:e?HBe(e,o):o})}return vd.Children.count(r)>1?vd.Children.only(null):null});WBe.displayName="SlotClone";var CIn=({children:t})=>(0,Kz.jsx)(Kz.Fragment,{children:t});function OIn(t){return vd.isValidElement(t)&&t.type===CIn}function PIn(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 EIn(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 zJt=F(pt(),1),AIn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],GBe=AIn.reduce((t,e)=>{let r=UJt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?KBe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,zJt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var UM=F(pt(),1),JBe="Checkbox",[IIn,avi]=Yi(JBe),[MIn,RIn]=IIn(JBe),HJt=gh.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]=gh.useState(null),m=qJt(e,x=>p(x)),h=gh.useRef(!1),b=f?c||!!f.closest("form"):!0,[g=!1,y]=ud({prop:o,defaultProp:i,onChange:l}),S=gh.useRef(g);return gh.useEffect(()=>{let x=f?.form;if(x){let O=()=>y(S.current);return x.addEventListener("reset",O),()=>x.removeEventListener("reset",O)}},[f,y]),(0,UM.jsxs)(MIn,{scope:r,state:g,disabled:s,children:[(0,UM.jsx)(GBe.button,{type:"button",role:"checkbox","aria-checked":qM(g)?"mixed":g,"aria-required":a,"data-state":KJt(g),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:m,onKeyDown:VBe(t.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:VBe(t.onClick,x=>{y(O=>qM(O)?!0:!O),b&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})}),b&&(0,UM.jsx)(jIn,{control:f,bubbles:!h.current,name:n,value:u,checked:g,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:qM(i)?!1:i})]})});HJt.displayName=JBe;var VJt="CheckboxIndicator",WJt=gh.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=RIn(VJt,r);return(0,UM.jsx)(fd,{present:n||qM(i.state)||i.state===!0,children:(0,UM.jsx)(GBe.span,{"data-state":KJt(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});WJt.displayName=VJt;var jIn=t=>{let{control:e,checked:r,bubbles:n=!0,defaultChecked:o,...i}=t,a=gh.useRef(null),s=Fz(r),u=Qx(e);gh.useEffect(()=>{let c=a.current,d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(s!==r&&p){let m=new Event("click",{bubbles:n});c.indeterminate=qM(r),p.call(c,qM(r)?!1:r),c.dispatchEvent(m)}},[s,r,n]);let l=gh.useRef(qM(r)?!1:r);return(0,UM.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 qM(t){return t==="indeterminate"}function KJt(t){return qM(t)?"indeterminate":t?"checked":"unchecked"}var YBe=HJt,GJt=WJt;bn();Tn();var wd=Gz.forwardRef(({className:t,...e},r)=>Gz.createElement(YBe,{ref:r,className:_e("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},Gz.createElement(GJt,{className:_e("tw-flex tw-items-center tw-justify-center tw-text-current")},Gz.createElement(Jl,{className:"tw-size-4"}))));wd.displayName=YBe.displayName;var Ae=F(X()),SL=F(ds());var Ls=F(X());function YJt(){for(var t=arguments.length,e=new Array(t),r=0;rn=>{e.forEach(o=>o(n))},e)}var F9=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function gL(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function ufe(t){return"nodeType"in t}function sp(t){var e,r;return t?gL(t)?t:ufe(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function lfe(t){let{Document:e}=sp(t);return t instanceof e}function Jz(t){return gL(t)?!1:t instanceof sp(t).HTMLElement}function XBe(t){return t instanceof sp(t).SVGElement}function yL(t){return t?gL(t)?t.document:ufe(t)?lfe(t)?t:Jz(t)||XBe(t)?t.ownerDocument:document:document:document}var oy=F9?Ls.useLayoutEffect:Ls.useEffect;function cfe(t){let e=(0,Ls.useRef)(t);return oy(()=>{e.current=t}),(0,Ls.useCallback)(function(){for(var r=arguments.length,n=new Array(r),o=0;o{t.current=setInterval(n,o)},[]),r=(0,Ls.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function Yz(t,e){e===void 0&&(e=[t]);let r=(0,Ls.useRef)(t);return oy(()=>{r.current!==t&&(r.current=t)},e),r}function Zz(t,e){let r=(0,Ls.useRef)();return(0,Ls.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function k9(t){let e=cfe(t),r=(0,Ls.useRef)(null),n=(0,Ls.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function dfe(t){let e=(0,Ls.useRef)();return(0,Ls.useEffect)(()=>{e.current=t},[t]),e.current}var ZBe={};function bL(t,e){return(0,Ls.useMemo)(()=>{if(e)return e;let r=ZBe[t]==null?0:ZBe[t]+1;return ZBe[t]=r,t+"-"+r},[t,e])}function XJt(t){return function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o{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 _L=XJt(1),vL=XJt(-1);function DIn(t){return"clientX"in t&&"clientY"in t}function $9(t){if(!t)return!1;let{KeyboardEvent:e}=sp(t.target);return e&&t instanceof e}function LIn(t){if(!t)return!1;let{TouchEvent:e}=sp(t.target);return e&&t instanceof e}function ffe(t){if(LIn(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 DIn(t)?{x:t.clientX,y:t.clientY}:null}var Rb=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[Rb.Translate.toString(t),Rb.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),JJt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function QJt(t){return t.matches(JJt)?t:t.querySelector(JJt)}var wL=F(X()),FIn={display:"none"};function e7t(t){let{id:e,value:r}=t;return wL.default.createElement("div",{id:e,style:FIn},r)}function t7t(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 wL.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function r7t(){let[t,e]=(0,wL.useState)("");return{announce:(0,wL.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var h7t=(0,Ae.createContext)(null);function kIn(t){let e=(0,Ae.useContext)(h7t);(0,Ae.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function $In(){let[t]=(0,Ae.useState)(()=>new Set),e=(0,Ae.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,Ae.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 BIn={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. - `},LIn={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 FIn(t){let{announcements:e=LIn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=DIn}=t,{announce:i,announcement:a}=ZJt(),s=yL("DndLiveRegion"),[u,l]=(0,Ae.useState)(!1);if((0,Ae.useEffect)(()=>{l(!0)},[]),jIn((0,Ae.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=Ae.default.createElement(Ae.default.Fragment,null,Ae.default.createElement(JJt,{id:n,value:o.draggable}),Ae.default.createElement(YJt,{id:s,announcement:a}));return r?(0,wL.createPortal)(c,r):c}var Ul;(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"})(Ul||(Ul={}));function dfe(){}function Zz(t,e){return(0,Ae.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function pfe(){for(var t=arguments.length,e=new Array(t),r=0;r[...e].filter(n=>n!=null),[...e])}var jb=Object.freeze({x:0,y:0});function d7t(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function f7t(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function kIn(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function XJt(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 iqe(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function QJt(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 z9=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=QJt(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=d7t(QJt(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(f7t)},p7t=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=XJt(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=XJt(u),c=o.reduce((f,p,m)=>f+d7t(l[m],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(f7t)};function $In(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{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=$In(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(kIn)};function qIn(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function m7t(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:jb}function UIn(t){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i({...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 zIn=UIn(1);function HIn(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 VIn(t,e,r){let n=HIn(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 WIn={ignoreTransform:!1};function CL(t,e){e===void 0&&(e=WIn);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=sp(t).getComputedStyle(t);l&&(r=VIn(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 e7t(t){return CL(t,{ignoreTransform:!0})}function KIn(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function GIn(t,e){return e===void 0&&(e=sp(t).getComputedStyle(t)),e.position==="fixed"}function JIn(t,e){e===void 0&&(e=sp(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 H9(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(afe(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!Gz(o)||YBe(o)||r.includes(o))return r;let i=sp(t).getComputedStyle(o);return o!==t&&JIn(o,i)&&r.push(o),GIn(o,i)?r:n(o.parentNode)}return t?n(t):r}function h7t(t){let[e]=H9(t,1);return e??null}function ZBe(t){return!L9||!t?null:hL(t)?t:ife(t)?afe(t)||t===gL(t).scrollingElement?window:Gz(t)?t:null:null}function g7t(t){return hL(t)?t.scrollX:t.scrollLeft}function y7t(t){return hL(t)?t.scrollY:t.scrollTop}function eqe(t){return{x:g7t(t),y:y7t(t)}}var Sc;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Sc||(Sc={}));function b7t(t){return!L9||!t?!1:t===document.scrollingElement}function _7t(t){let e={x:0,y:0},r=b7t(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 YIn={x:.2,y:.2};function ZIn(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=YIn);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=_7t(t),p={x:0,y:0},m={x:0,y:0},h={height:e.height*o.y,width:e.width*o.x};return!l&&i<=e.top+h.height?(p.y=Sc.Backward,m.y=n*Math.abs((e.top+h.height-i)/h.height)):!c&&u>=e.bottom-h.height&&(p.y=Sc.Forward,m.y=n*Math.abs((e.bottom-h.height-u)/h.height)),!f&&s>=e.right-h.width?(p.x=Sc.Forward,m.x=n*Math.abs((e.right-h.width-s)/h.width)):!d&&a<=e.left+h.width&&(p.x=Sc.Backward,m.x=n*Math.abs((e.left+h.width-a)/h.width)),{direction:p,speed:m}}function XIn(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 v7t(t){return t.reduce((e,r)=>bL(e,eqe(r)),jb)}function QIn(t){return t.reduce((e,r)=>e+g7t(r),0)}function eMn(t){return t.reduce((e,r)=>e+y7t(r),0)}function tMn(t,e){if(e===void 0&&(e=CL),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);h7t(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var rMn=[["x",["left","right"],QIn],["y",["top","bottom"],eMn]],B9=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=H9(r),o=v7t(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of rMn)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})}},SL=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 nMn(t){let{EventTarget:e}=sp(t);return t instanceof e?t:gL(t)}function XBe(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 iy;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(iy||(iy={}));function t7t(t){t.preventDefault()}function oMn(t){t.stopPropagation()}var $n;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})($n||($n={}));var w7t={start:[$n.Space,$n.Enter],cancel:[$n.Esc],end:[$n.Space,$n.Enter,$n.Tab]},iMn=(t,e)=>{let{currentCoordinates:r}=e;switch(t.code){case $n.Right:return{...r,x:r.x+25};case $n.Left:return{...r,x:r.x-25};case $n.Down:return{...r,y:r.y+25};case $n.Up:return{...r,y:r.y-25}}},HM=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 SL(gL(r)),this.windowListeners=new SL(sp(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(iy.Resize,this.handleCancel),this.windowListeners.add(iy.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(iy.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&tMn(n),r(jb)}handleKeyDown(e){if(k9(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=w7t,coordinateGetter:a=iMn,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}:jb;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=_L(d,c),p={x:0,y:0},{scrollableAncestors:m}=n.current;for(let h of m){let b=e.code,{isTop:g,isRight:y,isLeft:S,isBottom:x,maxScroll:O,minScroll:P}=_7t(h),E=XIn(h),A={x:Math.min(b===$n.Right?E.right-E.width/2:E.right,Math.max(b===$n.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(b===$n.Down?E.bottom-E.height/2:E.bottom,Math.max(b===$n.Down?E.top:E.top+E.height/2,d.y))},I=b===$n.Right&&!y||b===$n.Left&&!S,R=b===$n.Down&&!x||b===$n.Up&&!g;if(I&&A.x!==d.x){let N=h.scrollLeft+f.x,j=b===$n.Right&&N<=O.x||b===$n.Left&&N>=P.x;if(j&&!f.y){h.scrollTo({left:N,behavior:s});return}j?p.x=h.scrollLeft-N:p.x=b===$n.Right?h.scrollLeft-O.x:h.scrollLeft-P.x,p.x&&h.scrollBy({left:-p.x,behavior:s});break}else if(R&&A.y!==d.y){let N=h.scrollTop+f.y,j=b===$n.Down&&N<=O.y||b===$n.Up&&N>=P.y;if(j&&!f.x){h.scrollTo({top:N,behavior:s});return}j?p.y=h.scrollTop-N:p.y=b===$n.Down?h.scrollTop-O.y:h.scrollTop-P.y,p.y&&h.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,bL(_L(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()}};HM.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=w7t,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 r7t(t){return!!(t&&"distance"in t)}function n7t(t){return!!(t&&"delay"in t)}var q9=class{constructor(e,r,n){var o;n===void 0&&(n=nMn(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=gL(a),this.documentListeners=new SL(this.document),this.listeners=new SL(n),this.windowListeners=new SL(sp(a)),this.initialCoordinates=(o=lfe(i))!=null?o:jb,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(iy.Resize,this.handleCancel),this.windowListeners.add(iy.DragStart,t7t),this.windowListeners.add(iy.VisibilityChange,this.handleCancel),this.windowListeners.add(iy.ContextMenu,t7t),this.documentListeners.add(iy.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(n7t(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(r7t(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(iy.Click,oMn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(iy.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=lfe(e))!=null?r:jb,l=_L(o,u);if(!n&&s){if(r7t(s)){if(s.tolerance!=null&&XBe(l,s.tolerance))return this.handleCancel();if(XBe(l,s.distance))return this.handleStart()}if(n7t(s)&&XBe(l,s.tolerance))return this.handleCancel();this.handlePending(s,l);return}e.cancelable&&e.preventDefault(),a(u)}handleEnd(){let{onAbort:e,onEnd:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleCancel(){let{onAbort:e,onCancel:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleKeydown(e){e.code===$n.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},aMn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},VM=class extends q9{constructor(e){let{event:r}=e,n=gL(r.target);super(e,aMn,n)}};VM.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 sMn={move:{name:"mousemove"},end:{name:"mouseup"}},tqe;(function(t){t[t.RightClick=2]="RightClick"})(tqe||(tqe={}));var rqe=class extends q9{constructor(e){super(e,sMn,gL(e.event.target))}};rqe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===tqe.RightClick?!1:(n?.({event:r}),!0)}}];var QBe={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},nqe=class extends q9{constructor(e){super(e,QBe)}static setup(){return window.addEventListener(QBe.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(QBe.move.name,e)};function e(){}}};nqe.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 $9;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})($9||($9={}));var ffe;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(ffe||(ffe={}));function uMn(t){let{acceleration:e,activator:r=$9.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=ffe.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=cMn({delta:d,disabled:!i}),[m,h]=WJt(),b=(0,Ae.useRef)({x:0,y:0}),g=(0,Ae.useRef)({x:0,y:0}),y=(0,Ae.useMemo)(()=>{switch(r){case $9.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case $9.DraggableRect:return o}},[r,o,u]),S=(0,Ae.useRef)(null),x=(0,Ae.useCallback)(()=>{let P=S.current;if(!P)return;let E=b.current.x*g.current.x,A=b.current.y*g.current.y;P.scrollBy(E,A)},[]),O=(0,Ae.useMemo)(()=>s===ffe.TreeOrder?[...l].reverse():l,[s,l]);(0,Ae.useEffect)(()=>{if(!i||!l.length||!y){h();return}for(let P of O){if(n?.(P)===!1)continue;let E=l.indexOf(P),A=c[E];if(!A)continue;let{direction:I,speed:R}=ZIn(P,A,y,e,f);for(let N of["x","y"])p[N][I[N]]||(R[N]=0,I[N]=0);if(R.x>0||R.y>0){h(),S.current=P,m(x,a),b.current=R,g.current=I;return}}b.current={x:0,y:0},g.current={x:0,y:0},h()},[e,x,n,h,i,a,JSON.stringify(y),JSON.stringify(p),m,l,O,c,JSON.stringify(f)])}var lMn={x:{[Sc.Backward]:!1,[Sc.Forward]:!1},y:{[Sc.Backward]:!1,[Sc.Forward]:!1}};function cMn(t){let{delta:e,disabled:r}=t,n=ufe(e);return Yz(o=>{if(r||!n||!o)return lMn;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[Sc.Backward]:o.x[Sc.Backward]||i.x===-1,[Sc.Forward]:o.x[Sc.Forward]||i.x===1},y:{[Sc.Backward]:o.y[Sc.Backward]||i.y===-1,[Sc.Forward]:o.y[Sc.Forward]||i.y===1}}},[r,e,n])}function dMn(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return Yz(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function fMn(t,e){return(0,Ae.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 U9;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(U9||(U9={}));var oqe;(function(t){t.Optimized="optimized"})(oqe||(oqe={}));var o7t=new Map;function pMn(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,Ae.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,Ae.useRef)(t),d=b(),f=Jz(d),p=(0,Ae.useCallback)(function(g){g===void 0&&(g=[]),!f.current&&a(y=>y===null?g:y.concat(g.filter(S=>!y.includes(S))))},[f]),m=(0,Ae.useRef)(null),h=Yz(g=>{if(d&&!r)return o7t;if(!g||g===o7t||c.current!==t||i!=null){let y=new Map;for(let S of t){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){y.set(S.id,S.rect.current);continue}let x=S.node.current,O=x?new B9(u(x),x):null;S.rect.current=O,O&&y.set(S.id,O)}return y}return g},[t,i,r,d,u]);return(0,Ae.useEffect)(()=>{c.current=t},[t]),(0,Ae.useEffect)(()=>{d||p()},[r,d]),(0,Ae.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,Ae.useEffect)(()=>{d||typeof s!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...n]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(l){case U9.Always:return!1;case U9.BeforeDragging:return r;default:return!r}}}function S7t(t,e){return Yz(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function mMn(t,e){return S7t(t,e)}function hMn(t){let{callback:e,disabled:r}=t,n=sfe(e),o=(0,Ae.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,Ae.useEffect)(()=>()=>o?.disconnect(),[o]),o}function mfe(t){let{callback:e,disabled:r}=t,n=sfe(e),o=(0,Ae.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,Ae.useEffect)(()=>()=>o?.disconnect(),[o]),o}function gMn(t){return new B9(CL(t),t)}function i7t(t,e,r){e===void 0&&(e=gMn);let[n,o]=(0,Ae.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=hMn({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=mfe({callback:i});return oy(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function yMn(t){let e=S7t(t);return m7t(t,e)}var a7t=[];function bMn(t){let e=(0,Ae.useRef)(t),r=Yz(n=>t?n&&n!==a7t&&t&&e.current&&t.parentNode===e.current.parentNode?n:H9(t):a7t,[t]);return(0,Ae.useEffect)(()=>{e.current=t},[t]),r}function _Mn(t){let[e,r]=(0,Ae.useState)(null),n=(0,Ae.useRef)(t),o=(0,Ae.useCallback)(i=>{let a=ZBe(i.target);a&&r(s=>s?(s.set(a,eqe(a)),new Map(s)):null)},[]);return(0,Ae.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=ZBe(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,eqe(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=ZBe(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,Ae.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>bL(i,a),jb):v7t(t):jb,[t,e])}function s7t(t,e){e===void 0&&(e=[]);let r=(0,Ae.useRef)(null);return(0,Ae.useEffect)(()=>{r.current=null},e),(0,Ae.useEffect)(()=>{let n=t!==jb;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?_L(t,r.current):jb}function vMn(t){(0,Ae.useEffect)(()=>{if(!L9)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 wMn(t,e){return(0,Ae.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function x7t(t){return(0,Ae.useMemo)(()=>t?KIn(t):null,[t])}var u7t=[];function SMn(t,e){e===void 0&&(e=CL);let[r]=t,n=x7t(r?sp(r):null),[o,i]=(0,Ae.useState)(u7t);function a(){i(()=>t.length?t.map(u=>b7t(u)?n:new B9(e(u),u)):u7t)}let s=mfe({callback:a});return oy(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function xMn(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return Gz(e)?e:t}function CMn(t){let{measure:e}=t,[r,n]=(0,Ae.useState)(null),o=(0,Ae.useCallback)(l=>{for(let{target:c}of l)if(Gz(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=mfe({callback:o}),a=(0,Ae.useCallback)(l=>{let c=xMn(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=F9(a);return(0,Ae.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var OMn=[{sensor:VM,options:{}},{sensor:HM,options:{}}],PMn={current:{}},cfe={draggable:{measure:e7t},droppable:{measure:e7t,strategy:U9.WhileDragging,frequency:oqe.Optimized},dragOverlay:{measure:CL}},xL=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}},EMn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new xL,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dfe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:cfe,measureDroppableContainers:dfe,windowRect:null,measuringScheduled:!1},TMn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dfe,draggableNodes:new Map,over:null,measureDroppableContainers:dfe},hfe=(0,Ae.createContext)(TMn),C7t=(0,Ae.createContext)(EMn);function AMn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new xL}}}function IMn(t,e){switch(e.type){case Ul.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Ul.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 Ul.DragEnd:case Ul.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ul.RegisterDroppable:{let{element:r}=e,{id:n}=r,o=new xL(t.droppable.containers);return o.set(n,r),{...t,droppable:{...t.droppable,containers:o}}}case Ul.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 xL(t.droppable.containers);return a.set(r,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:a}}}case Ul.UnregisterDroppable:{let{id:r,key:n}=e,o=t.droppable.containers.get(r);if(!o||n!==o.key)return t;let i=new xL(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function MMn(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,Ae.useContext)(hfe),i=ufe(n),a=ufe(r?.id);return(0,Ae.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!k9(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=GJt(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function RMn(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function jMn(t){return(0,Ae.useMemo)(()=>({draggable:{...cfe.draggable,...t?.draggable},droppable:{...cfe.droppable,...t?.droppable},dragOverlay:{...cfe.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function NMn(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,Ae.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;oy(()=>{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=m7t(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=h7t(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var O7t=(0,Ae.createContext)({...jb,scaleX:1,scaleY:1}),zM;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(zM||(zM={}));var V9=(0,Ae.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=OMn,collisionDetection:d=BIn,measuring:f,modifiers:p,...m}=e,h=(0,Ae.useReducer)(IMn,void 0,AMn),[b,g]=h,[y,S]=NIn(),[x,O]=(0,Ae.useState)(zM.Uninitialized),P=x===zM.Initialized,{draggable:{active:E,nodes:A,translate:I},droppable:{containers:R}}=b,N=E!=null?A.get(E):null,j=(0,Ae.useRef)({initial:null,translated:null}),$=(0,Ae.useMemo)(()=>{var is;return E!=null?{id:E,data:(is=N?.data)!=null?is:PMn,rect:j}:null},[E,N]),k=(0,Ae.useRef)(null),[z,V]=(0,Ae.useState)(null),[Q,J]=(0,Ae.useState)(null),D=Jz(m,Object.values(m)),B=yL("DndDescribedBy",a),q=(0,Ae.useMemo)(()=>R.getEnabled(),[R]),K=jMn(f),{droppableRects:H,measureDroppableContainers:ee,measuringScheduled:U}=pMn(q,{dragging:P,dependencies:[I.x,I.y],config:K.droppable}),W=dMn(A,E),Y=(0,Ae.useMemo)(()=>Q?lfe(Q):null,[Q]),ae=kb(),Oe=mMn(W,K.draggable.measure);NMn({activeNode:E!=null?A.get(E):null,config:ae.layoutShiftCompensation,initialRect:Oe,measure:K.draggable.measure});let le=i7t(W,K.draggable.measure,Oe),Be=i7t(W?W.parentElement:null),ze=(0,Ae.useRef)({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:H,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),rt=R.getNodeFor((r=ze.current.over)==null?void 0:r.id),cr=CMn({measure:K.dragOverlay.measure}),wn=(n=cr.nodeRef.current)!=null?n:W,Le=P?(o=cr.rect)!=null?o:le:null,pt=!!(cr.nodeRef.current&&cr.rect),mt=yMn(pt?null:le),ht=x7t(wn?sp(wn):null),te=bMn(P?rt??W:null),et=SMn(te),Re=RMn(p,{transform:{x:I.x-mt.x,y:I.y-mt.y,scaleX:1,scaleY:1},activatorEvent:Q,active:$,activeNodeRect:le,containerNodeRect:Be,draggingNodeRect:Le,over:ze.current.over,overlayNodeRect:cr.rect,scrollableAncestors:te,scrollableAncestorRects:et,windowRect:ht}),Pe=Y?bL(Y,I):null,oe=_Mn(te),se=s7t(oe),ce=s7t(oe,[le]),Ce=bL(Re,se),Je=Le?zIn(Le,Re):null,ir=$&&Je?d({active:$,collisionRect:Je,droppableRects:H,droppableContainers:q,pointerCoordinates:Pe}):null,ea=iqe(ir,"id"),[ta,xc]=(0,Ae.useState)(null),Cd=pt?Re:bL(Re,ce),qi=qIn(Cd,(i=ta?.rect)!=null?i:null,le),lp=(0,Ae.useRef)(null),yf=(0,Ae.useCallback)((is,$s)=>{let{sensor:La,options:vf}=$s;if(k.current==null)return;let Od=A.get(k.current);if(!Od)return;let ws=is.nativeEvent,cp=new La({active:k.current,activeNode:Od,event:ws,options:vf,context:ze,onAbort(In){if(!A.get(In))return;let{onDragAbort:Sf}=D.current,mm={id:In};Sf?.(mm),y({type:"onDragAbort",event:mm})},onPending(In,Ye,Sf,mm){if(!A.get(In))return;let{onDragPending:uC}=D.current,En={id:In,constraint:Ye,initialCoordinates:Sf,offset:mm};uC?.(En),y({type:"onDragPending",event:En})},onStart(In){let Ye=k.current;if(Ye==null)return;let Sf=A.get(Ye);if(!Sf)return;let{onDragStart:mm}=D.current,vl={activatorEvent:ws,active:{id:Ye,data:Sf.data,rect:j}};(0,wL.unstable_batchedUpdates)(()=>{mm?.(vl),O(zM.Initializing),g({type:Ul.DragStart,initialCoordinates:In,active:Ye}),y({type:"onDragStart",event:vl}),V(lp.current),J(ws)})},onMove(In){g({type:Ul.DragMove,coordinates:In})},onEnd:wf(Ul.DragEnd),onCancel:wf(Ul.DragCancel)});lp.current=cp;function wf(In){return async function(){let{active:Sf,collisions:mm,over:vl,scrollAdjustedTranslate:uC}=ze.current,En=null;if(Sf&&uC){let{cancelDrop:uy}=D.current;En={activatorEvent:ws,active:Sf,collisions:mm,delta:uC,over:vl},In===Ul.DragEnd&&typeof uy=="function"&&await Promise.resolve(uy(En))&&(In=Ul.DragCancel)}k.current=null,(0,wL.unstable_batchedUpdates)(()=>{g({type:In}),O(zM.Uninitialized),xc(null),V(null),J(null),lp.current=null;let uy=In===Ul.DragEnd?"onDragEnd":"onDragCancel";if(En){let t2=D.current[uy];t2?.(En),y({type:uy,event:En})}})}}},[A]),bf=(0,Ae.useCallback)((is,$s)=>(La,vf)=>{let Od=La.nativeEvent,ws=A.get(vf);if(k.current!==null||!ws||Od.dndKit||Od.defaultPrevented)return;let cp={active:ws};is(La,$s.options,cp)===!0&&(Od.dndKit={capturedBy:$s.sensor},k.current=vf,yf(La,$s))},[A,yf]),Sn=fMn(c,bf);vMn(c),oy(()=>{le&&x===zM.Initializing&&O(zM.Initialized)},[le,x]),(0,Ae.useEffect)(()=>{let{onDragMove:is}=D.current,{active:$s,activatorEvent:La,collisions:vf,over:Od}=ze.current;if(!$s||!La)return;let ws={active:$s,activatorEvent:La,collisions:vf,delta:{x:Ce.x,y:Ce.y},over:Od};(0,wL.unstable_batchedUpdates)(()=>{is?.(ws),y({type:"onDragMove",event:ws})})},[Ce.x,Ce.y]),(0,Ae.useEffect)(()=>{let{active:is,activatorEvent:$s,collisions:La,droppableContainers:vf,scrollAdjustedTranslate:Od}=ze.current;if(!is||k.current==null||!$s||!Od)return;let{onDragOver:ws}=D.current,cp=vf.get(ea),wf=cp&&cp.rect.current?{id:cp.id,rect:cp.rect.current,data:cp.data,disabled:cp.disabled}:null,In={active:is,activatorEvent:$s,collisions:La,delta:{x:Od.x,y:Od.y},over:wf};(0,wL.unstable_batchedUpdates)(()=>{xc(wf),ws?.(In),y({type:"onDragOver",event:In})})},[ea]),oy(()=>{ze.current={activatorEvent:Q,active:$,activeNode:W,collisionRect:Je,collisions:ir,droppableRects:H,draggableNodes:A,draggingNode:wn,draggingNodeRect:Le,droppableContainers:R,over:ta,scrollableAncestors:te,scrollAdjustedTranslate:Ce},j.current={initial:Le,translated:Je}},[$,W,ir,Je,A,wn,Le,H,R,ta,te,Ce]),uMn({...ae,delta:I,draggingRect:Je,pointerCoordinates:Pe,scrollableAncestors:te,scrollableAncestorRects:et});let _f=(0,Ae.useMemo)(()=>({active:$,activeNode:W,activeNodeRect:le,activatorEvent:Q,collisions:ir,containerNodeRect:Be,dragOverlay:cr,draggableNodes:A,droppableContainers:R,droppableRects:H,over:ta,measureDroppableContainers:ee,scrollableAncestors:te,scrollableAncestorRects:et,measuringConfiguration:K,measuringScheduled:U,windowRect:ht}),[$,W,le,Q,ir,Be,cr,A,R,H,ta,ee,te,et,K,U,ht]),sC=(0,Ae.useMemo)(()=>({activatorEvent:Q,activators:Sn,active:$,activeNodeRect:le,ariaDescribedById:{draggable:B},dispatch:g,draggableNodes:A,over:ta,measureDroppableContainers:ee}),[Q,Sn,$,le,g,B,A,ta,ee]);return Ae.default.createElement(c7t.Provider,{value:S},Ae.default.createElement(hfe.Provider,{value:sC},Ae.default.createElement(C7t.Provider,{value:_f},Ae.default.createElement(O7t.Provider,{value:qi},l)),Ae.default.createElement(MMn,{disabled:s?.restoreFocus===!1})),Ae.default.createElement(FIn,{...s,hiddenTextDescribedById:B}));function kb(){let is=z?.autoScrollEnabled===!1,$s=typeof u=="object"?u.enabled===!1:u===!1,La=P&&!is&&!$s;return typeof u=="object"?{...u,enabled:La}:{enabled:La}}}),DMn=(0,Ae.createContext)(null),l7t="button",LMn="Draggable";function P7t(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=yL(LMn),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,Ae.useContext)(hfe),{role:p=l7t,roleDescription:m="draggable",tabIndex:h=0}=o??{},b=u?.id===e,g=(0,Ae.useContext)(b?O7t:DMn),[y,S]=F9(),[x,O]=F9(),P=wMn(a,e),E=Jz(r);oy(()=>(d.set(e,{id:e,key:i,node:y,activatorNode:x,data:E}),()=>{let I=d.get(e);I&&I.key===i&&d.delete(e)}),[d,e]);let A=(0,Ae.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":b&&p===l7t?!0:void 0,"aria-roledescription":m,"aria-describedby":c.draggable}),[n,p,h,b,m,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:A,isDragging:b,listeners:n?void 0:P,node:y,over:f,setNodeRef:S,setActivatorNodeRef:O,transform:g}}function E7t(){return(0,Ae.useContext)(C7t)}var FMn="Droppable",kMn={timeout:25};function T7t(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=yL(FMn),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,Ae.useContext)(hfe),c=(0,Ae.useRef)({disabled:r}),d=(0,Ae.useRef)(!1),f=(0,Ae.useRef)(null),p=(0,Ae.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:b}={...kMn,...o},g=Jz(h??n),y=(0,Ae.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(g.current)?g.current:[g.current]),p.current=null},b)},[b]),S=mfe({callback:y,disabled:m||!a}),x=(0,Ae.useCallback)((A,I)=>{S&&(I&&(S.unobserve(I),d.current=!1),A&&S.observe(A))},[S]),[O,P]=F9(x),E=Jz(e);return(0,Ae.useEffect)(()=>{!S||!O.current||(S.disconnect(),d.current=!1,S.observe(O.current))},[O,S]),(0,Ae.useEffect)(()=>(s({type:Ul.RegisterDroppable,element:{id:n,key:i,disabled:r,node:O,rect:f,data:E}}),()=>s({type:Ul.UnregisterDroppable,key:i,id:n})),[n]),(0,Ae.useEffect)(()=>{r!==c.current.disabled&&(s({type:Ul.SetDroppableDisabled,id:n,key:i,disabled:r}),c.current.disabled=r)},[n,i,r,s]),{active:a,rect:f,isOver:u?.id===n,node:O,over:u,setNodeRef:P}}var Fs=F(X());function _fe(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function $Mn(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function gfe(t){return t!==null&&t>=0}function BMn(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let r=0;r{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=_fe(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 yfe={scaleX:1,scaleY:1},W9=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:rr&&o<=a?{x:0,y:-s.height-u,...yfe}:o=a?{x:0,y:s.height+u,...yfe}:{x:0,y:0,...yfe}};function UMn(t,e,r){let n=t[e],o=t[e-1],i=t[e+1];return n?rn.map(P=>typeof P=="object"&&"id"in P?P.id:P),[n]),m=a!=null,h=a?p.indexOf(a.id):-1,b=l?p.indexOf(l.id):-1,g=(0,Fs.useRef)(p),y=!BMn(p,g.current),S=b!==-1&&h===-1||y,x=qMn(i);oy(()=>{y&&m&&c(p)},[y,p,m,c]),(0,Fs.useEffect)(()=>{g.current=p},[p]);let O=(0,Fs.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:S,items:p,overIndex:b,useDragOverlay:f,sortedRects:$Mn(p,u),strategy:o}),[h,d,x.draggable,x.droppable,S,p,b,u,f,o]);return Fs.default.createElement(M7t.Provider,{value:O},e)}var zMn=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return _fe(r,n,o).indexOf(e)},HMn=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},VMn={duration:200,easing:"ease"},R7t="transform",WMn=Rb.Transition.toString({property:R7t,duration:0,easing:"linear"}),KMn={roleDescription:"sortable"};function GMn(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,Fs.useState)(null),s=(0,Fs.useRef)(r);return oy(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=CL(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,Fs.useEffect)(()=>{i&&a(null)},[i]),i}function G9(t){let{animateLayoutChanges:e=HMn,attributes:r,disabled:n,data:o,getNewIndex:i=zMn,id:a,strategy:s,resizeObserverConfig:u,transition:l=VMn}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:b,useDragOverlay:g,strategy:y}=(0,Fs.useContext)(M7t),S=JMn(n,p),x=c.indexOf(a),O=(0,Fs.useMemo)(()=>({sortable:{containerId:d,index:x,items:c},...o}),[d,o,x,c]),P=(0,Fs.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:E,node:A,isOver:I,setNodeRef:R}=T7t({id:a,data:O,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...u}}),{active:N,activatorEvent:j,activeNodeRect:$,attributes:k,setNodeRef:z,listeners:V,isDragging:Q,over:J,setActivatorNodeRef:D,transform:B}=P7t({id:a,data:O,attributes:{...KMn,...r},disabled:S.draggable}),q=VJt(R,z),K=!!N,H=K&&!m&&gfe(f)&&gfe(b),ee=!g&&Q,U=ee&&H?B:null,Y=H?U??(s??y)({rects:h,activeNodeRect:$,activeIndex:f,overIndex:b,index:x}):null,ae=gfe(f)&&gfe(b)?i({id:a,items:c,activeIndex:f,overIndex:b}):x,Oe=N?.id,le=(0,Fs.useRef)({activeId:Oe,items:c,newIndex:ae,containerId:d}),Be=c!==le.current.items,ze=e({active:N,containerId:d,isDragging:Q,isSorting:K,id:a,index:x,items:c,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:l,wasDragging:le.current.activeId!=null}),rt=GMn({disabled:!ze,index:x,node:A,rect:E});return(0,Fs.useEffect)(()=>{K&&le.current.newIndex!==ae&&(le.current.newIndex=ae),d!==le.current.containerId&&(le.current.containerId=d),c!==le.current.items&&(le.current.items=c)},[K,ae,d,c]),(0,Fs.useEffect)(()=>{if(Oe===le.current.activeId)return;if(Oe!=null&&le.current.activeId==null){le.current.activeId=Oe;return}let wn=setTimeout(()=>{le.current.activeId=Oe},50);return()=>clearTimeout(wn)},[Oe]),{active:N,activeIndex:f,attributes:k,data:O,rect:E,index:x,newIndex:ae,items:c,isOver:I,isSorting:K,isDragging:Q,listeners:V,node:A,overIndex:b,over:J,setNodeRef:q,setActivatorNodeRef:D,setDroppableNodeRef:R,setDraggableNodeRef:z,transform:rt??Y,transition:cr()};function cr(){if(rt||Be&&le.current.newIndex===x)return WMn;if(!(ee&&!k9(j)||!l)&&(K||ze))return Rb.Transition.toString({...l,property:R7t})}}function JMn(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 bfe(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 YMn=[$n.Down,$n.Right,$n.Up,$n.Left],vfe=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(YMn.includes(t.code)){if(t.preventDefault(),!r||!n)return;let u=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;let f=o.get(d.id);if(f)switch(t.code){case $n.Down:n.topf.top&&u.push(d);break;case $n.Left:n.left>f.left&&u.push(d);break;case $n.Right:n.left1&&(c=l[1].id),c!=null){let d=i.get(r.id),f=i.get(c),p=f?o.get(f.id):null,m=f?.node.current;if(m&&p&&d&&f){let b=H9(m).some((P,E)=>s[E]!==P),g=j7t(d,f),y=ZMn(d,f),S=b||!g?{x:0,y:0}:{x:y?n.width-p.width:0,y:y?n.height-p.height:0},x={x:p.left,y:p.top};return S.x&&S.y?x:_L(x,S)}}}};function j7t(t,e){return!bfe(t)||!bfe(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function ZMn(t,e){return!bfe(t)||!bfe(e)||!j7t(t,e)?!1:t.data.current.sortable.index(0,wfe.useContext)(aqe);var tK=require("obsidian");var D7t=require("obsidian");ti();var Qo=F(X()),L7t=F(Dc());nr();Tn();yn();yo();var oC=F(X());function N7t(){return oC.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},oC.default.createElement("li",null,oC.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{}")," represents the selected text."),oC.default.createElement("li",null,oC.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),oC.default.createElement("li",null,oC.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),oC.default.createElement("li",null,oC.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)."))}function XMn({commands:t,command:e,onConfirm:r,onCancel:n}){let i=Rn().activeModels.filter(f=>f.enabled).map(f=>({label:Xce(f),value:kr(f)})),[a,s]=(0,Qo.useState)(e),[u,l]=(0,Qo.useState)({}),c=(f,p)=>{s(m=>({...m,[f]:p})),l(m=>({...m,[f]:void 0}))},d=()=>{let f={},p=GU(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 Qo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},Qo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Qo.default.createElement(ip,{htmlFor:"title"},"Name"),Qo.default.createElement(mo,{id:"title",value:a.title,onChange:f=>c("title",f.target.value),placeholder:"Enter command name"}),u.title&&Qo.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.title)),Qo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Qo.default.createElement(ip,{htmlFor:"content"},"Prompt"),Qo.default.createElement(N7t,null),Qo.default.createElement(yE,{id:"content",value:a.content,onChange:f=>c("content",f.target.value),placeholder:"Enter command prompt",className:"tw-min-h-[200px]"}),u.content&&Qo.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.content)),Qo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Qo.default.createElement(ip,{htmlFor:"modelKey"},"Model (Optional)"),Qo.default.createElement("div",{className:"tw-group tw-relative tw-w-full"},Qo.default.createElement("select",{value:a.modelKey,onChange:f=>{let p=f.target.value;if(!p){c("modelKey","");return}if(!i.find(h=>h.value===p)){fe(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:_e("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")},Qo.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>Qo.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),Qo.default.createElement("div",{className:_e("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")},Qo.default.createElement(Hi,{className:"tw-size-4"})))),Qo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qo.default.createElement(wd,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),Qo.default.createElement(ip,{htmlFor:"showInContextMenu"},"Show in context menu")),Qo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qo.default.createElement(wd,{id:"showInSlashMenu",checked:a.showInSlashMenu,onCheckedChange:f=>c("showInSlashMenu",f)}),Qo.default.createElement(ip,{htmlFor:"showInSlashMenu"},"Show in slash menu")),Qo.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Qo.default.createElement(ge,{variant:"secondary",onClick:n},"Cancel"),Qo.default.createElement(ge,{variant:"default",onClick:d},"Save")))}var Sfe=class extends D7t.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,L7t.createRoot)(r);let n=o=>{this.onUpdate(o),this.close()};this.root.render(Qo.default.createElement(XMn,{commands:this.commands,command:this.command,onConfirm:n,onCancel:()=>this.close()}))}onClose(){this.root.unmount()}};var va=F(X());Tn();var yh=F(X());Tn();yn();BR();yo();Cn();function iC({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,yh.useState)(!1),s=(0,yh.useRef)(null),u=(0,yh.useRef)(!0);return(0,yh.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await eo(t)}catch(c){fe("Failed to decrypt value:"+ei(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),yh.default.createElement("div",{className:_e("tw-relative",o)},yh.default.createElement(mo,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:_e("tw-w-full !tw-pr-7")}),yh.default.createElement("div",{onClick:()=>!n&&a(!i),className:_e("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?yh.default.createElement(y3,{className:_e("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")}):yh.default.createElement(QC,{className:_e("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")})))}yn();var xd=F(X());var Qi=F(X(),1);function aC(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var k7t=F(X(),1);function F7t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function sqe(...t){return e=>{let r=!1,n=t.map(o=>{let i=F7t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:r,...n}=t,o=Sd.Children.toArray(r),i=o.find(eRn);if(i){let a=i.props.children,s=o.map(u=>u===i?Sd.Children.count(a)>1?Sd.Children.only(null):Sd.isValidElement(a)?a.props.children:null:u);return(0,Xz.jsx)(uqe,{...n,ref:e,children:Sd.isValidElement(a)?Sd.cloneElement(a,void 0,s):null})}return(0,Xz.jsx)(uqe,{...n,ref:e,children:r})});Y9.displayName="Slot";var uqe=Sd.forwardRef((t,e)=>{let{children:r,...n}=t;if(Sd.isValidElement(r)){let o=rRn(r);return Sd.cloneElement(r,{...tRn(n,r.props),ref:e?sqe(e,o):o})}return Sd.Children.count(r)>1?Sd.Children.only(null):null});uqe.displayName="SlotClone";var QMn=({children:t})=>(0,Xz.jsx)(Xz.Fragment,{children:t});function eRn(t){return Sd.isValidElement(t)&&t.type===QMn}function tRn(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 rRn(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 q7t=F(ft(),1),nRn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],bh=nRn.reduce((t,e)=>{let r=$7t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Y9:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,q7t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function U7t(t,e){t&&B7t.flushSync(()=>t.dispatchEvent(e))}var cqe=F(ft(),1),oRn="DismissableLayer",lqe="dismissableLayer.update",iRn="dismissableLayer.pointerDownOutside",aRn="dismissableLayer.focusOutside",z7t,V7t=os.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),dqe=os.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=os.useContext(V7t),[c,d]=os.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=os.useState({}),m=_E(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=lRn(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=cRn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return oM(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),os.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(z7t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),H7t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=z7t)}},[c,f,r,l]),os.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),H7t())},[c,l]),os.useEffect(()=>{let E=()=>p({});return document.addEventListener(lqe,E),()=>document.removeEventListener(lqe,E)},[]),(0,cqe.jsx)(bh.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:aC(t.onFocusCapture,P.onFocusCapture),onBlurCapture:aC(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:aC(t.onPointerDownCapture,O.onPointerDownCapture)})});dqe.displayName=oRn;var sRn="DismissableLayerBranch",uRn=os.forwardRef((t,e)=>{let r=os.useContext(V7t),n=os.useRef(null),o=_E(e,n);return os.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,cqe.jsx)(bh.div,{...t,ref:o})});uRn.displayName=sRn;function lRn(t,e=globalThis?.document){let r=Ur(t),n=os.useRef(!1),o=os.useRef(()=>{});return os.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){W7t(iRn,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 cRn(t,e=globalThis?.document){let r=Ur(t),n=os.useRef(!1);return os.useEffect(()=>{let o=i=>{i.target&&!n.current&&W7t(aRn,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 H7t(){let t=new CustomEvent(lqe);document.dispatchEvent(t)}function W7t(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?U7t(o,i):o.dispatchEvent(i)}var ay=F(X(),1);var Z7t=F(ft(),1),fqe="focusScope.autoFocusOnMount",pqe="focusScope.autoFocusOnUnmount",K7t={bubbles:!1,cancelable:!0},dRn="FocusScope",mqe=ay.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=ay.useState(null),l=Ur(o),c=Ur(i),d=ay.useRef(null),f=_E(e,h=>u(h)),p=ay.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;ay.useEffect(()=>{if(n){let y=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:WM(d.current,{select:!0})},S=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||WM(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&WM(s)};var h=y,b=S,g=x;document.addEventListener("focusin",y),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),ay.useEffect(()=>{if(s){J7t.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(fqe,K7t);s.addEventListener(fqe,l),s.dispatchEvent(g),g.defaultPrevented||(fRn(yRn(X7t(s)),{select:!0}),document.activeElement===h&&WM(s))}return()=>{s.removeEventListener(fqe,l),setTimeout(()=>{let g=new CustomEvent(pqe,K7t);s.addEventListener(pqe,c),s.dispatchEvent(g),g.defaultPrevented||WM(h??document.body,{select:!0}),s.removeEventListener(pqe,c),J7t.remove(p)},0)}}},[s,l,c,p]);let m=ay.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let y=h.currentTarget,[S,x]=pRn(y);S&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&WM(S,{select:!0})):h.shiftKey&&g===S&&(h.preventDefault(),r&&WM(x,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,Z7t.jsx)(bh.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});mqe.displayName=dRn;function fRn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(WM(n,{select:e}),document.activeElement!==r)return}function pRn(t){let e=X7t(t),r=G7t(e,t),n=G7t(e.reverse(),t);return[r,n]}function X7t(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 G7t(t,e){for(let r of t)if(!mRn(r,{upTo:e}))return r}function mRn(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 hRn(t){return t instanceof HTMLInputElement&&"select"in t}function WM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&hRn(t)&&e&&t.select()}}var J7t=gRn();function gRn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Y7t(t,e),t.unshift(e)},remove(e){t=Y7t(t,e),t[0]?.resume()}}}function Y7t(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function yRn(t){return t.filter(e=>e.tagName!=="A")}var xfe=F(X(),1),Q7t=F(ds(),1);var eYt=F(ft(),1),bRn="Portal",hqe=xfe.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=xfe.useState(!1);Jn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Q7t.default.createPortal((0,eYt.jsx)(bh.div,{...n,ref:e}),a):null});hqe.displayName=bRn;var Ni=F(ft(),1),gqe="Dialog",[tYt,fwi]=Yi(gqe),[_Rn,Nb]=tYt(gqe),rYt=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=Qi.useRef(null),u=Qi.useRef(null),[l=!1,c]=ud({prop:n,defaultProp:o,onChange:i});return(0,Ni.jsx)(_Rn,{scope:e,triggerRef:s,contentRef:u,contentId:hl(),titleId:hl(),descriptionId:hl(),open:l,onOpenChange:c,onOpenToggle:Qi.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};rYt.displayName=gqe;var nYt="DialogTrigger",oYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(nYt,r),i=_E(e,o.triggerRef);return(0,Ni.jsx)(bh.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":_qe(o.open),...n,ref:i,onClick:aC(t.onClick,o.onOpenToggle)})});oYt.displayName=nYt;var yqe="DialogPortal",[vRn,iYt]=tYt(yqe,{forceMount:void 0}),aYt=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=Nb(yqe,e);return(0,Ni.jsx)(vRn,{scope:e,forceMount:r,children:Qi.Children.map(n,a=>(0,Ni.jsx)(fd,{present:r||i.open,children:(0,Ni.jsx)(hqe,{asChild:!0,container:o,children:a})}))})};aYt.displayName=yqe;var Cfe="DialogOverlay",sYt=Qi.forwardRef((t,e)=>{let r=iYt(Cfe,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=Nb(Cfe,t.__scopeDialog);return i.modal?(0,Ni.jsx)(fd,{present:n||i.open,children:(0,Ni.jsx)(wRn,{...o,ref:e})}):null});sYt.displayName=Cfe;var wRn=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(Cfe,r);return(0,Ni.jsx)(A9,{as:Y9,allowPinchZoom:!0,shards:[o.contentRef],children:(0,Ni.jsx)(bh.div,{"data-state":_qe(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),OL="DialogContent",uYt=Qi.forwardRef((t,e)=>{let r=iYt(OL,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=Nb(OL,t.__scopeDialog);return(0,Ni.jsx)(fd,{present:n||i.open,children:i.modal?(0,Ni.jsx)(SRn,{...o,ref:e}):(0,Ni.jsx)(xRn,{...o,ref:e})})});uYt.displayName=OL;var SRn=Qi.forwardRef((t,e)=>{let r=Nb(OL,t.__scopeDialog),n=Qi.useRef(null),o=_E(e,r.contentRef,n);return Qi.useEffect(()=>{let i=n.current;if(i)return bM(i)},[]),(0,Ni.jsx)(lYt,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:aC(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:aC(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:aC(t.onFocusOutside,i=>i.preventDefault())})}),xRn=Qi.forwardRef((t,e)=>{let r=Nb(OL,t.__scopeDialog),n=Qi.useRef(!1),o=Qi.useRef(!1);return(0,Ni.jsx)(lYt,{...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()}})}),lYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=Nb(OL,r),u=Qi.useRef(null),l=_E(e,u);return iM(),(0,Ni.jsxs)(Ni.Fragment,{children:[(0,Ni.jsx)(mqe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Ni.jsx)(dqe,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":_qe(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,Ni.jsxs)(Ni.Fragment,{children:[(0,Ni.jsx)(CRn,{titleId:s.titleId}),(0,Ni.jsx)(PRn,{contentRef:u,descriptionId:s.descriptionId})]})]})}),bqe="DialogTitle",cYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(bqe,r);return(0,Ni.jsx)(bh.h2,{id:o.titleId,...n,ref:e})});cYt.displayName=bqe;var dYt="DialogDescription",fYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(dYt,r);return(0,Ni.jsx)(bh.p,{id:o.descriptionId,...n,ref:e})});fYt.displayName=dYt;var pYt="DialogClose",mYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(pYt,r);return(0,Ni.jsx)(bh.button,{type:"button",...n,ref:e,onClick:aC(t.onClick,()=>o.onOpenChange(!1))})});mYt.displayName=pYt;function _qe(t){return t?"open":"closed"}var hYt="DialogTitleWarning",[pwi,gYt]=M3t(hYt,{contentName:OL,titleName:bqe,docsSlug:"dialog"}),CRn=({titleId:t})=>{let e=gYt(hYt),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. + `},qIn={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 UIn(t){let{announcements:e=qIn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=BIn}=t,{announce:i,announcement:a}=r7t(),s=bL("DndLiveRegion"),[u,l]=(0,Ae.useState)(!1);if((0,Ae.useEffect)(()=>{l(!0)},[]),kIn((0,Ae.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=Ae.default.createElement(Ae.default.Fragment,null,Ae.default.createElement(e7t,{id:n,value:o.draggable}),Ae.default.createElement(t7t,{id:s,announcement:a}));return r?(0,SL.createPortal)(c,r):c}var Ul;(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"})(Ul||(Ul={}));function mfe(){}function Xz(t,e){return(0,Ae.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function gfe(){for(var t=arguments.length,e=new Array(t),r=0;r[...e].filter(n=>n!=null),[...e])}var jb=Object.freeze({x:0,y:0});function g7t(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function y7t(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function zIn(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function n7t(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 sqe(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function o7t(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 H9=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=o7t(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=g7t(o7t(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(y7t)},b7t=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=n7t(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=n7t(u),c=o.reduce((f,p,m)=>f+g7t(l[m],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(y7t)};function HIn(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{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=HIn(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(zIn)};function WIn(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function _7t(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:jb}function KIn(t){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i({...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 GIn=KIn(1);function JIn(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 YIn(t,e,r){let n=JIn(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 ZIn={ignoreTransform:!1};function OL(t,e){e===void 0&&(e=ZIn);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=sp(t).getComputedStyle(t);l&&(r=YIn(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 i7t(t){return OL(t,{ignoreTransform:!0})}function XIn(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function QIn(t,e){return e===void 0&&(e=sp(t).getComputedStyle(t)),e.position==="fixed"}function eMn(t,e){e===void 0&&(e=sp(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 V9(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(lfe(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!Jz(o)||XBe(o)||r.includes(o))return r;let i=sp(t).getComputedStyle(o);return o!==t&&eMn(o,i)&&r.push(o),QIn(o,i)?r:n(o.parentNode)}return t?n(t):r}function v7t(t){let[e]=V9(t,1);return e??null}function QBe(t){return!F9||!t?null:gL(t)?t:ufe(t)?lfe(t)||t===yL(t).scrollingElement?window:Jz(t)?t:null:null}function w7t(t){return gL(t)?t.scrollX:t.scrollLeft}function S7t(t){return gL(t)?t.scrollY:t.scrollTop}function rqe(t){return{x:w7t(t),y:S7t(t)}}var Sc;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Sc||(Sc={}));function x7t(t){return!F9||!t?!1:t===document.scrollingElement}function C7t(t){let e={x:0,y:0},r=x7t(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 tMn={x:.2,y:.2};function rMn(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=tMn);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=C7t(t),p={x:0,y:0},m={x:0,y:0},h={height:e.height*o.y,width:e.width*o.x};return!l&&i<=e.top+h.height?(p.y=Sc.Backward,m.y=n*Math.abs((e.top+h.height-i)/h.height)):!c&&u>=e.bottom-h.height&&(p.y=Sc.Forward,m.y=n*Math.abs((e.bottom-h.height-u)/h.height)),!f&&s>=e.right-h.width?(p.x=Sc.Forward,m.x=n*Math.abs((e.right-h.width-s)/h.width)):!d&&a<=e.left+h.width&&(p.x=Sc.Backward,m.x=n*Math.abs((e.left+h.width-a)/h.width)),{direction:p,speed:m}}function nMn(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 O7t(t){return t.reduce((e,r)=>_L(e,rqe(r)),jb)}function oMn(t){return t.reduce((e,r)=>e+w7t(r),0)}function iMn(t){return t.reduce((e,r)=>e+S7t(r),0)}function aMn(t,e){if(e===void 0&&(e=OL),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);v7t(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var sMn=[["x",["left","right"],oMn],["y",["top","bottom"],iMn]],q9=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=V9(r),o=O7t(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of sMn)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})}},xL=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 uMn(t){let{EventTarget:e}=sp(t);return t instanceof e?t:yL(t)}function eqe(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 iy;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(iy||(iy={}));function a7t(t){t.preventDefault()}function lMn(t){t.stopPropagation()}var $n;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})($n||($n={}));var P7t={start:[$n.Space,$n.Enter],cancel:[$n.Esc],end:[$n.Space,$n.Enter,$n.Tab]},cMn=(t,e)=>{let{currentCoordinates:r}=e;switch(t.code){case $n.Right:return{...r,x:r.x+25};case $n.Left:return{...r,x:r.x-25};case $n.Down:return{...r,y:r.y+25};case $n.Up:return{...r,y:r.y-25}}},HM=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 xL(yL(r)),this.windowListeners=new xL(sp(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(iy.Resize,this.handleCancel),this.windowListeners.add(iy.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(iy.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&aMn(n),r(jb)}handleKeyDown(e){if($9(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=P7t,coordinateGetter:a=cMn,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}:jb;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=vL(d,c),p={x:0,y:0},{scrollableAncestors:m}=n.current;for(let h of m){let b=e.code,{isTop:g,isRight:y,isLeft:S,isBottom:x,maxScroll:O,minScroll:P}=C7t(h),E=nMn(h),A={x:Math.min(b===$n.Right?E.right-E.width/2:E.right,Math.max(b===$n.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(b===$n.Down?E.bottom-E.height/2:E.bottom,Math.max(b===$n.Down?E.top:E.top+E.height/2,d.y))},I=b===$n.Right&&!y||b===$n.Left&&!S,R=b===$n.Down&&!x||b===$n.Up&&!g;if(I&&A.x!==d.x){let N=h.scrollLeft+f.x,j=b===$n.Right&&N<=O.x||b===$n.Left&&N>=P.x;if(j&&!f.y){h.scrollTo({left:N,behavior:s});return}j?p.x=h.scrollLeft-N:p.x=b===$n.Right?h.scrollLeft-O.x:h.scrollLeft-P.x,p.x&&h.scrollBy({left:-p.x,behavior:s});break}else if(R&&A.y!==d.y){let N=h.scrollTop+f.y,j=b===$n.Down&&N<=O.y||b===$n.Up&&N>=P.y;if(j&&!f.x){h.scrollTo({top:N,behavior:s});return}j?p.y=h.scrollTop-N:p.y=b===$n.Down?h.scrollTop-O.y:h.scrollTop-P.y,p.y&&h.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,_L(vL(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()}};HM.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=P7t,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 s7t(t){return!!(t&&"distance"in t)}function u7t(t){return!!(t&&"delay"in t)}var U9=class{constructor(e,r,n){var o;n===void 0&&(n=uMn(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=yL(a),this.documentListeners=new xL(this.document),this.listeners=new xL(n),this.windowListeners=new xL(sp(a)),this.initialCoordinates=(o=ffe(i))!=null?o:jb,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(iy.Resize,this.handleCancel),this.windowListeners.add(iy.DragStart,a7t),this.windowListeners.add(iy.VisibilityChange,this.handleCancel),this.windowListeners.add(iy.ContextMenu,a7t),this.documentListeners.add(iy.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(u7t(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(s7t(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(iy.Click,lMn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(iy.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=ffe(e))!=null?r:jb,l=vL(o,u);if(!n&&s){if(s7t(s)){if(s.tolerance!=null&&eqe(l,s.tolerance))return this.handleCancel();if(eqe(l,s.distance))return this.handleStart()}if(u7t(s)&&eqe(l,s.tolerance))return this.handleCancel();this.handlePending(s,l);return}e.cancelable&&e.preventDefault(),a(u)}handleEnd(){let{onAbort:e,onEnd:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleCancel(){let{onAbort:e,onCancel:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleKeydown(e){e.code===$n.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},dMn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},VM=class extends U9{constructor(e){let{event:r}=e,n=yL(r.target);super(e,dMn,n)}};VM.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 fMn={move:{name:"mousemove"},end:{name:"mouseup"}},nqe;(function(t){t[t.RightClick=2]="RightClick"})(nqe||(nqe={}));var oqe=class extends U9{constructor(e){super(e,fMn,yL(e.event.target))}};oqe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===nqe.RightClick?!1:(n?.({event:r}),!0)}}];var tqe={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},iqe=class extends U9{constructor(e){super(e,tqe)}static setup(){return window.addEventListener(tqe.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(tqe.move.name,e)};function e(){}}};iqe.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 B9;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(B9||(B9={}));var hfe;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(hfe||(hfe={}));function pMn(t){let{acceleration:e,activator:r=B9.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=hfe.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=hMn({delta:d,disabled:!i}),[m,h]=ZJt(),b=(0,Ae.useRef)({x:0,y:0}),g=(0,Ae.useRef)({x:0,y:0}),y=(0,Ae.useMemo)(()=>{switch(r){case B9.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case B9.DraggableRect:return o}},[r,o,u]),S=(0,Ae.useRef)(null),x=(0,Ae.useCallback)(()=>{let P=S.current;if(!P)return;let E=b.current.x*g.current.x,A=b.current.y*g.current.y;P.scrollBy(E,A)},[]),O=(0,Ae.useMemo)(()=>s===hfe.TreeOrder?[...l].reverse():l,[s,l]);(0,Ae.useEffect)(()=>{if(!i||!l.length||!y){h();return}for(let P of O){if(n?.(P)===!1)continue;let E=l.indexOf(P),A=c[E];if(!A)continue;let{direction:I,speed:R}=rMn(P,A,y,e,f);for(let N of["x","y"])p[N][I[N]]||(R[N]=0,I[N]=0);if(R.x>0||R.y>0){h(),S.current=P,m(x,a),b.current=R,g.current=I;return}}b.current={x:0,y:0},g.current={x:0,y:0},h()},[e,x,n,h,i,a,JSON.stringify(y),JSON.stringify(p),m,l,O,c,JSON.stringify(f)])}var mMn={x:{[Sc.Backward]:!1,[Sc.Forward]:!1},y:{[Sc.Backward]:!1,[Sc.Forward]:!1}};function hMn(t){let{delta:e,disabled:r}=t,n=dfe(e);return Zz(o=>{if(r||!n||!o)return mMn;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[Sc.Backward]:o.x[Sc.Backward]||i.x===-1,[Sc.Forward]:o.x[Sc.Forward]||i.x===1},y:{[Sc.Backward]:o.y[Sc.Backward]||i.y===-1,[Sc.Forward]:o.y[Sc.Forward]||i.y===1}}},[r,e,n])}function gMn(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return Zz(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function yMn(t,e){return(0,Ae.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 z9;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(z9||(z9={}));var aqe;(function(t){t.Optimized="optimized"})(aqe||(aqe={}));var l7t=new Map;function bMn(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,Ae.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,Ae.useRef)(t),d=b(),f=Yz(d),p=(0,Ae.useCallback)(function(g){g===void 0&&(g=[]),!f.current&&a(y=>y===null?g:y.concat(g.filter(S=>!y.includes(S))))},[f]),m=(0,Ae.useRef)(null),h=Zz(g=>{if(d&&!r)return l7t;if(!g||g===l7t||c.current!==t||i!=null){let y=new Map;for(let S of t){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){y.set(S.id,S.rect.current);continue}let x=S.node.current,O=x?new q9(u(x),x):null;S.rect.current=O,O&&y.set(S.id,O)}return y}return g},[t,i,r,d,u]);return(0,Ae.useEffect)(()=>{c.current=t},[t]),(0,Ae.useEffect)(()=>{d||p()},[r,d]),(0,Ae.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,Ae.useEffect)(()=>{d||typeof s!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...n]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(l){case z9.Always:return!1;case z9.BeforeDragging:return r;default:return!r}}}function E7t(t,e){return Zz(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function _Mn(t,e){return E7t(t,e)}function vMn(t){let{callback:e,disabled:r}=t,n=cfe(e),o=(0,Ae.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,Ae.useEffect)(()=>()=>o?.disconnect(),[o]),o}function yfe(t){let{callback:e,disabled:r}=t,n=cfe(e),o=(0,Ae.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,Ae.useEffect)(()=>()=>o?.disconnect(),[o]),o}function wMn(t){return new q9(OL(t),t)}function c7t(t,e,r){e===void 0&&(e=wMn);let[n,o]=(0,Ae.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=vMn({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=yfe({callback:i});return oy(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function SMn(t){let e=E7t(t);return _7t(t,e)}var d7t=[];function xMn(t){let e=(0,Ae.useRef)(t),r=Zz(n=>t?n&&n!==d7t&&t&&e.current&&t.parentNode===e.current.parentNode?n:V9(t):d7t,[t]);return(0,Ae.useEffect)(()=>{e.current=t},[t]),r}function CMn(t){let[e,r]=(0,Ae.useState)(null),n=(0,Ae.useRef)(t),o=(0,Ae.useCallback)(i=>{let a=QBe(i.target);a&&r(s=>s?(s.set(a,rqe(a)),new Map(s)):null)},[]);return(0,Ae.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=QBe(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,rqe(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=QBe(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,Ae.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>_L(i,a),jb):O7t(t):jb,[t,e])}function f7t(t,e){e===void 0&&(e=[]);let r=(0,Ae.useRef)(null);return(0,Ae.useEffect)(()=>{r.current=null},e),(0,Ae.useEffect)(()=>{let n=t!==jb;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?vL(t,r.current):jb}function OMn(t){(0,Ae.useEffect)(()=>{if(!F9)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 PMn(t,e){return(0,Ae.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function T7t(t){return(0,Ae.useMemo)(()=>t?XIn(t):null,[t])}var p7t=[];function EMn(t,e){e===void 0&&(e=OL);let[r]=t,n=T7t(r?sp(r):null),[o,i]=(0,Ae.useState)(p7t);function a(){i(()=>t.length?t.map(u=>x7t(u)?n:new q9(e(u),u)):p7t)}let s=yfe({callback:a});return oy(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function TMn(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return Jz(e)?e:t}function AMn(t){let{measure:e}=t,[r,n]=(0,Ae.useState)(null),o=(0,Ae.useCallback)(l=>{for(let{target:c}of l)if(Jz(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=yfe({callback:o}),a=(0,Ae.useCallback)(l=>{let c=TMn(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=k9(a);return(0,Ae.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var IMn=[{sensor:VM,options:{}},{sensor:HM,options:{}}],MMn={current:{}},pfe={draggable:{measure:i7t},droppable:{measure:i7t,strategy:z9.WhileDragging,frequency:aqe.Optimized},dragOverlay:{measure:OL}},CL=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}},RMn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new CL,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:mfe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pfe,measureDroppableContainers:mfe,windowRect:null,measuringScheduled:!1},jMn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:mfe,draggableNodes:new Map,over:null,measureDroppableContainers:mfe},bfe=(0,Ae.createContext)(jMn),A7t=(0,Ae.createContext)(RMn);function NMn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new CL}}}function DMn(t,e){switch(e.type){case Ul.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Ul.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 Ul.DragEnd:case Ul.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ul.RegisterDroppable:{let{element:r}=e,{id:n}=r,o=new CL(t.droppable.containers);return o.set(n,r),{...t,droppable:{...t.droppable,containers:o}}}case Ul.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 CL(t.droppable.containers);return a.set(r,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:a}}}case Ul.UnregisterDroppable:{let{id:r,key:n}=e,o=t.droppable.containers.get(r);if(!o||n!==o.key)return t;let i=new CL(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function LMn(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,Ae.useContext)(bfe),i=dfe(n),a=dfe(r?.id);return(0,Ae.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!$9(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=QJt(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function FMn(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function kMn(t){return(0,Ae.useMemo)(()=>({draggable:{...pfe.draggable,...t?.draggable},droppable:{...pfe.droppable,...t?.droppable},dragOverlay:{...pfe.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function $Mn(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,Ae.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;oy(()=>{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=_7t(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=v7t(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var I7t=(0,Ae.createContext)({...jb,scaleX:1,scaleY:1}),zM;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(zM||(zM={}));var W9=(0,Ae.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=IMn,collisionDetection:d=VIn,measuring:f,modifiers:p,...m}=e,h=(0,Ae.useReducer)(DMn,void 0,NMn),[b,g]=h,[y,S]=$In(),[x,O]=(0,Ae.useState)(zM.Uninitialized),P=x===zM.Initialized,{draggable:{active:E,nodes:A,translate:I},droppable:{containers:R}}=b,N=E!=null?A.get(E):null,j=(0,Ae.useRef)({initial:null,translated:null}),$=(0,Ae.useMemo)(()=>{var is;return E!=null?{id:E,data:(is=N?.data)!=null?is:MMn,rect:j}:null},[E,N]),k=(0,Ae.useRef)(null),[z,V]=(0,Ae.useState)(null),[Q,J]=(0,Ae.useState)(null),D=Yz(m,Object.values(m)),B=bL("DndDescribedBy",a),q=(0,Ae.useMemo)(()=>R.getEnabled(),[R]),K=kMn(f),{droppableRects:H,measureDroppableContainers:ee,measuringScheduled:U}=bMn(q,{dragging:P,dependencies:[I.x,I.y],config:K.droppable}),W=gMn(A,E),Y=(0,Ae.useMemo)(()=>Q?ffe(Q):null,[Q]),ae=kb(),Oe=_Mn(W,K.draggable.measure);$Mn({activeNode:E!=null?A.get(E):null,config:ae.layoutShiftCompensation,initialRect:Oe,measure:K.draggable.measure});let le=c7t(W,K.draggable.measure,Oe),Be=c7t(W?W.parentElement:null),ze=(0,Ae.useRef)({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:H,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),rt=R.getNodeFor((r=ze.current.over)==null?void 0:r.id),cr=AMn({measure:K.dragOverlay.measure}),Sn=(n=cr.nodeRef.current)!=null?n:W,je=P?(o=cr.rect)!=null?o:le:null,mt=!!(cr.nodeRef.current&&cr.rect),ht=SMn(mt?null:le),ft=T7t(Sn?sp(Sn):null),te=xMn(P?rt??W:null),et=EMn(te),Re=FMn(p,{transform:{x:I.x-ht.x,y:I.y-ht.y,scaleX:1,scaleY:1},activatorEvent:Q,active:$,activeNodeRect:le,containerNodeRect:Be,draggingNodeRect:je,over:ze.current.over,overlayNodeRect:cr.rect,scrollableAncestors:te,scrollableAncestorRects:et,windowRect:ft}),Pe=Y?_L(Y,I):null,oe=CMn(te),se=f7t(oe),ce=f7t(oe,[le]),Ce=_L(Re,se),Je=je?GIn(je,Re):null,ir=$&&Je?d({active:$,collisionRect:Je,droppableRects:H,droppableContainers:q,pointerCoordinates:Pe}):null,ea=sqe(ir,"id"),[ta,xc]=(0,Ae.useState)(null),Cd=mt?Re:_L(Re,ce),qi=WIn(Cd,(i=ta?.rect)!=null?i:null,le),lp=(0,Ae.useRef)(null),yf=(0,Ae.useCallback)((is,$s)=>{let{sensor:La,options:vf}=$s;if(k.current==null)return;let Od=A.get(k.current);if(!Od)return;let ws=is.nativeEvent,cp=new La({active:k.current,activeNode:Od,event:ws,options:vf,context:ze,onAbort(In){if(!A.get(In))return;let{onDragAbort:Sf}=D.current,mm={id:In};Sf?.(mm),y({type:"onDragAbort",event:mm})},onPending(In,Ye,Sf,mm){if(!A.get(In))return;let{onDragPending:lC}=D.current,En={id:In,constraint:Ye,initialCoordinates:Sf,offset:mm};lC?.(En),y({type:"onDragPending",event:En})},onStart(In){let Ye=k.current;if(Ye==null)return;let Sf=A.get(Ye);if(!Sf)return;let{onDragStart:mm}=D.current,vl={activatorEvent:ws,active:{id:Ye,data:Sf.data,rect:j}};(0,SL.unstable_batchedUpdates)(()=>{mm?.(vl),O(zM.Initializing),g({type:Ul.DragStart,initialCoordinates:In,active:Ye}),y({type:"onDragStart",event:vl}),V(lp.current),J(ws)})},onMove(In){g({type:Ul.DragMove,coordinates:In})},onEnd:wf(Ul.DragEnd),onCancel:wf(Ul.DragCancel)});lp.current=cp;function wf(In){return async function(){let{active:Sf,collisions:mm,over:vl,scrollAdjustedTranslate:lC}=ze.current,En=null;if(Sf&&lC){let{cancelDrop:uy}=D.current;En={activatorEvent:ws,active:Sf,collisions:mm,delta:lC,over:vl},In===Ul.DragEnd&&typeof uy=="function"&&await Promise.resolve(uy(En))&&(In=Ul.DragCancel)}k.current=null,(0,SL.unstable_batchedUpdates)(()=>{g({type:In}),O(zM.Uninitialized),xc(null),V(null),J(null),lp.current=null;let uy=In===Ul.DragEnd?"onDragEnd":"onDragCancel";if(En){let r2=D.current[uy];r2?.(En),y({type:uy,event:En})}})}}},[A]),bf=(0,Ae.useCallback)((is,$s)=>(La,vf)=>{let Od=La.nativeEvent,ws=A.get(vf);if(k.current!==null||!ws||Od.dndKit||Od.defaultPrevented)return;let cp={active:ws};is(La,$s.options,cp)===!0&&(Od.dndKit={capturedBy:$s.sensor},k.current=vf,yf(La,$s))},[A,yf]),xn=yMn(c,bf);OMn(c),oy(()=>{le&&x===zM.Initializing&&O(zM.Initialized)},[le,x]),(0,Ae.useEffect)(()=>{let{onDragMove:is}=D.current,{active:$s,activatorEvent:La,collisions:vf,over:Od}=ze.current;if(!$s||!La)return;let ws={active:$s,activatorEvent:La,collisions:vf,delta:{x:Ce.x,y:Ce.y},over:Od};(0,SL.unstable_batchedUpdates)(()=>{is?.(ws),y({type:"onDragMove",event:ws})})},[Ce.x,Ce.y]),(0,Ae.useEffect)(()=>{let{active:is,activatorEvent:$s,collisions:La,droppableContainers:vf,scrollAdjustedTranslate:Od}=ze.current;if(!is||k.current==null||!$s||!Od)return;let{onDragOver:ws}=D.current,cp=vf.get(ea),wf=cp&&cp.rect.current?{id:cp.id,rect:cp.rect.current,data:cp.data,disabled:cp.disabled}:null,In={active:is,activatorEvent:$s,collisions:La,delta:{x:Od.x,y:Od.y},over:wf};(0,SL.unstable_batchedUpdates)(()=>{xc(wf),ws?.(In),y({type:"onDragOver",event:In})})},[ea]),oy(()=>{ze.current={activatorEvent:Q,active:$,activeNode:W,collisionRect:Je,collisions:ir,droppableRects:H,draggableNodes:A,draggingNode:Sn,draggingNodeRect:je,droppableContainers:R,over:ta,scrollableAncestors:te,scrollAdjustedTranslate:Ce},j.current={initial:je,translated:Je}},[$,W,ir,Je,A,Sn,je,H,R,ta,te,Ce]),pMn({...ae,delta:I,draggingRect:Je,pointerCoordinates:Pe,scrollableAncestors:te,scrollableAncestorRects:et});let _f=(0,Ae.useMemo)(()=>({active:$,activeNode:W,activeNodeRect:le,activatorEvent:Q,collisions:ir,containerNodeRect:Be,dragOverlay:cr,draggableNodes:A,droppableContainers:R,droppableRects:H,over:ta,measureDroppableContainers:ee,scrollableAncestors:te,scrollableAncestorRects:et,measuringConfiguration:K,measuringScheduled:U,windowRect:ft}),[$,W,le,Q,ir,Be,cr,A,R,H,ta,ee,te,et,K,U,ft]),uC=(0,Ae.useMemo)(()=>({activatorEvent:Q,activators:xn,active:$,activeNodeRect:le,ariaDescribedById:{draggable:B},dispatch:g,draggableNodes:A,over:ta,measureDroppableContainers:ee}),[Q,xn,$,le,g,B,A,ta,ee]);return Ae.default.createElement(h7t.Provider,{value:S},Ae.default.createElement(bfe.Provider,{value:uC},Ae.default.createElement(A7t.Provider,{value:_f},Ae.default.createElement(I7t.Provider,{value:qi},l)),Ae.default.createElement(LMn,{disabled:s?.restoreFocus===!1})),Ae.default.createElement(UIn,{...s,hiddenTextDescribedById:B}));function kb(){let is=z?.autoScrollEnabled===!1,$s=typeof u=="object"?u.enabled===!1:u===!1,La=P&&!is&&!$s;return typeof u=="object"?{...u,enabled:La}:{enabled:La}}}),BMn=(0,Ae.createContext)(null),m7t="button",qMn="Draggable";function M7t(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=bL(qMn),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,Ae.useContext)(bfe),{role:p=m7t,roleDescription:m="draggable",tabIndex:h=0}=o??{},b=u?.id===e,g=(0,Ae.useContext)(b?I7t:BMn),[y,S]=k9(),[x,O]=k9(),P=PMn(a,e),E=Yz(r);oy(()=>(d.set(e,{id:e,key:i,node:y,activatorNode:x,data:E}),()=>{let I=d.get(e);I&&I.key===i&&d.delete(e)}),[d,e]);let A=(0,Ae.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":b&&p===m7t?!0:void 0,"aria-roledescription":m,"aria-describedby":c.draggable}),[n,p,h,b,m,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:A,isDragging:b,listeners:n?void 0:P,node:y,over:f,setNodeRef:S,setActivatorNodeRef:O,transform:g}}function R7t(){return(0,Ae.useContext)(A7t)}var UMn="Droppable",zMn={timeout:25};function j7t(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=bL(UMn),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,Ae.useContext)(bfe),c=(0,Ae.useRef)({disabled:r}),d=(0,Ae.useRef)(!1),f=(0,Ae.useRef)(null),p=(0,Ae.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:b}={...zMn,...o},g=Yz(h??n),y=(0,Ae.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(g.current)?g.current:[g.current]),p.current=null},b)},[b]),S=yfe({callback:y,disabled:m||!a}),x=(0,Ae.useCallback)((A,I)=>{S&&(I&&(S.unobserve(I),d.current=!1),A&&S.observe(A))},[S]),[O,P]=k9(x),E=Yz(e);return(0,Ae.useEffect)(()=>{!S||!O.current||(S.disconnect(),d.current=!1,S.observe(O.current))},[O,S]),(0,Ae.useEffect)(()=>(s({type:Ul.RegisterDroppable,element:{id:n,key:i,disabled:r,node:O,rect:f,data:E}}),()=>s({type:Ul.UnregisterDroppable,key:i,id:n})),[n]),(0,Ae.useEffect)(()=>{r!==c.current.disabled&&(s({type:Ul.SetDroppableDisabled,id:n,key:i,disabled:r}),c.current.disabled=r)},[n,i,r,s]),{active:a,rect:f,isOver:u?.id===n,node:O,over:u,setNodeRef:P}}var Fs=F(X());function Sfe(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function HMn(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function _fe(t){return t!==null&&t>=0}function VMn(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let r=0;r{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=Sfe(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 vfe={scaleX:1,scaleY:1},K9=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:rr&&o<=a?{x:0,y:-s.height-u,...vfe}:o=a?{x:0,y:s.height+u,...vfe}:{x:0,y:0,...vfe}};function KMn(t,e,r){let n=t[e],o=t[e-1],i=t[e+1];return n?rn.map(P=>typeof P=="object"&&"id"in P?P.id:P),[n]),m=a!=null,h=a?p.indexOf(a.id):-1,b=l?p.indexOf(l.id):-1,g=(0,Fs.useRef)(p),y=!VMn(p,g.current),S=b!==-1&&h===-1||y,x=WMn(i);oy(()=>{y&&m&&c(p)},[y,p,m,c]),(0,Fs.useEffect)(()=>{g.current=p},[p]);let O=(0,Fs.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:S,items:p,overIndex:b,useDragOverlay:f,sortedRects:HMn(p,u),strategy:o}),[h,d,x.draggable,x.droppable,S,p,b,u,f,o]);return Fs.default.createElement(L7t.Provider,{value:O},e)}var GMn=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return Sfe(r,n,o).indexOf(e)},JMn=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},YMn={duration:200,easing:"ease"},F7t="transform",ZMn=Rb.Transition.toString({property:F7t,duration:0,easing:"linear"}),XMn={roleDescription:"sortable"};function QMn(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,Fs.useState)(null),s=(0,Fs.useRef)(r);return oy(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=OL(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,Fs.useEffect)(()=>{i&&a(null)},[i]),i}function J9(t){let{animateLayoutChanges:e=JMn,attributes:r,disabled:n,data:o,getNewIndex:i=GMn,id:a,strategy:s,resizeObserverConfig:u,transition:l=YMn}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:b,useDragOverlay:g,strategy:y}=(0,Fs.useContext)(L7t),S=eRn(n,p),x=c.indexOf(a),O=(0,Fs.useMemo)(()=>({sortable:{containerId:d,index:x,items:c},...o}),[d,o,x,c]),P=(0,Fs.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:E,node:A,isOver:I,setNodeRef:R}=j7t({id:a,data:O,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...u}}),{active:N,activatorEvent:j,activeNodeRect:$,attributes:k,setNodeRef:z,listeners:V,isDragging:Q,over:J,setActivatorNodeRef:D,transform:B}=M7t({id:a,data:O,attributes:{...XMn,...r},disabled:S.draggable}),q=YJt(R,z),K=!!N,H=K&&!m&&_fe(f)&&_fe(b),ee=!g&&Q,U=ee&&H?B:null,Y=H?U??(s??y)({rects:h,activeNodeRect:$,activeIndex:f,overIndex:b,index:x}):null,ae=_fe(f)&&_fe(b)?i({id:a,items:c,activeIndex:f,overIndex:b}):x,Oe=N?.id,le=(0,Fs.useRef)({activeId:Oe,items:c,newIndex:ae,containerId:d}),Be=c!==le.current.items,ze=e({active:N,containerId:d,isDragging:Q,isSorting:K,id:a,index:x,items:c,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:l,wasDragging:le.current.activeId!=null}),rt=QMn({disabled:!ze,index:x,node:A,rect:E});return(0,Fs.useEffect)(()=>{K&&le.current.newIndex!==ae&&(le.current.newIndex=ae),d!==le.current.containerId&&(le.current.containerId=d),c!==le.current.items&&(le.current.items=c)},[K,ae,d,c]),(0,Fs.useEffect)(()=>{if(Oe===le.current.activeId)return;if(Oe!=null&&le.current.activeId==null){le.current.activeId=Oe;return}let Sn=setTimeout(()=>{le.current.activeId=Oe},50);return()=>clearTimeout(Sn)},[Oe]),{active:N,activeIndex:f,attributes:k,data:O,rect:E,index:x,newIndex:ae,items:c,isOver:I,isSorting:K,isDragging:Q,listeners:V,node:A,overIndex:b,over:J,setNodeRef:q,setActivatorNodeRef:D,setDroppableNodeRef:R,setDraggableNodeRef:z,transform:rt??Y,transition:cr()};function cr(){if(rt||Be&&le.current.newIndex===x)return ZMn;if(!(ee&&!$9(j)||!l)&&(K||ze))return Rb.Transition.toString({...l,property:F7t})}}function eRn(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 wfe(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 tRn=[$n.Down,$n.Right,$n.Up,$n.Left],xfe=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(tRn.includes(t.code)){if(t.preventDefault(),!r||!n)return;let u=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;let f=o.get(d.id);if(f)switch(t.code){case $n.Down:n.topf.top&&u.push(d);break;case $n.Left:n.left>f.left&&u.push(d);break;case $n.Right:n.left1&&(c=l[1].id),c!=null){let d=i.get(r.id),f=i.get(c),p=f?o.get(f.id):null,m=f?.node.current;if(m&&p&&d&&f){let b=V9(m).some((P,E)=>s[E]!==P),g=k7t(d,f),y=rRn(d,f),S=b||!g?{x:0,y:0}:{x:y?n.width-p.width:0,y:y?n.height-p.height:0},x={x:p.left,y:p.top};return S.x&&S.y?x:vL(x,S)}}}};function k7t(t,e){return!wfe(t)||!wfe(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function rRn(t,e){return!wfe(t)||!wfe(e)||!k7t(t,e)?!1:t.data.current.sortable.index(0,Cfe.useContext)(uqe);var rK=require("obsidian");var B7t=require("obsidian");ti();var Qo=F(X()),q7t=F(Dc());nr();Tn();bn();yo();var iC=F(X());function $7t(){return iC.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},iC.default.createElement("li",null,iC.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{}")," represents the selected text."),iC.default.createElement("li",null,iC.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),iC.default.createElement("li",null,iC.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),iC.default.createElement("li",null,iC.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)."))}function nRn({commands:t,command:e,onConfirm:r,onCancel:n}){let i=Rn().activeModels.filter(f=>f.enabled).map(f=>({label:tde(f),value:kr(f)})),[a,s]=(0,Qo.useState)(e),[u,l]=(0,Qo.useState)({}),c=(f,p)=>{s(m=>({...m,[f]:p})),l(m=>({...m,[f]:void 0}))},d=()=>{let f={},p=JU(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 Qo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},Qo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Qo.default.createElement(ip,{htmlFor:"title"},"Name"),Qo.default.createElement(mo,{id:"title",value:a.title,onChange:f=>c("title",f.target.value),placeholder:"Enter command name"}),u.title&&Qo.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.title)),Qo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Qo.default.createElement(ip,{htmlFor:"content"},"Prompt"),Qo.default.createElement($7t,null),Qo.default.createElement(yE,{id:"content",value:a.content,onChange:f=>c("content",f.target.value),placeholder:"Enter command prompt",className:"tw-min-h-[200px]"}),u.content&&Qo.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.content)),Qo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Qo.default.createElement(ip,{htmlFor:"modelKey"},"Model (Optional)"),Qo.default.createElement("div",{className:"tw-group tw-relative tw-w-full"},Qo.default.createElement("select",{value:a.modelKey,onChange:f=>{let p=f.target.value;if(!p){c("modelKey","");return}if(!i.find(h=>h.value===p)){fe(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:_e("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")},Qo.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>Qo.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),Qo.default.createElement("div",{className:_e("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")},Qo.default.createElement(Hi,{className:"tw-size-4"})))),Qo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qo.default.createElement(wd,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),Qo.default.createElement(ip,{htmlFor:"showInContextMenu"},"Show in context menu")),Qo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qo.default.createElement(wd,{id:"showInSlashMenu",checked:a.showInSlashMenu,onCheckedChange:f=>c("showInSlashMenu",f)}),Qo.default.createElement(ip,{htmlFor:"showInSlashMenu"},"Show in slash menu")),Qo.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Qo.default.createElement(ge,{variant:"secondary",onClick:n},"Cancel"),Qo.default.createElement(ge,{variant:"default",onClick:d},"Save")))}var Ofe=class extends B7t.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,q7t.createRoot)(r);let n=o=>{this.onUpdate(o),this.close()};this.root.render(Qo.default.createElement(nRn,{commands:this.commands,command:this.command,onConfirm:n,onCancel:()=>this.close()}))}onClose(){this.root.unmount()}};var va=F(X());Tn();var yh=F(X());Tn();bn();qR();yo();yn();function aC({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,yh.useState)(!1),s=(0,yh.useRef)(null),u=(0,yh.useRef)(!0);return(0,yh.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await eo(t)}catch(c){fe("Failed to decrypt value:"+ei(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),yh.default.createElement("div",{className:_e("tw-relative",o)},yh.default.createElement(mo,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:_e("tw-w-full !tw-pr-7")}),yh.default.createElement("div",{onClick:()=>!n&&a(!i),className:_e("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?yh.default.createElement(b3,{className:_e("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")}):yh.default.createElement(eO,{className:_e("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")})))}bn();var xd=F(X());var Qi=F(X(),1);function sC(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var z7t=F(X(),1);function U7t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function lqe(...t){return e=>{let r=!1,n=t.map(o=>{let i=U7t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o{let{children:r,...n}=t,o=Sd.Children.toArray(r),i=o.find(iRn);if(i){let a=i.props.children,s=o.map(u=>u===i?Sd.Children.count(a)>1?Sd.Children.only(null):Sd.isValidElement(a)?a.props.children:null:u);return(0,Qz.jsx)(cqe,{...n,ref:e,children:Sd.isValidElement(a)?Sd.cloneElement(a,void 0,s):null})}return(0,Qz.jsx)(cqe,{...n,ref:e,children:r})});Z9.displayName="Slot";var cqe=Sd.forwardRef((t,e)=>{let{children:r,...n}=t;if(Sd.isValidElement(r)){let o=sRn(r);return Sd.cloneElement(r,{...aRn(n,r.props),ref:e?lqe(e,o):o})}return Sd.Children.count(r)>1?Sd.Children.only(null):null});cqe.displayName="SlotClone";var oRn=({children:t})=>(0,Qz.jsx)(Qz.Fragment,{children:t});function iRn(t){return Sd.isValidElement(t)&&t.type===oRn}function aRn(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 sRn(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 W7t=F(pt(),1),uRn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],bh=uRn.reduce((t,e)=>{let r=H7t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Z9:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,W7t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function K7t(t,e){t&&V7t.flushSync(()=>t.dispatchEvent(e))}var fqe=F(pt(),1),lRn="DismissableLayer",dqe="dismissableLayer.update",cRn="dismissableLayer.pointerDownOutside",dRn="dismissableLayer.focusOutside",G7t,Y7t=os.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),pqe=os.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=os.useContext(Y7t),[c,d]=os.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=os.useState({}),m=_E(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=mRn(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=hRn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return oM(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),os.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(G7t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),J7t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=G7t)}},[c,f,r,l]),os.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),J7t())},[c,l]),os.useEffect(()=>{let E=()=>p({});return document.addEventListener(dqe,E),()=>document.removeEventListener(dqe,E)},[]),(0,fqe.jsx)(bh.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:sC(t.onFocusCapture,P.onFocusCapture),onBlurCapture:sC(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:sC(t.onPointerDownCapture,O.onPointerDownCapture)})});pqe.displayName=lRn;var fRn="DismissableLayerBranch",pRn=os.forwardRef((t,e)=>{let r=os.useContext(Y7t),n=os.useRef(null),o=_E(e,n);return os.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,fqe.jsx)(bh.div,{...t,ref:o})});pRn.displayName=fRn;function mRn(t,e=globalThis?.document){let r=Ur(t),n=os.useRef(!1),o=os.useRef(()=>{});return os.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Z7t(cRn,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 hRn(t,e=globalThis?.document){let r=Ur(t),n=os.useRef(!1);return os.useEffect(()=>{let o=i=>{i.target&&!n.current&&Z7t(dRn,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 J7t(){let t=new CustomEvent(dqe);document.dispatchEvent(t)}function Z7t(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?K7t(o,i):o.dispatchEvent(i)}var ay=F(X(),1);var rYt=F(pt(),1),mqe="focusScope.autoFocusOnMount",hqe="focusScope.autoFocusOnUnmount",X7t={bubbles:!1,cancelable:!0},gRn="FocusScope",gqe=ay.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=ay.useState(null),l=Ur(o),c=Ur(i),d=ay.useRef(null),f=_E(e,h=>u(h)),p=ay.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;ay.useEffect(()=>{if(n){let y=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:WM(d.current,{select:!0})},S=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||WM(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&WM(s)};var h=y,b=S,g=x;document.addEventListener("focusin",y),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),ay.useEffect(()=>{if(s){eYt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(mqe,X7t);s.addEventListener(mqe,l),s.dispatchEvent(g),g.defaultPrevented||(yRn(SRn(nYt(s)),{select:!0}),document.activeElement===h&&WM(s))}return()=>{s.removeEventListener(mqe,l),setTimeout(()=>{let g=new CustomEvent(hqe,X7t);s.addEventListener(hqe,c),s.dispatchEvent(g),g.defaultPrevented||WM(h??document.body,{select:!0}),s.removeEventListener(hqe,c),eYt.remove(p)},0)}}},[s,l,c,p]);let m=ay.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let y=h.currentTarget,[S,x]=bRn(y);S&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&WM(S,{select:!0})):h.shiftKey&&g===S&&(h.preventDefault(),r&&WM(x,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,rYt.jsx)(bh.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});gqe.displayName=gRn;function yRn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(WM(n,{select:e}),document.activeElement!==r)return}function bRn(t){let e=nYt(t),r=Q7t(e,t),n=Q7t(e.reverse(),t);return[r,n]}function nYt(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 Q7t(t,e){for(let r of t)if(!_Rn(r,{upTo:e}))return r}function _Rn(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 vRn(t){return t instanceof HTMLInputElement&&"select"in t}function WM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&vRn(t)&&e&&t.select()}}var eYt=wRn();function wRn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=tYt(t,e),t.unshift(e)},remove(e){t=tYt(t,e),t[0]?.resume()}}}function tYt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function SRn(t){return t.filter(e=>e.tagName!=="A")}var Pfe=F(X(),1),oYt=F(ds(),1);var iYt=F(pt(),1),xRn="Portal",yqe=Pfe.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Pfe.useState(!1);Jn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?oYt.default.createPortal((0,iYt.jsx)(bh.div,{...n,ref:e}),a):null});yqe.displayName=xRn;var Ni=F(pt(),1),bqe="Dialog",[aYt,wwi]=Yi(bqe),[CRn,Nb]=aYt(bqe),sYt=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=Qi.useRef(null),u=Qi.useRef(null),[l=!1,c]=ud({prop:n,defaultProp:o,onChange:i});return(0,Ni.jsx)(CRn,{scope:e,triggerRef:s,contentRef:u,contentId:hl(),titleId:hl(),descriptionId:hl(),open:l,onOpenChange:c,onOpenToggle:Qi.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};sYt.displayName=bqe;var uYt="DialogTrigger",lYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(uYt,r),i=_E(e,o.triggerRef);return(0,Ni.jsx)(bh.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":wqe(o.open),...n,ref:i,onClick:sC(t.onClick,o.onOpenToggle)})});lYt.displayName=uYt;var _qe="DialogPortal",[ORn,cYt]=aYt(_qe,{forceMount:void 0}),dYt=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=Nb(_qe,e);return(0,Ni.jsx)(ORn,{scope:e,forceMount:r,children:Qi.Children.map(n,a=>(0,Ni.jsx)(fd,{present:r||i.open,children:(0,Ni.jsx)(yqe,{asChild:!0,container:o,children:a})}))})};dYt.displayName=_qe;var Efe="DialogOverlay",fYt=Qi.forwardRef((t,e)=>{let r=cYt(Efe,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=Nb(Efe,t.__scopeDialog);return i.modal?(0,Ni.jsx)(fd,{present:n||i.open,children:(0,Ni.jsx)(PRn,{...o,ref:e})}):null});fYt.displayName=Efe;var PRn=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(Efe,r);return(0,Ni.jsx)(I9,{as:Z9,allowPinchZoom:!0,shards:[o.contentRef],children:(0,Ni.jsx)(bh.div,{"data-state":wqe(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),PL="DialogContent",pYt=Qi.forwardRef((t,e)=>{let r=cYt(PL,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=Nb(PL,t.__scopeDialog);return(0,Ni.jsx)(fd,{present:n||i.open,children:i.modal?(0,Ni.jsx)(ERn,{...o,ref:e}):(0,Ni.jsx)(TRn,{...o,ref:e})})});pYt.displayName=PL;var ERn=Qi.forwardRef((t,e)=>{let r=Nb(PL,t.__scopeDialog),n=Qi.useRef(null),o=_E(e,r.contentRef,n);return Qi.useEffect(()=>{let i=n.current;if(i)return bM(i)},[]),(0,Ni.jsx)(mYt,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:sC(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:sC(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:sC(t.onFocusOutside,i=>i.preventDefault())})}),TRn=Qi.forwardRef((t,e)=>{let r=Nb(PL,t.__scopeDialog),n=Qi.useRef(!1),o=Qi.useRef(!1);return(0,Ni.jsx)(mYt,{...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()}})}),mYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=Nb(PL,r),u=Qi.useRef(null),l=_E(e,u);return iM(),(0,Ni.jsxs)(Ni.Fragment,{children:[(0,Ni.jsx)(gqe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Ni.jsx)(pqe,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":wqe(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,Ni.jsxs)(Ni.Fragment,{children:[(0,Ni.jsx)(ARn,{titleId:s.titleId}),(0,Ni.jsx)(MRn,{contentRef:u,descriptionId:s.descriptionId})]})]})}),vqe="DialogTitle",hYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(vqe,r);return(0,Ni.jsx)(bh.h2,{id:o.titleId,...n,ref:e})});hYt.displayName=vqe;var gYt="DialogDescription",yYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(gYt,r);return(0,Ni.jsx)(bh.p,{id:o.descriptionId,...n,ref:e})});yYt.displayName=gYt;var bYt="DialogClose",_Yt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(bYt,r);return(0,Ni.jsx)(bh.button,{type:"button",...n,ref:e,onClick:sC(t.onClick,()=>o.onOpenChange(!1))})});_Yt.displayName=bYt;function wqe(t){return t?"open":"closed"}var vYt="DialogTitleWarning",[Swi,wYt]=L3t(vYt,{contentName:PL,titleName:vqe,docsSlug:"dialog"}),ARn=({titleId:t})=>{let e=wYt(vYt),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 Qi.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},ORn="DialogDescriptionWarning",PRn=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${gYt(ORn).contentName}}.`;return Qi.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},yYt=rYt,bYt=oYt,_Yt=aYt,vqe=sYt,wqe=uYt,Sqe=cYt,xqe=fYt,vYt=mYt;yn();Tn();var Ofe=yYt,wYt=bYt,TRn=_Yt;var SYt=xd.forwardRef(({className:t,...e},r)=>xd.createElement(vqe,{ref:r,className:_e("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}));SYt.displayName=vqe.displayName;var Z9=xd.forwardRef(({className:t,children:e,container:r,...n},o)=>xd.createElement(TRn,{container:r},xd.createElement(SYt,null),xd.createElement(wqe,{ref:o,className:_e("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,xd.createElement(vYt,{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"},xd.createElement(Vi,{className:"tw-size-4"}),xd.createElement("span",{className:"tw-sr-only"},"Close")))));Z9.displayName=wqe.displayName;var X9=({className:t,...e})=>xd.createElement("div",{className:_e("tw-flex tw-flex-col tw-space-y-0.5 tw-text-center sm:tw-text-left",t),...e});X9.displayName="DialogHeader";var ARn=({className:t,...e})=>xd.createElement("div",{className:_e("tw-flex tw-flex-col-reverse sm:tw-flex-row sm:tw-justify-end sm:tw-space-x-2",t),...e});ARn.displayName="DialogFooter";var Q9=xd.forwardRef(({className:t,...e},r)=>xd.createElement(Sqe,{ref:r,className:_e("tw-mt-0 tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));Q9.displayName=Sqe.displayName;var eK=xd.forwardRef(({className:t,...e},r)=>xd.createElement(xqe,{ref:r,className:_e("tw-text-sm tw-text-muted",t),...e}));eK.displayName=xqe.displayName;Cn();function hn(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=Vz(),a="onChange"in t?t.onChange:void 0,s=(0,va.useMemo)(()=>{if(a)return tJ(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return va.default.createElement(mo,{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 va.default.createElement(iC,{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 va.default.createElement(yE,{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 va.default.createElement(cz,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return va.default.createElement("div",{className:"tw-group tw-relative tw-w-full sm:tw-w-[200px]"},va.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:_e("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&&va.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>va.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),va.default.createElement("div",{className:_e("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")},va.default.createElement(Hi,{className:"tw-size-4"})));case"slider":return va.default.createElement(nC,{value:t.value||0,onChange:t.onChange,min:t.min,max:t.max,step:t.step,disabled:o,className:"tw-w-full sm:tw-w-[300px]"});case"dialog":return va.default.createElement(Ofe,null,va.default.createElement(wYt,{asChild:!0},t.trigger),va.default.createElement(Z9,{container:i},(t.dialogTitle||t.dialogDescription)&&va.default.createElement(X9,null,t.dialogTitle&&va.default.createElement(Q9,null,t.dialogTitle),t.dialogDescription&&va.default.createElement(eK,null,t.dialogDescription)),t.children));case"custom":return t.children}};return va.default.createElement("div",{className:_e("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)},va.default.createElement("div",{className:"tw-w-full tw-space-y-1.5 sm:tw-w-[300px]"},va.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-leading-none"},e),r&&va.default.createElement("div",{className:"tw-text-xs tw-text-muted"},r)),va.default.createElement("div",{className:"tw-w-full tw-flex-1 sm:tw-flex sm:tw-justify-end"},u()))}nr();function IRn(t){let r=`${QI()}/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[AD]=o.showInContextMenu,s[ID]=o.showInSlashMenu,s[MD]=o.order,s[RD]=o.modelKey,s[jD]=0})}))}async function xYt(){let t=ue().inlineEditCommands;if(!t||t.length===0)return;let e=[],r=[],n=Gx(),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=GU(a.title,n);s?r.push({...a,title:encodeURIComponent(a.title),content:`> ${s} +For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return Qi.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},IRn="DialogDescriptionWarning",MRn=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wYt(IRn).contentName}}.`;return Qi.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},SYt=sYt,xYt=lYt,CYt=dYt,Sqe=fYt,xqe=pYt,Cqe=hYt,Oqe=yYt,OYt=_Yt;bn();Tn();var Tfe=SYt,PYt=xYt,jRn=CYt;var EYt=xd.forwardRef(({className:t,...e},r)=>xd.createElement(Sqe,{ref:r,className:_e("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}));EYt.displayName=Sqe.displayName;var X9=xd.forwardRef(({className:t,children:e,container:r,...n},o)=>xd.createElement(jRn,{container:r},xd.createElement(EYt,null),xd.createElement(xqe,{ref:o,className:_e("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,xd.createElement(OYt,{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"},xd.createElement(Vi,{className:"tw-size-4"}),xd.createElement("span",{className:"tw-sr-only"},"Close")))));X9.displayName=xqe.displayName;var Q9=({className:t,...e})=>xd.createElement("div",{className:_e("tw-flex tw-flex-col tw-space-y-0.5 tw-text-center sm:tw-text-left",t),...e});Q9.displayName="DialogHeader";var NRn=({className:t,...e})=>xd.createElement("div",{className:_e("tw-flex tw-flex-col-reverse sm:tw-flex-row sm:tw-justify-end sm:tw-space-x-2",t),...e});NRn.displayName="DialogFooter";var eK=xd.forwardRef(({className:t,...e},r)=>xd.createElement(Cqe,{ref:r,className:_e("tw-mt-0 tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));eK.displayName=Cqe.displayName;var tK=xd.forwardRef(({className:t,...e},r)=>xd.createElement(Oqe,{ref:r,className:_e("tw-text-sm tw-text-muted",t),...e}));tK.displayName=Oqe.displayName;yn();function hn(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=Wz(),a="onChange"in t?t.onChange:void 0,s=(0,va.useMemo)(()=>{if(a)return rJ(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return va.default.createElement(mo,{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 va.default.createElement(aC,{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 va.default.createElement(yE,{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 va.default.createElement(dz,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return va.default.createElement("div",{className:"tw-group tw-relative tw-w-full sm:tw-w-[200px]"},va.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:_e("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&&va.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>va.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),va.default.createElement("div",{className:_e("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")},va.default.createElement(Hi,{className:"tw-size-4"})));case"slider":return va.default.createElement(oC,{value:t.value||0,onChange:t.onChange,min:t.min,max:t.max,step:t.step,disabled:o,className:"tw-w-full sm:tw-w-[300px]"});case"dialog":return va.default.createElement(Tfe,null,va.default.createElement(PYt,{asChild:!0},t.trigger),va.default.createElement(X9,{container:i},(t.dialogTitle||t.dialogDescription)&&va.default.createElement(Q9,null,t.dialogTitle&&va.default.createElement(eK,null,t.dialogTitle),t.dialogDescription&&va.default.createElement(tK,null,t.dialogDescription)),t.children));case"custom":return t.children}};return va.default.createElement("div",{className:_e("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)},va.default.createElement("div",{className:"tw-w-full tw-space-y-1.5 sm:tw-w-[300px]"},va.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-leading-none"},e),r&&va.default.createElement("div",{className:"tw-text-xs tw-text-muted"},r)),va.default.createElement("div",{className:"tw-w-full tw-flex-1 sm:tw-flex sm:tw-justify-end"},u()))}nr();function DRn(t){let r=`${QI()}/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[ID]=o.showInContextMenu,s[MD]=o.showInSlashMenu,s[RD]=o.order,s[jD]=o.modelKey,s[ND]=0})}))}async function TYt(){let t=ue().inlineEditCommands;if(!t||t.length===0)return;let e=[],r=[],n=Jx(),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=JU(a.title,n);s?r.push({...a,title:encodeURIComponent(a.title),content:`> ${s} Original name: ${a.title} -${a.content}`}):e.push(a)}await lm.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 ${QI()}.`;r.length>0&&(await IRn(r),i+=` +${a.content}`}):e.push(a)}await lm.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 ${QI()}.`;r.length>0&&(await DRn(r),i+=` -We found ${r.length} unsupported commands. They are saved in ${QI()}/unsupported. To fix them, please resolve the errors and move the note file out of the unsupported folder.`),dt("inlineEditCommands",[]),new sd(app,()=>{},i,"\u{1F680} New Copilot Custom Commands","OK","").open()}async function Cqe(){let t=Gx(),e=O3t.filter(n=>!t.some(o=>o.title===n.title)),r=[...t,...e];lm.getInstance().updateCommands(r)}async function CYt(){if(ue().suggestedDefaultCommands)return;Gx().length===0&&(new sd(app,()=>{Cqe()},"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(),dt("suggestedDefaultCommands",!0))}var MRn=({command:t,commands:e,onUpdate:r,onRemove:n})=>{let{attributes:o,listeners:i,setNodeRef:a,transform:s,transition:u,isDragging:l}=G9({id:t.title}),c={transform:Rb.Transform.toString(s),transition:u},d=()=>{n(t)};return it.default.createElement(BM,{ref:a,style:c,className:_e("tw-transition-colors",l&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50")},it.default.createElement(gf,{className:"tw-w-10"},it.default.createElement("div",{...o,...i,className:"tw-flex tw-cursor-grab tw-items-center tw-justify-center"},it.default.createElement(d_,{className:"tw-size-4"}))),it.default.createElement(gf,null,t.title),it.default.createElement(gf,{className:"tw-text-center"},it.default.createElement(wd,{checked:t.showInContextMenu,onCheckedChange:f=>{r({...t,showInContextMenu:f===!0},t.title)},className:"tw-mx-auto"})),it.default.createElement(gf,{className:"tw-text-center"},it.default.createElement(wd,{checked:t.showInSlashMenu,onCheckedChange:f=>r({...t,showInSlashMenu:f===!0},t.title),className:"tw-mx-auto"})),it.default.createElement(gf,{className:"tw-text-center"},it.default.createElement("div",{className:"tw-flex tw-justify-center tw-space-x-1"},it.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>{new Sfe(app,e,t,async p=>{await r(p,t.title)}).open()}},it.default.createElement(p_,{className:"tw-size-4"})),it.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>{new sd(app,d,`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()}},it.default.createElement(Rm,{className:"tw-size-4"})))))},OYt=()=>{let t=P3t(),e=(0,it.useMemo)(()=>AW([...t]),[t]),[r,n]=it.default.useState(""),o=Rn(),i=pfe(Zz(VM,{activationConstraint:{distance:8}}),Zz(HM,{coordinateGetter:vfe})),a=GU(r,e),s=!a&&r.trim()!=="",u=async()=>{if(s)try{await lm.getInstance().createCommand(r.trim(),""),n(""),new tK.Notice(`Command "${r.trim()}" created successfully!`)}catch(p){console.error("Failed to create command:",p),new tK.Notice("Failed to create command. Please try again.")}},l=async(p,m)=>{await lm.getInstance().updateCommand(p,m)},c=async p=>{try{await lm.getInstance().deleteCommand(p),new tK.Notice(`Command "${p.title}" deleted successfully!`)}catch(m){throw console.error("Failed to delete command:",m),new tK.Notice("Failed to delete command. Please try again."),m}},d=async p=>{let{active:m,over:h}=p;if(!h||m.id===h.id)return;let b=e.findIndex(x=>x.title===m.id),g=e.findIndex(x=>x.title===h.id);if(b===-1||g===-1)return;let y=[...e],[S]=y.splice(b,1);y.splice(g,0,S);for(let x=0;x{dt("customPromptsFolder",p),uce()},placeholder:"copilot-custom-prompts"}),it.default.createElement(hn,{type:"switch",title:"Custom Prompt Templating",description:"Process variables like {activenote}, {foldername}, or {#tag} in prompts. Disable for raw prompts.",checked:o.enableCustomPromptTemplating,onCheckedChange:p=>{dt("enableCustomPromptTemplating",p)}}),it.default.createElement(hn,{type:"select",title:"Custom Prompts Sort Strategy",description:"Sort order for slash command menu prompts",value:o.promptSortStrategy,onChange:p=>dt("promptSortStrategy",p),options:[{label:"Recency",value:"timestamp"},{label:"Alphabetical",value:"alphabetical"},{label:"Manual",value:"manual"}]}),it.default.createElement("div",{className:"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"},it.default.createElement(eO,{className:"tw-size-5"})," ",it.default.createElement("div",null,"Commands are automatically loaded from .md files in your custom prompts folder"," ",it.default.createElement("strong",null,o.customPromptsFolder),". Modifying the files will also update the command settings.")),it.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},it.default.createElement(V9,{sensors:i,collisionDetection:z9,onDragEnd:d},it.default.createElement(j9,null,it.default.createElement(N9,null,it.default.createElement(BM,null,it.default.createElement(ap,{className:"tw-w-10"}),it.default.createElement(ap,null,"Name"),it.default.createElement(ap,{className:"tw-w-24 tw-text-center"},it.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"In Menu",it.default.createElement(vo,null,it.default.createElement(Rt,null,it.default.createElement(jt,{asChild:!0},it.default.createElement(f_,{className:"tw-size-4"})),it.default.createElement(Mt,{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."))))),it.default.createElement(ap,{className:"tw-w-28 tw-text-center"},it.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"Slash Cmd",it.default.createElement(vo,null,it.default.createElement(Rt,null,it.default.createElement(jt,{asChild:!0},it.default.createElement(f_,{className:"tw-size-4"})),it.default.createElement(Mt,{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available as a slash command in the chat."))))),it.default.createElement(ap,{className:"tw-w-32 tw-text-center"},"Actions"))),it.default.createElement(K9,{items:e.map(p=>p.title),strategy:W9},it.default.createElement(D9,null,e.length===0?it.default.createElement(BM,null,it.default.createElement(gf,{colSpan:5,className:"tw-py-8 tw-text-center tw-text-muted"},"No custom prompt files found.")):e.map(p=>it.default.createElement(MRn,{key:p.title,command:p,commands:e,onUpdate:l,onRemove:c})))))),it.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-between"},it.default.createElement("div",null,it.default.createElement(ge,{variant:"secondary",onClick:()=>new sd(app,Cqe,"This will add default commands to your custom prompts folder. Do you want to continue?","Generate Default Commands").open()},"Generate Default Commands")),it.default.createElement(mde,null,it.default.createElement(hde,{asChild:!0},it.default.createElement(ge,{variant:"default",className:"tw-gap-2"},it.default.createElement(Mm,{className:"tw-size-4"}),"Add Command")),it.default.createElement(p9,{container:f,className:"tw-w-80",align:"end"},it.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},it.default.createElement("div",{className:"tw-space-y-2"},it.default.createElement("div",{className:"tw-text-lg tw-font-medium tw-leading-none"},"Create New Command"),it.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Enter a name for your new custom command. A markdown file will be created in your custom prompts folder.")),it.default.createElement("div",{className:"tw-space-y-2"},it.default.createElement(mo,{placeholder:"Command name",value:r,onChange:p=>n(p.target.value),onKeyDown:p=>{p.key==="Enter"&&s&&u()}}),a&&it.default.createElement("p",{className:"tw-text-sm tw-text-error"},a)),it.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},it.default.createElement(O$e,{asChild:!0},it.default.createElement(ge,{variant:"secondary",size:"sm",onClick:()=>{n("")}},"Cancel")),it.default.createElement(O$e,{asChild:!0},it.default.createElement(ge,{size:"sm",onClick:u,disabled:!s},"Create"))))))))))};yn();var Bn=F(X());nr();var PL=F(X()),PYt=()=>{let t=Rn();return PL.default.createElement("div",{className:"tw-space-y-4"},PL.default.createElement("section",null,PL.default.createElement(hn,{type:"textarea",title:"User System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!",value:t.userSystemPrompt,onChange:e=>dt("userSystemPrompt",e),placeholder:"Enter your system prompt here..."}),PL.default.createElement("div",{className:"tw-space-y-4"},PL.default.createElement(hn,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:e=>{dt("enableEncryption",e)}}),PL.default.createElement(hn,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:e=>{dt("debug",e)}}))))};Fd();var Qz=class extends sd{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")}};ti();$r();nO();Ix();nr();var _l=F(X()),EYt=require("obsidian"),TYt=F(Dc());ti();nO();nr();yn();function RRn({onConfirm:t,onCancel:e}){let r=ue();return _l.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},_l.default.createElement("div",null,_l.default.createElement("p",null,"Thanks for purchasing ",_l.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!"),_l.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),_l.default.createElement("ul",{className:"tw-pl-4"},_l.default.createElement("li",null,"Default mode: ",_l.default.createElement("b",{className:"tw-text-accent"},"Copilot Plus")),_l.default.createElement("li",null,"Chat model: ",_l.default.createElement("b",{className:"tw-text-accent"},zRe)),_l.default.createElement("li",null,_l.default.createElement("div",null,"Embedding model:"," ",_l.default.createElement("b",{className:"tw-text-accent"},HRe)),r.embeddingModelKey!==VRe&&_l.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-warning"},_l.default.createElement(Uf,{className:"tw-size-4"})," It will rebuild your embeddings for the entire vault")))),_l.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},_l.default.createElement(ge,{variant:"ghost",onClick:e},"Apply Later"),_l.default.createElement(ge,{variant:"default",onClick:t},"Apply Now")))}var Pfe=class extends EYt.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,TYt.createRoot)(e);let r=()=>{p1t(),this.close()},n=()=>{this.close()};this.root.render(_l.default.createElement(RRn,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};ti();$r();nO();nr();yn();var ks=F(X());function AYt(){let t=Rn(),[e,r]=(0,ks.useState)(null),[n,o]=(0,ks.useState)(!1),i=Sq(),[a,s]=(0,ks.useState)(t.plusLicenseKey);return(0,ks.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),ks.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4 tw-rounded-lg tw-bg-secondary tw-p-4"},ks.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-text-xl tw-font-bold"},ks.default.createElement("span",null,"Copilot Plus (beta)"),i&&ks.default.createElement(cm,{variant:"outline",className:"tw-text-success"},"Active")),ks.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-sm tw-text-muted"},ks.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."),ks.default.createElement("div",null,"Currently in beta, Copilot Plus is evolving fast, with new features and improvements rolling out regularly. Join now to secure the lowest price and get early access!")),ks.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ks.default.createElement(iC,{className:"tw-w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),ks.default.createElement(ge,{disabled:n,onClick:async()=>{dt("plusLicenseKey",a),o(!0);let u=await iie();o(!1),u?(r(null),new Pfe(app).open()):r("Invalid license key")},className:"tw-min-w-20"},n?ks.default.createElement(Yl,{className:"tw-size-4 tw-animate-spin"}):"Apply"),ks.default.createElement(ge,{variant:"secondary",onClick:()=>p1(LC.SETTINGS)},"Join Now ",ks.default.createElement(s1,{className:"tw-size-4"}))),ks.default.createElement("div",{className:"tw-text-error"},e))}Cn();yn();var e2=require("obsidian"),Ge=F(X());ti();$r();BR();yo();nr();$r();var jRn={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"}))||[]},NRn=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})):[],DRn=t=>jRn[t]||NRn(t),IYt=(t,e)=>{let r=DRn(t);try{return r(e)}catch(n){return console.error(`Error parsing ${t} model data:`,n),[]}};Cn();yn();var Db=require("obsidian"),Ht=F(X()),MYt=F(Dc());function LRn({onClose:t}){let e=Rn(),[r,n]=(0,Ht.useState)(new Set),[o,i]=(0,Ht.useState)(new Set),[a,s]=(0,Ht.useState)(null),[u,l]=(0,Ht.useState)({}),[c,d]=(0,Ht.useState)(null),[f,p]=(0,Ht.useState)(null),[m,h]=(0,Ht.useState)(null),[b,g]=(0,Ht.useState)(!1),y=(0,Ht.useRef)(o);(0,Ht.useEffect)(()=>{y.current=o},[o]),(0,Ht.useEffect)(()=>(i(new Set),s(null),h(null),()=>{y.current.forEach(I=>{let R=Qb[I];dt(R,"")})}),[]);let S=I=>{let R=Qb[I];return e[R]??""},x=ege().map(I=>{let R=I,N=S(R);return{provider:R,apiKey:N,isVerified:!!N&&!o.has(R)}}),O=(I,R)=>{S(I)!==R&&(dt(Qb[I],R),i(j=>new Set(j).add(I)),l(j=>({...j,[I]:void 0})),p(j=>j===I?null:j))},P=async(I,R)=>{n(N=>new Set(N).add(I));try{ie(`Verifying ${I} API key`);let N=Xb(I).testModel;if(!N){new Db.Notice("API key verification failed: No default test model found for the selected provider.",1e4);return}let j={name:N,provider:I,apiKey:R,enabled:!0};await ac.instance.getCurrentChainManager().chatModelManager.ping(j),new Db.Notice("API key verified successfully!"),i($=>{let k=new Set($);return k.delete(I),k})}catch(N){console.error("API key verification failed:",N),new Db.Notice("API key verification failed: "+ei(N),1e4)}finally{n(N=>{let j=new Set(N);return j.delete(I),j})}},E=async(I,R)=>{d(I),p(null);try{R=await eo(R);let N=Xb(I).listModelURL,j={Authorization:`Bearer ${R}`};I==="google"?(N+=`?key=${R}`,j={}):I==="anthropic"&&(j={"x-api-key":R,"anthropic-version":"2023-06-01"});let $=async Q=>{let J=new AbortController,D=setTimeout(()=>J.abort(),3e3);try{let B=await(Q?Us:fetch)(N,{headers:j,signal:J.signal,method:"GET"});if(!B.ok){let q=ei(await B.json());throw fe(q),new Error(`Failed to fetch models: ${B.statusText} +We found ${r.length} unsupported commands. They are saved in ${QI()}/unsupported. To fix them, please resolve the errors and move the note file out of the unsupported folder.`),dt("inlineEditCommands",[]),new sd(app,()=>{},i,"\u{1F680} New Copilot Custom Commands","OK","").open()}async function Pqe(){let t=Jx(),e=I3t.filter(n=>!t.some(o=>o.title===n.title)),r=[...t,...e];lm.getInstance().updateCommands(r)}async function AYt(){if(ue().suggestedDefaultCommands)return;Jx().length===0&&(new sd(app,()=>{Pqe()},"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(),dt("suggestedDefaultCommands",!0))}var LRn=({command:t,commands:e,onUpdate:r,onRemove:n})=>{let{attributes:o,listeners:i,setNodeRef:a,transform:s,transition:u,isDragging:l}=J9({id:t.title}),c={transform:Rb.Transform.toString(s),transition:u},d=()=>{n(t)};return it.default.createElement(BM,{ref:a,style:c,className:_e("tw-transition-colors",l&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50")},it.default.createElement(gf,{className:"tw-w-10"},it.default.createElement("div",{...o,...i,className:"tw-flex tw-cursor-grab tw-items-center tw-justify-center"},it.default.createElement(d_,{className:"tw-size-4"}))),it.default.createElement(gf,null,t.title),it.default.createElement(gf,{className:"tw-text-center"},it.default.createElement(wd,{checked:t.showInContextMenu,onCheckedChange:f=>{r({...t,showInContextMenu:f===!0},t.title)},className:"tw-mx-auto"})),it.default.createElement(gf,{className:"tw-text-center"},it.default.createElement(wd,{checked:t.showInSlashMenu,onCheckedChange:f=>r({...t,showInSlashMenu:f===!0},t.title),className:"tw-mx-auto"})),it.default.createElement(gf,{className:"tw-text-center"},it.default.createElement("div",{className:"tw-flex tw-justify-center tw-space-x-1"},it.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>{new Ofe(app,e,t,async p=>{await r(p,t.title)}).open()}},it.default.createElement(p_,{className:"tw-size-4"})),it.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>{new sd(app,d,`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()}},it.default.createElement(Rm,{className:"tw-size-4"})))))},IYt=()=>{let t=M3t(),e=(0,it.useMemo)(()=>IW([...t]),[t]),[r,n]=it.default.useState(""),o=Rn(),i=gfe(Xz(VM,{activationConstraint:{distance:8}}),Xz(HM,{coordinateGetter:xfe})),a=JU(r,e),s=!a&&r.trim()!=="",u=async()=>{if(s)try{await lm.getInstance().createCommand(r.trim(),""),n(""),new rK.Notice(`Command "${r.trim()}" created successfully!`)}catch(p){console.error("Failed to create command:",p),new rK.Notice("Failed to create command. Please try again.")}},l=async(p,m)=>{await lm.getInstance().updateCommand(p,m)},c=async p=>{try{await lm.getInstance().deleteCommand(p),new rK.Notice(`Command "${p.title}" deleted successfully!`)}catch(m){throw console.error("Failed to delete command:",m),new rK.Notice("Failed to delete command. Please try again."),m}},d=async p=>{let{active:m,over:h}=p;if(!h||m.id===h.id)return;let b=e.findIndex(x=>x.title===m.id),g=e.findIndex(x=>x.title===h.id);if(b===-1||g===-1)return;let y=[...e],[S]=y.splice(b,1);y.splice(g,0,S);for(let x=0;x{dt("customPromptsFolder",p),dce()},placeholder:"copilot-custom-prompts"}),it.default.createElement(hn,{type:"switch",title:"Custom Prompt Templating",description:"Process variables like {activenote}, {foldername}, or {#tag} in prompts. Disable for raw prompts.",checked:o.enableCustomPromptTemplating,onCheckedChange:p=>{dt("enableCustomPromptTemplating",p)}}),it.default.createElement(hn,{type:"select",title:"Custom Prompts Sort Strategy",description:"Sort order for slash command menu prompts",value:o.promptSortStrategy,onChange:p=>dt("promptSortStrategy",p),options:[{label:"Recency",value:"timestamp"},{label:"Alphabetical",value:"alphabetical"},{label:"Manual",value:"manual"}]}),it.default.createElement("div",{className:"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"},it.default.createElement(tO,{className:"tw-size-5"})," ",it.default.createElement("div",null,"Commands are automatically loaded from .md files in your custom prompts folder"," ",it.default.createElement("strong",null,o.customPromptsFolder),". Modifying the files will also update the command settings.")),it.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},it.default.createElement(W9,{sensors:i,collisionDetection:H9,onDragEnd:d},it.default.createElement(N9,null,it.default.createElement(D9,null,it.default.createElement(BM,null,it.default.createElement(ap,{className:"tw-w-10"}),it.default.createElement(ap,null,"Name"),it.default.createElement(ap,{className:"tw-w-24 tw-text-center"},it.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"In Menu",it.default.createElement(vo,null,it.default.createElement(Rt,null,it.default.createElement(jt,{asChild:!0},it.default.createElement(f_,{className:"tw-size-4"})),it.default.createElement(Mt,{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."))))),it.default.createElement(ap,{className:"tw-w-28 tw-text-center"},it.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"Slash Cmd",it.default.createElement(vo,null,it.default.createElement(Rt,null,it.default.createElement(jt,{asChild:!0},it.default.createElement(f_,{className:"tw-size-4"})),it.default.createElement(Mt,{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available as a slash command in the chat."))))),it.default.createElement(ap,{className:"tw-w-32 tw-text-center"},"Actions"))),it.default.createElement(G9,{items:e.map(p=>p.title),strategy:K9},it.default.createElement(L9,null,e.length===0?it.default.createElement(BM,null,it.default.createElement(gf,{colSpan:5,className:"tw-py-8 tw-text-center tw-text-muted"},"No custom prompt files found.")):e.map(p=>it.default.createElement(LRn,{key:p.title,command:p,commands:e,onUpdate:l,onRemove:c})))))),it.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-between"},it.default.createElement("div",null,it.default.createElement(ge,{variant:"secondary",onClick:()=>new sd(app,Pqe,"This will add default commands to your custom prompts folder. Do you want to continue?","Generate Default Commands").open()},"Generate Default Commands")),it.default.createElement(yde,null,it.default.createElement(bde,{asChild:!0},it.default.createElement(ge,{variant:"default",className:"tw-gap-2"},it.default.createElement(Mm,{className:"tw-size-4"}),"Add Command")),it.default.createElement(m9,{container:f,className:"tw-w-80",align:"end"},it.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},it.default.createElement("div",{className:"tw-space-y-2"},it.default.createElement("div",{className:"tw-text-lg tw-font-medium tw-leading-none"},"Create New Command"),it.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Enter a name for your new custom command. A markdown file will be created in your custom prompts folder.")),it.default.createElement("div",{className:"tw-space-y-2"},it.default.createElement(mo,{placeholder:"Command name",value:r,onChange:p=>n(p.target.value),onKeyDown:p=>{p.key==="Enter"&&s&&u()}}),a&&it.default.createElement("p",{className:"tw-text-sm tw-text-error"},a)),it.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},it.default.createElement(E$e,{asChild:!0},it.default.createElement(ge,{variant:"secondary",size:"sm",onClick:()=>{n("")}},"Cancel")),it.default.createElement(E$e,{asChild:!0},it.default.createElement(ge,{size:"sm",onClick:u,disabled:!s},"Create"))))))))))};bn();var Bn=F(X());nr();var EL=F(X()),MYt=()=>{let t=Rn();return EL.default.createElement("div",{className:"tw-space-y-4"},EL.default.createElement("section",null,EL.default.createElement(hn,{type:"textarea",title:"User System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!",value:t.userSystemPrompt,onChange:e=>dt("userSystemPrompt",e),placeholder:"Enter your system prompt here..."}),EL.default.createElement("div",{className:"tw-space-y-4"},EL.default.createElement(hn,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:e=>{dt("enableEncryption",e)}}),EL.default.createElement(hn,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:e=>{dt("debug",e)}}))))};Fd();var e2=class extends sd{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")}};ti();$r();oO();Mx();nr();var _l=F(X()),RYt=require("obsidian"),jYt=F(Dc());ti();oO();nr();bn();function FRn({onConfirm:t,onCancel:e}){let r=ue();return _l.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},_l.default.createElement("div",null,_l.default.createElement("p",null,"Thanks for purchasing ",_l.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!"),_l.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),_l.default.createElement("ul",{className:"tw-pl-4"},_l.default.createElement("li",null,"Default mode: ",_l.default.createElement("b",{className:"tw-text-accent"},"Copilot Plus")),_l.default.createElement("li",null,"Chat model: ",_l.default.createElement("b",{className:"tw-text-accent"},VRe)),_l.default.createElement("li",null,_l.default.createElement("div",null,"Embedding model:"," ",_l.default.createElement("b",{className:"tw-text-accent"},WRe)),r.embeddingModelKey!==KRe&&_l.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-warning"},_l.default.createElement(Uf,{className:"tw-size-4"})," It will rebuild your embeddings for the entire vault")))),_l.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},_l.default.createElement(ge,{variant:"ghost",onClick:e},"Apply Later"),_l.default.createElement(ge,{variant:"default",onClick:t},"Apply Now")))}var Afe=class extends RYt.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,jYt.createRoot)(e);let r=()=>{b1t(),this.close()},n=()=>{this.close()};this.root.render(_l.default.createElement(FRn,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};ti();$r();oO();nr();bn();var ks=F(X());function NYt(){let t=Rn(),[e,r]=(0,ks.useState)(null),[n,o]=(0,ks.useState)(!1),i=xq(),[a,s]=(0,ks.useState)(t.plusLicenseKey);return(0,ks.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),ks.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4 tw-rounded-lg tw-bg-secondary tw-p-4"},ks.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-text-xl tw-font-bold"},ks.default.createElement("span",null,"Copilot Plus (beta)"),i&&ks.default.createElement(cm,{variant:"outline",className:"tw-text-success"},"Active")),ks.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-sm tw-text-muted"},ks.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."),ks.default.createElement("div",null,"Currently in beta, Copilot Plus is evolving fast, with new features and improvements rolling out regularly. Join now to secure the lowest price and get early access!")),ks.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ks.default.createElement(aC,{className:"tw-w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),ks.default.createElement(ge,{disabled:n,onClick:async()=>{dt("plusLicenseKey",a),o(!0);let u=await uie();o(!1),u?(r(null),new Afe(app).open()):r("Invalid license key")},className:"tw-min-w-20"},n?ks.default.createElement(Yl,{className:"tw-size-4 tw-animate-spin"}):"Apply"),ks.default.createElement(ge,{variant:"secondary",onClick:()=>m1(FC.SETTINGS)},"Join Now ",ks.default.createElement(u1,{className:"tw-size-4"}))),ks.default.createElement("div",{className:"tw-text-error"},e))}yn();bn();var t2=require("obsidian"),Ge=F(X());ti();$r();qR();yo();nr();$r();var kRn={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"}))||[]},$Rn=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})):[],BRn=t=>kRn[t]||$Rn(t),DYt=(t,e)=>{let r=BRn(t);try{return r(e)}catch(n){return console.error(`Error parsing ${t} model data:`,n),[]}};yn();bn();var Db=require("obsidian"),Ht=F(X()),LYt=F(Dc());function qRn({onClose:t}){let e=Rn(),[r,n]=(0,Ht.useState)(new Set),[o,i]=(0,Ht.useState)(new Set),[a,s]=(0,Ht.useState)(null),[u,l]=(0,Ht.useState)({}),[c,d]=(0,Ht.useState)(null),[f,p]=(0,Ht.useState)(null),[m,h]=(0,Ht.useState)(null),[b,g]=(0,Ht.useState)(!1),y=(0,Ht.useRef)(o);(0,Ht.useEffect)(()=>{y.current=o},[o]),(0,Ht.useEffect)(()=>(i(new Set),s(null),h(null),()=>{y.current.forEach(I=>{let R=Qb[I];dt(R,"")})}),[]);let S=I=>{let R=Qb[I];return e[R]??""},x=nge().map(I=>{let R=I,N=S(R);return{provider:R,apiKey:N,isVerified:!!N&&!o.has(R)}}),O=(I,R)=>{S(I)!==R&&(dt(Qb[I],R),i(j=>new Set(j).add(I)),l(j=>({...j,[I]:void 0})),p(j=>j===I?null:j))},P=async(I,R)=>{n(N=>new Set(N).add(I));try{ie(`Verifying ${I} API key`);let N=Xb(I).testModel;if(!N){new Db.Notice("API key verification failed: No default test model found for the selected provider.",1e4);return}let j={name:N,provider:I,apiKey:R,enabled:!0};await ac.instance.getCurrentChainManager().chatModelManager.ping(j),new Db.Notice("API key verified successfully!"),i($=>{let k=new Set($);return k.delete(I),k})}catch(N){console.error("API key verification failed:",N),new Db.Notice("API key verification failed: "+ei(N),1e4)}finally{n(N=>{let j=new Set(N);return j.delete(I),j})}},E=async(I,R)=>{d(I),p(null);try{R=await eo(R);let N=Xb(I).listModelURL,j={Authorization:`Bearer ${R}`};I==="google"?(N+=`?key=${R}`,j={}):I==="anthropic"&&(j={"x-api-key":R,"anthropic-version":"2023-06-01"});let $=async Q=>{let J=new AbortController,D=setTimeout(()=>J.abort(),3e3);try{let B=await(Q?Us:fetch)(N,{headers:j,signal:J.signal,method:"GET"});if(!B.ok){let q=ei(await B.json());throw fe(q),new Error(`Failed to fetch models: ${B.statusText} detail: `+q)}return B}finally{clearTimeout(D)}},k;try{k=await $(!1)}catch(Q){console.log("First fetch attempt failed, trying with safeFetch...");try{k=await $(!0)}catch(J){let D=` without CORS Error: `+ei(Q)+` -with CORS Error: `+ei(J);throw new Error(D)}}let z=await k.json(),V=IYt(I,z);l(Q=>({...Q,[I]:V})),d(null)}catch(N){console.error(`Error fetching models for ${I}:`,N),p(I),d(null),new Db.Notice(`Failed to load models for ${kf(I)}: ${ei(N)}`,5e3)}},A=async()=>{if(!m){new Db.Notice("Please select a model first");return}g(!0);try{let I=S(m.provider),R={name:m.name,provider:m.provider,apiKey:I,enabled:!0};if(await ac.instance.getCurrentChainManager().chatModelManager.ping(R),e.activeModels.find(j=>j.name===m.name&&j.provider===m.provider))new Db.Notice(`Model ${m.name} verified successfully! It already exists in your models list.`);else{let j=[...e.activeModels,R];dt("activeModels",j),new Db.Notice(`Model ${m.name} verified successfully and added to your models list!`)}}catch(I){console.error("Model verification failed:",I),new Db.Notice("Model verification failed: "+ei(I),1e4)}finally{g(!1)}};return Ht.default.createElement("div",{className:"tw-max-h-[600px] tw-overflow-y-auto tw-p-4 sm:tw-max-w-[500px]"},Ht.default.createElement("div",{className:"tw-mb-4"},Ht.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"AI Provider Settings"),Ht.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Configure your AI providers by adding their API keys.")),Ht.default.createElement("div",{className:"tw-space-y-6 tw-py-4"},Ht.default.createElement("div",{className:"tw-space-y-4"},x.map(I=>Ht.default.createElement(Ht.default.Fragment,{key:I.provider},Ht.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ht.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},Ht.default.createElement("div",{className:"tw-truncate"},kf(I.provider))),Ht.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},Ht.default.createElement("div",{className:"tw-flex-1"},Ht.default.createElement(iC,{className:"tw-max-w-full",value:I.apiKey,onChange:R=>O(I.provider,R),disabled:r.has(I.provider)})),Ht.default.createElement("div",{className:"tw-w-[72px]"},I.isVerified?Ht.default.createElement("span",{className:"tw-flex tw-h-9 tw-items-center tw-justify-center tw-text-sm tw-text-success"},"Verified"):Ht.default.createElement(ge,{onClick:()=>P(I.provider,I.apiKey),disabled:!I.apiKey||r.size>0,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},r.has(I.provider)?Ht.default.createElement(Yl,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Verify")),Ht.default.createElement("div",{className:""},Ht.default.createElement(ge,{onClick:()=>{let R=a===I.provider?null:I.provider;s(R),R&&I.apiKey&&u[I.provider]===void 0&&c!==I.provider&&f!==I.provider&&E(I.provider,I.apiKey)},disabled:!I.apiKey||r.size>0,variant:"secondary",size:"sm",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-1 tw-whitespace-nowrap tw-p-0.5"},"Add Model",a===I.provider?Ht.default.createElement(Ey,{className:"tw-ml-1 tw-size-4"}):Ht.default.createElement(Hi,{className:"tw-ml-1 tw-size-4"})))),Ht.default.createElement("div",null,Xb(I.provider).keyManagementURL&&Ht.default.createElement("a",{href:Xb(I.provider).keyManagementURL,target:"_blank",rel:"noopener noreferrer",className:"tw-text-[10px] tw-text-accent hover:tw-text-accent-hover sm:tw-text-xs"},"Get ",kf(I.provider)," Key"))),Ht.default.createElement(cE,{open:a===I.provider,className:"tw-mt-2"},Ht.default.createElement(dE,{className:"tw-rounded-md tw-p-3"},Ht.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ht.default.createElement(Yn,{label:"Model",description:"Add the currently selected model to model List. After adding, please check the Model Tab."},Ht.default.createElement("div",null,Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ht.default.createElement("div",{className:"tw-flex-1"},Ht.default.createElement(zde,{options:u[I.provider]?.sort((R,N)=>R.name.localeCompare(N.name)).map(R=>({label:R.name,value:R.id}))||[],onChange:R=>{let N=R.target.value,j=u[I.provider]?.find($=>$.id===N);j&&h({id:j.id,name:j.name,provider:I.provider})},onClick:()=>{I.apiKey&&u[I.provider]===void 0&&c!==I.provider&&f!==I.provider&&E(I.provider,I.apiKey)},value:m?.provider===I.provider?m.id:"",placeholder:"Select Model",disabled:!I.apiKey||c===I.provider||f===I.provider&&u[I.provider]!==null})),Ht.default.createElement("div",{className:"tw-w-[72px]"},Ht.default.createElement(ge,{onClick:A,disabled:!m||m.provider!==I.provider||b,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},b?Ht.default.createElement(Yl,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Add"))),Ht.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},c===I.provider&&Ht.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),f===I.provider&&Ht.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed to load models.",u[I.provider]===null&&" Check API Key or network."),u[I.provider]&&u[I.provider].length===0&&Ht.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models available for this provider."),u[I.provider]===void 0&&f!==I.provider&&c!==I.provider&&Ht.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Click to load models or expand to try again if API key was changed."))))))))))),Ht.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end"},Ht.default.createElement(ge,{onClick:t},"Close")))}var Efe=class extends Db.Modal{constructor(e){super(e)}onOpen(){let{contentEl:e}=this;this.root=(0,MYt.createRoot)(e),this.root.render(Ht.default.createElement(LRn,{onClose:()=>this.close()}))}onClose(){this.root.unmount()}};Tn();var kRn={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus (beta)",project:"Projects (alpha)"},RYt=()=>{let t=Rn(),[e,r]=(0,Ge.useState)(!1),[n,o]=(0,Ge.useState)(t.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),i=async l=>{l!==t.embeddingModelKey&&new Qz(app,async()=>{dt("embeddingModelKey",l),await ma.getInstance().indexVaultToVectorStore(!0)}).open()},a=()=>{r(!0);try{let l=n||"{$date}_{$time}__{$topic}",d=["{$date}","{$time}","{$topic}"].filter(g=>!l.includes(g));if(d.length>0){new e2.Notice(`Error: Missing required variables: ${d.join(", ")}`,4e3);return}let f=/[\\/:*?"<>|]/,p=l.replace(/\{\$date}/g,"").replace(/\{\$time}/g,"").replace(/\{\$topic}/g,"");if(f.test(p)){new e2.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:m}=Vl(new Date),b=l.replace("{$topic}","test topic name".slice(0,100).replace(/\s+/g,"_")).replace("{$date}",m.split("_")[0]).replace("{$time}",m.split("_")[1]);dt("defaultConversationNoteName",l),o(l),new e2.Notice(`Format applied successfully! Example: ${b}`,4e3)}catch(l){new e2.Notice(`Error applying format: ${l.message}`,4e3)}finally{r(!1)}},s=!!t.activeModels.find(l=>l.enabled&&kr(l)===t.defaultModelKey),u=t.activeModels.filter(l=>l.enabled).map(l=>({label:QW(l),value:kr(l)}));return Ge.default.createElement("div",{className:"tw-space-y-4"},Ge.default.createElement(AYt,null),Ge.default.createElement("section",null,Ge.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"General"),Ge.default.createElement("div",{className:"tw-space-y-4"},Ge.default.createElement("div",{className:"tw-space-y-4"},Ge.default.createElement(hn,{type:"custom",title:"API Keys",description:Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ge.default.createElement("span",{className:"tw-leading-none"},"Configure API keys for different AI providers"),Ge.default.createElement(vo,{delayDuration:0},Ge.default.createElement(Rt,null,Ge.default.createElement(jt,{asChild:!0},Ge.default.createElement(di,{className:"tw-size-4"})),Ge.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},Ge.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"API key required for chat and QA features"),Ge.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.")))))},Ge.default.createElement(ge,{onClick:()=>{new Efe(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",Ge.default.createElement(P3,{className:"tw-size-4"})))),Ge.default.createElement(hn,{type:"select",title:"Default Chat Model",description:"Select the Chat model to use",value:s?t.defaultModelKey:"Select Model",onChange:l=>{let c=t.activeModels.find(p=>p.enabled&&kr(p)===l);if(!c)return;let{hasApiKey:d,errorNotice:f}=mF(c,t);if(!d&&f){new e2.Notice(f);return}dt("defaultModelKey",l)},options:s?u:[{label:"Select Model",value:"Select Model"},...u],placeholder:"Model"}),Ge.default.createElement(hn,{type:"select",title:"Embedding Model",description:Ge.default.createElement("div",{className:"tw-space-y-2"},Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ge.default.createElement("span",{className:"tw-font-medium tw-leading-none tw-text-accent"},"Core Feature: Powers Semantic Search & QA"),Ge.default.createElement(vo,{delayDuration:0},Ge.default.createElement(Rt,null,Ge.default.createElement(jt,{asChild:!0},Ge.default.createElement(di,{className:"tw-size-4"})),Ge.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Ge.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 QA functionality. Changing the embedding model will:"),Ge.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Ge.default.createElement("li",null,"Require rebuilding your vault's vector index"),Ge.default.createElement("li",null,"Affect semantic search quality"),Ge.default.createElement("li",null,"Impact QA feature performance"))))))),value:t.embeddingModelKey,onChange:i,options:t.activeEmbeddingModels.map(l=>({label:QW(l),value:kr(l)})),placeholder:"Model"}),Ge.default.createElement(hn,{type:"select",title:"Default Mode",description:Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ge.default.createElement("span",{className:"tw-leading-none"},"Select the default chat mode"),Ge.default.createElement(vo,{delayDuration:0},Ge.default.createElement(Rt,null,Ge.default.createElement(jt,{asChild:!0},Ge.default.createElement(di,{className:"tw-size-4"})),Ge.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Ge.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",Ge.default.createElement("i",null,"Free to use with your own API key.")),Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",Ge.default.createElement("i",null,"Free to use with your own API key.")),Ge.default.createElement("li",null,Ge.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"," ",Ge.default.createElement("a",{href:WRe(LC.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:l=>dt("defaultChainType",l),options:Object.entries(kRn).map(([l,c])=>({label:c,value:l}))}),Ge.default.createElement(hn,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:l=>dt("defaultOpenArea",l),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),Ge.default.createElement(hn,{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:l=>dt("defaultSaveFolder",l),placeholder:"copilot-conversations"}),Ge.default.createElement(hn,{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:l=>dt("defaultConversationTag",l),placeholder:"ai-conversations"}),Ge.default.createElement(hn,{type:"custom",title:"Conversation Filename Template",description:Ge.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-1.5 "},Ge.default.createElement("span",{className:"tw-leading-none"},"Customize the format of saved conversation note names."),Ge.default.createElement(vo,{delayDuration:0},Ge.default.createElement(Rt,null,Ge.default.createElement(jt,{asChild:!0},Ge.default.createElement(di,{className:"tw-size-4"})),Ge.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},Ge.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Note: All the following variables must be included in the template."),Ge.default.createElement("div",null,Ge.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-muted"},"Available variables:"),Ge.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),Ge.default.createElement("i",{className:"tw-mt-2 tw-text-sm tw-text-muted"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]"))))))},Ge.default.createElement("div",{className:"tw-flex tw-w-[320px] tw-items-center tw-gap-1.5"},Ge.default.createElement(mo,{type:"text",className:_e("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:l=>o(l.target.value),disabled:e}),Ge.default.createElement(ge,{onClick:()=>a(),disabled:e,variant:"secondary"},e?Ge.default.createElement(Ge.default.Fragment,null,Ge.default.createElement(Yl,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Apply"):"Apply"))),Ge.default.createElement(hn,{type:"switch",title:"Autosave Chat",description:"Automatically saves the chat after every user message and AI response.",checked:t.autosaveChat,onCheckedChange:l=>dt("autosaveChat",l)}),Ge.default.createElement(hn,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:l=>dt("showSuggestedPrompts",l)}),Ge.default.createElement(hn,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:l=>dt("showRelevantNotes",l)}))))};ti();$r();Tn();nr();yn();var EL=require("obsidian"),Zn=F(X()),jYt=()=>{let t=Rn(),e=t.autocompleteAcceptKey||Nh.KEYBIND,[r,n]=(0,Zn.useState)(!1),o=[{value:"Tab",label:"Tab"},{value:"Space",label:"Space"},{value:"ArrowRight",label:"Right Arrow"}],i=u=>{dt("autocompleteAcceptKey",u),new EL.Notice(`Autocomplete accept key set to: ${u}`)},a=()=>{dt("autocompleteAcceptKey",Nh.KEYBIND),new EL.Notice(`Autocomplete accept key reset to: ${Nh.KEYBIND}`)},s=async()=>{if(!r){n(!0),new EL.Notice("Rebuilding word index...");try{let l=await TD.getInstance(app.vault).rescan(c=>{c.processedFiles===c.totalFiles&&new EL.Notice(`Word index complete! Found ${c.foundWords} words from ${c.processedFiles} files.`)});new EL.Notice(`Word index rebuilt successfully! ${l.wordCount} unique words indexed.`)}catch(u){console.error("Failed to refresh word index:",u),new EL.Notice("Failed to refresh word index. Check console for details.")}finally{n(!1)}}};return Zn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Zn.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4"},Zn.default.createElement("div",{className:"tw-flex tw-items-center tw-py-4"},Zn.default.createElement(cm,{variant:"secondary",className:"tw-text-accent"},"Plus Required")),Zn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Zn.default.createElement(hn,{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=>{dt("includeActiveNoteAsContext",u)}}),Zn.default.createElement(hn,{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=>{dt("passMarkdownImages",u)}}),Zn.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autocomplete"),Zn.default.createElement(hn,{type:"switch",title:"Sentence Autocomplete",description:Zn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Zn.default.createElement("span",{className:"tw-leading-none"},"Enable AI-powered sentence autocomplete suggestions while typing")),checked:t.enableAutocomplete,onCheckedChange:u=>dt("enableAutocomplete",u)}),Zn.default.createElement(hn,{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=>{dt("enableWordCompletion",u)}}),Zn.default.createElement(hn,{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."},Zn.default.createElement(ge,{onClick:s,disabled:r,className:"tw-flex tw-items-center tw-gap-2"},Zn.default.createElement(m_,{className:_e("tw-size-4",r&&"tw-animate-spin")}),r?"Rebuilding...":"Refresh Word Index")),Zn.default.createElement(hn,{type:"custom",title:"Autocomplete Accept Suggestion Key",description:Zn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Zn.default.createElement("span",{className:"tw-leading-none"},"The key used to accept autocomplete suggestions"),Zn.default.createElement(vo,{delayDuration:0},Zn.default.createElement(Rt,null,Zn.default.createElement(jt,{asChild:!0},Zn.default.createElement(di,{className:"tw-size-4"})),Zn.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Zn.default.createElement("div",{className:"tw-text-sm tw-text-muted"},'Select the key you want to use for accepting suggestions. Default is "Tab".')))))},Zn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Zn.default.createElement(zz,{value:e,onValueChange:i},Zn.default.createElement(dL,{className:"tw-w-[180px]"},Zn.default.createElement(Hz,{placeholder:"Select key"})),Zn.default.createElement(fL,null,o.map(u=>Zn.default.createElement(pL,{key:u.value,value:u.value},u.label)))),e&&e!==Nh.KEYBIND&&Zn.default.createElement(ge,{variant:"ghost",onClick:a,className:"tw-h-8 tw-text-xs"},"Reset to Default"))),Zn.default.createElement(hn,{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=>{dt("allowAdditionalContext",u)}}))))};$r();fN();yo();nr();var De=F(X());nr();$r();Cn();var rK=require("obsidian");ti();yn();var Oqe=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=Vz(),a=ue(),s=o?"openai":"openai",[u,l]=(0,De.useState)(null),[c,d]=(0,De.useState)(!1),[f,p]=(0,De.useState)(!1),[m,h]=(0,De.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1}),b=(D,B)=>{h(q=>({...q,[D]:B}))},g=()=>{h({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1})},y=()=>{let D=!0,B={...m};return B.name=!O.name,O.name||(D=!1),O.provider==="azure openai"&&(B.instanceName=!O.azureOpenAIApiInstanceName,B.apiVersion=!O.azureOpenAIApiVersion,o?(B.embeddingDeploymentName=!O.azureOpenAIApiEmbeddingDeploymentName,O.azureOpenAIApiEmbeddingDeploymentName||(D=!1)):(B.deploymentName=!O.azureOpenAIApiDeploymentName,O.azureOpenAIApiDeploymentName||(D=!1)),(!O.azureOpenAIApiInstanceName||!O.azureOpenAIApiVersion)&&(D=!1)),h(B),D},S=D=>a[Qb[D]]||"",x=(D=s)=>{let B={name:"",provider:D,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:S(D),isEmbeddingModel:o,capabilities:[]};return o?B:{...B,stream:!0}},[O,P]=(0,De.useState)(x()),E=D=>({...D,name:D.name?.trim(),baseUrl:D.baseUrl?.trim(),apiKey:D.apiKey?.trim(),openAIOrgId:D.openAIOrgId?.trim(),azureOpenAIApiInstanceName:D.azureOpenAIApiInstanceName?.trim(),azureOpenAIApiDeploymentName:D.azureOpenAIApiDeploymentName?.trim(),azureOpenAIApiEmbeddingDeploymentName:D.azureOpenAIApiEmbeddingDeploymentName?.trim(),azureOpenAIApiVersion:D.azureOpenAIApiVersion?.trim()}),[A,I]=(0,De.useState)(Xb(s)),R=()=>!!(O.name&&O.provider),N=()=>f||!R(),j=()=>{if(!y()){new rK.Notice("Please fill in all required fields");return}let D=E(O);r(D),e(!1),P(x()),g()},$=D=>{I(Xb(D)),P({...O,provider:D,apiKey:S(D),...D==="openai"?{openAIOrgId:a.openAIOrgId}:{},...D==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{}})},k=D=>{D||(P(x()),g(),d(!1)),e(D)},z=async()=>{if(!y()){new rK.Notice("Please fill in all required fields");return}p(!0);try{let D=E(O);await n(D),new rK.Notice("Model verification successful!")}catch(D){console.error(D);let B=ei(D);new rK.Notice("Model verification failed: "+B)}finally{p(!1)}},V=()=>{let B=(()=>{switch(O.provider){case"openai":return De.default.createElement(Yn,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},De.default.createElement(mo,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:O.openAIOrgId||"",onChange:q=>P({...O,openAIOrgId:q.target.value})}));case"azure openai":return De.default.createElement(De.default.Fragment,null,De.default.createElement(Yn,{label:"Instance Name",required:!0,error:m.instanceName,errorMessage:"Instance name is required"},De.default.createElement(mo,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:O.azureOpenAIApiInstanceName||"",onChange:q=>{P({...O,azureOpenAIApiInstanceName:q.target.value}),b("instanceName",!1)}})),o?De.default.createElement(Yn,{label:"Embedding Deployment Name",required:!0,error:m.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},De.default.createElement(mo,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:O.azureOpenAIApiEmbeddingDeploymentName||"",onChange:q=>{P({...O,azureOpenAIApiEmbeddingDeploymentName:q.target.value}),b("embeddingDeploymentName",!1)}})):De.default.createElement(Yn,{label:"Deployment Name",required:!0,error:m.deploymentName,errorMessage:"Deployment name is required",description:"This is your actual model, no need to pass a model name separately."},De.default.createElement(mo,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:O.azureOpenAIApiDeploymentName||"",onChange:q=>{P({...O,azureOpenAIApiDeploymentName:q.target.value}),b("deploymentName",!1)}})),De.default.createElement(Yn,{label:"API Version",required:!0,error:m.apiVersion,errorMessage:"API version is required"},De.default.createElement(mo,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:O.azureOpenAIApiVersion||"",onChange:q=>{P({...O,azureOpenAIApiVersion:q.target.value}),b("apiVersion",!1)}})));default:return null}})();return B?De.default.createElement(cE,{open:c,onOpenChange:d,className:"tw-space-y-2 tw-rounded-lg tw-border tw-pt-4"},De.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},De.default.createElement(ip,null,"Additional ",kf(O.provider)," Settings"),De.default.createElement(tL,{asChild:!0},De.default.createElement(ge,{variant:"ghost",size:"sm",className:"tw-w-9 tw-p-0"},De.default.createElement(Hi,{className:"tw-size-4"}),De.default.createElement("span",{className:"tw-sr-only"},"Toggle")))),De.default.createElement(dE,{className:"tw-max-h-[200px] tw-space-y-4 tw-overflow-y-auto tw-pb-0.5 tw-pl-0.5 tw-pr-2"},B)):null},Q=()=>{if(O.provider!=="azure openai")return A.host;let D=O.azureOpenAIApiInstanceName||"[instance]",B=o?O.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":O.azureOpenAIApiDeploymentName||"[deployment]",q=O.azureOpenAIApiVersion||"[api-version]";return`https://${D}.openai.azure.com/openai/deployments/${B}/${o?"embeddings":"chat/completions"}?api-version=${q}`},J=Object.entries(WE).map(([D,B])=>({id:D,label:D.charAt(0).toUpperCase()+D.slice(1),description:B}));return De.default.createElement(Ofe,{open:t,onOpenChange:k},De.default.createElement(Z9,{className:"sm:tw-max-w-[425px]",container:i,ref:D=>l(D)},De.default.createElement(X9,null,De.default.createElement(Q9,null,"Add Custom ",o?"Embedding":"Chat"," Model"),De.default.createElement(eK,null,"Add a new model to your collection.")),De.default.createElement("div",{className:"tw-space-y-3"},De.default.createElement(Yn,{label:"Model Name",required:!0,error:m.name,errorMessage:"Model name is required"},De.default.createElement(mo,{type:"text",placeholder:`Enter model name (e.g. ${o?"text-embedding-3-small":"gpt-4"})`,value:O.name,onChange:D=>{P({...O,name:D.target.value}),b("name",!1)}})),De.default.createElement(Yn,{label:De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},De.default.createElement("span",{className:"tw-leading-none"},"Display Name"),De.default.createElement(vo,{delayDuration:0},De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement(di,{className:"tw-size-4"})),De.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},De.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},De.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),De.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),De.default.createElement("div",{className:"tw-text-[12px]"},"Example:",De.default.createElement("li",null,"Direct-Paid:Ds-r1"),De.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),De.default.createElement("li",null,"Perplexity-Paid:lg")))))))},De.default.createElement(mo,{type:"text",placeholder:"Custom display name (optional)",value:O.displayName||"",onChange:D=>{P({...O,displayName:D.target.value})}})),De.default.createElement(Yn,{label:"Provider"},De.default.createElement(zz,{value:O.provider,onValueChange:$},De.default.createElement(dL,null,De.default.createElement(Hz,{placeholder:"Select provider"})),De.default.createElement(fL,{container:u},Object.values(o?u4(HE,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):u4(DC,["COPILOT_PLUS"])).map(D=>De.default.createElement(pL,{key:D,value:D},kf(D)))))),De.default.createElement(Yn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},De.default.createElement(mo,{type:"text",placeholder:Q()||"https://api.example.com/v1",value:O.baseUrl||"",onChange:D=>P({...O,baseUrl:D.target.value})})),De.default.createElement(Yn,{label:"API Key"},De.default.createElement(iC,{placeholder:`Enter ${A.label} API Key`,value:O.apiKey||"",onChange:D=>P({...O,apiKey:D})}),A.keyManagementURL&&De.default.createElement("p",{className:"tw-text-xs tw-text-muted"},De.default.createElement("a",{href:A.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",A.label," API Key"))),De.default.createElement(Yn,{label:De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},De.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),De.default.createElement(vo,{delayDuration:0},De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement(di,{className:"tw-size-4"})),De.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},De.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},J.map(({id:D,label:B,description:q})=>De.default.createElement("div",{key:D,className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(wd,{id:D,checked:O.capabilities?.includes(D),onCheckedChange:K=>{let H=O.capabilities||[];P({...O,capabilities:K?[...H,D]:H.filter(ee=>ee!==D)})}}),De.default.createElement(ip,{htmlFor:D,className:"tw-text-sm"},De.default.createElement(vo,{delayDuration:0},De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement("span",null,B)),De.default.createElement(Mt,{side:"bottom"},q)))))))),V()),De.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-gap-4"},De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(wd,{id:"enable-cors",checked:O.enableCors||!1,onCheckedChange:D=>P({...O,enableCors:D})}),De.default.createElement(ip,{htmlFor:"enable-cors",className:"tw-text-sm"},De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},De.default.createElement("span",null,"Enable CORS"),De.default.createElement(vo,{delayDuration:0},De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement(di,{className:"tw-size-4"})),De.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},De.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only check this option when prompted that CORS is needed"))))))),De.default.createElement("div",{className:"tw-flex tw-gap-2"},De.default.createElement(ge,{variant:"secondary",onClick:j,disabled:N()},"Add Model"),De.default.createElement(ge,{variant:"secondary",onClick:z,disabled:N()},f?De.default.createElement(De.default.Fragment,null,De.default.createElement(Yl,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Verify"):"Verify")))))};$r();nr();Cn();yn();var NYt=require("obsidian"),Ie=F(X()),DYt=F(Dc()),$Rn=({model:t,onUpdate:e,onCancel:r,isEmbeddingModel:n})=>{let[o,i]=(0,Ie.useState)(t),[a,s]=(0,Ie.useState)(t),[u,l]=(0,Ie.useState)({}),c=ue(),d=y=>c[Qb[y]]||"";(0,Ie.useEffect)(()=>{i(t),s(t),t.provider&&l(Xb(t.provider))},[t]);let f=(0,Ie.useMemo)(()=>tJ((y,S)=>{e(n,y,S)},500),[n,e]),p=(0,Ie.useCallback)((y,S)=>{i(x=>{let O={...x,[y]:S};return f(a,O),O})},[a,f]);if(!o)return null;let m=()=>{if(!o||!o.provider||o.provider!=="azure-openai")return u.host||"https://api.example.com/v1";let y=o.azureOpenAIApiInstanceName||"[instance]",S=o.isEmbeddingModel?o.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":o.azureOpenAIApiDeploymentName||"[deployment]",x=o.azureOpenAIApiVersion||"[api-version]",O=o.isEmbeddingModel?"embeddings":"chat/completions";return`https://${y}.openai.azure.com/openai/deployments/${S}/${O}?api-version=${x}`},h=Object.entries(WE).map(([y,S])=>({id:y,label:y.charAt(0).toUpperCase()+y.slice(1),description:S})),b=o.apiKey||d(o.provider),g=!n&&o.provider!=="copilot-plus-jina";return Ie.default.createElement("div",{className:"tw-space-y-3 tw-p-4"},Ie.default.createElement("div",{className:"tw-mb-4"},Ie.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"Model Settings - ",o.name),Ie.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Customize model parameters")),Ie.default.createElement("div",{className:"tw-space-y-3"},Ie.default.createElement(Yn,{label:"Model Name",required:!0},Ie.default.createElement(mo,{type:"text",disabled:o.core,value:o.name,onChange:y=>p("name",y.target.value),placeholder:"Enter model name"})),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ie.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4"})),Ie.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},Ie.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Ie.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Ie.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Ie.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Ie.default.createElement("li",null,"Direct-Paid:Ds-r1"),Ie.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Ie.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Ie.default.createElement(mo,{type:"text",placeholder:"Custom display name (optional)",value:o.displayName||"",onChange:y=>p("displayName",y.target.value)})),Ie.default.createElement(Yn,{label:"Provider"},Ie.default.createElement(mo,{type:"text",value:kf(o.provider),disabled:!0})),Ie.default.createElement(Yn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Ie.default.createElement(mo,{type:"text",placeholder:m(),value:o.baseUrl||"",onChange:y=>p("baseUrl",y.target.value)})),Ie.default.createElement(Yn,{label:"API Key"},Ie.default.createElement(iC,{placeholder:`Enter ${u.label||"Provider"} API Key`,value:b,onChange:y=>p("apiKey",y)}),u.keyManagementURL&&Ie.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Ie.default.createElement("a",{href:u.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",u.label," API Key"))),g&&Ie.default.createElement(Ie.default.Fragment,null,Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ie.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4"})),Ie.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},Ie.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},h.map(({id:y,label:S,description:x})=>Ie.default.createElement("div",{key:y,className:"tw-flex tw-items-center tw-gap-2"},Ie.default.createElement(wd,{id:y,checked:o.capabilities?.includes(y),onCheckedChange:O=>{let P=o.capabilities||[],E=O?[...P,y]:P.filter(A=>A!==y);p("capabilities",E)}}),Ie.default.createElement(ip,{htmlFor:y,className:"tw-text-sm"},Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement("span",null,S)),Ie.default.createElement(Mt,{side:"bottom"},x)))))))),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Token limit",Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Ie.default.createElement(Mt,{side:"bottom"},Ie.default.createElement("div",{className:"tw-w-[300px]"},Ie.default.createElement("p",null,"The maximum number of ",Ie.default.createElement("em",null,"output tokens")," to generate. Default is"," ",jh.MAX_TOKENS,"."),Ie.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model."))))))},Ie.default.createElement(nC,{value:o.maxTokens??c.maxTokens??jh.MAX_TOKENS,onChange:y=>p("maxTokens",y),min:0,max:65e3,step:100})),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Temperature",Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Ie.default.createElement(Mt,{side:"bottom"},Ie.default.createElement("div",{className:"tw-max-w-[300px]"},"Default is ",jh.TEMPERATURE,". Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.")))))},Ie.default.createElement(nC,{value:o.temperature??c.temperature??jh.TEMPERATURE,onChange:y=>p("temperature",y),max:2,min:0,step:.05})),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Top-P",Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Ie.default.createElement(Mt,{side:"bottom"},Ie.default.createElement("div",{className:"tw-w-[300px]"},"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 Al's vocabulary, the more diverse")))))},Ie.default.createElement(nC,{value:o.topP??.9,onChange:y=>p("topP",y),max:1,min:0,step:.05})),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Frequency Penalty",Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Ie.default.createElement(Mt,{side:"bottom"},Ie.default.createElement("div",{className:"tw-w-[300px]"},Ie.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."),Ie.default.createElement("em",null,"The higher the value, the more the model is penalized for repeating words."))))))},Ie.default.createElement(nC,{value:o.frequencyPenalty??0,onChange:y=>p("frequencyPenalty",y),max:2,min:0,step:.05})))))},Tfe=class extends NYt.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,DYt.createRoot)(r);let n=(i,a,s)=>{this.onUpdate(i,a,s)},o=()=>{this.close()};this.root.render(Ie.default.createElement($Rn,{model:this.model,isEmbeddingModel:this.isEmbeddingModel,onUpdate:n,onCancel:o}))}onClose(){this.root.unmount()}};ti();$r();Tn();nr();Cn();yn();var Me=F(X());var BRn={reasoning:{icon:eO,color:"tw-text-model-capabilities-blue",tooltip:WE.reasoning},vision:{icon:QC,color:"tw-text-model-capabilities-green",tooltip:WE.vision},websearch:{icon:u1,color:"tw-text-model-capabilities-blue",tooltip:WE.websearch}},qRn=["reasoning","vision","websearch"],URn=t=>Me.default.createElement(vo,{delayDuration:0},Me.default.createElement("div",{className:"tw-mx-auto tw-grid tw-w-16 tw-grid-cols-3 tw-gap-1"},qRn.map(e=>{let r=BRn[e];if(!r)return Me.default.createElement("div",{key:e,className:"tw-w-4"});let n=r.icon;return t.capabilities?.includes(e)?Me.default.createElement(Rt,{key:e},Me.default.createElement(jt,{asChild:!0},Me.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},Me.default.createElement(n,{className:_e("tw-size-4",r.color)}))),Me.default.createElement(Mt,{side:"bottom"},r.tooltip)):Me.default.createElement("div",{key:e,className:"tw-flex tw-items-center tw-justify-center"},Me.default.createElement("div",{className:"tw-size-4"}))}))),zRn=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,id:i})=>{let[a,s]=Me.default.useState(!1),u=J9(),{attributes:l,listeners:c,setNodeRef:d,transform:f,transition:p,isDragging:m}=G9({id:i,disabled:t.core}),h={transform:Rb.Transform.toString(f),transition:p};return Me.default.createElement(h9,{ref:d,style:h,className:_e("tw-mb-2",m&&["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")},Me.default.createElement(g9,{className:"tw-p-3"},Me.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},!t.core&&Me.default.createElement("div",{className:"tw-mr-2 tw-cursor-grab tw-touch-none active:tw-cursor-grabbing",...l,...c},Me.default.createElement(d_,{className:"tw-size-4"})),Me.default.createElement("div",{className:"tw-flex-1 tw-cursor-pointer",onClick:()=>s(!a)},Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement("div",{className:"tw-flex tw-size-3 tw-items-center tw-justify-center"},a?Me.default.createElement(Hi,{className:"tw-size-3 tw-stroke-[7]"}):Me.default.createElement(ZC,{className:"tw-size-3 tw-stroke-[7]"})),Me.default.createElement("div",null,Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Me.default.createElement("span",{className:"tw-font-medium"},t.displayName||t.name),t.capabilities&&t.capabilities.length>0&&Me.default.createElement(Eke,{capabilities:t.capabilities,iconSize:14})),Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement("span",{className:"tw-bg-secondary tw-text-sm tw-text-muted"},kf(t.provider,t)))))),Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},e&&Me.default.createElement(ge,{variant:"ghost",size:"icon",onClick:b=>{b.stopPropagation(),e(t)}},Me.default.createElement(ok,{className:"tw-size-4"})),Me.default.createElement(JD,null,Me.default.createElement(YD,{asChild:!0},Me.default.createElement(ge,{variant:"ghost",size:"icon"},Me.default.createElement(XC,{className:"tw-size-4"}))),Me.default.createElement(xb,{align:"end",container:u},e&&Me.default.createElement(Si,{onClick:b=>{b.stopPropagation(),e(t)}},Me.default.createElement(nk,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&Me.default.createElement(Si,{onClick:b=>{b.stopPropagation(),r(t)}},Me.default.createElement(Ty,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&Me.default.createElement(Si,{onClick:b=>{b.stopPropagation(),n(kr(t))},className:"tw-text-error"},Me.default.createElement(Rm,{className:"tw-mr-2 tw-size-4"}),"Delete")))))),Me.default.createElement("div",{className:_e("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")},Me.default.createElement(y9,{className:"tw-p-3 tw-pt-0"},Me.default.createElement("div",{className:"tw-flex tw-justify-around"},!t.isEmbeddingModel&&Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement("span",{className:"tw-text-sm"},"Enabled"),Me.default.createElement(wd,{checked:t.enabled,onCheckedChange:b=>o({...t,enabled:b})})),Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement("span",{className:"tw-text-sm"},"CORS"),Me.default.createElement(wd,{checked:t.enableCors,onCheckedChange:b=>o({...t,enableCors:b})}))))))},HRn=({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}=G9({id:kr(t),disabled:t.core}),f=J9(),p={transform:Rb.Transform.toString(l),transition:c},m=e||!t.core||r&&!t.core;return Me.default.createElement(BM,{ref:u,style:p,className:_e("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")},Me.default.createElement(gf,{className:"tw-w-6 tw-px-2"},!t.core&&Me.default.createElement(ge,{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},Me.default.createElement(d_,{className:"tw-size-4 tw-transition-colors"}))),Me.default.createElement(gf,{className:"tw-pl-0"},t.displayName||t.name),Me.default.createElement(gf,null,kf(t.provider,t)),Me.default.createElement(gf,null,URn(t)),!i&&Me.default.createElement(gf,{className:"tw-text-center"},Me.default.createElement(wd,{id:`${kr(t)}-enabled`,checked:t.enabled,onCheckedChange:h=>o({...t,enabled:h}),className:"tw-mx-auto"})),Me.default.createElement(gf,{className:"tw-text-center"},Me.default.createElement(wd,{id:`${kr(t)}-enableCors`,checked:t.enableCors,onCheckedChange:h=>o({...t,enableCors:h}),className:"tw-mx-auto"})),Me.default.createElement(gf,{className:"tw-text-center"},Me.default.createElement("div",{className:"tw-flex tw-justify-center tw-gap-2"},e&&Me.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},Me.default.createElement(ok,{className:"tw-size-4"})),m&&Me.default.createElement(JD,null,Me.default.createElement(YD,{asChild:!0},Me.default.createElement(ge,{variant:"ghost",size:"icon"},Me.default.createElement(XC,{className:"tw-size-4"}))),Me.default.createElement(xb,{align:"end",container:f},e&&Me.default.createElement(Si,{onClick:()=>e(t)},Me.default.createElement(nk,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&Me.default.createElement(Si,{onClick:()=>r(t)},Me.default.createElement(Ty,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&Me.default.createElement(Si,{onClick:()=>n(kr(t)),className:"tw-text-error"},Me.default.createElement(Rm,{className:"tw-mr-2 tw-size-4"}),"Delete"))))))},Pqe=({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=pfe(Zz(VM),Zz(HM,{coordinateGetter:vfe})),d=t.findIndex(h=>!h.core),f=h=>b=>{let{transform:g,active:y,activeNodeRect:S,over:x}=b;if(!y||!S)return g;let O=t.findIndex(R=>kr(R)===y.id),P=t.filter(R=>!R.core).length,E=S.height,A=(d-O)*E,I=(d+P-1-O)*E;if(h&&x){let R=t.findIndex(j=>kr(j)===x.id);if(t[R].core||R{let{active:b,over:g}=h;if(g&&b.id!==g.id){let y=t.findIndex(P=>kr(P)===b.id),S=t.findIndex(P=>kr(P)===g.id),x=t[S];if(SMe.default.createElement("div",{className:"tw-relative md:tw-hidden"},Me.default.createElement(V9,{sensors:c,collisionDetection:z9,onDragEnd:p,modifiers:[f(!0)]},Me.default.createElement(K9,{items:t.map(h=>kr(h)),strategy:W9},Me.default.createElement("div",{className:"tw-relative tw-space-y-2"},t.map(h=>Me.default.createElement(zRn,{key:kr(h),id:kr(h),model:h,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i}))))));return Me.default.createElement("div",{className:"tw-mb-4"},Me.default.createElement("div",{className:"tw-hidden md:tw-block"},Me.default.createElement(V9,{sensors:c,collisionDetection:z9,onDragEnd:p,modifiers:[f(!1)]},Me.default.createElement("div",{className:"tw-relative tw-overflow-hidden"},Me.default.createElement(j9,null,Me.default.createElement(N9,null,Me.default.createElement(BM,null,Me.default.createElement(ap,{className:"tw-w-6 tw-px-2"}),Me.default.createElement(ap,{className:"tw-pl-0"},"Model"),Me.default.createElement(ap,null,"Provider"),Me.default.createElement(ap,{className:"tw-text-center"},"Capabilities"),!l&&Me.default.createElement(ap,{className:"tw-text-center"},"Enable"),Me.default.createElement(ap,{className:"tw-text-center"},"CORS"),Me.default.createElement(ap,{className:"tw-w-[100px] tw-text-center"},"Actions"))),Me.default.createElement(D9,{className:"tw-relative"},Me.default.createElement(K9,{items:t.map(h=>kr(h)),strategy:W9},t.map(h=>Me.default.createElement(HRn,{key:kr(h),model:h,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i,isEmbeddingModel:l})))))))),m(),Me.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end tw-gap-2"},s&&Me.default.createElement(ge,{onClick:s,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement(m_,{className:"tw-size-4"}),"Refresh Built-in Models"),Me.default.createElement(ge,{onClick:o,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement(Mm,{className:"tw-size-4"}),"Add Custom Model")))};Cn();var Afe=require("obsidian"),up=F(X()),LYt=()=>{let t=Rn(),[e,r]=(0,up.useState)(!1),[n,o]=(0,up.useState)(!1),i=(h,b=!1)=>{let g={...u4(h,["isBuiltIn","core","projectEnabled","plusExclusive","believerExclusive","capabilities","displayName","dimensions"]),name:`${h.name} (copy)`},y=b?"activeEmbeddingModels":"activeModels";dt(y,[...t[y],g])},a=(h,b=!1)=>{dt(b?"activeEmbeddingModels":"activeModels",h)},s=h=>{let[b,g]=h.split("|"),y=t.activeModels.filter(x=>!(x.name===b&&x.provider===g)),S=t.defaultModelKey;if(h===t.defaultModelKey){let x=y.find(O=>O.enabled);S=x?`${x.name}|${x.provider}`:""}zE({activeModels:y,defaultModelKey:S})},u=(h,b,g)=>{let y=h?"activeEmbeddingModels":"activeModels",S=t[y].findIndex(x=>x.name===b.name&&x.provider===b.provider);if(S!==-1){let x=[...t[y]];x[S]=g,dt(y,x)}else new Afe.Notice("Could not find model to update"),fe("Could not find model to update:",b)},l=h=>{let b=t.activeModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);dt("activeModels",b)},c=h=>{let[b,g]=h.split("|"),y=t.activeEmbeddingModels.filter(S=>!(S.name===b&&S.provider===g));dt("activeEmbeddingModels",y)},d=h=>{let b=t.activeEmbeddingModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);dt("activeEmbeddingModels",b)},f=()=>{let h=t.activeModels.filter(g=>!g.isBuiltIn),b=[...Zb,...h];dt("activeModels",b),new Afe.Notice("Chat models refreshed successfully")},p=()=>{let h=t.activeEmbeddingModels.filter(g=>!g.isBuiltIn),b=[...jR,...h];dt("activeEmbeddingModels",b),new Afe.Notice("Embedding models refreshed successfully")},m=(h,b=!1)=>{new Tfe(app,h,b,u).open()};return up.default.createElement("div",{className:"tw-space-y-4"},up.default.createElement("section",null,up.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Chat Models"),up.default.createElement(Pqe,{models:t.activeModels,onEdit:h=>m(h),onCopy:h=>i(h),onDelete:s,onAdd:()=>r(!0),onUpdateModel:l,onReorderModels:h=>a(h),onRefresh:f,title:"Chat Model"}),up.default.createElement(Oqe,{open:e,onOpenChange:r,onAdd:h=>{let b=[...t.activeModels,h];dt("activeModels",b)},ping:h=>ac.instance.getCurrentChainManager().chatModelManager.ping(h)}),up.default.createElement("div",{className:"tw-space-y-4"},up.default.createElement(hn,{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:h=>dt("contextTurns",h),min:1,max:50,step:1}))),up.default.createElement("section",null,up.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Embedding Models"),up.default.createElement(Pqe,{models:t.activeEmbeddingModels,onEdit:h=>m(h,!0),onDelete:c,onCopy:h=>i(h,!0),onAdd:()=>o(!0),onUpdateModel:d,onReorderModels:h=>a(h,!0),onRefresh:p,title:"Embedding Model"}),up.default.createElement(Oqe,{open:n,onOpenChange:o,onAdd:h=>{let b=[...t.activeEmbeddingModels,h];dt("activeEmbeddingModels",b)},isEmbeddingModel:!0,ping:h=>Xs.getInstance().ping(h)})))};var qYt=require("obsidian");ti();var Pn=F(X()),UYt=F(Dc());_g();yn();var FYt=require("obsidian"),sy=F(X()),kYt=F(Dc());ti();function VRn({onConfirm:t,onCancel:e}){let[r,n]=(0,sy.useState)(""),[o,i]=(0,sy.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return sy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},sy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},sy.default.createElement(mo,{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&&sy.default.createElement("p",{className:"tw-text-sm tw-text-error"},o)),sy.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},sy.default.createElement(ge,{variant:"secondary",onClick:e},"Cancel"),sy.default.createElement(ge,{variant:"default",onClick:()=>a(r)},"Confirm")))}var Ife=class extends FYt.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,kYt.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(sy.default.createElement(VRn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var $Yt=require("obsidian"),Lb=F(X()),BYt=F(Dc());ti();function WRn({onConfirm:t,onCancel:e}){let[r,n]=(0,Lb.useState)("");return Lb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Lb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Lb.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"),Lb.default.createElement(mo,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),Lb.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Lb.default.createElement(ge,{variant:"secondary",onClick:e},"Cancel"),Lb.default.createElement(ge,{variant:"default",onClick:()=>t(r)},"Confirm")))}var Mfe=class extends $Yt.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,BYt.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(Lb.default.createElement(WRn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};function Rfe({title:t,patterns:e,onRemove:r}){return Pn.default.createElement("div",{className:"tw-grid tw-grid-cols-4 tw-gap-2"},Pn.default.createElement("div",{className:"tw-font-bold"},t),Pn.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=>Pn.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"},Pn.default.createElement(TM,{className:"tw-flex-1"},n),Pn.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>r(n)},Pn.default.createElement(Vi,{className:"tw-size-4"}))))))}function KRn({value:t,onUpdate:e,container:r}){let[n,o]=(0,Pn.useState)(t),i=bg(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=k8(i),c=f=>{let p=$8({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 Pn.default.createElement("div",{className:"tw-mt-2 tw-flex tw-flex-col tw-gap-4"},Pn.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&&Pn.default.createElement("div",{className:"tw-text-center tw-text-sm"},"No patterns specified"),a.length>0&&Pn.default.createElement(Rfe,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(m=>m!==f);c({tagPatterns:p})}}),s.length>0&&Pn.default.createElement(Rfe,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(m=>m!==f);c({extensionPatterns:p})}}),u.length>0&&Pn.default.createElement(Rfe,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(m=>m!==f);c({folderPatterns:p})}}),l.length>0&&Pn.default.createElement(Rfe,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(m=>m!==f);c({notePatterns:p})}})),Pn.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Pn.default.createElement(JD,null,Pn.default.createElement(YD,{asChild:!0},Pn.default.createElement(ge,{variant:"secondary"},"Add...")),Pn.default.createElement(xb,{align:"start",container:r},Pn.default.createElement(Si,{onSelect:()=>{new Sz(app,f=>{let p=Xoe(f);a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(d1,{className:"tw-size-4"}),"Tag")),Pn.default.createElement(Si,{onSelect:()=>{new wz(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(Iy,{className:"tw-size-4"}),"Folder")),Pn.default.createElement(Si,{onSelect:()=>{new SM({app,onNoteSelect:f=>{let p=B8(f);l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(Ay,{className:"tw-size-4"}),"Note")),Pn.default.createElement(Si,{onSelect:()=>{new Ife(app,f=>{let p=YRt(f);s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(x3,{className:"tw-size-4"}),"Extension")),Pn.default.createElement(Si,{onSelect:()=>{new Mfe(app,f=>{let p=bg(f),{tagPatterns:m,extensionPatterns:h,folderPatterns:b,notePatterns:g}=k8(p);c({tagPatterns:[...a,...m],extensionPatterns:[...s,...h],folderPatterns:[...u,...b],notePatterns:[...l,...g]})}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(f1,{className:"tw-size-4"}),"Custom"))))))}var nK=class extends qYt.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,UYt.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(Pn.default.createElement(KRn,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};ti();$r();Ix();nr();yn();var zr=F(X()),zYt=()=>{let t=Rn(),e=r=>{let n=parseInt(r);n!==t.numPartitions&&new Qz(app,async()=>{dt("numPartitions",n),await ma.getInstance().indexVaultToVectorStore(!0)}).open()};return zr.default.createElement("div",{className:"tw-space-y-4"},zr.default.createElement("section",null,zr.default.createElement("div",{className:"tw-space-y-4"},zr.default.createElement(hn,{type:"select",title:"Auto-Index Strategy",description:zr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},zr.default.createElement("span",{className:"tw-leading-none"},"Decide when you want the vault to be indexed."),zr.default.createElement(vo,{delayDuration:0},zr.default.createElement(Rt,null,zr.default.createElement(jt,{asChild:!0},zr.default.createElement(di,{className:"tw-size-4"})),zr.default.createElement(Mt,null,zr.default.createElement("div",{className:"tw-space-y-2 tw-py-2"},zr.default.createElement("div",{className:"tw-space-y-1"},zr.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Choose when to index your vault:"),zr.default.createElement("ul",{className:"tw-list-disc tw-space-y-1 tw-pl-2 tw-text-sm"},zr.default.createElement("li",null,zr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},zr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"NEVER:"),zr.default.createElement("span",null,"Manual indexing via command or refresh only"))),zr.default.createElement("li",null,zr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},zr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON STARTUP:"),zr.default.createElement("span",null,"Index updates when plugin loads or reloads"))),zr.default.createElement("li",null,zr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},zr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON MODE SWITCH:"),zr.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),zr.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=>{dt("indexVaultToVectorStore",r)},options:xVe.map(r=>({label:r,value:r})),placeholder:"Strategy"}),zr.default.createElement(hn,{type:"slider",title:"Max Sources",description:"Copilot goes through your vault to find relevant blocks and passes the top N blocks to the LLM. Default for N is 3. Increase if you want more sources included in the answer generation step.",min:1,max:128,step:1,value:t.maxSourceChunks,onChange:r=>dt("maxSourceChunks",r)}),zr.default.createElement(hn,{type:"slider",title:"Requests per Minute",description:"Default is 90. Decrease if you are rate limited by your embedding provider.",min:10,max:300,step:10,value:t.embeddingRequestsPerMin,onChange:r=>dt("embeddingRequestsPerMin",r)}),zr.default.createElement(hn,{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=>dt("embeddingBatchSize",r)}),zr.default.createElement(hn,{type:"select",title:"Number of Partitions",description:"Number of partitions for Copilot index. Default is 1. Increase if you have issues indexing large vaults. Warning: Changes require clearing and rebuilding the index!",value:t.numPartitions.toString(),onChange:e,options:["1","2","3","4","5","6","7","8","12","16","20","24","28","32","36","40"].map(r=>({label:r,value:r}))}),zr.default.createElement(hn,{type:"custom",title:"Exclusions",description:zr.default.createElement(zr.default.Fragment,null,zr.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."))},zr.default.createElement(ge,{variant:"secondary",onClick:()=>new nK(app,r=>dt("qaExclusions",r),t.qaExclusions,"Manage Exclusions").open()},"Manage")),zr.default.createElement(hn,{type:"custom",title:"Inclusions",description:zr.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.")},zr.default.createElement(ge,{variant:"secondary",onClick:()=>new nK(app,r=>dt("qaInclusions",r),t.qaInclusions,"Manage Inclusions").open()},"Manage")),zr.default.createElement(hn,{type:"switch",title:"Enable Obsidian Sync for Copilot index",description:"If enabled, the index will be stored in the .obsidian folder and synced with Obsidian Sync by default. If disabled, it will be stored in .copilot-index folder at vault root.",checked:t.enableIndexSync,onCheckedChange:r=>dt("enableIndexSync",r)}),zr.default.createElement(hn,{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=>dt("disableIndexOnMobile",r)}))))};var VYt=["basic","model","QA","command","plus","advanced"],GRn={basic:Bn.default.createElement(p3,{className:"tw-size-5"}),model:Bn.default.createElement(m3,{className:"tw-size-5"}),QA:Bn.default.createElement(h3,{className:"tw-size-5"}),command:Bn.default.createElement(c_,{className:"tw-size-5"}),plus:Bn.default.createElement(Vh,{className:"tw-size-5"}),advanced:Bn.default.createElement(f1,{className:"tw-size-5"})},JRn={basic:()=>Bn.default.createElement(RYt,null),model:()=>Bn.default.createElement(LYt,null),QA:()=>Bn.default.createElement(zYt,null),command:()=>Bn.default.createElement(OYt,null),plus:()=>Bn.default.createElement(jYt,null),advanced:()=>Bn.default.createElement(PYt,null)},HYt=VYt.map(t=>({id:t,icon:GRn[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),YRn=()=>{let{selectedTab:t,setSelectedTab:e}=Vz();return Bn.default.createElement("div",{className:"tw-flex tw-flex-col"},Bn.default.createElement("div",{className:"tw-inline-flex tw-rounded-lg"},HYt.map((r,n)=>Bn.default.createElement(IJt,{key:r.id,tab:r,isSelected:t===r.id,onClick:()=>e(r.id),isFirst:n===0,isLast:n===HYt.length-1}))),Bn.default.createElement("div",{className:"tw-w-full tw-border tw-border-solid"}),Bn.default.createElement("div",null,VYt.map(r=>{let n=JRn[r];return Bn.default.createElement(MJt,{key:r,id:r,isSelected:t===r},Bn.default.createElement(n,null))})))},ZRn=({plugin:t})=>{let[e,r]=Bn.default.useState(0),{latestVersion:n,hasUpdate:o}=_de(t.manifest.version),i=async()=>{new ofe(app,async()=>{nVe(),r(s=>s+1)}).open()};return Bn.default.createElement(jJt,null,Bn.default.createElement("div",null,Bn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Bn.default.createElement("h1",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},Bn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Bn.default.createElement("span",null,"Copilot Settings"),Bn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Bn.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"v",t.manifest.version),n&&Bn.default.createElement(Bn.default.Fragment,null,o?Bn.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,")"):Bn.default.createElement("span",{className:"tw-text-xs tw-text-normal"}," (up to date)")))),Bn.default.createElement("div",{className:"tw-self-end sm:tw-self-auto"},Bn.default.createElement(ge,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),Bn.default.createElement(YRn,{key:e})))},WYt=ZRn;var jfe=class extends oK.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{this.app.workspace.getLeavesOfType(Es)[0]?.view&&ue().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 oK.Notice("Plugin reloaded successfully.")}catch(e){new oK.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,KYt.createRoot)(r).render(Eqe.default.createElement(aqe.Provider,{value:e},Eqe.default.createElement(WYt,{plugin:this.plugin})))}};nr();var vE=require("obsidian");Cl();ti();yo();Cn();qE();Sm();yn();var Fb=require("obsidian"),Et=F(X()),GYt=F(Dc());nr();function XRn(t){let[e]=(0,Et.useState)(new hW({returnMessages:!0,memoryKey:"history"})),[r,n]=(0,Et.useState)(null);return(0,Et.useEffect)(()=>{async function o(){let i=await PD.getInstance().createModelInstance(t),a=xp.fromMessages([BE.fromTemplate("You are a helpful assistant. You'll help the user with their content editing needs."),new Gb("history"),Jb.fromTemplate("{input}")]),s=bi.from([{input:u=>u.input,memory:()=>e.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},a,i]);n(s)}o()},[t,e]),{chatChain:r,chatMemory:e}}function QRn({originalText:t,command:e,onInsert:r,onReplace:n}){let[o,i]=(0,Et.useState)(null),[a,s]=(0,Et.useState)(null),[u,l]=(0,Et.useState)(""),c=(0,Et.useRef)(null),d=(0,Et.useRef)(null),[f,p]=(0,Et.useState)(!0),[m]=wF(),h=Rn(),b=(0,Et.useMemo)(()=>eJ(e.modelKey||m,h.activeModels),[e.modelKey,m,h.activeModels]),{chatChain:g,chatMemory:y}=XRn(b),S=e.title,x=(0,Et.useCallback)(async(R,N)=>{if(!g)return console.error("Chat chain not initialized"),new Fb.Notice("Chat engine not ready. Please try again."),p(!1),null;try{i(null),s(null),p(!0);let j="",k=await g.bind({signal:N.signal}).stream({input:R});for await(let z of k){if(N.signal.aborted)break;let V=typeof z.content=="string"?z.content:"";j+=V,i(j)}if(!N.signal.aborted){let z=j.trim();return s(z),p(!1),await y.saveContext({input:R},{output:z}),z}return null}catch(j){return fe("Error generating response:",j),p(!1),null}},[g,y]);(0,Et.useEffect)(()=>{let R=new AbortController;O.current=R;async function N(){if(g)try{let j=await iFe(e.content,t);await x(j,R)}catch(j){fe("Error in initial response:",j),p(!1)}}return N(),()=>{R.abort()}},[e.content,t,g,x]);let O=(0,Et.useRef)(null),P=async()=>{if(!u.trim()||!g){g||new Fb.Notice("Chat engine not ready. Please try again.");return}let R=new AbortController;O.current=R;let N=await iFe(u,t,!0);try{await x(N,R)&&l("")}finally{R.signal.aborted&&(p(!1),s(o??"")),O.current=null}},E=()=>{O.current&&(O.current.abort(),O.current=null,p(!1))},A=R=>{R.nativeEvent.isComposing||(!f&&a&&!I&&(R.key==="Enter"&&(Fb.Platform.isMacOS?R.metaKey:R.ctrlKey)&&!R.shiftKey&&(R.preventDefault(),n(a)),R.key==="Enter"&&(Fb.Platform.isMacOS?R.metaKey:R.ctrlKey)&&R.shiftKey&&(R.preventDefault(),r(a))),I&&R.key==="Enter"&&!R.shiftKey&&!R.metaKey&&!R.ctrlKey&&(R.preventDefault(),P()))};(0,Et.useEffect)(()=>{if(c.current&&o&&f){let R=c.current;R.scrollTop=R.scrollHeight}},[o,f]);let I=!f&&u.trim().length>0;return Et.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4",onKeyDown:A},Et.default.createElement("div",{className:"tw-max-h-60 tw-overflow-y-auto tw-whitespace-pre-wrap tw-text-muted"},t),Et.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},S&&Et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-font-bold tw-text-normal"},Et.default.createElement(p_,{className:"tw-size-4"}),S)),Et.default.createElement("div",{className:"tw-group tw-relative"},Et.default.createElement("textarea",{ref:c,className:"tw-peer tw-h-60 tw-w-full tw-text-text",value:a??o??"loading...",disabled:a==null,onChange:R=>s(R.target.value)}),a&&Et.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(a),new Fb.Notice("Copied to clipboard")}},Et.default.createElement(Ty,{className:"tw-size-4 hover:tw-text-accent"}))),!f&&a&&Et.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Et.default.createElement("textarea",{autoFocus:!0,ref:d,className:"tw-h-20 tw-w-full tw-text-text",placeholder:"Enter follow-up instructions...",value:u,onChange:R=>l(R.target.value)})),Et.default.createElement("div",{className:"tw-flex tw-justify-between tw-gap-2"},Et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs tw-font-bold tw-text-faint"},Et.default.createElement(a1,{className:"tw-size-4"}),Xce(b)),Et.default.createElement("div",{className:"tw-flex tw-gap-2"},f?Et.default.createElement(ge,{variant:"secondary",onClick:E},"Stop"):I?Et.default.createElement(ge,{onClick:P,className:"tw-flex tw-items-center tw-gap-1"},Et.default.createElement("span",null,"Submit"),Et.default.createElement(Im,{className:"tw-size-3"})):Et.default.createElement(Et.default.Fragment,null,Et.default.createElement(ge,{onClick:()=>r(a??""),className:"tw-flex tw-items-center tw-gap-1"},Et.default.createElement("span",null,"Insert"),Et.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs tw-text-normal"},Fb.Platform.isMacOS?Et.default.createElement(Et.default.Fragment,null,Et.default.createElement(c_,{className:"tw-size-3"}),Et.default.createElement(YC,{className:"tw-size-3"}),Et.default.createElement(Im,{className:"tw-size-3"})):Et.default.createElement(Et.default.Fragment,null,Et.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Et.default.createElement(YC,{className:"tw-size-3"}),Et.default.createElement(Im,{className:"tw-size-3"})))),Et.default.createElement(ge,{onClick:()=>n(a??""),className:"tw-flex tw-items-center tw-gap-1"},Et.default.createElement("span",null,"Replace"),Et.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs tw-text-normal"},Fb.Platform.isMacOS?Et.default.createElement(Et.default.Fragment,null,Et.default.createElement(c_,{className:"tw-size-3"}),Et.default.createElement(Im,{className:"tw-size-3"})):Et.default.createElement(Et.default.Fragment,null,Et.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Et.default.createElement(Im,{className:"tw-size-3"}))))))))}var Nfe=class extends Fb.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,GYt.createRoot)(r);let{selectedText:n,command:o}=this.configs,i=s=>{l4(s),this.close()},a=s=>{l4(s,!0),this.close()};this.root.render(Et.default.createElement(QRn,{originalText:n,command:o,onInsert:i,onReplace:a}))}onClose(){this.root.unmount()}};var JYt=F(YRe());var Dfe=class{constructor(e,r){this.handleFileModify=(0,JYt.default)(async e=>{if(YU(e)){let r=await TW(e);this.registerCommand(r),EW(r,r.title)}},3e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(YU(e)){let r=await TW(e);this.registerCommand(r),ace(r.title)}};this.handleFileDeletion=async e=>{if(YU(e)){let r=JU(e.basename);this.plugin.removeCommand(r),PW(e.basename)}};this.handleFileRename=async(e,r)=>{let n=r.split("/").pop()?.replace(/\.md$/,"");if(n){let o=JU(n);this.plugin.removeCommand(o),PW(n)}if(YU(e)){let o=await TW(e);this.registerCommand(o),EW(o,o.title)}};this.plugin=e,this.vault=r,this.initializeEventListeners()}async initialize(){await uce(),this.registerCommands()}async registerCommands(){Gx().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=JU(e.title);this.plugin.removeCommand(r),this.plugin.addCommand({id:r,name:e.title,editorCallback:n=>{new Nfe(this.plugin.app,{selectedText:n.getSelection(),command:e}).open(),lm.getInstance().recordUsage(e)}})}};var Lfe=class extends vE.Plugin{constructor(){super(...arguments);this.userMessageHistory=[]}async onload(){await this.loadSettings(),this.settingsUnsubscriber=xa(async(r,n)=>{n.enableEncryption?await this.saveData(await VVe(n)):await this.saveData(n),nFe(this,r,n)}),this.addSettingTab(new jfe(this.app,this)),this.sharedState=new xJt(this),this.vectorStoreManager=ma.getInstance(),this.brevilabsClient=Fi.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),iie(),this.projectManager=ac.getInstance(this.app,this.vectorStoreManager,this),this.fileParserManager=new oI(this.brevilabsClient,this.app.vault),this.registerView(Es,r=>new $M(r,this)),this.registerView(s9,r=>new ude(r)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",r=>{this.activateView()}),nFe(this,void 0,ue()),IN.initTools(this.app.vault),this.registerEvent(this.app.workspace.on("editor-menu",r=>AJt(r))),this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{if(r&&r.view instanceof vE.MarkdownView&&r.view.file){let o=this.app.workspace.getLeavesOfType(Es).find(i=>i.view instanceof $M)?.view;if(o){let i=new CustomEvent(Dh.ACTIVE_LEAF_CHANGE);o.eventTarget.dispatchEvent(i)}}})),this.autocompleteService=tce.getInstance(this),this.customCommandRegister=new Dfe(this,this.app.vault),this.app.workspace.onLayoutReady(()=>{this.customCommandRegister.initialize().then(xYt).then(CYt)})}async onunload(){this.vectorStoreManager&&this.vectorStoreManager.onunload(),this.projectManager&&this.projectManager.onunload(),this.customCommandRegister.cleanup(),this.settingsUnsubscriber?.(),this.autocompleteService?.destroy(),ie("Copilot plugin unloaded")}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(ue().autosaveChat){let r=this.app.workspace.getLeavesOfType(Es)[0]?.view;r&&r.sharedState.chatHistory.length>0&&await r.saveChat()}}async processText(r,n,o,i=!0){let a=await r.getSelection();this.app.workspace.getLeavesOfType(Es).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(Es).find(l=>l.view instanceof $M)?.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(Es).find(n=>n.view instanceof $M)?.view;if(r){let n=new CustomEvent(Dh.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===Es&&this.emitChatIsVisible()}))}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(vE.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(Es).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(Es);r.length===0?ue().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:Es,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:Es,active:!0}):this.app.workspace.revealLeaf(r[0]),this.emitChatIsVisible()}async deactivateView(){this.app.workspace.detachLeavesOfType(Es)}async loadSettings(){let r=await this.loadData(),n=oVe(r);zE(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=kr(i),s=o.get(a);s?o.set(a,{...i,isBuiltIn:s.isBuiltIn||i.isBuiltIn}):o.set(a,i)}),Array.from(o.values())}async loadCopilotChatHistory(){let r=await this.getChatHistoryFiles();if(r.length===0){new vE.Notice("No chat history found.");return}new nfe(this.app,r,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(ue().defaultSaveFolder);if(!(r instanceof vE.TFolder))return[];let o=(await this.app.vault.getMarkdownFiles()).filter(s=>s.path.startsWith(r.path)),a=Mc()?.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=x1t(n);this.sharedState.clearChatHistory(),o.forEach(a=>this.sharedState.addMessage(a)),await _N(o,this.projectManager.getCurrentChainManager().memoryManager);let i=this.app.workspace.getLeavesOfType(Es)[0];i?i.view.updateView():this.activateView()}async handleNewChat(){await this.autosaveCurrentChat();let r=this.app.workspace.getLeavesOfType(Es)[0];if(r){let n=r.view,o=new CustomEvent(Dh.ABORT_STREAM,{detail:{reason:"new-chat"}});n.eventTarget.dispatchEvent(o)}this.sharedState.clearChatHistory(),this.projectManager.getCurrentChainManager().memoryManager.clearChatMemory(),r?r.view.updateView():await this.activateView()}async newChat(){await this.handleNewChat()}async customSearchDB(r,n,o){return(await new Rx({minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o}).getOramaChunks(r,n)).map(s=>({content:s.pageContent,metadata:s.metadata}))}}; +with CORS Error: `+ei(J);throw new Error(D)}}let z=await k.json(),V=DYt(I,z);l(Q=>({...Q,[I]:V})),d(null)}catch(N){console.error(`Error fetching models for ${I}:`,N),p(I),d(null),new Db.Notice(`Failed to load models for ${kf(I)}: ${ei(N)}`,5e3)}},A=async()=>{if(!m){new Db.Notice("Please select a model first");return}g(!0);try{let I=S(m.provider),R={name:m.name,provider:m.provider,apiKey:I,enabled:!0};if(await ac.instance.getCurrentChainManager().chatModelManager.ping(R),e.activeModels.find(j=>j.name===m.name&&j.provider===m.provider))new Db.Notice(`Model ${m.name} verified successfully! It already exists in your models list.`);else{let j=[...e.activeModels,R];dt("activeModels",j),new Db.Notice(`Model ${m.name} verified successfully and added to your models list!`)}}catch(I){console.error("Model verification failed:",I),new Db.Notice("Model verification failed: "+ei(I),1e4)}finally{g(!1)}};return Ht.default.createElement("div",{className:"tw-max-h-[600px] tw-overflow-y-auto tw-p-4 sm:tw-max-w-[500px]"},Ht.default.createElement("div",{className:"tw-mb-4"},Ht.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"AI Provider Settings"),Ht.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Configure your AI providers by adding their API keys.")),Ht.default.createElement("div",{className:"tw-space-y-6 tw-py-4"},Ht.default.createElement("div",{className:"tw-space-y-4"},x.map(I=>Ht.default.createElement(Ht.default.Fragment,{key:I.provider},Ht.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ht.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},Ht.default.createElement("div",{className:"tw-truncate"},kf(I.provider))),Ht.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},Ht.default.createElement("div",{className:"tw-flex-1"},Ht.default.createElement(aC,{className:"tw-max-w-full",value:I.apiKey,onChange:R=>O(I.provider,R),disabled:r.has(I.provider)})),Ht.default.createElement("div",{className:"tw-w-[72px]"},I.isVerified?Ht.default.createElement("span",{className:"tw-flex tw-h-9 tw-items-center tw-justify-center tw-text-sm tw-text-success"},"Verified"):Ht.default.createElement(ge,{onClick:()=>P(I.provider,I.apiKey),disabled:!I.apiKey||r.size>0,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},r.has(I.provider)?Ht.default.createElement(Yl,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Verify")),Ht.default.createElement("div",{className:""},Ht.default.createElement(ge,{onClick:()=>{let R=a===I.provider?null:I.provider;s(R),R&&I.apiKey&&u[I.provider]===void 0&&c!==I.provider&&f!==I.provider&&E(I.provider,I.apiKey)},disabled:!I.apiKey||r.size>0,variant:"secondary",size:"sm",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-1 tw-whitespace-nowrap tw-p-0.5"},"Add Model",a===I.provider?Ht.default.createElement(Ey,{className:"tw-ml-1 tw-size-4"}):Ht.default.createElement(Hi,{className:"tw-ml-1 tw-size-4"})))),Ht.default.createElement("div",null,Xb(I.provider).keyManagementURL&&Ht.default.createElement("a",{href:Xb(I.provider).keyManagementURL,target:"_blank",rel:"noopener noreferrer",className:"tw-text-[10px] tw-text-accent hover:tw-text-accent-hover sm:tw-text-xs"},"Get ",kf(I.provider)," Key"))),Ht.default.createElement(cE,{open:a===I.provider,className:"tw-mt-2"},Ht.default.createElement(dE,{className:"tw-rounded-md tw-p-3"},Ht.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ht.default.createElement(Yn,{label:"Model",description:"Add the currently selected model to model List. After adding, please check the Model Tab."},Ht.default.createElement("div",null,Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ht.default.createElement("div",{className:"tw-flex-1"},Ht.default.createElement(Wde,{options:u[I.provider]?.sort((R,N)=>R.name.localeCompare(N.name)).map(R=>({label:R.name,value:R.id}))||[],onChange:R=>{let N=R.target.value,j=u[I.provider]?.find($=>$.id===N);j&&h({id:j.id,name:j.name,provider:I.provider})},onClick:()=>{I.apiKey&&u[I.provider]===void 0&&c!==I.provider&&f!==I.provider&&E(I.provider,I.apiKey)},value:m?.provider===I.provider?m.id:"",placeholder:"Select Model",disabled:!I.apiKey||c===I.provider||f===I.provider&&u[I.provider]!==null})),Ht.default.createElement("div",{className:"tw-w-[72px]"},Ht.default.createElement(ge,{onClick:A,disabled:!m||m.provider!==I.provider||b,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},b?Ht.default.createElement(Yl,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Add"))),Ht.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},c===I.provider&&Ht.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),f===I.provider&&Ht.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed to load models.",u[I.provider]===null&&" Check API Key or network."),u[I.provider]&&u[I.provider].length===0&&Ht.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models available for this provider."),u[I.provider]===void 0&&f!==I.provider&&c!==I.provider&&Ht.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Click to load models or expand to try again if API key was changed."))))))))))),Ht.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end"},Ht.default.createElement(ge,{onClick:t},"Close")))}var Ife=class extends Db.Modal{constructor(e){super(e)}onOpen(){let{contentEl:e}=this;this.root=(0,LYt.createRoot)(e),this.root.render(Ht.default.createElement(qRn,{onClose:()=>this.close()}))}onClose(){this.root.unmount()}};Tn();var zRn={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus (beta)",project:"Projects (alpha)"},FYt=()=>{let t=Rn(),[e,r]=(0,Ge.useState)(!1),[n,o]=(0,Ge.useState)(t.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),i=async l=>{l!==t.embeddingModelKey&&new e2(app,async()=>{dt("embeddingModelKey",l),await ma.getInstance().indexVaultToVectorStore(!0)}).open()},a=()=>{r(!0);try{let l=n||"{$date}_{$time}__{$topic}",d=["{$date}","{$time}","{$topic}"].filter(g=>!l.includes(g));if(d.length>0){new t2.Notice(`Error: Missing required variables: ${d.join(", ")}`,4e3);return}let f=/[\\/:*?"<>|]/,p=l.replace(/\{\$date}/g,"").replace(/\{\$time}/g,"").replace(/\{\$topic}/g,"");if(f.test(p)){new t2.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:m}=Vl(new Date),b=l.replace("{$topic}","test topic name".slice(0,100).replace(/\s+/g,"_")).replace("{$date}",m.split("_")[0]).replace("{$time}",m.split("_")[1]);dt("defaultConversationNoteName",l),o(l),new t2.Notice(`Format applied successfully! Example: ${b}`,4e3)}catch(l){new t2.Notice(`Error applying format: ${l.message}`,4e3)}finally{r(!1)}},s=!!t.activeModels.find(l=>l.enabled&&kr(l)===t.defaultModelKey),u=t.activeModels.filter(l=>l.enabled).map(l=>({label:e9(l),value:kr(l)}));return Ge.default.createElement("div",{className:"tw-space-y-4"},Ge.default.createElement(NYt,null),Ge.default.createElement("section",null,Ge.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"General"),Ge.default.createElement("div",{className:"tw-space-y-4"},Ge.default.createElement("div",{className:"tw-space-y-4"},Ge.default.createElement(hn,{type:"custom",title:"API Keys",description:Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ge.default.createElement("span",{className:"tw-leading-none"},"Configure API keys for different AI providers"),Ge.default.createElement(vo,{delayDuration:0},Ge.default.createElement(Rt,null,Ge.default.createElement(jt,{asChild:!0},Ge.default.createElement(di,{className:"tw-size-4"})),Ge.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},Ge.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"API key required for chat and QA features"),Ge.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.")))))},Ge.default.createElement(ge,{onClick:()=>{new Ife(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",Ge.default.createElement(E3,{className:"tw-size-4"})))),Ge.default.createElement(hn,{type:"select",title:"Default Chat Model",description:"Select the Chat model to use",value:s?t.defaultModelKey:"Select Model",onChange:l=>{let c=t.activeModels.find(p=>p.enabled&&kr(p)===l);if(!c)return;let{hasApiKey:d,errorNotice:f}=hF(c,t);if(!d&&f){new t2.Notice(f);return}dt("defaultModelKey",l)},options:s?u:[{label:"Select Model",value:"Select Model"},...u],placeholder:"Model"}),Ge.default.createElement(hn,{type:"select",title:"Embedding Model",description:Ge.default.createElement("div",{className:"tw-space-y-2"},Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ge.default.createElement("span",{className:"tw-font-medium tw-leading-none tw-text-accent"},"Core Feature: Powers Semantic Search & QA"),Ge.default.createElement(vo,{delayDuration:0},Ge.default.createElement(Rt,null,Ge.default.createElement(jt,{asChild:!0},Ge.default.createElement(di,{className:"tw-size-4"})),Ge.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Ge.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 QA functionality. Changing the embedding model will:"),Ge.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Ge.default.createElement("li",null,"Require rebuilding your vault's vector index"),Ge.default.createElement("li",null,"Affect semantic search quality"),Ge.default.createElement("li",null,"Impact QA feature performance"))))))),value:t.embeddingModelKey,onChange:i,options:t.activeEmbeddingModels.map(l=>({label:e9(l),value:kr(l)})),placeholder:"Model"}),Ge.default.createElement(hn,{type:"select",title:"Default Mode",description:Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ge.default.createElement("span",{className:"tw-leading-none"},"Select the default chat mode"),Ge.default.createElement(vo,{delayDuration:0},Ge.default.createElement(Rt,null,Ge.default.createElement(jt,{asChild:!0},Ge.default.createElement(di,{className:"tw-size-4"})),Ge.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Ge.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",Ge.default.createElement("i",null,"Free to use with your own API key.")),Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",Ge.default.createElement("i",null,"Free to use with your own API key.")),Ge.default.createElement("li",null,Ge.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"," ",Ge.default.createElement("a",{href:GRe(FC.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:l=>dt("defaultChainType",l),options:Object.entries(zRn).map(([l,c])=>({label:c,value:l}))}),Ge.default.createElement(hn,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:l=>dt("defaultOpenArea",l),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),Ge.default.createElement(hn,{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:l=>dt("defaultSaveFolder",l),placeholder:"copilot-conversations"}),Ge.default.createElement(hn,{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:l=>dt("defaultConversationTag",l),placeholder:"ai-conversations"}),Ge.default.createElement(hn,{type:"custom",title:"Conversation Filename Template",description:Ge.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-1.5 "},Ge.default.createElement("span",{className:"tw-leading-none"},"Customize the format of saved conversation note names."),Ge.default.createElement(vo,{delayDuration:0},Ge.default.createElement(Rt,null,Ge.default.createElement(jt,{asChild:!0},Ge.default.createElement(di,{className:"tw-size-4"})),Ge.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},Ge.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Note: All the following variables must be included in the template."),Ge.default.createElement("div",null,Ge.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-muted"},"Available variables:"),Ge.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),Ge.default.createElement("i",{className:"tw-mt-2 tw-text-sm tw-text-muted"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]"))))))},Ge.default.createElement("div",{className:"tw-flex tw-w-[320px] tw-items-center tw-gap-1.5"},Ge.default.createElement(mo,{type:"text",className:_e("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:l=>o(l.target.value),disabled:e}),Ge.default.createElement(ge,{onClick:()=>a(),disabled:e,variant:"secondary"},e?Ge.default.createElement(Ge.default.Fragment,null,Ge.default.createElement(Yl,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Apply"):"Apply"))),Ge.default.createElement(hn,{type:"switch",title:"Autosave Chat",description:"Automatically saves the chat after every user message and AI response.",checked:t.autosaveChat,onCheckedChange:l=>dt("autosaveChat",l)}),Ge.default.createElement(hn,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:l=>dt("showSuggestedPrompts",l)}),Ge.default.createElement(hn,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:l=>dt("showRelevantNotes",l)}))))};ti();$r();Tn();nr();bn();var TL=require("obsidian"),Zn=F(X()),kYt=()=>{let t=Rn(),e=t.autocompleteAcceptKey||Nh.KEYBIND,[r,n]=(0,Zn.useState)(!1),o=[{value:"Tab",label:"Tab"},{value:"Space",label:"Space"},{value:"ArrowRight",label:"Right Arrow"}],i=u=>{dt("autocompleteAcceptKey",u),new TL.Notice(`Autocomplete accept key set to: ${u}`)},a=()=>{dt("autocompleteAcceptKey",Nh.KEYBIND),new TL.Notice(`Autocomplete accept key reset to: ${Nh.KEYBIND}`)},s=async()=>{if(!r){n(!0),new TL.Notice("Rebuilding word index...");try{let l=await AD.getInstance(app.vault).rescan(c=>{c.processedFiles===c.totalFiles&&new TL.Notice(`Word index complete! Found ${c.foundWords} words from ${c.processedFiles} files.`)});new TL.Notice(`Word index rebuilt successfully! ${l.wordCount} unique words indexed.`)}catch(u){console.error("Failed to refresh word index:",u),new TL.Notice("Failed to refresh word index. Check console for details.")}finally{n(!1)}}};return Zn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Zn.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4"},Zn.default.createElement("div",{className:"tw-flex tw-items-center tw-py-4"},Zn.default.createElement(cm,{variant:"secondary",className:"tw-text-accent"},"Plus Required")),Zn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Zn.default.createElement(hn,{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=>{dt("includeActiveNoteAsContext",u)}}),Zn.default.createElement(hn,{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=>{dt("passMarkdownImages",u)}}),Zn.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autocomplete"),Zn.default.createElement(hn,{type:"switch",title:"Sentence Autocomplete",description:Zn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Zn.default.createElement("span",{className:"tw-leading-none"},"Enable AI-powered sentence autocomplete suggestions while typing")),checked:t.enableAutocomplete,onCheckedChange:u=>dt("enableAutocomplete",u)}),Zn.default.createElement(hn,{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=>{dt("enableWordCompletion",u)}}),Zn.default.createElement(hn,{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."},Zn.default.createElement(ge,{onClick:s,disabled:r,className:"tw-flex tw-items-center tw-gap-2"},Zn.default.createElement(m_,{className:_e("tw-size-4",r&&"tw-animate-spin")}),r?"Rebuilding...":"Refresh Word Index")),Zn.default.createElement(hn,{type:"custom",title:"Autocomplete Accept Suggestion Key",description:Zn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Zn.default.createElement("span",{className:"tw-leading-none"},"The key used to accept autocomplete suggestions"),Zn.default.createElement(vo,{delayDuration:0},Zn.default.createElement(Rt,null,Zn.default.createElement(jt,{asChild:!0},Zn.default.createElement(di,{className:"tw-size-4"})),Zn.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Zn.default.createElement("div",{className:"tw-text-sm tw-text-muted"},'Select the key you want to use for accepting suggestions. Default is "Tab".')))))},Zn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Zn.default.createElement(Hz,{value:e,onValueChange:i},Zn.default.createElement(fL,{className:"tw-w-[180px]"},Zn.default.createElement(Vz,{placeholder:"Select key"})),Zn.default.createElement(pL,null,o.map(u=>Zn.default.createElement(mL,{key:u.value,value:u.value},u.label)))),e&&e!==Nh.KEYBIND&&Zn.default.createElement(ge,{variant:"ghost",onClick:a,className:"tw-h-8 tw-text-xs"},"Reset to Default"))),Zn.default.createElement(hn,{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=>{dt("allowAdditionalContext",u)}}))))};$r();pN();yo();nr();var Le=F(X());nr();$r();yn();var nK=require("obsidian");ti();bn();var Eqe=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=Wz(),a=ue(),s=o?"openai":"openai",[u,l]=(0,Le.useState)(null),[c,d]=(0,Le.useState)(!1),[f,p]=(0,Le.useState)(!1),[m,h]=(0,Le.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1}),b=(D,B)=>{h(q=>({...q,[D]:B}))},g=()=>{h({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1})},y=()=>{let D=!0,B={...m};return B.name=!O.name,O.name||(D=!1),O.provider==="azure openai"&&(B.instanceName=!O.azureOpenAIApiInstanceName,B.apiVersion=!O.azureOpenAIApiVersion,o?(B.embeddingDeploymentName=!O.azureOpenAIApiEmbeddingDeploymentName,O.azureOpenAIApiEmbeddingDeploymentName||(D=!1)):(B.deploymentName=!O.azureOpenAIApiDeploymentName,O.azureOpenAIApiDeploymentName||(D=!1)),(!O.azureOpenAIApiInstanceName||!O.azureOpenAIApiVersion)&&(D=!1)),h(B),D},S=D=>a[Qb[D]]||"",x=(D=s)=>{let B={name:"",provider:D,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:S(D),isEmbeddingModel:o,capabilities:[]};return o?B:{...B,stream:!0}},[O,P]=(0,Le.useState)(x()),E=D=>({...D,name:D.name?.trim(),baseUrl:D.baseUrl?.trim(),apiKey:D.apiKey?.trim(),openAIOrgId:D.openAIOrgId?.trim(),azureOpenAIApiInstanceName:D.azureOpenAIApiInstanceName?.trim(),azureOpenAIApiDeploymentName:D.azureOpenAIApiDeploymentName?.trim(),azureOpenAIApiEmbeddingDeploymentName:D.azureOpenAIApiEmbeddingDeploymentName?.trim(),azureOpenAIApiVersion:D.azureOpenAIApiVersion?.trim()}),[A,I]=(0,Le.useState)(Xb(s)),R=()=>!!(O.name&&O.provider),N=()=>f||!R(),j=()=>{if(!y()){new nK.Notice("Please fill in all required fields");return}let D=E(O);r(D),e(!1),P(x()),g()},$=D=>{I(Xb(D)),P({...O,provider:D,apiKey:S(D),...D==="openai"?{openAIOrgId:a.openAIOrgId}:{},...D==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{}})},k=D=>{D||(P(x()),g(),d(!1)),e(D)},z=async()=>{if(!y()){new nK.Notice("Please fill in all required fields");return}p(!0);try{let D=E(O);await n(D),new nK.Notice("Model verification successful!")}catch(D){console.error(D);let B=ei(D);new nK.Notice("Model verification failed: "+B)}finally{p(!1)}},V=()=>{let B=(()=>{switch(O.provider){case"openai":return Le.default.createElement(Yn,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},Le.default.createElement(mo,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:O.openAIOrgId||"",onChange:q=>P({...O,openAIOrgId:q.target.value})}));case"azure openai":return Le.default.createElement(Le.default.Fragment,null,Le.default.createElement(Yn,{label:"Instance Name",required:!0,error:m.instanceName,errorMessage:"Instance name is required"},Le.default.createElement(mo,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:O.azureOpenAIApiInstanceName||"",onChange:q=>{P({...O,azureOpenAIApiInstanceName:q.target.value}),b("instanceName",!1)}})),o?Le.default.createElement(Yn,{label:"Embedding Deployment Name",required:!0,error:m.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},Le.default.createElement(mo,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:O.azureOpenAIApiEmbeddingDeploymentName||"",onChange:q=>{P({...O,azureOpenAIApiEmbeddingDeploymentName:q.target.value}),b("embeddingDeploymentName",!1)}})):Le.default.createElement(Yn,{label:"Deployment Name",required:!0,error:m.deploymentName,errorMessage:"Deployment name is required",description:"This is your actual model, no need to pass a model name separately."},Le.default.createElement(mo,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:O.azureOpenAIApiDeploymentName||"",onChange:q=>{P({...O,azureOpenAIApiDeploymentName:q.target.value}),b("deploymentName",!1)}})),Le.default.createElement(Yn,{label:"API Version",required:!0,error:m.apiVersion,errorMessage:"API version is required"},Le.default.createElement(mo,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:O.azureOpenAIApiVersion||"",onChange:q=>{P({...O,azureOpenAIApiVersion:q.target.value}),b("apiVersion",!1)}})));default:return null}})();return B?Le.default.createElement(cE,{open:c,onOpenChange:d,className:"tw-space-y-2 tw-rounded-lg tw-border tw-pt-4"},Le.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},Le.default.createElement(ip,null,"Additional ",kf(O.provider)," Settings"),Le.default.createElement(rL,{asChild:!0},Le.default.createElement(ge,{variant:"ghost",size:"sm",className:"tw-w-9 tw-p-0"},Le.default.createElement(Hi,{className:"tw-size-4"}),Le.default.createElement("span",{className:"tw-sr-only"},"Toggle")))),Le.default.createElement(dE,{className:"tw-max-h-[200px] tw-space-y-4 tw-overflow-y-auto tw-pb-0.5 tw-pl-0.5 tw-pr-2"},B)):null},Q=()=>{if(O.provider!=="azure openai")return A.host;let D=O.azureOpenAIApiInstanceName||"[instance]",B=o?O.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":O.azureOpenAIApiDeploymentName||"[deployment]",q=O.azureOpenAIApiVersion||"[api-version]";return`https://${D}.openai.azure.com/openai/deployments/${B}/${o?"embeddings":"chat/completions"}?api-version=${q}`},J=Object.entries(WE).map(([D,B])=>({id:D,label:D.charAt(0).toUpperCase()+D.slice(1),description:B}));return Le.default.createElement(Tfe,{open:t,onOpenChange:k},Le.default.createElement(X9,{className:"sm:tw-max-w-[425px]",container:i,ref:D=>l(D)},Le.default.createElement(Q9,null,Le.default.createElement(eK,null,"Add Custom ",o?"Embedding":"Chat"," Model"),Le.default.createElement(tK,null,"Add a new model to your collection.")),Le.default.createElement("div",{className:"tw-space-y-3"},Le.default.createElement(Yn,{label:"Model Name",required:!0,error:m.name,errorMessage:"Model name is required"},Le.default.createElement(mo,{type:"text",placeholder:`Enter model name (e.g. ${o?"text-embedding-3-small":"gpt-4"})`,value:O.name,onChange:D=>{P({...O,name:D.target.value}),b("name",!1)}})),Le.default.createElement(Yn,{label:Le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Le.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Le.default.createElement(vo,{delayDuration:0},Le.default.createElement(Rt,null,Le.default.createElement(jt,{asChild:!0},Le.default.createElement(di,{className:"tw-size-4"})),Le.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},Le.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Le.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Le.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Le.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Le.default.createElement("li",null,"Direct-Paid:Ds-r1"),Le.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Le.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Le.default.createElement(mo,{type:"text",placeholder:"Custom display name (optional)",value:O.displayName||"",onChange:D=>{P({...O,displayName:D.target.value})}})),Le.default.createElement(Yn,{label:"Provider"},Le.default.createElement(Hz,{value:O.provider,onValueChange:$},Le.default.createElement(fL,null,Le.default.createElement(Vz,{placeholder:"Select provider"})),Le.default.createElement(pL,{container:u},Object.values(o?l4(HE,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):l4(LC,["COPILOT_PLUS"])).map(D=>Le.default.createElement(mL,{key:D,value:D},kf(D)))))),Le.default.createElement(Yn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Le.default.createElement(mo,{type:"text",placeholder:Q()||"https://api.example.com/v1",value:O.baseUrl||"",onChange:D=>P({...O,baseUrl:D.target.value})})),Le.default.createElement(Yn,{label:"API Key"},Le.default.createElement(aC,{placeholder:`Enter ${A.label} API Key`,value:O.apiKey||"",onChange:D=>P({...O,apiKey:D})}),A.keyManagementURL&&Le.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Le.default.createElement("a",{href:A.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",A.label," API Key"))),Le.default.createElement(Yn,{label:Le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Le.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Le.default.createElement(vo,{delayDuration:0},Le.default.createElement(Rt,null,Le.default.createElement(jt,{asChild:!0},Le.default.createElement(di,{className:"tw-size-4"})),Le.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},Le.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},Le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},J.map(({id:D,label:B,description:q})=>Le.default.createElement("div",{key:D,className:"tw-flex tw-items-center tw-gap-2"},Le.default.createElement(wd,{id:D,checked:O.capabilities?.includes(D),onCheckedChange:K=>{let H=O.capabilities||[];P({...O,capabilities:K?[...H,D]:H.filter(ee=>ee!==D)})}}),Le.default.createElement(ip,{htmlFor:D,className:"tw-text-sm"},Le.default.createElement(vo,{delayDuration:0},Le.default.createElement(Rt,null,Le.default.createElement(jt,{asChild:!0},Le.default.createElement("span",null,B)),Le.default.createElement(Mt,{side:"bottom"},q)))))))),V()),Le.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-gap-4"},Le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Le.default.createElement(wd,{id:"enable-cors",checked:O.enableCors||!1,onCheckedChange:D=>P({...O,enableCors:D})}),Le.default.createElement(ip,{htmlFor:"enable-cors",className:"tw-text-sm"},Le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Le.default.createElement("span",null,"Enable CORS"),Le.default.createElement(vo,{delayDuration:0},Le.default.createElement(Rt,null,Le.default.createElement(jt,{asChild:!0},Le.default.createElement(di,{className:"tw-size-4"})),Le.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},Le.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only check this option when prompted that CORS is needed"))))))),Le.default.createElement("div",{className:"tw-flex tw-gap-2"},Le.default.createElement(ge,{variant:"secondary",onClick:j,disabled:N()},"Add Model"),Le.default.createElement(ge,{variant:"secondary",onClick:z,disabled:N()},f?Le.default.createElement(Le.default.Fragment,null,Le.default.createElement(Yl,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Verify"):"Verify")))))};$r();nr();yn();bn();var $Yt=require("obsidian"),Ie=F(X()),BYt=F(Dc()),HRn=({model:t,onUpdate:e,onCancel:r,isEmbeddingModel:n})=>{let[o,i]=(0,Ie.useState)(t),[a,s]=(0,Ie.useState)(t),[u,l]=(0,Ie.useState)({}),c=ue(),d=y=>c[Qb[y]]||"";(0,Ie.useEffect)(()=>{i(t),s(t),t.provider&&l(Xb(t.provider))},[t]);let f=(0,Ie.useMemo)(()=>rJ((y,S)=>{e(n,y,S)},500),[n,e]),p=(0,Ie.useCallback)((y,S)=>{i(x=>{let O={...x,[y]:S};return f(a,O),O})},[a,f]);if(!o)return null;let m=()=>{if(!o||!o.provider||o.provider!=="azure-openai")return u.host||"https://api.example.com/v1";let y=o.azureOpenAIApiInstanceName||"[instance]",S=o.isEmbeddingModel?o.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":o.azureOpenAIApiDeploymentName||"[deployment]",x=o.azureOpenAIApiVersion||"[api-version]",O=o.isEmbeddingModel?"embeddings":"chat/completions";return`https://${y}.openai.azure.com/openai/deployments/${S}/${O}?api-version=${x}`},h=Object.entries(WE).map(([y,S])=>({id:y,label:y.charAt(0).toUpperCase()+y.slice(1),description:S})),b=o.apiKey||d(o.provider),g=!n&&o.provider!=="copilot-plus-jina";return Ie.default.createElement("div",{className:"tw-space-y-3 tw-p-4"},Ie.default.createElement("div",{className:"tw-mb-4"},Ie.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"Model Settings - ",o.name),Ie.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Customize model parameters")),Ie.default.createElement("div",{className:"tw-space-y-3"},Ie.default.createElement(Yn,{label:"Model Name",required:!0},Ie.default.createElement(mo,{type:"text",disabled:o.core,value:o.name,onChange:y=>p("name",y.target.value),placeholder:"Enter model name"})),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ie.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4"})),Ie.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},Ie.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Ie.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Ie.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Ie.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Ie.default.createElement("li",null,"Direct-Paid:Ds-r1"),Ie.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Ie.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Ie.default.createElement(mo,{type:"text",placeholder:"Custom display name (optional)",value:o.displayName||"",onChange:y=>p("displayName",y.target.value)})),Ie.default.createElement(Yn,{label:"Provider"},Ie.default.createElement(mo,{type:"text",value:kf(o.provider),disabled:!0})),Ie.default.createElement(Yn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Ie.default.createElement(mo,{type:"text",placeholder:m(),value:o.baseUrl||"",onChange:y=>p("baseUrl",y.target.value)})),Ie.default.createElement(Yn,{label:"API Key"},Ie.default.createElement(aC,{placeholder:`Enter ${u.label||"Provider"} API Key`,value:b,onChange:y=>p("apiKey",y)}),u.keyManagementURL&&Ie.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Ie.default.createElement("a",{href:u.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",u.label," API Key"))),g&&Ie.default.createElement(Ie.default.Fragment,null,Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ie.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4"})),Ie.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},Ie.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},h.map(({id:y,label:S,description:x})=>Ie.default.createElement("div",{key:y,className:"tw-flex tw-items-center tw-gap-2"},Ie.default.createElement(wd,{id:y,checked:o.capabilities?.includes(y),onCheckedChange:O=>{let P=o.capabilities||[],E=O?[...P,y]:P.filter(A=>A!==y);p("capabilities",E)}}),Ie.default.createElement(ip,{htmlFor:y,className:"tw-text-sm"},Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement("span",null,S)),Ie.default.createElement(Mt,{side:"bottom"},x)))))))),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Token limit",Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Ie.default.createElement(Mt,{side:"bottom"},Ie.default.createElement("div",{className:"tw-w-[300px]"},Ie.default.createElement("p",null,"The maximum number of ",Ie.default.createElement("em",null,"output tokens")," to generate. Default is"," ",jh.MAX_TOKENS,"."),Ie.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model."))))))},Ie.default.createElement(oC,{value:o.maxTokens??c.maxTokens??jh.MAX_TOKENS,onChange:y=>p("maxTokens",y),min:0,max:65e3,step:100})),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Temperature",Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Ie.default.createElement(Mt,{side:"bottom"},Ie.default.createElement("div",{className:"tw-max-w-[300px]"},"Default is ",jh.TEMPERATURE,". Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.")))))},Ie.default.createElement(oC,{value:o.temperature??c.temperature??jh.TEMPERATURE,onChange:y=>p("temperature",y),max:2,min:0,step:.05})),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Top-P",Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Ie.default.createElement(Mt,{side:"bottom"},Ie.default.createElement("div",{className:"tw-w-[300px]"},"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 Al's vocabulary, the more diverse")))))},Ie.default.createElement(oC,{value:o.topP??.9,onChange:y=>p("topP",y),max:1,min:0,step:.05})),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Frequency Penalty",Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Ie.default.createElement(Mt,{side:"bottom"},Ie.default.createElement("div",{className:"tw-w-[300px]"},Ie.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."),Ie.default.createElement("em",null,"The higher the value, the more the model is penalized for repeating words."))))))},Ie.default.createElement(oC,{value:o.frequencyPenalty??0,onChange:y=>p("frequencyPenalty",y),max:2,min:0,step:.05})))))},Mfe=class extends $Yt.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,BYt.createRoot)(r);let n=(i,a,s)=>{this.onUpdate(i,a,s)},o=()=>{this.close()};this.root.render(Ie.default.createElement(HRn,{model:this.model,isEmbeddingModel:this.isEmbeddingModel,onUpdate:n,onCancel:o}))}onClose(){this.root.unmount()}};ti();$r();Tn();nr();yn();bn();var Me=F(X());var VRn={reasoning:{icon:tO,color:"tw-text-model-capabilities-blue",tooltip:WE.reasoning},vision:{icon:eO,color:"tw-text-model-capabilities-green",tooltip:WE.vision},websearch:{icon:l1,color:"tw-text-model-capabilities-blue",tooltip:WE.websearch}},WRn=["reasoning","vision","websearch"],KRn=t=>Me.default.createElement(vo,{delayDuration:0},Me.default.createElement("div",{className:"tw-mx-auto tw-grid tw-w-16 tw-grid-cols-3 tw-gap-1"},WRn.map(e=>{let r=VRn[e];if(!r)return Me.default.createElement("div",{key:e,className:"tw-w-4"});let n=r.icon;return t.capabilities?.includes(e)?Me.default.createElement(Rt,{key:e},Me.default.createElement(jt,{asChild:!0},Me.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},Me.default.createElement(n,{className:_e("tw-size-4",r.color)}))),Me.default.createElement(Mt,{side:"bottom"},r.tooltip)):Me.default.createElement("div",{key:e,className:"tw-flex tw-items-center tw-justify-center"},Me.default.createElement("div",{className:"tw-size-4"}))}))),GRn=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,id:i})=>{let[a,s]=Me.default.useState(!1),u=Y9(),{attributes:l,listeners:c,setNodeRef:d,transform:f,transition:p,isDragging:m}=J9({id:i,disabled:t.core}),h={transform:Rb.Transform.toString(f),transition:p};return Me.default.createElement(g9,{ref:d,style:h,className:_e("tw-mb-2",m&&["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")},Me.default.createElement(y9,{className:"tw-p-3"},Me.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},!t.core&&Me.default.createElement("div",{className:"tw-mr-2 tw-cursor-grab tw-touch-none active:tw-cursor-grabbing",...l,...c},Me.default.createElement(d_,{className:"tw-size-4"})),Me.default.createElement("div",{className:"tw-flex-1 tw-cursor-pointer",onClick:()=>s(!a)},Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement("div",{className:"tw-flex tw-size-3 tw-items-center tw-justify-center"},a?Me.default.createElement(Hi,{className:"tw-size-3 tw-stroke-[7]"}):Me.default.createElement(XC,{className:"tw-size-3 tw-stroke-[7]"})),Me.default.createElement("div",null,Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Me.default.createElement("span",{className:"tw-font-medium"},t.displayName||t.name),t.capabilities&&t.capabilities.length>0&&Me.default.createElement(Ake,{capabilities:t.capabilities,iconSize:14})),Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement("span",{className:"tw-bg-secondary tw-text-sm tw-text-muted"},kf(t.provider,t)))))),Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},e&&Me.default.createElement(ge,{variant:"ghost",size:"icon",onClick:b=>{b.stopPropagation(),e(t)}},Me.default.createElement(ik,{className:"tw-size-4"})),Me.default.createElement(YD,null,Me.default.createElement(ZD,{asChild:!0},Me.default.createElement(ge,{variant:"ghost",size:"icon"},Me.default.createElement(QC,{className:"tw-size-4"}))),Me.default.createElement(xb,{align:"end",container:u},e&&Me.default.createElement(Si,{onClick:b=>{b.stopPropagation(),e(t)}},Me.default.createElement(ok,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&Me.default.createElement(Si,{onClick:b=>{b.stopPropagation(),r(t)}},Me.default.createElement(Ty,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&Me.default.createElement(Si,{onClick:b=>{b.stopPropagation(),n(kr(t))},className:"tw-text-error"},Me.default.createElement(Rm,{className:"tw-mr-2 tw-size-4"}),"Delete")))))),Me.default.createElement("div",{className:_e("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")},Me.default.createElement(b9,{className:"tw-p-3 tw-pt-0"},Me.default.createElement("div",{className:"tw-flex tw-justify-around"},!t.isEmbeddingModel&&Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement("span",{className:"tw-text-sm"},"Enabled"),Me.default.createElement(wd,{checked:t.enabled,onCheckedChange:b=>o({...t,enabled:b})})),Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement("span",{className:"tw-text-sm"},"CORS"),Me.default.createElement(wd,{checked:t.enableCors,onCheckedChange:b=>o({...t,enableCors:b})}))))))},JRn=({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}=J9({id:kr(t),disabled:t.core}),f=Y9(),p={transform:Rb.Transform.toString(l),transition:c},m=e||!t.core||r&&!t.core;return Me.default.createElement(BM,{ref:u,style:p,className:_e("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")},Me.default.createElement(gf,{className:"tw-w-6 tw-px-2"},!t.core&&Me.default.createElement(ge,{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},Me.default.createElement(d_,{className:"tw-size-4 tw-transition-colors"}))),Me.default.createElement(gf,{className:"tw-pl-0"},t.displayName||t.name),Me.default.createElement(gf,null,kf(t.provider,t)),Me.default.createElement(gf,null,KRn(t)),!i&&Me.default.createElement(gf,{className:"tw-text-center"},Me.default.createElement(wd,{id:`${kr(t)}-enabled`,checked:t.enabled,onCheckedChange:h=>o({...t,enabled:h}),className:"tw-mx-auto"})),Me.default.createElement(gf,{className:"tw-text-center"},Me.default.createElement(wd,{id:`${kr(t)}-enableCors`,checked:t.enableCors,onCheckedChange:h=>o({...t,enableCors:h}),className:"tw-mx-auto"})),Me.default.createElement(gf,{className:"tw-text-center"},Me.default.createElement("div",{className:"tw-flex tw-justify-center tw-gap-2"},e&&Me.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},Me.default.createElement(ik,{className:"tw-size-4"})),m&&Me.default.createElement(YD,null,Me.default.createElement(ZD,{asChild:!0},Me.default.createElement(ge,{variant:"ghost",size:"icon"},Me.default.createElement(QC,{className:"tw-size-4"}))),Me.default.createElement(xb,{align:"end",container:f},e&&Me.default.createElement(Si,{onClick:()=>e(t)},Me.default.createElement(ok,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&Me.default.createElement(Si,{onClick:()=>r(t)},Me.default.createElement(Ty,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&Me.default.createElement(Si,{onClick:()=>n(kr(t)),className:"tw-text-error"},Me.default.createElement(Rm,{className:"tw-mr-2 tw-size-4"}),"Delete"))))))},Tqe=({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=gfe(Xz(VM),Xz(HM,{coordinateGetter:xfe})),d=t.findIndex(h=>!h.core),f=h=>b=>{let{transform:g,active:y,activeNodeRect:S,over:x}=b;if(!y||!S)return g;let O=t.findIndex(R=>kr(R)===y.id),P=t.filter(R=>!R.core).length,E=S.height,A=(d-O)*E,I=(d+P-1-O)*E;if(h&&x){let R=t.findIndex(j=>kr(j)===x.id);if(t[R].core||R{let{active:b,over:g}=h;if(g&&b.id!==g.id){let y=t.findIndex(P=>kr(P)===b.id),S=t.findIndex(P=>kr(P)===g.id),x=t[S];if(SMe.default.createElement("div",{className:"tw-relative md:tw-hidden"},Me.default.createElement(W9,{sensors:c,collisionDetection:H9,onDragEnd:p,modifiers:[f(!0)]},Me.default.createElement(G9,{items:t.map(h=>kr(h)),strategy:K9},Me.default.createElement("div",{className:"tw-relative tw-space-y-2"},t.map(h=>Me.default.createElement(GRn,{key:kr(h),id:kr(h),model:h,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i}))))));return Me.default.createElement("div",{className:"tw-mb-4"},Me.default.createElement("div",{className:"tw-hidden md:tw-block"},Me.default.createElement(W9,{sensors:c,collisionDetection:H9,onDragEnd:p,modifiers:[f(!1)]},Me.default.createElement("div",{className:"tw-relative tw-overflow-hidden"},Me.default.createElement(N9,null,Me.default.createElement(D9,null,Me.default.createElement(BM,null,Me.default.createElement(ap,{className:"tw-w-6 tw-px-2"}),Me.default.createElement(ap,{className:"tw-pl-0"},"Model"),Me.default.createElement(ap,null,"Provider"),Me.default.createElement(ap,{className:"tw-text-center"},"Capabilities"),!l&&Me.default.createElement(ap,{className:"tw-text-center"},"Enable"),Me.default.createElement(ap,{className:"tw-text-center"},"CORS"),Me.default.createElement(ap,{className:"tw-w-[100px] tw-text-center"},"Actions"))),Me.default.createElement(L9,{className:"tw-relative"},Me.default.createElement(G9,{items:t.map(h=>kr(h)),strategy:K9},t.map(h=>Me.default.createElement(JRn,{key:kr(h),model:h,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i,isEmbeddingModel:l})))))))),m(),Me.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end tw-gap-2"},s&&Me.default.createElement(ge,{onClick:s,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement(m_,{className:"tw-size-4"}),"Refresh Built-in Models"),Me.default.createElement(ge,{onClick:o,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement(Mm,{className:"tw-size-4"}),"Add Custom Model")))};yn();var Rfe=require("obsidian"),up=F(X()),qYt=()=>{let t=Rn(),[e,r]=(0,up.useState)(!1),[n,o]=(0,up.useState)(!1),i=(h,b=!1)=>{let g={...l4(h,["isBuiltIn","core","projectEnabled","plusExclusive","believerExclusive","capabilities","displayName","dimensions"]),name:`${h.name} (copy)`},y=b?"activeEmbeddingModels":"activeModels";dt(y,[...t[y],g])},a=(h,b=!1)=>{dt(b?"activeEmbeddingModels":"activeModels",h)},s=h=>{let[b,g]=h.split("|"),y=t.activeModels.filter(x=>!(x.name===b&&x.provider===g)),S=t.defaultModelKey;if(h===t.defaultModelKey){let x=y.find(O=>O.enabled);S=x?`${x.name}|${x.provider}`:""}zE({activeModels:y,defaultModelKey:S})},u=(h,b,g)=>{let y=h?"activeEmbeddingModels":"activeModels",S=t[y].findIndex(x=>x.name===b.name&&x.provider===b.provider);if(S!==-1){let x=[...t[y]];x[S]=g,dt(y,x)}else new Rfe.Notice("Could not find model to update"),fe("Could not find model to update:",b)},l=h=>{let b=t.activeModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);dt("activeModels",b)},c=h=>{let[b,g]=h.split("|"),y=t.activeEmbeddingModels.filter(S=>!(S.name===b&&S.provider===g));dt("activeEmbeddingModels",y)},d=h=>{let b=t.activeEmbeddingModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);dt("activeEmbeddingModels",b)},f=()=>{let h=t.activeModels.filter(g=>!g.isBuiltIn),b=[...Zb,...h];dt("activeModels",b),new Rfe.Notice("Chat models refreshed successfully")},p=()=>{let h=t.activeEmbeddingModels.filter(g=>!g.isBuiltIn),b=[...jR,...h];dt("activeEmbeddingModels",b),new Rfe.Notice("Embedding models refreshed successfully")},m=(h,b=!1)=>{new Mfe(app,h,b,u).open()};return up.default.createElement("div",{className:"tw-space-y-4"},up.default.createElement("section",null,up.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Chat Models"),up.default.createElement(Tqe,{models:t.activeModels,onEdit:h=>m(h),onCopy:h=>i(h),onDelete:s,onAdd:()=>r(!0),onUpdateModel:l,onReorderModels:h=>a(h),onRefresh:f,title:"Chat Model"}),up.default.createElement(Eqe,{open:e,onOpenChange:r,onAdd:h=>{let b=[...t.activeModels,h];dt("activeModels",b)},ping:h=>ac.instance.getCurrentChainManager().chatModelManager.ping(h)}),up.default.createElement("div",{className:"tw-space-y-4"},up.default.createElement(hn,{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:h=>dt("contextTurns",h),min:1,max:50,step:1}))),up.default.createElement("section",null,up.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Embedding Models"),up.default.createElement(Tqe,{models:t.activeEmbeddingModels,onEdit:h=>m(h,!0),onDelete:c,onCopy:h=>i(h,!0),onAdd:()=>o(!0),onUpdateModel:d,onReorderModels:h=>a(h,!0),onRefresh:p,title:"Embedding Model"}),up.default.createElement(Eqe,{open:n,onOpenChange:o,onAdd:h=>{let b=[...t.activeEmbeddingModels,h];dt("activeEmbeddingModels",b)},isEmbeddingModel:!0,ping:h=>Xs.getInstance().ping(h)})))};var WYt=require("obsidian");ti();var Pn=F(X()),KYt=F(Dc());_g();bn();var UYt=require("obsidian"),sy=F(X()),zYt=F(Dc());ti();function YRn({onConfirm:t,onCancel:e}){let[r,n]=(0,sy.useState)(""),[o,i]=(0,sy.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return sy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},sy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},sy.default.createElement(mo,{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&&sy.default.createElement("p",{className:"tw-text-sm tw-text-error"},o)),sy.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},sy.default.createElement(ge,{variant:"secondary",onClick:e},"Cancel"),sy.default.createElement(ge,{variant:"default",onClick:()=>a(r)},"Confirm")))}var jfe=class extends UYt.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,zYt.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(sy.default.createElement(YRn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var HYt=require("obsidian"),Lb=F(X()),VYt=F(Dc());ti();function ZRn({onConfirm:t,onCancel:e}){let[r,n]=(0,Lb.useState)("");return Lb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Lb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Lb.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"),Lb.default.createElement(mo,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),Lb.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Lb.default.createElement(ge,{variant:"secondary",onClick:e},"Cancel"),Lb.default.createElement(ge,{variant:"default",onClick:()=>t(r)},"Confirm")))}var Nfe=class extends HYt.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,VYt.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(Lb.default.createElement(ZRn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};function Dfe({title:t,patterns:e,onRemove:r}){return Pn.default.createElement("div",{className:"tw-grid tw-grid-cols-4 tw-gap-2"},Pn.default.createElement("div",{className:"tw-font-bold"},t),Pn.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=>Pn.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"},Pn.default.createElement(TM,{className:"tw-flex-1"},n),Pn.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>r(n)},Pn.default.createElement(Vi,{className:"tw-size-4"}))))))}function XRn({value:t,onUpdate:e,container:r}){let[n,o]=(0,Pn.useState)(t),i=bg(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=$8(i),c=f=>{let p=B8({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 Pn.default.createElement("div",{className:"tw-mt-2 tw-flex tw-flex-col tw-gap-4"},Pn.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&&Pn.default.createElement("div",{className:"tw-text-center tw-text-sm"},"No patterns specified"),a.length>0&&Pn.default.createElement(Dfe,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(m=>m!==f);c({tagPatterns:p})}}),s.length>0&&Pn.default.createElement(Dfe,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(m=>m!==f);c({extensionPatterns:p})}}),u.length>0&&Pn.default.createElement(Dfe,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(m=>m!==f);c({folderPatterns:p})}}),l.length>0&&Pn.default.createElement(Dfe,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(m=>m!==f);c({notePatterns:p})}})),Pn.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Pn.default.createElement(YD,null,Pn.default.createElement(ZD,{asChild:!0},Pn.default.createElement(ge,{variant:"secondary"},"Add...")),Pn.default.createElement(xb,{align:"start",container:r},Pn.default.createElement(Si,{onSelect:()=>{new xz(app,f=>{let p=tie(f);a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(f1,{className:"tw-size-4"}),"Tag")),Pn.default.createElement(Si,{onSelect:()=>{new Sz(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(Iy,{className:"tw-size-4"}),"Folder")),Pn.default.createElement(Si,{onSelect:()=>{new SM({app,onNoteSelect:f=>{let p=q8(f);l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(Ay,{className:"tw-size-4"}),"Note")),Pn.default.createElement(Si,{onSelect:()=>{new jfe(app,f=>{let p=t1t(f);s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(C3,{className:"tw-size-4"}),"Extension")),Pn.default.createElement(Si,{onSelect:()=>{new Nfe(app,f=>{let p=bg(f),{tagPatterns:m,extensionPatterns:h,folderPatterns:b,notePatterns:g}=$8(p);c({tagPatterns:[...a,...m],extensionPatterns:[...s,...h],folderPatterns:[...u,...b],notePatterns:[...l,...g]})}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(p1,{className:"tw-size-4"}),"Custom"))))))}var oK=class extends WYt.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,KYt.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(Pn.default.createElement(XRn,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};ti();$r();Mx();nr();bn();var zr=F(X()),GYt=()=>{let t=Rn(),e=r=>{let n=parseInt(r);n!==t.numPartitions&&new e2(app,async()=>{dt("numPartitions",n),await ma.getInstance().indexVaultToVectorStore(!0)}).open()};return zr.default.createElement("div",{className:"tw-space-y-4"},zr.default.createElement("section",null,zr.default.createElement("div",{className:"tw-space-y-4"},zr.default.createElement(hn,{type:"select",title:"Auto-Index Strategy",description:zr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},zr.default.createElement("span",{className:"tw-leading-none"},"Decide when you want the vault to be indexed."),zr.default.createElement(vo,{delayDuration:0},zr.default.createElement(Rt,null,zr.default.createElement(jt,{asChild:!0},zr.default.createElement(di,{className:"tw-size-4"})),zr.default.createElement(Mt,null,zr.default.createElement("div",{className:"tw-space-y-2 tw-py-2"},zr.default.createElement("div",{className:"tw-space-y-1"},zr.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Choose when to index your vault:"),zr.default.createElement("ul",{className:"tw-list-disc tw-space-y-1 tw-pl-2 tw-text-sm"},zr.default.createElement("li",null,zr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},zr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"NEVER:"),zr.default.createElement("span",null,"Manual indexing via command or refresh only"))),zr.default.createElement("li",null,zr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},zr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON STARTUP:"),zr.default.createElement("span",null,"Index updates when plugin loads or reloads"))),zr.default.createElement("li",null,zr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},zr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON MODE SWITCH:"),zr.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),zr.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=>{dt("indexVaultToVectorStore",r)},options:EVe.map(r=>({label:r,value:r})),placeholder:"Strategy"}),zr.default.createElement(hn,{type:"slider",title:"Max Sources",description:"Copilot goes through your vault to find relevant blocks and passes the top N blocks to the LLM. Default for N is 3. Increase if you want more sources included in the answer generation step.",min:1,max:128,step:1,value:t.maxSourceChunks,onChange:r=>dt("maxSourceChunks",r)}),zr.default.createElement(hn,{type:"slider",title:"Requests per Minute",description:"Default is 90. Decrease if you are rate limited by your embedding provider.",min:10,max:300,step:10,value:t.embeddingRequestsPerMin,onChange:r=>dt("embeddingRequestsPerMin",r)}),zr.default.createElement(hn,{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=>dt("embeddingBatchSize",r)}),zr.default.createElement(hn,{type:"select",title:"Number of Partitions",description:"Number of partitions for Copilot index. Default is 1. Increase if you have issues indexing large vaults. Warning: Changes require clearing and rebuilding the index!",value:t.numPartitions.toString(),onChange:e,options:["1","2","3","4","5","6","7","8","12","16","20","24","28","32","36","40"].map(r=>({label:r,value:r}))}),zr.default.createElement(hn,{type:"custom",title:"Exclusions",description:zr.default.createElement(zr.default.Fragment,null,zr.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."))},zr.default.createElement(ge,{variant:"secondary",onClick:()=>new oK(app,r=>dt("qaExclusions",r),t.qaExclusions,"Manage Exclusions").open()},"Manage")),zr.default.createElement(hn,{type:"custom",title:"Inclusions",description:zr.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.")},zr.default.createElement(ge,{variant:"secondary",onClick:()=>new oK(app,r=>dt("qaInclusions",r),t.qaInclusions,"Manage Inclusions").open()},"Manage")),zr.default.createElement(hn,{type:"switch",title:"Enable Obsidian Sync for Copilot index",description:"If enabled, the index will be stored in the .obsidian folder and synced with Obsidian Sync by default. If disabled, it will be stored in .copilot-index folder at vault root.",checked:t.enableIndexSync,onCheckedChange:r=>dt("enableIndexSync",r)}),zr.default.createElement(hn,{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=>dt("disableIndexOnMobile",r)}))))};var YYt=["basic","model","QA","command","plus","advanced"],QRn={basic:Bn.default.createElement(m3,{className:"tw-size-5"}),model:Bn.default.createElement(h3,{className:"tw-size-5"}),QA:Bn.default.createElement(g3,{className:"tw-size-5"}),command:Bn.default.createElement(c_,{className:"tw-size-5"}),plus:Bn.default.createElement(Vh,{className:"tw-size-5"}),advanced:Bn.default.createElement(p1,{className:"tw-size-5"})},e1n={basic:()=>Bn.default.createElement(FYt,null),model:()=>Bn.default.createElement(qYt,null),QA:()=>Bn.default.createElement(GYt,null),command:()=>Bn.default.createElement(IYt,null),plus:()=>Bn.default.createElement(kYt,null),advanced:()=>Bn.default.createElement(MYt,null)},JYt=YYt.map(t=>({id:t,icon:QRn[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),t1n=()=>{let{selectedTab:t,setSelectedTab:e}=Wz();return Bn.default.createElement("div",{className:"tw-flex tw-flex-col"},Bn.default.createElement("div",{className:"tw-inline-flex tw-rounded-lg"},JYt.map((r,n)=>Bn.default.createElement(DJt,{key:r.id,tab:r,isSelected:t===r.id,onClick:()=>e(r.id),isFirst:n===0,isLast:n===JYt.length-1}))),Bn.default.createElement("div",{className:"tw-w-full tw-border tw-border-solid"}),Bn.default.createElement("div",null,YYt.map(r=>{let n=e1n[r];return Bn.default.createElement(LJt,{key:r,id:r,isSelected:t===r},Bn.default.createElement(n,null))})))},r1n=({plugin:t})=>{let[e,r]=Bn.default.useState(0),{latestVersion:n,hasUpdate:o}=Sde(t.manifest.version),i=async()=>{new sfe(app,async()=>{iVe(),r(s=>s+1)}).open()};return Bn.default.createElement(kJt,null,Bn.default.createElement("div",null,Bn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Bn.default.createElement("h1",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},Bn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Bn.default.createElement("span",null,"Copilot Settings"),Bn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Bn.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"v",t.manifest.version),n&&Bn.default.createElement(Bn.default.Fragment,null,o?Bn.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,")"):Bn.default.createElement("span",{className:"tw-text-xs tw-text-normal"}," (up to date)")))),Bn.default.createElement("div",{className:"tw-self-end sm:tw-self-auto"},Bn.default.createElement(ge,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),Bn.default.createElement(t1n,{key:e})))},ZYt=r1n;var Lfe=class extends iK.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{this.app.workspace.getLeavesOfType(Es)[0]?.view&&ue().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 iK.Notice("Plugin reloaded successfully.")}catch(e){new iK.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,XYt.createRoot)(r).render(Aqe.default.createElement(uqe.Provider,{value:e},Aqe.default.createElement(ZYt,{plugin:this.plugin})))}};nr();var vE=require("obsidian");Cl();ti();yo();yn();qE();Sm();bn();var Fb=require("obsidian"),Et=F(X()),QYt=F(Dc());nr();function n1n(t){let[e]=(0,Et.useState)(new gW({returnMessages:!0,memoryKey:"history"})),[r,n]=(0,Et.useState)(null);return(0,Et.useEffect)(()=>{async function o(){let i=await ED.getInstance().createModelInstance(t),a=xp.fromMessages([BE.fromTemplate("You are a helpful assistant. You'll help the user with their content editing needs."),new Gb("history"),Jb.fromTemplate("{input}")]),s=bi.from([{input:u=>u.input,memory:()=>e.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},a,i]);n(s)}o()},[t,e]),{chatChain:r,chatMemory:e}}function o1n({originalText:t,command:e,onInsert:r,onReplace:n}){let[o,i]=(0,Et.useState)(null),[a,s]=(0,Et.useState)(null),[u,l]=(0,Et.useState)(""),c=(0,Et.useRef)(null),d=(0,Et.useRef)(null),[f,p]=(0,Et.useState)(!0),[m]=SF(),h=Rn(),b=(0,Et.useMemo)(()=>tJ(e.modelKey||m,h.activeModels),[e.modelKey,m,h.activeModels]),{chatChain:g,chatMemory:y}=n1n(b),S=e.title,x=(0,Et.useCallback)(async(R,N)=>{if(!g)return console.error("Chat chain not initialized"),new Fb.Notice("Chat engine not ready. Please try again."),p(!1),null;try{i(null),s(null),p(!0);let j="",k=await g.bind({signal:N.signal}).stream({input:R});for await(let z of k){if(N.signal.aborted)break;let V=typeof z.content=="string"?z.content:"";j+=V,i(j)}if(!N.signal.aborted){let z=j.trim();return s(z),p(!1),await y.saveContext({input:R},{output:z}),z}return null}catch(j){return fe("Error generating response:",j),p(!1),null}},[g,y]);(0,Et.useEffect)(()=>{let R=new AbortController;O.current=R;async function N(){if(g)try{let j=await sFe(e.content,t);await x(j,R)}catch(j){fe("Error in initial response:",j),p(!1)}}return N(),()=>{R.abort()}},[e.content,t,g,x]);let O=(0,Et.useRef)(null),P=async()=>{if(!u.trim()||!g){g||new Fb.Notice("Chat engine not ready. Please try again.");return}let R=new AbortController;O.current=R;let N=await sFe(u,t,!0);try{await x(N,R)&&l("")}finally{R.signal.aborted&&(p(!1),s(o??"")),O.current=null}},E=()=>{O.current&&(O.current.abort(),O.current=null,p(!1))},A=R=>{R.nativeEvent.isComposing||(!f&&a&&!I&&(R.key==="Enter"&&(Fb.Platform.isMacOS?R.metaKey:R.ctrlKey)&&!R.shiftKey&&(R.preventDefault(),n(a)),R.key==="Enter"&&(Fb.Platform.isMacOS?R.metaKey:R.ctrlKey)&&R.shiftKey&&(R.preventDefault(),r(a))),I&&R.key==="Enter"&&!R.shiftKey&&!R.metaKey&&!R.ctrlKey&&(R.preventDefault(),P()))};(0,Et.useEffect)(()=>{if(c.current&&o&&f){let R=c.current;R.scrollTop=R.scrollHeight}},[o,f]);let I=!f&&u.trim().length>0;return Et.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4",onKeyDown:A},Et.default.createElement("div",{className:"tw-max-h-60 tw-overflow-y-auto tw-whitespace-pre-wrap tw-text-muted"},t),Et.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},S&&Et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-font-bold tw-text-normal"},Et.default.createElement(p_,{className:"tw-size-4"}),S)),Et.default.createElement("div",{className:"tw-group tw-relative"},Et.default.createElement("textarea",{ref:c,className:"tw-peer tw-h-60 tw-w-full tw-text-text",value:a??o??"loading...",disabled:a==null,onChange:R=>s(R.target.value)}),a&&Et.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(a),new Fb.Notice("Copied to clipboard")}},Et.default.createElement(Ty,{className:"tw-size-4 hover:tw-text-accent"}))),!f&&a&&Et.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Et.default.createElement("textarea",{autoFocus:!0,ref:d,className:"tw-h-20 tw-w-full tw-text-text",placeholder:"Enter follow-up instructions...",value:u,onChange:R=>l(R.target.value)})),Et.default.createElement("div",{className:"tw-flex tw-justify-between tw-gap-2"},Et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs tw-font-bold tw-text-faint"},Et.default.createElement(s1,{className:"tw-size-4"}),tde(b)),Et.default.createElement("div",{className:"tw-flex tw-gap-2"},f?Et.default.createElement(ge,{variant:"secondary",onClick:E},"Stop"):I?Et.default.createElement(ge,{onClick:P,className:"tw-flex tw-items-center tw-gap-1"},Et.default.createElement("span",null,"Submit"),Et.default.createElement(Im,{className:"tw-size-3"})):Et.default.createElement(Et.default.Fragment,null,Et.default.createElement(ge,{onClick:()=>r(a??""),className:"tw-flex tw-items-center tw-gap-1"},Et.default.createElement("span",null,"Insert"),Et.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs tw-text-normal"},Fb.Platform.isMacOS?Et.default.createElement(Et.default.Fragment,null,Et.default.createElement(c_,{className:"tw-size-3"}),Et.default.createElement(ZC,{className:"tw-size-3"}),Et.default.createElement(Im,{className:"tw-size-3"})):Et.default.createElement(Et.default.Fragment,null,Et.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Et.default.createElement(ZC,{className:"tw-size-3"}),Et.default.createElement(Im,{className:"tw-size-3"})))),Et.default.createElement(ge,{onClick:()=>n(a??""),className:"tw-flex tw-items-center tw-gap-1"},Et.default.createElement("span",null,"Replace"),Et.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs tw-text-normal"},Fb.Platform.isMacOS?Et.default.createElement(Et.default.Fragment,null,Et.default.createElement(c_,{className:"tw-size-3"}),Et.default.createElement(Im,{className:"tw-size-3"})):Et.default.createElement(Et.default.Fragment,null,Et.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Et.default.createElement(Im,{className:"tw-size-3"}))))))))}var Ffe=class extends Fb.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,QYt.createRoot)(r);let{selectedText:n,command:o}=this.configs,i=s=>{c4(s),this.close()},a=s=>{c4(s,!0),this.close()};this.root.render(Et.default.createElement(o1n,{originalText:n,command:o,onInsert:i,onReplace:a}))}onClose(){this.root.unmount()}};var eZt=F(XRe());var kfe=class{constructor(e,r){this.handleFileModify=(0,eZt.default)(async e=>{if(ZU(e)){let r=await AW(e);this.registerCommand(r),TW(r,r.title)}},3e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(ZU(e)){let r=await AW(e);this.registerCommand(r),lce(r.title)}};this.handleFileDeletion=async e=>{if(ZU(e)){let r=YU(e.basename);this.plugin.removeCommand(r),EW(e.basename)}};this.handleFileRename=async(e,r)=>{let n=r.split("/").pop()?.replace(/\.md$/,"");if(n){let o=YU(n);this.plugin.removeCommand(o),EW(n)}if(ZU(e)){let o=await AW(e);this.registerCommand(o),TW(o,o.title)}};this.plugin=e,this.vault=r,this.initializeEventListeners()}async initialize(){await dce(),this.registerCommands()}async registerCommands(){Jx().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=YU(e.title);this.plugin.removeCommand(r),this.plugin.addCommand({id:r,name:e.title,editorCallback:n=>{new Ffe(this.plugin.app,{selectedText:n.getSelection(),command:e}).open(),lm.getInstance().recordUsage(e)}})}};var $fe=class extends vE.Plugin{constructor(){super(...arguments);this.userMessageHistory=[]}async onload(){await this.loadSettings(),this.settingsUnsubscriber=xa(async(r,n)=>{n.enableEncryption?await this.saveData(await JVe(n)):await this.saveData(n),iFe(this,r,n)}),this.addSettingTab(new Lfe(this.app,this)),this.sharedState=new TJt(this),this.vectorStoreManager=ma.getInstance(),this.brevilabsClient=Fi.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),uie(),this.projectManager=ac.getInstance(this.app,this.vectorStoreManager,this),this.fileParserManager=new oI(this.brevilabsClient,this.app.vault),this.registerView(Es,r=>new $M(r,this)),this.registerView(u9,r=>new dde(r)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",r=>{this.activateView()}),iFe(this,void 0,ue()),MN.initTools(this.app.vault),this.registerEvent(this.app.workspace.on("editor-menu",r=>NJt(r))),this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{if(r&&r.view instanceof vE.MarkdownView&&r.view.file){let o=this.app.workspace.getLeavesOfType(Es).find(i=>i.view instanceof $M)?.view;if(o){let i=new CustomEvent(Dh.ACTIVE_LEAF_CHANGE);o.eventTarget.dispatchEvent(i)}}})),this.autocompleteService=oce.getInstance(this),this.customCommandRegister=new kfe(this,this.app.vault),this.app.workspace.onLayoutReady(()=>{this.customCommandRegister.initialize().then(TYt).then(AYt)})}async onunload(){this.vectorStoreManager&&this.vectorStoreManager.onunload(),this.projectManager&&this.projectManager.onunload(),this.customCommandRegister.cleanup(),this.settingsUnsubscriber?.(),this.autocompleteService?.destroy(),ie("Copilot plugin unloaded")}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(ue().autosaveChat){let r=this.app.workspace.getLeavesOfType(Es)[0]?.view;r&&r.sharedState.chatHistory.length>0&&await r.saveChat()}}async processText(r,n,o,i=!0){let a=await r.getSelection();this.app.workspace.getLeavesOfType(Es).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(Es).find(l=>l.view instanceof $M)?.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(Es).find(n=>n.view instanceof $M)?.view;if(r){let n=new CustomEvent(Dh.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===Es&&this.emitChatIsVisible()}))}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(vE.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(Es).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(Es);r.length===0?ue().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:Es,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:Es,active:!0}):this.app.workspace.revealLeaf(r[0]),this.emitChatIsVisible()}async deactivateView(){this.app.workspace.detachLeavesOfType(Es)}async loadSettings(){let r=await this.loadData(),n=aVe(r);zE(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=kr(i),s=o.get(a);s?o.set(a,{...i,isBuiltIn:s.isBuiltIn||i.isBuiltIn}):o.set(a,i)}),Array.from(o.values())}async loadCopilotChatHistory(){let r=await this.getChatHistoryFiles();if(r.length===0){new vE.Notice("No chat history found.");return}new afe(this.app,r,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(ue().defaultSaveFolder);if(!(r instanceof vE.TFolder))return[];let o=(await this.app.vault.getMarkdownFiles()).filter(s=>s.path.startsWith(r.path)),a=Mc()?.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=T1t(n);this.sharedState.clearChatHistory(),o.forEach(a=>this.sharedState.addMessage(a)),await vN(o,this.projectManager.getCurrentChainManager().memoryManager);let i=this.app.workspace.getLeavesOfType(Es)[0];i?i.view.updateView():this.activateView()}async handleNewChat(){await this.autosaveCurrentChat();let r=this.app.workspace.getLeavesOfType(Es)[0];if(r){let n=r.view,o=new CustomEvent(Dh.ABORT_STREAM,{detail:{reason:"new-chat"}});n.eventTarget.dispatchEvent(o)}this.sharedState.clearChatHistory(),this.projectManager.getCurrentChainManager().memoryManager.clearChatMemory(),r?r.view.updateView():await this.activateView()}async newChat(){await this.handleNewChat()}async customSearchDB(r,n,o){return(await new jx({minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o}).getOramaChunks(r,n)).map(s=>({content:s.pageContent,metadata:s.metadata}))}}; /*! Bundled license information: @langchain/core/dist/utils/fast-json-patch/src/helpers.js: diff --git a/.obsidian/plugins/copilot/manifest.json b/.obsidian/plugins/copilot/manifest.json index a62b1b72..8af2d3f3 100644 --- a/.obsidian/plugins/copilot/manifest.json +++ b/.obsidian/plugins/copilot/manifest.json @@ -1,7 +1,7 @@ { "id": "copilot", "name": "Copilot", - "version": "2.9.3", + "version": "2.9.4", "minAppVersion": "0.15.0", "description": "Your AI Copilot: Chat with Your Second Brain, Learn Faster, Work Smarter.", "author": "Logan Yang", diff --git a/.obsidian/plugins/rss-reader/data.json b/.obsidian/plugins/rss-reader/data.json index b3a74e9c..dd33453b 100644 --- a/.obsidian/plugins/rss-reader/data.json +++ b/.obsidian/plugins/rss-reader/data.json @@ -3321,7 +3321,6 @@ "资讯", "人文", "ChinaDaily", - "各种折腾", "我的博客" ], "renamedText": { diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index e764a833..ae9da09b 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -32,17 +32,17 @@ } }, { - "id": "3deeedcdbfd6f5e1", + "id": "7987b0c6b435b6c1", "type": "leaf", "state": { "type": "markdown", "state": { - "file": "80-笔记归档/归档说明.md", + "file": "40-Podcast/podnotes/和Emily一起练口语(附中英双语字幕)-【发音版】美国人说“我超喜欢”时,常会用这句话!.md", "mode": "source", "source": false }, "icon": "lucide-file", - "title": "归档说明" + "title": "和Emily一起练口语(附中英双语字幕)-【发音版】美国人说“我超喜欢”时,常会用这句话!" } } ], @@ -132,7 +132,7 @@ { "id": "6eb65634f662a76d", "type": "tabs", - "dimension": 48.65853658536585, + "dimension": 46.58536585365854, "children": [ { "id": "255862dc8754e160", @@ -245,7 +245,7 @@ { "id": "ad86bdfc0cc9f06b", "type": "tabs", - "dimension": 51.34146341463415, + "dimension": 53.41463414634147, "children": [ { "id": "61523dba4992de80", @@ -273,11 +273,12 @@ "state": { "type": "copilot-chat-view", "state": {}, - "icon": "lucide-file", - "title": "插件不再活动" + "icon": "message-square", + "title": "Copilot" } } - ] + ], + "currentTab": 2 } ], "direction": "horizontal", @@ -310,10 +311,18 @@ "obsidian-memos:Thino": false } }, - "active": "3deeedcdbfd6f5e1", + "active": "7987b0c6b435b6c1", "lastOpenFiles": [ + "40-Podcast/podnotes/陈说历史-雍正帝怎么死的?唐朝为何不建长城?方孝孺真的被诛十族?能否称刘邦为汉高祖?等.md", + "80-笔记归档/README-归档.md", + "80-笔记归档/81-工作日记/202508", + "80-笔记归档/82-待办计划/2025", + "80-笔记归档/81-工作日记/202507", + "README.md", + "80-笔记归档/82-待办计划", + "80-笔记归档/82-待办计划.md", + "80-笔记归档/81-工作日记", "80-笔记归档/81-工作日记.md", - "80-笔记归档/归档说明.md", "01-工作日记/2025-07-02.md", "80-笔记归档", "01-工作日记/2025-07-12.md", @@ -324,7 +333,6 @@ "03-学习笔记/OB插件.md", "02-技术评测/关于RSS.md", "02-技术评测/笔记软件评测.md", - "README.md", "00-待办计划/2025-07 待办事宜.md", "10-WebClipper/AList的开源替代:OpenList.md", "01-工作日记/2025-07-09.md", @@ -332,26 +340,18 @@ "30-RSS/RSS阅读/阅读样本.md", "20-我的收藏夹/21-浏览器收藏/开源项目/OnlyOffice/Hidocs文档在线预览平台提供office文档在线预览服务.md", "40-Podcast/podnotes/和Emily一起练口语(附中英双语字幕)-【发音版】美国人说“我超喜欢”时,常会用这句话!.md", - "40-Podcast/podnotes/陈说历史-雍正帝怎么死的?唐朝为何不建长城?方孝孺真的被诛十族?能否称刘邦为汉高祖?等.md", "01-工作日记/2025-07-08.md", "40-Podcast/podnotes", "40-Podcast", "01-工作日记/2025-07-07.md", "01-工作日记/2025-07-04.md", "01-工作日记/2025-07-05.md", - "01-工作日记/2025-07-06.md", - "01-工作日记/未命名.md", "screenshot 1.png", "screenshot.png", "工作日记", "30-RSS/RSS阅读", "08-Inbox/assets/68691ee74ca1b.png", "08-Inbox/assets/yy88496nfr.png", - "08-Inbox/assets", - "09-Templates/copilot-custom-prompts", - "04-博客发布/040-系统技术", - "30-RSS/网文精选/assets", - "30-RSS/网文精选", "10-WebClipper/assets/v2-9f9b51f2020f8fd18c421810cc179483_1440w.png", "10-WebClipper/assets/v2-0bb091571c199e26882c3bbba78eaf15_1440w.png", "10-WebClipper/assets/v2-f666b8a845692cd6fee65bfbc52a3c59_1440w.png", diff --git a/80-笔记归档/81-工作日记.md b/80-笔记归档/81-工作日记.md deleted file mode 100644 index e69de29b..00000000 diff --git a/80-笔记归档/归档说明.md b/80-笔记归档/README-归档.md similarity index 100% rename from 80-笔记归档/归档说明.md rename to 80-笔记归档/README-归档.md