zhangkun9038@dingtalk.com 4380e95e00 2025-04-07 13:07:53: ...
2025-04-07 13:08:02 +08:00

1447 lines
3.1 MiB
Raw Blame History

This file contains invisible Unicode characters

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

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

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var g8t=Object.create;var M$=Object.defineProperty;var y8t=Object.getOwnPropertyDescriptor;var b8t=Object.getOwnPropertyNames;var _8t=Object.getPrototypeOf,v8t=Object.prototype.hasOwnProperty;var w8t=(e,t,r)=>t in e?M$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var C=(e,t)=>()=>(e&&(t=e(e=0)),t);var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yd=(e,t)=>{for(var r in t)M$(e,r,{get:t[r],enumerable:!0})},Z1e=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of b8t(t))!v8t.call(e,o)&&o!==r&&M$(e,o,{get:()=>t[o],enumerable:!(n=y8t(t,o))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?g8t(_8t(e)):{},Z1e(t||!e||!e.__esModule?M$(r,"default",{value:e,enumerable:!0}):r,e)),sl=e=>Z1e(M$({},"__esModule",{value:!0}),e);var Ll=(e,t,r)=>w8t(e,typeof t!="symbol"?t+"":t,r);function x8t(e){eDe=e}function P6(){return eDe}function He(e,t){let r=P6(),n=T6({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===CD?void 0:CD].filter(o=>!!o)});e.common.issues.push(n)}function M6(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}function tDe(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r}function br(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{var u,l;let{message:c}=e;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 nDe(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function q8t(e){return new RegExp(`^${nDe(e)}$`)}function oDe(e){let t=`${rDe}T${nDe(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function U8t(e,t){return!!((t==="v4"||!t)&&j8t.test(e)||(t==="v6"||!t)&&L8t.test(e))}function z8t(e,t){if(!I8t.test(e))return!1;try{let[r]=e.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||t&&o.alg!==t)}catch{return!1}}function H8t(e,t){return!!((t==="v4"||!t)&&N8t.test(e)||(t==="v6"||!t)&&F8t.test(e))}function V8t(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=parseInt(e.toFixed(o).replace(".","")),a=parseInt(t.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}function SD(e){if(e instanceof Qd){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Xd.create(SD(n))}return new Qd({...e._def,shape:()=>t})}else return e instanceof bS?new bS({...e._def,type:SD(e.element)}):e instanceof Xd?Xd.create(SD(e.unwrap())):e instanceof ny?ny.create(SD(e.unwrap())):e instanceof ry?ry.create(e.items.map(t=>SD(t))):e}function $ae(e,t){let r=gS(e),n=gS(t);if(e===t)return{valid:!0,data:e};if(r===Qe.object&&n===Qe.object){let o=xn.objectKeys(t),i=xn.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let u=$ae(e[s],t[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===Qe.array&&n===Qe.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],u=$ae(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===Qe.date&&n===Qe.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}function iDe(e,t){return new RM({values:e,typeName:re.ZodEnum,...br(t)})}function aDe(e,t={},r){return e?fO.create().superRefine((n,o)=>{var i,a;if(!e(n)){let s=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,u=(a=(i=s.fatal)!==null&&i!==void 0?i:r)!==null&&a!==void 0?a:!0,l=typeof s=="string"?{message:s}:s;o.addIssue({code:"custom",...l,fatal:u})}}):fO.create()}var xn,Fae,Qe,gS,ve,S8t,Qf,CD,eDe,T6,C8t,Ic,zt,xD,yd,kae,Bae,wM,R$,mt,I$,A$,Gp,X1e,_r,O8t,E8t,P8t,T8t,M8t,I8t,A8t,R8t,D8t,Lae,j8t,N8t,L8t,F8t,k8t,B8t,rDe,$8t,dO,SM,xM,CM,OM,OD,EM,PM,fO,yS,Dm,ED,bS,Qd,TM,mS,I6,MM,ry,A6,PD,TD,R6,IM,AM,RM,DM,pO,ep,Xd,ny,jM,NM,MD,W8t,D$,j$,LM,J8t,re,G8t,sDe,uDe,K8t,Y8t,lDe,Z8t,X8t,Q8t,eHt,tHt,rHt,nHt,oHt,iHt,aHt,sHt,uHt,lHt,cHt,dHt,fHt,pHt,hHt,mHt,gHt,yHt,bHt,_Ht,vHt,Q1e,wHt,SHt,xHt,CHt,OHt,EHt,PHt,THt,MHt,Tr,bd=C(()=>{(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.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},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.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)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(xn||(xn={}));(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Fae||(Fae={}));Qe=xn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gS=e=>{switch(typeof e){case"undefined":return Qe.undefined;case"string":return Qe.string;case"number":return isNaN(e)?Qe.nan:Qe.number;case"boolean":return Qe.boolean;case"function":return Qe.function;case"bigint":return Qe.bigint;case"symbol":return Qe.symbol;case"object":return Array.isArray(e)?Qe.array:e===null?Qe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Qe.promise:typeof Map<"u"&&e instanceof Map?Qe.map:typeof Set<"u"&&e instanceof Set?Qe.set:typeof Date<"u"&&e instanceof Date?Qe.date:Qe.object;default:return Qe.unknown}},ve=xn.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"]),S8t=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Qf=class e extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Qf.create=e=>new Qf(e);CD=(e,t)=>{let r;switch(e.code){case ve.invalid_type:e.received===Qe.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ve.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,xn.jsonStringifyReplacer)}`;break;case ve.unrecognized_keys:r=`Unrecognized key(s) in object: ${xn.joinValues(e.keys,", ")}`;break;case ve.invalid_union:r="Invalid input";break;case ve.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${xn.joinValues(e.options)}`;break;case ve.invalid_enum_value:r=`Invalid enum value. Expected ${xn.joinValues(e.options)}, received '${e.received}'`;break;case ve.invalid_arguments:r="Invalid function arguments";break;case ve.invalid_return_type:r="Invalid function return type";break;case ve.invalid_date:r="Invalid date";break;case ve.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:xn.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ve.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case ve.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case ve.custom:r="Invalid input";break;case ve.invalid_intersection_types:r="Intersection results could not be merged";break;case ve.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ve.not_finite:r="Number must be finite";break;default:r=t.defaultError,xn.assertNever(e)}return{message:r}},eDe=CD;T6=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,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:t,defaultError:s}).message;return{...o,path:i,message:s}},C8t=[];Ic=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return zt;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return zt;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},zt=Object.freeze({status:"aborted"}),xD=e=>({status:"dirty",value:e}),yd=e=>({status:"valid",value:e}),kae=e=>e.status==="aborted",Bae=e=>e.status==="dirty",wM=e=>e.status==="valid",R$=e=>typeof Promise<"u"&&e instanceof Promise;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(mt||(mt={}));Gp=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,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}},X1e=(e,t)=>{if(wM(t))return{success:!0,data:t.value};if(!e.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 Qf(e.common.issues);return this._error=r,this._error}}};_r=class{get description(){return this._def.description}_getType(t){return gS(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:gS(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ic,ctx:{common:t.parent.common,data:t.data,parsedType:gS(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(R$(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,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:t,parsedType:gS(t)},i=this._parseSync({data:t,path:o.path,parent:o});return X1e(o,i)}"~validate"(t){var r,n;let o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:gS(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:o});return wM(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:t,path:[],parent:o}).then(i=>wM(i)?{value:i.value}:{issues:o.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:gS(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(R$(o)?o:Promise.resolve(o));return X1e(n,i)}refine(t,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=t(o),s=()=>i.addIssue({code:ve.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new ep({schema:this,typeName:re.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 Xd.create(this,this._def)}nullable(){return ny.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bS.create(this)}promise(){return pO.create(this,this._def)}or(t){return TM.create([this,t],this._def)}and(t){return MM.create(this,t,this._def)}transform(t){return new ep({...br(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new jM({...br(this._def),innerType:this,defaultValue:r,typeName:re.ZodDefault})}brand(){return new D$({typeName:re.ZodBranded,type:this,...br(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new NM({...br(this._def),innerType:this,catchValue:r,typeName:re.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return j$.create(this,t)}readonly(){return LM.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},O8t=/^c[^\s-]{8,}$/i,E8t=/^[0-9a-z]+$/,P8t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,T8t=/^[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,M8t=/^[a-z0-9_-]{21}$/i,I8t=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,A8t=/^[-+]?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)?)??$/,R8t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,D8t="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",j8t=/^(?:(?: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])$/,N8t=/^(?:(?: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])$/,L8t=/^(([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]))$/,F8t=/^(([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])$/,k8t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B8t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,rDe="((\\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])))",$8t=new RegExp(`^${rDe}$`);dO=class e extends _r{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Qe.string){let i=this._getOrReturnCtx(t);return He(i,{code:ve.invalid_type,expected:Qe.string,received:i.parsedType}),zt}let n=new Ic,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),He(o,{code:ve.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),He(o,{code:ve.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?He(o,{code:ve.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&He(o,{code:ve.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")R8t.test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"email",code:ve.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Lae||(Lae=new RegExp(D8t,"u")),Lae.test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"emoji",code:ve.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")T8t.test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"uuid",code:ve.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")M8t.test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"nanoid",code:ve.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")O8t.test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"cuid",code:ve.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")E8t.test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"cuid2",code:ve.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")P8t.test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"ulid",code:ve.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),He(o,{validation:"url",code:ve.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"regex",code:ve.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),He(o,{code:ve.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),He(o,{code:ve.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),He(o,{code:ve.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?oDe(i).test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{code:ve.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?$8t.test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{code:ve.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?q8t(i).test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{code:ve.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?A8t.test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"duration",code:ve.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?U8t(t.data,i.version)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"ip",code:ve.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?z8t(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"jwt",code:ve.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?H8t(t.data,i.version)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"cidr",code:ve.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?k8t.test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"base64",code:ve.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?B8t.test(t.data)||(o=this._getOrReturnCtx(t,o),He(o,{validation:"base64url",code:ve.invalid_string,message:i.message}),n.dirty()):xn.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:ve.invalid_string,...mt.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...mt.errToObj(t)})}url(t){return this._addCheck({kind:"url",...mt.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...mt.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...mt.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...mt.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...mt.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...mt.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...mt.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...mt.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...mt.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...mt.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...mt.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...mt.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(r=t?.offset)!==null&&r!==void 0?r:!1,local:(n=t?.local)!==null&&n!==void 0?n:!1,...mt.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...mt.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...mt.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...mt.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...mt.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...mt.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...mt.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...mt.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...mt.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...mt.errToObj(r)})}nonempty(t){return this.min(1,mt.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};dO.create=e=>{var t;return new dO({checks:[],typeName:re.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...br(e)})};SM=class e extends _r{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Qe.number){let i=this._getOrReturnCtx(t);return He(i,{code:ve.invalid_type,expected:Qe.number,received:i.parsedType}),zt}let n,o=new Ic;for(let i of this._def.checks)i.kind==="int"?xn.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),He(n,{code:ve.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),He(n,{code:ve.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),He(n,{code:ve.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?V8t(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),He(n,{code:ve.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),He(n,{code:ve.not_finite,message:i.message}),o.dirty()):xn.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,mt.toString(r))}gt(t,r){return this.setLimit("min",t,!1,mt.toString(r))}lte(t,r){return this.setLimit("max",t,!0,mt.toString(r))}lt(t,r){return this.setLimit("max",t,!1,mt.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:mt.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:mt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:mt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:mt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:mt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:mt.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:mt.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:mt.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:mt.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:mt.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&xn.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};SM.create=e=>new SM({checks:[],typeName:re.ZodNumber,coerce:e?.coerce||!1,...br(e)});xM=class e extends _r{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Qe.bigint)return this._getInvalidInput(t);let n,o=new Ic;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),He(n,{code:ve.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),He(n,{code:ve.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),He(n,{code:ve.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):xn.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return He(r,{code:ve.invalid_type,expected:Qe.bigint,received:r.parsedType}),zt}gte(t,r){return this.setLimit("min",t,!0,mt.toString(r))}gt(t,r){return this.setLimit("min",t,!1,mt.toString(r))}lte(t,r){return this.setLimit("max",t,!0,mt.toString(r))}lt(t,r){return this.setLimit("max",t,!1,mt.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:mt.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:mt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:mt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:mt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:mt.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:mt.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};xM.create=e=>{var t;return new xM({checks:[],typeName:re.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...br(e)})};CM=class extends _r{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Qe.boolean){let n=this._getOrReturnCtx(t);return He(n,{code:ve.invalid_type,expected:Qe.boolean,received:n.parsedType}),zt}return yd(t.data)}};CM.create=e=>new CM({typeName:re.ZodBoolean,coerce:e?.coerce||!1,...br(e)});OM=class e extends _r{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Qe.date){let i=this._getOrReturnCtx(t);return He(i,{code:ve.invalid_type,expected:Qe.date,received:i.parsedType}),zt}if(isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return He(i,{code:ve.invalid_date}),zt}let n=new Ic,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),He(o,{code:ve.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),He(o,{code:ve.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):xn.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:mt.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:mt.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};OM.create=e=>new OM({checks:[],coerce:e?.coerce||!1,typeName:re.ZodDate,...br(e)});OD=class extends _r{_parse(t){if(this._getType(t)!==Qe.symbol){let n=this._getOrReturnCtx(t);return He(n,{code:ve.invalid_type,expected:Qe.symbol,received:n.parsedType}),zt}return yd(t.data)}};OD.create=e=>new OD({typeName:re.ZodSymbol,...br(e)});EM=class extends _r{_parse(t){if(this._getType(t)!==Qe.undefined){let n=this._getOrReturnCtx(t);return He(n,{code:ve.invalid_type,expected:Qe.undefined,received:n.parsedType}),zt}return yd(t.data)}};EM.create=e=>new EM({typeName:re.ZodUndefined,...br(e)});PM=class extends _r{_parse(t){if(this._getType(t)!==Qe.null){let n=this._getOrReturnCtx(t);return He(n,{code:ve.invalid_type,expected:Qe.null,received:n.parsedType}),zt}return yd(t.data)}};PM.create=e=>new PM({typeName:re.ZodNull,...br(e)});fO=class extends _r{constructor(){super(...arguments),this._any=!0}_parse(t){return yd(t.data)}};fO.create=e=>new fO({typeName:re.ZodAny,...br(e)});yS=class extends _r{constructor(){super(...arguments),this._unknown=!0}_parse(t){return yd(t.data)}};yS.create=e=>new yS({typeName:re.ZodUnknown,...br(e)});Dm=class extends _r{_parse(t){let r=this._getOrReturnCtx(t);return He(r,{code:ve.invalid_type,expected:Qe.never,received:r.parsedType}),zt}};Dm.create=e=>new Dm({typeName:re.ZodNever,...br(e)});ED=class extends _r{_parse(t){if(this._getType(t)!==Qe.undefined){let n=this._getOrReturnCtx(t);return He(n,{code:ve.invalid_type,expected:Qe.void,received:n.parsedType}),zt}return yd(t.data)}};ED.create=e=>new ED({typeName:re.ZodVoid,...br(e)});bS=class e extends _r{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==Qe.array)return He(r,{code:ve.invalid_type,expected:Qe.array,received:r.parsedType}),zt;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(He(r,{code:a?ve.too_big:ve.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(He(r,{code:ve.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(He(r,{code:ve.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 Gp(r,a,r.path,s)))).then(a=>Ic.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Gp(r,a,r.path,s)));return Ic.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:mt.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:mt.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:mt.toString(r)}})}nonempty(t){return this.min(1,t)}};bS.create=(e,t)=>new bS({type:e,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...br(t)});Qd=class e extends _r{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=xn.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==Qe.object){let l=this._getOrReturnCtx(t);return He(l,{code:ve.invalid_type,expected:Qe.object,received:l.parsedType}),zt}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Dm&&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 Gp(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Dm){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&&(He(o,{code:ve.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 Gp(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=>Ic.mergeObjectSync(n,l)):Ic.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return mt.errToObj,new e({...this._def,unknownKeys:"strict",...t!==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=mt.errToObj(t).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:re.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};return xn.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new e({...this._def,shape:()=>r})}omit(t){let r={};return xn.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new e({...this._def,shape:()=>r})}deepPartial(){return SD(this)}partial(t){let r={};return xn.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}),new e({...this._def,shape:()=>r})}required(t){let r={};return xn.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Xd;)i=i._def.innerType;r[n]=i}}),new e({...this._def,shape:()=>r})}keyof(){return iDe(xn.objectKeys(this.shape))}};Qd.create=(e,t)=>new Qd({shape:()=>e,unknownKeys:"strip",catchall:Dm.create(),typeName:re.ZodObject,...br(t)});Qd.strictCreate=(e,t)=>new Qd({shape:()=>e,unknownKeys:"strict",catchall:Dm.create(),typeName:re.ZodObject,...br(t)});Qd.lazycreate=(e,t)=>new Qd({shape:e,unknownKeys:"strip",catchall:Dm.create(),typeName:re.ZodObject,...br(t)});TM=class extends _r{_parse(t){let{ctx:r}=this._processInputParams(t),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 Qf(s.ctx.common.issues));return He(r,{code:ve.invalid_union,unionErrors:a}),zt}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let u of n){let l={...r,common:{...r.common,issues:[]},parent:null},c=u._parseSync({data:r.data,path:r.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!i&&(i={result:c,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new Qf(u));return He(r,{code:ve.invalid_union,unionErrors:s}),zt}}get options(){return this._def.options}};TM.create=(e,t)=>new TM({options:e,typeName:re.ZodUnion,...br(t)});mS=e=>e instanceof IM?mS(e.schema):e instanceof ep?mS(e.innerType()):e instanceof AM?[e.value]:e instanceof RM?e.options:e instanceof DM?xn.objectValues(e.enum):e instanceof jM?mS(e._def.innerType):e instanceof EM?[void 0]:e instanceof PM?[null]:e instanceof Xd?[void 0,...mS(e.unwrap())]:e instanceof ny?[null,...mS(e.unwrap())]:e instanceof D$||e instanceof LM?mS(e.unwrap()):e instanceof NM?mS(e._def.innerType):[],I6=class e extends _r{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.object)return He(r,{code:ve.invalid_type,expected:Qe.object,received:r.parsedType}),zt;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(He(r,{code:ve.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),zt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=mS(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:re.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...br(n)})}};MM=class extends _r{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(kae(i)||kae(a))return zt;let s=$ae(i.value,a.value);return s.valid?((Bae(i)||Bae(a))&&r.dirty(),{status:r.value,value:s.data}):(He(n,{code:ve.invalid_intersection_types}),zt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};MM.create=(e,t,r)=>new MM({left:e,right:t,typeName:re.ZodIntersection,...br(r)});ry=class e extends _r{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Qe.array)return He(n,{code:ve.invalid_type,expected:Qe.array,received:n.parsedType}),zt;if(n.data.length<this._def.items.length)return He(n,{code:ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),zt;!this._def.rest&&n.data.length>this._def.items.length&&(He(n,{code:ve.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 Gp(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Ic.mergeArray(r,a)):Ic.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ry.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ry({items:e,typeName:re.ZodTuple,rest:null,...br(t)})};A6=class e extends _r{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Qe.object)return He(n,{code:ve.invalid_type,expected:Qe.object,received:n.parsedType}),zt;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Gp(n,s,n.path,s)),value:a._parse(new Gp(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ic.mergeObjectAsync(r,o):Ic.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof _r?new e({keyType:t,valueType:r,typeName:re.ZodRecord,...br(n)}):new e({keyType:dO.create(),valueType:t,typeName:re.ZodRecord,...br(r)})}},PD=class extends _r{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Qe.map)return He(n,{code:ve.invalid_type,expected:Qe.map,received:n.parsedType}),zt;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Gp(n,s,n.path,[l,"key"])),value:i._parse(new Gp(n,u,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,c=await u.value;if(l.status==="aborted"||c.status==="aborted")return zt;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let u of a){let l=u.key,c=u.value;if(l.status==="aborted"||c.status==="aborted")return zt;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};PD.create=(e,t,r)=>new PD({valueType:t,keyType:e,typeName:re.ZodMap,...br(r)});TD=class e extends _r{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Qe.set)return He(n,{code:ve.invalid_type,expected:Qe.set,received:n.parsedType}),zt;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(He(n,{code:ve.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(He(n,{code:ve.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let l=new Set;for(let c of u){if(c.status==="aborted")return zt;c.status==="dirty"&&r.dirty(),l.add(c.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((u,l)=>i._parse(new Gp(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:mt.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:mt.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};TD.create=(e,t)=>new TD({valueType:e,minSize:null,maxSize:null,typeName:re.ZodSet,...br(t)});R6=class e extends _r{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.function)return He(r,{code:ve.invalid_type,expected:Qe.function,received:r.parsedType}),zt;function n(s,u){return T6({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,P6(),CD].filter(l=>!!l),issueData:{code:ve.invalid_arguments,argumentsError:u}})}function o(s,u){return T6({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,P6(),CD].filter(l=>!!l),issueData:{code:ve.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof pO){let s=this;return yd(async function(...u){let l=new Qf([]),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 yd(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new Qf([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new Qf([o(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ry.create(t).rest(yS.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||ry.create([]).rest(yS.create()),returns:r||yS.create(),typeName:re.ZodFunction,...br(n)})}},IM=class extends _r{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};IM.create=(e,t)=>new IM({getter:e,typeName:re.ZodLazy,...br(t)});AM=class extends _r{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return He(r,{received:r.data,code:ve.invalid_literal,expected:this._def.value}),zt}return{status:"valid",value:t.data}}get value(){return this._def.value}};AM.create=(e,t)=>new AM({value:e,typeName:re.ZodLiteral,...br(t)});RM=class e extends _r{constructor(){super(...arguments),I$.set(this,void 0)}_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return He(r,{expected:xn.joinValues(n),received:r.parsedType,code:ve.invalid_type}),zt}if(M6(this,I$,"f")||tDe(this,I$,new Set(this._def.values),"f"),!M6(this,I$,"f").has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return He(r,{received:r.data,code:ve.invalid_enum_value,options:n}),zt}return yd(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};I$=new WeakMap;RM.create=iDe;DM=class extends _r{constructor(){super(...arguments),A$.set(this,void 0)}_parse(t){let r=xn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Qe.string&&n.parsedType!==Qe.number){let o=xn.objectValues(r);return He(n,{expected:xn.joinValues(o),received:n.parsedType,code:ve.invalid_type}),zt}if(M6(this,A$,"f")||tDe(this,A$,new Set(xn.getValidEnumValues(this._def.values)),"f"),!M6(this,A$,"f").has(t.data)){let o=xn.objectValues(r);return He(n,{received:n.data,code:ve.invalid_enum_value,options:o}),zt}return yd(t.data)}get enum(){return this._def.values}};A$=new WeakMap;DM.create=(e,t)=>new DM({values:e,typeName:re.ZodNativeEnum,...br(t)});pO=class extends _r{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.promise&&r.common.async===!1)return He(r,{code:ve.invalid_type,expected:Qe.promise,received:r.parsedType}),zt;let n=r.parsedType===Qe.promise?r.data:Promise.resolve(r.data);return yd(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};pO.create=(e,t)=>new pO({type:e,typeName:re.ZodPromise,...br(t)});ep=class extends _r{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{He(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return zt;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?zt:u.status==="dirty"||r.value==="dirty"?xD(u.value):u});{if(r.value==="aborted")return zt;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?zt:s.status==="dirty"||r.value==="dirty"?xD(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?zt:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?zt:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!wM(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=>wM(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);xn.assertNever(o)}};ep.create=(e,t,r)=>new ep({schema:e,typeName:re.ZodEffects,effect:t,...br(r)});ep.createWithPreprocess=(e,t,r)=>new ep({schema:t,effect:{type:"preprocess",transform:e},typeName:re.ZodEffects,...br(r)});Xd=class extends _r{_parse(t){return this._getType(t)===Qe.undefined?yd(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Xd.create=(e,t)=>new Xd({innerType:e,typeName:re.ZodOptional,...br(t)});ny=class extends _r{_parse(t){return this._getType(t)===Qe.null?yd(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ny.create=(e,t)=>new ny({innerType:e,typeName:re.ZodNullable,...br(t)});jM=class extends _r{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===Qe.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};jM.create=(e,t)=>new jM({innerType:e,typeName:re.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...br(t)});NM=class extends _r{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return R$(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Qf(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Qf(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};NM.create=(e,t)=>new NM({innerType:e,typeName:re.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...br(t)});MD=class extends _r{_parse(t){if(this._getType(t)!==Qe.nan){let n=this._getOrReturnCtx(t);return He(n,{code:ve.invalid_type,expected:Qe.nan,received:n.parsedType}),zt}return{status:"valid",value:t.data}}};MD.create=e=>new MD({typeName:re.ZodNaN,...br(e)});W8t=Symbol("zod_brand"),D$=class extends _r{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},j$=class e extends _r{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?zt:i.status==="dirty"?(r.dirty(),xD(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?zt:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:re.ZodPipeline})}},LM=class extends _r{_parse(t){let r=this._def.innerType._parse(t),n=o=>(wM(o)&&(o.value=Object.freeze(o.value)),o);return R$(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};LM.create=(e,t)=>new LM({innerType:e,typeName:re.ZodReadonly,...br(t)});J8t={object:Qd.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(re||(re={}));G8t=(e,t={message:`Input not instance of ${e.name}`})=>aDe(r=>r instanceof e,t),sDe=dO.create,uDe=SM.create,K8t=MD.create,Y8t=xM.create,lDe=CM.create,Z8t=OM.create,X8t=OD.create,Q8t=EM.create,eHt=PM.create,tHt=fO.create,rHt=yS.create,nHt=Dm.create,oHt=ED.create,iHt=bS.create,aHt=Qd.create,sHt=Qd.strictCreate,uHt=TM.create,lHt=I6.create,cHt=MM.create,dHt=ry.create,fHt=A6.create,pHt=PD.create,hHt=TD.create,mHt=R6.create,gHt=IM.create,yHt=AM.create,bHt=RM.create,_Ht=DM.create,vHt=pO.create,Q1e=ep.create,wHt=Xd.create,SHt=ny.create,xHt=ep.createWithPreprocess,CHt=j$.create,OHt=()=>sDe().optional(),EHt=()=>uDe().optional(),PHt=()=>lDe().optional(),THt={string:e=>dO.create({...e,coerce:!0}),number:e=>SM.create({...e,coerce:!0}),boolean:e=>CM.create({...e,coerce:!0}),bigint:e=>xM.create({...e,coerce:!0}),date:e=>OM.create({...e,coerce:!0})},MHt=zt,Tr=Object.freeze({__proto__:null,defaultErrorMap:CD,setErrorMap:x8t,getErrorMap:P6,makeIssue:T6,EMPTY_PATH:C8t,addIssueToContext:He,ParseStatus:Ic,INVALID:zt,DIRTY:xD,OK:yd,isAborted:kae,isDirty:Bae,isValid:wM,isAsync:R$,get util(){return xn},get objectUtil(){return Fae},ZodParsedType:Qe,getParsedType:gS,ZodType:_r,datetimeRegex:oDe,ZodString:dO,ZodNumber:SM,ZodBigInt:xM,ZodBoolean:CM,ZodDate:OM,ZodSymbol:OD,ZodUndefined:EM,ZodNull:PM,ZodAny:fO,ZodUnknown:yS,ZodNever:Dm,ZodVoid:ED,ZodArray:bS,ZodObject:Qd,ZodUnion:TM,ZodDiscriminatedUnion:I6,ZodIntersection:MM,ZodTuple:ry,ZodRecord:A6,ZodMap:PD,ZodSet:TD,ZodFunction:R6,ZodLazy:IM,ZodLiteral:AM,ZodEnum:RM,ZodNativeEnum:DM,ZodPromise:pO,ZodEffects:ep,ZodTransformer:ep,ZodOptional:Xd,ZodNullable:ny,ZodDefault:jM,ZodCatch:NM,ZodNaN:MD,BRAND:W8t,ZodBranded:D$,ZodPipeline:j$,ZodReadonly:LM,custom:aDe,Schema:_r,ZodSchema:_r,late:J8t,get ZodFirstPartyTypeKind(){return re},coerce:THt,any:tHt,array:iHt,bigint:Y8t,boolean:lDe,date:Z8t,discriminatedUnion:lHt,effect:Q1e,enum:bHt,function:mHt,instanceof:G8t,intersection:cHt,lazy:gHt,literal:yHt,map:pHt,nan:K8t,nativeEnum:_Ht,never:nHt,null:eHt,nullable:SHt,number:uDe,object:aHt,oboolean:PHt,onumber:EHt,optional:wHt,ostring:OHt,pipeline:CHt,preprocess:xHt,promise:vHt,record:fHt,set:hHt,strictObject:sHt,string:sDe,symbol:X8t,transformer:Q1e,tuple:dHt,undefined:Q8t,union:uHt,unknown:rHt,void:oHt,NEVER:MHt,ZodIssueCode:ve,quotelessJson:S8t,ZodError:Qf})});var dDe=b((ogn,cDe)=>{function Kp(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.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))}cDe.exports=Kp;Kp.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Kp.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Kp.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);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};Kp.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Kp.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};Kp.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};Kp.prototype.start=Kp.prototype.try;Kp.prototype.errors=function(){return this._errors};Kp.prototype.attempts=function(){return this._attempts};Kp.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(e[i]||0)+1;e[i]=a,a>=r&&(t=o,r=a)}return t}});var fDe=b(FM=>{var IHt=dDe();FM.operation=function(e){var t=FM.timeouts(e);return new IHt(t,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};FM.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in e)t[r]=e[r];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<t.retries;o++)n.push(this.createTimeout(o,t));return e&&e.forever&&!n.length&&n.push(this.createTimeout(o,t)),n.sort(function(i,a){return i-a}),n};FM.createTimeout=function(e,t){var r=t.randomize?Math.random()+1:1,n=Math.round(r*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return n=Math.min(n,t.maxTimeout),n};FM.wrap=function(e,t,r){if(t instanceof Array&&(r=t,t=null),!r){r=[];for(var n in e)typeof e[n]=="function"&&r.push(n)}for(var o=0;o<r.length;o++){var i=r[o],a=e[i];e[i]=function(u){var l=FM.operation(t),c=Array.prototype.slice.call(arguments,1),d=c.pop();c.push(function(f){l.retry(f)||(f&&(arguments[0]=l.mainError()),d.apply(this,arguments))}),l.attempt(function(){u.apply(e,c)})}.bind(e,a),e[i].options=t}}});var hDe=b((agn,pDe)=>{pDe.exports=fDe()});var N6=b((sgn,j6)=>{"use strict";var AHt=hDe(),RHt=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],D6=class extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,{message:t}=t):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}},DHt=(e,t,r)=>{let n=r.retries-(t-1);return e.attemptNumber=t,e.retriesLeft=n,e},jHt=e=>RHt.includes(e),mDe=(e,t)=>new Promise((r,n)=>{t={onFailedAttempt:()=>{},retries:10,...t};let o=AHt.operation(t);o.attempt(async i=>{try{r(await e(i))}catch(a){if(!(a instanceof Error)){n(new TypeError(`Non-error was thrown: "${a}". You should only throw errors.`));return}if(a instanceof D6)o.stop(),n(a.originalError);else if(a instanceof TypeError&&!jHt(a.message))o.stop(),n(a);else{DHt(a,i,t);try{await t.onFailedAttempt(a)}catch(s){n(s);return}o.retry(a)||n(o.mainError())}}})});j6.exports=mDe;j6.exports.default=mDe;j6.exports.AbortError=D6});var gDe,yDe=C(()=>{gDe=/^(?:[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 NHt(e){return typeof e=="string"&&gDe.test(e)}var ID,bDe=C(()=>{yDe();ID=NHt});function _De(e,t=0){return(Fl[e[t+0]]+Fl[e[t+1]]+Fl[e[t+2]]+Fl[e[t+3]]+"-"+Fl[e[t+4]]+Fl[e[t+5]]+"-"+Fl[e[t+6]]+Fl[e[t+7]]+"-"+Fl[e[t+8]]+Fl[e[t+9]]+"-"+Fl[e[t+10]]+Fl[e[t+11]]+Fl[e[t+12]]+Fl[e[t+13]]+Fl[e[t+14]]+Fl[e[t+15]]).toLowerCase()}var Fl,L6,vDe=C(()=>{Fl=[];for(L6=0;L6<256;++L6)Fl.push((L6+256).toString(16).slice(1))});function qae(){if(!F6&&(F6=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!F6))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return F6(LHt)}var F6,LHt,wDe=C(()=>{LHt=new Uint8Array(16)});var FHt,Uae,SDe=C(()=>{FHt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Uae={randomUUID:FHt}});function kHt(e,t,r){if(Uae.randomUUID&&!t&&!e)return Uae.randomUUID();e=e||{};var n=e.random||(e.rng||qae)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=n[o];return t}return _De(n)}var ef,xDe=C(()=>{SDe();wDe();vDe();ef=kHt});var N$=C(()=>{xDe();bDe()});var CDe,ODe=C(()=>{CDe=/^(?:[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 $Ht(e){return typeof e=="string"&&CDe.test(e)}var zae,EDe=C(()=>{ODe();zae=$Ht});function PDe(e,t=0){return(kl[e[t+0]]+kl[e[t+1]]+kl[e[t+2]]+kl[e[t+3]]+"-"+kl[e[t+4]]+kl[e[t+5]]+"-"+kl[e[t+6]]+kl[e[t+7]]+"-"+kl[e[t+8]]+kl[e[t+9]]+"-"+kl[e[t+10]]+kl[e[t+11]]+kl[e[t+12]]+kl[e[t+13]]+kl[e[t+14]]+kl[e[t+15]]).toLowerCase()}var kl,k6,TDe=C(()=>{kl=[];for(k6=0;k6<256;++k6)kl.push((k6+256).toString(16).slice(1))});function Hae(){if(!B6&&(B6=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!B6))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return B6(qHt)}var B6,qHt,MDe=C(()=>{qHt=new Uint8Array(16)});var UHt,Vae,IDe=C(()=>{UHt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vae={randomUUID:UHt}});function zHt(e,t,r){if(Vae.randomUUID&&!t&&!e)return Vae.randomUUID();e=e||{};var n=e.random||(e.rng||Hae)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=n[o];return t}return PDe(n)}var hO,ADe=C(()=>{IDe();MDe();TDe();hO=zHt});var $6=C(()=>{ADe();EDe()});var DDe=b((Rgn,Jae)=>{"use strict";var HHt=Object.prototype.hasOwnProperty,_d="~";function L$(){}Object.create&&(L$.prototype=Object.create(null),new L$().__proto__||(_d=!1));function VHt(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function RDe(e,t,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new VHt(r,n||e,o),a=_d?_d+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],i]:e._events[a].push(i):(e._events[a]=i,e._eventsCount++),e}function q6(e,t){--e._eventsCount===0?e._events=new L$:delete e._events[t]}function Ac(){this._events=new L$,this._eventsCount=0}Ac.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)HHt.call(r,n)&&t.push(_d?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};Ac.prototype.listeners=function(t){var r=_d?_d+t:t,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,a=new Array(i);o<i;o++)a[o]=n[o].fn;return a};Ac.prototype.listenerCount=function(t){var r=_d?_d+t:t,n=this._events[r];return n?n.fn?1:n.length:0};Ac.prototype.emit=function(t,r,n,o,i,a){var s=_d?_d+t:t;if(!this._events[s])return!1;var u=this._events[s],l=arguments.length,c,d;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,r),!0;case 3:return u.fn.call(u.context,r,n),!0;case 4:return u.fn.call(u.context,r,n,o),!0;case 5:return u.fn.call(u.context,r,n,o,i),!0;case 6:return u.fn.call(u.context,r,n,o,i,a),!0}for(d=1,c=new Array(l-1);d<l;d++)c[d-1]=arguments[d];u.fn.apply(u.context,c)}else{var f=u.length,p;for(d=0;d<f;d++)switch(u[d].once&&this.removeListener(t,u[d].fn,void 0,!0),l){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,r);break;case 3:u[d].fn.call(u[d].context,r,n);break;case 4:u[d].fn.call(u[d].context,r,n,o);break;default:if(!c)for(p=1,c=new Array(l-1);p<l;p++)c[p-1]=arguments[p];u[d].fn.apply(u[d].context,c)}}return!0};Ac.prototype.on=function(t,r,n){return RDe(this,t,r,n,!1)};Ac.prototype.once=function(t,r,n){return RDe(this,t,r,n,!0)};Ac.prototype.removeListener=function(t,r,n,o){var i=_d?_d+t:t;if(!this._events[i])return this;if(!r)return q6(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&q6(this,i);else{for(var s=0,u=[],l=a.length;s<l;s++)(a[s].fn!==r||o&&!a[s].once||n&&a[s].context!==n)&&u.push(a[s]);u.length?this._events[i]=u.length===1?u[0]:u:q6(this,i)}return this};Ac.prototype.removeAllListeners=function(t){var r;return t?(r=_d?_d+t:t,this._events[r]&&q6(this,r)):(this._events=new L$,this._eventsCount=0),this};Ac.prototype.off=Ac.prototype.removeListener;Ac.prototype.addListener=Ac.prototype.on;Ac.prefixed=_d;Ac.EventEmitter=Ac;typeof Jae<"u"&&(Jae.exports=Ac)});var NDe=b((Dgn,jDe)=>{"use strict";jDe.exports=(e,t)=>(t=t||(()=>{}),e.then(r=>new Promise(n=>{n(t())}).then(()=>r),r=>new Promise(n=>{n(t())}).then(()=>{throw r})))});var FDe=b((jgn,z6)=>{"use strict";var WHt=NDe(),U6=class extends Error{constructor(t){super(t),this.name="TimeoutError"}},LDe=(e,t,r)=>new Promise((n,o)=>{if(typeof t!="number"||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0){n(e);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 ${t} milliseconds`,s=r instanceof Error?r:new U6(a);typeof e.cancel=="function"&&e.cancel(),o(s)},t);WHt(e.then(n,o),()=>{clearTimeout(i)})});z6.exports=LDe;z6.exports.default=LDe;z6.exports.TimeoutError=U6});var kDe=b(Gae=>{"use strict";Object.defineProperty(Gae,"__esModule",{value:!0});function JHt(e,t,r){let n=0,o=e.length;for(;o>0;){let i=o/2|0,a=n+i;r(e[a],t)<=0?(n=++a,o-=i+1):o=i}return n}Gae.default=JHt});var BDe=b(Yae=>{"use strict";Object.defineProperty(Yae,"__esModule",{value:!0});var GHt=kDe(),Kae=class{constructor(){this._queue=[]}enqueue(t,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:t};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let o=GHt.default(this._queue,n,(i,a)=>a.priority-i.priority);this._queue.splice(o,0,n)}dequeue(){let t=this._queue.shift();return t?.run}filter(t){return this._queue.filter(r=>r.priority===t.priority).map(r=>r.run)}get size(){return this._queue.length}};Yae.default=Kae});var V6=b(Xae=>{"use strict";Object.defineProperty(Xae,"__esModule",{value:!0});var KHt=DDe(),$De=FDe(),YHt=BDe(),H6=()=>{},ZHt=new $De.TimeoutError,Zae=class extends KHt{constructor(t){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=H6,this._resolveIdle=H6,t=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:YHt.default},t),!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=t.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(i=(o=t.interval)===null||o===void 0?void 0:o.toString())!==null&&i!==void 0?i:""}\` (${typeof t.interval})`);this._carryoverConcurrencyCount=t.carryoverConcurrencyCount,this._isIntervalIgnored=t.intervalCap===1/0||t.interval===0,this._intervalCap=t.intervalCap,this._interval=t.interval,this._queue=new t.queueClass,this._queueClass=t.queueClass,this.concurrency=t.concurrency,this._timeout=t.timeout,this._throwOnTimeout=t.throwOnTimeout===!0,this._isPaused=t.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=H6,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=H6,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let t=Date.now();if(this._intervalId===void 0){let r=this._intervalEnd-t;if(r<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let t=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),t&&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(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this._concurrency=t,this._processQueue()}async add(t,r={}){return new Promise((n,o)=>{let i=async()=>{this._pendingCount++,this._intervalCount++;try{let a=this._timeout===void 0&&r.timeout===void 0?t():$De.default(Promise.resolve(t()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(ZHt)});n(await a)}catch(a){o(a)}this._next()};this._queue.enqueue(i,r),this._tryToStartAnother(),this.emit("add")})}async addAll(t,r){return Promise.all(t.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(t=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),t()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(t=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),t()}})}get size(){return this._queue.size}sizeBy(t){return this._queue.filter(t).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(t){this._timeout=t}};Xae.default=Zae});var XHt,QHt,St,W6=C(()=>{XHt=(...e)=>fetch(...e),QHt=Symbol.for("ls:fetch_implementation"),St=()=>globalThis[QHt]??XHt});var qDe,J6,e6t,t6t,F$,UDe=C(()=>{qDe=B(N6(),1),J6=B(V6(),1);W6();e6t=[400,401,403,404,405,406,407,408],t6t=[409],F$=class{constructor(t){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}),this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,"default"in J6.default?this.queue=new J6.default.default({concurrency:this.maxConcurrency}):this.queue=new J6.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=t?.onFailedResponseHook}call(t,...r){let n=this.onFailedResponseHook;return this.queue.add(()=>(0,qDe.default)(()=>t(...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(e6t.includes(+a))throw o;if(t6t.includes(+a))return;n&&await n(i)}},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,r,...n){return t.signal?Promise.race([this.call(r,...n),new Promise((o,i)=>{t.signal?.addEventListener("abort",()=>{i(new Error("AbortError"))})})]):this.call(r,...n)}fetch(...t){return this.call(()=>St()(...t).then(r=>r.ok?r:Promise.reject(r)))}}});function Qae(e){return typeof e?._getType=="function"}function ese(e){let t={type:e._getType(),data:{content:e.content}};return e?.additional_kwargs&&Object.keys(e.additional_kwargs).length>0&&(t.data.additional_kwargs={...e.additional_kwargs}),t}var zDe=C(()=>{});function tn(e,t){if(!zae(e)){let r=t!==void 0?`Invalid UUID for ${t}: ${e}`:`Invalid UUID: ${e}`;throw new Error(r)}return e}var HDe=C(()=>{$6()});function G6(e){VDe[e]||(console.warn(e),VDe[e]=!0)}var VDe,tse=C(()=>{VDe={}});var k$=b((Hgn,WDe)=>{var r6t="2.0.0",n6t=Number.MAX_SAFE_INTEGER||9007199254740991,o6t=16,i6t=250,a6t=["major","premajor","minor","preminor","patch","prepatch","prerelease"];WDe.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:o6t,MAX_SAFE_BUILD_LENGTH:i6t,MAX_SAFE_INTEGER:n6t,RELEASE_TYPES:a6t,SEMVER_SPEC_VERSION:r6t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var B$=b((Vgn,JDe)=>{var s6t=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};JDe.exports=s6t});var AD=b((_S,GDe)=>{var{MAX_SAFE_COMPONENT_LENGTH:rse,MAX_SAFE_BUILD_LENGTH:u6t,MAX_LENGTH:l6t}=k$(),c6t=B$();_S=GDe.exports={};var d6t=_S.re=[],f6t=_S.safeRe=[],tt=_S.src=[],rt=_S.t={},p6t=0,nse="[a-zA-Z0-9-]",h6t=[["\\s",1],["\\d",l6t],[nse,u6t]],m6t=e=>{for(let[t,r]of h6t)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},pr=(e,t,r)=>{let n=m6t(t),o=p6t++;c6t(e,o,t),rt[e]=o,tt[o]=t,d6t[o]=new RegExp(t,r?"g":void 0),f6t[o]=new RegExp(n,r?"g":void 0)};pr("NUMERICIDENTIFIER","0|[1-9]\\d*");pr("NUMERICIDENTIFIERLOOSE","\\d+");pr("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${nse}*`);pr("MAINVERSION",`(${tt[rt.NUMERICIDENTIFIER]})\\.(${tt[rt.NUMERICIDENTIFIER]})\\.(${tt[rt.NUMERICIDENTIFIER]})`);pr("MAINVERSIONLOOSE",`(${tt[rt.NUMERICIDENTIFIERLOOSE]})\\.(${tt[rt.NUMERICIDENTIFIERLOOSE]})\\.(${tt[rt.NUMERICIDENTIFIERLOOSE]})`);pr("PRERELEASEIDENTIFIER",`(?:${tt[rt.NUMERICIDENTIFIER]}|${tt[rt.NONNUMERICIDENTIFIER]})`);pr("PRERELEASEIDENTIFIERLOOSE",`(?:${tt[rt.NUMERICIDENTIFIERLOOSE]}|${tt[rt.NONNUMERICIDENTIFIER]})`);pr("PRERELEASE",`(?:-(${tt[rt.PRERELEASEIDENTIFIER]}(?:\\.${tt[rt.PRERELEASEIDENTIFIER]})*))`);pr("PRERELEASELOOSE",`(?:-?(${tt[rt.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${tt[rt.PRERELEASEIDENTIFIERLOOSE]})*))`);pr("BUILDIDENTIFIER",`${nse}+`);pr("BUILD",`(?:\\+(${tt[rt.BUILDIDENTIFIER]}(?:\\.${tt[rt.BUILDIDENTIFIER]})*))`);pr("FULLPLAIN",`v?${tt[rt.MAINVERSION]}${tt[rt.PRERELEASE]}?${tt[rt.BUILD]}?`);pr("FULL",`^${tt[rt.FULLPLAIN]}$`);pr("LOOSEPLAIN",`[v=\\s]*${tt[rt.MAINVERSIONLOOSE]}${tt[rt.PRERELEASELOOSE]}?${tt[rt.BUILD]}?`);pr("LOOSE",`^${tt[rt.LOOSEPLAIN]}$`);pr("GTLT","((?:<|>)?=?)");pr("XRANGEIDENTIFIERLOOSE",`${tt[rt.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);pr("XRANGEIDENTIFIER",`${tt[rt.NUMERICIDENTIFIER]}|x|X|\\*`);pr("XRANGEPLAIN",`[v=\\s]*(${tt[rt.XRANGEIDENTIFIER]})(?:\\.(${tt[rt.XRANGEIDENTIFIER]})(?:\\.(${tt[rt.XRANGEIDENTIFIER]})(?:${tt[rt.PRERELEASE]})?${tt[rt.BUILD]}?)?)?`);pr("XRANGEPLAINLOOSE",`[v=\\s]*(${tt[rt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${tt[rt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${tt[rt.XRANGEIDENTIFIERLOOSE]})(?:${tt[rt.PRERELEASELOOSE]})?${tt[rt.BUILD]}?)?)?`);pr("XRANGE",`^${tt[rt.GTLT]}\\s*${tt[rt.XRANGEPLAIN]}$`);pr("XRANGELOOSE",`^${tt[rt.GTLT]}\\s*${tt[rt.XRANGEPLAINLOOSE]}$`);pr("COERCEPLAIN",`(^|[^\\d])(\\d{1,${rse}})(?:\\.(\\d{1,${rse}}))?(?:\\.(\\d{1,${rse}}))?`);pr("COERCE",`${tt[rt.COERCEPLAIN]}(?:$|[^\\d])`);pr("COERCEFULL",tt[rt.COERCEPLAIN]+`(?:${tt[rt.PRERELEASE]})?(?:${tt[rt.BUILD]})?(?:$|[^\\d])`);pr("COERCERTL",tt[rt.COERCE],!0);pr("COERCERTLFULL",tt[rt.COERCEFULL],!0);pr("LONETILDE","(?:~>?)");pr("TILDETRIM",`(\\s*)${tt[rt.LONETILDE]}\\s+`,!0);_S.tildeTrimReplace="$1~";pr("TILDE",`^${tt[rt.LONETILDE]}${tt[rt.XRANGEPLAIN]}$`);pr("TILDELOOSE",`^${tt[rt.LONETILDE]}${tt[rt.XRANGEPLAINLOOSE]}$`);pr("LONECARET","(?:\\^)");pr("CARETTRIM",`(\\s*)${tt[rt.LONECARET]}\\s+`,!0);_S.caretTrimReplace="$1^";pr("CARET",`^${tt[rt.LONECARET]}${tt[rt.XRANGEPLAIN]}$`);pr("CARETLOOSE",`^${tt[rt.LONECARET]}${tt[rt.XRANGEPLAINLOOSE]}$`);pr("COMPARATORLOOSE",`^${tt[rt.GTLT]}\\s*(${tt[rt.LOOSEPLAIN]})$|^$`);pr("COMPARATOR",`^${tt[rt.GTLT]}\\s*(${tt[rt.FULLPLAIN]})$|^$`);pr("COMPARATORTRIM",`(\\s*)${tt[rt.GTLT]}\\s*(${tt[rt.LOOSEPLAIN]}|${tt[rt.XRANGEPLAIN]})`,!0);_S.comparatorTrimReplace="$1$2$3";pr("HYPHENRANGE",`^\\s*(${tt[rt.XRANGEPLAIN]})\\s+-\\s+(${tt[rt.XRANGEPLAIN]})\\s*$`);pr("HYPHENRANGELOOSE",`^\\s*(${tt[rt.XRANGEPLAINLOOSE]})\\s+-\\s+(${tt[rt.XRANGEPLAINLOOSE]})\\s*$`);pr("STAR","(<|>)?=?\\s*\\*");pr("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");pr("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var K6=b((Wgn,KDe)=>{var g6t=Object.freeze({loose:!0}),y6t=Object.freeze({}),b6t=e=>e?typeof e!="object"?g6t:e:y6t;KDe.exports=b6t});var ose=b((Jgn,XDe)=>{var YDe=/^[0-9]+$/,ZDe=(e,t)=>{let r=YDe.test(e),n=YDe.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},_6t=(e,t)=>ZDe(t,e);XDe.exports={compareIdentifiers:ZDe,rcompareIdentifiers:_6t}});var Rc=b((Ggn,rje)=>{var Y6=B$(),{MAX_LENGTH:QDe,MAX_SAFE_INTEGER:Z6}=k$(),{safeRe:eje,t:tje}=AD(),v6t=K6(),{compareIdentifiers:RD}=ose(),ise=class e{constructor(t,r){if(r=v6t(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>QDe)throw new TypeError(`version is longer than ${QDe} characters`);Y6("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?eje[tje.LOOSE]:eje[tje.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Z6||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Z6||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Z6||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<Z6)return i}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Y6("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),RD(this.major,t.major)||RD(this.minor,t.minor)||RD(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=t.prerelease[r];if(Y6("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return RD(n,o)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],o=t.build[r];if(Y6("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return RD(n,o)}while(++r)}inc(t,r,n){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let i=[r,o];n===!1&&(i=[r]),RD(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};rje.exports=ise});var kM=b((Kgn,oje)=>{var nje=Rc(),w6t=(e,t,r=!1)=>{if(e instanceof nje)return e;try{return new nje(e,t)}catch(n){if(!r)return null;throw n}};oje.exports=w6t});var aje=b((Ygn,ije)=>{var S6t=kM(),x6t=(e,t)=>{let r=S6t(e,t);return r?r.version:null};ije.exports=x6t});var uje=b((Zgn,sje)=>{var C6t=kM(),O6t=(e,t)=>{let r=C6t(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};sje.exports=O6t});var dje=b((Xgn,cje)=>{var lje=Rc(),E6t=(e,t,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new lje(e instanceof lje?e.version:e,r).inc(t,n,o).version}catch{return null}};cje.exports=E6t});var hje=b((Qgn,pje)=>{var fje=kM(),P6t=(e,t)=>{let r=fje(e,null,!0),n=fje(t,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"};pje.exports=P6t});var gje=b((eyn,mje)=>{var T6t=Rc(),M6t=(e,t)=>new T6t(e,t).major;mje.exports=M6t});var bje=b((tyn,yje)=>{var I6t=Rc(),A6t=(e,t)=>new I6t(e,t).minor;yje.exports=A6t});var vje=b((ryn,_je)=>{var R6t=Rc(),D6t=(e,t)=>new R6t(e,t).patch;_je.exports=D6t});var Sje=b((nyn,wje)=>{var j6t=kM(),N6t=(e,t)=>{let r=j6t(e,t);return r&&r.prerelease.length?r.prerelease:null};wje.exports=N6t});var Yp=b((oyn,Cje)=>{var xje=Rc(),L6t=(e,t,r)=>new xje(e,r).compare(new xje(t,r));Cje.exports=L6t});var Eje=b((iyn,Oje)=>{var F6t=Yp(),k6t=(e,t,r)=>F6t(t,e,r);Oje.exports=k6t});var Tje=b((ayn,Pje)=>{var B6t=Yp(),$6t=(e,t)=>B6t(e,t,!0);Pje.exports=$6t});var X6=b((syn,Ije)=>{var Mje=Rc(),q6t=(e,t,r)=>{let n=new Mje(e,r),o=new Mje(t,r);return n.compare(o)||n.compareBuild(o)};Ije.exports=q6t});var Rje=b((uyn,Aje)=>{var U6t=X6(),z6t=(e,t)=>e.sort((r,n)=>U6t(r,n,t));Aje.exports=z6t});var jje=b((lyn,Dje)=>{var H6t=X6(),V6t=(e,t)=>e.sort((r,n)=>H6t(n,r,t));Dje.exports=V6t});var $$=b((cyn,Nje)=>{var W6t=Yp(),J6t=(e,t,r)=>W6t(e,t,r)>0;Nje.exports=J6t});var Q6=b((dyn,Lje)=>{var G6t=Yp(),K6t=(e,t,r)=>G6t(e,t,r)<0;Lje.exports=K6t});var ase=b((fyn,Fje)=>{var Y6t=Yp(),Z6t=(e,t,r)=>Y6t(e,t,r)===0;Fje.exports=Z6t});var sse=b((pyn,kje)=>{var X6t=Yp(),Q6t=(e,t,r)=>X6t(e,t,r)!==0;kje.exports=Q6t});var eV=b((hyn,Bje)=>{var eVt=Yp(),tVt=(e,t,r)=>eVt(e,t,r)>=0;Bje.exports=tVt});var tV=b((myn,$je)=>{var rVt=Yp(),nVt=(e,t,r)=>rVt(e,t,r)<=0;$je.exports=nVt});var use=b((gyn,qje)=>{var oVt=ase(),iVt=sse(),aVt=$$(),sVt=eV(),uVt=Q6(),lVt=tV(),cVt=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return oVt(e,r,n);case"!=":return iVt(e,r,n);case">":return aVt(e,r,n);case">=":return sVt(e,r,n);case"<":return uVt(e,r,n);case"<=":return lVt(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};qje.exports=cVt});var zje=b((yyn,Uje)=>{var dVt=Rc(),fVt=kM(),{safeRe:rV,t:nV}=AD(),pVt=(e,t)=>{if(e instanceof dVt)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?rV[nV.COERCEFULL]:rV[nV.COERCE]);else{let u=t.includePrerelease?rV[nV.COERCERTLFULL]:rV[nV.COERCERTL],l;for(;(l=u.exec(e))&&(!r||r.index+r[0].length!==e.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=t.includePrerelease&&r[5]?`-${r[5]}`:"",s=t.includePrerelease&&r[6]?`+${r[6]}`:"";return fVt(`${n}.${o}.${i}${a}${s}`,t)};Uje.exports=pVt});var Vje=b((byn,Hje)=>{var lse=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(t,r)}return this}};Hje.exports=lse});var Zp=b((_yn,Kje)=>{var hVt=/\s+/g,cse=class e{constructor(t,r){if(r=gVt(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof dse)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(hVt," "),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=>!Jje(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&&xVt(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&wVt)|(this.options.loose&&SVt))+":"+t,o=Wje.get(n);if(o)return o;let i=this.options.loose,a=i?tf[vd.HYPHENRANGELOOSE]:tf[vd.HYPHENRANGE];t=t.replace(a,DVt(this.options.includePrerelease)),yi("hyphen replace",t),t=t.replace(tf[vd.COMPARATORTRIM],bVt),yi("comparator trim",t),t=t.replace(tf[vd.TILDETRIM],_Vt),yi("tilde trim",t),t=t.replace(tf[vd.CARETTRIM],vVt),yi("caret trim",t);let s=t.split(" ").map(d=>CVt(d,this.options)).join(" ").split(/\s+/).map(d=>RVt(d,this.options));i&&(s=s.filter(d=>(yi("loose invalid filter",d,this.options),!!d.match(tf[vd.COMPARATORLOOSE])))),yi("range list",s);let u=new Map,l=s.map(d=>new dse(d,this.options));for(let d of l){if(Jje(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return Wje.set(n,c),c}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>Gje(n,r)&&t.set.some(o=>Gje(o,r)&&n.every(i=>o.every(a=>i.intersects(a,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new yVt(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(jVt(this.set[r],t,this.options))return!0;return!1}};Kje.exports=cse;var mVt=Vje(),Wje=new mVt,gVt=K6(),dse=q$(),yi=B$(),yVt=Rc(),{safeRe:tf,t:vd,comparatorTrimReplace:bVt,tildeTrimReplace:_Vt,caretTrimReplace:vVt}=AD(),{FLAG_INCLUDE_PRERELEASE:wVt,FLAG_LOOSE:SVt}=k$(),Jje=e=>e.value==="<0.0.0-0",xVt=e=>e.value==="",Gje=(e,t)=>{let r=!0,n=e.slice(),o=n.pop();for(;r&&n.length;)r=n.every(i=>o.intersects(i,t)),o=n.pop();return r},CVt=(e,t)=>(yi("comp",e,t),e=PVt(e,t),yi("caret",e),e=OVt(e,t),yi("tildes",e),e=MVt(e,t),yi("xrange",e),e=AVt(e,t),yi("stars",e),e),wd=e=>!e||e.toLowerCase()==="x"||e==="*",OVt=(e,t)=>e.trim().split(/\s+/).map(r=>EVt(r,t)).join(" "),EVt=(e,t)=>{let r=t.loose?tf[vd.TILDELOOSE]:tf[vd.TILDE];return e.replace(r,(n,o,i,a,s)=>{yi("tilde",e,n,o,i,a,s);let u;return wd(o)?u="":wd(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:wd(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(yi("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,yi("tilde return",u),u})},PVt=(e,t)=>e.trim().split(/\s+/).map(r=>TVt(r,t)).join(" "),TVt=(e,t)=>{yi("caret",e,t);let r=t.loose?tf[vd.CARETLOOSE]:tf[vd.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(o,i,a,s,u)=>{yi("caret",e,o,i,a,s,u);let l;return wd(i)?l="":wd(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:wd(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(yi("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`):(yi("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`),yi("caret return",l),l})},MVt=(e,t)=>(yi("replaceXRanges",e,t),e.split(/\s+/).map(r=>IVt(r,t)).join(" ")),IVt=(e,t)=>{e=e.trim();let r=t.loose?tf[vd.XRANGELOOSE]:tf[vd.XRANGE];return e.replace(r,(n,o,i,a,s,u)=>{yi("xRange",e,n,o,i,a,s,u);let l=wd(i),c=l||wd(a),d=c||wd(s),f=d;return o==="="&&f&&(o=""),u=t.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`),yi("xRange return",n),n})},AVt=(e,t)=>(yi("replaceStars",e,t),e.trim().replace(tf[vd.STAR],"")),RVt=(e,t)=>(yi("replaceGTE0",e,t),e.trim().replace(tf[t.includePrerelease?vd.GTE0PRE:vd.GTE0],"")),DVt=e=>(t,r,n,o,i,a,s,u,l,c,d,f)=>(wd(n)?r="":wd(o)?r=`>=${n}.0.0${e?"-0":""}`:wd(i)?r=`>=${n}.${o}.0${e?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,wd(l)?u="":wd(c)?u=`<${+l+1}.0.0-0`:wd(d)?u=`<${l}.${+c+1}.0-0`:f?u=`<=${l}.${c}.${d}-${f}`:e?u=`<${l}.${c}.${+d+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),jVt=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++)if(yi(e[n].semver),e[n].semver!==dse.ANY&&e[n].semver.prerelease.length>0){let o=e[n].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}return!1}return!0}});var q$=b((vyn,tNe)=>{var U$=Symbol("SemVer ANY"),hse=class e{static get ANY(){return U$}constructor(t,r){if(r=Yje(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),pse("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===U$?this.value="":this.value=this.operator+this.semver.version,pse("comp",this)}parse(t){let r=this.options.loose?Zje[Xje.COMPARATORLOOSE]:Zje[Xje.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new Qje(n[2],this.options.loose):this.semver=U$}toString(){return this.value}test(t){if(pse("Comparator.test",t,this.options.loose),this.semver===U$||t===U$)return!0;if(typeof t=="string")try{t=new Qje(t,this.options)}catch{return!1}return fse(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new eNe(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new eNe(this.value,r).test(t.semver):(r=Yje(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||fse(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||fse(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};tNe.exports=hse;var Yje=K6(),{safeRe:Zje,t:Xje}=AD(),fse=use(),pse=B$(),Qje=Rc(),eNe=Zp()});var z$=b((wyn,rNe)=>{var NVt=Zp(),LVt=(e,t,r)=>{try{t=new NVt(t,r)}catch{return!1}return t.test(e)};rNe.exports=LVt});var oNe=b((Syn,nNe)=>{var FVt=Zp(),kVt=(e,t)=>new FVt(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));nNe.exports=kVt});var aNe=b((xyn,iNe)=>{var BVt=Rc(),$Vt=Zp(),qVt=(e,t,r)=>{let n=null,o=null,i=null;try{i=new $Vt(t,r)}catch{return null}return e.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new BVt(n,r))}),n};iNe.exports=qVt});var uNe=b((Cyn,sNe)=>{var UVt=Rc(),zVt=Zp(),HVt=(e,t,r)=>{let n=null,o=null,i=null;try{i=new zVt(t,r)}catch{return null}return e.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new UVt(n,r))}),n};sNe.exports=HVt});var dNe=b((Oyn,cNe)=>{var mse=Rc(),VVt=Zp(),lNe=$$(),WVt=(e,t)=>{e=new VVt(e,t);let r=new mse("0.0.0");if(e.test(r)||(r=new mse("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n<e.set.length;++n){let o=e.set[n],i=null;o.forEach(a=>{let s=new mse(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||lNe(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||lNe(r,i))&&(r=i)}return r&&e.test(r)?r:null};cNe.exports=WVt});var pNe=b((Eyn,fNe)=>{var JVt=Zp(),GVt=(e,t)=>{try{return new JVt(e,t).range||"*"}catch{return null}};fNe.exports=GVt});var oV=b((Pyn,yNe)=>{var KVt=Rc(),gNe=q$(),{ANY:YVt}=gNe,ZVt=Zp(),XVt=z$(),hNe=$$(),mNe=Q6(),QVt=tV(),e5t=eV(),t5t=(e,t,r,n)=>{e=new KVt(e,n),t=new ZVt(t,n);let o,i,a,s,u;switch(r){case">":o=hNe,i=QVt,a=mNe,s=">",u=">=";break;case"<":o=mNe,i=e5t,a=hNe,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(XVt(e,t,n))return!1;for(let l=0;l<t.set.length;++l){let c=t.set[l],d=null,f=null;if(c.forEach(p=>{p.semver===YVt&&(p=new gNe(">=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(e,f.semver))return!1;if(f.operator===u&&a(e,f.semver))return!1}return!0};yNe.exports=t5t});var _Ne=b((Tyn,bNe)=>{var r5t=oV(),n5t=(e,t,r)=>r5t(e,t,">",r);bNe.exports=n5t});var wNe=b((Myn,vNe)=>{var o5t=oV(),i5t=(e,t,r)=>o5t(e,t,"<",r);vNe.exports=i5t});var CNe=b((Iyn,xNe)=>{var SNe=Zp(),a5t=(e,t,r)=>(e=new SNe(e,r),t=new SNe(t,r),e.intersects(t,r));xNe.exports=a5t});var ENe=b((Ayn,ONe)=>{var s5t=z$(),u5t=Yp();ONe.exports=(e,t,r)=>{let n=[],o=null,i=null,a=e.sort((c,d)=>u5t(c,d,r));for(let c of a)s5t(c,t,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 t.raw=="string"?t.raw:String(t);return u.length<l.length?u:t}});var RNe=b((Ryn,ANe)=>{var PNe=Zp(),yse=q$(),{ANY:gse}=yse,H$=z$(),bse=Yp(),l5t=(e,t,r={})=>{if(e===t)return!0;e=new PNe(e,r),t=new PNe(t,r);let n=!1;e:for(let o of e.set){for(let i of t.set){let a=d5t(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},c5t=[new yse(">=0.0.0-0")],TNe=[new yse(">=0.0.0")],d5t=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===gse){if(t.length===1&&t[0].semver===gse)return!0;r.includePrerelease?e=c5t:e=TNe}if(t.length===1&&t[0].semver===gse){if(r.includePrerelease)return!0;t=TNe}let n=new Set,o,i;for(let p of e)p.operator===">"||p.operator===">="?o=MNe(o,p,r):p.operator==="<"||p.operator==="<="?i=INe(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=bse(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&&!H$(p,String(o),r)||i&&!H$(p,String(i),r))return null;for(let h of t)if(!H$(p,String(h),r))return!1;return!0}let s,u,l,c,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of t){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=MNe(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!H$(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=INe(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!H$(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)},MNe=(e,t,r)=>{if(!e)return t;let n=bse(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},INe=(e,t,r)=>{if(!e)return t;let n=bse(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};ANe.exports=l5t});var LNe=b((Dyn,NNe)=>{var _se=AD(),DNe=k$(),f5t=Rc(),jNe=ose(),p5t=kM(),h5t=aje(),m5t=uje(),g5t=dje(),y5t=hje(),b5t=gje(),_5t=bje(),v5t=vje(),w5t=Sje(),S5t=Yp(),x5t=Eje(),C5t=Tje(),O5t=X6(),E5t=Rje(),P5t=jje(),T5t=$$(),M5t=Q6(),I5t=ase(),A5t=sse(),R5t=eV(),D5t=tV(),j5t=use(),N5t=zje(),L5t=q$(),F5t=Zp(),k5t=z$(),B5t=oNe(),$5t=aNe(),q5t=uNe(),U5t=dNe(),z5t=pNe(),H5t=oV(),V5t=_Ne(),W5t=wNe(),J5t=CNe(),G5t=ENe(),K5t=RNe();NNe.exports={parse:p5t,valid:h5t,clean:m5t,inc:g5t,diff:y5t,major:b5t,minor:_5t,patch:v5t,prerelease:w5t,compare:S5t,rcompare:x5t,compareLoose:C5t,compareBuild:O5t,sort:E5t,rsort:P5t,gt:T5t,lt:M5t,eq:I5t,neq:A5t,gte:R5t,lte:D5t,cmp:j5t,coerce:N5t,Comparator:L5t,Range:F5t,satisfies:k5t,toComparators:B5t,maxSatisfying:$5t,minSatisfying:q5t,minVersion:U5t,validRange:z5t,outside:H5t,gtr:V5t,ltr:W5t,intersects:J5t,simplifyRange:G5t,subset:K5t,SemVer:f5t,re:_se.re,src:_se.src,tokens:_se.t,SEMVER_SPEC_VERSION:DNe.SEMVER_SPEC_VERSION,RELEASE_TYPES:DNe.RELEASE_TYPES,compareIdentifiers:jNe.compareIdentifiers,rcompareIdentifiers:jNe.rcompareIdentifiers}});function vS(e){if(!e||e.split("/").length>2||e.startsWith("/")||e.endsWith("/")||e.split(":").length>2)throw new Error(`Invalid identifier format: ${e}`);let[t,r]=e.split(":"),n=r||"latest";if(t.includes("/")){let[o,i]=t.split("/",2);if(!o||!i)throw new Error(`Invalid identifier format: ${e}`);return[o,i,n]}else{if(!t)throw new Error(`Invalid identifier format: ${e}`);return["-",t,n]}}var Y5t,FNe=C(()=>{Y5t=B(LNe(),1)});async function zr(e,t,r){let n;if(e.ok){r&&(n=await e.text());return}n=await e.text();let o=`Failed to ${t}. Received status [${e.status}]: ${e.statusText}. Server response: ${n}`;throw e.status===409?new vse(o):new Error(o)}var vse,kNe=C(()=>{vse=class extends Error{constructor(t){super(t),this.name="LangSmithConflictError"}}});function X5t(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function rf(e,t,r,n){try{return JSON.stringify(e,t,r)}catch(a){if(!a.message?.includes("Converting circular structure to JSON"))return console.warn("[WARNING]: LangSmith received unserializable value."),"[Unserializable]";console.warn("[WARNING]: LangSmith received circular JSON. This will decrease tracer performance."),typeof n>"u"&&(n=X5t()),Sse(e,"",0,[],void 0,0,n);var o;try{DD.length===0?o=JSON.stringify(e,t,r):o=JSON.stringify(e,Q5t(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;iV.length!==0;){var i=iV.pop();i.length===4?Object.defineProperty(i[0],i[1],i[3]):i[0][i[1]]=i[2]}}return o}}function wse(e,t,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:e}),iV.push([n,r,t,o])):DD.push([t,r,e]):(n[r]=e,iV.push([n,r,t]))}function Sse(e,t,r,n,o,i,a){i+=1;var s;if(typeof e=="object"&&e!==null){for(s=0;s<n.length;s++)if(n[s]===e){wse(Z5t,e,t,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){wse(BNe,e,t,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){wse(BNe,e,t,o);return}if(n.push(e),Array.isArray(e))for(s=0;s<e.length;s++)Sse(e[s],s,s,n,e,i,a);else{var u=Object.keys(e);for(s=0;s<u.length;s++){var l=u[s];Sse(e[l],l,s,n,e,i,a)}}n.pop()}}function Q5t(e){return e=typeof e<"u"?e:function(t,r){return r},function(t,r){if(DD.length>0)for(var n=0;n<DD.length;n++){var o=DD[n];if(o[1]===t&&o[0]===r){r=o[2],DD.splice(n,1);break}}return e.call(this,t,r)}}var BNe,Z5t,iV,DD,$Ne=C(()=>{BNe="[...]",Z5t={result:"[Circular]"},iV=[],DD=[]});function qNe(e){let t=uV(),r=UNe(),n=e.extra??{},o=n.metadata;return e.extra={...n,runtime:{...t,...n?.runtime},metadata:{...r,...r.revision_id||e.revision_id?{revision_id:e.revision_id??r.revision_id}:{},...o}},e}async function r9t(e){let t=[];for await(let r of e)t.push(r);return t}function xse(e){if(e!==void 0)return e.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}var e9t,t9t,n9t,Cse,o9t,i9t,BM,Ose=C(()=>{$6();UDe();zDe();lV();sV();HDe();tse();FNe();kNe();W6();$Ne();e9t=()=>{let e=wS("TRACING_SAMPLING_RATE");if(e===void 0)return;let t=parseFloat(e);if(t<0||t>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${t}`);return t},t9t=e=>{let r=e.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};n9t=async e=>{if(e?.status===429){let t=parseInt(e.headers.get("retry-after")??"30",10)*1e3;if(t>0)return await new Promise(r=>setTimeout(r,t)),!0}return!1},Cse=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(t){let r,n=new Promise(i=>{r=i}),o=rf(t.item).length;return this.items.push({action:t.action,payload:t.item,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n}pop(t){if(t<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)<t&&this.items.length>0;){let o=this.items.shift();o&&(r.push(o),n+=o.size,this.sizeBytes-=o.size)}if(r.length===0&&this.items.length>0){let o=this.items.shift();r.push(o),n+=o.size,this.sizeBytes-=o.size}return[r.map(o=>({action:o.action,item:o.payload})),()=>r.forEach(o=>o.itemPromiseResolve())]}},o9t=20971520,i9t=2500,BM=class e{constructor(t={}){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 Cse}),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:oy("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});let r=e.getDefaultClientConfig();if(this.tracingSampleRate=e9t(),this.apiUrl=xse(t.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=xse(t.apiKey??r.apiKey),this.webUrl=xse(t.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.timeout_ms=t.timeout_ms??9e4,this.caller=new F$(t.callerOptions??{}),this.traceBatchConcurrency=t.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.batchIngestCaller=new F$({maxRetries:2,maxConcurrency:this.traceBatchConcurrency,...t.callerOptions??{},onFailedResponseHook:n9t}),this.hideInputs=t.hideInputs??t.anonymizer??r.hideInputs,this.hideOutputs=t.hideOutputs??t.anonymizer??r.hideOutputs,this.autoBatchTracing=t.autoBatchTracing??this.autoBatchTracing,this.blockOnRootRunFinalization=t.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=t.batchSizeBytesLimit,this.fetchOptions=t.fetchOptions||{},this.manualFlushMode=t.manualFlushMode??this.manualFlushMode}static getDefaultClientConfig(){let t=wS("API_KEY"),r=wS("ENDPOINT")??"https://api.smith.langchain.com",n=wS("HIDE_INPUTS")==="true",o=wS("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:t,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:t9t(this.apiUrl)?(this.webUrl="http://localhost:3000",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.webUrl="https://smith.langchain.com",this.webUrl)}get headers(){let t={"User-Agent":`langsmith-js/${aV}`};return this.apiKey&&(t["x-api-key"]=`${this.apiKey}`),t}processInputs(t){return this.hideInputs===!1?t:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(t):t}processOutputs(t){return this.hideOutputs===!1?t:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(t):t}prepareRunCreateOrUpdateInputs(t){let r={...t};return r.inputs!==void 0&&(r.inputs=this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=this.processOutputs(r.outputs)),r}async _getResponse(t,r){let n=r?.toString()??"",o=`${this.apiUrl}${t}?${n}`,i=await this.caller.call(St(),o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zr(i,`Failed to fetch ${t}`),i}async _get(t,r){return(await this._getResponse(t,r)).json()}async*_getPaginated(t,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}${t}?${r}`,s=await this.caller.call(St(),a,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(s,`Failed to fetch ${t}`);let u=n?n(await s.json()):await s.json();if(u.length===0||(yield u,u.length<i))break;o+=u.length}}async*_getCursorPaginatedList(t,r=null,n="POST",o="runs"){let i=r?{...r}:{};for(;;){let s=await(await this.caller.call(St(),`${this.apiUrl}${t}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)})).json();if(!s||!s[o])break;yield s[o];let u=s.cursors;if(!u||!u.next)break;i.cursor=u.next}}_filterForSampling(t,r=!1){if(this.tracingSampleRate===void 0)return t;if(r){let n=[];for(let o of t)this.filteredPostUuids.has(o.id)?this.filteredPostUuids.delete(o.id):n.push(o);return n}else{let n=[];for(let o of t)o.id!==o.trace_id&&!this.filteredPostUuids.has(o.trace_id)||Math.random()<this.tracingSampleRate?n.push(o):this.filteredPostUuids.add(o.id);return n}}async _getBatchSizeLimitBytes(){let t=await this._ensureServerInfo();return this.batchSizeBytesLimit??t.batch_ingest_config?.size_limit_bytes??o9t}async _getMultiPartSupport(){return(await this._ensureServerInfo()).instance_flags?.dataset_examples_multipart_enabled??!1}drainAutoBatchQueue(t){let r=[];for(;this.autoBatchQueue.items.length>0;){let[n,o]=this.autoBatchQueue.pop(t);if(!n.length){o();break}let i=this._processBatch(n,o).catch(console.error);r.push(i)}return Promise.all(r)}async _processBatch(t,r){if(!t.length){r();return}try{let n={runCreates:t.filter(i=>i.action==="create").map(i=>i.item),runUpdates:t.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(t){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,t.action==="create"&&(t.item=qNe(t.item));let r=this.autoBatchQueue.push(t);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 t=await St()(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(i9t),...this.fetchOptions});return await zr(t,"get server info"),t.json()}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(t=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),t))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let t=await this._getBatchSizeLimitBytes();await this.drainAutoBatchQueue(t)}async createRun(t){if(!this._filterForSampling([t]).length)return;let r={...this.headers,"Content-Type":"application/json"},n=t.project_name;delete t.project_name;let o=this.prepareRunCreateOrUpdateInputs({session_name:n,...t,start_time:t.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=qNe(o),a=await this.caller.call(St(),`${this.apiUrl}/runs`,{method:"POST",headers:r,body:rf(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(a,"create run",!0)}async batchIngestRuns({runCreates:t,runUpdates:r}){if(t===void 0&&r===void 0)return;let n=t?.map(s=>this.prepareRunCreateOrUpdateInputs(s))??[],o=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:this._filterForSampling(n),patch:this._filterForSampling(o,!0)};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(rf(a))}async _postBatchIngestRuns(t){let r={...this.headers,"Content-Type":"application/json",Accept:"application/json"},n=await this.batchIngestCaller.call(St(),`${this.apiUrl}/runs/batch`,{method:"POST",headers:r,body:t,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(n,"batch create run",!0)}async multipartIngestRuns({runCreates:t,runUpdates:r}){if(t===void 0&&r===void 0)return;let n={},o=[];for(let c of t??[]){let d=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(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:h,events:m,attachments:_,...g}=f,v={inputs:p,outputs:h,events:m},S=rf(g);l.push({name:`${c}.${g.id}`,payload:new Blob([S],{type:`application/json; length=${S.length}`})});for(let[x,O]of Object.entries(v)){if(O===void 0)continue;let T=rf(O);l.push({name:`${c}.${g.id}.${x}`,payload:new Blob([T],{type:`application/json; length=${T.length}`})})}if(g.id!==void 0){let x=n[g.id];if(x){delete n[g.id];for(let[O,T]of Object.entries(x)){let E,M;if(Array.isArray(T)?[E,M]=T:(E=T.mimeType,M=T.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([M],{type:`${E}; length=${M.byteLength}`})})}}}u.push(`trace=${g.trace_id},id=${g.id}`)}await this._sendMultipartRequest(l,u.join("; "))}async _sendMultipartRequest(t,r){try{let n="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),o=[];for(let u of t)o.push(new Blob([`--${n}\r
`])),o.push(new Blob([`Content-Disposition: form-data; name="${u.name}"\r
`,`Content-Type: ${u.payload.type}\r
\r
`])),o.push(u.payload),o.push(new Blob([`\r
`]));o.push(new Blob([`--${n}--\r
`]));let a=await new Blob(o).arrayBuffer(),s=await this.batchIngestCaller.call(St(),`${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 zr(s,"ingest multipart runs",!0)}catch(n){console.warn(`${n.message.trim()}
Context: ${r}`)}}async updateRun(t,r){tn(t),r.inputs&&(r.inputs=this.processInputs(r.inputs)),r.outputs&&(r.outputs=this.processOutputs(r.outputs));let n={...r,id:t};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(St(),`${this.apiUrl}/runs/${t}`,{method:"PATCH",headers:o,body:rf(r),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(i,"update run",!0)}async readRun(t,{loadChildRuns:r}={loadChildRuns:!1}){tn(t);let n=await this._get(`/runs/${t}`);return r&&n.child_run_ids&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:t,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:wS("PROJECT")||"default"})).id;let i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/projects/p/${o}/r/${r.id}?poll=true`}else if(t!==void 0){let o=await this.readRun(t);if(!o.app_path)throw new Error(`Run ${t} has no app_path`);return`${this.getHostUrl()}${o.app_path}`}else throw new Error("Must provide either runId or run")}async _loadChildRuns(t){let r=await r9t(this.listRuns({id:t.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}t.child_runs=n[t.id]||[];for(let i in n)i!==t.id&&(o[i].child_runs=n[i]);return t}async*listRuns(t){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:a,startTime:s,executionOrder:u,isRoot:l,runType:c,error:d,id:f,query:p,filter:h,traceFilter:m,treeFilter:_,limit:g,select:v}=t,S=[];if(r&&(S=Array.isArray(r)?r:[r]),n){let E=Array.isArray(n)?n:[n],M=await Promise.all(E.map(A=>this.readProject({projectName:A}).then(j=>j.id)));S.push(...M)}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:h,trace_filter:m,tree_filter:_,execution_order:u,parent_run:o,start_time:s?s.toISOString():null,error:d,id:f,limit:g,trace:i,select:v||x,is_root:l},T=0;for await(let E of this._getCursorPaginatedList("/runs/query",O))if(g){if(T>=g)break;if(E.length+T>g){yield*E.slice(0,g-T);break}T+=E.length,yield*E}else yield*E}async getRunStats({id:t,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:a,referenceExampleIds:s,startTime:u,endTime:l,error:c,query:d,filter:f,traceFilter:p,treeFilter:h,isRoot:m,dataSourceType:_}){let g=a||[];i&&(g=[...a||[],...await Promise.all(i.map(T=>this.readProject({projectName:T}).then(E=>E.id)))]);let S=Object.fromEntries(Object.entries({id:t,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:h,is_root:m,data_source_type:_}).filter(([T,E])=>E!==void 0));return await(await this.caller.call(St(),`${this.apiUrl}/runs/stats`,{method:"POST",headers:this.headers,body:JSON.stringify(S),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async shareRun(t,{shareId:r}={}){let n={run_id:t,share_token:r||hO()};tn(t);let i=await(await this.caller.call(St(),`${this.apiUrl}/runs/${t}/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(t){tn(t);let r=await this.caller.call(St(),`${this.apiUrl}/runs/${t}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(r,"unshare run",!0)}async readRunSharedLink(t){tn(t);let n=await(await this.caller.call(St(),`${this.apiUrl}/runs/${t}/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(t,{runIds:r}={}){let n=new URLSearchParams({share_token:t});if(r!==void 0)for(let a of r)n.append("id",a);return tn(t),await(await this.caller.call(St(),`${this.apiUrl}/public/${t}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async readDatasetSharedSchema(t,r){if(!t&&!r)throw new Error("Either datasetId or datasetName must be given");t||(t=(await this.readDataset({datasetName:r})).id),tn(t);let o=await(await this.caller.call(St(),`${this.apiUrl}/datasets/${t}/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(t,r){if(!t&&!r)throw new Error("Either datasetId or datasetName must be given");t||(t=(await this.readDataset({datasetName:r})).id);let n={dataset_id:t};tn(t);let i=await(await this.caller.call(St(),`${this.apiUrl}/datasets/${t}/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(t){tn(t);let r=await this.caller.call(St(),`${this.apiUrl}/datasets/${t}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(r,"unshare dataset",!0)}async readSharedDataset(t){return tn(t),await(await this.caller.call(St(),`${this.apiUrl}/public/${t}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async listSharedExamples(t,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(St(),`${this.apiUrl}/public/${t}/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:t,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:t,extra:l,description:r};a!==null&&(c.reference_dataset_id=a);let d=await this.caller.call(St(),u,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(c),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zr(d,"create project"),await d.json()}async updateProject(t,{name:r=null,description:n=null,metadata:o=null,projectExtra:i=null,endTime:a=null}){let s=`${this.apiUrl}/sessions/${t}`,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(St(),s,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(l),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zr(c,"update project"),await c.json()}async hasProject({projectId:t,projectName:r}){let n="/sessions",o=new URLSearchParams;if(t!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(t!==void 0)tn(t),n+=`/${t}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide projectName or projectId");let i=await this.caller.call(St(),`${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:t,projectName:r,includeStats:n}){let o="/sessions",i=new URLSearchParams;if(t!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(t!==void 0)tn(t),o+=`/${t}`;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=${t}, name=${r}] not found`);s=a[0]}else s=a;return s}async getProjectUrl({projectId:t,projectName:r}){if(t===void 0&&r===void 0)throw new Error("Must provide either projectName or projectId");let n=await this.readProject({projectId:t,projectName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/projects/p/${n.id}`}async getDatasetUrl({datasetId:t,datasetName:r}){if(t===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");let n=await this.readDataset({datasetId:t,datasetName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/datasets/${n.id}`}async _getTenantId(){if(this._tenantId!==null)return this._tenantId;let t=new URLSearchParams({limit:"1"});for await(let r of this._getPaginated("/sessions",t))return this._tenantId=r[0].tenant_id,r[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:t,name:r,nameContains:n,referenceDatasetId:o,referenceDatasetName:i,referenceFree:a,metadata:s}={}){let u=new URLSearchParams;if(t!==void 0)for(let l of t)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:t,projectName:r}){let n;if(t===void 0&&r===void 0)throw new Error("Must provide projectName or projectId");if(t!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");t===void 0?n=(await this.readProject({projectName:r})).id:n=t,tn(n);let o=await this.caller.call(St(),`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(o,`delete session ${n} (${r})`,!0)}async uploadCsv({csvFile:t,fileName:r,inputKeys:n,outputKeys:o,description:i,dataType:a,name:s}){let u=`${this.apiUrl}/datasets/upload`,l=new FormData;l.append("file",t,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(St(),u,{method:"POST",headers:this.headers,body:l,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zr(c,"upload CSV"),await c.json()}async createDataset(t,{description:r,dataType:n,inputsSchema:o,outputsSchema:i,metadata:a}={}){let s={name:t,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(St(),`${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 zr(u,"create dataset"),await u.json()}async readDataset({datasetId:t,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(t!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(t!==void 0)tn(t),n+=`/${t}`;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=${t}, name=${r}] not found`);a=i[0]}else a=i;return a}async hasDataset({datasetId:t,datasetName:r}){try{return await this.readDataset({datasetId:t,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:t,datasetName:r,fromVersion:n,toVersion:o}){let i=t;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:t,datasetName:r}){let n="/datasets";if(t===void 0)if(r!==void 0)t=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide datasetName or datasetId");return(await(await this._getResponse(`${n}/${t}/openai_ft`)).text()).trim().split(`
`).map(s=>JSON.parse(s))}async*listDatasets({limit:t=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:a}={}){let s="/datasets",u=new URLSearchParams({limit:t.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(t){let{datasetId:r,datasetName:n,...o}=t;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;tn(i);let a=await this.caller.call(St(),`${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 zr(a,"update dataset"),await a.json()}async deleteDataset({datasetId:t,datasetName:r}){let n="/datasets",o=t;if(t!==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)tn(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");let i=await this.caller.call(St(),this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(i,`delete ${n}`),await i.json()}async indexDataset({datasetId:t,datasetName:r,tag:n}){let o=t;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),tn(o);let i={tag:n},a=await this.caller.call(St(),`${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 zr(a,"index dataset"),await a.json()}async similarExamples(t,r,n,{filter:o}={}){let i={limit:n,inputs:t};o!==void 0&&(i.filter=o),tn(r);let a=await this.caller.call(St(),`${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 zr(a,"fetch similar examples"),(await a.json()).examples}async createExample(t,r,{datasetId:n,datasetName:o,createdAt:i,exampleId:a,metadata:s,split:u,sourceRunId:l}){let c=n;if(c===void 0&&o===void 0)throw new Error("Must provide either datasetName or datasetId");if(c!==void 0&&o!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");c===void 0&&(c=(await this.readDataset({datasetName:o})).id);let f={dataset_id:c,inputs:t,outputs:r,created_at:(i||new Date)?.toISOString(),id:a,metadata:s,split:u,source_run_id:l},p=await this.caller.call(St(),`${this.apiUrl}/examples`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(f),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zr(p,"create example"),await p.json()}async createExamples(t){let{inputs:r,outputs:n,metadata:o,sourceRunIds:i,exampleIds:a,datasetId:s,datasetName:u}=t,l=s;if(l===void 0&&u===void 0)throw new Error("Must provide either datasetName or datasetId");if(l!==void 0&&u!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");l===void 0&&(l=(await this.readDataset({datasetName:u})).id);let c=r.map((p,h)=>({dataset_id:l,inputs:p,outputs:n?n[h]:void 0,metadata:o?o[h]:void 0,split:t.splits?t.splits[h]:void 0,id:a?a[h]:void 0,source_run_id:i?i[h]:void 0})),d=await this.caller.call(St(),`${this.apiUrl}/examples/bulk`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(c),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zr(d,"create examples"),await d.json()}async createLLMExample(t,r,n){return this.createExample({input:t},{output:r},n)}async createChatExample(t,r,n){let o=t.map(a=>Qae(a)?ese(a):a),i=Qae(r)?ese(r):r;return this.createExample({input:o},{output:i},n)}async readExample(t){tn(t);let r=`/examples/${t}`,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},s),{})),a}async*listExamples({datasetId:t,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:a,metadata:s,limit:u,offset:l,filter:c,includeAttachments:d}={}){let f;if(t!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(t!==void 0)f=t;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),h=o?typeof o=="string"?o:o?.toISOString():void 0;h&&p.append("as_of",h);let m=a??!0;if(p.append("inline_s3_urls",m.toString()),n!==void 0)for(let 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 _=0;for await(let g of this._getPaginated("/examples",p)){for(let v of g){let{attachment_urls:S,...x}=v,O=x;S&&(O.attachments=Object.entries(S).reduce((T,[E,M])=>(T[E.slice(11)]={presigned_url:M.presigned_url},T),{})),yield O,_++}if(u!==void 0&&_>=u)break}}async deleteExample(t){tn(t);let r=`/examples/${t}`,n=await this.caller.call(St(),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(n,`delete ${r}`),await n.json()}async updateExample(t,r){tn(t);let n=await this.caller.call(St(),`${this.apiUrl}/examples/${t}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(r),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zr(n,"update example"),await n.json()}async updateExamples(t){let r=await this.caller.call(St(),`${this.apiUrl}/examples/bulk`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(t),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zr(r,"update examples"),await r.json()}async listDatasetSplits({datasetId:t,datasetName:r,asOf:n}){let o;if(t===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(t!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");t===void 0?o=(await this.readDataset({datasetName:r})).id:o=t,tn(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:t,datasetName:r,splitName:n,exampleIds:o,remove:i=!1}){let a;if(t===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(t!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");t===void 0?a=(await this.readDataset({datasetName:r})).id:a=t,tn(a);let s={split_name:n,examples:o.map(l=>(tn(l),l)),remove:i},u=await this.caller.call(St(),`${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 zr(u,"update dataset splits",!0)}async evaluateRun(t,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){G6("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let a;if(typeof t=="string")a=await this.readRun(t,{loadChildRuns:o});else if(typeof t=="object"&&"id"in t)a=t;else throw new Error(`Invalid run type: ${typeof t}`);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(t,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(!t&&!f)throw new Error("One of runId or projectId must be provided");if(t&&f)throw new Error("Only one of runId or projectId can be provided");let h={type:u??"api",metadata:s??{}};l!==void 0&&h?.metadata!==void 0&&!h.metadata.__run&&(h.metadata.__run={run_id:l}),h?.metadata!==void 0&&h.metadata.__run?.run_id!==void 0&&tn(h.metadata.__run.run_id);let m={id:c??hO(),run_id:t,key:r,score:n,value:o,correction:i,comment:a,feedback_source:h,comparative_experiment_id:p,feedbackConfig:d,session_id:f},_=`${this.apiUrl}/feedback`,g=await this.caller.call(St(),_,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(m),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zr(g,"create feedback",!0),m}async updateFeedback(t,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=r),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),tn(t);let s=await this.caller.call(St(),`${this.apiUrl}/feedback/${t}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(a),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(s,"update feedback",!0)}async readFeedback(t){tn(t);let r=`/feedback/${t}`;return await this._get(r)}async deleteFeedback(t){tn(t);let r=`/feedback/${t}`,n=await this.caller.call(St(),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(n,`delete ${r}`),await n.json()}async*listFeedback({runIds:t,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(t&&o.append("run",t.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(t,r,{expiration:n,feedbackConfig:o}={}){let i={run_id:t,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(St(),`${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:t,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:t,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(St(),`${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(t){tn(t);let r=new URLSearchParams({run_id:t});for await(let n of this._getPaginated("/feedback/tokens",r))yield*n}_selectEvalResults(t){let r;return"results"in t?r=t.results:r=[t],r}async _logEvaluationFeedback(t,r,n){let o=this._selectEvalResults(t),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(t,r,n){let[o]=await this._logEvaluationFeedback(t,r,n);return o}async*listAnnotationQueues(t={}){let{queueIds:r,name:n,nameContains:o,limit:i}=t,a=new URLSearchParams;r&&r.forEach((u,l)=>{tn(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(t){let{name:r,description:n,queueId:o}=t,i={name:r,description:n,id:o||hO()},a=await this.caller.call(St(),`${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 zr(a,"create annotation queue"),await a.json()}async readAnnotationQueue(t){let r=await this.listAnnotationQueues({queueIds:[t]}).next();if(r.done)throw new Error(`Annotation queue with ID ${t} not found`);return r.value}async updateAnnotationQueue(t,r){let{name:n,description:o}=r,i=await this.caller.call(St(),`${this.apiUrl}/annotation-queues/${tn(t,"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 zr(i,"update annotation queue")}async deleteAnnotationQueue(t){let r=await this.caller.call(St(),`${this.apiUrl}/annotation-queues/${tn(t,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(r,"delete annotation queue")}async addRunsToAnnotationQueue(t,r){let n=await this.caller.call(St(),`${this.apiUrl}/annotation-queues/${tn(t,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(r.map((o,i)=>tn(o,`runIds[${i}]`).toString())),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await zr(n,"add runs to annotation queue")}async getRunFromAnnotationQueue(t,r){let n=`/annotation-queues/${tn(t,"queueId")}/run`,o=await this.caller.call(St(),`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zr(o,"get run from annotation queue"),await o.json()}async _currentTenantIsOwner(t){let r=await this._getSettings();return t=="-"||r.tenant_handle===t}async _ownerConflictError(t,r){let n=await this._getSettings();return new Error(`Cannot ${t} for another tenant.
Current tenant: ${n.tenant_handle}
Requested tenant: ${r}`)}async _getLatestCommitHash(t){let r=await this.caller.call(St(),`${this.apiUrl}/commits/${t}/?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(t,r){let[n,o,i]=vS(t),a=await this.caller.call(St(),`${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 zr(a,`${r?"like":"unlike"} prompt`),await a.json()}async _getPromptUrl(t){let[r,n,o]=vS(t);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(t){return!!await this.getPrompt(t)}async likePrompt(t){return this._likeOrUnlikePrompt(t,!0)}async unlikePrompt(t){return this._likeOrUnlikePrompt(t,!1)}async*listCommits(t){for await(let r of this._getPaginated(`/commits/${t}/`,new URLSearchParams,n=>n.commits))yield*r}async*listPrompts(t){let r=new URLSearchParams;r.append("sort_field",t?.sortField??"updated_at"),r.append("sort_direction","desc"),r.append("is_archived",(!!t?.isArchived).toString()),t?.isPublic!==void 0&&r.append("is_public",t.isPublic.toString()),t?.query&&r.append("query",t.query);for await(let n of this._getPaginated("/repos",r,o=>o.repos))yield*n}async getPrompt(t){let[r,n,o]=vS(t),i=await this.caller.call(St(),`${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 zr(i,"get prompt");let a=await i.json();return a.repo?a.repo:null}async createPrompt(t,r){let n=await this._getSettings();if(r?.isPublic&&!n.tenant_handle)throw new Error(`Cannot create a public prompt without first
creating a LangChain Hub handle.
You can add a handle by creating a public prompt at:
https://smith.langchain.com/prompts`);let[o,i,a]=vS(t);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(St(),`${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 zr(u,"create prompt");let{repo:l}=await u.json();return l}async createCommit(t,r,n){if(!await this.promptExists(t))throw new Error("Prompt does not exist, you must create it first.");let[o,i,a]=vS(t),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(St(),`${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 zr(l,"create commit");let c=await l.json();return this._getPromptUrl(`${o}/${i}${c.commit_hash?`:${c.commit_hash}`:""}`)}async updateExamplesMultipart(t,r=[]){if(!await this._getMultiPartSupport())throw new Error("Your LangSmith version does not allow using the multipart examples endpoint, please update to the latest version.");let n=new FormData;for(let a of r){let s=a.id,u={...a.metadata&&{metadata:a.metadata},...a.split&&{split:a.split}},l=rf(u),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=rf(a.inputs),f=new Blob([d],{type:"application/json"});n.append(`${s}.inputs`,f)}if(a.outputs){let d=rf(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,h;Array.isArray(f)?[p,h]=f:(p=f.mimeType,h=f.data);let m=new Blob([h],{type:`${p}; length=${h.byteLength}`});n.append(`${s}.attachment.${d}`,m)}if(a.attachments_operations){let d=rf(a.attachments_operations),f=new Blob([d],{type:"application/json"});n.append(`${s}.attachments_operations`,f)}}return await(await this.caller.call(St(),`${this.apiUrl}/v1/platform/datasets/${t}/examples`,{method:"PATCH",headers:this.headers,body:n})).json()}async uploadExamplesMultipart(t,r=[]){if(!await this._getMultiPartSupport())throw new Error("Your LangSmith version does not allow using the multipart examples endpoint, please update to the latest version.");let n=new FormData;for(let a of r){let s=(a.id??hO()).toString(),u={created_at:a.created_at,...a.metadata&&{metadata:a.metadata},...a.split&&{split:a.split}},l=rf(u),c=new Blob([l],{type:"application/json"});n.append(s,c);let d=rf(a.inputs),f=new Blob([d],{type:"application/json"});if(n.append(`${s}.inputs`,f),a.outputs){let p=rf(a.outputs),h=new Blob([p],{type:"application/json"});n.append(`${s}.outputs`,h)}if(a.attachments)for(let[p,h]of Object.entries(a.attachments)){let m,_;Array.isArray(h)?[m,_]=h:(m=h.mimeType,_=h.data);let g=new Blob([_],{type:`${m}; length=${_.byteLength}`});n.append(`${s}.attachment.${p}`,g)}}return await(await this.caller.call(St(),`${this.apiUrl}/v1/platform/datasets/${t}/examples`,{method:"POST",headers:this.headers,body:n})).json()}async updatePrompt(t,r){if(!await this.promptExists(t))throw new Error("Prompt does not exist, you must create it first.");let[n,o]=vS(t);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(St(),`${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 zr(a,"update prompt"),a.json()}async deletePrompt(t){if(!await this.promptExists(t))throw new Error("Prompt does not exist, you must create it first.");let[r,n,o]=vS(t);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return await(await this.caller.call(St(),`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async pullPromptCommit(t,r){let[n,o,i]=vS(t),a=await this.caller.call(St(),`${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 zr(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(t,r){let n=await this.pullPromptCommit(t,{includeModel:r?.includeModel});return JSON.stringify(n.manifest)}async pushPrompt(t,r){return await this.promptExists(t)?r&&Object.keys(r).some(o=>o!=="object")&&await this.updatePrompt(t,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(t,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(t,r?.object,{parentCommitHash:r?.parentCommitHash}):await this._getPromptUrl(t)}async clonePublicDataset(t,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:o}=r,[i,a]=this.parseTokenOrUrl(t,n),s=new e({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(t,r,n=2,o="dataset"){try{return tn(t),[r,t]}catch{}try{let a=new URL(t).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: ${t}`)}catch{throw new Error(`Invalid public ${o} URL or token: ${t}`)}}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:t})=>t),this.batchIngestCaller.queue.onIdle()])}}});var aV,sV=C(()=>{Ose();cV();W6();aV="0.2.14"});function uV(){if(Ese===void 0){let e=c9t(),t=f9t();Ese={library:"langsmith",runtime:e,sdk:"langsmith-js",sdk_version:aV,...t}}return Ese}function UNe(){let e=d9t()||{},t={},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(e))(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"?t.revision_id=o:t[n]=o);return t}function d9t(){try{return typeof process<"u"&&process.env?Object.entries(process.env).reduce((e,[t,r])=>(e[t]=String(r),e),{}):void 0}catch{return}}function oy(e){try{return typeof process<"u"?process.env?.[e]:void 0}catch{return}}function wS(e){return oy(`LANGSMITH_${e}`)||oy(`LANGCHAIN_${e}`)}function f9t(){if(Pse!==void 0)return Pse;let e=["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"],t={};for(let r of e){let n=oy(r);n!==void 0&&(t[r]=n)}return Pse=t,t}var xS,a9t,s9t,u9t,zNe,l9t,c9t,Ese,Pse,lV=C(()=>{sV();a9t=()=>typeof window<"u"&&typeof window.document<"u",s9t=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",u9t=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),zNe=()=>typeof Deno<"u",l9t=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!zNe(),c9t=()=>xS||(a9t()?xS="browser":l9t()?xS="node":s9t()?xS="webworker":u9t()?xS="jsdom":zNe()?xS="deno":xS="other",xS)});var HNe,VNe=C(()=>{lV();HNe=e=>e!==void 0?e:!!["TRACING_V2","TRACING"].find(r=>wS(r)==="true")});var dV,WNe=C(()=>{dV=Symbol.for("lc:context_variables")});function p9t(e){return e.replace(/[-:.]/g,"")}function h9t(e,t,r=1){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return p9t(`${new Date(e).toISOString().slice(0,-1)}${n}Z`)+t}function pV(e){return e!==void 0&&typeof e.createChild=="function"&&typeof e.postRun=="function"}function GNe(e){return typeof e=="object"&&e!=null&&typeof e.name=="string"&&e.name==="langchain_tracer"}function JNe(e){return Array.isArray(e)&&e.some(t=>GNe(t))}function m9t(e){return typeof e=="object"&&e!=null&&Array.isArray(e.handlers)}function g9t(e){return e!==void 0&&typeof e.callbacks=="object"&&(JNe(e.callbacks?.handlers)||JNe(e.callbacks))}var fV,SS,cV=C(()=>{$6();lV();Ose();VNe();tse();WNe();fV=class e{constructor(t,r){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}),this.metadata=t,this.tags=r}static fromHeader(t){let r=t.split(","),n={},o=[];for(let i of r){let[a,s]=i.split("="),u=decodeURIComponent(s);a==="langsmith-metadata"?n=JSON.parse(u):a==="langsmith-tags"&&(o=u.split(","))}return new e(n,o)}toHeader(){let t=[];return this.metadata&&Object.keys(this.metadata).length>0&&t.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&t.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),t.join(",")}},SS=class e{constructor(t){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}),pV(t)){Object.assign(this,{...t});return}let r=e.getDefaultConfig(),{metadata:n,...o}=t,i=o.client??e.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=h9t(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:hO(),run_type:"chain",project_name:oy("LANGCHAIN_PROJECT")??oy("LANGCHAIN_SESSION")??"default",child_runs:[],api_url:oy("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:oy("LANGCHAIN_API_KEY"),caller_options:{},start_time:Date.now(),serialized:{},inputs:{},extra:{}}}static getSharedClient(){return e.sharedClient||(e.sharedClient=new BM),e.sharedClient}createChild(t){let r=this.child_execution_order+1,n=new e({...t,parent_run:this,project_name:this.project_name,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});dV in this&&(n[dV]=this[dV]);let o=Symbol.for("lc:child_config"),i=t.extra?.[o]??this.extra[o];if(g9t(i)){let u={...i},l=m9t(u.callbacks)?u.callbacks.copy?.():void 0;l&&(Object.assign(l,{_parentRunId:n.id}),l.handlers?.find(GNe)?.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(t,r,n=Date.now(),o){this.outputs=this.outputs??t,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(t,r,n=!0){let o=t.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=t.parent_run?.id,i=[]):(i=t.child_runs.map(u=>this._convertToCreate(u,r,n)),a=void 0),{id:t.id,name:t.name,start_time:t.start_time,end_time:t.end_time,run_type:t.run_type,reference_example_id:t.reference_example_id,extra:o,serialized:t.serialized,error:t.error,inputs:t.inputs,outputs:t.outputs,session_name:t.project_name,child_runs:i,parent_run_id:a,trace_id:t.trace_id,dotted_order:t.dotted_order,tags:t.tags,attachments:t.attachments}}async postRun(t=!0){try{let r=uV(),n=await this._convertToCreate(this,r,!0);if(await this.client.createRun(n),!t){G6("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 t={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};await this.client.updateRun(this.id,t)}catch(t){console.error(`Error in patchRun for run ${this.id}`,t)}}toJSON(){return this._convertToCreate(this,void 0,!1)}static fromRunnableConfig(t,r){let n=t?.callbacks,o,i,a,s=HNe();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 e({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(t?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...t?.metadata}}}).createChild(r):new e({...r,client:a,tracingEnabled:s,project_name:i})}static fromDottedOrder(t){return this.fromHeaders({"langsmith-trace":t})}static fromHeaders(t,r){let n="get"in t&&typeof t.get=="function"?{"langsmith-trace":t.get("langsmith-trace"),baggage:t.get("baggage")}:t,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=fV.fromHeader(n.baggage);u.metadata=l.metadata,u.tags=l.tags}return new e(u)}toHeaders(t){let r={"langsmith-trace":this.dotted_order,baggage:new fV(this.extra?.metadata,this.tags).toHeader()};if(t)for(let[n,o]of Object.entries(r))t.set(n,o);return r}};Object.defineProperty(SS,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});function hV(e){return typeof e=="function"&&"langsmith:traceable"in e}var Mse,Tse,y9t,Ise,b9t,KNe,dbn,YNe=C(()=>{cV();Mse=class{getStore(){}run(t,r){return r()}},Tse=Symbol.for("ls:tracing_async_local_storage"),y9t=new Mse,Ise=class{getInstance(){return globalThis[Tse]??y9t}initializeGlobalInstance(t){globalThis[Tse]===void 0&&(globalThis[Tse]=t)}},b9t=new Ise,KNe=()=>{let e=b9t.getInstance().getStore();if(!pV(e))throw new Error(["Could not get the current run tree.","","Please make sure you are calling this method within a traceable function or the tracing is enabled."].join(`
`));return e},dbn=Symbol.for("langsmith:traceable:root")});var Ase=C(()=>{YNe()});function gV(e,t){return _9t.call(e,t)}function yV(e){if(Array.isArray(e)){let r=new Array(e.length);for(let n=0;n<r.length;n++)r[n]=""+n;return r}if(Object.keys)return Object.keys(e);let t=[];for(let r in e)gV(e,r)&&t.push(r);return t}function Dc(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function bV(e){let t=0,r=e.length,n;for(;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function iy(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function V$(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function mV(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(let r=0,n=e.length;r<n;r++)if(mV(e[r]))return!0}else if(typeof e=="object"){let r=yV(e),n=r.length;for(var t=0;t<n;t++)if(mV(e[r[t]]))return!0}}return!1}function ZNe(e,t){let r=[e];for(let n in t){let o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(`${n}: ${o}`)}return r.join(`
`)}var _9t,$M,W$=C(()=>{_9t=Object.prototype.hasOwnProperty;$M=class extends Error{constructor(t,r,n,o,i){super(ZNe(t,{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=ZNe(t,{name:r,index:n,operation:o,tree:i})}}});var Rse={};Yd(Rse,{JsonPatchError:()=>Pa,_areEquals:()=>J$,applyOperation:()=>qM,applyPatch:()=>mO,applyReducer:()=>S9t,deepClone:()=>v9t,getValueByPointer:()=>_V,validate:()=>XNe,validator:()=>vV});function _V(e,t){if(t=="")return e;var r={op:"_get",path:t};return qM(e,r),r.value}function qM(e,t,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(t,0,e,t.path):vV(t,0)),t.path===""){let a={newDocument:e};if(t.op==="add")return a.newDocument=t.value,a;if(t.op==="replace")return a.newDocument=t.value,a.removed=e,a;if(t.op==="move"||t.op==="copy")return a.newDocument=_V(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=J$(e,t.value),a.test===!1)throw new Pa("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}else{if(t.op==="remove")return a.removed=e,a.newDocument=null,a;if(t.op==="_get")return t.value=e,a;if(r)throw new Pa("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=Dc(e));let s=(t.path||"").split("/"),u=e,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=vV;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=V$(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=t.path),d!==void 0&&p(t,0,e,d)),l++,Array.isArray(u)){if(f==="-")f=u.length;else{if(r&&!bV(f))throw new Pa("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,t,e);bV(f)&&(f=~~f)}if(l>=c){if(r&&t.op==="add"&&f>u.length)throw new Pa("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);let h=w9t[t.op].call(t,u,f,e);if(h.test===!1)throw new Pa("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return h}}else if(l>=c){let h=jD[t.op].call(t,u,f,e);if(h.test===!1)throw new Pa("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return h}if(u=u[f],r&&l<c&&(!u||typeof u!="object"))throw new Pa("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function mO(e,t,r,n=!0,o=!0){if(r&&!Array.isArray(t))throw new Pa("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Dc(e));let i=new Array(t.length);for(let a=0,s=t.length;a<s;a++)i[a]=qM(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function S9t(e,t,r){let n=qM(e,t);if(n.test===!1)throw new Pa("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function vV(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Pa("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(jD[e.op]){if(typeof e.path!="string")throw new Pa("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Pa('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Pa("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Pa("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&mV(e.value))throw new Pa("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var o=e.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new Pa("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new Pa("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var a={op:"_get",path:e.from,value:void 0},s=XNe([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Pa("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Pa("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function XNe(e,t,r){try{if(!Array.isArray(e))throw new Pa("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)mO(Dc(t),Dc(e),r||!0);else{r=r||vV;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof Pa)return o;throw o}}function J$(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),o,i,a;if(r&&n){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!J$(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(e);if(i=s.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!J$(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var Pa,v9t,jD,w9t,wV=C(()=>{W$();Pa=$M,v9t=Dc,jD={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){let n=_V(r,this.path);n&&(n=Dc(n));let o=qM(r,{op:"remove",path:this.from}).removed;return qM(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){let n=_V(r,this.from);return qM(r,{op:"add",path:this.path,value:Dc(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:J$(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},w9t={add:function(e,t,r){return bV(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:jD.move,copy:jD.copy,test:jD.test,_get:jD._get}});function QNe(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=yV(t),a=yV(e),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=e[c];if(gV(t,c)&&!(t[c]===void 0&&d!==void 0&&Array.isArray(t)===!1)){var f=t[c];typeof d=="object"&&d!=null&&typeof f=="object"&&f!=null&&Array.isArray(d)===Array.isArray(f)?QNe(d,f,r,n+"/"+iy(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+iy(c),value:Dc(d)}),r.push({op:"replace",path:n+"/"+iy(c),value:Dc(f)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+iy(c),value:Dc(d)}),r.push({op:"remove",path:n+"/"+iy(c)}),u=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),s=!0)}if(!(!u&&i.length==a.length))for(var l=0;l<i.length;l++){var c=i[l];!gV(e,c)&&t[c]!==void 0&&r.push({op:"add",path:n+"/"+iy(c),value:Dc(t[c])})}}}function SV(e,t,r=!1){var n=[];return QNe(e,t,n,"",r),n}var eLe=C(()=>{W$();wV();});var wbn,Dse=C(()=>{wV();eLe();W$();wV();W$();wbn={...Rse,JsonPatchError:$M,deepClone:Dc,escapePathComponent:iy,unescapePathComponent:V$}});var rLe=b((Ebn,tLe)=>{"use strict";tLe.exports=function(e,t){if(typeof e!="string")throw new TypeError("Expected a string");return t=typeof t>"u"?"_":t,e.replace(/([a-z\d])([A-Z])/g,"$1"+t+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+t+"$2").toLowerCase()}});var lLe=b((Pbn,jse)=>{"use strict";var x9t=/[\p{Lu}]/u,C9t=/[\p{Ll}]/u,nLe=/^[\p{Lu}](?![\p{Lu}])/gu,aLe=/([\p{Alpha}\p{N}_]|$)/u,sLe=/[_.\- ]+/,O9t=new RegExp("^"+sLe.source),oLe=new RegExp(sLe.source+aLe.source,"gu"),iLe=new RegExp("\\d+"+aLe.source,"gu"),E9t=(e,t,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<e.length;a++){let s=e[a];n&&x9t.test(s)?(e=e.slice(0,a)+"-"+e.slice(a),n=!1,i=o,o=!0,a++):o&&i&&C9t.test(s)?(e=e.slice(0,a-1)+"-"+e.slice(a-1),i=o,o=!1,n=!0):(n=t(s)===s&&r(s)!==s,i=o,o=r(s)===s&&t(s)!==s)}return e},P9t=(e,t)=>(nLe.lastIndex=0,e.replace(nLe,r=>t(r))),T9t=(e,t)=>(oLe.lastIndex=0,iLe.lastIndex=0,e.replace(oLe,(r,n)=>t(n)).replace(iLe,r=>t(r))),uLe=(e,t)=>{if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(e)?e=e.map(i=>i.trim()).filter(i=>i.length).join("-"):e=e.trim(),e.length===0)return"";let r=t.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(t.locale),n=t.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(t.locale);return e.length===1?t.pascalCase?n(e):r(e):(e!==r(e)&&(e=E9t(e,r,n)),e=e.replace(O9t,""),t.preserveConsecutiveUppercase?e=P9t(e,r):e=r(e),t.pascalCase&&(e=n(e.charAt(0))+e.slice(1)),T9t(e,n))};jse.exports=uLe;jse.exports.default=uLe});function dLe(e,t){return t?.[e]||(0,cLe.default)(e)}function fLe(e,t,r){let n={};for(let o in e)Object.hasOwn(e,o)&&(n[t(o,r)]=e[o]);return n}var cLe,M9t,pLe=C(()=>{cLe=B(rLe(),1),M9t=B(lLe(),1)});function hLe(e){return Array.isArray(e)?[...e]:{...e}}function I9t(e,t){let r=hLe(e);for(let[n,o]of Object.entries(t)){let[i,...a]=n.split(".").reverse(),s=r;for(let u of a.reverse()){if(s[u]===void 0)break;s[u]=hLe(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function Nse(e){let t=Object.getPrototypeOf(e);return typeof e.lc_name=="function"&&(typeof t.lc_name!="function"||e.lc_name()!==t.lc_name())?e.lc_name():e.name}var nf,UM=C(()=>{pLe();nf=class e{static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Nse(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(t,...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(t||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=t??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof e||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let t={},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(t,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:fLe(Object.keys(r).length?I9t(n,r):n,dLe,t)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});async function mLe(){return Lse===void 0&&(Lse={library:"langchain-js",runtime:N9t()}),Lse}function At(e){try{return typeof process<"u"?process.env?.[e]:Fse()?Deno?.env.get(e):void 0}catch{return}}var A9t,R9t,D9t,Fse,j9t,N9t,Lse,zM=C(()=>{A9t=()=>typeof window<"u"&&typeof window.document<"u",R9t=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",D9t=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),Fse=()=>typeof Deno<"u",j9t=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!Fse(),N9t=()=>{let e;return A9t()?e="browser":j9t()?e="node":R9t()?e="webworker":D9t()?e="jsdom":Fse()?e="deno":e="other",e}});function Bse(e){return"lc_prefer_streaming"in e&&e.lc_prefer_streaming}var kse,HM,gLe,G$=C(()=>{N$();UM();zM();kse=class{};HM=class e extends kse{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,Nse(this.constructor)]}constructor(t){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:At("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"}),this.lc_kwargs=t||{},t&&(this.ignoreLLM=t.ignoreLLM??this.ignoreLLM,this.ignoreChain=t.ignoreChain??this.ignoreChain,this.ignoreAgent=t.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=t.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=t.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=t.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(t._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return nf.prototype.toJSON.call(this)}toJSONNotImplemented(){return nf.prototype.toJSONNotImplemented.call(this)}static fromMethods(t){class r extends e{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:ef()}),Object.assign(this,t)}}return new r}},gLe=e=>{let t=e;return t!==void 0&&typeof t.copy=="function"&&typeof t.name=="string"&&typeof t.awaitHandlers=="boolean"}});function $se(e,t){return e&&!Array.isArray(e)&&typeof e=="object"?e:{[t]:e}}function L9t(e){return e.replace(/[-:.]/g,"")}function F9t(e,t,r){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return L9t(`${new Date(e).toISOString().slice(0,-1)}${n}Z`)+t}function ND(e){return typeof e._addRunToRunMap=="function"}var Xp,VM=C(()=>{G$();Xp=class extends HM{constructor(t){super(...arguments),Object.defineProperty(this,"runMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}copy(){return this}stringifyError(t){return t instanceof Error?t.message+(t?.stack?`
${t.stack}`:""):typeof t=="string"?t:`${t}`}_addChildRun(t,r){t.child_runs.push(r)}_addRunToRunMap(t){let r=F9t(t.start_time,t.id,t.execution_order),n={...t};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(t){let r=t.parent_run_id!==void 0&&this.runMap.get(t.parent_run_id);r?r.child_execution_order=Math.max(r.child_execution_order,t.child_execution_order):await this.persistRun(t),this.runMap.delete(t.id),await this.onRunUpdate?.(t)}_getExecutionOrder(t){let r=t!==void 0&&this.runMap.get(t);return r?r.child_execution_order+1:1}_createRunForLLMStart(t,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??t.id[t.id.length-1],parent_run_id:o,start_time:c,serialized:t,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(t,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForLLMStart(t,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}_createRunForChatModelStart(t,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??t.id[t.id.length-1],parent_run_id:o,start_time:c,serialized:t,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(t,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForChatModelStart(t,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}async handleLLMEnd(t,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=t,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(t,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(t),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(t,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d={id:n,name:u??t.id[t.id.length-1],parent_run_id:o,start_time:c,serialized:t,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(t,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForChainStart(t,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onChainStart?.(l),l}async handleChainEnd(t,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=$se(t,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=$se(i.inputs,"input")),await this.onChainEnd?.(a),await this._endTrace(a),a}async handleChainError(t,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(t),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=$se(i.inputs,"input")),await this.onChainError?.(a),await this._endTrace(a),a}_createRunForToolStart(t,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??t.id[t.id.length-1],parent_run_id:o,start_time:l,serialized:t,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(t,r,n,o,i,a,s){let u=this.runMap.get(n)??this._createRunForToolStart(t,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onToolStart?.(u),u}async handleToolEnd(t,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:t},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onToolEnd?.(n),await this._endTrace(n),n}async handleToolError(t,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(t),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onToolError?.(n),await this._endTrace(n),n}async handleAgentAction(t,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="chain")return;let o=n;o.actions=o.actions||[],o.actions.push(t),o.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentAction?.(n)}async handleAgentEnd(t,r){let n=this.runMap.get(r);!n||n?.run_type!=="chain"||(n.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentEnd?.(n))}_createRunForRetrieverStart(t,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??t.id[t.id.length-1],parent_run_id:o,start_time:l,serialized:t,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(t,r,n,o,i,a,s){let u=this.runMap.get(n)??this._createRunForRetrieverStart(t,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onRetrieverStart?.(u),u}async handleRetrieverEnd(t,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:t},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onRetrieverEnd?.(n),await this._endTrace(n),n}async handleRetrieverError(t,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(t),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onRetrieverError?.(n),await this._endTrace(n),n}async handleText(t,r){let n=this.runMap.get(r);!n||n?.run_type!=="chain"||(n.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:t}}),await this.onText?.(n))}async handleLLMNewToken(t,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:t,idx:r,chunk:a?.chunk}}),await this.onLLMNewToken?.(s,t,{chunk:a?.chunk}),s}}});var vLe=b((Fbn,_Le)=>{"use strict";var yLe=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,bLe=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`;function k9t(){let e=new Map,t={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]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[r,n]of Object.entries(t)){for(let[o,i]of Object.entries(n))t[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=t[o],e.set(i[0],i[1]);Object.defineProperty(t,r,{value:n,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi256=yLe(),t.color.ansi16m=bLe(),t.bgColor.ansi256=yLe(10),t.bgColor.ansi16m=bLe(10),Object.defineProperties(t,{rgbToAnsi256:{value:(r,n,o)=>r===n&&n===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:o}=n.groups;o.length===3&&(o=o.split("").map(a=>a+a).join(""));let i=Number.parseInt(o,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:r=>t.rgbToAnsi256(...t.hexToRgb(r)),enumerable:!1}}),t}Object.defineProperty(_Le,"exports",{enumerable:!0,get:k9t})});function Sd(e,t){return`${e.open}${t}${e.close}`}function Qp(e,t){try{return JSON.stringify(e,null,2)}catch{return t}}function wLe(e){return typeof e=="string"?e.trim():e==null?e:Qp(e,e.toString())}function gO(e){if(!e.end_time)return"";let t=e.end_time-e.start_time;return t<1e3?`${t}ms`:`${(t/1e3).toFixed(2)}s`}var qse,of,K$,SLe=C(()=>{qse=B(vLe(),1);VM();({color:of}=qse.default),K$=class extends Xp{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"console_callback_handler"})}persistRun(t){return Promise.resolve()}getParents(t){let r=[],n=t;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(t){let n=[...this.getParents(t).reverse(),t].map((o,i,a)=>{let s=`${o.execution_order}:${o.run_type}:${o.name}`;return i===a.length-1?Sd(qse.default.bold,s):s}).join(" > ");return Sd(of.grey,n)}onChainStart(t){let r=this.getBreadcrumbs(t);console.log(`${Sd(of.green,"[chain/start]")} [${r}] Entering Chain run with input: ${Qp(t.inputs,"[inputs]")}`)}onChainEnd(t){let r=this.getBreadcrumbs(t);console.log(`${Sd(of.cyan,"[chain/end]")} [${r}] [${gO(t)}] Exiting Chain run with output: ${Qp(t.outputs,"[outputs]")}`)}onChainError(t){let r=this.getBreadcrumbs(t);console.log(`${Sd(of.red,"[chain/error]")} [${r}] [${gO(t)}] Chain run errored with error: ${Qp(t.error,"[error]")}`)}onLLMStart(t){let r=this.getBreadcrumbs(t),n="prompts"in t.inputs?{prompts:t.inputs.prompts.map(o=>o.trim())}:t.inputs;console.log(`${Sd(of.green,"[llm/start]")} [${r}] Entering LLM run with input: ${Qp(n,"[inputs]")}`)}onLLMEnd(t){let r=this.getBreadcrumbs(t);console.log(`${Sd(of.cyan,"[llm/end]")} [${r}] [${gO(t)}] Exiting LLM run with output: ${Qp(t.outputs,"[response]")}`)}onLLMError(t){let r=this.getBreadcrumbs(t);console.log(`${Sd(of.red,"[llm/error]")} [${r}] [${gO(t)}] LLM run errored with error: ${Qp(t.error,"[error]")}`)}onToolStart(t){let r=this.getBreadcrumbs(t);console.log(`${Sd(of.green,"[tool/start]")} [${r}] Entering Tool run with input: "${wLe(t.inputs.input)}"`)}onToolEnd(t){let r=this.getBreadcrumbs(t);console.log(`${Sd(of.cyan,"[tool/end]")} [${r}] [${gO(t)}] Exiting Tool run with output: "${wLe(t.outputs?.output)}"`)}onToolError(t){let r=this.getBreadcrumbs(t);console.log(`${Sd(of.red,"[tool/error]")} [${r}] [${gO(t)}] Tool run errored with error: ${Qp(t.error,"[error]")}`)}onRetrieverStart(t){let r=this.getBreadcrumbs(t);console.log(`${Sd(of.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${Qp(t.inputs,"[inputs]")}`)}onRetrieverEnd(t){let r=this.getBreadcrumbs(t);console.log(`${Sd(of.cyan,"[retriever/end]")} [${r}] [${gO(t)}] Exiting Retriever run with output: ${Qp(t.outputs,"[outputs]")}`)}onRetrieverError(t){let r=this.getBreadcrumbs(t);console.log(`${Sd(of.red,"[retriever/error]")} [${r}] [${gO(t)}] Retriever run errored with error: ${Qp(t.error,"[error]")}`)}onAgentAction(t){let r=t,n=this.getBreadcrumbs(t);console.log(`${Sd(of.blue,"[agent/action]")} [${n}] Agent selected action: ${Qp(r.actions[r.actions.length-1],"[action]")}`)}}});function yO(e,t){return e.lc_error_code=t,e.message=`${e.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${t}/
`,e}var Y$=C(()=>{});function FD(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="tool_call")}var LD,xV=C(()=>{LD=class extends Error{constructor(t,r){super(t),Object.defineProperty(this,"output",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.output=r}}});function Use(e,t=kD){e=e.trim();let r=/```(json)?(.*)```/s.exec(e);return t(r?r[2]:e)}function kD(e){if(typeof e>"u")return null;try{return JSON.parse(e)}catch{}let t="",r=[],n=!1,o=!1;for(let i of e){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;t+=i}n&&(t+='"');for(let i=r.length-1;i>=0;i-=1)t+=r[i];try{return JSON.parse(t)}catch{return null}}var zse=C(()=>{});function eh(e,t){return typeof e=="string"?typeof t=="string"?e+t:[{type:"text",text:e},...t]:Array.isArray(t)?Z$(e,t)??[...e,...t]:[...e,{type:"text",text:t}]}function xLe(e,t){return e==="error"||t==="error"?"error":"success"}function B9t(e,t){function r(n,o){if(typeof n!="object"||n===null||n===void 0)return n;if(o>=t)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(e,0),null,2)}function qa(e,t){let r={...e};for(let[n,o]of Object.entries(t))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]=qa(r[n],o);else if(Array.isArray(r[n]))r[n]=Z$(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 Z$(e,t){if(!(e===void 0&&t===void 0)){if(e===void 0||t===void 0)return e||t;{let r=[...e];for(let n of t)if(typeof n=="object"&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>i.index===n.index);o!==-1?r[o]=qa(r[o],n):r.push(n)}else{if(typeof n=="object"&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function CLe(e,t){if(!e&&!t)throw new Error("Cannot merge two undefined objects.");if(!e||!t)return e||t;if(typeof e!=typeof t)throw new Error(`Cannot merge objects of different types.
Left ${typeof e}
Right ${typeof t}`);if(typeof e=="string"&&typeof t=="string")return e+t;if(Array.isArray(e)&&Array.isArray(t))return Z$(e,t);if(typeof e=="object"&&typeof t=="object")return qa(e,t);if(e===t)return e;throw new Error(`Can not merge objects of different types.
Left ${e}
Right ${t}`)}function OLe(e){return typeof e.role=="string"}function th(e){return typeof e?._getType=="function"}function Hse(e){return th(e)&&typeof e.concat=="function"}var ku,af,rh=C(()=>{UM();ku=class extends nf{get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}get text(){return typeof this.content=="string"?this.content:""}getType(){return this._getType()}constructor(t,r){typeof t=="string"&&(t={content:t,additional_kwargs:r,response_metadata:{}}),t.additional_kwargs||(t.additional_kwargs={}),t.response_metadata||(t.response_metadata={}),super(t),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=t.name,this.content=t.content,this.additional_kwargs=t.additional_kwargs,this.response_metadata=t.response_metadata,this.id=t.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(t){this.id=t,this.lc_kwargs.id=t}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](t){if(t===null)return this;let r=B9t(this._printableFields,Math.max(4,t));return`${this.constructor.lc_name()} ${r}`}};af=class extends ku{}});function ELe(e){return e!=null&&typeof e=="object"&&"lc_direct_tool_output"in e&&e.lc_direct_tool_output===!0}function PLe(e){let t=[],r=[];for(let n of e)if(n.function){let o=n.function.name;try{let i=JSON.parse(n.function.arguments),a={name:o||"",args:i||{},id:n.id};t.push(a)}catch{r.push({name:o,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[t,r]}var CS,bO,BD=C(()=>{rh();CS=class extends ku{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}constructor(t,r,n){typeof t=="string"&&(t={content:t,name:n,tool_call_id:r}),super(t),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=t.tool_call_id,this.artifact=t.artifact,this.status=t.status}_getType(){return"tool"}static isInstance(t){return t._getType()==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},bO=class e extends af{constructor(t){super(t),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=t.tool_call_id,this.artifact=t.artifact,this.status=t.status}static lc_name(){return"ToolMessageChunk"}_getType(){return"tool"}concat(t){return new e({content:eh(this.content,t.content),additional_kwargs:qa(this.additional_kwargs,t.additional_kwargs),response_metadata:qa(this.response_metadata,t.response_metadata),artifact:CLe(this.artifact,t.artifact),tool_call_id:this.tool_call_id,id:this.id??t.id,status:xLe(this.status,t.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function Bu(e){return e._getType()==="ai"}function Vse(e){return e._getType()==="ai"}var Po,Gr,WM=C(()=>{zse();rh();BD();Po=class extends ku{get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls"}}constructor(t,r){let n;if(typeof t=="string")n={content:t,tool_calls:[],invalid_tool_calls:[],additional_kwargs:r??{}};else{n=t;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]=PLe(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}}};Gr=class e extends af{constructor(t){let r;if(typeof t=="string")r={content:t,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]};else if(t.tool_call_chunks===void 0)r={...t,tool_calls:t.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0};else{let n=[],o=[];for(let i of t.tool_call_chunks){let a={};try{if(a=kD(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={...t,tool_calls:n,invalid_tool_calls:o,usage_metadata:t.usage_metadata!==void 0?t.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(t){let r={content:eh(this.content,t.content),additional_kwargs:qa(this.additional_kwargs,t.additional_kwargs),response_metadata:qa(this.response_metadata,t.response_metadata),tool_call_chunks:[],id:this.id??t.id};if(this.tool_call_chunks!==void 0||t.tool_call_chunks!==void 0){let n=Z$(this.tool_call_chunks,t.tool_call_chunks);n!==void 0&&n.length>0&&(r.tool_call_chunks=n)}if(this.usage_metadata!==void 0||t.usage_metadata!==void 0){let n={...(this.usage_metadata?.input_token_details?.audio!==void 0||t.usage_metadata?.input_token_details?.audio!==void 0)&&{audio:(this.usage_metadata?.input_token_details?.audio??0)+(t.usage_metadata?.input_token_details?.audio??0)},...(this.usage_metadata?.input_token_details?.cache_read!==void 0||t.usage_metadata?.input_token_details?.cache_read!==void 0)&&{cache_read:(this.usage_metadata?.input_token_details?.cache_read??0)+(t.usage_metadata?.input_token_details?.cache_read??0)},...(this.usage_metadata?.input_token_details?.cache_creation!==void 0||t.usage_metadata?.input_token_details?.cache_creation!==void 0)&&{cache_creation:(this.usage_metadata?.input_token_details?.cache_creation??0)+(t.usage_metadata?.input_token_details?.cache_creation??0)}},o={...(this.usage_metadata?.output_token_details?.audio!==void 0||t.usage_metadata?.output_token_details?.audio!==void 0)&&{audio:(this.usage_metadata?.output_token_details?.audio??0)+(t.usage_metadata?.output_token_details?.audio??0)},...(this.usage_metadata?.output_token_details?.reasoning!==void 0||t.usage_metadata?.output_token_details?.reasoning!==void 0)&&{reasoning:(this.usage_metadata?.output_token_details?.reasoning??0)+(t.usage_metadata?.output_token_details?.reasoning??0)}},i=this.usage_metadata??{input_tokens:0,output_tokens:0,total_tokens:0},a=t.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 e(r)}}});var xd,jm,CV=C(()=>{rh();xd=class e extends ku{static lc_name(){return"ChatMessage"}static _chatMessageClass(){return e}constructor(t,r){typeof t=="string"&&(t={content:t,role:r}),super(t),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=t.role}_getType(){return"generic"}static isInstance(t){return t._getType()==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},jm=class e extends af{static lc_name(){return"ChatMessageChunk"}constructor(t,r){typeof t=="string"&&(t={content:t,role:r}),super(t),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=t.role}_getType(){return"generic"}concat(t){return new e({content:eh(this.content,t.content),additional_kwargs:qa(this.additional_kwargs,t.additional_kwargs),response_metadata:qa(this.response_metadata,t.response_metadata),role:this.role,id:this.id??t.id})}get _printableFields(){return{...super._printableFields,role:this.role}}}});var OS,OV=C(()=>{rh();OS=class e extends af{static lc_name(){return"FunctionMessageChunk"}_getType(){return"function"}concat(t){return new e({content:eh(this.content,t.content),additional_kwargs:qa(this.additional_kwargs,t.additional_kwargs),response_metadata:qa(this.response_metadata,t.response_metadata),name:this.name??"",id:this.id??t.id})}}});var Ua,Nm,X$=C(()=>{rh();Ua=class extends ku{static lc_name(){return"HumanMessage"}_getType(){return"human"}},Nm=class e extends af{static lc_name(){return"HumanMessageChunk"}_getType(){return"human"}concat(t){return new e({content:eh(this.content,t.content),additional_kwargs:qa(this.additional_kwargs,t.additional_kwargs),response_metadata:qa(this.response_metadata,t.response_metadata),id:this.id??t.id})}}});var ES,ay,EV=C(()=>{rh();ES=class extends ku{static lc_name(){return"SystemMessage"}_getType(){return"system"}},ay=class e extends af{static lc_name(){return"SystemMessageChunk"}_getType(){return"system"}concat(t){return new e({content:eh(this.content,t.content),additional_kwargs:qa(this.additional_kwargs,t.additional_kwargs),response_metadata:qa(this.response_metadata,t.response_metadata),id:this.id??t.id})}}});function q9t(e){return FD(e)?e:typeof e.id=="string"&&e.type==="function"&&typeof e.function=="object"&&e.function!==null&&"arguments"in e.function&&typeof e.function.arguments=="string"&&"name"in e.function&&typeof e.function.name=="string"?{id:e.id,args:JSON.parse(e.function.arguments),name:e.function.name,type:"tool_call"}:e}function U9t(e){return typeof e=="object"&&e!=null&&e.lc===1&&Array.isArray(e.id)&&e.kwargs!=null&&typeof e.kwargs=="object"}function Wse(e){let t,r;if(U9t(e)){let n=e.id.at(-1);n==="HumanMessage"||n==="HumanMessageChunk"?t="user":n==="AIMessage"||n==="AIMessageChunk"?t="assistant":n==="SystemMessage"||n==="SystemMessageChunk"?t="system":n==="FunctionMessage"||n==="FunctionMessageChunk"?t="function":n==="ToolMessage"||n==="ToolMessageChunk"?t="tool":t="unknown",r=e.kwargs}else{let{type:n,...o}=e;t=n,r=o}if(t==="human"||t==="user")return new Ua(r);if(t==="ai"||t==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new Po(r);let i=n.map(q9t);return new Po({...o,tool_calls:i})}else{if(t==="system")return new ES(r);if(t==="developer")return new ES({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(t==="tool"&&"tool_call_id"in r)return new CS({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});throw yO(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported.
Received: ${JSON.stringify(e,null,2)}`),"MESSAGE_COERCION_FAILURE")}}function Lm(e){if(typeof e=="string")return new Ua(e);if(th(e))return e;if(Array.isArray(e)){let[t,r]=e;return Wse({type:t,content:r})}else if(OLe(e)){let{role:t,...r}=e;return Wse({...r,type:t})}else return Wse(e)}function sf(e,t="Human",r="AI"){let n=[];for(let o of e){let i;if(o._getType()==="human")i=t;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 Jse(e){let t=e._getType();if(t==="human")return new Nm({...e});if(t==="ai"){let r={...e};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 Gr({...r})}else{if(t==="system")return new ay({...e});if(t==="function")return new OS({...e});if(xd.isInstance(e))return new jm({...e});throw new Error("Unknown message type.")}}var _O=C(()=>{Y$();xV();WM();rh();CV();OV();X$();EV();BD()});var Gse=C(()=>{cV()});var Kse=C(()=>{sV()});var Yse,TLe,MLe=C(()=>{Kse();zM();TLe=()=>{if(Yse===void 0){let e=At("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};Yse=new BM(e)}return Yse}});var $D,ILe=C(()=>{Gse();Ase();zM();VM();MLe();$D=class e extends Xp{constructor(t={}){super(t),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}=t;this.projectName=n??At("LANGCHAIN_PROJECT")??At("LANGCHAIN_SESSION"),this.exampleId=r,this.client=o??TLe();let i=e.getTraceableRunTree();i&&this.updateFromRunTree(i)}async _convertToCreate(t,r=void 0){return{...t,extra:{...t.extra,runtime:await mLe()},child_runs:void 0,session_name:this.projectName,reference_example_id:t.parent_run_id?void 0:r}}async persistRun(t){}async onRunCreate(t){let r=await this._convertToCreate(t,this.exampleId);await this.client.createRun(r)}async onRunUpdate(t){let r={end_time:t.end_time,error:t.error,outputs:t.outputs,events:t.events,inputs:t.inputs,trace_id:t.trace_id,dotted_order:t.dotted_order,parent_run_id:t.parent_run_id,extra:t.extra};await this.client.updateRun(t.id,r)}getRun(t){return this.runMap.get(t)}updateFromRunTree(t){let r=t,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=t.client??this.client,this.projectName=t.project_name??this.projectName,this.exampleId=t.reference_example_id??this.exampleId}convertToRunTree(t){let r={},n=[];for(let[o,i]of this.runMap){let a=new SS({...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[t]}static getTraceableRunTree(){try{return KNe()}catch{return}}}});var ALe,JM,RLe,vO,Q$=C(()=>{ALe=Symbol.for("ls:tracing_async_local_storage"),JM=Symbol.for("lc:context_variables"),RLe=e=>{globalThis[ALe]=e},vO=()=>globalThis[ALe]});function z9t(){let e="default"in PV.default?PV.default.default:PV.default;return new e({autoStart:!0,concurrency:1})}function H9t(){return typeof eq>"u"&&(eq=z9t()),eq}async function za(e,t){if(t===!0){let r=vO();r!==void 0?await r.run(void 0,async()=>e()):await e()}else eq=H9t(),eq.add(async()=>{let r=vO();r!==void 0?await r.run(void 0,async()=>e()):await e()})}var PV,eq,DLe=C(()=>{PV=B(V6(),1);Q$()});var jLe=C(()=>{DLe()});var NLe,LLe=C(()=>{zM();NLe=e=>e!==void 0?e:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>At(r)==="true")});function Zse(e){let t=vO();return t===void 0?void 0:t.getStore()?.[JM]?.[e]}var V9t,FLe,kLe=C(()=>{Gse();Q$();V9t=Symbol("lc:configure_hooks"),FLe=()=>Zse(V9t)||[]});function GM(e){return e?Array.isArray(e)||"name"in e?{callbacks:e}:e:{}}function tq(e){return"name"in e?e:HM.fromMethods(e)}var Xse,qD,Qse,TV,eue,tue,os,wO=C(()=>{N$();G$();SLe();_O();zM();ILe();jLe();LLe();VM();kLe();Xse=class{setHandler(t){return this.setHandlers([t])}},qD=class{constructor(t,r,n,o,i,a,s,u){Object.defineProperty(this,"runId",{enumerable:!0,configurable:!0,writable:!0,value:t}),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(t){await Promise.all(this.handlers.map(r=>za(async()=>{try{await r.handleText?.(t,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(t,r,n,o,i){await Promise.all(this.handlers.map(a=>za(async()=>{try{await a.handleCustomEvent?.(t,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)))}},Qse=class extends qD{getChild(t){let r=new os(this.runId);return r.setHandlers(this.inheritableHandlers),r.addTags(this.inheritableTags),r.addMetadata(this.inheritableMetadata),t&&r.addTags([t],!1),r}async handleRetrieverEnd(t){await Promise.all(this.handlers.map(r=>za(async()=>{if(!r.ignoreRetriever)try{await r.handleRetrieverEnd?.(t,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(t){await Promise.all(this.handlers.map(r=>za(async()=>{if(!r.ignoreRetriever)try{await r.handleRetrieverError?.(t,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 t}},r.awaitHandlers)))}},TV=class extends qD{async handleLLMNewToken(t,r,n,o,i,a){await Promise.all(this.handlers.map(s=>za(async()=>{if(!s.ignoreLLM)try{await s.handleLLMNewToken?.(t,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(t,r,n,o,i){await Promise.all(this.handlers.map(a=>za(async()=>{if(!a.ignoreLLM)try{await a.handleLLMError?.(t,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(t,r,n,o,i){await Promise.all(this.handlers.map(a=>za(async()=>{if(!a.ignoreLLM)try{await a.handleLLMEnd?.(t,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)))}},eue=class extends qD{getChild(t){let r=new os(this.runId);return r.setHandlers(this.inheritableHandlers),r.addTags(this.inheritableTags),r.addMetadata(this.inheritableMetadata),t&&r.addTags([t],!1),r}async handleChainError(t,r,n,o,i){await Promise.all(this.handlers.map(a=>za(async()=>{if(!a.ignoreChain)try{await a.handleChainError?.(t,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(t,r,n,o,i){await Promise.all(this.handlers.map(a=>za(async()=>{if(!a.ignoreChain)try{await a.handleChainEnd?.(t,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(t){await Promise.all(this.handlers.map(r=>za(async()=>{if(!r.ignoreAgent)try{await r.handleAgentAction?.(t,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(t){await Promise.all(this.handlers.map(r=>za(async()=>{if(!r.ignoreAgent)try{await r.handleAgentEnd?.(t,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)))}},tue=class extends qD{getChild(t){let r=new os(this.runId);return r.setHandlers(this.inheritableHandlers),r.addTags(this.inheritableTags),r.addMetadata(this.inheritableMetadata),t&&r.addTags([t],!1),r}async handleToolError(t){await Promise.all(this.handlers.map(r=>za(async()=>{if(!r.ignoreAgent)try{await r.handleToolError?.(t,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(t){await Promise.all(this.handlers.map(r=>za(async()=>{if(!r.ignoreAgent)try{await r.handleToolEnd?.(t,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)))}},os=class e extends Xse{constructor(t,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=t}getParentRunId(){return this._parentRunId}async handleLLMStart(t,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:ef();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return ND(f)&&f._createRunForLLMStart(t,[l],d,this._parentRunId,i,this.tags,this.metadata,u),za(async()=>{try{await f.handleLLMStart?.(t,[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 TV(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(t,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:ef();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return ND(f)&&f._createRunForChatModelStart(t,[l],d,this._parentRunId,i,this.tags,this.metadata,u),za(async()=>{try{if(f.handleChatModelStart)await f.handleChatModelStart?.(t,[l],d,this._parentRunId,i,this.tags,this.metadata,u);else if(f.handleLLMStart){let p=sf(l);await f.handleLLMStart?.(t,[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 TV(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(t,r,n=ef(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreChain)return ND(u)&&u._createRunForChainStart(t,r,n,this._parentRunId,this.tags,this.metadata,o,s),za(async()=>{try{await u.handleChainStart?.(t,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 eue(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(t,r,n=ef(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreAgent)return ND(u)&&u._createRunForToolStart(t,r,n,this._parentRunId,this.tags,this.metadata,s),za(async()=>{try{await u.handleToolStart?.(t,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 tue(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(t,r,n=ef(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreRetriever)return ND(u)&&u._createRunForRetrieverStart(t,r,n,this._parentRunId,this.tags,this.metadata,s),za(async()=>{try{await u.handleRetrieverStart?.(t,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 Qse(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(t,r,n,o,i){await Promise.all(this.handlers.map(a=>za(async()=>{if(!a.ignoreCustomEvent)try{await a.handleCustomEvent?.(t,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(t,r=!0){this.handlers.push(t),r&&this.inheritableHandlers.push(t)}removeHandler(t){this.handlers=this.handlers.filter(r=>r!==t),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==t)}setHandlers(t,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let n of t)this.addHandler(n,r)}addTags(t,r=!0){this.removeTags(t),this.tags.push(...t),r&&this.inheritableTags.push(...t)}removeTags(t){this.tags=this.tags.filter(r=>!t.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!t.includes(r))}addMetadata(t,r=!0){this.metadata={...this.metadata,...t},r&&(this.inheritableMetadata={...this.inheritableMetadata,...t})}removeMetadata(t){for(let r of Object.keys(t))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(t=[],r=!0){let n=new e(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 t)n.handlers.filter(i=>i.name==="console_callback_handler").some(i=>i.name===o.name)||n.addHandler(o,r);return n}static fromHandlers(t){class r extends HM{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:ef()}),Object.assign(this,t)}}let n=new this;return n.addHandler(new r),n}static configure(t,r,n,o,i,a,s){return this._configureSync(t,r,n,o,i,a,s)}static _configureSync(t,r,n,o,i,a,s){let u;(t||r)&&(Array.isArray(t)||!t?(u=new e,u.setHandlers(t?.map(tq)??[],!0)):u=t,u=u.copy(Array.isArray(r)?r.map(tq):r?.handlers,!1));let l=At("LANGCHAIN_VERBOSE")==="true"||s?.verbose,c=$D.getTraceableRunTree()?.tracingEnabled||NLe(),d=c||(At("LANGCHAIN_TRACING")??!1);if(l||d){if(u||(u=new e),l&&!u.handlers.some(f=>f.name===K$.prototype.name)){let f=new K$;u.addHandler(f,!0)}if(d&&!u.handlers.some(f=>f.name==="langchain_tracer")&&c){let f=new $D;u.addHandler(f,!0),u._parentRunId=$D.getTraceableRunTree()?.id??u._parentRunId}}for(let{contextVar:f,inheritable:p=!0,handlerClass:h,envVar:m}of FLe()){let _=m&&At(m)==="true"&&h,g,v=f!==void 0?Zse(f):void 0;v&&gLe(v)?g=v:_&&(g=new h({})),g!==void 0&&(u||(u=new e),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 MV,W9t,BLe,rue,jc,$Le=C(()=>{Kse();Q$();wO();MV=class{getStore(){}run(t,r){return r()}enterWith(t){}},W9t=new MV,BLe=Symbol.for("lc:child_config"),rue=class{getInstance(){return vO()??W9t}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[BLe]}runWithConfig(t,r,n){let o=os._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.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 SS({name:"<runnable_lambda>",tracingEnabled:!1})),l&&(l.extra={...l.extra,[BLe]:t}),a!==void 0&&a[JM]!==void 0&&(l[JM]=a[JM]),i.run(l,r)}initializeGlobalInstance(t){vO()===void 0&&RLe(t)}},jc=new rue});var UD=C(()=>{$Le();Q$()});async function uf(e){return os._configureSync(e?.callbacks,void 0,e?.tags,void 0,e?.metadata)}function AV(...e){let t={};for(let r of e.filter(n=>!!n))for(let n of Object.keys(r))if(n==="metadata")t[n]={...t[n],...r[n]};else if(n==="tags"){let o=t[n]??[];t[n]=[...new Set(o.concat(r[n]??[]))]}else if(n==="configurable")t[n]={...t[n],...r[n]};else if(n==="timeout")t.timeout===void 0?t.timeout=r.timeout:r.timeout!==void 0&&(t.timeout=Math.min(t.timeout,r.timeout));else if(n==="signal")t.signal===void 0?t.signal=r.signal:r.signal!==void 0&&("any"in AbortSignal?t.signal=AbortSignal.any([t.signal,r.signal]):t.signal=r.signal);else if(n==="callbacks"){let o=t.callbacks,i=r.callbacks;if(Array.isArray(i))if(!o)t.callbacks=i;else if(Array.isArray(o))t.callbacks=o.concat(i);else{let a=o.copy();for(let s of i)a.addHandler(tq(s),!0);t.callbacks=a}else if(i)if(!o)t.callbacks=i;else if(Array.isArray(o)){let a=i.copy();for(let s of o)a.addHandler(tq(s),!0);t.callbacks=a}else t.callbacks=new os(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;t[o]=r[o]??t[o]}return t}function jr(e){let t=jc.getRunnableConfig(),r={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(t){let{runId:n,runName:o,...i}=t;r=Object.entries(i).reduce((a,[s,u])=>(u!==void 0&&(a[s]=u),a),r)}if(e&&(r=Object.entries(e).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),r)),r?.configurable)for(let n of Object.keys(r.configurable))J9t.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 Ta(e={},{callbacks:t,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=jr(e);return t!==void 0&&(delete s.runName,s.callbacks=t),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 tp(e){return e?{configurable:e.configurable,recursionLimit:e.recursionLimit,callbacks:e.callbacks,tags:e.tags,metadata:e.metadata,maxConcurrency:e.maxConcurrency,timeout:e.timeout,signal:e.signal}:void 0}var IV,J9t,sy=C(()=>{wO();UD();IV=25;J9t=new Set(["string","number","boolean"])});async function uy(e,t){if(t===void 0)return e;let r;return Promise.race([e.catch(n=>{if(!t?.aborted)throw n}),new Promise((n,o)=>{r=()=>{o(new Error("Aborted"))},t.addEventListener("abort",r),t.aborted&&o(new Error("Aborted"))})]).finally(()=>t.removeEventListener("abort",r))}var nue=C(()=>{});function oue(e,t=2){let r=Array.from({length:t},()=>[]);return r.map(async function*(o){for(;;)if(o.length===0){let i=await e.next();for(let a of r)a.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function ul(e,t){if(Array.isArray(e)&&Array.isArray(t))return e.concat(t);if(typeof e=="string"&&typeof t=="string")return e+t;if(typeof e=="number"&&typeof t=="number")return e+t;if("concat"in e&&typeof e.concat=="function")return e.concat(t);if(typeof e=="object"&&typeof t=="object"){let r={...e};for(let[n,o]of Object.entries(t))n in r&&!Array.isArray(r[n])?r[n]=ul(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof e} and ${typeof t}`)}async function qLe(e,t,r,n,...o){let i=new PS({generator:t,startSetup:r,signal:n}),a=await i.setup;return{output:e(i,a,...o),setup:a}}var Nc,PS,ly=C(()=>{sy();UD();nue();Nc=class e 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 t=await this.reader.read();return t.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:t.value}}catch(t){throw this.reader.releaseLock(),t}}async return(){if(this.ensureReader(),this.locked){let t=this.reader.cancel();this.reader.releaseLock(),await t}return{done:!0,value:void 0}}async throw(t){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw t}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(t){let r=t.getReader();return new e({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(t){return new e({async pull(r){let{value:n,done:o}=await t.next();o&&r.close(),r.enqueue(n)},async cancel(r){await t.return(r)}})}};PS=class{constructor(t){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=t.generator,this.config=t.config,this.signal=t.signal??this.config?.signal,this.setup=new Promise((r,n)=>{jc.runWithConfig(tp(t.config),async()=>{this.firstResult=t.generator.next(),t.startSetup?this.firstResult.then(t.startSetup).then(r,n):this.firstResult.then(o=>r(void 0),n)},!0)})}async next(...t){return this.signal?.throwIfAborted(),this.firstResultUsed?jc.runWithConfig(tp(this.config),this.signal?async()=>uy(this.generator.next(...t),this.signal):async()=>this.generator.next(...t),!0):(this.firstResultUsed=!0,this.firstResult)}async return(t){return this.generator.return(t)}async throw(t){return this.generator.throw(t)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}}});async function ULe(e,t){if(t==="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}=e;if(["retriever","llm","prompt"].includes(e.run_type))return r;if(!(Object.keys(r).length===1&&r?.input===""))return r.input}async function zLe(e,t){let{outputs:r}=e;return t==="original"||["retriever","llm","prompt"].includes(e.run_type)?r:r!==void 0&&Object.keys(r).length===1&&r?.output!==void 0?r.output:r}function G9t(e){return e!==void 0&&e.message!==void 0}var Fm,rq,HLe,nq,VLe=C(()=>{Dse();VM();ly();WM();Fm=class{constructor(t){Object.defineProperty(this,"ops",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.ops=t.ops??[]}concat(t){let r=this.ops.concat(t.ops),n=mO({},r);return new rq({ops:r,state:n[n.length-1].newDocument})}},rq=class e extends Fm{constructor(t){super(t),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.state=t.state}concat(t){let r=this.ops.concat(t.ops),n=mO(this.state,t.ops);return new e({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(t){let r=mO({},t.ops);return new e({ops:t.ops,state:r[r.length-1].newDocument})}},HLe=e=>e.name==="log_stream_tracer";nq=class extends Xp{constructor(t){super({_awaitHandler:!0,...t}),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=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this._schemaFormat=t?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=Nc.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){if(t.id===this.rootId)return!1;let r=t.tags??[],n=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(n=n||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(t.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(t.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(t.run_type)),this.excludeTags!==void 0&&(n=n&&r.every(o=>!this.excludeTags?.includes(o))),n}async*tapOutputIterable(t,r){for await(let n of r){if(t!==this.rootId){let o=this.keyMapByRunId[t];o&&await this.writer.write(new Fm({ops:[{op:"add",path:`/logs/${o}/streamed_output/-`,value:n}]}))}yield n}}async onRunCreate(t){if(this.rootId===void 0&&(this.rootId=t.id,await this.writer.write(new Fm({ops:[{op:"replace",path:"",value:{id:t.id,name:t.name,type:t.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(t))return;this.counterMapByRunName[t.name]===void 0&&(this.counterMapByRunName[t.name]=0),this.counterMapByRunName[t.name]+=1;let r=this.counterMapByRunName[t.name];this.keyMapByRunId[t.id]=r===1?t.name:`${t.name}:${r}`;let n={id:t.id,name:t.name,type:t.run_type,tags:t.tags??[],metadata:t.extra?.metadata??{},start_time:new Date(t.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};this._schemaFormat==="streaming_events"&&(n.inputs=await ULe(t,this._schemaFormat)),await this.writer.write(new Fm({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[t.id]}`,value:n}]}))}async onRunUpdate(t){try{let r=this.keyMapByRunId[t.id];if(r===void 0)return;let n=[];this._schemaFormat==="streaming_events"&&n.push({op:"replace",path:`/logs/${r}/inputs`,value:await ULe(t,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await zLe(t,this._schemaFormat)}),t.end_time!==void 0&&n.push({op:"add",path:`/logs/${r}/end_time`,value:new Date(t.end_time).toISOString()});let o=new Fm({ops:n});await this.writer.write(o)}finally{if(t.id===this.rootId){let r=new Fm({ops:[{op:"replace",path:"/final_output",value:await zLe(t,this._schemaFormat)}]});await this.writer.write(r),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(t,r,n){let o=this.keyMapByRunId[t.id];if(o===void 0)return;let i=t.inputs.messages!==void 0,a;i?G9t(n?.chunk)?a=n?.chunk:a=new Gr({id:`run-${t.id}`,content:r}):a=r;let s=new Fm({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 oq,nh,ii,zD=C(()=>{oq="__run",nh=class e{constructor(t){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=t.text,this.generationInfo=t.generationInfo}concat(t){return new e({text:this.text+t.text,generationInfo:{...this.generationInfo,...t.generationInfo}})}},ii=class e extends nh{constructor(t){super(t),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.message=t.message}concat(t){return new e({text:this.text+t.text,generationInfo:{...this.generationInfo,...t.generationInfo},message:this.message.concat(t.message)})}}});function RV({name:e,serialized:t}){return e!==void 0?e:t?.name!==void 0?t.name:t?.id!==void 0&&Array.isArray(t?.id)?t.id[t.id.length-1]:"Unnamed"}var WLe,DV,JLe=C(()=>{VM();ly();WM();zD();WLe=e=>e.name==="event_stream_tracer",DV=class extends Xp{constructor(t){super({_awaitHandler:!0,...t}),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=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=Nc.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){let r=t.tags??[],n=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(n=n||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(t.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(t.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(t.runType)),this.excludeTags!==void 0&&(n=n&&r.every(o=>!this.excludeTags?.includes(o))),n}async*tapOutputIterable(t,r){let n=await r.next();if(n.done)return;let o=this.runInfoMap.get(t);if(o===void 0){yield n.value;return}function i(s,u){return s==="llm"&&typeof u=="string"?new nh({text:u}):u}let a=this.tappedPromises.get(t);if(a===void 0){let s;a=new Promise(u=>{s=u}),this.tappedPromises.set(t,a);try{let u={event:`on_${o.runType}_stream`,run_id:t,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(t,r){this._includeRun(r)&&await this.writer.write(t)}async sendEndEvent(t,r){let n=this.tappedPromises.get(t.run_id);n!==void 0?n.then(()=>{this.send(t,r)}):await this.send(t,r)}async onLLMStart(t){let r=RV(t),n=t.inputs.messages!==void 0?"chat_model":"llm",o={tags:t.tags??[],metadata:t.extra?.metadata??{},name:r,runType:n,inputs:t.inputs};this.runInfoMap.set(t.id,o);let i=`on_${n}_start`;await this.send({event:i,data:{input:t.inputs},name:r,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},o)}async onLLMNewToken(t,r,n){let o=this.runInfoMap.get(t.id),i,a;if(o===void 0)throw new Error(`onLLMNewToken: Run ID ${t.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 Gr({content:r,id:`run-${t.id}`}):i=n.chunk.message;else if(o.runType==="llm")a="on_llm_stream",n?.chunk===void 0?i=new nh({text:r}):i=n.chunk;else throw new Error(`Unexpected run type ${o.runType}`);await this.send({event:a,data:{chunk:i},run_id:t.id,name:o.name,tags:o.tags,metadata:o.metadata},o)}}async onLLMEnd(t){let r=this.runInfoMap.get(t.id);this.runInfoMap.delete(t.id);let n;if(r===void 0)throw new Error(`onLLMEnd: Run ID ${t.id} not found in run map.`);let o=t.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:t.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:t.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async onChainStart(t){let r=RV(t),n=t.run_type??"chain",o={tags:t.tags??[],metadata:t.extra?.metadata??{},name:r,runType:t.run_type},i={};t.inputs.input===""&&Object.keys(t.inputs).length===1?(i={},o.inputs={}):t.inputs.input!==void 0?(i.input=t.inputs.input,o.inputs=t.inputs.input):(i.input=t.inputs,o.inputs=t.inputs),this.runInfoMap.set(t.id,o),await this.send({event:`on_${n}_start`,data:i,name:r,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},o)}async onChainEnd(t){let r=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),r===void 0)throw new Error(`onChainEnd: Run ID ${t.id} not found in run map.`);let n=`on_${t.run_type}_end`,o=t.inputs??r.inputs??{},a={output:t.outputs?.output??t.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:t.id,name:r.name,tags:r.tags,metadata:r.metadata??{}},r)}async onToolStart(t){let r=RV(t),n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:r,runType:"tool",inputs:t.inputs??{}};this.runInfoMap.set(t.id,n),await this.send({event:"on_tool_start",data:{input:t.inputs??{}},name:r,run_id:t.id,tags:t.tags??[],metadata:t.extra?.metadata??{}},n)}async onToolEnd(t){let r=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),r===void 0)throw new Error(`onToolEnd: Run ID ${t.id} not found in run map.`);if(r.inputs===void 0)throw new Error(`onToolEnd: Run ID ${t.id} is a tool call, and is expected to have traced inputs.`);let n=t.outputs?.output===void 0?t.outputs:t.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:n,input:r.inputs},run_id:t.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async onRetrieverStart(t){let r=RV(t),o={tags:t.tags??[],metadata:t.extra?.metadata??{},name:r,runType:"retriever",inputs:{query:t.inputs.query}};this.runInfoMap.set(t.id,o),await this.send({event:"on_retriever_start",data:{input:{query:t.inputs.query}},name:r,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},o)}async onRetrieverEnd(t){let r=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),r===void 0)throw new Error(`onRetrieverEnd: Run ID ${t.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:t.outputs?.documents??t.outputs,input:r.inputs},run_id:t.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async handleCustomEvent(t,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:t,tags:o.tags,metadata:o.metadata,data:r},o)}async finish(){let t=[...this.tappedPromises.values()];Promise.all(t).finally(()=>{this.writer.close()})}}});var GLe,jV,K9t,Y9t,rp,HD=C(()=>{GLe=B(N6(),1),jV=B(V6(),1),K9t=[400,401,402,403,404,405,406,407,409],Y9t=e=>{if(e.message.startsWith("Cancel")||e.message.startsWith("AbortError")||e.name==="AbortError"||e?.code==="ECONNABORTED")throw e;let t=e?.response?.status??e?.status;if(t&&K9t.includes(+t))throw e;if(e?.error?.code==="insufficient_quota"){let r=new Error(e?.message);throw r.name="InsufficientQuotaError",r}},rp=class{constructor(t){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=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,this.onFailedAttempt=t.onFailedAttempt??Y9t;let r="default"in jV.default?jV.default.default:jV.default;this.queue=new r({concurrency:this.maxConcurrency})}call(t,...r){return this.queue.add(()=>(0,GLe.default)(()=>t(...r).catch(n=>{throw n instanceof Error?n:new Error(n)}),{onFailedAttempt:this.onFailedAttempt,retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,r,...n){return t.signal?Promise.race([this.call(r,...n),new Promise((o,i)=>{t.signal?.addEventListener("abort",()=>{i(new Error("AbortError"))})})]):this.call(r,...n)}fetch(...t){return this.call(()=>fetch(...t).then(r=>r.ok?r:Promise.reject(r)))}}});var iq,KLe=C(()=>{VM();iq=class extends Xp{constructor({config:t,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=t,this.argOnStart=r,this.argOnEnd=n,this.argOnError=o}persistRun(t){return Promise.resolve()}async onRunCreate(t){this.rootId||(this.rootId=t.id,this.argOnStart&&await this.argOnStart(t,this.config))}async onRunUpdate(t){t.id===this.rootId&&(t.error?this.argOnError&&await this.argOnError(t,this.config):this.argOnEnd&&await this.argOnEnd(t,this.config))}}});function aq(e){return e?e.lc_runnable:!1}var NV,iue=C(()=>{NV=class{constructor(t){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=t.includeNames,this.includeTypes=t.includeTypes,this.includeTags=t.includeTags,this.excludeNames=t.excludeNames,this.excludeTypes=t.excludeTypes,this.excludeTags=t.excludeTags}includeEvent(t,r){let n=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,o=t.tags??[];return this.includeNames!==void 0&&(n=n||this.includeNames.includes(t.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(t.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 ZLe,YLe,XLe,LV=C(()=>{ZLe=Symbol("Let zodToJsonSchema decide on which parser to use"),YLe={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"},XLe=e=>typeof e=="string"?{...YLe,name:e}:{...YLe,...e}});var QLe,aue=C(()=>{LV();QLe=e=>{let t=XLe(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}}});function sue(e,t,r,n){n?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function gn(e,t,r,n,o){e[t]=r,sue(e,t,n,o)}var SO=C(()=>{});function eFe(){return{}}var uue=C(()=>{});function tFe(e,t){let r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==re.ZodAny&&(r.items=Bt(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&gn(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&gn(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(gn(r,"minItems",e.exactLength.value,e.exactLength.message,t),gn(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}var lue=C(()=>{bd();SO();is()});function rFe(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":t.target==="jsonSchema7"?n.inclusive?gn(r,"minimum",n.value,n.message,t):gn(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),gn(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?gn(r,"maximum",n.value,n.message,t):gn(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),gn(r,"maximum",n.value,n.message,t));break;case"multipleOf":gn(r,"multipleOf",n.value,n.message,t);break}return r}var cue=C(()=>{SO()});function nFe(){return{type:"boolean"}}var due=C(()=>{});function FV(e,t){return Bt(e.type._def,t)}var kV=C(()=>{is()});var oFe,fue=C(()=>{is();oFe=(e,t)=>Bt(e.innerType._def,t)});function pue(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>pue(e,t,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 Z9t(e,t)}}var Z9t,hue=C(()=>{SO();Z9t=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":gn(r,"minimum",n.value,n.message,t);break;case"max":gn(r,"maximum",n.value,n.message,t);break}return r}});function iFe(e,t){return{...Bt(e.innerType._def,t),default:e.defaultValue()}}var mue=C(()=>{is()});function aFe(e,t){return t.effectStrategy==="input"?Bt(e.schema._def,t):{}}var gue=C(()=>{is()});function sFe(e){return{type:"string",enum:Array.from(e.values)}}var yue=C(()=>{});function uFe(e,t){let r=[Bt(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Bt(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(X9t(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 X9t,bue=C(()=>{is();X9t=e=>"type"in e&&e.type==="string"?!1:"allOf"in e});function lFe(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}var _ue=C(()=>{});function BV(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":gn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":gn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Bm(r,"email",n.message,t);break;case"format:idn-email":Bm(r,"idn-email",n.message,t);break;case"pattern:zod":Cd(r,km.email,n.message,t);break}break;case"url":Bm(r,"uri",n.message,t);break;case"uuid":Bm(r,"uuid",n.message,t);break;case"regex":Cd(r,n.regex,n.message,t);break;case"cuid":Cd(r,km.cuid,n.message,t);break;case"cuid2":Cd(r,km.cuid2,n.message,t);break;case"startsWith":Cd(r,RegExp(`^${wue(n.value,t)}`),n.message,t);break;case"endsWith":Cd(r,RegExp(`${wue(n.value,t)}$`),n.message,t);break;case"datetime":Bm(r,"date-time",n.message,t);break;case"date":Bm(r,"date",n.message,t);break;case"time":Bm(r,"time",n.message,t);break;case"duration":Bm(r,"duration",n.message,t);break;case"length":gn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t),gn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":{Cd(r,RegExp(wue(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&Bm(r,"ipv4",n.message,t),n.version!=="v4"&&Bm(r,"ipv6",n.message,t);break}case"base64url":Cd(r,km.base64url,n.message,t);break;case"jwt":Cd(r,km.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&Cd(r,km.ipv4Cidr,n.message,t),n.version!=="v4"&&Cd(r,km.ipv6Cidr,n.message,t);break}case"emoji":Cd(r,km.emoji(),n.message,t);break;case"ulid":{Cd(r,km.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Bm(r,"binary",n.message,t);break}case"contentEncoding:base64":{gn(r,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{Cd(r,km.base64,n.message,t);break}}break}case"nanoid":Cd(r,km.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function wue(e,t){return t.patternStrategy==="escape"?eWt(e):e}function eWt(e){let t="";for(let r=0;r<e.length;r++)Q9t.has(e[r])||(t+="\\"),t+=e[r];return t}function Bm(e,t,r,n){e.format||e.anyOf?.some(o=>o.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):gn(e,"format",t,r,n)}function Cd(e,t,r,n){e.pattern||e.allOf?.some(o=>o.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:cFe(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):gn(e,"pattern",cFe(t,n),r,n)}function cFe(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,o="",i=!1,a=!1,s=!1;for(let u=0;u<n.length;u++){if(i){o+=n[u],i=!1;continue}if(r.i){if(a){if(n[u].match(/[a-z]/)){s?(o+=n[u],o+=`${n[u-2]}-${n[u]}`.toUpperCase(),s=!1):n[u+1]==="-"&&n[u+2]?.match(/[a-z]/)?(o+=n[u],s=!0):o+=`${n[u]}${n[u].toUpperCase()}`;continue}}else if(n[u].match(/[a-z]/)){o+=`[${n[u]}${n[u].toUpperCase()}]`;continue}}if(r.m){if(n[u]==="^"){o+=`(^|(?<=[\r
]))`;continue}else if(n[u]==="$"){o+=`($|(?=[\r
]))`;continue}}if(r.s&&n[u]==="."){o+=a?`${n[u]}\r
`:`[${n[u]}\r
]`;continue}o+=n[u],n[u]==="\\"?i=!0:a&&n[u]==="]"?a=!1:!a&&n[u]==="["&&(a=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}var vue,km,Q9t,$V=C(()=>{SO();km={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:()=>(vue===void 0&&(vue=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),vue),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-_]*$/};Q9t=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function qV(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===re.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,o)=>({...n,[o]:Bt(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Bt(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??{}};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===re.ZodString&&e.keyType._def.checks?.length){let{type:n,...o}=BV(e.keyType._def,t);return{...r,propertyNames:o}}else{if(e.keyType?._def.typeName===re.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===re.ZodBranded&&e.keyType._def.type._def.typeName===re.ZodString&&e.keyType._def.type._def.checks?.length){let{type:n,...o}=FV(e.keyType._def,t);return{...r,propertyNames:o}}}return r}var UV=C(()=>{bd();is();$V();kV()});function dFe(e,t){if(t.mapStrategy==="record")return qV(e,t);let r=Bt(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},n=Bt(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var Sue=C(()=>{is();UV()});function fFe(e){let t=e.values,n=Object.keys(e.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[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 xue=C(()=>{});function pFe(){return{not:{}}}var Cue=C(()=>{});function hFe(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Oue=C(()=>{});function gFe(e,t){if(t.target==="openApi3")return mFe(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in sq&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=sq[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 mFe(e,t)}var sq,mFe,zV=C(()=>{is();sq={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};mFe=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>Bt(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});function yFe(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:sq[e.innerType._def.typeName],nullable:!0}:{type:[sq[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let n=Bt(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Bt(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var Eue=C(()=>{is();zV()});function bFe(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",sue(r,"type",n.message,t);break;case"min":t.target==="jsonSchema7"?n.inclusive?gn(r,"minimum",n.value,n.message,t):gn(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),gn(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?gn(r,"maximum",n.value,n.message,t):gn(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),gn(r,"maximum",n.value,n.message,t));break;case"multipleOf":gn(r,"multipleOf",n.value,n.message,t);break}return r}var Pue=C(()=>{SO()});function tWt(e,t){return t.removeAdditionalStrategy==="strict"?e.catchall._def.typeName==="ZodNever"?e.unknownKeys!=="strict":Bt(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??!0:e.catchall._def.typeName==="ZodNever"?e.unknownKeys==="passthrough":Bt(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??!0}function _Fe(e,t){let r=t.target==="openAi",n={type:"object",...Object.entries(e.shape()).reduce((o,[i,a])=>{if(a===void 0||a._def===void 0)return o;let s=a.isOptional();s&&r&&(a instanceof Xd&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=Bt(a._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});return u===void 0?o:{properties:{...o.properties,[i]:u},required:s?o.required:[...o.required,i]}},{properties:{},required:[]}),additionalProperties:tWt(e,t)};return n.required.length||delete n.required,n}var Tue=C(()=>{bd();is()});var vFe,Mue=C(()=>{is();vFe=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Bt(e.innerType._def,t);let r=Bt(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var wFe,Iue=C(()=>{is();wFe=(e,t)=>{if(t.pipeStrategy==="input")return Bt(e.in._def,t);if(t.pipeStrategy==="output")return Bt(e.out._def,t);let r=Bt(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=Bt(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function SFe(e,t){return Bt(e.type._def,t)}var Aue=C(()=>{is()});function xFe(e,t){let n={type:"array",uniqueItems:!0,items:Bt(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&gn(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&gn(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}var Rue=C(()=>{SO();is()});function CFe(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>Bt(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Bt(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>Bt(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var Due=C(()=>{is()});function OFe(){return{not:{}}}var jue=C(()=>{});function EFe(){return{}}var Nue=C(()=>{});var PFe,Lue=C(()=>{is();PFe=(e,t)=>Bt(e.innerType._def,t)});function Bt(e,t,r=!1){let n=t.seen.get(e);if(t.override){let a=t.override?.(e,t,n,r);if(a!==ZLe)return a}if(n&&!r){let a=rWt(n,t);if(a!==void 0)return a}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let i=oWt(e,e.typeName,t);return i&&iWt(e,t,i),o.jsonSchema=i,i}var rWt,nWt,oWt,iWt,is=C(()=>{bd();uue();lue();cue();due();kV();fue();hue();mue();gue();yue();bue();_ue();Sue();xue();Cue();Oue();Eue();Pue();Tue();Mue();Iue();Aue();UV();Rue();$V();Due();jue();zV();Nue();Lue();LV();rWt=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:nWt(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{}):t.$refStrategy==="seen"?{}:void 0}},nWt=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")},oWt=(e,t,r)=>{switch(t){case re.ZodString:return BV(e,r);case re.ZodNumber:return bFe(e,r);case re.ZodObject:return _Fe(e,r);case re.ZodBigInt:return rFe(e,r);case re.ZodBoolean:return nFe();case re.ZodDate:return pue(e,r);case re.ZodUndefined:return OFe();case re.ZodNull:return hFe(r);case re.ZodArray:return tFe(e,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return gFe(e,r);case re.ZodIntersection:return uFe(e,r);case re.ZodTuple:return CFe(e,r);case re.ZodRecord:return qV(e,r);case re.ZodLiteral:return lFe(e,r);case re.ZodEnum:return sFe(e);case re.ZodNativeEnum:return fFe(e);case re.ZodNullable:return yFe(e,r);case re.ZodOptional:return vFe(e,r);case re.ZodMap:return dFe(e,r);case re.ZodSet:return xFe(e,r);case re.ZodLazy:return Bt(e.getter()._def,r);case re.ZodPromise:return SFe(e,r);case re.ZodNaN:case re.ZodNever:return pFe();case re.ZodEffects:return aFe(e,r);case re.ZodAny:return eFe();case re.ZodUnknown:return EFe();case re.ZodDefault:return iFe(e,r);case re.ZodBranded:return FV(e,r);case re.ZodReadonly:return PFe(e,r);case re.ZodCatch:return oFe(e,r);case re.ZodPipeline:return wFe(e,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(n=>{})(t)}},iWt=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r)});var Li,Fue=C(()=>{is();aue();Li=(e,t)=>{let r=QLe(t),n=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[l,c])=>({...u,[l]:Bt(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??{}}),{}):void 0,o=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=Bt(e._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??{},a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.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 oh=C(()=>{LV();aue();SO();is();uue();lue();cue();due();kV();fue();hue();mue();gue();yue();bue();_ue();Sue();xue();Cue();Oue();Eue();Pue();Tue();Mue();Iue();Aue();Lue();UV();Rue();$V();Due();jue();zV();Nue();Fue();Fue()});function kue(e){return e.replace(/[^a-zA-Z-_0-9]/g,"_")}function sWt(e){let t="";for(let[r,n]of Object.entries(e))t+=` classDef ${r} ${n};
`;return t}function TFe(e,t,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:a=!0,curveStyle:s="linear",wrapLabelNWords:u=9}=r??{},l=a?`%%{init: {'flowchart': {'curve': '${s}'}}}%%
graph TD;
`:`graph TD;
`;if(a){let p="default",h={[p]:"{0}({1})"};n!==void 0&&(h[n]="{0}([{1}]):::first"),o!==void 0&&(h[o]="{0}([{1}]):::last");for(let[m,_]of Object.entries(e)){let g=_.name.split(":").pop()??"",S=aWt.some(O=>g.startsWith(O)&&g.endsWith(O))?`<p>${g}</p>`:g;Object.keys(_.metadata??{}).length&&(S+=`<hr/><small><em>${Object.entries(_.metadata??{}).map(([O,T])=>`${O} = ${T}`).join(`
`)}</em></small>`);let x=(h[m]??h[p]).replace("{0}",kue(m)).replace("{1}",S);l+=` ${x}
`}}let c={};for(let p of t){let h=p.source.split(":"),m=p.target.split(":"),_=h.filter((g,v)=>g===m[v]).join(":");c[_]||(c[_]=[]),c[_].push(p)}let d=new Set;function f(p,h){let m=p.length===1&&p[0].source===p[0].target;if(h&&!m){let _=h.split(":").pop();if(d.has(_))throw new Error(`Found duplicate subgraph '${_}' -- 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(_),l+=` subgraph ${_}
`}for(let _ of p){let{source:g,target:v,data:S,conditional:x}=_,O="";if(S!==void 0){let T=S,E=T.split(" ");E.length>u&&(T=Array.from({length:Math.ceil(E.length/u)},(M,A)=>E.slice(A*u,(A+1)*u).join(" ")).join("&nbsp;<br>&nbsp;")),O=x?` -. &nbsp;${T}&nbsp; .-> `:` -- &nbsp;${T}&nbsp; --> `}else O=x?" -.-> ":" --> ";l+=` ${kue(g)}${O}${kue(v)};
`}for(let _ in c)_.startsWith(`${h}:`)&&_!==h&&f(c[_],_);h&&!m&&(l+=` end
`)}f(c[""]??[],"");for(let p in c)!p.includes(":")&&p!==""&&f(c[p],p);return a&&(l+=sWt(i??{})),l}async function MFe(e,t){let{backgroundColor:r="white"}=t??{},n=btoa(e);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 aWt,IFe=C(()=>{aWt=["*","_","`"]});function uWt(e,t){if(e!==void 0&&!ID(e))return e;if(aq(t))try{let r=t.getName();return r=r.startsWith("Runnable")?r.slice(8):r,r}catch{return t.getName()}else return t.name??"UnknownSchema"}function lWt(e){return aq(e.data)?{type:"runnable",data:{id:e.data.lc_id,name:e.data.getName()}}:{type:"schema",data:{...Li(e.data.schema),title:e.data.name}}}function AFe(e,t=[]){let r=new Set(e.edges.filter(o=>!t.includes(o.source)).map(o=>o.target)),n=[];for(let o of Object.values(e.nodes))!t.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function RFe(e,t=[]){let r=new Set(e.edges.filter(o=>!t.includes(o.target)).map(o=>o.source)),n=[];for(let o of Object.values(e.nodes))!t.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}var uq,DFe=C(()=>{oh();N$();iue();IFe();uq=class e{constructor(t){Object.defineProperty(this,"nodes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"edges",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.nodes=t?.nodes??this.nodes,this.edges=t?.edges??this.edges}toJSON(){let t={};return Object.values(this.nodes).forEach((r,n)=>{t[r.id]=ID(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:t[r.id],...lWt(r)})),edges:this.edges.map(r=>{let n={source:t[r.source],target:t[r.target]};return typeof r.data<"u"&&(n.data=r.data),typeof r.conditional<"u"&&(n.conditional=r.conditional),n})}}addNode(t,r,n){if(r!==void 0&&this.nodes[r]!==void 0)throw new Error(`Node with id ${r} already exists`);let o=r??ef(),i={id:o,data:t,name:uWt(r,t),metadata:n};return this.nodes[o]=i,i}removeNode(t){delete this.nodes[t.id],this.edges=this.edges.filter(r=>r.source!==t.id&&r.target!==t.id)}addEdge(t,r,n,o){if(this.nodes[t.id]===void 0)throw new Error(`Source node ${t.id} not in graph`);if(this.nodes[r.id]===void 0)throw new Error(`Target node ${r.id} not in graph`);let i={source:t.id,target:r.id,data:n,conditional:o};return this.edges.push(i),i}firstNode(){return AFe(this)}lastNode(){return RFe(this)}extend(t,r=""){let n=r;Object.values(t.nodes).map(l=>l.id).every(ID)&&(n="");let i=l=>n?`${n}:${l}`:l;Object.entries(t.nodes).forEach(([l,c])=>{this.nodes[i(l)]={...c,id:i(l)}});let a=t.edges.map(l=>({...l,source:i(l.source),target:i(l.target)}));this.edges=[...this.edges,...a];let s=t.firstNode(),u=t.lastNode();return[s?{id:i(s.id),data:s.data}:void 0,u?{id:i(u.id),data:u.data}:void 0]}trimFirstNode(){let t=this.firstNode();t&&AFe(this,[t.id])&&this.removeNode(t)}trimLastNode(){let t=this.lastNode();t&&RFe(this,[t.id])&&this.removeNode(t)}reid(){let t=Object.fromEntries(Object.values(this.nodes).map(o=>[o.id,o.name])),r=new Map;Object.values(t).forEach(o=>{r.set(o,(r.get(o)||0)+1)});let n=o=>{let i=t[o];return ID(o)&&r.get(i)===1?i:o};return new e({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(t){let{withStyles:r,curveStyle:n,nodeColors:o={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=t??{},a=this.reid(),s=a.firstNode(),u=a.lastNode();return TFe(a.nodes,a.edges,{firstNode:s?.id,lastNode:u?.id,withStyles:r,curveStyle:n,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(t){let r=this.drawMermaid(t);return MFe(r,{backgroundColor:t?.backgroundColor})}}});function jFe(e){let t=new TextEncoder,r=new ReadableStream({async start(n){for await(let o of e)n.enqueue(t.encode(`event: data
data: ${JSON.stringify(o)}
`));n.enqueue(t.encode(`event: end
`)),n.close()}});return Nc.fromReadableStream(r)}var NFe=C(()=>{ly()});function Bue(e){return typeof e=="object"&&e!==null&&typeof e[Symbol.iterator]=="function"&&typeof e.next=="function"}function HV(e){return typeof e=="object"&&e!==null&&typeof e[Symbol.asyncIterator]=="function"}function*$ue(e,t){for(;;){let{value:r,done:n}=jc.runWithConfig(tp(e),t.next.bind(t),!0);if(n)break;yield r}}async function*VV(e,t){let r=t[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await jc.runWithConfig(tp(e),r.next.bind(t),!0);if(o)break;yield n}}var LFe,FFe=C(()=>{UD();sy();LFe=e=>e!=null&&typeof e=="object"&&"next"in e&&typeof e.next=="function"});function $u(e,t){return e&&!Array.isArray(e)&&!(e instanceof Date)&&typeof e=="object"?e:{[t]:e}}function cWt(e){if(hV(e))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function TS(e){if(typeof e=="function")return new IS({func:e});if(on.isRunnable(e))return e;if(!Array.isArray(e)&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=TS(n);return new xO({steps:t})}else throw new Error(`Expected a Runnable, function or object.
Instead got an unsupported type.`)}function dWt(e,t){let r=t.name??e.getName(),n=t.description??t.schema?.description;return t.schema.constructor===Tr.ZodString?new lq({name:r,description:n,schema:Tr.object({input:Tr.string()}).transform(o=>o.input),bound:e}):new lq({name:r,description:n,schema:t.schema,bound:e})}var que,on,MS,WV,JV,Ha,xO,Uue,IS,GV,VD,KV,lq,lf=C(()=>{bd();que=B(N6(),1);N$();Ase();VLe();JLe();UM();ly();nue();sy();HD();KLe();iue();UD();DFe();NFe();FFe();xV();on=class extends nf{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(t){let r=this.name??this.constructor.lc_name()??this.constructor.name;return t?`${r}${t}`:r}bind(t){return new MS({bound:this,kwargs:t,config:{}})}map(){return new WV({bound:this})}withRetry(t){return new JV({bound:this,kwargs:{},config:{},maxAttemptNumber:t?.stopAfterAttempt,...t})}withConfig(t){return new MS({bound:this,config:t,kwargs:{}})}withFallbacks(t){let r=Array.isArray(t)?t:t.fallbacks;return new GV({runnable:this,fallbacks:r})}_getOptionsList(t,r=0){if(Array.isArray(t)&&t.length!==r)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${t.length} options for ${r} inputs`);if(Array.isArray(t))return t.map(jr);if(r>1&&!Array.isArray(t)&&t.runId){console.warn("Provided runId will be used only for the first element of the batch.");let n=Object.fromEntries(Object.entries(t).filter(([o])=>o!=="runId"));return Array.from({length:r},(o,i)=>jr(i===0?t:n))}return Array.from({length:r},()=>jr(t))}async batch(t,r,n){let o=this._getOptionsList(r??{},t.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new rp({maxConcurrency:i,onFailedAttempt:u=>{throw u}}),s=t.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(t,r){yield this.invoke(t,r)}async stream(t,r){let n=jr(r),o=new PS({generator:this._streamIterator(t,n),config:n});return await o.setup,Nc.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(t){let r;t===void 0?r=jr(t):r=jr({callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,runName:t.runName,configurable:t.configurable,recursionLimit:t.recursionLimit,maxConcurrency:t.maxConcurrency,runId:t.runId,timeout:t.timeout,signal:t.signal});let n={...t};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(t,r,n){let o=jr(n),a=await(await uf(o))?.handleChainStart(this.toJSON(),$u(r,"input"),o.runId,o?.runType,void 0,void 0,o?.runName??this.getName());delete o.runId;let s;try{let u=t.call(this,r,o,a);s=await uy(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd($u(s,"output")),s}async _batchWithConfig(t,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(uf)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),$u(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=t.call(this,r,i,s,o);u=await uy(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($u(u,"output")))),u}async*_transformStreamWithConfig(t,r,n){let o,i=!0,a,s=!0,u=jr(n),l=await uf(u);async function*c(){for await(let f of t){if(i)if(o===void 0)o=f;else try{o=ul(o,f)}catch{o=void 0,i=!1}yield f}}let d;try{let f=await qLe(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(WLe),h=f.output;p!==void 0&&d!==void 0&&(h=p.tapOutputIterable(d.runId,h));let m=d?.handlers.find(HLe);m!==void 0&&d!==void 0&&(h=m.tapOutputIterable(d.runId,h));for await(let _ of h)if(yield _,s)if(a===void 0)a=_;else try{a=ul(a,_)}catch{a=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:$u(o,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:$u(o,"input")})}getGraph(t){let r=new uq,n=r.addNode({name:`${this.getName()}Input`,schema:Tr.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:Tr.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(t){return new Ha({first:this,last:TS(t)})}pick(t){return this.pipe(new KV(t))}assign(t){return this.pipe(new VD(new xO({steps:t})))}async*transform(t,r){let n;for await(let o of t)n===void 0?n=o:n=ul(n,o);yield*this._streamIterator(n,jr(r))}async*streamLog(t,r,n){let o=new nq({...n,autoClose:!1,_schemaFormat:"original"}),i=jr(r);yield*this._streamLog(t,o,i)}async*_streamLog(t,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(t,n);async function a(){try{let u=await i;for await(let l of u){let c=new Fm({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(t,r,n){let o;if(r.version==="v1")o=this._streamEventsV1(t,r,n);else if(r.version==="v2")o=this._streamEventsV2(t,r,n);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return r.encoding==="text/event-stream"?jFe(o):Nc.fromAsyncGenerator(o)}async*_streamEventsV2(t,r,n){let o=new DV({...n,autoClose:!1}),i=jr(r),a=i.runId??ef();i.runId=a;let s=i.callbacks;if(s===void 0)i.callbacks=[o];else if(Array.isArray(s))i.callbacks=s.concat(o);else{let h=s.copy();h.addHandler(o,!0),i.callbacks=h}let u=new AbortController,l=this;async function c(){try{let h;r?.signal?"any"in AbortSignal?h=AbortSignal.any([u.signal,r.signal]):(h=r.signal,r.signal.addEventListener("abort",()=>{u.abort()},{once:!0})):h=u.signal;let m=await l.stream(t,{...i,signal:h}),_=o.tapOutputIterable(a,m);for await(let g of _)if(u.signal.aborted)break}finally{await o.finish()}}let d=c(),f=!1,p;try{for await(let h of o){if(!f){h.data.input=t,f=!0,p=h.run_id,yield h;continue}h.run_id===p&&h.event.endsWith("_end")&&h.data?.input&&delete h.data.input,yield h}}finally{u.abort(),await d}}async*_streamEventsV1(t,r,n){let o,i=!1,a=jr(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new nq({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new NV({...n}),f=this._streamLog(t,c,a);for await(let h of f){if(o?o=o.concat(h):o=rq.fromRunLogPatch(h),o.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!i){i=!0;let v={...o.state},S={run_id:v.id,event:`on_${v.type}_start`,name:l,tags:s,metadata:u,data:{input:t}};d.includeEvent(S,v.type)&&(yield S)}let m=h.ops.filter(v=>v.path.startsWith("/logs/")).map(v=>v.path.split("/")[2]),_=[...new Set(m)];for(let v of _){let S,x={},O=o.state.logs[v];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 T=O.streamed_output.length;if(T!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${T} 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 v=g.streamed_output.length;if(v!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${v} 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 h={event:`on_${p.type}_end`,name:l,run_id:p.id,tags:s,metadata:u,data:{output:p.final_output}};d.includeEvent(h,p.type)&&(yield h)}}static isRunnable(t){return aq(t)}withListeners({onStart:t,onEnd:r,onError:n}){return new MS({bound:this,config:{},configFactories:[o=>({callbacks:[new iq({config:o,onStart:t,onEnd:r,onError:n})]})]})}asTool(t){return dWt(this,t)}},MS=class e extends on{static lc_name(){return"RunnableBinding"}constructor(t){super(t),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=t.bound,this.kwargs=t.kwargs,this.config=t.config,this.configFactories=t.configFactories}getName(t){return this.bound.getName(t)}async _mergeConfig(...t){let r=AV(this.config,...t);return AV(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}bind(t){return new this.constructor({bound:this.bound,kwargs:{...this.kwargs,...t},config:this.config})}withConfig(t){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...t}})}withRetry(t){return new this.constructor({bound:this.bound.withRetry(t),kwargs:this.kwargs,config:this.config})}async invoke(t,r){return this.bound.invoke(t,await this._mergeConfig(jr(r),this.kwargs))}async batch(t,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(jr(i),this.kwargs))):await this._mergeConfig(jr(r),this.kwargs);return this.bound.batch(t,o,n)}async*_streamIterator(t,r){yield*this.bound._streamIterator(t,await this._mergeConfig(jr(r),this.kwargs))}async stream(t,r){return this.bound.stream(t,await this._mergeConfig(jr(r),this.kwargs))}async*transform(t,r){yield*this.bound.transform(t,await this._mergeConfig(jr(r),this.kwargs))}streamEvents(t,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(t,{...await o._mergeConfig(jr(r),o.kwargs),version:r.version},n)};return Nc.fromAsyncGenerator(i())}static isRunnableBinding(t){return t.bound&&on.isRunnable(t.bound)}withListeners({onStart:t,onEnd:r,onError:n}){return new e({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[o=>({callbacks:[new iq({config:o,onStart:t,onEnd:r,onError:n})]})]})}},WV=class e extends on{static lc_name(){return"RunnableEach"}constructor(t){super(t),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=t.bound}bind(t){return new e({bound:this.bound.bind(t)})}async invoke(t,r){return this._callWithConfig(this._invoke.bind(this),t,r)}async _invoke(t,r,n){return this.bound.batch(t,Ta(r,{callbacks:n?.getChild()}))}withListeners({onStart:t,onEnd:r,onError:n}){return new e({bound:this.bound.withListeners({onStart:t,onEnd:r,onError:n})})}},JV=class extends MS{static lc_name(){return"RunnableRetry"}constructor(t){super(t),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=t.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=t.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(t,r,n){let o=t>1?`retry:attempt:${t}`:void 0;return Ta(r,{callbacks:n?.getChild(o)})}async _invoke(t,r,n){return(0,que.default)(o=>super.invoke(t,this._patchConfigForRetry(o,r,n)),{onFailedAttempt:o=>this.onFailedAttempt(o,t),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(t,r){return this._callWithConfig(this._invoke.bind(this),t,r)}async _batch(t,r,n,o){let i={};try{await(0,que.default)(async a=>{let s=t.map((f,p)=>p).filter(f=>i[f.toString()]===void 0||i[f.toString()]instanceof Error),u=s.map(f=>t[f]),l=s.map(f=>this._patchConfigForRetry(a,r?.[f],n?.[f])),c=await super.batch(u,l,{...o,returnExceptions:!0}),d;for(let f=0;f<c.length;f+=1){let p=c[f],h=s[f];p instanceof Error&&d===void 0&&(d=p,d.input=u[f]),i[h.toString()]=p}if(d)throw d;return c},{onFailedAttempt:a=>this.onFailedAttempt(a,a.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(a){if(o?.returnExceptions!==!0)throw a}return Object.keys(i).sort((a,s)=>parseInt(a,10)-parseInt(s,10)).map(a=>i[parseInt(a,10)])}async batch(t,r,n){return this._batchWithConfig(this._batch.bind(this),t,r,n)}},Ha=class e extends on{static lc_name(){return"RunnableSequence"}constructor(t){super(t),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=t.first,this.middle=t.middle??this.middle,this.last=t.last,this.name=t.name,this.omitSequenceTags=t.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(t,r){let n=jr(r),i=await(await uf(n))?.handleChainStart(this.toJSON(),$u(t,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let a=t,s;try{let u=[this.first,...this.middle];for(let l=0;l<u.length;l+=1){let d=u[l].invoke(a,Ta(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`)}));a=await uy(d,r?.signal)}if(r?.signal?.aborted)throw new Error("Aborted");s=await this.last.invoke(a,Ta(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${this.steps.length}`)}))}catch(u){throw await i?.handleChainError(u),u}return await i?.handleChainEnd($u(s,"output")),s}async batch(t,r,n){let o=this._getOptionsList(r??{},t.length),i=await Promise.all(o.map(uf)),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),$u(t[l],"input"),o[l].runId,void 0,void 0,void 0,o[l].runName);return delete o[l].runId,c})),s=t;try{for(let u=0;u<this.steps.length;u+=1){let c=this.steps[u].batch(s,a.map((d,f)=>{let p=d?.getChild(this.omitSequenceTags?void 0:`seq:step:${u+1}`);return Ta(o[f],{callbacks:p})}),n);s=await uy(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($u(s,"output")))),s}async*_streamIterator(t,r){let n=await uf(r),{runId:o,...i}=r??{},a=await n?.handleChainStart(this.toJSON(),$u(t,"input"),o,void 0,void 0,void 0,i?.runName),s=[this.first,...this.middle,this.last],u=!0,l;async function*c(){yield t}try{let d=s[0].transform(c(),Ta(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f<s.length;f+=1)d=await s[f].transform(d,Ta(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:`seq:step:${f+1}`)}));for await(let f of d)if(r?.signal?.throwIfAborted(),yield f,u)if(l===void 0)l=f;else try{l=ul(l,f)}catch{l=void 0,u=!1}}catch(d){throw await a?.handleChainError(d),d}await a?.handleChainEnd($u(l,"output"))}getGraph(t){let r=new uq,n=null;return this.steps.forEach((o,i)=>{let a=o.getGraph(t);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(t){return e.isRunnableSequence(t)?new e({first:this.first,middle:this.middle.concat([this.last,t.first,...t.middle]),last:t.last,name:this.name??t.name}):new e({first:this.first,middle:[...this.middle,this.last],last:TS(t),name:this.name})}static isRunnableSequence(t){return Array.isArray(t.middle)&&on.isRunnable(t)}static from([t,...r],n){let o={};return typeof n=="string"?o.name=n:n!==void 0&&(o=n),new e({...o,first:TS(t),middle:r.slice(0,-1).map(TS),last:TS(r[r.length-1])})}},xO=class e extends on{static lc_name(){return"RunnableMap"}getStepsKeys(){return Object.keys(this.steps)}constructor(t){super(t),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(t.steps))this.steps[r]=TS(n)}static from(t){return new e({steps:t})}async invoke(t,r){let n=jr(r),i=await(await uf(n))?.handleChainStart(this.toJSON(),{input:t},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(t,Ta(n,{callbacks:i?.getChild(`map:key:${u}`)}))});await uy(Promise.all(s),r?.signal)}catch(s){throw await i?.handleChainError(s),s}return await i?.handleChainEnd(a),a}async*_transform(t,r,n){let o={...this.steps},i=oue(t,Object.keys(o).length),a=new Map(Object.entries(o).map(([s,u],l)=>{let c=u.transform(i[l],Ta(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 uy(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(t,r){return this._transformStreamWithConfig(t,this._transform.bind(this),r)}async stream(t,r){async function*n(){yield t}let o=jr(r),i=new PS({generator:this.transform(n(),o),config:o});return await i.setup,Nc.fromAsyncGenerator(i)}},Uue=class e extends on{constructor(t){if(super(t),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}),!hV(t.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=t.func}async invoke(t,r){let[n]=this._getOptionsList(r??{},1),o=await uf(n),i=this.func(Ta(n,{callbacks:o}),t);return uy(i,n?.signal)}async*_streamIterator(t,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(t,r);if(HV(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(LFe(o)){for(;;){n?.signal?.throwIfAborted();let i=o.next();if(i.done)break;yield i.value}return}yield o}static from(t){return new e({func:t})}};IS=class e extends on{static lc_name(){return"RunnableLambda"}constructor(t){if(hV(t.func))return Uue.from(t.func);super(t),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}),cWt(t.func),this.func=t.func}static from(t){return new e({func:t})}async _invoke(t,r,n){return new Promise((o,i)=>{let a=Ta(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??IV)-1});jc.runWithConfig(tp(a),async()=>{try{let s=await this.func(t,{...a});if(s&&on.isRunnable(s)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");s=await s.invoke(t,{...a,recursionLimit:(a.recursionLimit??IV)-1})}else if(HV(s)){let u;for await(let l of VV(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=ul(u,l)}catch{u=l}s=u}else if(Bue(s)){let u;for(let l of $ue(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=ul(u,l)}catch{u=l}s=u}o(s)}catch(s){i(s)}})})}async invoke(t,r){return this._callWithConfig(this._invoke.bind(this),t,r)}async*_transform(t,r,n){let o;for await(let s of t)if(o===void 0)o=s;else try{o=ul(o,s)}catch{o=s}let i=Ta(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??IV)-1}),a=await new Promise((s,u)=>{jc.runWithConfig(tp(i),async()=>{try{let l=await this.func(o,{...i,config:i});s(l)}catch(l){u(l)}})});if(a&&on.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(HV(a))for await(let s of VV(i,a))n?.signal?.throwIfAborted(),yield s;else if(Bue(a))for(let s of $ue(i,a))n?.signal?.throwIfAborted(),yield s;else yield a}transform(t,r){return this._transformStreamWithConfig(t,this._transform.bind(this),r)}async stream(t,r){async function*n(){yield t}let o=jr(r),i=new PS({generator:this.transform(n(),o),config:o});return await i.setup,Nc.fromAsyncGenerator(i)}},GV=class extends on{static lc_name(){return"RunnableWithFallbacks"}constructor(t){super(t),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=t.runnable,this.fallbacks=t.fallbacks}*runnables(){yield this.runnable;for(let t of this.fallbacks)yield t}async invoke(t,r){let n=jr(r),o=await uf(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),$u(t,"input"),i,void 0,void 0,void 0,a?.runName),u=Ta(a,{callbacks:s?.getChild()});return await jc.runWithConfig(u,async()=>{let c;for(let d of this.runnables()){n?.signal?.throwIfAborted();try{let f=await d.invoke(t,u);return await s?.handleChainEnd($u(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(t,r){let n=jr(r),o=await uf(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),$u(t,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=Ta(a,{callbacks:s?.getChild()});try{let p=await d.stream(t,f);l=VV(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:ul(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd($u(c,"output"))}async batch(t,r,n){if(n?.returnExceptions)throw new Error("Not implemented.");let o=this._getOptionsList(r??{},t.length),i=await Promise.all(o.map(u=>uf(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),$u(t[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(t,a.map((c,d)=>Ta(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd($u(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.")}};VD=class extends on{static lc_name(){return"RunnableAssign"}constructor(t){t instanceof xO&&(t={mapper:t}),super(t),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=t.mapper}async invoke(t,r){let n=await this.mapper.invoke(t,r);return{...t,...n}}async*_transform(t,r,n){let o=this.mapper.getStepsKeys(),[i,a]=oue(t),s=this.mapper.transform(a,Ta(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(t,r){return this._transformStreamWithConfig(t,this._transform.bind(this),r)}async stream(t,r){async function*n(){yield t}let o=jr(r),i=new PS({generator:this.transform(n(),o),config:o});return await i.setup,Nc.fromAsyncGenerator(i)}},KV=class extends on{static lc_name(){return"RunnablePick"}constructor(t){(typeof t=="string"||Array.isArray(t))&&(t={keys:t}),super(t),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=t.keys}async _pick(t){if(typeof this.keys=="string")return t[this.keys];{let r=this.keys.map(n=>[n,t[n]]).filter(n=>n[1]!==void 0);return r.length===0?void 0:Object.fromEntries(r)}}async invoke(t,r){return this._callWithConfig(this._pick.bind(this),t,r)}async*_transform(t){for await(let r of t){let n=await this._pick(r);n!==void 0&&(yield n)}}transform(t,r){return this._transformStreamWithConfig(t,this._transform.bind(this),r)}async stream(t,r){async function*n(){yield t}let o=jr(r),i=new PS({generator:this.transform(n(),o),config:o});return await i.setup,Nc.fromAsyncGenerator(i)}},lq=class extends MS{constructor(t){let r=Ha.from([IS.from(async n=>{let o;if(FD(n))try{o=await this.schema.parseAsync(n.args)}catch{throw new LD("Received tool input did not match expected schema",JSON.stringify(n.args))}else o=n;return o}).withConfig({runName:`${t.name}:parse_input`}),t.bound]).withConfig({runName:t.name});super({bound:r,config:t.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=t.name,this.description=t.description,this.schema=t.schema}static lc_name(){return"RunnableToolLike"}}});var Fi,YV=C(()=>{ly();lf();sy();Fi=class extends on{static lc_name(){return"RunnablePassthrough"}constructor(t){super(t),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}),t&&(this.func=t.func)}async invoke(t,r){let n=jr(r);return this.func&&await this.func(t,n),this._callWithConfig(o=>Promise.resolve(o),t,n)}async*transform(t,r){let n=jr(r),o,i=!0;for await(let a of this._transformStreamWithConfig(t,s=>s,n))if(yield a,i)if(o===void 0)o=a;else try{o=ul(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(t){return new VD(new xO({steps:t}))}}});var kFe=C(()=>{lf();sy()});var BFe=C(()=>{lf();sy();ly()});var zue=C(()=>{rh()});var $Fe=C(()=>{lf();WM();rh();CV();OV();X$();zue();EV();BD();_O()});var KM=C(()=>{WM();rh();CV();OV();X$();EV();_O();$Fe();zue();BD()});var qFe=C(()=>{KM();lf();YV()});var Hue=C(()=>{lf();sy();YV();kFe();BFe();qFe()});var YM,ZM,np,WD=C(()=>{Hue();Y$();YM=class extends on{parseResultWithPrompt(t,r,n){return this.parseResult(t,n)}_baseMessageToString(t){return typeof t.content=="string"?t.content:this._baseMessageContentToString(t.content)}_baseMessageContentToString(t){return JSON.stringify(t)}async invoke(t,r){return typeof t=="string"?this._callWithConfig(async(n,o)=>this.parseResult([{text:n}],o?.callbacks),t,{...r,runType:"parser"}):this._callWithConfig(async(n,o)=>this.parseResult([{message:n,text:this._baseMessageToString(n)}],o?.callbacks),t,{...r,runType:"parser"})}},ZM=class extends YM{parseResult(t,r){return this.parse(t[0].text,r)}async parseWithPrompt(t,r,n){return this.parse(t,n)}_type(){throw new Error("_type not implemented")}},np=class extends Error{constructor(t,r,n,o=!1){if(super(t),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");yO(this,"OUTPUT_PARSING_FAILURE")}}});function cq(e,t){let r=typeof e;if(r!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let o=0;o<n;o++)if(!cq(e[o],t[o]))return!1;return!0}if(r==="object"){if(!e||!t)return e===t;let n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let a of n)if(!cq(e[a],t[a]))return!1;return!0}return e===t}var Vue=C(()=>{});var ZV=C(()=>{});var Nxn,XV=C(()=>{ZV();Nxn=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker")});function cf(e){return e.test.bind(e)}function jWt(e){return e%4===0&&(e%100!==0||e%400===0)}function UFe(e){let t=e.match(pWt);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&jWt(r)?29:hWt[n])}function zFe(e,t){let r=t.match(mWt);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)&&(!e||a)}function LWt(e){let t=e.split(NWt);return t.length==2&&UFe(t[0])&&zFe(!0,t[1])}function BWt(e){return FWt.test(e)&&kWt.test(e)}function qWt(e){if($Wt.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}var pWt,hWt,mWt,gWt,yWt,bWt,_Wt,vWt,wWt,SWt,xWt,CWt,OWt,EWt,PWt,TWt,MWt,IWt,AWt,RWt,DWt,NWt,FWt,kWt,$Wt,Wue=C(()=>{pWt=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,hWt=[0,31,28,31,30,31,30,31,31,30,31,30,31],mWt=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,gWt=/^(?=.{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,yWt=/^(?:[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,bWt=/^(?:(?:[^\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,_Wt=/^(?:(?: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,vWt=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,wWt=/^(?:\/(?:[^~/]|~0|~1)*)*$/,SWt=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,xWt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,CWt=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,OWt=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,EWt=/^\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,PWt=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,TWt=e=>{if(e[0]==='"')return!1;let[t,r,...n]=e.split("@");return!t||!r||n.length!==0||t.length>64||r.length>253||t[0]==="."||t.endsWith(".")||t.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:r.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},MWt=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,IWt=/^((([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,AWt=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));RWt={date:UFe,time:zFe.bind(void 0,!1),"date-time":LWt,duration:AWt,uri:BWt,"uri-reference":cf(yWt),"uri-template":cf(bWt),url:cf(_Wt),email:TWt,hostname:cf(gWt),ipv4:cf(MWt),ipv6:cf(IWt),regex:qWt,uuid:cf(vWt),"json-pointer":cf(wWt),"json-pointer-uri-fragment":cf(SWt),"relative-json-pointer":cf(xWt)},DWt={...RWt,date:cf(CWt),time:cf(OWt),"date-time":cf(EWt),"uri-reference":cf(PWt)};NWt=/t|\s/i;FWt=/\/|:/,kWt=/^(?:[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;$Wt=/[^\\]\\Z/});var HFe,VFe=C(()=>{(function(e){e[e.Flag=1]="Flag",e[e.Basic=2]="Basic",e[e.Detailed=4]="Detailed"})(HFe||(HFe={}))});var Jue=C(()=>{});var Gue=C(()=>{Vue();XV();Wue();ZV();Jue()});var WFe=C(()=>{XV();Gue()});var JFe=C(()=>{Vue();XV();Wue();ZV();VFe();Jue();Gue();WFe()});var XM,QM,CO=C(()=>{JFe();WD();rh();_O();zD();XM=class extends ZM{async*_transform(t){for await(let r of t)typeof r=="string"?yield this.parseResult([{text:r}]):yield this.parseResult([{message:r,text:this._baseMessageToString(r)}])}async*transform(t,r){yield*this._transformStreamWithConfig(t,this._transform.bind(this),{...r,runType:"parser"})}},QM=class extends XM{constructor(t){super(t),Object.defineProperty(this,"diff",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.diff=t?.diff??this.diff}async*_transform(t){let r,n;for await(let o of t){if(typeof o!="string"&&typeof o.content!="string")throw new Error("Cannot handle non-string output.");let i;if(Hse(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new ii({message:o,text:o.content})}else if(th(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new ii({message:Jse(o),text:o.content})}else i=new nh({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!cq(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var GFe=C(()=>{CO()});var KFe=C(()=>{WD();CO()});var QV,YFe=C(()=>{CO();QV=class extends XM{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(t){return Promise.resolve(t)}getFormatInstructions(){return""}_textContentToString(t){return t.text}_imageUrlContentToString(t){throw new Error('Cannot coerce a multimodal "image_url" message part into a string.')}_messageContentComplexToString(t){switch(t.type){case"text":case"text_delta":if("text"in t)return this._textContentToString(t);break;case"image_url":if("image_url"in t)return this._imageUrlContentToString(t);break;default:throw new Error(`Cannot coerce "${t.type}" message part into a string.`)}throw new Error(`Invalid content type: ${t.type}`)}_baseMessageContentToString(t){return t.reduce((r,n)=>r+this._messageContentComplexToString(n),"")}}});var AS,ZFe=C(()=>{bd();oh();WD();AS=class extends ZM{static lc_name(){return"StructuredOutputParser"}toJSON(){return this.toJSONNotImplemented()}constructor(t){super(t),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","structured"]})}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let r=Tr.object(Object.fromEntries(Object.entries(t).map(([n,o])=>[n,Tr.string().describe(o)])));return new this(r)}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance.
"JSON Schema" is a declarative language that allows you to annotate and validate JSON documents.
For example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}}}}
would match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings.
Thus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted.
Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas!
Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock:
\`\`\`json
${JSON.stringify(Li(this.schema))}
\`\`\`
`}async parse(t){try{let n=(t.includes("```")?t.trim().split(/```(?:json)?/)[1]:t.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 np(`Failed to parse. Text: "${t}". Error: ${r}`,t)}}}});var Kue=C(()=>{Dse()});var RS,Yue=C(()=>{CO();Kue();zse();RS=class extends QM{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(t,r){if(r)return t?SV(t,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(t){return Use(t[0].text)}async parse(t){return Use(t,JSON.parse)}getFormatInstructions(){return""}}});var XFe=C(()=>{});var QFe=C(()=>{CO();Kue();XFe()});var eke=C(()=>{WD();GFe();KFe();YFe();ZFe();CO();Yue();QFe()});var OO=C(()=>{eke()});var dq,JD,GD,e5,fq=C(()=>{UM();X$();_O();dq=class extends nf{},JD=class extends dq{static lc_name(){return"StringPromptValue"}constructor(t){super({value:t}),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=t}toString(){return this.value}toChatMessages(){return[new Ua(this.value)]}},GD=class extends dq{static lc_name(){return"ChatPromptValue"}constructor(t){Array.isArray(t)&&(t={messages:t}),super(t),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=t.messages}toString(){return sf(this.messages)}toChatMessages(){return this.messages}},e5=class extends dq{static lc_name(){return"ImagePromptValue"}constructor(t){"imageUrl"in t||(t={imageUrl:t}),super(t),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=t.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new Ua({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var DS,pq=C(()=>{fq();KD();DS=class extends cy{async formatPromptValue(t){let r=await this.format(t);return new JD(r)}}});function Xue(e){return typeof e=="function"}function HWt(e){return ZD(e)?"array":typeof e}function Zue(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function tke(e,t){return e!=null&&typeof e=="object"&&t in e}function VWt(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}function JWt(e,t){return WWt.call(e,t)}function KWt(e){return!JWt(GWt,e)}function ZWt(e){return String(e).replace(/[&<>"'`=\/]/g,function(r){return YWt[r]})}function rJt(e,t){if(!e)return[];var r=!1,n=[],o=[],i=[],a=!1,s=!1,u="",l=0;function c(){if(a&&!s)for(;i.length;)delete o[i.pop()];else i=[];a=!1,s=!1}var d,f,p;function h(M){if(typeof M=="string"&&(M=M.split(QWt,2)),!ZD(M)||M.length!==2)throw new Error("Invalid tags: "+M);d=new RegExp(Zue(M[0])+"\\s*"),f=new RegExp("\\s*"+Zue(M[1])),p=new RegExp("\\s*"+Zue("}"+M[1]))}h(t||ih.tags);for(var m=new mq(e),_,g,v,S,x,O;!m.eos();){if(_=m.pos,v=m.scanUntil(d),v)for(var T=0,E=v.length;T<E;++T)S=v.charAt(T),KWt(S)?(i.push(o.length),u+=S):(s=!0,r=!0,u+=" "),o.push(["text",S,_,_+1]),_+=1,S===`
`&&(c(),u="",l=0,r=!1);if(!m.scan(d))break;if(a=!0,g=m.scan(tJt)||"name",m.scan(XWt),g==="="?(v=m.scanUntil(rke),m.scan(rke),m.scanUntil(f)):g==="{"?(v=m.scanUntil(p),m.scan(eJt),m.scanUntil(f),g="&"):v=m.scanUntil(f),!m.scan(f))throw new Error("Unclosed tag at "+m.pos);if(g==">"?x=[g,v,_,m.pos,u,l,r]:x=[g,v,_,m.pos],l++,o.push(x),g==="#"||g==="^")n.push(x);else if(g==="/"){if(O=n.pop(),!O)throw new Error('Unopened section "'+v+'" at '+_);if(O[1]!==v)throw new Error('Unclosed section "'+O[1]+'" at '+_)}else g==="name"||g==="{"||g==="&"?s=!0:g==="="&&h(v)}if(c(),O=n.pop(),O)throw new Error('Unclosed section "'+O[1]+'" at '+m.pos);return oJt(nJt(o))}function nJt(e){for(var t=[],r,n,o=0,i=e.length;o<i;++o)r=e[o],r&&(r[0]==="text"&&n&&n[0]==="text"?(n[1]+=r[1],n[3]=r[3]):(t.push(r),n=r));return t}function oJt(e){for(var t=[],r=t,n=[],o,i,a=0,s=e.length;a<s;++a)switch(o=e[a],o[0]){case"#":case"^":r.push(o),n.push(o),r=o[4]=[];break;case"/":i=n.pop(),i[5]=o[2],r=n.length>0?n[n.length-1][4]:t;break;default:r.push(o)}return t}function mq(e){this.string=e,this.tail=e,this.pos=0}function YD(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function Od(){this.templateCache={_cache:{},set:function(t,r){this._cache[t]=r},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}var zWt,ZD,WWt,GWt,YWt,XWt,QWt,rke,eJt,tJt,ih,hq,t5,nke=C(()=>{zWt=Object.prototype.toString,ZD=Array.isArray||function(t){return zWt.call(t)==="[object Array]"};WWt=RegExp.prototype.test;GWt=/\S/;YWt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};XWt=/\s*/,QWt=/\s+/,rke=/\s*=/,eJt=/\s*\}/,tJt=/#|\^|\/|>|\{|&|=|!/;mq.prototype.eos=function(){return this.tail===""};mq.prototype.scan=function(t){var r=this.tail.match(t);if(!r||r.index!==0)return"";var n=r[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};mq.prototype.scanUntil=function(t){var r=this.tail.search(t),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};YD.prototype.push=function(t){return new YD(t,this)};YD.prototype.lookup=function(t){var r=this.cache,n;if(r.hasOwnProperty(t))n=r[t];else{for(var o=this,i,a,s,u=!1;o;){if(t.indexOf(".")>0)for(i=o.view,a=t.split("."),s=0;i!=null&&s<a.length;)s===a.length-1&&(u=tke(i,a[s])||VWt(i,a[s])),i=i[a[s++]];else i=o.view[t],u=tke(o.view,t);if(u){n=i;break}o=o.parent}r[t]=n}return Xue(n)&&(n=n.call(this.view)),n};Od.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Od.prototype.parse=function(t,r){var n=this.templateCache,o=t+":"+(r||ih.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=rJt(t,r),i&&n.set(o,a)),a};Od.prototype.render=function(t,r,n,o){var i=this.getConfigTags(o),a=this.parse(t,i),s=r instanceof YD?r:new YD(r,void 0);return this.renderTokens(a,s,n,t,o)};Od.prototype.renderTokens=function(t,r,n,o,i){for(var a="",s,u,l,c=0,d=t.length;c<d;++c)l=void 0,s=t[c],u=s[0],u==="#"?l=this.renderSection(s,r,n,o,i):u==="^"?l=this.renderInverted(s,r,n,o,i):u===">"?l=this.renderPartial(s,r,n,i):u==="&"?l=this.unescapedValue(s,r):u==="name"?l=this.escapedValue(s,r,i):u==="text"&&(l=this.rawValue(s)),l!==void 0&&(a+=l);return a};Od.prototype.renderSection=function(t,r,n,o,i){var a=this,s="",u=r.lookup(t[1]);function l(f){return a.render(f,r,n,i)}if(u){if(ZD(u))for(var c=0,d=u.length;c<d;++c)s+=this.renderTokens(t[4],r.push(u[c]),n,o,i);else if(typeof u=="object"||typeof u=="string"||typeof u=="number")s+=this.renderTokens(t[4],r.push(u),n,o,i);else if(Xue(u)){if(typeof o!="string")throw new Error("Cannot use higher-order sections without the original template");u=u.call(r.view,o.slice(t[3],t[5]),l),u!=null&&(s+=u)}else s+=this.renderTokens(t[4],r,n,o,i);return s}};Od.prototype.renderInverted=function(t,r,n,o,i){var a=r.lookup(t[1]);if(!a||ZD(a)&&a.length===0)return this.renderTokens(t[4],r,n,o,i)};Od.prototype.indentPartial=function(t,r,n){for(var o=r.replace(/[^ \t]/g,""),i=t.split(`
`),a=0;a<i.length;a++)i[a].length&&(a>0||!n)&&(i[a]=o+i[a]);return i.join(`
`)};Od.prototype.renderPartial=function(t,r,n,o){if(n){var i=this.getConfigTags(o),a=Xue(n)?n(t[1]):n[t[1]];if(a!=null){var s=t[6],u=t[5],l=t[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)}}};Od.prototype.unescapedValue=function(t,r){var n=r.lookup(t[1]);if(n!=null)return n};Od.prototype.escapedValue=function(t,r,n){var o=this.getConfigEscape(n)||ih.escape,i=r.lookup(t[1]);if(i!=null)return typeof i=="number"&&o===ih.escape?String(i):o(i)};Od.prototype.rawValue=function(t){return t[1]};Od.prototype.getConfigTags=function(t){return ZD(t)?t:t&&typeof t=="object"?t.tags:void 0};Od.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!ZD(t))return t.escape};ih={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(e){hq.templateCache=e},get templateCache(){return hq.templateCache}},hq=new Od;ih.clearCache=function(){return hq.clearCache()};ih.parse=function(t,r){return hq.parse(t,r)};ih.render=function(t,r,n,o){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+HWt(t)+'" was given as the first argument for mustache#render(template, view, partials)');return hq.render(t,r,n,o)};ih.escape=ZWt;ih.Scanner=mq;ih.Context=YD;ih.Writer=Od;t5=ih});function oke(){t5.escape=e=>e}var gq,iJt,r5,aJt,sJt,Que,uJt,$m,ike,eI,XD=C(()=>{nke();Y$();gq=e=>{let t=e.split(""),r=[],n=(i,a)=>{for(let s=a;s<t.length;s+=1)if(i.includes(t[s]))return s;return-1},o=0;for(;o<t.length;)if(t[o]==="{"&&o+1<t.length&&t[o+1]==="{")r.push({type:"literal",text:"{"}),o+=2;else if(t[o]==="}"&&o+1<t.length&&t[o+1]==="}")r.push({type:"literal",text:"}"}),o+=2;else if(t[o]==="{"){let i=n("}",o);if(i<0)throw new Error("Unclosed '{' in template.");r.push({type:"variable",name:t.slice(o+1,i).join("")}),o=i+1}else{if(t[o]==="}")throw new Error("Single '}' in template.");{let i=n("{}",o),a=(i<0?t.slice(o):t.slice(o,i)).join("");r.push({type:"literal",text:a}),o=i<0?t.length:i}}return r},iJt=e=>e.map(t=>t[0]==="name"?{type:"variable",name:t[1].includes(".")?t[1].split(".")[0]:t[1]}:["#","&","^",">"].includes(t[0])?{type:"variable",name:t[1]}:{type:"literal",text:t[1]}),r5=e=>{oke();let t=t5.parse(e);return iJt(t)},aJt=(e,t)=>gq(e).reduce((r,n)=>{if(n.type==="variable"){if(n.name in t){let o=typeof t[n.name]=="string"?t[n.name]:JSON.stringify(t[n.name]);return r+o}throw new Error(`(f-string) Missing value for input ${n.name}`)}return r+n.text},""),sJt=(e,t)=>(oke(),t5.render(e,t)),Que={"f-string":aJt,mustache:sJt},uJt={"f-string":gq,mustache:r5},$m=(e,t,r)=>{try{return Que[t](e,r)}catch(n){throw yO(n,"INVALID_PROMPT_INPUT")}},ike=(e,t)=>uJt[t](e),eI=(e,t,r)=>{if(!(t in Que)){let n=Object.keys(Que);throw new Error(`Invalid template format. Got \`${t}\`;
should be one of ${n}`)}try{let n=r.reduce((o,i)=>(o[i]="foo",o),{});Array.isArray(e)?e.forEach(o=>{if(o.type==="text")$m(o.text,t,n);else if(o.type==="image_url")if(typeof o.image_url=="string")$m(o.image_url,t,n);else{let i=o.image_url.url;$m(i,t,n)}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):$m(e,t,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var ele={};Yd(ele,{PromptTemplate:()=>Ed});var Ed,QD=C(()=>{pq();XD();Ed=class e extends DS{static lc_name(){return"PromptTemplate"}constructor(t){if(super(t),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}),t.templateFormat==="mustache"&&t.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,t),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))),eI(this.template,this.templateFormat,r)}}_getPromptType(){return"prompt"}async format(t){let r=await this.mergePartialAndUserVariables(t);return $m(this.template,this.templateFormat,r)}static fromExamples(t,r,n,o=`
`,i=""){let a=[i,...t,r].join(o);return new e({inputVariables:n,template:a})}static fromTemplate(t,r){let{templateFormat:n="f-string",...o}=r??{},i=new Set;return ike(t,n).forEach(a=>{a.type==="variable"&&i.add(a.name)}),new e({inputVariables:[...i],templateFormat:n,template:t,...o})}async partial(t){let r=this.inputVariables.filter(i=>!(i in t)),n={...this.partialVariables??{},...t},o={...this,inputVariables:r,partialVariables:n};return new e(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(t){if(!t.template)throw new Error("Prompt template must have a template");return new e({inputVariables:t.input_variables,template:t.template,templateFormat:t.template_format})}}});var ej,tle=C(()=>{fq();KD();XD();ej=class e extends cy{static lc_name(){return"ImagePromptTemplate"}constructor(t){if(super(t),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=t.template,this.templateFormat=t.templateFormat??this.templateFormat,this.validateTemplate=t.validateTemplate??this.validateTemplate,this.additionalContentFields=t.additionalContentFields,this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),eI([{type:"image_url",image_url:this.template}],this.templateFormat,r)}}_getPromptType(){return"prompt"}async partial(t){let r=this.inputVariables.filter(i=>!(i in t)),n={...this.partialVariables??{},...t},o={...this,inputVariables:r,partialVariables:n};return new e(o)}async format(t){let r={};for(let[a,s]of Object.entries(this.template))typeof s=="string"?r[a]=$m(s,this.templateFormat,t):r[a]=s;let n=t.url||r.url,o=t.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(t){let r=await this.format(t);return new e5(r)}}});function lJt(e){return typeof e.formatMessages=="function"}function cJt(e,t){if(lJt(e)||th(e))return e;if(Array.isArray(e)&&e[0]==="placeholder"){let o=e[1];if(t?.templateFormat==="mustache"&&typeof o=="string"&&o.slice(0,2)==="{{"&&o.slice(-2)==="}}"){let i=o.slice(2,-2);return new EO({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new EO({variableName:i,optional:!0})}throw new Error(`Invalid placeholder template for format ${t?.templateFormat??'"f-string"'}: "${e[1]}". Expected a variable name surrounded by ${t?.templateFormat==="mustache"?"double":"single"} curly braces.`)}let r=Lm(e),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 PO.fromTemplate(n,t);if(r._getType()==="ai")return ole.fromTemplate(n,t);if(r._getType()==="system")return tj.fromTemplate(n,t);if(xd.isInstance(r))return nle.fromTemplate(r.content,r.role,t);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function dJt(e){return e.constructor.lc_name()==="MessagesPlaceholder"}var yq,EO,rle,bq,nle,_q,PO,ole,tj,ah,vq=C(()=>{KM();fq();lf();pq();KD();QD();tle();XD();Y$();yq=class extends on{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(t,r){return this._callWithConfig(n=>this.formatMessages(n),t,{...r,runType:"prompt"})}},EO=class extends yq{static lc_name(){return"MessagesPlaceholder"}constructor(t){typeof t=="string"&&(t={variableName:t}),super(t),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=t.variableName,this.optional=t.optional??!1}get inputVariables(){return[this.variableName]}async formatMessages(t){let r=t[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(Lm):n=[Lm(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}},rle=class extends yq{constructor(t){"prompt"in t||(t={prompt:t}),super(t),Object.defineProperty(this,"prompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.prompt=t.prompt}get inputVariables(){return this.prompt.inputVariables}async formatMessages(t){return[await this.format(t)]}},bq=class extends cy{constructor(t){super(t)}async format(t){return(await this.formatPromptValue(t)).toString()}async formatPromptValue(t){let r=await this.formatMessages(t);return new GD(r)}},nle=class extends rle{static lc_name(){return"ChatMessagePromptTemplate"}constructor(t,r){"prompt"in t||(t={prompt:t,role:r}),super(t),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=t.role}async format(t){return new xd(await this.prompt.format(t),this.role)}static fromTemplate(t,r,n){return new this(Ed.fromTemplate(t,{templateFormat:n?.templateFormat}),r)}},_q=class extends yq{static _messageClass(){throw new Error("Can not invoke _messageClass from inside _StringImageMessagePromptTemplate")}constructor(t,r){if("prompt"in t||(t={prompt:t}),super(t),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=t.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(t){let r=this.constructor;if(r._messageClass()){let n=r._messageClass();return new n({content:t})}else if(r.chatMessageClass){let n=r.chatMessageClass();return new n({content:t,role:this.getRoleFromMessageClass(n.lc_name())})}else throw new Error("No message class defined")}getRoleFromMessageClass(t){switch(t){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(t,r){if(typeof t=="string")return new this(Ed.fromTemplate(t,r));let n=[];for(let o of t)if(typeof o=="string"||typeof o=="object"&&"text"in o){let i="";typeof o=="string"?i=o:typeof o.text=="string"&&(i=o.text??"");let a={...r,...typeof o!="string"?{additionalContentFields:o}:{}};n.push(Ed.fromTemplate(i,a))}else if(typeof o=="object"&&"image_url"in o){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=r5(i):u=gq(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 ej({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=r5(i.url):u=gq(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new ej({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else throw new Error("Invalid image template");n.push(a)}return new this({prompt:n,additionalOptions:r})}async format(t){if(this.prompt instanceof DS){let r=await this.prompt.format(t);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]:t[i]}),o={...o,[i]:t[i]};if(n instanceof DS){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"text",text:i})}else if(n instanceof ej){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"image_url",image_url:i})}}return this.createMessage(r)}}async formatMessages(t){return[await this.format(t)]}},PO=class extends _q{static _messageClass(){return Ua}static lc_name(){return"HumanMessagePromptTemplate"}},ole=class extends _q{static _messageClass(){return Po}static lc_name(){return"AIMessagePromptTemplate"}},tj=class extends _q{static _messageClass(){return ES}static lc_name(){return"SystemMessagePromptTemplate"}};ah=class e extends bq{static lc_name(){return"ChatPromptTemplate"}get lc_aliases(){return{promptMessages:"messages"}}constructor(t){if(super(t),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"}),t.templateFormat==="mustache"&&t.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,t),this.validateTemplate){let r=new Set;for(let s of this.promptMessages)if(!(s instanceof ku))for(let u of s.inputVariables)r.add(u);let n=this.inputVariables,o=new Set(this.partialVariables?n.concat(Object.keys(this.partialVariables)):n),i=new Set([...o].filter(s=>!r.has(s)));if(i.size>0)throw new Error(`Input variables \`${[...i]}\` are not used in any of the prompt messages.`);let a=new Set([...r].filter(s=>!o.has(s)));if(a.size>0)throw new Error(`Input variables \`${[...a]}\` are used in prompt messages but not in the prompt template.`)}}_getPromptType(){return"chat"}async _parseImagePrompts(t,r){if(typeof t.content=="string")return t;let n=await Promise.all(t.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 Ed.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 t.content=n,t}async formatMessages(t){let r=await this.mergePartialAndUserVariables(t),n=[];for(let o of this.promptMessages)if(o instanceof ku)n.push(await this._parseImagePrompts(o,r));else{let i=o.inputVariables.reduce((s,u)=>{if(!(u in r)&&!(dJt(o)&&o.optional))throw yO(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(t){let r=this.inputVariables.filter(i=>!(i in t)),n={...this.partialVariables??{},...t},o={...this,inputVariables:r,partialVariables:n};return new e(o)}static fromTemplate(t,r){let n=Ed.fromTemplate(t,r),o=new PO({prompt:n});return this.fromMessages([o])}static fromMessages(t,r){let n=t.reduce((a,s)=>a.concat(s instanceof e?s.promptMessages:[cJt(s,r)]),[]),o=t.reduce((a,s)=>s instanceof e?Object.assign(a,s.partialVariables):a,Object.create(null)),i=new Set;for(let a of n)if(!(a instanceof ku))for(let s of a.inputVariables)s in o||i.add(s);return new this({...r,inputVariables:[...i],promptMessages:n,partialVariables:o,templateFormat:r?.templateFormat})}static fromPromptMessages(t){return this.fromMessages(t)}}});var ake={};Yd(ake,{FewShotChatMessagePromptTemplate:()=>ale,FewShotPromptTemplate:()=>ile});var ile,ale,sle=C(()=>{pq();XD();QD();vq();ile=class e extends DS{constructor(t){if(super(t),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,t),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))),eI(this.prefix+this.suffix,this.templateFormat,r)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(t){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(t);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(t){let r=this.inputVariables.filter(i=>!(i in t)),n={...this.partialVariables??{},...t},o={...this,inputVariables:r,partialVariables:n};return new e(o)}async format(t){let r=await this.mergePartialAndUserVariables(t),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 $m(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(t){let{example_prompt:r}=t;if(!r)throw new Error("Missing example prompt");let n=await Ed.deserialize(r),o;if(Array.isArray(t.examples))o=t.examples;else throw new Error("Invalid examples format. Only list or string are supported.");return new e({inputVariables:t.input_variables,examplePrompt:n,examples:o,exampleSeparator:t.example_separator,prefix:t.prefix,suffix:t.suffix,templateFormat:t.template_format})}},ale=class e extends bq{_getPromptType(){return"few_shot_chat"}static lc_name(){return"FewShotChatMessagePromptTemplate"}constructor(t){if(super(t),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=t.examples,this.examplePrompt=t.examplePrompt,this.exampleSeparator=t.exampleSeparator??`
`,this.exampleSelector=t.exampleSelector,this.prefix=t.prefix??"",this.suffix=t.suffix??"",this.templateFormat=t.templateFormat??"f-string",this.validateTemplate=t.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))),eI(this.prefix+this.suffix,this.templateFormat,r)}}async getExamples(t){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(t);throw new Error("One of 'examples' and 'example_selector' should be provided")}async formatMessages(t){let r=await this.mergePartialAndUserVariables(t),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(t){let r=await this.mergePartialAndUserVariables(t),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 $m(a,this.templateFormat,r)}async partial(t){let r=this.inputVariables.filter(i=>!(i in t)),n={...this.partialVariables??{},...t},o={...this,inputVariables:r,partialVariables:n};return new e(o)}}});var cy,KD=C(()=>{lf();cy=class extends on{get lc_attributes(){return{partialVariables:void 0}}constructor(t){super(t),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}=t;if(r.includes("stop"))throw new Error("Cannot have an input variable named 'stop', as it is used internally, please rename.");Object.assign(this,t)}async mergePartialAndUserVariables(t){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,...t}}async invoke(t,r){let n={...this.metadata,...r?.metadata},o=[...this.tags??[],...r?.tags??[]];return this._callWithConfig(i=>this.formatPromptValue(i),t,{...r,tags:o,metadata:n,runType:"prompt"})}serialize(){throw new Error("Use .toJSON() instead")}static async deserialize(t){switch(t._type){case"prompt":{let{PromptTemplate:r}=await Promise.resolve().then(()=>(QD(),ele));return r.deserialize(t)}case void 0:{let{PromptTemplate:r}=await Promise.resolve().then(()=>(QD(),ele));return r.deserialize({...t,_type:"prompt"})}case"few_shot":{let{FewShotPromptTemplate:r}=await Promise.resolve().then(()=>(sle(),ake));return r.deserialize(t)}default:throw new Error(`Invalid prompt type in config: ${t._type}`)}}}});var ske=C(()=>{KD();vq()});var uke=C(()=>{});var lke=C(()=>{vq()});var cke=C(()=>{KD();vq();sle();ske();QD();uke();pq();XD();tle();lke()});var tI=C(()=>{cke()});var jS=C(()=>{Hue()});var Tke=b(an=>{"use strict";var Sq=Symbol.for("react.element"),_Jt=Symbol.for("react.portal"),vJt=Symbol.for("react.fragment"),wJt=Symbol.for("react.strict_mode"),SJt=Symbol.for("react.profiler"),xJt=Symbol.for("react.provider"),CJt=Symbol.for("react.context"),OJt=Symbol.for("react.forward_ref"),EJt=Symbol.for("react.suspense"),PJt=Symbol.for("react.memo"),TJt=Symbol.for("react.lazy"),bke=Symbol.iterator;function MJt(e){return e===null||typeof e!="object"?null:(e=bke&&e[bke]||e["@@iterator"],typeof e=="function"?e:null)}var wke={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ske=Object.assign,xke={};function nj(e,t,r){this.props=e,this.context=t,this.refs=xke,this.updater=r||wke}nj.prototype.isReactComponent={};nj.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};nj.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Cke(){}Cke.prototype=nj.prototype;function mle(e,t,r){this.props=e,this.context=t,this.refs=xke,this.updater=r||wke}var gle=mle.prototype=new Cke;gle.constructor=mle;Ske(gle,nj.prototype);gle.isPureReactComponent=!0;var _ke=Array.isArray,Oke=Object.prototype.hasOwnProperty,yle={current:null},Eke={key:!0,ref:!0,__self:!0,__source:!0};function Pke(e,t,r){var n,o={},i=null,a=null;if(t!=null)for(n in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)Oke.call(t,n)&&!Eke.hasOwnProperty(n)&&(o[n]=t[n]);var s=arguments.length-2;if(s===1)o.children=r;else if(1<s){for(var u=Array(s),l=0;l<s;l++)u[l]=arguments[l+2];o.children=u}if(e&&e.defaultProps)for(n in s=e.defaultProps,s)o[n]===void 0&&(o[n]=s[n]);return{$$typeof:Sq,type:e,key:i,ref:a,props:o,_owner:yle.current}}function IJt(e,t){return{$$typeof:Sq,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ble(e){return typeof e=="object"&&e!==null&&e.$$typeof===Sq}function AJt(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var vke=/\/+/g;function hle(e,t){return typeof e=="object"&&e!==null&&e.key!=null?AJt(""+e.key):t.toString(36)}function s5(e,t,r,n,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Sq:case _Jt:a=!0}}if(a)return a=e,o=o(a),e=n===""?"."+hle(a,0):n,_ke(o)?(r="",e!=null&&(r=e.replace(vke,"$&/")+"/"),s5(o,t,r,"",function(l){return l})):o!=null&&(ble(o)&&(o=IJt(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(vke,"$&/")+"/")+e)),t.push(o)),1;if(a=0,n=n===""?".":n+":",_ke(e))for(var s=0;s<e.length;s++){i=e[s];var u=n+hle(i,s);a+=s5(i,t,r,u,o)}else if(u=MJt(e),typeof u=="function")for(e=u.call(e),s=0;!(i=e.next()).done;)i=i.value,u=n+hle(i,s++),a+=s5(i,t,r,u,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function a5(e,t,r){if(e==null)return e;var n=[],o=0;return s5(e,n,"","",function(i){return t.call(r,i,o++)}),n}function RJt(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Pd={current:null},u5={transition:null},DJt={ReactCurrentDispatcher:Pd,ReactCurrentBatchConfig:u5,ReactCurrentOwner:yle};an.Children={map:a5,forEach:function(e,t,r){a5(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return a5(e,function(){t++}),t},toArray:function(e){return a5(e,function(t){return t})||[]},only:function(e){if(!ble(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};an.Component=nj;an.Fragment=vJt;an.Profiler=SJt;an.PureComponent=mle;an.StrictMode=wJt;an.Suspense=EJt;an.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=DJt;an.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=Ske({},e.props),o=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=yle.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(u in t)Oke.call(t,u)&&!Eke.hasOwnProperty(u)&&(n[u]=t[u]===void 0&&s!==void 0?s[u]:t[u])}var u=arguments.length-2;if(u===1)n.children=r;else if(1<u){s=Array(u);for(var l=0;l<u;l++)s[l]=arguments[l+2];n.children=s}return{$$typeof:Sq,type:e.type,key:o,ref:i,props:n,_owner:a}};an.createContext=function(e){return e={$$typeof:CJt,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:xJt,_context:e},e.Consumer=e};an.createElement=Pke;an.createFactory=function(e){var t=Pke.bind(null,e);return t.type=e,t};an.createRef=function(){return{current:null}};an.forwardRef=function(e){return{$$typeof:OJt,render:e}};an.isValidElement=ble;an.lazy=function(e){return{$$typeof:TJt,_payload:{_status:-1,_result:e},_init:RJt}};an.memo=function(e,t){return{$$typeof:PJt,type:e,compare:t===void 0?null:t}};an.startTransition=function(e){var t=u5.transition;u5.transition={};try{e()}finally{u5.transition=t}};an.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};an.useCallback=function(e,t){return Pd.current.useCallback(e,t)};an.useContext=function(e){return Pd.current.useContext(e)};an.useDebugValue=function(){};an.useDeferredValue=function(e){return Pd.current.useDeferredValue(e)};an.useEffect=function(e,t){return Pd.current.useEffect(e,t)};an.useId=function(){return Pd.current.useId()};an.useImperativeHandle=function(e,t,r){return Pd.current.useImperativeHandle(e,t,r)};an.useInsertionEffect=function(e,t){return Pd.current.useInsertionEffect(e,t)};an.useLayoutEffect=function(e,t){return Pd.current.useLayoutEffect(e,t)};an.useMemo=function(e,t){return Pd.current.useMemo(e,t)};an.useReducer=function(e,t,r){return Pd.current.useReducer(e,t,r)};an.useRef=function(e){return Pd.current.useRef(e)};an.useState=function(e){return Pd.current.useState(e)};an.useSyncExternalStore=function(e,t,r){return Pd.current.useSyncExternalStore(e,t,r)};an.useTransition=function(){return Pd.current.useTransition()};an.version="18.2.0"});var Y=b((ZOn,Mke)=>{"use strict";Mke.exports=Tke()});var Ole=b(c5=>{"use strict";c5.byteLength=BJt;c5.toByteArray=qJt;c5.fromByteArray=HJt;var dy=[],sh=[],kJt=typeof Uint8Array<"u"?Uint8Array:Array,Cle="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(iI=0,Lke=Cle.length;iI<Lke;++iI)dy[iI]=Cle[iI],sh[Cle.charCodeAt(iI)]=iI;var iI,Lke;sh[45]=62;sh[95]=63;function Fke(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function BJt(e){var t=Fke(e),r=t[0],n=t[1];return(r+n)*3/4-n}function $Jt(e,t,r){return(t+r)*3/4-r}function qJt(e){var t,r=Fke(e),n=r[0],o=r[1],i=new kJt($Jt(e,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)t=sh[e.charCodeAt(u)]<<18|sh[e.charCodeAt(u+1)]<<12|sh[e.charCodeAt(u+2)]<<6|sh[e.charCodeAt(u+3)],i[a++]=t>>16&255,i[a++]=t>>8&255,i[a++]=t&255;return o===2&&(t=sh[e.charCodeAt(u)]<<2|sh[e.charCodeAt(u+1)]>>4,i[a++]=t&255),o===1&&(t=sh[e.charCodeAt(u)]<<10|sh[e.charCodeAt(u+1)]<<4|sh[e.charCodeAt(u+2)]>>2,i[a++]=t>>8&255,i[a++]=t&255),i}function UJt(e){return dy[e>>18&63]+dy[e>>12&63]+dy[e>>6&63]+dy[e&63]}function zJt(e,t,r){for(var n,o=[],i=t;i<r;i+=3)n=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),o.push(UJt(n));return o.join("")}function HJt(e){for(var t,r=e.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(zJt(e,a,a+i>s?s:a+i));return n===1?(t=e[r-1],o.push(dy[t>>2]+dy[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],o.push(dy[t>>10]+dy[t>>4&63]+dy[t<<2&63]+"=")),o.join("")}});var kke=b(Ele=>{Ele.read=function(e,t,r,n,o){var i,a,s=o*8-n-1,u=(1<<s)-1,l=u>>1,c=-7,d=r?o-1:0,f=r?-1:1,p=e[t+d];for(d+=f,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=i*256+e[t+d],d+=f,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=a*256+e[t+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)};Ele.write=function(e,t,r,n,o,i){var a,s,u,l=i*8-o-1,c=(1<<l)-1,d=c>>1,f=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,h=n?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+d>=1?t+=f/u:t+=f*Math.pow(2,1-d),t*u>=2&&(a++,u/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*u-1)*Math.pow(2,o),a=a+d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[r+p]=s&255,p+=h,s/=256,o-=8);for(a=a<<o|s,l+=o;l>0;e[r+p]=a&255,p+=h,a/=256,l-=8);e[r+p-h]|=m*128}});var Td=b(sj=>{"use strict";var Ple=Ole(),ij=kke(),Bke=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;sj.Buffer=le;sj.SlowBuffer=YJt;sj.INSPECT_MAX_BYTES=50;var d5=2147483647;sj.kMaxLength=d5;le.TYPED_ARRAY_SUPPORT=VJt();!le.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 VJt(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(le.prototype,"parent",{enumerable:!0,get:function(){if(le.isBuffer(this))return this.buffer}});Object.defineProperty(le.prototype,"offset",{enumerable:!0,get:function(){if(le.isBuffer(this))return this.byteOffset}});function LS(e){if(e>d5)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,le.prototype),t}function le(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ale(e)}return zke(e,t,r)}le.poolSize=8192;function zke(e,t,r){if(typeof e=="string")return JJt(e,t);if(ArrayBuffer.isView(e))return GJt(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(fy(e,ArrayBuffer)||e&&fy(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(fy(e,SharedArrayBuffer)||e&&fy(e.buffer,SharedArrayBuffer)))return Mle(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return le.from(n,t,r);let o=KJt(e);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return le.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}le.from=function(e,t,r){return zke(e,t,r)};Object.setPrototypeOf(le.prototype,Uint8Array.prototype);Object.setPrototypeOf(le,Uint8Array);function Hke(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function WJt(e,t,r){return Hke(e),e<=0?LS(e):t!==void 0?typeof r=="string"?LS(e).fill(t,r):LS(e).fill(t):LS(e)}le.alloc=function(e,t,r){return WJt(e,t,r)};function Ale(e){return Hke(e),LS(e<0?0:Rle(e)|0)}le.allocUnsafe=function(e){return Ale(e)};le.allocUnsafeSlow=function(e){return Ale(e)};function JJt(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!le.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=Vke(e,t)|0,n=LS(r),o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}function Tle(e){let t=e.length<0?0:Rle(e.length)|0,r=LS(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function GJt(e){if(fy(e,Uint8Array)){let t=new Uint8Array(e);return Mle(t.buffer,t.byteOffset,t.byteLength)}return Tle(e)}function Mle(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&r===void 0?n=new Uint8Array(e):r===void 0?n=new Uint8Array(e,t):n=new Uint8Array(e,t,r),Object.setPrototypeOf(n,le.prototype),n}function KJt(e){if(le.isBuffer(e)){let t=Rle(e.length)|0,r=LS(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||jle(e.length)?LS(0):Tle(e);if(e.type==="Buffer"&&Array.isArray(e.data))return Tle(e.data)}function Rle(e){if(e>=d5)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d5.toString(16)+" bytes");return e|0}function YJt(e){return+e!=e&&(e=0),le.alloc(+e)}le.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==le.prototype};le.compare=function(t,r){if(fy(t,Uint8Array)&&(t=le.from(t,t.offset,t.byteLength)),fy(r,Uint8Array)&&(r=le.from(r,r.offset,r.byteLength)),!le.isBuffer(t)||!le.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,o=r.length;for(let i=0,a=Math.min(n,o);i<a;++i)if(t[i]!==r[i]){n=t[i],o=r[i];break}return n<o?-1:o<n?1:0};le.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};le.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return le.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;let o=le.allocUnsafe(r),i=0;for(n=0;n<t.length;++n){let a=t[n];if(fy(a,Uint8Array))i+a.length>o.length?(le.isBuffer(a)||(a=le.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(le.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function Vke(e,t){if(le.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||fy(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Ile(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return eBe(e).length;default:if(o)return n?-1:Ile(e).length;t=(""+t).toLowerCase(),o=!0}}le.byteLength=Vke;function ZJt(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return sGt(this,t,r);case"utf8":case"utf-8":return Jke(this,t,r);case"ascii":return iGt(this,t,r);case"latin1":case"binary":return aGt(this,t,r);case"base64":return nGt(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return uGt(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}le.prototype._isBuffer=!0;function aI(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}le.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)aI(this,r,r+1);return this};le.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)aI(this,r,r+3),aI(this,r+1,r+2);return this};le.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)aI(this,r,r+7),aI(this,r+1,r+6),aI(this,r+2,r+5),aI(this,r+3,r+4);return this};le.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?Jke(this,0,t):ZJt.apply(this,arguments)};le.prototype.toLocaleString=le.prototype.toString;le.prototype.equals=function(t){if(!le.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:le.compare(this,t)===0};le.prototype.inspect=function(){let t="",r=sj.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};Bke&&(le.prototype[Bke]=le.prototype.inspect);le.prototype.compare=function(t,r,n,o,i){if(fy(t,Uint8Array)&&(t=le.from(t,t.offset,t.byteLength)),!le.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),r<0||n>t.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===t)return 0;let a=i-o,s=n-r,u=Math.min(a,s),l=this.slice(o,i),c=t.slice(r,n);for(let d=0;d<u;++d)if(l[d]!==c[d]){a=l[d],s=c[d];break}return a<s?-1:s<a?1:0};function Wke(e,t,r,n,o){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,jle(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof t=="string"&&(t=le.from(t,n)),le.isBuffer(t))return t.length===0?-1:$ke(e,t,r,n,o);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):$ke(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function $ke(e,t,r,n,o){let i=1,a=e.length,s=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;i=2,a/=2,s/=2,r/=2}function u(c,d){return i===1?c[d]:c.readUInt16BE(d*i)}let l;if(o){let c=-1;for(l=r;l<a;l++)if(u(e,l)===u(t,c===-1?0:l-c)){if(c===-1&&(c=l),l-c+1===s)return c*i}else c!==-1&&(l-=l-c),c=-1}else for(r+s>a&&(r=a-s),l=r;l>=0;l--){let c=!0;for(let d=0;d<s;d++)if(u(e,l+d)!==u(t,d)){c=!1;break}if(c)return l}return-1}le.prototype.includes=function(t,r,n){return this.indexOf(t,r,n)!==-1};le.prototype.indexOf=function(t,r,n){return Wke(this,t,r,n,!0)};le.prototype.lastIndexOf=function(t,r,n){return Wke(this,t,r,n,!1)};function XJt(e,t,r,n){r=Number(r)||0;let o=e.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;let i=t.length;n>i/2&&(n=i/2);let a;for(a=0;a<n;++a){let s=parseInt(t.substr(a*2,2),16);if(jle(s))return a;e[r+a]=s}return a}function QJt(e,t,r,n){return f5(Ile(t,e.length-r),e,r,n)}function eGt(e,t,r,n){return f5(fGt(t),e,r,n)}function tGt(e,t,r,n){return f5(eBe(t),e,r,n)}function rGt(e,t,r,n){return f5(pGt(t,e.length-r),e,r,n)}le.prototype.write=function(t,r,n,o){if(r===void 0)o="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")o=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let i=this.length-r;if((n===void 0||n>i)&&(n=i),t.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 XJt(this,t,r,n);case"utf8":case"utf-8":return QJt(this,t,r,n);case"ascii":case"latin1":case"binary":return eGt(this,t,r,n);case"base64":return tGt(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rGt(this,t,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};le.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function nGt(e,t,r){return t===0&&r===e.length?Ple.fromByteArray(e):Ple.fromByteArray(e.slice(t,r))}function Jke(e,t,r){r=Math.min(e.length,r);let n=[],o=t;for(;o<r;){let i=e[o],a=null,s=i>239?4:i>223?3:i>191?2:1;if(o+s<=r){let u,l,c,d;switch(s){case 1:i<128&&(a=i);break;case 2:u=e[o+1],(u&192)===128&&(d=(i&31)<<6|u&63,d>127&&(a=d));break;case 3:u=e[o+1],l=e[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=e[o+1],l=e[o+2],c=e[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 oGt(n)}var qke=4096;function oGt(e){let t=e.length;if(t<=qke)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=qke));return r}function iGt(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(e[o]&127);return n}function aGt(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function sGt(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let o="";for(let i=t;i<r;++i)o+=hGt[e[i]];return o}function uGt(e,t,r){let n=e.slice(t,r),o="";for(let i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+n[i+1]*256);return o}le.prototype.slice=function(t,r){let n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t);let o=this.subarray(t,r);return Object.setPrototypeOf(o,le.prototype),o};function cl(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}le.prototype.readUintLE=le.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||cl(t,r,this.length);let o=this[t],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[t+a]*i;return o};le.prototype.readUintBE=le.prototype.readUIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||cl(t,r,this.length);let o=this[t+--r],i=1;for(;r>0&&(i*=256);)o+=this[t+--r]*i;return o};le.prototype.readUint8=le.prototype.readUInt8=function(t,r){return t=t>>>0,r||cl(t,1,this.length),this[t]};le.prototype.readUint16LE=le.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||cl(t,2,this.length),this[t]|this[t+1]<<8};le.prototype.readUint16BE=le.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||cl(t,2,this.length),this[t]<<8|this[t+1]};le.prototype.readUint32LE=le.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||cl(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};le.prototype.readUint32BE=le.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||cl(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};le.prototype.readBigUInt64LE=RO(function(t){t=t>>>0,aj(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Cq(t,this.length-8);let o=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,i=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(o)+(BigInt(i)<<BigInt(32))});le.prototype.readBigUInt64BE=RO(function(t){t=t>>>0,aj(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Cq(t,this.length-8);let o=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],i=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(o)<<BigInt(32))+BigInt(i)});le.prototype.readIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||cl(t,r,this.length);let o=this[t],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[t+a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*r)),o};le.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||cl(t,r,this.length);let o=r,i=1,a=this[t+--o];for(;o>0&&(i*=256);)a+=this[t+--o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*r)),a};le.prototype.readInt8=function(t,r){return t=t>>>0,r||cl(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};le.prototype.readInt16LE=function(t,r){t=t>>>0,r||cl(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};le.prototype.readInt16BE=function(t,r){t=t>>>0,r||cl(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};le.prototype.readInt32LE=function(t,r){return t=t>>>0,r||cl(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};le.prototype.readInt32BE=function(t,r){return t=t>>>0,r||cl(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};le.prototype.readBigInt64LE=RO(function(t){t=t>>>0,aj(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Cq(t,this.length-8);let o=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(o)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});le.prototype.readBigInt64BE=RO(function(t){t=t>>>0,aj(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Cq(t,this.length-8);let o=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(o)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)});le.prototype.readFloatLE=function(t,r){return t=t>>>0,r||cl(t,4,this.length),ij.read(this,t,!0,23,4)};le.prototype.readFloatBE=function(t,r){return t=t>>>0,r||cl(t,4,this.length),ij.read(this,t,!1,23,4)};le.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||cl(t,8,this.length),ij.read(this,t,!0,52,8)};le.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||cl(t,8,this.length),ij.read(this,t,!1,52,8)};function df(e,t,r,n,o,i){if(!le.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}le.prototype.writeUintLE=le.prototype.writeUIntLE=function(t,r,n,o){if(t=+t,r=r>>>0,n=n>>>0,!o){let s=Math.pow(2,8*n)-1;df(this,t,r,n,s,0)}let i=1,a=0;for(this[r]=t&255;++a<n&&(i*=256);)this[r+a]=t/i&255;return r+n};le.prototype.writeUintBE=le.prototype.writeUIntBE=function(t,r,n,o){if(t=+t,r=r>>>0,n=n>>>0,!o){let s=Math.pow(2,8*n)-1;df(this,t,r,n,s,0)}let i=n-1,a=1;for(this[r+i]=t&255;--i>=0&&(a*=256);)this[r+i]=t/a&255;return r+n};le.prototype.writeUint8=le.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||df(this,t,r,1,255,0),this[r]=t&255,r+1};le.prototype.writeUint16LE=le.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||df(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};le.prototype.writeUint16BE=le.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||df(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};le.prototype.writeUint32LE=le.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||df(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};le.prototype.writeUint32BE=le.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||df(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function Gke(e,t,r,n,o){Qke(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i=i>>8,e[r++]=i,i=i>>8,e[r++]=i,i=i>>8,e[r++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a,r}function Kke(e,t,r,n,o){Qke(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i=i>>8,e[r+6]=i,i=i>>8,e[r+5]=i,i=i>>8,e[r+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a=a>>8,e[r+2]=a,a=a>>8,e[r+1]=a,a=a>>8,e[r]=a,r+8}le.prototype.writeBigUInt64LE=RO(function(t,r=0){return Gke(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});le.prototype.writeBigUInt64BE=RO(function(t,r=0){return Kke(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});le.prototype.writeIntLE=function(t,r,n,o){if(t=+t,r=r>>>0,!o){let u=Math.pow(2,8*n-1);df(this,t,r,n,u-1,-u)}let i=0,a=1,s=0;for(this[r]=t&255;++i<n&&(a*=256);)t<0&&s===0&&this[r+i-1]!==0&&(s=1),this[r+i]=(t/a>>0)-s&255;return r+n};le.prototype.writeIntBE=function(t,r,n,o){if(t=+t,r=r>>>0,!o){let u=Math.pow(2,8*n-1);df(this,t,r,n,u-1,-u)}let i=n-1,a=1,s=0;for(this[r+i]=t&255;--i>=0&&(a*=256);)t<0&&s===0&&this[r+i+1]!==0&&(s=1),this[r+i]=(t/a>>0)-s&255;return r+n};le.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||df(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};le.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||df(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};le.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||df(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};le.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||df(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};le.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||df(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};le.prototype.writeBigInt64LE=RO(function(t,r=0){return Gke(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});le.prototype.writeBigInt64BE=RO(function(t,r=0){return Kke(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Yke(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Zke(e,t,r,n,o){return t=+t,r=r>>>0,o||Yke(e,t,r,4,34028234663852886e22,-34028234663852886e22),ij.write(e,t,r,n,23,4),r+4}le.prototype.writeFloatLE=function(t,r,n){return Zke(this,t,r,!0,n)};le.prototype.writeFloatBE=function(t,r,n){return Zke(this,t,r,!1,n)};function Xke(e,t,r,n,o){return t=+t,r=r>>>0,o||Yke(e,t,r,8,17976931348623157e292,-17976931348623157e292),ij.write(e,t,r,n,52,8),r+8}le.prototype.writeDoubleLE=function(t,r,n){return Xke(this,t,r,!0,n)};le.prototype.writeDoubleBE=function(t,r,n){return Xke(this,t,r,!1,n)};le.prototype.copy=function(t,r,n,o){if(!le.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),r>=t.length&&(r=t.length),r||(r=0),o>0&&o<n&&(o=n),o===n||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-r<o-n&&(o=t.length-r+n);let i=o-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,o):Uint8Array.prototype.set.call(t,this.subarray(n,o),r),i};le.prototype.fill=function(t,r,n,o){if(typeof t=="string"){if(typeof r=="string"?(o=r,r=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!le.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(t.length===1){let a=t.charCodeAt(0);(o==="utf8"&&a<128||o==="latin1")&&(t=a)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let i;if(typeof t=="number")for(i=r;i<n;++i)this[i]=t;else{let a=le.isBuffer(t)?t:le.from(t,o),s=a.length;if(s===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-r;++i)this[i+r]=a[i%s]}return this};var oj={};function Dle(e,t,r){oj[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}Dle("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Dle("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);Dle("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=Uke(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=Uke(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n},RangeError);function Uke(e){let t="",r=e.length,n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function lGt(e,t,r){aj(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&Cq(t,e.length-(r+1))}function Qke(e,t,r,n,o,i){if(e>r||e<t){let a=typeof t=="bigint"?"n":"",s;throw i>3?t===0||t===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=`>= ${t}${a} and <= ${r}${a}`,new oj.ERR_OUT_OF_RANGE("value",s,e)}lGt(n,o,i)}function aj(e,t){if(typeof e!="number")throw new oj.ERR_INVALID_ARG_TYPE(t,"number",e)}function Cq(e,t,r){throw Math.floor(e)!==e?(aj(e,r),new oj.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new oj.ERR_BUFFER_OUT_OF_BOUNDS:new oj.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var cGt=/[^+/0-9A-Za-z-_]/g;function dGt(e){if(e=e.split("=")[0],e=e.trim().replace(cGt,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function Ile(e,t){t=t||1/0;let r,n=e.length,o=null,i=[];for(let a=0;a<n;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}else if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=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 fGt(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function pGt(e,t){let r,n,o,i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function eBe(e){return Ple.toByteArray(dGt(e))}function f5(e,t,r,n){let o;for(o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function fy(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function jle(e){return e!==e}var hGt=function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let o=0;o<16;++o)t[n+o]=e[r]+e[o]}return t}();function RO(e){return typeof BigInt>"u"?mGt:e}function mGt(){throw new Error("BigInt not supported")}});var tBe=b((Nle,uj)=>{(function(e,t){typeof Nle=="object"&&typeof uj<"u"?uj.exports=t():typeof define=="function"&&define.amd?define(t):e.moment=t()})(Nle,function(){"use strict";var e;function t(){return e.apply(null,arguments)}function r(y){e=y}function n(y){return y instanceof Array||Object.prototype.toString.call(y)==="[object Array]"}function o(y){return y!=null&&Object.prototype.toString.call(y)==="[object Object]"}function i(y,w){return Object.prototype.hasOwnProperty.call(y,w)}function a(y){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(y).length===0;var w;for(w in y)if(i(y,w))return!1;return!0}function s(y){return y===void 0}function u(y){return typeof y=="number"||Object.prototype.toString.call(y)==="[object Number]"}function l(y){return y instanceof Date||Object.prototype.toString.call(y)==="[object Date]"}function c(y,w){var P=[],I,R=y.length;for(I=0;I<R;++I)P.push(w(y[I],I));return P}function d(y,w){for(var P in w)i(w,P)&&(y[P]=w[P]);return i(w,"toString")&&(y.toString=w.toString),i(w,"valueOf")&&(y.valueOf=w.valueOf),y}function f(y,w,P,I){return M1e(y,w,P,I,!0).utc()}function p(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function h(y){return y._pf==null&&(y._pf=p()),y._pf}var m;Array.prototype.some?m=Array.prototype.some:m=function(y){var w=Object(this),P=w.length>>>0,I;for(I=0;I<P;I++)if(I in w&&y.call(this,w[I],I,w))return!0;return!1};function _(y){if(y._isValid==null){var w=h(y),P=m.call(w.parsedDateParts,function(R){return R!=null}),I=!isNaN(y._d.getTime())&&w.overflow<0&&!w.empty&&!w.invalidEra&&!w.invalidMonth&&!w.invalidWeekday&&!w.weekdayMismatch&&!w.nullInput&&!w.invalidFormat&&!w.userInvalidated&&(!w.meridiem||w.meridiem&&P);if(y._strict&&(I=I&&w.charsLeftOver===0&&w.unusedTokens.length===0&&w.bigHour===void 0),Object.isFrozen==null||!Object.isFrozen(y))y._isValid=I;else return I}return y._isValid}function g(y){var w=f(NaN);return y!=null?d(h(w),y):h(w).userInvalidated=!0,w}var v=t.momentProperties=[],S=!1;function x(y,w){var P,I,R,H=v.length;if(s(w._isAMomentObject)||(y._isAMomentObject=w._isAMomentObject),s(w._i)||(y._i=w._i),s(w._f)||(y._f=w._f),s(w._l)||(y._l=w._l),s(w._strict)||(y._strict=w._strict),s(w._tzm)||(y._tzm=w._tzm),s(w._isUTC)||(y._isUTC=w._isUTC),s(w._offset)||(y._offset=w._offset),s(w._pf)||(y._pf=h(w)),s(w._locale)||(y._locale=w._locale),H>0)for(P=0;P<H;P++)I=v[P],R=w[I],s(R)||(y[I]=R);return y}function O(y){x(this,y),this._d=new Date(y._d!=null?y._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),S===!1&&(S=!0,t.updateOffset(this),S=!1)}function T(y){return y instanceof O||y!=null&&y._isAMomentObject!=null}function E(y){t.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+y)}function M(y,w){var P=!0;return d(function(){if(t.deprecationHandler!=null&&t.deprecationHandler(null,y),P){var I=[],R,H,se,It=arguments.length;for(H=0;H<It;H++){if(R="",typeof arguments[H]=="object"){R+=`
[`+H+"] ";for(se in arguments[0])i(arguments[0],se)&&(R+=se+": "+arguments[0][se]+", ");R=R.slice(0,-2)}else R=arguments[H];I.push(R)}E(y+`
Arguments: `+Array.prototype.slice.call(I).join("")+`
`+new Error().stack),P=!1}return w.apply(this,arguments)},w)}var A={};function j(y,w){t.deprecationHandler!=null&&t.deprecationHandler(y,w),A[y]||(E(w),A[y]=!0)}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;function N(y){return typeof Function<"u"&&y instanceof Function||Object.prototype.toString.call(y)==="[object Function]"}function F(y){var w,P;for(P in y)i(y,P)&&(w=y[P],N(w)?this[P]=w:this["_"+P]=w);this._config=y,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function k(y,w){var P=d({},y),I;for(I in w)i(w,I)&&(o(y[I])&&o(w[I])?(P[I]={},d(P[I],y[I]),d(P[I],w[I])):w[I]!=null?P[I]=w[I]:delete P[I]);for(I in y)i(y,I)&&!i(w,I)&&o(y[I])&&(P[I]=d({},P[I]));return P}function L(y){y!=null&&this.set(y)}var q;Object.keys?q=Object.keys:q=function(y){var w,P=[];for(w in y)i(y,w)&&P.push(w);return P};var U={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function G(y,w,P){var I=this._calendar[y]||this._calendar.sameElse;return N(I)?I.call(w,P):I}function V(y,w,P){var I=""+Math.abs(y),R=w-I.length,H=y>=0;return(H?P?"+":"":"-")+Math.pow(10,Math.max(0,R)).toString().substr(1)+I}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,z=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,W={},J={};function te(y,w,P,I){var R=I;typeof I=="string"&&(R=function(){return this[I]()}),y&&(J[y]=R),w&&(J[w[0]]=function(){return V(R.apply(this,arguments),w[1],w[2])}),P&&(J[P]=function(){return this.localeData().ordinal(R.apply(this,arguments),y)})}function Ie(y){return y.match(/\[[\s\S]/)?y.replace(/^\[|\]$/g,""):y.replace(/\\/g,"")}function Z(y){var w=y.match(D),P,I;for(P=0,I=w.length;P<I;P++)J[w[P]]?w[P]=J[w[P]]:w[P]=Ie(w[P]);return function(R){var H="",se;for(se=0;se<I;se++)H+=N(w[se])?w[se].call(R,y):w[se];return H}}function X(y,w){return y.isValid()?(w=ne(w,y.localeData()),W[w]=W[w]||Z(w),W[w](y)):y.localeData().invalidDate()}function ne(y,w){var P=5;function I(R){return w.longDateFormat(R)||R}for(z.lastIndex=0;P>=0&&z.test(y);)y=y.replace(z,I),z.lastIndex=0,P-=1;return y}var Pe={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 ht(y){var w=this._longDateFormat[y],P=this._longDateFormat[y.toUpperCase()];return w||!P?w:(this._longDateFormat[y]=P.match(D).map(function(I){return I==="MMMM"||I==="MM"||I==="DD"||I==="dddd"?I.slice(1):I}).join(""),this._longDateFormat[y])}var we="Invalid date";function ae(){return this._invalidDate}var ee="%d",ge=/\d{1,2}/;function Ue(y){return this._ordinal.replace("%d",y)}var ct={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(y,w,P,I){var R=this._relativeTime[P];return N(R)?R(y,w,P,I):R.replace(/%d/i,y)}function cr(y,w){var P=this._relativeTime[y>0?"future":"past"];return N(P)?P(w):P.replace(/%s/i,w)}var Qr={};function dr(y,w){var P=y.toLowerCase();Qr[P]=Qr[P+"s"]=Qr[w]=y}function Ut(y){return typeof y=="string"?Qr[y]||Qr[y.toLowerCase()]:void 0}function $o(y){var w={},P,I;for(I in y)i(y,I)&&(P=Ut(I),P&&(w[P]=y[I]));return w}var Xi={};function No(y,w){Xi[y]=w}function Ae(y){var w=[],P;for(P in y)i(y,P)&&w.push({unit:P,priority:Xi[P]});return w.sort(function(I,R){return I.priority-R.priority}),w}function Ze(y){return y%4===0&&y%100!==0||y%400===0}function fr(y){return y<0?Math.ceil(y)||0:Math.floor(y)}function Xe(y){var w=+y,P=0;return w!==0&&isFinite(w)&&(P=fr(w)),P}function Bn(y,w){return function(P){return P!=null?(al(this,y,P),t.updateOffset(this,w),this):Qi(this,y)}}function Qi(y,w){return y.isValid()?y._d["get"+(y._isUTC?"UTC":"")+w]():NaN}function al(y,w,P){y.isValid()&&!isNaN(P)&&(w==="FullYear"&&Ze(y.year())&&y.month()===1&&y.date()===29?(P=Xe(P),y._d["set"+(y._isUTC?"UTC":"")+w](P,y.month(),m6(P,y.month()))):y._d["set"+(y._isUTC?"UTC":"")+w](P))}function Pc(y){return y=Ut(y),N(this[y])?this[y]():this}function Tm(y,w){if(typeof y=="object"){y=$o(y);var P=Ae(y),I,R=P.length;for(I=0;I<R;I++)this[P[I].unit](y[P[I].unit])}else if(y=Ut(y),N(this[y]))return this[y](w);return this}var Mm=/\d/,Oa=/\d\d/,Wp=/\d{3}/,Zf=/\d{4}/,Jp=/[+-]?\d{6}/,mn=/\d\d?/,aO=/\d\d\d\d?/,yM=/\d\d\d\d\d\d?/,sO=/\d{1,3}/,Ea=/\d{1,4}/,ns=/[+-]?\d{1,6}/,ea=/\d+/,pd=/[+-]?\d+/,Tc=/Z|[+-]\d\d:?\d\d/gi,Ba=/Z|[+-]\d\d(?::?\d\d)?/gi,Kd=/[+-]?\d+(\.\d{1,3})?/,hd=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,nn;nn={};function je(y,w,P){nn[y]=N(w)?w:function(I,R){return I&&P?P:w}}function md(y,w){return i(nn,y)?nn[y](w._strict,w._locale):new RegExp(Xf(y))}function Xf(y){return Lu(y.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(w,P,I,R,H){return P||I||R||H}))}function Lu(y){return y.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var aS={};function en(y,w){var P,I=w,R;for(typeof y=="string"&&(y=[y]),u(w)&&(I=function(H,se){se[w]=Xe(H)}),R=y.length,P=0;P<R;P++)aS[y[P]]=I}function Im(y,w){en(y,function(P,I,R,H){R._w=R._w||{},w(P,R._w,R,H)})}function S$(y,w,P){w!=null&&i(aS,y)&&aS[y](w,P._a,P,y)}var Mc=0,sS=1,ty=2,Fu=3,Am=4,uS=5,bM=6,qzt=7,Uzt=8;function zzt(y,w){return(y%w+w)%w}var $a;Array.prototype.indexOf?$a=Array.prototype.indexOf:$a=function(y){var w;for(w=0;w<this.length;++w)if(this[w]===y)return w;return-1};function m6(y,w){if(isNaN(y)||isNaN(w))return NaN;var P=zzt(w,12);return y+=(w-P)/12,P===1?Ze(y)?29:28:31-P%7%2}te("M",["MM",2],"Mo",function(){return this.month()+1}),te("MMM",0,0,function(y){return this.localeData().monthsShort(this,y)}),te("MMMM",0,0,function(y){return this.localeData().months(this,y)}),dr("month","M"),No("month",8),je("M",mn),je("MM",mn,Oa),je("MMM",function(y,w){return w.monthsShortRegex(y)}),je("MMMM",function(y,w){return w.monthsRegex(y)}),en(["M","MM"],function(y,w){w[sS]=Xe(y)-1}),en(["MMM","MMMM"],function(y,w,P,I){var R=P._locale.monthsParse(y,I,P._strict);R!=null?w[sS]=R:h(P).invalidMonth=y});var Hzt="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),h1e="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),m1e=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Vzt=hd,Wzt=hd;function Jzt(y,w){return y?n(this._months)?this._months[y.month()]:this._months[(this._months.isFormat||m1e).test(w)?"format":"standalone"][y.month()]:n(this._months)?this._months:this._months.standalone}function Gzt(y,w){return y?n(this._monthsShort)?this._monthsShort[y.month()]:this._monthsShort[m1e.test(w)?"format":"standalone"][y.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Kzt(y,w,P){var I,R,H,se=y.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],I=0;I<12;++I)H=f([2e3,I]),this._shortMonthsParse[I]=this.monthsShort(H,"").toLocaleLowerCase(),this._longMonthsParse[I]=this.months(H,"").toLocaleLowerCase();return P?w==="MMM"?(R=$a.call(this._shortMonthsParse,se),R!==-1?R:null):(R=$a.call(this._longMonthsParse,se),R!==-1?R:null):w==="MMM"?(R=$a.call(this._shortMonthsParse,se),R!==-1?R:(R=$a.call(this._longMonthsParse,se),R!==-1?R:null)):(R=$a.call(this._longMonthsParse,se),R!==-1?R:(R=$a.call(this._shortMonthsParse,se),R!==-1?R:null))}function Yzt(y,w,P){var I,R,H;if(this._monthsParseExact)return Kzt.call(this,y,w,P);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),I=0;I<12;I++){if(R=f([2e3,I]),P&&!this._longMonthsParse[I]&&(this._longMonthsParse[I]=new RegExp("^"+this.months(R,"").replace(".","")+"$","i"),this._shortMonthsParse[I]=new RegExp("^"+this.monthsShort(R,"").replace(".","")+"$","i")),!P&&!this._monthsParse[I]&&(H="^"+this.months(R,"")+"|^"+this.monthsShort(R,""),this._monthsParse[I]=new RegExp(H.replace(".",""),"i")),P&&w==="MMMM"&&this._longMonthsParse[I].test(y))return I;if(P&&w==="MMM"&&this._shortMonthsParse[I].test(y))return I;if(!P&&this._monthsParse[I].test(y))return I}}function g1e(y,w){var P;if(!y.isValid())return y;if(typeof w=="string"){if(/^\d+$/.test(w))w=Xe(w);else if(w=y.localeData().monthsParse(w),!u(w))return y}return P=Math.min(y.date(),m6(y.year(),w)),y._d["set"+(y._isUTC?"UTC":"")+"Month"](w,P),y}function y1e(y){return y!=null?(g1e(this,y),t.updateOffset(this,!0),this):Qi(this,"Month")}function Zzt(){return m6(this.year(),this.month())}function Xzt(y){return this._monthsParseExact?(i(this,"_monthsRegex")||b1e.call(this),y?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=Vzt),this._monthsShortStrictRegex&&y?this._monthsShortStrictRegex:this._monthsShortRegex)}function Qzt(y){return this._monthsParseExact?(i(this,"_monthsRegex")||b1e.call(this),y?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=Wzt),this._monthsStrictRegex&&y?this._monthsStrictRegex:this._monthsRegex)}function b1e(){function y(se,It){return It.length-se.length}var w=[],P=[],I=[],R,H;for(R=0;R<12;R++)H=f([2e3,R]),w.push(this.monthsShort(H,"")),P.push(this.months(H,"")),I.push(this.months(H,"")),I.push(this.monthsShort(H,""));for(w.sort(y),P.sort(y),I.sort(y),R=0;R<12;R++)w[R]=Lu(w[R]),P[R]=Lu(P[R]);for(R=0;R<24;R++)I[R]=Lu(I[R]);this._monthsRegex=new RegExp("^("+I.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+P.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+w.join("|")+")","i")}te("Y",0,0,function(){var y=this.year();return y<=9999?V(y,4):"+"+y}),te(0,["YY",2],0,function(){return this.year()%100}),te(0,["YYYY",4],0,"year"),te(0,["YYYYY",5],0,"year"),te(0,["YYYYYY",6,!0],0,"year"),dr("year","y"),No("year",1),je("Y",pd),je("YY",mn,Oa),je("YYYY",Ea,Zf),je("YYYYY",ns,Jp),je("YYYYYY",ns,Jp),en(["YYYYY","YYYYYY"],Mc),en("YYYY",function(y,w){w[Mc]=y.length===2?t.parseTwoDigitYear(y):Xe(y)}),en("YY",function(y,w){w[Mc]=t.parseTwoDigitYear(y)}),en("Y",function(y,w){w[Mc]=parseInt(y,10)});function x$(y){return Ze(y)?366:365}t.parseTwoDigitYear=function(y){return Xe(y)+(Xe(y)>68?1900:2e3)};var _1e=Bn("FullYear",!0);function e2t(){return Ze(this.year())}function t2t(y,w,P,I,R,H,se){var It;return y<100&&y>=0?(It=new Date(y+400,w,P,I,R,H,se),isFinite(It.getFullYear())&&It.setFullYear(y)):It=new Date(y,w,P,I,R,H,se),It}function C$(y){var w,P;return y<100&&y>=0?(P=Array.prototype.slice.call(arguments),P[0]=y+400,w=new Date(Date.UTC.apply(null,P)),isFinite(w.getUTCFullYear())&&w.setUTCFullYear(y)):w=new Date(Date.UTC.apply(null,arguments)),w}function g6(y,w,P){var I=7+w-P,R=(7+C$(y,0,I).getUTCDay()-w)%7;return-R+I-1}function v1e(y,w,P,I,R){var H=(7+P-I)%7,se=g6(y,I,R),It=1+7*(w-1)+H+se,Dr,qo;return It<=0?(Dr=y-1,qo=x$(Dr)+It):It>x$(y)?(Dr=y+1,qo=It-x$(y)):(Dr=y,qo=It),{year:Dr,dayOfYear:qo}}function O$(y,w,P){var I=g6(y.year(),w,P),R=Math.floor((y.dayOfYear()-I-1)/7)+1,H,se;return R<1?(se=y.year()-1,H=R+lS(se,w,P)):R>lS(y.year(),w,P)?(H=R-lS(y.year(),w,P),se=y.year()+1):(se=y.year(),H=R),{week:H,year:se}}function lS(y,w,P){var I=g6(y,w,P),R=g6(y+1,w,P);return(x$(y)-I+R)/7}te("w",["ww",2],"wo","week"),te("W",["WW",2],"Wo","isoWeek"),dr("week","w"),dr("isoWeek","W"),No("week",5),No("isoWeek",5),je("w",mn),je("ww",mn,Oa),je("W",mn),je("WW",mn,Oa),Im(["w","ww","W","WW"],function(y,w,P,I){w[I.substr(0,1)]=Xe(y)});function r2t(y){return O$(y,this._week.dow,this._week.doy).week}var n2t={dow:0,doy:6};function o2t(){return this._week.dow}function i2t(){return this._week.doy}function a2t(y){var w=this.localeData().week(this);return y==null?w:this.add((y-w)*7,"d")}function s2t(y){var w=O$(this,1,4).week;return y==null?w:this.add((y-w)*7,"d")}te("d",0,"do","day"),te("dd",0,0,function(y){return this.localeData().weekdaysMin(this,y)}),te("ddd",0,0,function(y){return this.localeData().weekdaysShort(this,y)}),te("dddd",0,0,function(y){return this.localeData().weekdays(this,y)}),te("e",0,0,"weekday"),te("E",0,0,"isoWeekday"),dr("day","d"),dr("weekday","e"),dr("isoWeekday","E"),No("day",11),No("weekday",11),No("isoWeekday",11),je("d",mn),je("e",mn),je("E",mn),je("dd",function(y,w){return w.weekdaysMinRegex(y)}),je("ddd",function(y,w){return w.weekdaysShortRegex(y)}),je("dddd",function(y,w){return w.weekdaysRegex(y)}),Im(["dd","ddd","dddd"],function(y,w,P,I){var R=P._locale.weekdaysParse(y,I,P._strict);R!=null?w.d=R:h(P).invalidWeekday=y}),Im(["d","e","E"],function(y,w,P,I){w[I]=Xe(y)});function u2t(y,w){return typeof y!="string"?y:isNaN(y)?(y=w.weekdaysParse(y),typeof y=="number"?y:null):parseInt(y,10)}function l2t(y,w){return typeof y=="string"?w.weekdaysParse(y)%7||7:isNaN(y)?null:y}function bae(y,w){return y.slice(w,7).concat(y.slice(0,w))}var c2t="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),w1e="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),d2t="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),f2t=hd,p2t=hd,h2t=hd;function m2t(y,w){var P=n(this._weekdays)?this._weekdays:this._weekdays[y&&y!==!0&&this._weekdays.isFormat.test(w)?"format":"standalone"];return y===!0?bae(P,this._week.dow):y?P[y.day()]:P}function g2t(y){return y===!0?bae(this._weekdaysShort,this._week.dow):y?this._weekdaysShort[y.day()]:this._weekdaysShort}function y2t(y){return y===!0?bae(this._weekdaysMin,this._week.dow):y?this._weekdaysMin[y.day()]:this._weekdaysMin}function b2t(y,w,P){var I,R,H,se=y.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],I=0;I<7;++I)H=f([2e3,1]).day(I),this._minWeekdaysParse[I]=this.weekdaysMin(H,"").toLocaleLowerCase(),this._shortWeekdaysParse[I]=this.weekdaysShort(H,"").toLocaleLowerCase(),this._weekdaysParse[I]=this.weekdays(H,"").toLocaleLowerCase();return P?w==="dddd"?(R=$a.call(this._weekdaysParse,se),R!==-1?R:null):w==="ddd"?(R=$a.call(this._shortWeekdaysParse,se),R!==-1?R:null):(R=$a.call(this._minWeekdaysParse,se),R!==-1?R:null):w==="dddd"?(R=$a.call(this._weekdaysParse,se),R!==-1||(R=$a.call(this._shortWeekdaysParse,se),R!==-1)?R:(R=$a.call(this._minWeekdaysParse,se),R!==-1?R:null)):w==="ddd"?(R=$a.call(this._shortWeekdaysParse,se),R!==-1||(R=$a.call(this._weekdaysParse,se),R!==-1)?R:(R=$a.call(this._minWeekdaysParse,se),R!==-1?R:null)):(R=$a.call(this._minWeekdaysParse,se),R!==-1||(R=$a.call(this._weekdaysParse,se),R!==-1)?R:(R=$a.call(this._shortWeekdaysParse,se),R!==-1?R:null))}function _2t(y,w,P){var I,R,H;if(this._weekdaysParseExact)return b2t.call(this,y,w,P);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),I=0;I<7;I++){if(R=f([2e3,1]).day(I),P&&!this._fullWeekdaysParse[I]&&(this._fullWeekdaysParse[I]=new RegExp("^"+this.weekdays(R,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[I]=new RegExp("^"+this.weekdaysShort(R,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[I]=new RegExp("^"+this.weekdaysMin(R,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[I]||(H="^"+this.weekdays(R,"")+"|^"+this.weekdaysShort(R,"")+"|^"+this.weekdaysMin(R,""),this._weekdaysParse[I]=new RegExp(H.replace(".",""),"i")),P&&w==="dddd"&&this._fullWeekdaysParse[I].test(y))return I;if(P&&w==="ddd"&&this._shortWeekdaysParse[I].test(y))return I;if(P&&w==="dd"&&this._minWeekdaysParse[I].test(y))return I;if(!P&&this._weekdaysParse[I].test(y))return I}}function v2t(y){if(!this.isValid())return y!=null?this:NaN;var w=this._isUTC?this._d.getUTCDay():this._d.getDay();return y!=null?(y=u2t(y,this.localeData()),this.add(y-w,"d")):w}function w2t(y){if(!this.isValid())return y!=null?this:NaN;var w=(this.day()+7-this.localeData()._week.dow)%7;return y==null?w:this.add(y-w,"d")}function S2t(y){if(!this.isValid())return y!=null?this:NaN;if(y!=null){var w=l2t(y,this.localeData());return this.day(this.day()%7?w:w-7)}else return this.day()||7}function x2t(y){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||_ae.call(this),y?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=f2t),this._weekdaysStrictRegex&&y?this._weekdaysStrictRegex:this._weekdaysRegex)}function C2t(y){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||_ae.call(this),y?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=p2t),this._weekdaysShortStrictRegex&&y?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function O2t(y){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||_ae.call(this),y?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=h2t),this._weekdaysMinStrictRegex&&y?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function _ae(){function y(gd,hS){return hS.length-gd.length}var w=[],P=[],I=[],R=[],H,se,It,Dr,qo;for(H=0;H<7;H++)se=f([2e3,1]).day(H),It=Lu(this.weekdaysMin(se,"")),Dr=Lu(this.weekdaysShort(se,"")),qo=Lu(this.weekdays(se,"")),w.push(It),P.push(Dr),I.push(qo),R.push(It),R.push(Dr),R.push(qo);w.sort(y),P.sort(y),I.sort(y),R.sort(y),this._weekdaysRegex=new RegExp("^("+R.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+P.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+w.join("|")+")","i")}function vae(){return this.hours()%12||12}function E2t(){return this.hours()||24}te("H",["HH",2],0,"hour"),te("h",["hh",2],0,vae),te("k",["kk",2],0,E2t),te("hmm",0,0,function(){return""+vae.apply(this)+V(this.minutes(),2)}),te("hmmss",0,0,function(){return""+vae.apply(this)+V(this.minutes(),2)+V(this.seconds(),2)}),te("Hmm",0,0,function(){return""+this.hours()+V(this.minutes(),2)}),te("Hmmss",0,0,function(){return""+this.hours()+V(this.minutes(),2)+V(this.seconds(),2)});function S1e(y,w){te(y,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),w)})}S1e("a",!0),S1e("A",!1),dr("hour","h"),No("hour",13);function x1e(y,w){return w._meridiemParse}je("a",x1e),je("A",x1e),je("H",mn),je("h",mn),je("k",mn),je("HH",mn,Oa),je("hh",mn,Oa),je("kk",mn,Oa),je("hmm",aO),je("hmmss",yM),je("Hmm",aO),je("Hmmss",yM),en(["H","HH"],Fu),en(["k","kk"],function(y,w,P){var I=Xe(y);w[Fu]=I===24?0:I}),en(["a","A"],function(y,w,P){P._isPm=P._locale.isPM(y),P._meridiem=y}),en(["h","hh"],function(y,w,P){w[Fu]=Xe(y),h(P).bigHour=!0}),en("hmm",function(y,w,P){var I=y.length-2;w[Fu]=Xe(y.substr(0,I)),w[Am]=Xe(y.substr(I)),h(P).bigHour=!0}),en("hmmss",function(y,w,P){var I=y.length-4,R=y.length-2;w[Fu]=Xe(y.substr(0,I)),w[Am]=Xe(y.substr(I,2)),w[uS]=Xe(y.substr(R)),h(P).bigHour=!0}),en("Hmm",function(y,w,P){var I=y.length-2;w[Fu]=Xe(y.substr(0,I)),w[Am]=Xe(y.substr(I))}),en("Hmmss",function(y,w,P){var I=y.length-4,R=y.length-2;w[Fu]=Xe(y.substr(0,I)),w[Am]=Xe(y.substr(I,2)),w[uS]=Xe(y.substr(R))});function P2t(y){return(y+"").toLowerCase().charAt(0)==="p"}var T2t=/[ap]\.?m?\.?/i,M2t=Bn("Hours",!0);function I2t(y,w,P){return y>11?P?"pm":"PM":P?"am":"AM"}var C1e={calendar:U,longDateFormat:Pe,invalidDate:we,ordinal:ee,dayOfMonthOrdinalParse:ge,relativeTime:ct,months:Hzt,monthsShort:h1e,week:n2t,weekdays:c2t,weekdaysMin:d2t,weekdaysShort:w1e,meridiemParse:T2t},Ni={},E$={},P$;function A2t(y,w){var P,I=Math.min(y.length,w.length);for(P=0;P<I;P+=1)if(y[P]!==w[P])return P;return I}function O1e(y){return y&&y.toLowerCase().replace("_","-")}function R2t(y){for(var w=0,P,I,R,H;w<y.length;){for(H=O1e(y[w]).split("-"),P=H.length,I=O1e(y[w+1]),I=I?I.split("-"):null;P>0;){if(R=y6(H.slice(0,P).join("-")),R)return R;if(I&&I.length>=P&&A2t(H,I)>=P-1)break;P--}w++}return P$}function D2t(y){return y.match("^[^/\\\\]*$")!=null}function y6(y){var w=null,P;if(Ni[y]===void 0&&typeof uj<"u"&&uj&&uj.exports&&D2t(y))try{w=P$._abbr,P=require,P("./locale/"+y),uO(w)}catch{Ni[y]=null}return Ni[y]}function uO(y,w){var P;return y&&(s(w)?P=cS(y):P=wae(y,w),P?P$=P:typeof console<"u"&&console.warn&&console.warn("Locale "+y+" not found. Did you forget to load it?")),P$._abbr}function wae(y,w){if(w!==null){var P,I=C1e;if(w.abbr=y,Ni[y]!=null)j("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),I=Ni[y]._config;else if(w.parentLocale!=null)if(Ni[w.parentLocale]!=null)I=Ni[w.parentLocale]._config;else if(P=y6(w.parentLocale),P!=null)I=P._config;else return E$[w.parentLocale]||(E$[w.parentLocale]=[]),E$[w.parentLocale].push({name:y,config:w}),null;return Ni[y]=new L(k(I,w)),E$[y]&&E$[y].forEach(function(R){wae(R.name,R.config)}),uO(y),Ni[y]}else return delete Ni[y],null}function j2t(y,w){if(w!=null){var P,I,R=C1e;Ni[y]!=null&&Ni[y].parentLocale!=null?Ni[y].set(k(Ni[y]._config,w)):(I=y6(y),I!=null&&(R=I._config),w=k(R,w),I==null&&(w.abbr=y),P=new L(w),P.parentLocale=Ni[y],Ni[y]=P),uO(y)}else Ni[y]!=null&&(Ni[y].parentLocale!=null?(Ni[y]=Ni[y].parentLocale,y===uO()&&uO(y)):Ni[y]!=null&&delete Ni[y]);return Ni[y]}function cS(y){var w;if(y&&y._locale&&y._locale._abbr&&(y=y._locale._abbr),!y)return P$;if(!n(y)){if(w=y6(y),w)return w;y=[y]}return R2t(y)}function N2t(){return q(Ni)}function Sae(y){var w,P=y._a;return P&&h(y).overflow===-2&&(w=P[sS]<0||P[sS]>11?sS:P[ty]<1||P[ty]>m6(P[Mc],P[sS])?ty:P[Fu]<0||P[Fu]>24||P[Fu]===24&&(P[Am]!==0||P[uS]!==0||P[bM]!==0)?Fu:P[Am]<0||P[Am]>59?Am:P[uS]<0||P[uS]>59?uS:P[bM]<0||P[bM]>999?bM:-1,h(y)._overflowDayOfYear&&(w<Mc||w>ty)&&(w=ty),h(y)._overflowWeeks&&w===-1&&(w=qzt),h(y)._overflowWeekday&&w===-1&&(w=Uzt),h(y).overflow=w),y}var L2t=/^\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)?)?$/,F2t=/^\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)?)?$/,k2t=/Z|[+-]\d\d(?::?\d\d)?/,b6=[["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]],xae=[["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/]],B2t=/^\/?Date\((-?\d+)/i,$2t=/^(?:(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}))$/,q2t={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 E1e(y){var w,P,I=y._i,R=L2t.exec(I)||F2t.exec(I),H,se,It,Dr,qo=b6.length,gd=xae.length;if(R){for(h(y).iso=!0,w=0,P=qo;w<P;w++)if(b6[w][1].exec(R[1])){se=b6[w][0],H=b6[w][2]!==!1;break}if(se==null){y._isValid=!1;return}if(R[3]){for(w=0,P=gd;w<P;w++)if(xae[w][1].exec(R[3])){It=(R[2]||" ")+xae[w][0];break}if(It==null){y._isValid=!1;return}}if(!H&&It!=null){y._isValid=!1;return}if(R[4])if(k2t.exec(R[4]))Dr="Z";else{y._isValid=!1;return}y._f=se+(It||"")+(Dr||""),Oae(y)}else y._isValid=!1}function U2t(y,w,P,I,R,H){var se=[z2t(y),h1e.indexOf(w),parseInt(P,10),parseInt(I,10),parseInt(R,10)];return H&&se.push(parseInt(H,10)),se}function z2t(y){var w=parseInt(y,10);return w<=49?2e3+w:w<=999?1900+w:w}function H2t(y){return y.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function V2t(y,w,P){if(y){var I=w1e.indexOf(y),R=new Date(w[0],w[1],w[2]).getDay();if(I!==R)return h(P).weekdayMismatch=!0,P._isValid=!1,!1}return!0}function W2t(y,w,P){if(y)return q2t[y];if(w)return 0;var I=parseInt(P,10),R=I%100,H=(I-R)/100;return H*60+R}function P1e(y){var w=$2t.exec(H2t(y._i)),P;if(w){if(P=U2t(w[4],w[3],w[2],w[5],w[6],w[7]),!V2t(w[1],P,y))return;y._a=P,y._tzm=W2t(w[8],w[9],w[10]),y._d=C$.apply(null,y._a),y._d.setUTCMinutes(y._d.getUTCMinutes()-y._tzm),h(y).rfc2822=!0}else y._isValid=!1}function J2t(y){var w=B2t.exec(y._i);if(w!==null){y._d=new Date(+w[1]);return}if(E1e(y),y._isValid===!1)delete y._isValid;else return;if(P1e(y),y._isValid===!1)delete y._isValid;else return;y._strict?y._isValid=!1:t.createFromInputFallback(y)}t.createFromInputFallback=M("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(y){y._d=new Date(y._i+(y._useUTC?" UTC":""))});function gD(y,w,P){return y??w??P}function G2t(y){var w=new Date(t.now());return y._useUTC?[w.getUTCFullYear(),w.getUTCMonth(),w.getUTCDate()]:[w.getFullYear(),w.getMonth(),w.getDate()]}function Cae(y){var w,P,I=[],R,H,se;if(!y._d){for(R=G2t(y),y._w&&y._a[ty]==null&&y._a[sS]==null&&K2t(y),y._dayOfYear!=null&&(se=gD(y._a[Mc],R[Mc]),(y._dayOfYear>x$(se)||y._dayOfYear===0)&&(h(y)._overflowDayOfYear=!0),P=C$(se,0,y._dayOfYear),y._a[sS]=P.getUTCMonth(),y._a[ty]=P.getUTCDate()),w=0;w<3&&y._a[w]==null;++w)y._a[w]=I[w]=R[w];for(;w<7;w++)y._a[w]=I[w]=y._a[w]==null?w===2?1:0:y._a[w];y._a[Fu]===24&&y._a[Am]===0&&y._a[uS]===0&&y._a[bM]===0&&(y._nextDay=!0,y._a[Fu]=0),y._d=(y._useUTC?C$:t2t).apply(null,I),H=y._useUTC?y._d.getUTCDay():y._d.getDay(),y._tzm!=null&&y._d.setUTCMinutes(y._d.getUTCMinutes()-y._tzm),y._nextDay&&(y._a[Fu]=24),y._w&&typeof y._w.d<"u"&&y._w.d!==H&&(h(y).weekdayMismatch=!0)}}function K2t(y){var w,P,I,R,H,se,It,Dr,qo;w=y._w,w.GG!=null||w.W!=null||w.E!=null?(H=1,se=4,P=gD(w.GG,y._a[Mc],O$(gi(),1,4).year),I=gD(w.W,1),R=gD(w.E,1),(R<1||R>7)&&(Dr=!0)):(H=y._locale._week.dow,se=y._locale._week.doy,qo=O$(gi(),H,se),P=gD(w.gg,y._a[Mc],qo.year),I=gD(w.w,qo.week),w.d!=null?(R=w.d,(R<0||R>6)&&(Dr=!0)):w.e!=null?(R=w.e+H,(w.e<0||w.e>6)&&(Dr=!0)):R=H),I<1||I>lS(P,H,se)?h(y)._overflowWeeks=!0:Dr!=null?h(y)._overflowWeekday=!0:(It=v1e(P,I,R,H,se),y._a[Mc]=It.year,y._dayOfYear=It.dayOfYear)}t.ISO_8601=function(){},t.RFC_2822=function(){};function Oae(y){if(y._f===t.ISO_8601){E1e(y);return}if(y._f===t.RFC_2822){P1e(y);return}y._a=[],h(y).empty=!0;var w=""+y._i,P,I,R,H,se,It=w.length,Dr=0,qo,gd;for(R=ne(y._f,y._locale).match(D)||[],gd=R.length,P=0;P<gd;P++)H=R[P],I=(w.match(md(H,y))||[])[0],I&&(se=w.substr(0,w.indexOf(I)),se.length>0&&h(y).unusedInput.push(se),w=w.slice(w.indexOf(I)+I.length),Dr+=I.length),J[H]?(I?h(y).empty=!1:h(y).unusedTokens.push(H),S$(H,I,y)):y._strict&&!I&&h(y).unusedTokens.push(H);h(y).charsLeftOver=It-Dr,w.length>0&&h(y).unusedInput.push(w),y._a[Fu]<=12&&h(y).bigHour===!0&&y._a[Fu]>0&&(h(y).bigHour=void 0),h(y).parsedDateParts=y._a.slice(0),h(y).meridiem=y._meridiem,y._a[Fu]=Y2t(y._locale,y._a[Fu],y._meridiem),qo=h(y).era,qo!==null&&(y._a[Mc]=y._locale.erasConvertYear(qo,y._a[Mc])),Cae(y),Sae(y)}function Y2t(y,w,P){var I;return P==null?w:y.meridiemHour!=null?y.meridiemHour(w,P):(y.isPM!=null&&(I=y.isPM(P),I&&w<12&&(w+=12),!I&&w===12&&(w=0)),w)}function Z2t(y){var w,P,I,R,H,se,It=!1,Dr=y._f.length;if(Dr===0){h(y).invalidFormat=!0,y._d=new Date(NaN);return}for(R=0;R<Dr;R++)H=0,se=!1,w=x({},y),y._useUTC!=null&&(w._useUTC=y._useUTC),w._f=y._f[R],Oae(w),_(w)&&(se=!0),H+=h(w).charsLeftOver,H+=h(w).unusedTokens.length*10,h(w).score=H,It?H<I&&(I=H,P=w):(I==null||H<I||se)&&(I=H,P=w,se&&(It=!0));d(y,P||w)}function X2t(y){if(!y._d){var w=$o(y._i),P=w.day===void 0?w.date:w.day;y._a=c([w.year,w.month,P,w.hour,w.minute,w.second,w.millisecond],function(I){return I&&parseInt(I,10)}),Cae(y)}}function Q2t(y){var w=new O(Sae(T1e(y)));return w._nextDay&&(w.add(1,"d"),w._nextDay=void 0),w}function T1e(y){var w=y._i,P=y._f;return y._locale=y._locale||cS(y._l),w===null||P===void 0&&w===""?g({nullInput:!0}):(typeof w=="string"&&(y._i=w=y._locale.preparse(w)),T(w)?new O(Sae(w)):(l(w)?y._d=w:n(P)?Z2t(y):P?Oae(y):e4t(y),_(y)||(y._d=null),y))}function e4t(y){var w=y._i;s(w)?y._d=new Date(t.now()):l(w)?y._d=new Date(w.valueOf()):typeof w=="string"?J2t(y):n(w)?(y._a=c(w.slice(0),function(P){return parseInt(P,10)}),Cae(y)):o(w)?X2t(y):u(w)?y._d=new Date(w):t.createFromInputFallback(y)}function M1e(y,w,P,I,R){var H={};return(w===!0||w===!1)&&(I=w,w=void 0),(P===!0||P===!1)&&(I=P,P=void 0),(o(y)&&a(y)||n(y)&&y.length===0)&&(y=void 0),H._isAMomentObject=!0,H._useUTC=H._isUTC=R,H._l=P,H._i=y,H._f=w,H._strict=I,Q2t(H)}function gi(y,w,P,I){return M1e(y,w,P,I,!1)}var t4t=M("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var y=gi.apply(null,arguments);return this.isValid()&&y.isValid()?y<this?this:y:g()}),r4t=M("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var y=gi.apply(null,arguments);return this.isValid()&&y.isValid()?y>this?this:y:g()});function I1e(y,w){var P,I;if(w.length===1&&n(w[0])&&(w=w[0]),!w.length)return gi();for(P=w[0],I=1;I<w.length;++I)(!w[I].isValid()||w[I][y](P))&&(P=w[I]);return P}function n4t(){var y=[].slice.call(arguments,0);return I1e("isBefore",y)}function o4t(){var y=[].slice.call(arguments,0);return I1e("isAfter",y)}var i4t=function(){return Date.now?Date.now():+new Date},T$=["year","quarter","month","week","day","hour","minute","second","millisecond"];function a4t(y){var w,P=!1,I,R=T$.length;for(w in y)if(i(y,w)&&!($a.call(T$,w)!==-1&&(y[w]==null||!isNaN(y[w]))))return!1;for(I=0;I<R;++I)if(y[T$[I]]){if(P)return!1;parseFloat(y[T$[I]])!==Xe(y[T$[I]])&&(P=!0)}return!0}function s4t(){return this._isValid}function u4t(){return Rm(NaN)}function _6(y){var w=$o(y),P=w.year||0,I=w.quarter||0,R=w.month||0,H=w.week||w.isoWeek||0,se=w.day||0,It=w.hour||0,Dr=w.minute||0,qo=w.second||0,gd=w.millisecond||0;this._isValid=a4t(w),this._milliseconds=+gd+qo*1e3+Dr*6e4+It*1e3*60*60,this._days=+se+H*7,this._months=+R+I*3+P*12,this._data={},this._locale=cS(),this._bubble()}function v6(y){return y instanceof _6}function Eae(y){return y<0?Math.round(-1*y)*-1:Math.round(y)}function l4t(y,w,P){var I=Math.min(y.length,w.length),R=Math.abs(y.length-w.length),H=0,se;for(se=0;se<I;se++)(P&&y[se]!==w[se]||!P&&Xe(y[se])!==Xe(w[se]))&&H++;return H+R}function A1e(y,w){te(y,0,0,function(){var P=this.utcOffset(),I="+";return P<0&&(P=-P,I="-"),I+V(~~(P/60),2)+w+V(~~P%60,2)})}A1e("Z",":"),A1e("ZZ",""),je("Z",Ba),je("ZZ",Ba),en(["Z","ZZ"],function(y,w,P){P._useUTC=!0,P._tzm=Pae(Ba,y)});var c4t=/([\+\-]|\d\d)/gi;function Pae(y,w){var P=(w||"").match(y),I,R,H;return P===null?null:(I=P[P.length-1]||[],R=(I+"").match(c4t)||["-",0,0],H=+(R[1]*60)+Xe(R[2]),H===0?0:R[0]==="+"?H:-H)}function Tae(y,w){var P,I;return w._isUTC?(P=w.clone(),I=(T(y)||l(y)?y.valueOf():gi(y).valueOf())-P.valueOf(),P._d.setTime(P._d.valueOf()+I),t.updateOffset(P,!1),P):gi(y).local()}function Mae(y){return-Math.round(y._d.getTimezoneOffset())}t.updateOffset=function(){};function d4t(y,w,P){var I=this._offset||0,R;if(!this.isValid())return y!=null?this:NaN;if(y!=null){if(typeof y=="string"){if(y=Pae(Ba,y),y===null)return this}else Math.abs(y)<16&&!P&&(y=y*60);return!this._isUTC&&w&&(R=Mae(this)),this._offset=y,this._isUTC=!0,R!=null&&this.add(R,"m"),I!==y&&(!w||this._changeInProgress?N1e(this,Rm(y-I,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?I:Mae(this)}function f4t(y,w){return y!=null?(typeof y!="string"&&(y=-y),this.utcOffset(y,w),this):-this.utcOffset()}function p4t(y){return this.utcOffset(0,y)}function h4t(y){return this._isUTC&&(this.utcOffset(0,y),this._isUTC=!1,y&&this.subtract(Mae(this),"m")),this}function m4t(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var y=Pae(Tc,this._i);y!=null?this.utcOffset(y):this.utcOffset(0,!0)}return this}function g4t(y){return this.isValid()?(y=y?gi(y).utcOffset():0,(this.utcOffset()-y)%60===0):!1}function y4t(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function b4t(){if(!s(this._isDSTShifted))return this._isDSTShifted;var y={},w;return x(y,this),y=T1e(y),y._a?(w=y._isUTC?f(y._a):gi(y._a),this._isDSTShifted=this.isValid()&&l4t(y._a,w.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function _4t(){return this.isValid()?!this._isUTC:!1}function v4t(){return this.isValid()?this._isUTC:!1}function R1e(){return this.isValid()?this._isUTC&&this._offset===0:!1}var w4t=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,S4t=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Rm(y,w){var P=y,I=null,R,H,se;return v6(y)?P={ms:y._milliseconds,d:y._days,M:y._months}:u(y)||!isNaN(+y)?(P={},w?P[w]=+y:P.milliseconds=+y):(I=w4t.exec(y))?(R=I[1]==="-"?-1:1,P={y:0,d:Xe(I[ty])*R,h:Xe(I[Fu])*R,m:Xe(I[Am])*R,s:Xe(I[uS])*R,ms:Xe(Eae(I[bM]*1e3))*R}):(I=S4t.exec(y))?(R=I[1]==="-"?-1:1,P={y:_M(I[2],R),M:_M(I[3],R),w:_M(I[4],R),d:_M(I[5],R),h:_M(I[6],R),m:_M(I[7],R),s:_M(I[8],R)}):P==null?P={}:typeof P=="object"&&("from"in P||"to"in P)&&(se=x4t(gi(P.from),gi(P.to)),P={},P.ms=se.milliseconds,P.M=se.months),H=new _6(P),v6(y)&&i(y,"_locale")&&(H._locale=y._locale),v6(y)&&i(y,"_isValid")&&(H._isValid=y._isValid),H}Rm.fn=_6.prototype,Rm.invalid=u4t;function _M(y,w){var P=y&&parseFloat(y.replace(",","."));return(isNaN(P)?0:P)*w}function D1e(y,w){var P={};return P.months=w.month()-y.month()+(w.year()-y.year())*12,y.clone().add(P.months,"M").isAfter(w)&&--P.months,P.milliseconds=+w-+y.clone().add(P.months,"M"),P}function x4t(y,w){var P;return y.isValid()&&w.isValid()?(w=Tae(w,y),y.isBefore(w)?P=D1e(y,w):(P=D1e(w,y),P.milliseconds=-P.milliseconds,P.months=-P.months),P):{milliseconds:0,months:0}}function j1e(y,w){return function(P,I){var R,H;return I!==null&&!isNaN(+I)&&(j(w,"moment()."+w+"(period, number) is deprecated. Please use moment()."+w+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),H=P,P=I,I=H),R=Rm(P,I),N1e(this,R,y),this}}function N1e(y,w,P,I){var R=w._milliseconds,H=Eae(w._days),se=Eae(w._months);y.isValid()&&(I=I??!0,se&&g1e(y,Qi(y,"Month")+se*P),H&&al(y,"Date",Qi(y,"Date")+H*P),R&&y._d.setTime(y._d.valueOf()+R*P),I&&t.updateOffset(y,H||se))}var C4t=j1e(1,"add"),O4t=j1e(-1,"subtract");function L1e(y){return typeof y=="string"||y instanceof String}function E4t(y){return T(y)||l(y)||L1e(y)||u(y)||T4t(y)||P4t(y)||y===null||y===void 0}function P4t(y){var w=o(y)&&!a(y),P=!1,I=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],R,H,se=I.length;for(R=0;R<se;R+=1)H=I[R],P=P||i(y,H);return w&&P}function T4t(y){var w=n(y),P=!1;return w&&(P=y.filter(function(I){return!u(I)&&L1e(y)}).length===0),w&&P}function M4t(y){var w=o(y)&&!a(y),P=!1,I=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],R,H;for(R=0;R<I.length;R+=1)H=I[R],P=P||i(y,H);return w&&P}function I4t(y,w){var P=y.diff(w,"days",!0);return P<-6?"sameElse":P<-1?"lastWeek":P<0?"lastDay":P<1?"sameDay":P<2?"nextDay":P<7?"nextWeek":"sameElse"}function A4t(y,w){arguments.length===1&&(arguments[0]?E4t(arguments[0])?(y=arguments[0],w=void 0):M4t(arguments[0])&&(w=arguments[0],y=void 0):(y=void 0,w=void 0));var P=y||gi(),I=Tae(P,this).startOf("day"),R=t.calendarFormat(this,I)||"sameElse",H=w&&(N(w[R])?w[R].call(this,P):w[R]);return this.format(H||this.localeData().calendar(R,this,gi(P)))}function R4t(){return new O(this)}function D4t(y,w){var P=T(y)?y:gi(y);return this.isValid()&&P.isValid()?(w=Ut(w)||"millisecond",w==="millisecond"?this.valueOf()>P.valueOf():P.valueOf()<this.clone().startOf(w).valueOf()):!1}function j4t(y,w){var P=T(y)?y:gi(y);return this.isValid()&&P.isValid()?(w=Ut(w)||"millisecond",w==="millisecond"?this.valueOf()<P.valueOf():this.clone().endOf(w).valueOf()<P.valueOf()):!1}function N4t(y,w,P,I){var R=T(y)?y:gi(y),H=T(w)?w:gi(w);return this.isValid()&&R.isValid()&&H.isValid()?(I=I||"()",(I[0]==="("?this.isAfter(R,P):!this.isBefore(R,P))&&(I[1]===")"?this.isBefore(H,P):!this.isAfter(H,P))):!1}function L4t(y,w){var P=T(y)?y:gi(y),I;return this.isValid()&&P.isValid()?(w=Ut(w)||"millisecond",w==="millisecond"?this.valueOf()===P.valueOf():(I=P.valueOf(),this.clone().startOf(w).valueOf()<=I&&I<=this.clone().endOf(w).valueOf())):!1}function F4t(y,w){return this.isSame(y,w)||this.isAfter(y,w)}function k4t(y,w){return this.isSame(y,w)||this.isBefore(y,w)}function B4t(y,w,P){var I,R,H;if(!this.isValid())return NaN;if(I=Tae(y,this),!I.isValid())return NaN;switch(R=(I.utcOffset()-this.utcOffset())*6e4,w=Ut(w),w){case"year":H=w6(this,I)/12;break;case"month":H=w6(this,I);break;case"quarter":H=w6(this,I)/3;break;case"second":H=(this-I)/1e3;break;case"minute":H=(this-I)/6e4;break;case"hour":H=(this-I)/36e5;break;case"day":H=(this-I-R)/864e5;break;case"week":H=(this-I-R)/6048e5;break;default:H=this-I}return P?H:fr(H)}function w6(y,w){if(y.date()<w.date())return-w6(w,y);var P=(w.year()-y.year())*12+(w.month()-y.month()),I=y.clone().add(P,"months"),R,H;return w-I<0?(R=y.clone().add(P-1,"months"),H=(w-I)/(I-R)):(R=y.clone().add(P+1,"months"),H=(w-I)/(R-I)),-(P+H)||0}t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function $4t(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function q4t(y){if(!this.isValid())return null;var w=y!==!0,P=w?this.clone().utc():this;return P.year()<0||P.year()>9999?X(P,w?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):N(Date.prototype.toISOString)?w?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",X(P,"Z")):X(P,w?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function U4t(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var y="moment",w="",P,I,R,H;return this.isLocal()||(y=this.utcOffset()===0?"moment.utc":"moment.parseZone",w="Z"),P="["+y+'("]',I=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",R="-MM-DD[T]HH:mm:ss.SSS",H=w+'[")]',this.format(P+I+R+H)}function z4t(y){y||(y=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var w=X(this,y);return this.localeData().postformat(w)}function H4t(y,w){return this.isValid()&&(T(y)&&y.isValid()||gi(y).isValid())?Rm({to:this,from:y}).locale(this.locale()).humanize(!w):this.localeData().invalidDate()}function V4t(y){return this.from(gi(),y)}function W4t(y,w){return this.isValid()&&(T(y)&&y.isValid()||gi(y).isValid())?Rm({from:this,to:y}).locale(this.locale()).humanize(!w):this.localeData().invalidDate()}function J4t(y){return this.to(gi(),y)}function F1e(y){var w;return y===void 0?this._locale._abbr:(w=cS(y),w!=null&&(this._locale=w),this)}var k1e=M("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(y){return y===void 0?this.localeData():this.locale(y)});function B1e(){return this._locale}var S6=1e3,yD=60*S6,x6=60*yD,$1e=(365*400+97)*24*x6;function bD(y,w){return(y%w+w)%w}function q1e(y,w,P){return y<100&&y>=0?new Date(y+400,w,P)-$1e:new Date(y,w,P).valueOf()}function U1e(y,w,P){return y<100&&y>=0?Date.UTC(y+400,w,P)-$1e:Date.UTC(y,w,P)}function G4t(y){var w,P;if(y=Ut(y),y===void 0||y==="millisecond"||!this.isValid())return this;switch(P=this._isUTC?U1e:q1e,y){case"year":w=P(this.year(),0,1);break;case"quarter":w=P(this.year(),this.month()-this.month()%3,1);break;case"month":w=P(this.year(),this.month(),1);break;case"week":w=P(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":w=P(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":w=P(this.year(),this.month(),this.date());break;case"hour":w=this._d.valueOf(),w-=bD(w+(this._isUTC?0:this.utcOffset()*yD),x6);break;case"minute":w=this._d.valueOf(),w-=bD(w,yD);break;case"second":w=this._d.valueOf(),w-=bD(w,S6);break}return this._d.setTime(w),t.updateOffset(this,!0),this}function K4t(y){var w,P;if(y=Ut(y),y===void 0||y==="millisecond"||!this.isValid())return this;switch(P=this._isUTC?U1e:q1e,y){case"year":w=P(this.year()+1,0,1)-1;break;case"quarter":w=P(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":w=P(this.year(),this.month()+1,1)-1;break;case"week":w=P(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":w=P(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":w=P(this.year(),this.month(),this.date()+1)-1;break;case"hour":w=this._d.valueOf(),w+=x6-bD(w+(this._isUTC?0:this.utcOffset()*yD),x6)-1;break;case"minute":w=this._d.valueOf(),w+=yD-bD(w,yD)-1;break;case"second":w=this._d.valueOf(),w+=S6-bD(w,S6)-1;break}return this._d.setTime(w),t.updateOffset(this,!0),this}function Y4t(){return this._d.valueOf()-(this._offset||0)*6e4}function Z4t(){return Math.floor(this.valueOf()/1e3)}function X4t(){return new Date(this.valueOf())}function Q4t(){var y=this;return[y.year(),y.month(),y.date(),y.hour(),y.minute(),y.second(),y.millisecond()]}function e3t(){var y=this;return{years:y.year(),months:y.month(),date:y.date(),hours:y.hours(),minutes:y.minutes(),seconds:y.seconds(),milliseconds:y.milliseconds()}}function t3t(){return this.isValid()?this.toISOString():null}function r3t(){return _(this)}function n3t(){return d({},h(this))}function o3t(){return h(this).overflow}function i3t(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}te("N",0,0,"eraAbbr"),te("NN",0,0,"eraAbbr"),te("NNN",0,0,"eraAbbr"),te("NNNN",0,0,"eraName"),te("NNNNN",0,0,"eraNarrow"),te("y",["y",1],"yo","eraYear"),te("y",["yy",2],0,"eraYear"),te("y",["yyy",3],0,"eraYear"),te("y",["yyyy",4],0,"eraYear"),je("N",Iae),je("NN",Iae),je("NNN",Iae),je("NNNN",g3t),je("NNNNN",y3t),en(["N","NN","NNN","NNNN","NNNNN"],function(y,w,P,I){var R=P._locale.erasParse(y,I,P._strict);R?h(P).era=R:h(P).invalidEra=y}),je("y",ea),je("yy",ea),je("yyy",ea),je("yyyy",ea),je("yo",b3t),en(["y","yy","yyy","yyyy"],Mc),en(["yo"],function(y,w,P,I){var R;P._locale._eraYearOrdinalRegex&&(R=y.match(P._locale._eraYearOrdinalRegex)),P._locale.eraYearOrdinalParse?w[Mc]=P._locale.eraYearOrdinalParse(y,R):w[Mc]=parseInt(y,10)});function a3t(y,w){var P,I,R,H=this._eras||cS("en")._eras;for(P=0,I=H.length;P<I;++P){switch(typeof H[P].since){case"string":R=t(H[P].since).startOf("day"),H[P].since=R.valueOf();break}switch(typeof H[P].until){case"undefined":H[P].until=1/0;break;case"string":R=t(H[P].until).startOf("day").valueOf(),H[P].until=R.valueOf();break}}return H}function s3t(y,w,P){var I,R,H=this.eras(),se,It,Dr;for(y=y.toUpperCase(),I=0,R=H.length;I<R;++I)if(se=H[I].name.toUpperCase(),It=H[I].abbr.toUpperCase(),Dr=H[I].narrow.toUpperCase(),P)switch(w){case"N":case"NN":case"NNN":if(It===y)return H[I];break;case"NNNN":if(se===y)return H[I];break;case"NNNNN":if(Dr===y)return H[I];break}else if([se,It,Dr].indexOf(y)>=0)return H[I]}function u3t(y,w){var P=y.since<=y.until?1:-1;return w===void 0?t(y.since).year():t(y.since).year()+(w-y.offset)*P}function l3t(){var y,w,P,I=this.localeData().eras();for(y=0,w=I.length;y<w;++y)if(P=this.clone().startOf("day").valueOf(),I[y].since<=P&&P<=I[y].until||I[y].until<=P&&P<=I[y].since)return I[y].name;return""}function c3t(){var y,w,P,I=this.localeData().eras();for(y=0,w=I.length;y<w;++y)if(P=this.clone().startOf("day").valueOf(),I[y].since<=P&&P<=I[y].until||I[y].until<=P&&P<=I[y].since)return I[y].narrow;return""}function d3t(){var y,w,P,I=this.localeData().eras();for(y=0,w=I.length;y<w;++y)if(P=this.clone().startOf("day").valueOf(),I[y].since<=P&&P<=I[y].until||I[y].until<=P&&P<=I[y].since)return I[y].abbr;return""}function f3t(){var y,w,P,I,R=this.localeData().eras();for(y=0,w=R.length;y<w;++y)if(P=R[y].since<=R[y].until?1:-1,I=this.clone().startOf("day").valueOf(),R[y].since<=I&&I<=R[y].until||R[y].until<=I&&I<=R[y].since)return(this.year()-t(R[y].since).year())*P+R[y].offset;return this.year()}function p3t(y){return i(this,"_erasNameRegex")||Aae.call(this),y?this._erasNameRegex:this._erasRegex}function h3t(y){return i(this,"_erasAbbrRegex")||Aae.call(this),y?this._erasAbbrRegex:this._erasRegex}function m3t(y){return i(this,"_erasNarrowRegex")||Aae.call(this),y?this._erasNarrowRegex:this._erasRegex}function Iae(y,w){return w.erasAbbrRegex(y)}function g3t(y,w){return w.erasNameRegex(y)}function y3t(y,w){return w.erasNarrowRegex(y)}function b3t(y,w){return w._eraYearOrdinalRegex||ea}function Aae(){var y=[],w=[],P=[],I=[],R,H,se=this.eras();for(R=0,H=se.length;R<H;++R)w.push(Lu(se[R].name)),y.push(Lu(se[R].abbr)),P.push(Lu(se[R].narrow)),I.push(Lu(se[R].name)),I.push(Lu(se[R].abbr)),I.push(Lu(se[R].narrow));this._erasRegex=new RegExp("^("+I.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+w.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+y.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+P.join("|")+")","i")}te(0,["gg",2],0,function(){return this.weekYear()%100}),te(0,["GG",2],0,function(){return this.isoWeekYear()%100});function C6(y,w){te(0,[y,y.length],0,w)}C6("gggg","weekYear"),C6("ggggg","weekYear"),C6("GGGG","isoWeekYear"),C6("GGGGG","isoWeekYear"),dr("weekYear","gg"),dr("isoWeekYear","GG"),No("weekYear",1),No("isoWeekYear",1),je("G",pd),je("g",pd),je("GG",mn,Oa),je("gg",mn,Oa),je("GGGG",Ea,Zf),je("gggg",Ea,Zf),je("GGGGG",ns,Jp),je("ggggg",ns,Jp),Im(["gggg","ggggg","GGGG","GGGGG"],function(y,w,P,I){w[I.substr(0,2)]=Xe(y)}),Im(["gg","GG"],function(y,w,P,I){w[I]=t.parseTwoDigitYear(y)});function _3t(y){return z1e.call(this,y,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function v3t(y){return z1e.call(this,y,this.isoWeek(),this.isoWeekday(),1,4)}function w3t(){return lS(this.year(),1,4)}function S3t(){return lS(this.isoWeekYear(),1,4)}function x3t(){var y=this.localeData()._week;return lS(this.year(),y.dow,y.doy)}function C3t(){var y=this.localeData()._week;return lS(this.weekYear(),y.dow,y.doy)}function z1e(y,w,P,I,R){var H;return y==null?O$(this,I,R).year:(H=lS(y,I,R),w>H&&(w=H),O3t.call(this,y,w,P,I,R))}function O3t(y,w,P,I,R){var H=v1e(y,w,P,I,R),se=C$(H.year,0,H.dayOfYear);return this.year(se.getUTCFullYear()),this.month(se.getUTCMonth()),this.date(se.getUTCDate()),this}te("Q",0,"Qo","quarter"),dr("quarter","Q"),No("quarter",7),je("Q",Mm),en("Q",function(y,w){w[sS]=(Xe(y)-1)*3});function E3t(y){return y==null?Math.ceil((this.month()+1)/3):this.month((y-1)*3+this.month()%3)}te("D",["DD",2],"Do","date"),dr("date","D"),No("date",9),je("D",mn),je("DD",mn,Oa),je("Do",function(y,w){return y?w._dayOfMonthOrdinalParse||w._ordinalParse:w._dayOfMonthOrdinalParseLenient}),en(["D","DD"],ty),en("Do",function(y,w){w[ty]=Xe(y.match(mn)[0])});var H1e=Bn("Date",!0);te("DDD",["DDDD",3],"DDDo","dayOfYear"),dr("dayOfYear","DDD"),No("dayOfYear",4),je("DDD",sO),je("DDDD",Wp),en(["DDD","DDDD"],function(y,w,P){P._dayOfYear=Xe(y)});function P3t(y){var w=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return y==null?w:this.add(y-w,"d")}te("m",["mm",2],0,"minute"),dr("minute","m"),No("minute",14),je("m",mn),je("mm",mn,Oa),en(["m","mm"],Am);var T3t=Bn("Minutes",!1);te("s",["ss",2],0,"second"),dr("second","s"),No("second",15),je("s",mn),je("ss",mn,Oa),en(["s","ss"],uS);var M3t=Bn("Seconds",!1);te("S",0,0,function(){return~~(this.millisecond()/100)}),te(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),te(0,["SSS",3],0,"millisecond"),te(0,["SSSS",4],0,function(){return this.millisecond()*10}),te(0,["SSSSS",5],0,function(){return this.millisecond()*100}),te(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),te(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),te(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),te(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),dr("millisecond","ms"),No("millisecond",16),je("S",sO,Mm),je("SS",sO,Oa),je("SSS",sO,Wp);var lO,V1e;for(lO="SSSS";lO.length<=9;lO+="S")je(lO,ea);function I3t(y,w){w[bM]=Xe(("0."+y)*1e3)}for(lO="S";lO.length<=9;lO+="S")en(lO,I3t);V1e=Bn("Milliseconds",!1),te("z",0,0,"zoneAbbr"),te("zz",0,0,"zoneName");function A3t(){return this._isUTC?"UTC":""}function R3t(){return this._isUTC?"Coordinated Universal Time":""}var Ee=O.prototype;Ee.add=C4t,Ee.calendar=A4t,Ee.clone=R4t,Ee.diff=B4t,Ee.endOf=K4t,Ee.format=z4t,Ee.from=H4t,Ee.fromNow=V4t,Ee.to=W4t,Ee.toNow=J4t,Ee.get=Pc,Ee.invalidAt=o3t,Ee.isAfter=D4t,Ee.isBefore=j4t,Ee.isBetween=N4t,Ee.isSame=L4t,Ee.isSameOrAfter=F4t,Ee.isSameOrBefore=k4t,Ee.isValid=r3t,Ee.lang=k1e,Ee.locale=F1e,Ee.localeData=B1e,Ee.max=r4t,Ee.min=t4t,Ee.parsingFlags=n3t,Ee.set=Tm,Ee.startOf=G4t,Ee.subtract=O4t,Ee.toArray=Q4t,Ee.toObject=e3t,Ee.toDate=X4t,Ee.toISOString=q4t,Ee.inspect=U4t,typeof Symbol<"u"&&Symbol.for!=null&&(Ee[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Ee.toJSON=t3t,Ee.toString=$4t,Ee.unix=Z4t,Ee.valueOf=Y4t,Ee.creationData=i3t,Ee.eraName=l3t,Ee.eraNarrow=c3t,Ee.eraAbbr=d3t,Ee.eraYear=f3t,Ee.year=_1e,Ee.isLeapYear=e2t,Ee.weekYear=_3t,Ee.isoWeekYear=v3t,Ee.quarter=Ee.quarters=E3t,Ee.month=y1e,Ee.daysInMonth=Zzt,Ee.week=Ee.weeks=a2t,Ee.isoWeek=Ee.isoWeeks=s2t,Ee.weeksInYear=x3t,Ee.weeksInWeekYear=C3t,Ee.isoWeeksInYear=w3t,Ee.isoWeeksInISOWeekYear=S3t,Ee.date=H1e,Ee.day=Ee.days=v2t,Ee.weekday=w2t,Ee.isoWeekday=S2t,Ee.dayOfYear=P3t,Ee.hour=Ee.hours=M2t,Ee.minute=Ee.minutes=T3t,Ee.second=Ee.seconds=M3t,Ee.millisecond=Ee.milliseconds=V1e,Ee.utcOffset=d4t,Ee.utc=p4t,Ee.local=h4t,Ee.parseZone=m4t,Ee.hasAlignedHourOffset=g4t,Ee.isDST=y4t,Ee.isLocal=_4t,Ee.isUtcOffset=v4t,Ee.isUtc=R1e,Ee.isUTC=R1e,Ee.zoneAbbr=A3t,Ee.zoneName=R3t,Ee.dates=M("dates accessor is deprecated. Use date instead.",H1e),Ee.months=M("months accessor is deprecated. Use month instead",y1e),Ee.years=M("years accessor is deprecated. Use year instead",_1e),Ee.zone=M("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",f4t),Ee.isDSTShifted=M("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",b4t);function D3t(y){return gi(y*1e3)}function j3t(){return gi.apply(null,arguments).parseZone()}function W1e(y){return y}var $n=L.prototype;$n.calendar=G,$n.longDateFormat=ht,$n.invalidDate=ae,$n.ordinal=Ue,$n.preparse=W1e,$n.postformat=W1e,$n.relativeTime=Je,$n.pastFuture=cr,$n.set=F,$n.eras=a3t,$n.erasParse=s3t,$n.erasConvertYear=u3t,$n.erasAbbrRegex=h3t,$n.erasNameRegex=p3t,$n.erasNarrowRegex=m3t,$n.months=Jzt,$n.monthsShort=Gzt,$n.monthsParse=Yzt,$n.monthsRegex=Qzt,$n.monthsShortRegex=Xzt,$n.week=r2t,$n.firstDayOfYear=i2t,$n.firstDayOfWeek=o2t,$n.weekdays=m2t,$n.weekdaysMin=y2t,$n.weekdaysShort=g2t,$n.weekdaysParse=_2t,$n.weekdaysRegex=x2t,$n.weekdaysShortRegex=C2t,$n.weekdaysMinRegex=O2t,$n.isPM=P2t,$n.meridiem=I2t;function O6(y,w,P,I){var R=cS(),H=f().set(I,w);return R[P](H,y)}function J1e(y,w,P){if(u(y)&&(w=y,y=void 0),y=y||"",w!=null)return O6(y,w,P,"month");var I,R=[];for(I=0;I<12;I++)R[I]=O6(y,I,P,"month");return R}function Rae(y,w,P,I){typeof y=="boolean"?(u(w)&&(P=w,w=void 0),w=w||""):(w=y,P=w,y=!1,u(w)&&(P=w,w=void 0),w=w||"");var R=cS(),H=y?R._week.dow:0,se,It=[];if(P!=null)return O6(w,(P+H)%7,I,"day");for(se=0;se<7;se++)It[se]=O6(w,(se+H)%7,I,"day");return It}function N3t(y,w){return J1e(y,w,"months")}function L3t(y,w){return J1e(y,w,"monthsShort")}function F3t(y,w,P){return Rae(y,w,P,"weekdays")}function k3t(y,w,P){return Rae(y,w,P,"weekdaysShort")}function B3t(y,w,P){return Rae(y,w,P,"weekdaysMin")}uO("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(y){var w=y%10,P=Xe(y%100/10)===1?"th":w===1?"st":w===2?"nd":w===3?"rd":"th";return y+P}}),t.lang=M("moment.lang is deprecated. Use moment.locale instead.",uO),t.langData=M("moment.langData is deprecated. Use moment.localeData instead.",cS);var dS=Math.abs;function $3t(){var y=this._data;return this._milliseconds=dS(this._milliseconds),this._days=dS(this._days),this._months=dS(this._months),y.milliseconds=dS(y.milliseconds),y.seconds=dS(y.seconds),y.minutes=dS(y.minutes),y.hours=dS(y.hours),y.months=dS(y.months),y.years=dS(y.years),this}function G1e(y,w,P,I){var R=Rm(w,P);return y._milliseconds+=I*R._milliseconds,y._days+=I*R._days,y._months+=I*R._months,y._bubble()}function q3t(y,w){return G1e(this,y,w,1)}function U3t(y,w){return G1e(this,y,w,-1)}function K1e(y){return y<0?Math.floor(y):Math.ceil(y)}function z3t(){var y=this._milliseconds,w=this._days,P=this._months,I=this._data,R,H,se,It,Dr;return y>=0&&w>=0&&P>=0||y<=0&&w<=0&&P<=0||(y+=K1e(Dae(P)+w)*864e5,w=0,P=0),I.milliseconds=y%1e3,R=fr(y/1e3),I.seconds=R%60,H=fr(R/60),I.minutes=H%60,se=fr(H/60),I.hours=se%24,w+=fr(se/24),Dr=fr(Y1e(w)),P+=Dr,w-=K1e(Dae(Dr)),It=fr(P/12),P%=12,I.days=w,I.months=P,I.years=It,this}function Y1e(y){return y*4800/146097}function Dae(y){return y*146097/4800}function H3t(y){if(!this.isValid())return NaN;var w,P,I=this._milliseconds;if(y=Ut(y),y==="month"||y==="quarter"||y==="year")switch(w=this._days+I/864e5,P=this._months+Y1e(w),y){case"month":return P;case"quarter":return P/3;case"year":return P/12}else switch(w=this._days+Math.round(Dae(this._months)),y){case"week":return w/7+I/6048e5;case"day":return w+I/864e5;case"hour":return w*24+I/36e5;case"minute":return w*1440+I/6e4;case"second":return w*86400+I/1e3;case"millisecond":return Math.floor(w*864e5)+I;default:throw new Error("Unknown unit "+y)}}function V3t(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Xe(this._months/12)*31536e6:NaN}function fS(y){return function(){return this.as(y)}}var W3t=fS("ms"),J3t=fS("s"),G3t=fS("m"),K3t=fS("h"),Y3t=fS("d"),Z3t=fS("w"),X3t=fS("M"),Q3t=fS("Q"),e8t=fS("y");function t8t(){return Rm(this)}function r8t(y){return y=Ut(y),this.isValid()?this[y+"s"]():NaN}function vM(y){return function(){return this.isValid()?this._data[y]:NaN}}var n8t=vM("milliseconds"),o8t=vM("seconds"),i8t=vM("minutes"),a8t=vM("hours"),s8t=vM("days"),u8t=vM("months"),l8t=vM("years");function c8t(){return fr(this.days()/7)}var pS=Math.round,_D={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function d8t(y,w,P,I,R){return R.relativeTime(w||1,!!P,y,I)}function f8t(y,w,P,I){var R=Rm(y).abs(),H=pS(R.as("s")),se=pS(R.as("m")),It=pS(R.as("h")),Dr=pS(R.as("d")),qo=pS(R.as("M")),gd=pS(R.as("w")),hS=pS(R.as("y")),cO=H<=P.ss&&["s",H]||H<P.s&&["ss",H]||se<=1&&["m"]||se<P.m&&["mm",se]||It<=1&&["h"]||It<P.h&&["hh",It]||Dr<=1&&["d"]||Dr<P.d&&["dd",Dr];return P.w!=null&&(cO=cO||gd<=1&&["w"]||gd<P.w&&["ww",gd]),cO=cO||qo<=1&&["M"]||qo<P.M&&["MM",qo]||hS<=1&&["y"]||["yy",hS],cO[2]=w,cO[3]=+y>0,cO[4]=I,d8t.apply(null,cO)}function p8t(y){return y===void 0?pS:typeof y=="function"?(pS=y,!0):!1}function h8t(y,w){return _D[y]===void 0?!1:w===void 0?_D[y]:(_D[y]=w,y==="s"&&(_D.ss=w-1),!0)}function m8t(y,w){if(!this.isValid())return this.localeData().invalidDate();var P=!1,I=_D,R,H;return typeof y=="object"&&(w=y,y=!1),typeof y=="boolean"&&(P=y),typeof w=="object"&&(I=Object.assign({},_D,w),w.s!=null&&w.ss==null&&(I.ss=w.s-1)),R=this.localeData(),H=f8t(this,!P,I,R),P&&(H=R.pastFuture(+this,H)),R.postformat(H)}var jae=Math.abs;function vD(y){return(y>0)-(y<0)||+y}function E6(){if(!this.isValid())return this.localeData().invalidDate();var y=jae(this._milliseconds)/1e3,w=jae(this._days),P=jae(this._months),I,R,H,se,It=this.asSeconds(),Dr,qo,gd,hS;return It?(I=fr(y/60),R=fr(I/60),y%=60,I%=60,H=fr(P/12),P%=12,se=y?y.toFixed(3).replace(/\.?0+$/,""):"",Dr=It<0?"-":"",qo=vD(this._months)!==vD(It)?"-":"",gd=vD(this._days)!==vD(It)?"-":"",hS=vD(this._milliseconds)!==vD(It)?"-":"",Dr+"P"+(H?qo+H+"Y":"")+(P?qo+P+"M":"")+(w?gd+w+"D":"")+(R||I||y?"T":"")+(R?hS+R+"H":"")+(I?hS+I+"M":"")+(y?hS+se+"S":"")):"P0D"}var Sn=_6.prototype;Sn.isValid=s4t,Sn.abs=$3t,Sn.add=q3t,Sn.subtract=U3t,Sn.as=H3t,Sn.asMilliseconds=W3t,Sn.asSeconds=J3t,Sn.asMinutes=G3t,Sn.asHours=K3t,Sn.asDays=Y3t,Sn.asWeeks=Z3t,Sn.asMonths=X3t,Sn.asQuarters=Q3t,Sn.asYears=e8t,Sn.valueOf=V3t,Sn._bubble=z3t,Sn.clone=t8t,Sn.get=r8t,Sn.milliseconds=n8t,Sn.seconds=o8t,Sn.minutes=i8t,Sn.hours=a8t,Sn.days=s8t,Sn.weeks=c8t,Sn.months=u8t,Sn.years=l8t,Sn.humanize=m8t,Sn.toISOString=E6,Sn.toString=E6,Sn.toJSON=E6,Sn.locale=F1e,Sn.localeData=B1e,Sn.toIsoString=M("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",E6),Sn.lang=k1e,te("X",0,0,"unix"),te("x",0,0,"valueOf"),je("x",pd),je("X",Kd),en("X",function(y,w,P){P._d=new Date(parseFloat(y)*1e3)}),en("x",function(y,w,P){P._d=new Date(Xe(y))});return t.version="2.29.4",r(gi),t.fn=Ee,t.min=n4t,t.max=o4t,t.now=i4t,t.utc=f,t.unix=D3t,t.months=N3t,t.isDate=l,t.locale=uO,t.invalid=g,t.duration=Rm,t.isMoment=T,t.weekdays=F3t,t.parseZone=j3t,t.localeData=cS,t.isDuration=v6,t.monthsShort=L3t,t.weekdaysMin=B3t,t.defineLocale=wae,t.updateLocale=j2t,t.locales=N2t,t.weekdaysShort=k3t,t.normalizeUnits=Ut,t.relativeTimeRounding=p8t,t.relativeTimeThreshold=h8t,t.calendarFormat=I4t,t.prototype=Ee,t.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"},t})});var NBe=b(ai=>{"use strict";function nce(e,t){var r=e.length;e.push(t);e:for(;0<r;){var n=r-1>>>1,o=e[n];if(0<P5(o,t))e[n]=t,e[r]=o,r=n;else break e}}function Hm(e){return e.length===0?null:e[0]}function M5(e){if(e.length===0)return null;var t=e[0],r=e.pop();if(r!==t){e[0]=r;e:for(var n=0,o=e.length,i=o>>>1;n<i;){var a=2*(n+1)-1,s=e[a],u=a+1,l=e[u];if(0>P5(s,r))u<o&&0>P5(l,s)?(e[n]=l,e[u]=r,n=u):(e[n]=s,e[a]=r,n=a);else if(u<o&&0>P5(l,r))e[n]=l,e[u]=r,n=u;else break e}}return t}function P5(e,t){var r=e.sortIndex-t.sortIndex;return r!==0?r:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(EBe=performance,ai.unstable_now=function(){return EBe.now()}):(ece=Date,PBe=ece.now(),ai.unstable_now=function(){return ece.now()-PBe});var EBe,ece,PBe,gy=[],LO=[],xGt=1,lh=null,Fc=3,I5=!1,dI=!1,Iq=!1,IBe=typeof setTimeout=="function"?setTimeout:null,ABe=typeof clearTimeout=="function"?clearTimeout:null,TBe=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function oce(e){for(var t=Hm(LO);t!==null;){if(t.callback===null)M5(LO);else if(t.startTime<=e)M5(LO),t.sortIndex=t.expirationTime,nce(gy,t);else break;t=Hm(LO)}}function ice(e){if(Iq=!1,oce(e),!dI)if(Hm(gy)!==null)dI=!0,sce(ace);else{var t=Hm(LO);t!==null&&uce(ice,t.startTime-e)}}function ace(e,t){dI=!1,Iq&&(Iq=!1,ABe(Aq),Aq=-1),I5=!0;var r=Fc;try{for(oce(t),lh=Hm(gy);lh!==null&&(!(lh.expirationTime>t)||e&&!jBe());){var n=lh.callback;if(typeof n=="function"){lh.callback=null,Fc=lh.priorityLevel;var o=n(lh.expirationTime<=t);t=ai.unstable_now(),typeof o=="function"?lh.callback=o:lh===Hm(gy)&&M5(gy),oce(t)}else M5(gy);lh=Hm(gy)}if(lh!==null)var i=!0;else{var a=Hm(LO);a!==null&&uce(ice,a.startTime-t),i=!1}return i}finally{lh=null,Fc=r,I5=!1}}var A5=!1,T5=null,Aq=-1,RBe=5,DBe=-1;function jBe(){return!(ai.unstable_now()-DBe<RBe)}function tce(){if(T5!==null){var e=ai.unstable_now();DBe=e;var t=!0;try{t=T5(!0,e)}finally{t?Mq():(A5=!1,T5=null)}}else A5=!1}var Mq;typeof TBe=="function"?Mq=function(){TBe(tce)}:typeof MessageChannel<"u"?(rce=new MessageChannel,MBe=rce.port2,rce.port1.onmessage=tce,Mq=function(){MBe.postMessage(null)}):Mq=function(){IBe(tce,0)};var rce,MBe;function sce(e){T5=e,A5||(A5=!0,Mq())}function uce(e,t){Aq=IBe(function(){e(ai.unstable_now())},t)}ai.unstable_IdlePriority=5;ai.unstable_ImmediatePriority=1;ai.unstable_LowPriority=4;ai.unstable_NormalPriority=3;ai.unstable_Profiling=null;ai.unstable_UserBlockingPriority=2;ai.unstable_cancelCallback=function(e){e.callback=null};ai.unstable_continueExecution=function(){dI||I5||(dI=!0,sce(ace))};ai.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):RBe=0<e?Math.floor(1e3/e):5};ai.unstable_getCurrentPriorityLevel=function(){return Fc};ai.unstable_getFirstCallbackNode=function(){return Hm(gy)};ai.unstable_next=function(e){switch(Fc){case 1:case 2:case 3:var t=3;break;default:t=Fc}var r=Fc;Fc=t;try{return e()}finally{Fc=r}};ai.unstable_pauseExecution=function(){};ai.unstable_requestPaint=function(){};ai.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=Fc;Fc=e;try{return t()}finally{Fc=r}};ai.unstable_scheduleCallback=function(e,t,r){var n=ai.unstable_now();switch(typeof r=="object"&&r!==null?(r=r.delay,r=typeof r=="number"&&0<r?n+r:n):r=n,e){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return o=r+o,e={id:xGt++,callback:t,priorityLevel:e,startTime:r,expirationTime:o,sortIndex:-1},r>n?(e.sortIndex=r,nce(LO,e),Hm(gy)===null&&e===Hm(LO)&&(Iq?(ABe(Aq),Aq=-1):Iq=!0,uce(ice,r-n))):(e.sortIndex=o,nce(gy,e),dI||I5||(dI=!0,sce(ace))),e};ai.unstable_shouldYield=jBe;ai.unstable_wrapCallback=function(e){var t=Fc;return function(){var r=Fc;Fc=t;try{return e.apply(this,arguments)}finally{Fc=r}}}});var FBe=b((jEn,LBe)=>{"use strict";LBe.exports=NBe()});var zUe=b(cp=>{"use strict";var H$e=Y(),up=FBe();function Ce(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var V$e=new Set,Qq={};function CI(e,t){Fj(e,t),Fj(e+"Capture",t)}function Fj(e,t){for(Qq[e]=t,e=0;e<t.length;e++)V$e.add(t[e])}var HS=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ace=Object.prototype.hasOwnProperty,CGt=/^[: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]*$/,kBe={},BBe={};function OGt(e){return Ace.call(BBe,e)?!0:Ace.call(kBe,e)?!1:CGt.test(e)?BBe[e]=!0:(kBe[e]=!0,!1)}function EGt(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function PGt(e,t,r,n){if(t===null||typeof t>"u"||EGt(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Rd(e,t,r,n,o,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=o,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var Ul={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ul[e]=new Rd(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ul[t]=new Rd(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ul[e]=new Rd(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ul[e]=new Rd(e,2,!1,e,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(e){Ul[e]=new Rd(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ul[e]=new Rd(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ul[e]=new Rd(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ul[e]=new Rd(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ul[e]=new Rd(e,5,!1,e.toLowerCase(),null,!1,!1)});var xde=/[\-:]([a-z])/g;function Cde(e){return e[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(e){var t=e.replace(xde,Cde);Ul[t]=new Rd(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(xde,Cde);Ul[t]=new Rd(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(xde,Cde);Ul[t]=new Rd(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ul[e]=new Rd(e,1,!1,e.toLowerCase(),null,!1,!1)});Ul.xlinkHref=new Rd("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ul[e]=new Rd(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ode(e,t,r,n){var o=Ul.hasOwnProperty(t)?Ul[t]:null;(o!==null?o.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(PGt(t,r,o,n)&&(r=null),n||o===null?OGt(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):o.mustUseProperty?e[o.propertyName]=r===null?o.type===3?!1:"":r:(t=o.attributeName,n=o.attributeNamespace,r===null?e.removeAttribute(t):(o=o.type,r=o===3||o===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var GS=H$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,R5=Symbol.for("react.element"),_j=Symbol.for("react.portal"),vj=Symbol.for("react.fragment"),Ede=Symbol.for("react.strict_mode"),Rce=Symbol.for("react.profiler"),W$e=Symbol.for("react.provider"),J$e=Symbol.for("react.context"),Pde=Symbol.for("react.forward_ref"),Dce=Symbol.for("react.suspense"),jce=Symbol.for("react.suspense_list"),Tde=Symbol.for("react.memo"),kO=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var G$e=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var $Be=Symbol.iterator;function Rq(e){return e===null||typeof e!="object"?null:(e=$Be&&e[$Be]||e["@@iterator"],typeof e=="function"?e:null)}var na=Object.assign,lce;function $q(e){if(lce===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);lce=t&&t[1]||""}return`
`+lce+e}var cce=!1;function dce(e,t){if(!e||cce)return"";cce=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(l){var n=l}Reflect.construct(e,[],t)}else{try{t.call()}catch(l){n=l}e.call(t.prototype)}else{try{throw Error()}catch(l){n=l}e()}}catch(l){if(l&&n&&typeof l.stack=="string"){for(var o=l.stack.split(`
`),i=n.stack.split(`
`),a=o.length-1,s=i.length-1;1<=a&&0<=s&&o[a]!==i[s];)s--;for(;1<=a&&0<=s;a--,s--)if(o[a]!==i[s]){if(a!==1||s!==1)do if(a--,s--,0>s||o[a]!==i[s]){var u=`
`+o[a].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=a&&0<=s);break}}}finally{cce=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?$q(e):""}function TGt(e){switch(e.tag){case 5:return $q(e.type);case 16:return $q("Lazy");case 13:return $q("Suspense");case 19:return $q("SuspenseList");case 0:case 2:case 15:return e=dce(e.type,!1),e;case 11:return e=dce(e.type.render,!1),e;case 1:return e=dce(e.type,!0),e;default:return""}}function Nce(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case vj:return"Fragment";case _j:return"Portal";case Rce:return"Profiler";case Ede:return"StrictMode";case Dce:return"Suspense";case jce:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case J$e:return(e.displayName||"Context")+".Consumer";case W$e:return(e._context.displayName||"Context")+".Provider";case Pde:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Tde:return t=e.displayName||null,t!==null?t:Nce(e.type)||"Memo";case kO:t=e._payload,e=e._init;try{return Nce(e(t))}catch{}}return null}function MGt(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Nce(t);case 8:return t===Ede?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function XO(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function K$e(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function IGt(e){var t=K$e(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(a){n=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function D5(e){e._valueTracker||(e._valueTracker=IGt(e))}function Y$e(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=K$e(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function s9(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Lce(e,t){var r=t.checked;return na({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function qBe(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=XO(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Z$e(e,t){t=t.checked,t!=null&&Ode(e,"checked",t,!1)}function Fce(e,t){Z$e(e,t);var r=XO(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?kce(e,t.type,r):t.hasOwnProperty("defaultValue")&&kce(e,t.type,XO(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function UBe(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function kce(e,t,r){(t!=="number"||s9(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var qq=Array.isArray;function Aj(e,t,r,n){if(e=e.options,t){t={};for(var o=0;o<r.length;o++)t["$"+r[o]]=!0;for(r=0;r<e.length;r++)o=t.hasOwnProperty("$"+e[r].value),e[r].selected!==o&&(e[r].selected=o),o&&n&&(e[r].defaultSelected=!0)}else{for(r=""+XO(r),t=null,o=0;o<e.length;o++){if(e[o].value===r){e[o].selected=!0,n&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Bce(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Ce(91));return na({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function zBe(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(Ce(92));if(qq(r)){if(1<r.length)throw Error(Ce(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:XO(r)}}function X$e(e,t){var r=XO(t.value),n=XO(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function HBe(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Q$e(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function $ce(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Q$e(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var j5,eqe=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,o){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(j5=j5||document.createElement("div"),j5.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=j5.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function eU(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Hq={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},AGt=["Webkit","ms","Moz","O"];Object.keys(Hq).forEach(function(e){AGt.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Hq[t]=Hq[e]})});function tqe(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Hq.hasOwnProperty(e)&&Hq[e]?(""+t).trim():t+"px"}function rqe(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=tqe(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,o):e[r]=o}}var RGt=na({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 qce(e,t){if(t){if(RGt[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ce(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ce(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ce(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ce(62))}}function Uce(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 zce=null;function Mde(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Hce=null,Rj=null,Dj=null;function VBe(e){if(e=bU(e)){if(typeof Hce!="function")throw Error(Ce(280));var t=e.stateNode;t&&(t=N9(t),Hce(e.stateNode,e.type,t))}}function nqe(e){Rj?Dj?Dj.push(e):Dj=[e]:Rj=e}function oqe(){if(Rj){var e=Rj,t=Dj;if(Dj=Rj=null,VBe(e),t)for(e=0;e<t.length;e++)VBe(t[e])}}function iqe(e,t){return e(t)}function aqe(){}var fce=!1;function sqe(e,t,r){if(fce)return e(t,r);fce=!0;try{return iqe(e,t,r)}finally{fce=!1,(Rj!==null||Dj!==null)&&(aqe(),oqe())}}function tU(e,t){var r=e.stateNode;if(r===null)return null;var n=N9(r);if(n===null)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(Ce(231,t,typeof r));return r}var Vce=!1;if(HS)try{yj={},Object.defineProperty(yj,"passive",{get:function(){Vce=!0}}),window.addEventListener("test",yj,yj),window.removeEventListener("test",yj,yj)}catch{Vce=!1}var yj;function DGt(e,t,r,n,o,i,a,s,u){var l=Array.prototype.slice.call(arguments,3);try{t.apply(r,l)}catch(c){this.onError(c)}}var Vq=!1,u9=null,l9=!1,Wce=null,jGt={onError:function(e){Vq=!0,u9=e}};function NGt(e,t,r,n,o,i,a,s,u){Vq=!1,u9=null,DGt.apply(jGt,arguments)}function LGt(e,t,r,n,o,i,a,s,u){if(NGt.apply(this,arguments),Vq){if(Vq){var l=u9;Vq=!1,u9=null}else throw Error(Ce(198));l9||(l9=!0,Wce=l)}}function OI(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function uqe(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function WBe(e){if(OI(e)!==e)throw Error(Ce(188))}function FGt(e){var t=e.alternate;if(!t){if(t=OI(e),t===null)throw Error(Ce(188));return t!==e?null:e}for(var r=e,n=t;;){var o=r.return;if(o===null)break;var i=o.alternate;if(i===null){if(n=o.return,n!==null){r=n;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===r)return WBe(o),e;if(i===n)return WBe(o),t;i=i.sibling}throw Error(Ce(188))}if(r.return!==n.return)r=o,n=i;else{for(var a=!1,s=o.child;s;){if(s===r){a=!0,r=o,n=i;break}if(s===n){a=!0,n=o,r=i;break}s=s.sibling}if(!a){for(s=i.child;s;){if(s===r){a=!0,r=i,n=o;break}if(s===n){a=!0,n=i,r=o;break}s=s.sibling}if(!a)throw Error(Ce(189))}}if(r.alternate!==n)throw Error(Ce(190))}if(r.tag!==3)throw Error(Ce(188));return r.stateNode.current===r?e:t}function lqe(e){return e=FGt(e),e!==null?cqe(e):null}function cqe(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=cqe(e);if(t!==null)return t;e=e.sibling}return null}var dqe=up.unstable_scheduleCallback,JBe=up.unstable_cancelCallback,kGt=up.unstable_shouldYield,BGt=up.unstable_requestPaint,Va=up.unstable_now,$Gt=up.unstable_getCurrentPriorityLevel,Ide=up.unstable_ImmediatePriority,fqe=up.unstable_UserBlockingPriority,c9=up.unstable_NormalPriority,qGt=up.unstable_LowPriority,pqe=up.unstable_IdlePriority,A9=null,vy=null;function UGt(e){if(vy&&typeof vy.onCommitFiberRoot=="function")try{vy.onCommitFiberRoot(A9,e,void 0,(e.current.flags&128)===128)}catch{}}var Km=Math.clz32?Math.clz32:VGt,zGt=Math.log,HGt=Math.LN2;function VGt(e){return e>>>=0,e===0?32:31-(zGt(e)/HGt|0)|0}var N5=64,L5=4194304;function Uq(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function d9(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,o=e.suspendedLanes,i=e.pingedLanes,a=r&268435455;if(a!==0){var s=a&~o;s!==0?n=Uq(s):(i&=a,i!==0&&(n=Uq(i)))}else a=r&~o,a!==0?n=Uq(a):i!==0&&(n=Uq(i));if(n===0)return 0;if(t!==0&&t!==n&&(t&o)===0&&(o=n&-n,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if((n&4)!==0&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-Km(t),o=1<<r,n|=e[r],t&=~o;return n}function WGt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function JGt(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-Km(i),s=1<<a,u=o[a];u===-1?((s&r)===0||(s&n)!==0)&&(o[a]=WGt(s,t)):u<=t&&(e.expiredLanes|=s),i&=~s}}function Jce(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function hqe(){var e=N5;return N5<<=1,(N5&4194240)===0&&(N5=64),e}function pce(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function gU(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Km(t),e[t]=r}function GGt(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var o=31-Km(r),i=1<<o;t[o]=0,n[o]=-1,e[o]=-1,r&=~i}}function Ade(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Km(r),o=1<<n;o&t|e[n]&t&&(e[n]|=t),r&=~o}}var Lo=0;function mqe(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var gqe,Rde,yqe,bqe,_qe,Gce=!1,F5=[],HO=null,VO=null,WO=null,rU=new Map,nU=new Map,$O=[],KGt="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function GBe(e,t){switch(e){case"focusin":case"focusout":HO=null;break;case"dragenter":case"dragleave":VO=null;break;case"mouseover":case"mouseout":WO=null;break;case"pointerover":case"pointerout":rU.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":nU.delete(t.pointerId)}}function Dq(e,t,r,n,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:i,targetContainers:[o]},t!==null&&(t=bU(t),t!==null&&Rde(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function YGt(e,t,r,n,o){switch(t){case"focusin":return HO=Dq(HO,e,t,r,n,o),!0;case"dragenter":return VO=Dq(VO,e,t,r,n,o),!0;case"mouseover":return WO=Dq(WO,e,t,r,n,o),!0;case"pointerover":var i=o.pointerId;return rU.set(i,Dq(rU.get(i)||null,e,t,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,nU.set(i,Dq(nU.get(i)||null,e,t,r,n,o)),!0}return!1}function vqe(e){var t=hI(e.target);if(t!==null){var r=OI(t);if(r!==null){if(t=r.tag,t===13){if(t=uqe(r),t!==null){e.blockedOn=t,_qe(e.priority,function(){yqe(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Z5(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Kce(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);zce=n,r.target.dispatchEvent(n),zce=null}else return t=bU(r),t!==null&&Rde(t),e.blockedOn=r,!1;t.shift()}return!0}function KBe(e,t,r){Z5(e)&&r.delete(t)}function ZGt(){Gce=!1,HO!==null&&Z5(HO)&&(HO=null),VO!==null&&Z5(VO)&&(VO=null),WO!==null&&Z5(WO)&&(WO=null),rU.forEach(KBe),nU.forEach(KBe)}function jq(e,t){e.blockedOn===t&&(e.blockedOn=null,Gce||(Gce=!0,up.unstable_scheduleCallback(up.unstable_NormalPriority,ZGt)))}function oU(e){function t(o){return jq(o,e)}if(0<F5.length){jq(F5[0],e);for(var r=1;r<F5.length;r++){var n=F5[r];n.blockedOn===e&&(n.blockedOn=null)}}for(HO!==null&&jq(HO,e),VO!==null&&jq(VO,e),WO!==null&&jq(WO,e),rU.forEach(t),nU.forEach(t),r=0;r<$O.length;r++)n=$O[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<$O.length&&(r=$O[0],r.blockedOn===null);)vqe(r),r.blockedOn===null&&$O.shift()}var jj=GS.ReactCurrentBatchConfig,f9=!0;function XGt(e,t,r,n){var o=Lo,i=jj.transition;jj.transition=null;try{Lo=1,Dde(e,t,r,n)}finally{Lo=o,jj.transition=i}}function QGt(e,t,r,n){var o=Lo,i=jj.transition;jj.transition=null;try{Lo=4,Dde(e,t,r,n)}finally{Lo=o,jj.transition=i}}function Dde(e,t,r,n){if(f9){var o=Kce(e,t,r,n);if(o===null)vce(e,t,n,p9,r),GBe(e,n);else if(YGt(o,e,t,r,n))n.stopPropagation();else if(GBe(e,n),t&4&&-1<KGt.indexOf(e)){for(;o!==null;){var i=bU(o);if(i!==null&&gqe(i),i=Kce(e,t,r,n),i===null&&vce(e,t,n,p9,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else vce(e,t,n,null,r)}}var p9=null;function Kce(e,t,r,n){if(p9=null,e=Mde(n),e=hI(e),e!==null)if(t=OI(e),t===null)e=null;else if(r=t.tag,r===13){if(e=uqe(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return p9=e,null}function wqe(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch($Gt()){case Ide:return 1;case fqe:return 4;case c9:case qGt:return 16;case pqe:return 536870912;default:return 16}default:return 16}}var UO=null,jde=null,X5=null;function Sqe(){if(X5)return X5;var e,t=jde,r=t.length,n,o="value"in UO?UO.value:UO.textContent,i=o.length;for(e=0;e<r&&t[e]===o[e];e++);var a=r-e;for(n=1;n<=a&&t[r-n]===o[i-n];n++);return X5=o.slice(e,1<n?1-n:void 0)}function Q5(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function k5(){return!0}function YBe(){return!1}function lp(e){function t(r,n,o,i,a){this._reactName=r,this._targetInst=o,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var s in e)e.hasOwnProperty(s)&&(r=e[s],this[s]=r?r(i):i[s]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?k5:YBe,this.isPropagationStopped=YBe,this}return na(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=k5)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=k5)},persist:function(){},isPersistent:k5}),t}var Hj={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Nde=lp(Hj),yU=na({},Hj,{view:0,detail:0}),eKt=lp(yU),hce,mce,Nq,R9=na({},yU,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Lde,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Nq&&(Nq&&e.type==="mousemove"?(hce=e.screenX-Nq.screenX,mce=e.screenY-Nq.screenY):mce=hce=0,Nq=e),hce)},movementY:function(e){return"movementY"in e?e.movementY:mce}}),ZBe=lp(R9),tKt=na({},R9,{dataTransfer:0}),rKt=lp(tKt),nKt=na({},yU,{relatedTarget:0}),gce=lp(nKt),oKt=na({},Hj,{animationName:0,elapsedTime:0,pseudoElement:0}),iKt=lp(oKt),aKt=na({},Hj,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),sKt=lp(aKt),uKt=na({},Hj,{data:0}),XBe=lp(uKt),lKt={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cKt={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},dKt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fKt(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=dKt[e])?!!t[e]:!1}function Lde(){return fKt}var pKt=na({},yU,{key:function(e){if(e.key){var t=lKt[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Q5(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?cKt[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Lde,charCode:function(e){return e.type==="keypress"?Q5(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Q5(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),hKt=lp(pKt),mKt=na({},R9,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),QBe=lp(mKt),gKt=na({},yU,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Lde}),yKt=lp(gKt),bKt=na({},Hj,{propertyName:0,elapsedTime:0,pseudoElement:0}),_Kt=lp(bKt),vKt=na({},R9,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),wKt=lp(vKt),SKt=[9,13,27,32],Fde=HS&&"CompositionEvent"in window,Wq=null;HS&&"documentMode"in document&&(Wq=document.documentMode);var xKt=HS&&"TextEvent"in window&&!Wq,xqe=HS&&(!Fde||Wq&&8<Wq&&11>=Wq),e$e=" ",t$e=!1;function Cqe(e,t){switch(e){case"keyup":return SKt.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Oqe(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var wj=!1;function CKt(e,t){switch(e){case"compositionend":return Oqe(t);case"keypress":return t.which!==32?null:(t$e=!0,e$e);case"textInput":return e=t.data,e===e$e&&t$e?null:e;default:return null}}function OKt(e,t){if(wj)return e==="compositionend"||!Fde&&Cqe(e,t)?(e=Sqe(),X5=jde=UO=null,wj=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return xqe&&t.locale!=="ko"?null:t.data;default:return null}}var EKt={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function r$e(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!EKt[e.type]:t==="textarea"}function Eqe(e,t,r,n){nqe(n),t=h9(t,"onChange"),0<t.length&&(r=new Nde("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var Jq=null,iU=null;function PKt(e){Fqe(e,0)}function D9(e){var t=Cj(e);if(Y$e(t))return e}function TKt(e,t){if(e==="change")return t}var Pqe=!1;HS&&(HS?($5="oninput"in document,$5||(yce=document.createElement("div"),yce.setAttribute("oninput","return;"),$5=typeof yce.oninput=="function"),B5=$5):B5=!1,Pqe=B5&&(!document.documentMode||9<document.documentMode));var B5,$5,yce;function n$e(){Jq&&(Jq.detachEvent("onpropertychange",Tqe),iU=Jq=null)}function Tqe(e){if(e.propertyName==="value"&&D9(iU)){var t=[];Eqe(t,iU,e,Mde(e)),sqe(PKt,t)}}function MKt(e,t,r){e==="focusin"?(n$e(),Jq=t,iU=r,Jq.attachEvent("onpropertychange",Tqe)):e==="focusout"&&n$e()}function IKt(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return D9(iU)}function AKt(e,t){if(e==="click")return D9(t)}function RKt(e,t){if(e==="input"||e==="change")return D9(t)}function DKt(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Zm=typeof Object.is=="function"?Object.is:DKt;function aU(e,t){if(Zm(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var o=r[n];if(!Ace.call(t,o)||!Zm(e[o],t[o]))return!1}return!0}function o$e(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function i$e(e,t){var r=o$e(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=o$e(r)}}function Mqe(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mqe(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Iqe(){for(var e=window,t=s9();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=s9(e.document)}return t}function kde(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function jKt(e){var t=Iqe(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Mqe(r.ownerDocument.documentElement,r)){if(n!==null&&kde(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=r.textContent.length,i=Math.min(n.start,o);n=n.end===void 0?i:Math.min(n.end,o),!e.extend&&i>n&&(o=n,n=i,i=o),o=i$e(r,i);var a=i$e(r,n);o&&a&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var NKt=HS&&"documentMode"in document&&11>=document.documentMode,Sj=null,Yce=null,Gq=null,Zce=!1;function a$e(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Zce||Sj==null||Sj!==s9(n)||(n=Sj,"selectionStart"in n&&kde(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}),Gq&&aU(Gq,n)||(Gq=n,n=h9(Yce,"onSelect"),0<n.length&&(t=new Nde("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=Sj)))}function q5(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var xj={animationend:q5("Animation","AnimationEnd"),animationiteration:q5("Animation","AnimationIteration"),animationstart:q5("Animation","AnimationStart"),transitionend:q5("Transition","TransitionEnd")},bce={},Aqe={};HS&&(Aqe=document.createElement("div").style,"AnimationEvent"in window||(delete xj.animationend.animation,delete xj.animationiteration.animation,delete xj.animationstart.animation),"TransitionEvent"in window||delete xj.transitionend.transition);function j9(e){if(bce[e])return bce[e];if(!xj[e])return e;var t=xj[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in Aqe)return bce[e]=t[r];return e}var Rqe=j9("animationend"),Dqe=j9("animationiteration"),jqe=j9("animationstart"),Nqe=j9("transitionend"),Lqe=new Map,s$e="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function eE(e,t){Lqe.set(e,t),CI(t,[e])}for(U5=0;U5<s$e.length;U5++)z5=s$e[U5],u$e=z5.toLowerCase(),l$e=z5[0].toUpperCase()+z5.slice(1),eE(u$e,"on"+l$e);var z5,u$e,l$e,U5;eE(Rqe,"onAnimationEnd");eE(Dqe,"onAnimationIteration");eE(jqe,"onAnimationStart");eE("dblclick","onDoubleClick");eE("focusin","onFocus");eE("focusout","onBlur");eE(Nqe,"onTransitionEnd");Fj("onMouseEnter",["mouseout","mouseover"]);Fj("onMouseLeave",["mouseout","mouseover"]);Fj("onPointerEnter",["pointerout","pointerover"]);Fj("onPointerLeave",["pointerout","pointerover"]);CI("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));CI("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));CI("onBeforeInput",["compositionend","keypress","textInput","paste"]);CI("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));CI("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));CI("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zq="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),LKt=new Set("cancel close invalid load scroll toggle".split(" ").concat(zq));function c$e(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,LGt(n,t,void 0,e),e.currentTarget=null}function Fqe(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],o=n.event;n=n.listeners;e:{var i=void 0;if(t)for(var a=n.length-1;0<=a;a--){var s=n[a],u=s.instance,l=s.currentTarget;if(s=s.listener,u!==i&&o.isPropagationStopped())break e;c$e(o,s,l),i=u}else for(a=0;a<n.length;a++){if(s=n[a],u=s.instance,l=s.currentTarget,s=s.listener,u!==i&&o.isPropagationStopped())break e;c$e(o,s,l),i=u}}}if(l9)throw e=Wce,l9=!1,Wce=null,e}function _i(e,t){var r=t[rde];r===void 0&&(r=t[rde]=new Set);var n=e+"__bubble";r.has(n)||(kqe(t,e,2,!1),r.add(n))}function _ce(e,t,r){var n=0;t&&(n|=4),kqe(r,e,n,t)}var H5="_reactListening"+Math.random().toString(36).slice(2);function sU(e){if(!e[H5]){e[H5]=!0,V$e.forEach(function(r){r!=="selectionchange"&&(LKt.has(r)||_ce(r,!1,e),_ce(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[H5]||(t[H5]=!0,_ce("selectionchange",!1,t))}}function kqe(e,t,r,n){switch(wqe(t)){case 1:var o=XGt;break;case 4:o=QGt;break;default:o=Dde}r=o.bind(null,t,r,e),o=void 0,!Vce||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),n?o!==void 0?e.addEventListener(t,r,{capture:!0,passive:o}):e.addEventListener(t,r,!0):o!==void 0?e.addEventListener(t,r,{passive:o}):e.addEventListener(t,r,!1)}function vce(e,t,r,n,o){var i=n;if((t&1)===0&&(t&2)===0&&n!==null)e:for(;;){if(n===null)return;var a=n.tag;if(a===3||a===4){var s=n.stateNode.containerInfo;if(s===o||s.nodeType===8&&s.parentNode===o)break;if(a===4)for(a=n.return;a!==null;){var u=a.tag;if((u===3||u===4)&&(u=a.stateNode.containerInfo,u===o||u.nodeType===8&&u.parentNode===o))return;a=a.return}for(;s!==null;){if(a=hI(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}sqe(function(){var l=i,c=Mde(r),d=[];e:{var f=Lqe.get(e);if(f!==void 0){var p=Nde,h=e;switch(e){case"keypress":if(Q5(r)===0)break e;case"keydown":case"keyup":p=hKt;break;case"focusin":h="focus",p=gce;break;case"focusout":h="blur",p=gce;break;case"beforeblur":case"afterblur":p=gce;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=ZBe;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=rKt;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=yKt;break;case Rqe:case Dqe:case jqe:p=iKt;break;case Nqe:p=_Kt;break;case"scroll":p=eKt;break;case"wheel":p=wKt;break;case"copy":case"cut":case"paste":p=sKt;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=QBe}var m=(t&4)!==0,_=!m&&e==="scroll",g=m?f!==null?f+"Capture":null:f;m=[];for(var v=l,S;v!==null;){S=v;var x=S.stateNode;if(S.tag===5&&x!==null&&(S=x,g!==null&&(x=tU(v,g),x!=null&&m.push(uU(v,x,S)))),_)break;v=v.return}0<m.length&&(f=new p(f,h,null,r,c),d.push({event:f,listeners:m}))}}if((t&7)===0){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==zce&&(h=r.relatedTarget||r.fromElement)&&(hI(h)||h[VS]))break e;if((p||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,p?(h=r.relatedTarget||r.toElement,p=l,h=h?hI(h):null,h!==null&&(_=OI(h),h!==_||h.tag!==5&&h.tag!==6)&&(h=null)):(p=null,h=l),p!==h)){if(m=ZBe,x="onMouseLeave",g="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(m=QBe,x="onPointerLeave",g="onPointerEnter",v="pointer"),_=p==null?f:Cj(p),S=h==null?f:Cj(h),f=new m(x,v+"leave",p,r,c),f.target=_,f.relatedTarget=S,x=null,hI(c)===l&&(m=new m(g,v+"enter",h,r,c),m.target=S,m.relatedTarget=_,x=m),_=x,p&&h)t:{for(m=p,g=h,v=0,S=m;S;S=bj(S))v++;for(S=0,x=g;x;x=bj(x))S++;for(;0<v-S;)m=bj(m),v--;for(;0<S-v;)g=bj(g),S--;for(;v--;){if(m===g||g!==null&&m===g.alternate)break t;m=bj(m),g=bj(g)}m=null}else m=null;p!==null&&d$e(d,f,p,m,!1),h!==null&&_!==null&&d$e(d,_,h,m,!0)}}e:{if(f=l?Cj(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var O=TKt;else if(r$e(f))if(Pqe)O=RKt;else{O=IKt;var T=MKt}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(O=AKt);if(O&&(O=O(e,l))){Eqe(d,O,r,c);break e}T&&T(e,f,l),e==="focusout"&&(T=f._wrapperState)&&T.controlled&&f.type==="number"&&kce(f,"number",f.value)}switch(T=l?Cj(l):window,e){case"focusin":(r$e(T)||T.contentEditable==="true")&&(Sj=T,Yce=l,Gq=null);break;case"focusout":Gq=Yce=Sj=null;break;case"mousedown":Zce=!0;break;case"contextmenu":case"mouseup":case"dragend":Zce=!1,a$e(d,r,c);break;case"selectionchange":if(NKt)break;case"keydown":case"keyup":a$e(d,r,c)}var E;if(Fde)e:{switch(e){case"compositionstart":var M="onCompositionStart";break e;case"compositionend":M="onCompositionEnd";break e;case"compositionupdate":M="onCompositionUpdate";break e}M=void 0}else wj?Cqe(e,r)&&(M="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(M="onCompositionStart");M&&(xqe&&r.locale!=="ko"&&(wj||M!=="onCompositionStart"?M==="onCompositionEnd"&&wj&&(E=Sqe()):(UO=c,jde="value"in UO?UO.value:UO.textContent,wj=!0)),T=h9(l,M),0<T.length&&(M=new XBe(M,e,null,r,c),d.push({event:M,listeners:T}),E?M.data=E:(E=Oqe(r),E!==null&&(M.data=E)))),(E=xKt?CKt(e,r):OKt(e,r))&&(l=h9(l,"onBeforeInput"),0<l.length&&(c=new XBe("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=E))}Fqe(d,t)})}function uU(e,t,r){return{instance:e,listener:t,currentTarget:r}}function h9(e,t){for(var r=t+"Capture",n=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=tU(e,r),i!=null&&n.unshift(uU(e,i,o)),i=tU(e,t),i!=null&&n.push(uU(e,i,o))),e=e.return}return n}function bj(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function d$e(e,t,r,n,o){for(var i=t._reactName,a=[];r!==null&&r!==n;){var s=r,u=s.alternate,l=s.stateNode;if(u!==null&&u===n)break;s.tag===5&&l!==null&&(s=l,o?(u=tU(r,i),u!=null&&a.unshift(uU(r,u,s))):o||(u=tU(r,i),u!=null&&a.push(uU(r,u,s)))),r=r.return}a.length!==0&&e.push({event:t,listeners:a})}var FKt=/\r\n?/g,kKt=/\u0000|\uFFFD/g;function f$e(e){return(typeof e=="string"?e:""+e).replace(FKt,`
`).replace(kKt,"")}function V5(e,t,r){if(t=f$e(t),f$e(e)!==t&&r)throw Error(Ce(425))}function m9(){}var Xce=null,Qce=null;function ede(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var tde=typeof setTimeout=="function"?setTimeout:void 0,BKt=typeof clearTimeout=="function"?clearTimeout:void 0,p$e=typeof Promise=="function"?Promise:void 0,$Kt=typeof queueMicrotask=="function"?queueMicrotask:typeof p$e<"u"?function(e){return p$e.resolve(null).then(e).catch(qKt)}:tde;function qKt(e){setTimeout(function(){throw e})}function wce(e,t){var r=t,n=0;do{var o=r.nextSibling;if(e.removeChild(r),o&&o.nodeType===8)if(r=o.data,r==="/$"){if(n===0){e.removeChild(o),oU(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);oU(t)}function JO(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function h$e(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var Vj=Math.random().toString(36).slice(2),_y="__reactFiber$"+Vj,lU="__reactProps$"+Vj,VS="__reactContainer$"+Vj,rde="__reactEvents$"+Vj,UKt="__reactListeners$"+Vj,zKt="__reactHandles$"+Vj;function hI(e){var t=e[_y];if(t)return t;for(var r=e.parentNode;r;){if(t=r[VS]||r[_y]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=h$e(e);e!==null;){if(r=e[_y])return r;e=h$e(e)}return t}e=r,r=e.parentNode}return null}function bU(e){return e=e[_y]||e[VS],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Cj(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Ce(33))}function N9(e){return e[lU]||null}var nde=[],Oj=-1;function tE(e){return{current:e}}function vi(e){0>Oj||(e.current=nde[Oj],nde[Oj]=null,Oj--)}function si(e,t){Oj++,nde[Oj]=e.current,e.current=t}var QO={},qc=tE(QO),hf=tE(!1),_I=QO;function kj(e,t){var r=e.type.contextTypes;if(!r)return QO;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in r)o[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function mf(e){return e=e.childContextTypes,e!=null}function g9(){vi(hf),vi(qc)}function m$e(e,t,r){if(qc.current!==QO)throw Error(Ce(168));si(qc,t),si(hf,r)}function Bqe(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var o in n)if(!(o in t))throw Error(Ce(108,MGt(e)||"Unknown",o));return na({},r,n)}function y9(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||QO,_I=qc.current,si(qc,e),si(hf,hf.current),!0}function g$e(e,t,r){var n=e.stateNode;if(!n)throw Error(Ce(169));r?(e=Bqe(e,t,_I),n.__reactInternalMemoizedMergedChildContext=e,vi(hf),vi(qc),si(qc,e)):vi(hf),si(hf,r)}var $S=null,L9=!1,Sce=!1;function $qe(e){$S===null?$S=[e]:$S.push(e)}function HKt(e){L9=!0,$qe(e)}function rE(){if(!Sce&&$S!==null){Sce=!0;var e=0,t=Lo;try{var r=$S;for(Lo=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}$S=null,L9=!1}catch(o){throw $S!==null&&($S=$S.slice(e+1)),dqe(Ide,rE),o}finally{Lo=t,Sce=!1}}return null}var Ej=[],Pj=0,b9=null,_9=0,ch=[],dh=0,vI=null,qS=1,US="";function fI(e,t){Ej[Pj++]=_9,Ej[Pj++]=b9,b9=e,_9=t}function qqe(e,t,r){ch[dh++]=qS,ch[dh++]=US,ch[dh++]=vI,vI=e;var n=qS;e=US;var o=32-Km(n)-1;n&=~(1<<o),r+=1;var i=32-Km(t)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,qS=1<<32-Km(t)+o|r<<o|n,US=i+e}else qS=1<<i|r<<o|n,US=e}function Bde(e){e.return!==null&&(fI(e,1),qqe(e,1,0))}function $de(e){for(;e===b9;)b9=Ej[--Pj],Ej[Pj]=null,_9=Ej[--Pj],Ej[Pj]=null;for(;e===vI;)vI=ch[--dh],ch[dh]=null,US=ch[--dh],ch[dh]=null,qS=ch[--dh],ch[dh]=null}var sp=null,ap=null,Bi=!1,Gm=null;function Uqe(e,t){var r=fh(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function y$e(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,sp=e,ap=JO(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,sp=e,ap=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=vI!==null?{id:qS,overflow:US}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=fh(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,sp=e,ap=null,!0):!1;default:return!1}}function ode(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ide(e){if(Bi){var t=ap;if(t){var r=t;if(!y$e(e,t)){if(ode(e))throw Error(Ce(418));t=JO(r.nextSibling);var n=sp;t&&y$e(e,t)?Uqe(n,r):(e.flags=e.flags&-4097|2,Bi=!1,sp=e)}}else{if(ode(e))throw Error(Ce(418));e.flags=e.flags&-4097|2,Bi=!1,sp=e}}}function b$e(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;sp=e}function W5(e){if(e!==sp)return!1;if(!Bi)return b$e(e),Bi=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!ede(e.type,e.memoizedProps)),t&&(t=ap)){if(ode(e))throw zqe(),Error(Ce(418));for(;t;)Uqe(e,t),t=JO(t.nextSibling)}if(b$e(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ce(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){ap=JO(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}ap=null}}else ap=sp?JO(e.stateNode.nextSibling):null;return!0}function zqe(){for(var e=ap;e;)e=JO(e.nextSibling)}function Bj(){ap=sp=null,Bi=!1}function qde(e){Gm===null?Gm=[e]:Gm.push(e)}var VKt=GS.ReactCurrentBatchConfig;function Wm(e,t){if(e&&e.defaultProps){t=na({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}var v9=tE(null),w9=null,Tj=null,Ude=null;function zde(){Ude=Tj=w9=null}function Hde(e){var t=v9.current;vi(v9),e._currentValue=t}function ade(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Nj(e,t){w9=e,Ude=Tj=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(pf=!0),e.firstContext=null)}function hh(e){var t=e._currentValue;if(Ude!==e)if(e={context:e,memoizedValue:t,next:null},Tj===null){if(w9===null)throw Error(Ce(308));Tj=e,w9.dependencies={lanes:0,firstContext:e}}else Tj=Tj.next=e;return t}var mI=null;function Vde(e){mI===null?mI=[e]:mI.push(e)}function Hqe(e,t,r,n){var o=t.interleaved;return o===null?(r.next=r,Vde(t)):(r.next=o.next,o.next=r),t.interleaved=r,WS(e,n)}function WS(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var BO=!1;function Wde(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vqe(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function zS(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function GO(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(Fn&2)!==0){var o=n.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),n.pending=t,WS(e,r)}return o=n.interleaved,o===null?(t.next=t,Vde(n)):(t.next=o.next,o.next=t),n.interleaved=t,WS(e,r)}function e9(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Ade(e,r)}}function _$e(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var o=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var a={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?o=i=a:i=i.next=a,r=r.next}while(r!==null);i===null?o=i=t:i=i.next=t}else o=i=t;r={baseState:n.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function S9(e,t,r,n){var o=e.updateQueue;BO=!1;var i=o.firstBaseUpdate,a=o.lastBaseUpdate,s=o.shared.pending;if(s!==null){o.shared.pending=null;var u=s,l=u.next;u.next=null,a===null?i=l:a.next=l,a=u;var c=e.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==a&&(s===null?c.firstBaseUpdate=l:s.next=l,c.lastBaseUpdate=u))}if(i!==null){var d=o.baseState;a=0,c=l=u=null,s=i;do{var f=s.lane,p=s.eventTime;if((n&f)===f){c!==null&&(c=c.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var h=e,m=s;switch(f=t,p=r,m.tag){case 1:if(h=m.payload,typeof h=="function"){d=h.call(p,d,f);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=m.payload,f=typeof h=="function"?h.call(p,d,f):h,f==null)break e;d=na({},d,f);break e;case 2:BO=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=o.effects,f===null?o.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(l=c=p,u=d):c=c.next=p,a|=f;if(s=s.next,s===null){if(s=o.shared.pending,s===null)break;f=s,s=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(c===null&&(u=d),o.baseState=u,o.firstBaseUpdate=l,o.lastBaseUpdate=c,t=o.shared.interleaved,t!==null){o=t;do a|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);SI|=a,e.lanes=a,e.memoizedState=d}}function v$e(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],o=n.callback;if(o!==null){if(n.callback=null,n=r,typeof o!="function")throw Error(Ce(191,o));o.call(n)}}}var Wqe=new H$e.Component().refs;function sde(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:na({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var F9={isMounted:function(e){return(e=e._reactInternals)?OI(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=Ad(),o=YO(e),i=zS(n,o);i.payload=t,r!=null&&(i.callback=r),t=GO(e,i,o),t!==null&&(Ym(t,e,o,n),e9(t,e,o))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=Ad(),o=YO(e),i=zS(n,o);i.tag=1,i.payload=t,r!=null&&(i.callback=r),t=GO(e,i,o),t!==null&&(Ym(t,e,o,n),e9(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Ad(),n=YO(e),o=zS(r,n);o.tag=2,t!=null&&(o.callback=t),t=GO(e,o,n),t!==null&&(Ym(t,e,n,r),e9(t,e,n))}};function w$e(e,t,r,n,o,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,i,a):t.prototype&&t.prototype.isPureReactComponent?!aU(r,n)||!aU(o,i):!0}function Jqe(e,t,r){var n=!1,o=QO,i=t.contextType;return typeof i=="object"&&i!==null?i=hh(i):(o=mf(t)?_I:qc.current,n=t.contextTypes,i=(n=n!=null)?kj(e,o):QO),t=new t(r,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=F9,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function S$e(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&F9.enqueueReplaceState(t,t.state,null)}function ude(e,t,r,n){var o=e.stateNode;o.props=r,o.state=e.memoizedState,o.refs=Wqe,Wde(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=hh(i):(i=mf(t)?_I:qc.current,o.context=kj(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(sde(e,t,i,r),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&F9.enqueueReplaceState(o,o.state,null),S9(e,r,o,n),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Lq(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(Ce(309));var n=r.stateNode}if(!n)throw Error(Ce(147,e));var o=n,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var s=o.refs;s===Wqe&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(Ce(284));if(!r._owner)throw Error(Ce(290,e))}return e}function J5(e,t){throw e=Object.prototype.toString.call(t),Error(Ce(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function x$e(e){var t=e._init;return t(e._payload)}function Gqe(e){function t(g,v){if(e){var S=g.deletions;S===null?(g.deletions=[v],g.flags|=16):S.push(v)}}function r(g,v){if(!e)return null;for(;v!==null;)t(g,v),v=v.sibling;return null}function n(g,v){for(g=new Map;v!==null;)v.key!==null?g.set(v.key,v):g.set(v.index,v),v=v.sibling;return g}function o(g,v){return g=ZO(g,v),g.index=0,g.sibling=null,g}function i(g,v,S){return g.index=S,e?(S=g.alternate,S!==null?(S=S.index,S<v?(g.flags|=2,v):S):(g.flags|=2,v)):(g.flags|=1048576,v)}function a(g){return e&&g.alternate===null&&(g.flags|=2),g}function s(g,v,S,x){return v===null||v.tag!==6?(v=Mce(S,g.mode,x),v.return=g,v):(v=o(v,S),v.return=g,v)}function u(g,v,S,x){var O=S.type;return O===vj?c(g,v,S.props.children,x,S.key):v!==null&&(v.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===kO&&x$e(O)===v.type)?(x=o(v,S.props),x.ref=Lq(g,v,S),x.return=g,x):(x=a9(S.type,S.key,S.props,null,g.mode,x),x.ref=Lq(g,v,S),x.return=g,x)}function l(g,v,S,x){return v===null||v.tag!==4||v.stateNode.containerInfo!==S.containerInfo||v.stateNode.implementation!==S.implementation?(v=Ice(S,g.mode,x),v.return=g,v):(v=o(v,S.children||[]),v.return=g,v)}function c(g,v,S,x,O){return v===null||v.tag!==7?(v=bI(S,g.mode,x,O),v.return=g,v):(v=o(v,S),v.return=g,v)}function d(g,v,S){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Mce(""+v,g.mode,S),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case R5:return S=a9(v.type,v.key,v.props,null,g.mode,S),S.ref=Lq(g,null,v),S.return=g,S;case _j:return v=Ice(v,g.mode,S),v.return=g,v;case kO:var x=v._init;return d(g,x(v._payload),S)}if(qq(v)||Rq(v))return v=bI(v,g.mode,S,null),v.return=g,v;J5(g,v)}return null}function f(g,v,S,x){var O=v!==null?v.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return O!==null?null:s(g,v,""+S,x);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case R5:return S.key===O?u(g,v,S,x):null;case _j:return S.key===O?l(g,v,S,x):null;case kO:return O=S._init,f(g,v,O(S._payload),x)}if(qq(S)||Rq(S))return O!==null?null:c(g,v,S,x,null);J5(g,S)}return null}function p(g,v,S,x,O){if(typeof x=="string"&&x!==""||typeof x=="number")return g=g.get(S)||null,s(v,g,""+x,O);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case R5:return g=g.get(x.key===null?S:x.key)||null,u(v,g,x,O);case _j:return g=g.get(x.key===null?S:x.key)||null,l(v,g,x,O);case kO:var T=x._init;return p(g,v,S,T(x._payload),O)}if(qq(x)||Rq(x))return g=g.get(S)||null,c(v,g,x,O,null);J5(v,x)}return null}function h(g,v,S,x){for(var O=null,T=null,E=v,M=v=0,A=null;E!==null&&M<S.length;M++){E.index>M?(A=E,E=null):A=E.sibling;var j=f(g,E,S[M],x);if(j===null){E===null&&(E=A);break}e&&E&&j.alternate===null&&t(g,E),v=i(j,v,M),T===null?O=j:T.sibling=j,T=j,E=A}if(M===S.length)return r(g,E),Bi&&fI(g,M),O;if(E===null){for(;M<S.length;M++)E=d(g,S[M],x),E!==null&&(v=i(E,v,M),T===null?O=E:T.sibling=E,T=E);return Bi&&fI(g,M),O}for(E=n(g,E);M<S.length;M++)A=p(E,g,M,S[M],x),A!==null&&(e&&A.alternate!==null&&E.delete(A.key===null?M:A.key),v=i(A,v,M),T===null?O=A:T.sibling=A,T=A);return e&&E.forEach(function(N){return t(g,N)}),Bi&&fI(g,M),O}function m(g,v,S,x){var O=Rq(S);if(typeof O!="function")throw Error(Ce(150));if(S=O.call(S),S==null)throw Error(Ce(151));for(var T=O=null,E=v,M=v=0,A=null,j=S.next();E!==null&&!j.done;M++,j=S.next()){E.index>M?(A=E,E=null):A=E.sibling;var N=f(g,E,j.value,x);if(N===null){E===null&&(E=A);break}e&&E&&N.alternate===null&&t(g,E),v=i(N,v,M),T===null?O=N:T.sibling=N,T=N,E=A}if(j.done)return r(g,E),Bi&&fI(g,M),O;if(E===null){for(;!j.done;M++,j=S.next())j=d(g,j.value,x),j!==null&&(v=i(j,v,M),T===null?O=j:T.sibling=j,T=j);return Bi&&fI(g,M),O}for(E=n(g,E);!j.done;M++,j=S.next())j=p(E,g,M,j.value,x),j!==null&&(e&&j.alternate!==null&&E.delete(j.key===null?M:j.key),v=i(j,v,M),T===null?O=j:T.sibling=j,T=j);return e&&E.forEach(function(F){return t(g,F)}),Bi&&fI(g,M),O}function _(g,v,S,x){if(typeof S=="object"&&S!==null&&S.type===vj&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case R5:e:{for(var O=S.key,T=v;T!==null;){if(T.key===O){if(O=S.type,O===vj){if(T.tag===7){r(g,T.sibling),v=o(T,S.props.children),v.return=g,g=v;break e}}else if(T.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===kO&&x$e(O)===T.type){r(g,T.sibling),v=o(T,S.props),v.ref=Lq(g,T,S),v.return=g,g=v;break e}r(g,T);break}else t(g,T);T=T.sibling}S.type===vj?(v=bI(S.props.children,g.mode,x,S.key),v.return=g,g=v):(x=a9(S.type,S.key,S.props,null,g.mode,x),x.ref=Lq(g,v,S),x.return=g,g=x)}return a(g);case _j:e:{for(T=S.key;v!==null;){if(v.key===T)if(v.tag===4&&v.stateNode.containerInfo===S.containerInfo&&v.stateNode.implementation===S.implementation){r(g,v.sibling),v=o(v,S.children||[]),v.return=g,g=v;break e}else{r(g,v);break}else t(g,v);v=v.sibling}v=Ice(S,g.mode,x),v.return=g,g=v}return a(g);case kO:return T=S._init,_(g,v,T(S._payload),x)}if(qq(S))return h(g,v,S,x);if(Rq(S))return m(g,v,S,x);J5(g,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,v!==null&&v.tag===6?(r(g,v.sibling),v=o(v,S),v.return=g,g=v):(r(g,v),v=Mce(S,g.mode,x),v.return=g,g=v),a(g)):r(g,v)}return _}var $j=Gqe(!0),Kqe=Gqe(!1),_U={},wy=tE(_U),cU=tE(_U),dU=tE(_U);function gI(e){if(e===_U)throw Error(Ce(174));return e}function Jde(e,t){switch(si(dU,t),si(cU,e),si(wy,_U),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:$ce(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=$ce(t,e)}vi(wy),si(wy,t)}function qj(){vi(wy),vi(cU),vi(dU)}function Yqe(e){gI(dU.current);var t=gI(wy.current),r=$ce(t,e.type);t!==r&&(si(cU,e),si(wy,r))}function Gde(e){cU.current===e&&(vi(wy),vi(cU))}var ta=tE(0);function x9(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var xce=[];function Kde(){for(var e=0;e<xce.length;e++)xce[e]._workInProgressVersionPrimary=null;xce.length=0}var t9=GS.ReactCurrentDispatcher,Cce=GS.ReactCurrentBatchConfig,wI=0,ra=null,qu=null,pl=null,C9=!1,Kq=!1,fU=0,WKt=0;function kc(){throw Error(Ce(321))}function Yde(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Zm(e[r],t[r]))return!1;return!0}function Zde(e,t,r,n,o,i){if(wI=i,ra=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,t9.current=e===null||e.memoizedState===null?YKt:ZKt,e=r(n,o),Kq){i=0;do{if(Kq=!1,fU=0,25<=i)throw Error(Ce(301));i+=1,pl=qu=null,t.updateQueue=null,t9.current=XKt,e=r(n,o)}while(Kq)}if(t9.current=O9,t=qu!==null&&qu.next!==null,wI=0,pl=qu=ra=null,C9=!1,t)throw Error(Ce(300));return e}function Xde(){var e=fU!==0;return fU=0,e}function by(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pl===null?ra.memoizedState=pl=e:pl=pl.next=e,pl}function mh(){if(qu===null){var e=ra.alternate;e=e!==null?e.memoizedState:null}else e=qu.next;var t=pl===null?ra.memoizedState:pl.next;if(t!==null)pl=t,qu=e;else{if(e===null)throw Error(Ce(310));qu=e,e={memoizedState:qu.memoizedState,baseState:qu.baseState,baseQueue:qu.baseQueue,queue:qu.queue,next:null},pl===null?ra.memoizedState=pl=e:pl=pl.next=e}return pl}function pU(e,t){return typeof t=="function"?t(e):t}function Oce(e){var t=mh(),r=t.queue;if(r===null)throw Error(Ce(311));r.lastRenderedReducer=e;var n=qu,o=n.baseQueue,i=r.pending;if(i!==null){if(o!==null){var a=o.next;o.next=i.next,i.next=a}n.baseQueue=o=i,r.pending=null}if(o!==null){i=o.next,n=n.baseState;var s=a=null,u=null,l=i;do{var c=l.lane;if((wI&c)===c)u!==null&&(u=u.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),n=l.hasEagerState?l.eagerState:e(n,l.action);else{var d={lane:c,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};u===null?(s=u=d,a=n):u=u.next=d,ra.lanes|=c,SI|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,Zm(n,t.memoizedState)||(pf=!0),t.memoizedState=n,t.baseState=a,t.baseQueue=u,r.lastRenderedState=n}if(e=r.interleaved,e!==null){o=e;do i=o.lane,ra.lanes|=i,SI|=i,o=o.next;while(o!==e)}else o===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Ece(e){var t=mh(),r=t.queue;if(r===null)throw Error(Ce(311));r.lastRenderedReducer=e;var n=r.dispatch,o=r.pending,i=t.memoizedState;if(o!==null){r.pending=null;var a=o=o.next;do i=e(i,a.action),a=a.next;while(a!==o);Zm(i,t.memoizedState)||(pf=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),r.lastRenderedState=i}return[i,n]}function Zqe(){}function Xqe(e,t){var r=ra,n=mh(),o=t(),i=!Zm(n.memoizedState,o);if(i&&(n.memoizedState=o,pf=!0),n=n.queue,Qde(tUe.bind(null,r,n,e),[e]),n.getSnapshot!==t||i||pl!==null&&pl.memoizedState.tag&1){if(r.flags|=2048,hU(9,eUe.bind(null,r,n,o,t),void 0,null),hl===null)throw Error(Ce(349));(wI&30)!==0||Qqe(r,t,o)}return o}function Qqe(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ra.updateQueue,t===null?(t={lastEffect:null,stores:null},ra.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function eUe(e,t,r,n){t.value=r,t.getSnapshot=n,rUe(t)&&nUe(e)}function tUe(e,t,r){return r(function(){rUe(t)&&nUe(e)})}function rUe(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Zm(e,r)}catch{return!0}}function nUe(e){var t=WS(e,1);t!==null&&Ym(t,e,1,-1)}function C$e(e){var t=by();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:pU,lastRenderedState:e},t.queue=e,e=e.dispatch=KKt.bind(null,ra,e),[t.memoizedState,e]}function hU(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=ra.updateQueue,t===null?(t={lastEffect:null,stores:null},ra.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function oUe(){return mh().memoizedState}function r9(e,t,r,n){var o=by();ra.flags|=e,o.memoizedState=hU(1|t,r,void 0,n===void 0?null:n)}function k9(e,t,r,n){var o=mh();n=n===void 0?null:n;var i=void 0;if(qu!==null){var a=qu.memoizedState;if(i=a.destroy,n!==null&&Yde(n,a.deps)){o.memoizedState=hU(t,r,i,n);return}}ra.flags|=e,o.memoizedState=hU(1|t,r,i,n)}function O$e(e,t){return r9(8390656,8,e,t)}function Qde(e,t){return k9(2048,8,e,t)}function iUe(e,t){return k9(4,2,e,t)}function aUe(e,t){return k9(4,4,e,t)}function sUe(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function uUe(e,t,r){return r=r!=null?r.concat([e]):null,k9(4,4,sUe.bind(null,t,e),r)}function efe(){}function lUe(e,t){var r=mh();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Yde(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function cUe(e,t){var r=mh();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Yde(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function dUe(e,t,r){return(wI&21)===0?(e.baseState&&(e.baseState=!1,pf=!0),e.memoizedState=r):(Zm(r,t)||(r=hqe(),ra.lanes|=r,SI|=r,e.baseState=!0),t)}function JKt(e,t){var r=Lo;Lo=r!==0&&4>r?r:4,e(!0);var n=Cce.transition;Cce.transition={};try{e(!1),t()}finally{Lo=r,Cce.transition=n}}function fUe(){return mh().memoizedState}function GKt(e,t,r){var n=YO(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},pUe(e))hUe(t,r);else if(r=Hqe(e,t,r,n),r!==null){var o=Ad();Ym(r,e,n,o),mUe(r,t,n)}}function KKt(e,t,r){var n=YO(e),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(pUe(e))hUe(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,s=i(a,r);if(o.hasEagerState=!0,o.eagerState=s,Zm(s,a)){var u=t.interleaved;u===null?(o.next=o,Vde(t)):(o.next=u.next,u.next=o),t.interleaved=o;return}}catch{}finally{}r=Hqe(e,t,o,n),r!==null&&(o=Ad(),Ym(r,e,n,o),mUe(r,t,n))}}function pUe(e){var t=e.alternate;return e===ra||t!==null&&t===ra}function hUe(e,t){Kq=C9=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function mUe(e,t,r){if((r&4194240)!==0){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Ade(e,r)}}var O9={readContext:hh,useCallback:kc,useContext:kc,useEffect:kc,useImperativeHandle:kc,useInsertionEffect:kc,useLayoutEffect:kc,useMemo:kc,useReducer:kc,useRef:kc,useState:kc,useDebugValue:kc,useDeferredValue:kc,useTransition:kc,useMutableSource:kc,useSyncExternalStore:kc,useId:kc,unstable_isNewReconciler:!1},YKt={readContext:hh,useCallback:function(e,t){return by().memoizedState=[e,t===void 0?null:t],e},useContext:hh,useEffect:O$e,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,r9(4194308,4,sUe.bind(null,t,e),r)},useLayoutEffect:function(e,t){return r9(4194308,4,e,t)},useInsertionEffect:function(e,t){return r9(4,2,e,t)},useMemo:function(e,t){var r=by();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=by();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=GKt.bind(null,ra,e),[n.memoizedState,e]},useRef:function(e){var t=by();return e={current:e},t.memoizedState=e},useState:C$e,useDebugValue:efe,useDeferredValue:function(e){return by().memoizedState=e},useTransition:function(){var e=C$e(!1),t=e[0];return e=JKt.bind(null,e[1]),by().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ra,o=by();if(Bi){if(r===void 0)throw Error(Ce(407));r=r()}else{if(r=t(),hl===null)throw Error(Ce(349));(wI&30)!==0||Qqe(n,t,r)}o.memoizedState=r;var i={value:r,getSnapshot:t};return o.queue=i,O$e(tUe.bind(null,n,i,e),[e]),n.flags|=2048,hU(9,eUe.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=by(),t=hl.identifierPrefix;if(Bi){var r=US,n=qS;r=(n&~(1<<32-Km(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=fU++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=WKt++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ZKt={readContext:hh,useCallback:lUe,useContext:hh,useEffect:Qde,useImperativeHandle:uUe,useInsertionEffect:iUe,useLayoutEffect:aUe,useMemo:cUe,useReducer:Oce,useRef:oUe,useState:function(){return Oce(pU)},useDebugValue:efe,useDeferredValue:function(e){var t=mh();return dUe(t,qu.memoizedState,e)},useTransition:function(){var e=Oce(pU)[0],t=mh().memoizedState;return[e,t]},useMutableSource:Zqe,useSyncExternalStore:Xqe,useId:fUe,unstable_isNewReconciler:!1},XKt={readContext:hh,useCallback:lUe,useContext:hh,useEffect:Qde,useImperativeHandle:uUe,useInsertionEffect:iUe,useLayoutEffect:aUe,useMemo:cUe,useReducer:Ece,useRef:oUe,useState:function(){return Ece(pU)},useDebugValue:efe,useDeferredValue:function(e){var t=mh();return qu===null?t.memoizedState=e:dUe(t,qu.memoizedState,e)},useTransition:function(){var e=Ece(pU)[0],t=mh().memoizedState;return[e,t]},useMutableSource:Zqe,useSyncExternalStore:Xqe,useId:fUe,unstable_isNewReconciler:!1};function Uj(e,t){try{var r="",n=t;do r+=TGt(n),n=n.return;while(n);var o=r}catch(i){o=`
Error generating stack: `+i.message+`
`+i.stack}return{value:e,source:t,stack:o,digest:null}}function Pce(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function lde(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var QKt=typeof WeakMap=="function"?WeakMap:Map;function gUe(e,t,r){r=zS(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){P9||(P9=!0,_de=n),lde(e,t)},r}function yUe(e,t,r){r=zS(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var o=t.value;r.payload=function(){return n(o)},r.callback=function(){lde(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){lde(e,t),typeof n!="function"&&(KO===null?KO=new Set([this]):KO.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),r}function E$e(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new QKt;var o=new Set;n.set(t,o)}else o=n.get(t),o===void 0&&(o=new Set,n.set(t,o));o.has(r)||(o.add(r),e=p7t.bind(null,e,t,r),t.then(e,e))}function P$e(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function T$e(e,t,r,n,o){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=zS(-1,1),t.tag=2,GO(r,t,1))),r.lanes|=1),e):(e.flags|=65536,e.lanes=o,e)}var e7t=GS.ReactCurrentOwner,pf=!1;function Id(e,t,r,n){t.child=e===null?Kqe(t,null,r,n):$j(t,e.child,r,n)}function M$e(e,t,r,n,o){r=r.render;var i=t.ref;return Nj(t,o),n=Zde(e,t,r,n,i,o),r=Xde(),e!==null&&!pf?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,JS(e,t,o)):(Bi&&r&&Bde(t),t.flags|=1,Id(e,t,n,o),t.child)}function I$e(e,t,r,n,o){if(e===null){var i=r.type;return typeof i=="function"&&!ufe(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,bUe(e,t,i,n,o)):(e=a9(r.type,null,n,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,(e.lanes&o)===0){var a=i.memoizedProps;if(r=r.compare,r=r!==null?r:aU,r(a,n)&&e.ref===t.ref)return JS(e,t,o)}return t.flags|=1,e=ZO(i,n),e.ref=t.ref,e.return=t,t.child=e}function bUe(e,t,r,n,o){if(e!==null){var i=e.memoizedProps;if(aU(i,n)&&e.ref===t.ref)if(pf=!1,t.pendingProps=n=i,(e.lanes&o)!==0)(e.flags&131072)!==0&&(pf=!0);else return t.lanes=e.lanes,JS(e,t,o)}return cde(e,t,r,n,o)}function _Ue(e,t,r){var n=t.pendingProps,o=n.children,i=e!==null?e.memoizedState:null;if(n.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},si(Ij,ip),ip|=r;else{if((r&1073741824)===0)return e=i!==null?i.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,si(Ij,ip),ip|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,si(Ij,ip),ip|=n}else i!==null?(n=i.baseLanes|r,t.memoizedState=null):n=r,si(Ij,ip),ip|=n;return Id(e,t,o,r),t.child}function vUe(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function cde(e,t,r,n,o){var i=mf(r)?_I:qc.current;return i=kj(t,i),Nj(t,o),r=Zde(e,t,r,n,i,o),n=Xde(),e!==null&&!pf?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,JS(e,t,o)):(Bi&&n&&Bde(t),t.flags|=1,Id(e,t,r,o),t.child)}function A$e(e,t,r,n,o){if(mf(r)){var i=!0;y9(t)}else i=!1;if(Nj(t,o),t.stateNode===null)n9(e,t),Jqe(t,r,n),ude(t,r,n,o),n=!0;else if(e===null){var a=t.stateNode,s=t.memoizedProps;a.props=s;var u=a.context,l=r.contextType;typeof l=="object"&&l!==null?l=hh(l):(l=mf(r)?_I:qc.current,l=kj(t,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)&&S$e(t,a,n,l),BO=!1;var f=t.memoizedState;a.state=f,S9(t,n,a,o),u=t.memoizedState,s!==n||f!==u||hf.current||BO?(typeof c=="function"&&(sde(t,r,c,n),u=t.memoizedState),(s=BO||w$e(t,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"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=u),a.props=n,a.state=u,a.context=l,n=s):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{a=t.stateNode,Vqe(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:Wm(t.type,s),a.props=l,d=t.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=hh(u):(u=mf(r)?_I:qc.current,u=kj(t,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)&&S$e(t,a,n,u),BO=!1,f=t.memoizedState,a.state=f,S9(t,n,a,o);var h=t.memoizedState;s!==d||f!==h||hf.current||BO?(typeof p=="function"&&(sde(t,r,p,n),h=t.memoizedState),(l=BO||w$e(t,r,l,n,f,h,u)||!1)?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,h,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,h,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=h),a.props=n,a.state=h,a.context=u,n=l):(typeof a.componentDidUpdate!="function"||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),n=!1)}return dde(e,t,r,n,i,o)}function dde(e,t,r,n,o,i){vUe(e,t);var a=(t.flags&128)!==0;if(!n&&!a)return o&&g$e(t,r,!1),JS(e,t,i);n=t.stateNode,e7t.current=t;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&a?(t.child=$j(t,e.child,null,i),t.child=$j(t,null,s,i)):Id(e,t,s,i),t.memoizedState=n.state,o&&g$e(t,r,!0),t.child}function wUe(e){var t=e.stateNode;t.pendingContext?m$e(e,t.pendingContext,t.pendingContext!==t.context):t.context&&m$e(e,t.context,!1),Jde(e,t.containerInfo)}function R$e(e,t,r,n,o){return Bj(),qde(o),t.flags|=256,Id(e,t,r,n),t.child}var fde={dehydrated:null,treeContext:null,retryLane:0};function pde(e){return{baseLanes:e,cachePool:null,transitions:null}}function SUe(e,t,r){var n=t.pendingProps,o=ta.current,i=!1,a=(t.flags&128)!==0,s;if((s=a)||(s=e!==null&&e.memoizedState===null?!1:(o&2)!==0),s?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),si(ta,o&1),e===null)return ide(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(a=n.children,e=n.fallback,i?(n=t.mode,i=t.child,a={mode:"hidden",children:a},(n&1)===0&&i!==null?(i.childLanes=0,i.pendingProps=a):i=q9(a,n,0,null),e=bI(e,n,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=pde(r),t.memoizedState=fde,e):tfe(t,a));if(o=e.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return t7t(e,t,a,n,s,o,r);if(i){i=n.fallback,a=t.mode,o=e.child,s=o.sibling;var u={mode:"hidden",children:n.children};return(a&1)===0&&t.child!==o?(n=t.child,n.childLanes=0,n.pendingProps=u,t.deletions=null):(n=ZO(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=ZO(s,i):(i=bI(i,a,r,null),i.flags|=2),i.return=t,n.return=t,n.sibling=i,t.child=n,n=i,i=t.child,a=e.child.memoizedState,a=a===null?pde(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~r,t.memoizedState=fde,n}return i=e.child,e=i.sibling,n=ZO(i,{mode:"visible",children:n.children}),(t.mode&1)===0&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function tfe(e,t){return t=q9({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function G5(e,t,r,n){return n!==null&&qde(n),$j(t,e.child,null,r),e=tfe(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function t7t(e,t,r,n,o,i,a){if(r)return t.flags&256?(t.flags&=-257,n=Pce(Error(Ce(422))),G5(e,t,a,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=n.fallback,o=t.mode,n=q9({mode:"visible",children:n.children},o,0,null),i=bI(i,o,a,null),i.flags|=2,n.return=t,i.return=t,n.sibling=i,t.child=n,(t.mode&1)!==0&&$j(t,e.child,null,a),t.child.memoizedState=pde(a),t.memoizedState=fde,i);if((t.mode&1)===0)return G5(e,t,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(Ce(419)),n=Pce(i,n,void 0),G5(e,t,a,n)}if(s=(a&e.childLanes)!==0,pf||s){if(n=hl,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,WS(e,o),Ym(n,e,o,-1))}return sfe(),n=Pce(Error(Ce(421))),G5(e,t,a,n)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=h7t.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,ap=JO(o.nextSibling),sp=t,Bi=!0,Gm=null,e!==null&&(ch[dh++]=qS,ch[dh++]=US,ch[dh++]=vI,qS=e.id,US=e.overflow,vI=t),t=tfe(t,n.children),t.flags|=4096,t)}function D$e(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),ade(e.return,t,r)}function Tce(e,t,r,n,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=o)}function xUe(e,t,r){var n=t.pendingProps,o=n.revealOrder,i=n.tail;if(Id(e,t,n.children,r),n=ta.current,(n&2)!==0)n=n&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&D$e(e,r,t);else if(e.tag===19)D$e(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(si(ta,n),(t.mode&1)===0)t.memoizedState=null;else switch(o){case"forwards":for(r=t.child,o=null;r!==null;)e=r.alternate,e!==null&&x9(e)===null&&(o=r),r=r.sibling;r=o,r===null?(o=t.child,t.child=null):(o=r.sibling,r.sibling=null),Tce(t,!1,o,r,i);break;case"backwards":for(r=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&x9(e)===null){t.child=o;break}e=o.sibling,o.sibling=r,r=o,o=e}Tce(t,!0,r,null,i);break;case"together":Tce(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function n9(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function JS(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),SI|=t.lanes,(r&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(Ce(153));if(t.child!==null){for(e=t.child,r=ZO(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=ZO(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function r7t(e,t,r){switch(t.tag){case 3:wUe(t),Bj();break;case 5:Yqe(t);break;case 1:mf(t.type)&&y9(t);break;case 4:Jde(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,o=t.memoizedProps.value;si(v9,n._currentValue),n._currentValue=o;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(si(ta,ta.current&1),t.flags|=128,null):(r&t.child.childLanes)!==0?SUe(e,t,r):(si(ta,ta.current&1),e=JS(e,t,r),e!==null?e.sibling:null);si(ta,ta.current&1);break;case 19:if(n=(r&t.childLanes)!==0,(e.flags&128)!==0){if(n)return xUe(e,t,r);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),si(ta,ta.current),n)break;return null;case 22:case 23:return t.lanes=0,_Ue(e,t,r)}return JS(e,t,r)}var CUe,hde,OUe,EUe;CUe=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};hde=function(){};OUe=function(e,t,r,n){var o=e.memoizedProps;if(o!==n){e=t.stateNode,gI(wy.current);var i=null;switch(r){case"input":o=Lce(e,o),n=Lce(e,n),i=[];break;case"select":o=na({},o,{value:void 0}),n=na({},n,{value:void 0}),i=[];break;case"textarea":o=Bce(e,o),n=Bce(e,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=m9)}qce(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"&&(Qq.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"&&(Qq.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&_i("scroll",e),i||s===u||(i=[])):(i=i||[]).push(l,u))}r&&(i=i||[]).push("style",r);var l=i;(t.updateQueue=l)&&(t.flags|=4)}};EUe=function(e,t,r,n){r!==n&&(t.flags|=4)};function Fq(e,t){if(!Bi)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Bc(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var o=e.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags&14680064,n|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags,n|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function n7t(e,t,r){var n=t.pendingProps;switch($de(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bc(t),null;case 1:return mf(t.type)&&g9(),Bc(t),null;case 3:return n=t.stateNode,qj(),vi(hf),vi(qc),Kde(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(W5(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Gm!==null&&(Sde(Gm),Gm=null))),hde(e,t),Bc(t),null;case 5:Gde(t);var o=gI(dU.current);if(r=t.type,e!==null&&t.stateNode!=null)OUe(e,t,r,n,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(Ce(166));return Bc(t),null}if(e=gI(wy.current),W5(t)){n=t.stateNode,r=t.type;var i=t.memoizedProps;switch(n[_y]=t,n[lU]=i,e=(t.mode&1)!==0,r){case"dialog":_i("cancel",n),_i("close",n);break;case"iframe":case"object":case"embed":_i("load",n);break;case"video":case"audio":for(o=0;o<zq.length;o++)_i(zq[o],n);break;case"source":_i("error",n);break;case"img":case"image":case"link":_i("error",n),_i("load",n);break;case"details":_i("toggle",n);break;case"input":qBe(n,i),_i("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},_i("invalid",n);break;case"textarea":zBe(n,i),_i("invalid",n)}qce(r,i),o=null;for(var a in i)if(i.hasOwnProperty(a)){var s=i[a];a==="children"?typeof s=="string"?n.textContent!==s&&(i.suppressHydrationWarning!==!0&&V5(n.textContent,s,e),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&V5(n.textContent,s,e),o=["children",""+s]):Qq.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&_i("scroll",n)}switch(r){case"input":D5(n),UBe(n,i,!0);break;case"textarea":D5(n),HBe(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=m9)}n=o,t.updateQueue=n,n!==null&&(t.flags|=4)}else{a=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Q$e(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=a.createElement(r,{is:n.is}):(e=a.createElement(r),r==="select"&&(a=e,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):e=a.createElementNS(e,r),e[_y]=t,e[lU]=n,CUe(e,t,!1,!1),t.stateNode=e;e:{switch(a=Uce(r,n),r){case"dialog":_i("cancel",e),_i("close",e),o=n;break;case"iframe":case"object":case"embed":_i("load",e),o=n;break;case"video":case"audio":for(o=0;o<zq.length;o++)_i(zq[o],e);o=n;break;case"source":_i("error",e),o=n;break;case"img":case"image":case"link":_i("error",e),_i("load",e),o=n;break;case"details":_i("toggle",e),o=n;break;case"input":qBe(e,n),o=Lce(e,n),_i("invalid",e);break;case"option":o=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},o=na({},n,{value:void 0}),_i("invalid",e);break;case"textarea":zBe(e,n),o=Bce(e,n),_i("invalid",e);break;default:o=n}qce(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?rqe(e,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&eqe(e,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&eU(e,u):typeof u=="number"&&eU(e,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Qq.hasOwnProperty(i)?u!=null&&i==="onScroll"&&_i("scroll",e):u!=null&&Ode(e,i,u,a))}switch(r){case"input":D5(e),UBe(e,n,!1);break;case"textarea":D5(e),HBe(e);break;case"option":n.value!=null&&e.setAttribute("value",""+XO(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?Aj(e,!!n.multiple,i,!1):n.defaultValue!=null&&Aj(e,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=m9)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Bc(t),null;case 6:if(e&&t.stateNode!=null)EUe(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(Ce(166));if(r=gI(dU.current),gI(wy.current),W5(t)){if(n=t.stateNode,r=t.memoizedProps,n[_y]=t,(i=n.nodeValue!==r)&&(e=sp,e!==null))switch(e.tag){case 3:V5(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&V5(n.nodeValue,r,(e.mode&1)!==0)}i&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[_y]=t,t.stateNode=n}return Bc(t),null;case 13:if(vi(ta),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Bi&&ap!==null&&(t.mode&1)!==0&&(t.flags&128)===0)zqe(),Bj(),t.flags|=98560,i=!1;else if(i=W5(t),n!==null&&n.dehydrated!==null){if(e===null){if(!i)throw Error(Ce(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Ce(317));i[_y]=t}else Bj(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Bc(t),i=!1}else Gm!==null&&(Sde(Gm),Gm=null),i=!0;if(!i)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(ta.current&1)!==0?Uu===0&&(Uu=3):sfe())),t.updateQueue!==null&&(t.flags|=4),Bc(t),null);case 4:return qj(),hde(e,t),e===null&&sU(t.stateNode.containerInfo),Bc(t),null;case 10:return Hde(t.type._context),Bc(t),null;case 17:return mf(t.type)&&g9(),Bc(t),null;case 19:if(vi(ta),i=t.memoizedState,i===null)return Bc(t),null;if(n=(t.flags&128)!==0,a=i.rendering,a===null)if(n)Fq(i,!1);else{if(Uu!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(a=x9(e),a!==null){for(t.flags|=128,Fq(i,!1),n=a.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)i=r,e=n,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return si(ta,ta.current&1|2),t.child}e=e.sibling}i.tail!==null&&Va()>zj&&(t.flags|=128,n=!0,Fq(i,!1),t.lanes=4194304)}else{if(!n)if(e=x9(a),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Fq(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Bi)return Bc(t),null}else 2*Va()-i.renderingStartTime>zj&&r!==1073741824&&(t.flags|=128,n=!0,Fq(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(r=i.last,r!==null?r.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Va(),t.sibling=null,r=ta.current,si(ta,n?r&1|2:r&1),t):(Bc(t),null);case 22:case 23:return afe(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&(t.mode&1)!==0?(ip&1073741824)!==0&&(Bc(t),t.subtreeFlags&6&&(t.flags|=8192)):Bc(t),null;case 24:return null;case 25:return null}throw Error(Ce(156,t.tag))}function o7t(e,t){switch($de(t),t.tag){case 1:return mf(t.type)&&g9(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qj(),vi(hf),vi(qc),Kde(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Gde(t),null;case 13:if(vi(ta),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ce(340));Bj()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return vi(ta),null;case 4:return qj(),null;case 10:return Hde(t.type._context),null;case 22:case 23:return afe(),null;case 24:return null;default:return null}}var K5=!1,$c=!1,i7t=typeof WeakSet=="function"?WeakSet:Set,nt=null;function Mj(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Ma(e,t,n)}else r.current=null}function mde(e,t,r){try{r()}catch(n){Ma(e,t,n)}}var j$e=!1;function a7t(e,t){if(Xce=f9,e=Iqe(),kde(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.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=e,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===e)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(Qce={focusedElem:e,selectionRange:r},f9=!1,nt=t;nt!==null;)if(t=nt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,nt=e;else for(;nt!==null;){t=nt;try{var h=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var m=h.memoizedProps,_=h.memoizedState,g=t.stateNode,v=g.getSnapshotBeforeUpdate(t.elementType===t.type?m:Wm(t.type,m),_);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var S=t.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(Ce(163))}}catch(x){Ma(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,nt=e;break}nt=t.return}return h=j$e,j$e=!1,h}function Yq(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&mde(t,r,i)}o=o.next}while(o!==n)}}function B9(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function gde(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function PUe(e){var t=e.alternate;t!==null&&(e.alternate=null,PUe(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[_y],delete t[lU],delete t[rde],delete t[UKt],delete t[zKt])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function TUe(e){return e.tag===5||e.tag===3||e.tag===4}function N$e(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||TUe(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function yde(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=m9));else if(n!==4&&(e=e.child,e!==null))for(yde(e,t,r),e=e.sibling;e!==null;)yde(e,t,r),e=e.sibling}function bde(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(bde(e,t,r),e=e.sibling;e!==null;)bde(e,t,r),e=e.sibling}var $l=null,Jm=!1;function FO(e,t,r){for(r=r.child;r!==null;)MUe(e,t,r),r=r.sibling}function MUe(e,t,r){if(vy&&typeof vy.onCommitFiberUnmount=="function")try{vy.onCommitFiberUnmount(A9,r)}catch{}switch(r.tag){case 5:$c||Mj(r,t);case 6:var n=$l,o=Jm;$l=null,FO(e,t,r),$l=n,Jm=o,$l!==null&&(Jm?(e=$l,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):$l.removeChild(r.stateNode));break;case 18:$l!==null&&(Jm?(e=$l,r=r.stateNode,e.nodeType===8?wce(e.parentNode,r):e.nodeType===1&&wce(e,r),oU(e)):wce($l,r.stateNode));break;case 4:n=$l,o=Jm,$l=r.stateNode.containerInfo,Jm=!0,FO(e,t,r),$l=n,Jm=o;break;case 0:case 11:case 14:case 15:if(!$c&&(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)&&mde(r,t,a),o=o.next}while(o!==n)}FO(e,t,r);break;case 1:if(!$c&&(Mj(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Ma(r,t,s)}FO(e,t,r);break;case 21:FO(e,t,r);break;case 22:r.mode&1?($c=(n=$c)||r.memoizedState!==null,FO(e,t,r),$c=n):FO(e,t,r);break;default:FO(e,t,r)}}function L$e(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new i7t),t.forEach(function(n){var o=m7t.bind(null,e,n);r.has(n)||(r.add(n),n.then(o,o))})}}function Vm(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var o=r[n];try{var i=e,a=t,s=a;e:for(;s!==null;){switch(s.tag){case 5:$l=s.stateNode,Jm=!1;break e;case 3:$l=s.stateNode.containerInfo,Jm=!0;break e;case 4:$l=s.stateNode.containerInfo,Jm=!0;break e}s=s.return}if($l===null)throw Error(Ce(160));MUe(i,a,o),$l=null,Jm=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){Ma(o,t,l)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)IUe(t,e),t=t.sibling}function IUe(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Vm(t,e),yy(e),n&4){try{Yq(3,e,e.return),B9(3,e)}catch(m){Ma(e,e.return,m)}try{Yq(5,e,e.return)}catch(m){Ma(e,e.return,m)}}break;case 1:Vm(t,e),yy(e),n&512&&r!==null&&Mj(r,r.return);break;case 5:if(Vm(t,e),yy(e),n&512&&r!==null&&Mj(r,r.return),e.flags&32){var o=e.stateNode;try{eU(o,"")}catch(m){Ma(e,e.return,m)}}if(n&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,a=r!==null?r.memoizedProps:i,s=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{s==="input"&&i.type==="radio"&&i.name!=null&&Z$e(o,i),Uce(s,a);var l=Uce(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?rqe(o,d):c==="dangerouslySetInnerHTML"?eqe(o,d):c==="children"?eU(o,d):Ode(o,c,d,l)}switch(s){case"input":Fce(o,i);break;case"textarea":X$e(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Aj(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?Aj(o,!!i.multiple,i.defaultValue,!0):Aj(o,!!i.multiple,i.multiple?[]:"",!1))}o[lU]=i}catch(m){Ma(e,e.return,m)}}break;case 6:if(Vm(t,e),yy(e),n&4){if(e.stateNode===null)throw Error(Ce(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(m){Ma(e,e.return,m)}}break;case 3:if(Vm(t,e),yy(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{oU(t.containerInfo)}catch(m){Ma(e,e.return,m)}break;case 4:Vm(t,e),yy(e);break;case 13:Vm(t,e),yy(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(ofe=Va())),n&4&&L$e(e);break;case 22:if(c=r!==null&&r.memoizedState!==null,e.mode&1?($c=(l=$c)||c,Vm(t,e),$c=l):Vm(t,e),yy(e),n&8192){if(l=e.memoizedState!==null,(e.stateNode.isHidden=l)&&!c&&(e.mode&1)!==0)for(nt=e,c=e.child;c!==null;){for(d=nt=c;nt!==null;){switch(f=nt,p=f.child,f.tag){case 0:case 11:case 14:case 15:Yq(4,f,f.return);break;case 1:Mj(f,f.return);var h=f.stateNode;if(typeof h.componentWillUnmount=="function"){n=f,r=f.return;try{t=n,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(m){Ma(n,r,m)}}break;case 5:Mj(f,f.return);break;case 22:if(f.memoizedState!==null){k$e(d);continue}}p!==null?(p.return=f,nt=p):k$e(d)}c=c.sibling}e:for(c=null,d=e;;){if(d.tag===5){if(c===null){c=d;try{o=d.stateNode,l?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(s=d.stateNode,u=d.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,s.style.display=tqe("display",a))}catch(m){Ma(e,e.return,m)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(m){Ma(e,e.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Vm(t,e),yy(e),n&4&&L$e(e);break;case 21:break;default:Vm(t,e),yy(e)}}function yy(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(TUe(r)){var n=r;break e}r=r.return}throw Error(Ce(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(eU(o,""),n.flags&=-33);var i=N$e(e);bde(e,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=N$e(e);yde(e,s,a);break;default:throw Error(Ce(161))}}catch(u){Ma(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function s7t(e,t,r){nt=e,AUe(e,t,r)}function AUe(e,t,r){for(var n=(e.mode&1)!==0;nt!==null;){var o=nt,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||K5;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||$c;s=K5;var l=$c;if(K5=a,($c=u)&&!l)for(nt=o;nt!==null;)a=nt,u=a.child,a.tag===22&&a.memoizedState!==null?B$e(o):u!==null?(u.return=a,nt=u):B$e(o);for(;i!==null;)nt=i,AUe(i,t,r),i=i.sibling;nt=o,K5=s,$c=l}F$e(e,t,r)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,nt=i):F$e(e,t,r)}}function F$e(e){for(;nt!==null;){var t=nt;if((t.flags&8772)!==0){var r=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:$c||B9(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!$c)if(r===null)n.componentDidMount();else{var o=t.elementType===t.type?r.memoizedProps:Wm(t.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&v$e(t,i,n);break;case 3:var a=t.updateQueue;if(a!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}v$e(t,a,r)}break;case 5:var s=t.stateNode;if(r===null&&t.flags&4){r=s;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&r.focus();break;case"img":u.src&&(r.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var l=t.alternate;if(l!==null){var c=l.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&oU(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ce(163))}$c||t.flags&512&&gde(t)}catch(f){Ma(t,t.return,f)}}if(t===e){nt=null;break}if(r=t.sibling,r!==null){r.return=t.return,nt=r;break}nt=t.return}}function k$e(e){for(;nt!==null;){var t=nt;if(t===e){nt=null;break}var r=t.sibling;if(r!==null){r.return=t.return,nt=r;break}nt=t.return}}function B$e(e){for(;nt!==null;){var t=nt;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{B9(4,t)}catch(u){Ma(t,r,u)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var o=t.return;try{n.componentDidMount()}catch(u){Ma(t,o,u)}}var i=t.return;try{gde(t)}catch(u){Ma(t,i,u)}break;case 5:var a=t.return;try{gde(t)}catch(u){Ma(t,a,u)}}}catch(u){Ma(t,t.return,u)}if(t===e){nt=null;break}var s=t.sibling;if(s!==null){s.return=t.return,nt=s;break}nt=t.return}}var u7t=Math.ceil,E9=GS.ReactCurrentDispatcher,rfe=GS.ReactCurrentOwner,ph=GS.ReactCurrentBatchConfig,Fn=0,hl=null,as=null,ql=0,ip=0,Ij=tE(0),Uu=0,mU=null,SI=0,$9=0,nfe=0,Zq=null,ff=null,ofe=0,zj=1/0,BS=null,P9=!1,_de=null,KO=null,Y5=!1,zO=null,T9=0,Xq=0,vde=null,o9=-1,i9=0;function Ad(){return(Fn&6)!==0?Va():o9!==-1?o9:o9=Va()}function YO(e){return(e.mode&1)===0?1:(Fn&2)!==0&&ql!==0?ql&-ql:VKt.transition!==null?(i9===0&&(i9=hqe()),i9):(e=Lo,e!==0||(e=window.event,e=e===void 0?16:wqe(e.type)),e)}function Ym(e,t,r,n){if(50<Xq)throw Xq=0,vde=null,Error(Ce(185));gU(e,r,n),((Fn&2)===0||e!==hl)&&(e===hl&&((Fn&2)===0&&($9|=r),Uu===4&&qO(e,ql)),gf(e,n),r===1&&Fn===0&&(t.mode&1)===0&&(zj=Va()+500,L9&&rE()))}function gf(e,t){var r=e.callbackNode;JGt(e,t);var n=d9(e,e===hl?ql:0);if(n===0)r!==null&&JBe(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&JBe(r),t===1)e.tag===0?HKt($$e.bind(null,e)):$qe($$e.bind(null,e)),$Kt(function(){(Fn&6)===0&&rE()}),r=null;else{switch(mqe(n)){case 1:r=Ide;break;case 4:r=fqe;break;case 16:r=c9;break;case 536870912:r=pqe;break;default:r=c9}r=BUe(r,RUe.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function RUe(e,t){if(o9=-1,i9=0,(Fn&6)!==0)throw Error(Ce(327));var r=e.callbackNode;if(Lj()&&e.callbackNode!==r)return null;var n=d9(e,e===hl?ql:0);if(n===0)return null;if((n&30)!==0||(n&e.expiredLanes)!==0||t)t=M9(e,n);else{t=n;var o=Fn;Fn|=2;var i=jUe();(hl!==e||ql!==t)&&(BS=null,zj=Va()+500,yI(e,t));do try{d7t();break}catch(s){DUe(e,s)}while(!0);zde(),E9.current=i,Fn=o,as!==null?t=0:(hl=null,ql=0,t=Uu)}if(t!==0){if(t===2&&(o=Jce(e),o!==0&&(n=o,t=wde(e,o))),t===1)throw r=mU,yI(e,0),qO(e,n),gf(e,Va()),r;if(t===6)qO(e,n);else{if(o=e.current.alternate,(n&30)===0&&!l7t(o)&&(t=M9(e,n),t===2&&(i=Jce(e),i!==0&&(n=i,t=wde(e,i))),t===1))throw r=mU,yI(e,0),qO(e,n),gf(e,Va()),r;switch(e.finishedWork=o,e.finishedLanes=n,t){case 0:case 1:throw Error(Ce(345));case 2:pI(e,ff,BS);break;case 3:if(qO(e,n),(n&130023424)===n&&(t=ofe+500-Va(),10<t)){if(d9(e,0)!==0)break;if(o=e.suspendedLanes,(o&n)!==n){Ad(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=tde(pI.bind(null,e,ff,BS),t);break}pI(e,ff,BS);break;case 4:if(qO(e,n),(n&4194240)===n)break;for(t=e.eventTimes,o=-1;0<n;){var a=31-Km(n);i=1<<a,a=t[a],a>o&&(o=a),n&=~i}if(n=o,n=Va()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*u7t(n/1960))-n,10<n){e.timeoutHandle=tde(pI.bind(null,e,ff,BS),n);break}pI(e,ff,BS);break;case 5:pI(e,ff,BS);break;default:throw Error(Ce(329))}}}return gf(e,Va()),e.callbackNode===r?RUe.bind(null,e):null}function wde(e,t){var r=Zq;return e.current.memoizedState.isDehydrated&&(yI(e,t).flags|=256),e=M9(e,t),e!==2&&(t=ff,ff=r,t!==null&&Sde(t)),e}function Sde(e){ff===null?ff=e:ff.push.apply(ff,e)}function l7t(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var o=r[n],i=o.getSnapshot;o=o.value;try{if(!Zm(i(),o))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function qO(e,t){for(t&=~nfe,t&=~$9,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Km(t),n=1<<r;e[r]=-1,t&=~n}}function $$e(e){if((Fn&6)!==0)throw Error(Ce(327));Lj();var t=d9(e,0);if((t&1)===0)return gf(e,Va()),null;var r=M9(e,t);if(e.tag!==0&&r===2){var n=Jce(e);n!==0&&(t=n,r=wde(e,n))}if(r===1)throw r=mU,yI(e,0),qO(e,t),gf(e,Va()),r;if(r===6)throw Error(Ce(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,pI(e,ff,BS),gf(e,Va()),null}function ife(e,t){var r=Fn;Fn|=1;try{return e(t)}finally{Fn=r,Fn===0&&(zj=Va()+500,L9&&rE())}}function xI(e){zO!==null&&zO.tag===0&&(Fn&6)===0&&Lj();var t=Fn;Fn|=1;var r=ph.transition,n=Lo;try{if(ph.transition=null,Lo=1,e)return e()}finally{Lo=n,ph.transition=r,Fn=t,(Fn&6)===0&&rE()}}function afe(){ip=Ij.current,vi(Ij)}function yI(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,BKt(r)),as!==null)for(r=as.return;r!==null;){var n=r;switch($de(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&g9();break;case 3:qj(),vi(hf),vi(qc),Kde();break;case 5:Gde(n);break;case 4:qj();break;case 13:vi(ta);break;case 19:vi(ta);break;case 10:Hde(n.type._context);break;case 22:case 23:afe()}r=r.return}if(hl=e,as=e=ZO(e.current,null),ql=ip=t,Uu=0,mU=null,nfe=$9=SI=0,ff=Zq=null,mI!==null){for(t=0;t<mI.length;t++)if(r=mI[t],n=r.interleaved,n!==null){r.interleaved=null;var o=n.next,i=r.pending;if(i!==null){var a=i.next;i.next=o,n.next=a}r.pending=n}mI=null}return e}function DUe(e,t){do{var r=as;try{if(zde(),t9.current=O9,C9){for(var n=ra.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}C9=!1}if(wI=0,pl=qu=ra=null,Kq=!1,fU=0,rfe.current=null,r===null||r.return===null){Uu=1,mU=t,as=null;break}e:{var i=e,a=r.return,s=r,u=t;if(t=ql,s.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var l=u,c=s,d=c.tag;if((c.mode&1)===0&&(d===0||d===11||d===15)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var p=P$e(a);if(p!==null){p.flags&=-257,T$e(p,a,s,i,t),p.mode&1&&E$e(i,l,t),t=p,u=l;var h=t.updateQueue;if(h===null){var m=new Set;m.add(u),t.updateQueue=m}else h.add(u);break e}else{if((t&1)===0){E$e(i,l,t),sfe();break e}u=Error(Ce(426))}}else if(Bi&&s.mode&1){var _=P$e(a);if(_!==null){(_.flags&65536)===0&&(_.flags|=256),T$e(_,a,s,i,t),qde(Uj(u,s));break e}}i=u=Uj(u,s),Uu!==4&&(Uu=2),Zq===null?Zq=[i]:Zq.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=gUe(i,u,t);_$e(i,g);break e;case 1:s=u;var v=i.type,S=i.stateNode;if((i.flags&128)===0&&(typeof v.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(KO===null||!KO.has(S)))){i.flags|=65536,t&=-t,i.lanes|=t;var x=yUe(i,s,t);_$e(i,x);break e}}i=i.return}while(i!==null)}LUe(r)}catch(O){t=O,as===r&&r!==null&&(as=r=r.return);continue}break}while(!0)}function jUe(){var e=E9.current;return E9.current=O9,e===null?O9:e}function sfe(){(Uu===0||Uu===3||Uu===2)&&(Uu=4),hl===null||(SI&268435455)===0&&($9&268435455)===0||qO(hl,ql)}function M9(e,t){var r=Fn;Fn|=2;var n=jUe();(hl!==e||ql!==t)&&(BS=null,yI(e,t));do try{c7t();break}catch(o){DUe(e,o)}while(!0);if(zde(),Fn=r,E9.current=n,as!==null)throw Error(Ce(261));return hl=null,ql=0,Uu}function c7t(){for(;as!==null;)NUe(as)}function d7t(){for(;as!==null&&!kGt();)NUe(as)}function NUe(e){var t=kUe(e.alternate,e,ip);e.memoizedProps=e.pendingProps,t===null?LUe(e):as=t,rfe.current=null}function LUe(e){var t=e;do{var r=t.alternate;if(e=t.return,(t.flags&32768)===0){if(r=n7t(r,t,ip),r!==null){as=r;return}}else{if(r=o7t(r,t),r!==null){r.flags&=32767,as=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Uu=6,as=null;return}}if(t=t.sibling,t!==null){as=t;return}as=t=e}while(t!==null);Uu===0&&(Uu=5)}function pI(e,t,r){var n=Lo,o=ph.transition;try{ph.transition=null,Lo=1,f7t(e,t,r,n)}finally{ph.transition=o,Lo=n}return null}function f7t(e,t,r,n){do Lj();while(zO!==null);if((Fn&6)!==0)throw Error(Ce(327));r=e.finishedWork;var o=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(Ce(177));e.callbackNode=null,e.callbackPriority=0;var i=r.lanes|r.childLanes;if(GGt(e,i),e===hl&&(as=hl=null,ql=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||Y5||(Y5=!0,BUe(c9,function(){return Lj(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=ph.transition,ph.transition=null;var a=Lo;Lo=1;var s=Fn;Fn|=4,rfe.current=null,a7t(e,r),IUe(r,e),jKt(Qce),f9=!!Xce,Qce=Xce=null,e.current=r,s7t(r,e,o),BGt(),Fn=s,Lo=a,ph.transition=i}else e.current=r;if(Y5&&(Y5=!1,zO=e,T9=o),i=e.pendingLanes,i===0&&(KO=null),UGt(r.stateNode,n),gf(e,Va()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)o=t[r],n(o.value,{componentStack:o.stack,digest:o.digest});if(P9)throw P9=!1,e=_de,_de=null,e;return(T9&1)!==0&&e.tag!==0&&Lj(),i=e.pendingLanes,(i&1)!==0?e===vde?Xq++:(Xq=0,vde=e):Xq=0,rE(),null}function Lj(){if(zO!==null){var e=mqe(T9),t=ph.transition,r=Lo;try{if(ph.transition=null,Lo=16>e?16:e,zO===null)var n=!1;else{if(e=zO,zO=null,T9=0,(Fn&6)!==0)throw Error(Ce(331));var o=Fn;for(Fn|=4,nt=e.current;nt!==null;){var i=nt,a=i.child;if((nt.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(nt=l;nt!==null;){var c=nt;switch(c.tag){case 0:case 11:case 15:Yq(8,c,i)}var d=c.child;if(d!==null)d.return=c,nt=d;else for(;nt!==null;){c=nt;var f=c.sibling,p=c.return;if(PUe(c),c===l){nt=null;break}if(f!==null){f.return=p,nt=f;break}nt=p}}}var h=i.alternate;if(h!==null){var m=h.child;if(m!==null){h.child=null;do{var _=m.sibling;m.sibling=null,m=_}while(m!==null)}}nt=i}}if((i.subtreeFlags&2064)!==0&&a!==null)a.return=i,nt=a;else e:for(;nt!==null;){if(i=nt,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:Yq(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,nt=g;break e}nt=i.return}}var v=e.current;for(nt=v;nt!==null;){a=nt;var S=a.child;if((a.subtreeFlags&2064)!==0&&S!==null)S.return=a,nt=S;else e:for(a=v;nt!==null;){if(s=nt,(s.flags&2048)!==0)try{switch(s.tag){case 0:case 11:case 15:B9(9,s)}}catch(O){Ma(s,s.return,O)}if(s===a){nt=null;break e}var x=s.sibling;if(x!==null){x.return=s.return,nt=x;break e}nt=s.return}}if(Fn=o,rE(),vy&&typeof vy.onPostCommitFiberRoot=="function")try{vy.onPostCommitFiberRoot(A9,e)}catch{}n=!0}return n}finally{Lo=r,ph.transition=t}}return!1}function q$e(e,t,r){t=Uj(r,t),t=gUe(e,t,1),e=GO(e,t,1),t=Ad(),e!==null&&(gU(e,1,t),gf(e,t))}function Ma(e,t,r){if(e.tag===3)q$e(e,e,r);else for(;t!==null;){if(t.tag===3){q$e(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(KO===null||!KO.has(n))){e=Uj(r,e),e=yUe(t,e,1),t=GO(t,e,1),e=Ad(),t!==null&&(gU(t,1,e),gf(t,e));break}}t=t.return}}function p7t(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=Ad(),e.pingedLanes|=e.suspendedLanes&r,hl===e&&(ql&r)===r&&(Uu===4||Uu===3&&(ql&130023424)===ql&&500>Va()-ofe?yI(e,0):nfe|=r),gf(e,t)}function FUe(e,t){t===0&&((e.mode&1)===0?t=1:(t=L5,L5<<=1,(L5&130023424)===0&&(L5=4194304)));var r=Ad();e=WS(e,t),e!==null&&(gU(e,t,r),gf(e,r))}function h7t(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),FUe(e,r)}function m7t(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,o=e.memoizedState;o!==null&&(r=o.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(Ce(314))}n!==null&&n.delete(t),FUe(e,r)}var kUe;kUe=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||hf.current)pf=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return pf=!1,r7t(e,t,r);pf=(e.flags&131072)!==0}else pf=!1,Bi&&(t.flags&1048576)!==0&&qqe(t,_9,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;n9(e,t),e=t.pendingProps;var o=kj(t,qc.current);Nj(t,r),o=Zde(null,t,n,e,o,r);var i=Xde();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,mf(n)?(i=!0,y9(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Wde(t),o.updater=F9,t.stateNode=o,o._reactInternals=t,ude(t,n,e,r),t=dde(null,t,n,!0,i,r)):(t.tag=0,Bi&&i&&Bde(t),Id(null,t,o,r),t=t.child),t;case 16:n=t.elementType;e:{switch(n9(e,t),e=t.pendingProps,o=n._init,n=o(n._payload),t.type=n,o=t.tag=y7t(n),e=Wm(n,e),o){case 0:t=cde(null,t,n,e,r);break e;case 1:t=A$e(null,t,n,e,r);break e;case 11:t=M$e(null,t,n,e,r);break e;case 14:t=I$e(null,t,n,Wm(n.type,e),r);break e}throw Error(Ce(306,n,""))}return t;case 0:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Wm(n,o),cde(e,t,n,o,r);case 1:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Wm(n,o),A$e(e,t,n,o,r);case 3:e:{if(wUe(t),e===null)throw Error(Ce(387));n=t.pendingProps,i=t.memoizedState,o=i.element,Vqe(e,t),S9(t,n,null,r);var a=t.memoizedState;if(n=a.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Uj(Error(Ce(423)),t),t=R$e(e,t,n,r,o);break e}else if(n!==o){o=Uj(Error(Ce(424)),t),t=R$e(e,t,n,r,o);break e}else for(ap=JO(t.stateNode.containerInfo.firstChild),sp=t,Bi=!0,Gm=null,r=Kqe(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Bj(),n===o){t=JS(e,t,r);break e}Id(e,t,n,r)}t=t.child}return t;case 5:return Yqe(t),e===null&&ide(t),n=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,a=o.children,ede(n,o)?a=null:i!==null&&ede(n,i)&&(t.flags|=32),vUe(e,t),Id(e,t,a,r),t.child;case 6:return e===null&&ide(t),null;case 13:return SUe(e,t,r);case 4:return Jde(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=$j(t,null,n,r):Id(e,t,n,r),t.child;case 11:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Wm(n,o),M$e(e,t,n,o,r);case 7:return Id(e,t,t.pendingProps,r),t.child;case 8:return Id(e,t,t.pendingProps.children,r),t.child;case 12:return Id(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,o=t.pendingProps,i=t.memoizedProps,a=o.value,si(v9,n._currentValue),n._currentValue=a,i!==null)if(Zm(i.value,a)){if(i.children===o.children&&!hf.current){t=JS(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);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=zS(-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),ade(i.return,r,t),s.lanes|=r;break}u=u.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Ce(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),ade(a,r,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Id(e,t,o.children,r),t=t.child}return t;case 9:return o=t.type,n=t.pendingProps.children,Nj(t,r),o=hh(o),n=n(o),t.flags|=1,Id(e,t,n,r),t.child;case 14:return n=t.type,o=Wm(n,t.pendingProps),o=Wm(n.type,o),I$e(e,t,n,o,r);case 15:return bUe(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Wm(n,o),n9(e,t),t.tag=1,mf(n)?(e=!0,y9(t)):e=!1,Nj(t,r),Jqe(t,n,o),ude(t,n,o,r),dde(null,t,n,!0,e,r);case 19:return xUe(e,t,r);case 22:return _Ue(e,t,r)}throw Error(Ce(156,t.tag))};function BUe(e,t){return dqe(e,t)}function g7t(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 fh(e,t,r,n){return new g7t(e,t,r,n)}function ufe(e){return e=e.prototype,!(!e||!e.isReactComponent)}function y7t(e){if(typeof e=="function")return ufe(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Pde)return 11;if(e===Tde)return 14}return 2}function ZO(e,t){var r=e.alternate;return r===null?(r=fh(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function a9(e,t,r,n,o,i){var a=2;if(n=e,typeof e=="function")ufe(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case vj:return bI(r.children,o,i,t);case Ede:a=8,o|=8;break;case Rce:return e=fh(12,r,t,o|2),e.elementType=Rce,e.lanes=i,e;case Dce:return e=fh(13,r,t,o),e.elementType=Dce,e.lanes=i,e;case jce:return e=fh(19,r,t,o),e.elementType=jce,e.lanes=i,e;case G$e:return q9(r,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case W$e:a=10;break e;case J$e:a=9;break e;case Pde:a=11;break e;case Tde:a=14;break e;case kO:a=16,n=null;break e}throw Error(Ce(130,e==null?e:typeof e,""))}return t=fh(a,r,t,o),t.elementType=e,t.type=n,t.lanes=i,t}function bI(e,t,r,n){return e=fh(7,e,n,t),e.lanes=r,e}function q9(e,t,r,n){return e=fh(22,e,n,t),e.elementType=G$e,e.lanes=r,e.stateNode={isHidden:!1},e}function Mce(e,t,r){return e=fh(6,e,null,t),e.lanes=r,e}function Ice(e,t,r){return t=fh(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function b7t(e,t,r,n,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=pce(0),this.expirationTimes=pce(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pce(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function lfe(e,t,r,n,o,i,a,s,u){return e=new b7t(e,t,r,s,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=fh(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Wde(i),e}function _7t(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_j,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function $Ue(e){if(!e)return QO;e=e._reactInternals;e:{if(OI(e)!==e||e.tag!==1)throw Error(Ce(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(mf(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Ce(171))}if(e.tag===1){var r=e.type;if(mf(r))return Bqe(e,r,t)}return t}function qUe(e,t,r,n,o,i,a,s,u){return e=lfe(r,n,!0,e,o,i,a,s,u),e.context=$Ue(null),r=e.current,n=Ad(),o=YO(r),i=zS(n,o),i.callback=t??null,GO(r,i,o),e.current.lanes=o,gU(e,o,n),gf(e,n),e}function U9(e,t,r,n){var o=t.current,i=Ad(),a=YO(o);return r=$Ue(r),t.context===null?t.context=r:t.pendingContext=r,t=zS(i,a),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=GO(o,t,a),e!==null&&(Ym(e,o,a,i),e9(e,o,a)),a}function I9(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function U$e(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function cfe(e,t){U$e(e,t),(e=e.alternate)&&U$e(e,t)}function v7t(){return null}var UUe=typeof reportError=="function"?reportError:function(e){console.error(e)};function dfe(e){this._internalRoot=e}z9.prototype.render=dfe.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Ce(409));U9(e,t,null,null)};z9.prototype.unmount=dfe.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;xI(function(){U9(null,e,null,null)}),t[VS]=null}};function z9(e){this._internalRoot=e}z9.prototype.unstable_scheduleHydration=function(e){if(e){var t=bqe();e={blockedOn:null,target:e,priority:t};for(var r=0;r<$O.length&&t!==0&&t<$O[r].priority;r++);$O.splice(r,0,e),r===0&&vqe(e)}};function ffe(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function H9(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function z$e(){}function w7t(e,t,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=I9(a);i.call(l)}}var a=qUe(t,n,e,0,null,!1,!1,"",z$e);return e._reactRootContainer=a,e[VS]=a.current,sU(e.nodeType===8?e.parentNode:e),xI(),a}for(;o=e.lastChild;)e.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=I9(u);s.call(l)}}var u=lfe(e,0,!1,null,null,!1,!1,"",z$e);return e._reactRootContainer=u,e[VS]=u.current,sU(e.nodeType===8?e.parentNode:e),xI(function(){U9(t,u,r,n)}),u}function V9(e,t,r,n,o){var i=r._reactRootContainer;if(i){var a=i;if(typeof o=="function"){var s=o;o=function(){var u=I9(a);s.call(u)}}U9(t,a,e,o)}else a=w7t(r,t,e,o,n);return I9(a)}gqe=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=Uq(t.pendingLanes);r!==0&&(Ade(t,r|1),gf(t,Va()),(Fn&6)===0&&(zj=Va()+500,rE()))}break;case 13:xI(function(){var n=WS(e,1);if(n!==null){var o=Ad();Ym(n,e,1,o)}}),cfe(e,1)}};Rde=function(e){if(e.tag===13){var t=WS(e,134217728);if(t!==null){var r=Ad();Ym(t,e,134217728,r)}cfe(e,134217728)}};yqe=function(e){if(e.tag===13){var t=YO(e),r=WS(e,t);if(r!==null){var n=Ad();Ym(r,e,t,n)}cfe(e,t)}};bqe=function(){return Lo};_qe=function(e,t){var r=Lo;try{return Lo=e,t()}finally{Lo=r}};Hce=function(e,t,r){switch(t){case"input":if(Fce(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var o=N9(n);if(!o)throw Error(Ce(90));Y$e(n),Fce(n,o)}}}break;case"textarea":X$e(e,r);break;case"select":t=r.value,t!=null&&Aj(e,!!r.multiple,t,!1)}};iqe=ife;aqe=xI;var S7t={usingClientEntryPoint:!1,Events:[bU,Cj,N9,nqe,oqe,ife]},kq={findFiberByHostInstance:hI,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},x7t={bundleType:kq.bundleType,version:kq.version,rendererPackageName:kq.rendererPackageName,rendererConfig:kq.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:GS.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=lqe(e),e===null?null:e.stateNode},findFiberByHostInstance:kq.findFiberByHostInstance||v7t,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Bq=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Bq.isDisabled&&Bq.supportsFiber))try{A9=Bq.inject(x7t),vy=Bq}catch{}var Bq;cp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=S7t;cp.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ffe(t))throw Error(Ce(200));return _7t(e,t,null,r)};cp.createRoot=function(e,t){if(!ffe(e))throw Error(Ce(299));var r=!1,n="",o=UUe;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=lfe(e,1,!1,null,null,r,!1,n,o),e[VS]=t.current,sU(e.nodeType===8?e.parentNode:e),new dfe(t)};cp.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Ce(188)):(e=Object.keys(e).join(","),Error(Ce(268,e)));return e=lqe(t),e=e===null?null:e.stateNode,e};cp.flushSync=function(e){return xI(e)};cp.hydrate=function(e,t,r){if(!H9(t))throw Error(Ce(200));return V9(null,e,t,!0,r)};cp.hydrateRoot=function(e,t,r){if(!ffe(e))throw Error(Ce(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=UUe;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),t=qUe(t,null,e,1,r??null,o,!1,i,a),e[VS]=t.current,sU(e),n)for(e=0;e<n.length;e++)r=n[e],o=r._getVersion,o=o(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,o]:t.mutableSourceEagerHydrationData.push(r,o);return new z9(t)};cp.render=function(e,t,r){if(!H9(t))throw Error(Ce(200));return V9(null,e,t,!1,r)};cp.unmountComponentAtNode=function(e){if(!H9(e))throw Error(Ce(40));return e._reactRootContainer?(xI(function(){V9(null,null,e,!1,function(){e._reactRootContainer=null,e[VS]=null})}),!0):!1};cp.unstable_batchedUpdates=ife;cp.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!H9(r))throw Error(Ce(200));if(e==null||e._reactInternals===void 0)throw Error(Ce(38));return V9(e,t,r,!1,n)};cp.version="18.2.0-next-9e3b772b8-20220608"});var ss=b((LEn,VUe)=>{"use strict";function HUe(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(HUe)}catch(e){console.error(e)}}HUe(),VUe.exports=zUe()});var gh=b(pfe=>{"use strict";var WUe=ss();pfe.createRoot=WUe.createRoot,pfe.hydrateRoot=WUe.hydrateRoot;var FEn});var KUe=b(W9=>{"use strict";var O7t=Y(),E7t=Symbol.for("react.element"),P7t=Symbol.for("react.fragment"),T7t=Object.prototype.hasOwnProperty,M7t=O7t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,I7t={key:!0,ref:!0,__self:!0,__source:!0};function GUe(e,t,r){var n,o={},i=null,a=null;r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(n in t)T7t.call(t,n)&&!I7t.hasOwnProperty(n)&&(o[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)o[n]===void 0&&(o[n]=t[n]);return{$$typeof:E7t,type:e,key:i,ref:a,props:o,_owner:M7t.current}}W9.Fragment=P7t;W9.jsx=GUe;W9.jsxs=GUe});var lt=b((qEn,YUe)=>{"use strict";YUe.exports=KUe()});var mze=b(X9=>{"use strict";Object.defineProperty(X9,"__esModule",{value:!0});X9.V2ChatStreamRequestCitationMode=void 0;X9.V2ChatStreamRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var gze=b(Q9=>{"use strict";Object.defineProperty(Q9,"__esModule",{value:!0});Q9.V2ChatRequestCitationMode=void 0;Q9.V2ChatRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var bze=b(yze=>{"use strict";Object.defineProperty(yze,"__esModule",{value:!0})});var vze=b(_ze=>{"use strict";Object.defineProperty(_ze,"__esModule",{value:!0})});var Sze=b(wze=>{"use strict";Object.defineProperty(wze,"__esModule",{value:!0})});var Cze=b(xze=>{"use strict";Object.defineProperty(xze,"__esModule",{value:!0})});var Eze=b(Oze=>{"use strict";Object.defineProperty(Oze,"__esModule",{value:!0})});var Tze=b(Pze=>{"use strict";Object.defineProperty(Pze,"__esModule",{value:!0})});var Ize=b(Mze=>{"use strict";Object.defineProperty(Mze,"__esModule",{value:!0})});var Rze=b(Aze=>{"use strict";Object.defineProperty(Aze,"__esModule",{value:!0})});var jze=b(Dze=>{"use strict";Object.defineProperty(Dze,"__esModule",{value:!0})});var Lze=b(Nze=>{"use strict";Object.defineProperty(Nze,"__esModule",{value:!0})});var kze=b(Fze=>{"use strict";Object.defineProperty(Fze,"__esModule",{value:!0})});var $ze=b(Bze=>{"use strict";Object.defineProperty(Bze,"__esModule",{value:!0})});var Uze=b(qze=>{"use strict";Object.defineProperty(qze,"__esModule",{value:!0})});var Hze=b(zze=>{"use strict";Object.defineProperty(zze,"__esModule",{value:!0})});var Wze=b(Vze=>{"use strict";Object.defineProperty(Vze,"__esModule",{value:!0})});var Gze=b(Jze=>{"use strict";Object.defineProperty(Jze,"__esModule",{value:!0})});var Yze=b(Kze=>{"use strict";Object.defineProperty(Kze,"__esModule",{value:!0})});var Xze=b(Zze=>{"use strict";Object.defineProperty(Zze,"__esModule",{value:!0})});var e2e=b(Qze=>{"use strict";Object.defineProperty(Qze,"__esModule",{value:!0})});var r2e=b(t2e=>{"use strict";Object.defineProperty(t2e,"__esModule",{value:!0})});var o2e=b(n2e=>{"use strict";Object.defineProperty(n2e,"__esModule",{value:!0})});var a2e=b(i2e=>{"use strict";Object.defineProperty(i2e,"__esModule",{value:!0})});var u2e=b(s2e=>{"use strict";Object.defineProperty(s2e,"__esModule",{value:!0})});var l2e=b(eW=>{"use strict";Object.defineProperty(eW,"__esModule",{value:!0});eW.ChatFinishReason=void 0;eW.ChatFinishReason={Complete:"complete",StopSequence:"stop_sequence",MaxTokens:"max_tokens",ToolCall:"tool_call",Error:"error",ContentBlocked:"content_blocked",ErrorLimit:"error_limit"}});var d2e=b(c2e=>{"use strict";Object.defineProperty(c2e,"__esModule",{value:!0})});var p2e=b(f2e=>{"use strict";Object.defineProperty(f2e,"__esModule",{value:!0})});var m2e=b(h2e=>{"use strict";Object.defineProperty(h2e,"__esModule",{value:!0})});var y2e=b(g2e=>{"use strict";Object.defineProperty(g2e,"__esModule",{value:!0})});var _2e=b(b2e=>{"use strict";Object.defineProperty(b2e,"__esModule",{value:!0})});var w2e=b(v2e=>{"use strict";Object.defineProperty(v2e,"__esModule",{value:!0})});var x2e=b(S2e=>{"use strict";Object.defineProperty(S2e,"__esModule",{value:!0})});var O2e=b(C2e=>{"use strict";Object.defineProperty(C2e,"__esModule",{value:!0})});var P2e=b(E2e=>{"use strict";Object.defineProperty(E2e,"__esModule",{value:!0})});var M2e=b(T2e=>{"use strict";Object.defineProperty(T2e,"__esModule",{value:!0})});var A2e=b(I2e=>{"use strict";Object.defineProperty(I2e,"__esModule",{value:!0})});var D2e=b(R2e=>{"use strict";Object.defineProperty(R2e,"__esModule",{value:!0})});var N2e=b(j2e=>{"use strict";Object.defineProperty(j2e,"__esModule",{value:!0})});var F2e=b(L2e=>{"use strict";Object.defineProperty(L2e,"__esModule",{value:!0})});var B2e=b(k2e=>{"use strict";Object.defineProperty(k2e,"__esModule",{value:!0})});var q2e=b($2e=>{"use strict";Object.defineProperty($2e,"__esModule",{value:!0})});var z2e=b(U2e=>{"use strict";Object.defineProperty(U2e,"__esModule",{value:!0})});var V2e=b(H2e=>{"use strict";Object.defineProperty(H2e,"__esModule",{value:!0})});var J2e=b(W2e=>{"use strict";Object.defineProperty(W2e,"__esModule",{value:!0})});var K2e=b(G2e=>{"use strict";Object.defineProperty(G2e,"__esModule",{value:!0})});var Z2e=b(Y2e=>{"use strict";Object.defineProperty(Y2e,"__esModule",{value:!0})});var Q2e=b(X2e=>{"use strict";Object.defineProperty(X2e,"__esModule",{value:!0})});var t4e=b(e4e=>{"use strict";Object.defineProperty(e4e,"__esModule",{value:!0})});var n4e=b(r4e=>{"use strict";Object.defineProperty(r4e,"__esModule",{value:!0})});var i4e=b(o4e=>{"use strict";Object.defineProperty(o4e,"__esModule",{value:!0})});var s4e=b(a4e=>{"use strict";Object.defineProperty(a4e,"__esModule",{value:!0})});var l4e=b(u4e=>{"use strict";Object.defineProperty(u4e,"__esModule",{value:!0})});var d4e=b(c4e=>{"use strict";Object.defineProperty(c4e,"__esModule",{value:!0})});var p4e=b(f4e=>{"use strict";Object.defineProperty(f4e,"__esModule",{value:!0})});var m4e=b(h4e=>{"use strict";Object.defineProperty(h4e,"__esModule",{value:!0})});var y4e=b(g4e=>{"use strict";Object.defineProperty(g4e,"__esModule",{value:!0})});var _4e=b(b4e=>{"use strict";Object.defineProperty(b4e,"__esModule",{value:!0})});var w4e=b(v4e=>{"use strict";Object.defineProperty(v4e,"__esModule",{value:!0})});var vfe=b(at=>{"use strict";var gYt=at&&at.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),yt=at&&at.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&gYt(t,e,r)};Object.defineProperty(at,"__esModule",{value:!0});yt(mze(),at);yt(gze(),at);yt(bze(),at);yt(vze(),at);yt(Sze(),at);yt(Cze(),at);yt(Eze(),at);yt(Tze(),at);yt(Ize(),at);yt(Rze(),at);yt(jze(),at);yt(Lze(),at);yt(kze(),at);yt($ze(),at);yt(Uze(),at);yt(Hze(),at);yt(Wze(),at);yt(Gze(),at);yt(Yze(),at);yt(Xze(),at);yt(e2e(),at);yt(r2e(),at);yt(o2e(),at);yt(a2e(),at);yt(u2e(),at);yt(l2e(),at);yt(d2e(),at);yt(p2e(),at);yt(m2e(),at);yt(y2e(),at);yt(_2e(),at);yt(w2e(),at);yt(x2e(),at);yt(O2e(),at);yt(P2e(),at);yt(M2e(),at);yt(A2e(),at);yt(D2e(),at);yt(N2e(),at);yt(F2e(),at);yt(B2e(),at);yt(q2e(),at);yt(z2e(),at);yt(V2e(),at);yt(J2e(),at);yt(K2e(),at);yt(Z2e(),at);yt(Q2e(),at);yt(t4e(),at);yt(n4e(),at);yt(i4e(),at);yt(s4e(),at);yt(l4e(),at);yt(d4e(),at);yt(p4e(),at);yt(m4e(),at);yt(y4e(),at);yt(_4e(),at);yt(w4e(),at)});var wfe=b(S4e=>{"use strict";Object.defineProperty(S4e,"__esModule",{value:!0})});var x4e=b(jI=>{"use strict";var yYt=jI&&jI.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),bYt=jI&&jI.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&yYt(t,e,r)};Object.defineProperty(jI,"__esModule",{value:!0});bYt(wfe(),jI)});var O4e=b(dE=>{"use strict";var _Yt=dE&&dE.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),C4e=dE&&dE.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&_Yt(t,e,r)};Object.defineProperty(dE,"__esModule",{value:!0});C4e(vfe(),dE);C4e(x4e(),dE)});var E4e=b(tW=>{"use strict";Object.defineProperty(tW,"__esModule",{value:!0});tW.CreateEmbedJobRequestTruncate=void 0;tW.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var Sfe=b(NI=>{"use strict";var vYt=NI&&NI.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),wYt=NI&&NI.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&vYt(t,e,r)};Object.defineProperty(NI,"__esModule",{value:!0});wYt(E4e(),NI)});var xfe=b(P4e=>{"use strict";Object.defineProperty(P4e,"__esModule",{value:!0})});var T4e=b(LI=>{"use strict";var SYt=LI&&LI.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),xYt=LI&&LI.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&SYt(t,e,r)};Object.defineProperty(LI,"__esModule",{value:!0});xYt(xfe(),LI)});var I4e=b(fE=>{"use strict";var CYt=fE&&fE.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),M4e=fE&&fE.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&CYt(t,e,r)};Object.defineProperty(fE,"__esModule",{value:!0});M4e(Sfe(),fE);M4e(T4e(),fE)});var R4e=b(A4e=>{"use strict";Object.defineProperty(A4e,"__esModule",{value:!0})});var j4e=b(D4e=>{"use strict";Object.defineProperty(D4e,"__esModule",{value:!0})});var L4e=b(N4e=>{"use strict";Object.defineProperty(N4e,"__esModule",{value:!0})});var k4e=b(F4e=>{"use strict";Object.defineProperty(F4e,"__esModule",{value:!0})});var $4e=b(B4e=>{"use strict";Object.defineProperty(B4e,"__esModule",{value:!0})});var Cfe=b(tg=>{"use strict";var OYt=tg&&tg.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),WU=tg&&tg.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&OYt(t,e,r)};Object.defineProperty(tg,"__esModule",{value:!0});WU(R4e(),tg);WU(j4e(),tg);WU(L4e(),tg);WU(k4e(),tg);WU($4e(),tg)});var Ofe=b(q4e=>{"use strict";Object.defineProperty(q4e,"__esModule",{value:!0})});var U4e=b(FI=>{"use strict";var EYt=FI&&FI.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),PYt=FI&&FI.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&EYt(t,e,r)};Object.defineProperty(FI,"__esModule",{value:!0});PYt(Ofe(),FI)});var H4e=b(pE=>{"use strict";var TYt=pE&&pE.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),z4e=pE&&pE.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&TYt(t,e,r)};Object.defineProperty(pE,"__esModule",{value:!0});z4e(Cfe(),pE);z4e(U4e(),pE)});var V4e=b(rW=>{"use strict";Object.defineProperty(rW,"__esModule",{value:!0});rW.BaseType=void 0;rW.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var W4e=b(nW=>{"use strict";Object.defineProperty(nW,"__esModule",{value:!0});nW.Strategy=void 0;nW.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var G4e=b(J4e=>{"use strict";Object.defineProperty(J4e,"__esModule",{value:!0})});var Y4e=b(K4e=>{"use strict";Object.defineProperty(K4e,"__esModule",{value:!0})});var X4e=b(Z4e=>{"use strict";Object.defineProperty(Z4e,"__esModule",{value:!0})});var e3e=b(Q4e=>{"use strict";Object.defineProperty(Q4e,"__esModule",{value:!0})});var t3e=b(oW=>{"use strict";Object.defineProperty(oW,"__esModule",{value:!0});oW.Status=void 0;oW.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 n3e=b(r3e=>{"use strict";Object.defineProperty(r3e,"__esModule",{value:!0})});var i3e=b(o3e=>{"use strict";Object.defineProperty(o3e,"__esModule",{value:!0})});var s3e=b(a3e=>{"use strict";Object.defineProperty(a3e,"__esModule",{value:!0})});var l3e=b(u3e=>{"use strict";Object.defineProperty(u3e,"__esModule",{value:!0})});var d3e=b(c3e=>{"use strict";Object.defineProperty(c3e,"__esModule",{value:!0})});var p3e=b(f3e=>{"use strict";Object.defineProperty(f3e,"__esModule",{value:!0})});var m3e=b(h3e=>{"use strict";Object.defineProperty(h3e,"__esModule",{value:!0})});var y3e=b(g3e=>{"use strict";Object.defineProperty(g3e,"__esModule",{value:!0})});var _3e=b(b3e=>{"use strict";Object.defineProperty(b3e,"__esModule",{value:!0})});var w3e=b(v3e=>{"use strict";Object.defineProperty(v3e,"__esModule",{value:!0})});var Efe=b(oa=>{"use strict";var MYt=oa&&oa.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Vl=oa&&oa.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&MYt(t,e,r)};Object.defineProperty(oa,"__esModule",{value:!0});Vl(V4e(),oa);Vl(W4e(),oa);Vl(G4e(),oa);Vl(Y4e(),oa);Vl(X4e(),oa);Vl(e3e(),oa);Vl(t3e(),oa);Vl(n3e(),oa);Vl(i3e(),oa);Vl(s3e(),oa);Vl(l3e(),oa);Vl(d3e(),oa);Vl(p3e(),oa);Vl(m3e(),oa);Vl(y3e(),oa);Vl(_3e(),oa);Vl(w3e(),oa)});var S3e=b(kI=>{"use strict";var IYt=kI&&kI.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),AYt=kI&&kI.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&IYt(t,e,r)};Object.defineProperty(kI,"__esModule",{value:!0});AYt(Efe(),kI)});var C3e=b(dp=>{"use strict";var x3e=dp&&dp.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),RYt=dp&&dp.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),DYt=dp&&dp.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&x3e(t,e,r);return RYt(t,e),t},jYt=dp&&dp.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&x3e(t,e,r)};Object.defineProperty(dp,"__esModule",{value:!0});dp.finetuning=void 0;dp.finetuning=DYt(S3e());jYt(Efe(),dp)});var Pfe=b(O3e=>{"use strict";Object.defineProperty(O3e,"__esModule",{value:!0})});var E3e=b(BI=>{"use strict";var NYt=BI&&BI.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),LYt=BI&&BI.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&NYt(t,e,r)};Object.defineProperty(BI,"__esModule",{value:!0});LYt(Pfe(),BI)});var T3e=b(hE=>{"use strict";var FYt=hE&&hE.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),P3e=hE&&hE.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&FYt(t,e,r)};Object.defineProperty(hE,"__esModule",{value:!0});P3e(C3e(),hE);P3e(E3e(),hE)});var Tfe=b(M3e=>{"use strict";Object.defineProperty(M3e,"__esModule",{value:!0})});var I3e=b($I=>{"use strict";var kYt=$I&&$I.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),BYt=$I&&$I.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&kYt(t,e,r)};Object.defineProperty($I,"__esModule",{value:!0});BYt(Tfe(),$I)});var A3e=b(qI=>{"use strict";var $Yt=qI&&qI.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),qYt=qI&&qI.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&$Yt(t,e,r)};Object.defineProperty(qI,"__esModule",{value:!0});qYt(I3e(),qI)});var Mfe=b(R3e=>{"use strict";Object.defineProperty(R3e,"__esModule",{value:!0})});var D3e=b(UI=>{"use strict";var UYt=UI&&UI.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),zYt=UI&&UI.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&UYt(t,e,r)};Object.defineProperty(UI,"__esModule",{value:!0});zYt(Mfe(),UI)});var j3e=b(zI=>{"use strict";var HYt=zI&&zI.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),VYt=zI&&zI.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&HYt(t,e,r)};Object.defineProperty(zI,"__esModule",{value:!0});VYt(D3e(),zI)});var L3e=b(bo=>{"use strict";var N3e=bo&&bo.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),WYt=bo&&bo.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),eN=bo&&bo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&N3e(t,e,r);return WYt(t,e),t},tx=bo&&bo.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&N3e(t,e,r)};Object.defineProperty(bo,"__esModule",{value:!0});bo.models=bo.connectors=bo.finetuning=bo.datasets=bo.embedJobs=bo.v2=void 0;bo.v2=eN(O4e());tx(vfe(),bo);bo.embedJobs=eN(I4e());tx(Sfe(),bo);bo.datasets=eN(H4e());tx(Cfe(),bo);bo.finetuning=eN(T3e());bo.connectors=eN(A3e());bo.models=eN(j3e());tx(wfe(),bo);tx(xfe(),bo);tx(Ofe(),bo);tx(Tfe(),bo);tx(Mfe(),bo);tx(Pfe(),bo)});var F3e=b(iW=>{"use strict";Object.defineProperty(iW,"__esModule",{value:!0});iW.ChatStreamRequestPromptTruncation=void 0;iW.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var k3e=b(aW=>{"use strict";Object.defineProperty(aW,"__esModule",{value:!0});aW.ChatStreamRequestCitationQuality=void 0;aW.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var $3e=b(B3e=>{"use strict";Object.defineProperty(B3e,"__esModule",{value:!0})});var q3e=b(sW=>{"use strict";Object.defineProperty(sW,"__esModule",{value:!0});sW.ChatStreamRequestSafetyMode=void 0;sW.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var z3e=b(U3e=>{"use strict";Object.defineProperty(U3e,"__esModule",{value:!0})});var V3e=b(H3e=>{"use strict";Object.defineProperty(H3e,"__esModule",{value:!0})});var J3e=b(W3e=>{"use strict";Object.defineProperty(W3e,"__esModule",{value:!0})});var K3e=b(G3e=>{"use strict";Object.defineProperty(G3e,"__esModule",{value:!0})});var Z3e=b(Y3e=>{"use strict";Object.defineProperty(Y3e,"__esModule",{value:!0})});var X3e=b(uW=>{"use strict";Object.defineProperty(uW,"__esModule",{value:!0});uW.ChatRequestPromptTruncation=void 0;uW.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var Q3e=b(lW=>{"use strict";Object.defineProperty(lW,"__esModule",{value:!0});lW.ChatRequestCitationQuality=void 0;lW.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var t8e=b(e8e=>{"use strict";Object.defineProperty(e8e,"__esModule",{value:!0})});var r8e=b(cW=>{"use strict";Object.defineProperty(cW,"__esModule",{value:!0});cW.ChatRequestSafetyMode=void 0;cW.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var n8e=b(dW=>{"use strict";Object.defineProperty(dW,"__esModule",{value:!0});dW.GenerateStreamRequestTruncate=void 0;dW.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var o8e=b(fW=>{"use strict";Object.defineProperty(fW,"__esModule",{value:!0});fW.GenerateStreamRequestReturnLikelihoods=void 0;fW.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var i8e=b(pW=>{"use strict";Object.defineProperty(pW,"__esModule",{value:!0});pW.GenerateRequestTruncate=void 0;pW.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var a8e=b(hW=>{"use strict";Object.defineProperty(hW,"__esModule",{value:!0});hW.GenerateRequestReturnLikelihoods=void 0;hW.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var s8e=b(mW=>{"use strict";Object.defineProperty(mW,"__esModule",{value:!0});mW.EmbedRequestTruncate=void 0;mW.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var l8e=b(u8e=>{"use strict";Object.defineProperty(u8e,"__esModule",{value:!0})});var d8e=b(c8e=>{"use strict";Object.defineProperty(c8e,"__esModule",{value:!0})});var p8e=b(f8e=>{"use strict";Object.defineProperty(f8e,"__esModule",{value:!0})});var m8e=b(h8e=>{"use strict";Object.defineProperty(h8e,"__esModule",{value:!0})});var y8e=b(g8e=>{"use strict";Object.defineProperty(g8e,"__esModule",{value:!0})});var b8e=b(gW=>{"use strict";Object.defineProperty(gW,"__esModule",{value:!0});gW.ClassifyRequestTruncate=void 0;gW.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var v8e=b(_8e=>{"use strict";Object.defineProperty(_8e,"__esModule",{value:!0})});var w8e=b(yW=>{"use strict";Object.defineProperty(yW,"__esModule",{value:!0});yW.ClassifyResponseClassificationsItemClassificationType=void 0;yW.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var x8e=b(S8e=>{"use strict";Object.defineProperty(S8e,"__esModule",{value:!0})});var O8e=b(C8e=>{"use strict";Object.defineProperty(C8e,"__esModule",{value:!0})});var E8e=b(bW=>{"use strict";Object.defineProperty(bW,"__esModule",{value:!0});bW.SummarizeRequestLength=void 0;bW.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var P8e=b(_W=>{"use strict";Object.defineProperty(_W,"__esModule",{value:!0});_W.SummarizeRequestFormat=void 0;_W.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var T8e=b(vW=>{"use strict";Object.defineProperty(vW,"__esModule",{value:!0});vW.SummarizeRequestExtractiveness=void 0;vW.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var I8e=b(M8e=>{"use strict";Object.defineProperty(M8e,"__esModule",{value:!0})});var R8e=b(A8e=>{"use strict";Object.defineProperty(A8e,"__esModule",{value:!0})});var j8e=b(D8e=>{"use strict";Object.defineProperty(D8e,"__esModule",{value:!0})});var L8e=b(N8e=>{"use strict";Object.defineProperty(N8e,"__esModule",{value:!0})});var k8e=b(F8e=>{"use strict";Object.defineProperty(F8e,"__esModule",{value:!0})});var $8e=b(B8e=>{"use strict";Object.defineProperty(B8e,"__esModule",{value:!0})});var U8e=b(q8e=>{"use strict";Object.defineProperty(q8e,"__esModule",{value:!0})});var H8e=b(z8e=>{"use strict";Object.defineProperty(z8e,"__esModule",{value:!0})});var W8e=b(V8e=>{"use strict";Object.defineProperty(V8e,"__esModule",{value:!0})});var G8e=b(J8e=>{"use strict";Object.defineProperty(J8e,"__esModule",{value:!0})});var Y8e=b(K8e=>{"use strict";Object.defineProperty(K8e,"__esModule",{value:!0})});var X8e=b(Z8e=>{"use strict";Object.defineProperty(Z8e,"__esModule",{value:!0})});var eHe=b(Q8e=>{"use strict";Object.defineProperty(Q8e,"__esModule",{value:!0})});var rHe=b(tHe=>{"use strict";Object.defineProperty(tHe,"__esModule",{value:!0})});var oHe=b(nHe=>{"use strict";Object.defineProperty(nHe,"__esModule",{value:!0})});var aHe=b(iHe=>{"use strict";Object.defineProperty(iHe,"__esModule",{value:!0})});var uHe=b(sHe=>{"use strict";Object.defineProperty(sHe,"__esModule",{value:!0})});var cHe=b(lHe=>{"use strict";Object.defineProperty(lHe,"__esModule",{value:!0})});var fHe=b(dHe=>{"use strict";Object.defineProperty(dHe,"__esModule",{value:!0})});var hHe=b(pHe=>{"use strict";Object.defineProperty(pHe,"__esModule",{value:!0})});var mHe=b(wW=>{"use strict";Object.defineProperty(wW,"__esModule",{value:!0});wW.FinishReason=void 0;wW.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var yHe=b(gHe=>{"use strict";Object.defineProperty(gHe,"__esModule",{value:!0})});var _He=b(bHe=>{"use strict";Object.defineProperty(bHe,"__esModule",{value:!0})});var wHe=b(vHe=>{"use strict";Object.defineProperty(vHe,"__esModule",{value:!0})});var xHe=b(SHe=>{"use strict";Object.defineProperty(SHe,"__esModule",{value:!0})});var OHe=b(CHe=>{"use strict";Object.defineProperty(CHe,"__esModule",{value:!0})});var PHe=b(EHe=>{"use strict";Object.defineProperty(EHe,"__esModule",{value:!0})});var MHe=b(THe=>{"use strict";Object.defineProperty(THe,"__esModule",{value:!0})});var AHe=b(IHe=>{"use strict";Object.defineProperty(IHe,"__esModule",{value:!0})});var DHe=b(RHe=>{"use strict";Object.defineProperty(RHe,"__esModule",{value:!0})});var NHe=b(jHe=>{"use strict";Object.defineProperty(jHe,"__esModule",{value:!0})});var FHe=b(LHe=>{"use strict";Object.defineProperty(LHe,"__esModule",{value:!0})});var BHe=b(kHe=>{"use strict";Object.defineProperty(kHe,"__esModule",{value:!0})});var $He=b(SW=>{"use strict";Object.defineProperty(SW,"__esModule",{value:!0});SW.ChatStreamEndEventFinishReason=void 0;SW.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var UHe=b(qHe=>{"use strict";Object.defineProperty(qHe,"__esModule",{value:!0})});var HHe=b(zHe=>{"use strict";Object.defineProperty(zHe,"__esModule",{value:!0})});var WHe=b(VHe=>{"use strict";Object.defineProperty(VHe,"__esModule",{value:!0})});var GHe=b(JHe=>{"use strict";Object.defineProperty(JHe,"__esModule",{value:!0})});var YHe=b(KHe=>{"use strict";Object.defineProperty(KHe,"__esModule",{value:!0})});var XHe=b(ZHe=>{"use strict";Object.defineProperty(ZHe,"__esModule",{value:!0})});var e6e=b(QHe=>{"use strict";Object.defineProperty(QHe,"__esModule",{value:!0})});var r6e=b(t6e=>{"use strict";Object.defineProperty(t6e,"__esModule",{value:!0})});var o6e=b(n6e=>{"use strict";Object.defineProperty(n6e,"__esModule",{value:!0})});var a6e=b(i6e=>{"use strict";Object.defineProperty(i6e,"__esModule",{value:!0})});var u6e=b(s6e=>{"use strict";Object.defineProperty(s6e,"__esModule",{value:!0})});var c6e=b(l6e=>{"use strict";Object.defineProperty(l6e,"__esModule",{value:!0})});var f6e=b(d6e=>{"use strict";Object.defineProperty(d6e,"__esModule",{value:!0})});var h6e=b(p6e=>{"use strict";Object.defineProperty(p6e,"__esModule",{value:!0})});var g6e=b(m6e=>{"use strict";Object.defineProperty(m6e,"__esModule",{value:!0})});var b6e=b(y6e=>{"use strict";Object.defineProperty(y6e,"__esModule",{value:!0})});var v6e=b(_6e=>{"use strict";Object.defineProperty(_6e,"__esModule",{value:!0})});var S6e=b(w6e=>{"use strict";Object.defineProperty(w6e,"__esModule",{value:!0})});var C6e=b(x6e=>{"use strict";Object.defineProperty(x6e,"__esModule",{value:!0})});var E6e=b(O6e=>{"use strict";Object.defineProperty(O6e,"__esModule",{value:!0})});var P6e=b(xW=>{"use strict";Object.defineProperty(xW,"__esModule",{value:!0});xW.EmbedInputType=void 0;xW.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering"}});var T6e=b(CW=>{"use strict";Object.defineProperty(CW,"__esModule",{value:!0});CW.EmbeddingType=void 0;CW.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"}});var I6e=b(M6e=>{"use strict";Object.defineProperty(M6e,"__esModule",{value:!0})});var R6e=b(A6e=>{"use strict";Object.defineProperty(A6e,"__esModule",{value:!0})});var j6e=b(D6e=>{"use strict";Object.defineProperty(D6e,"__esModule",{value:!0})});var N6e=b(OW=>{"use strict";Object.defineProperty(OW,"__esModule",{value:!0});OW.EmbedJobStatus=void 0;OW.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var L6e=b(EW=>{"use strict";Object.defineProperty(EW,"__esModule",{value:!0});EW.EmbedJobTruncate=void 0;EW.EmbedJobTruncate={Start:"START",End:"END"}});var k6e=b(F6e=>{"use strict";Object.defineProperty(F6e,"__esModule",{value:!0})});var $6e=b(B6e=>{"use strict";Object.defineProperty(B6e,"__esModule",{value:!0})});var U6e=b(q6e=>{"use strict";Object.defineProperty(q6e,"__esModule",{value:!0})});var H6e=b(z6e=>{"use strict";Object.defineProperty(z6e,"__esModule",{value:!0})});var W6e=b(V6e=>{"use strict";Object.defineProperty(V6e,"__esModule",{value:!0})});var J6e=b(PW=>{"use strict";Object.defineProperty(PW,"__esModule",{value:!0});PW.DatasetValidationStatus=void 0;PW.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var G6e=b(TW=>{"use strict";Object.defineProperty(TW,"__esModule",{value:!0});TW.DatasetType=void 0;TW.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 Y6e=b(K6e=>{"use strict";Object.defineProperty(K6e,"__esModule",{value:!0})});var X6e=b(Z6e=>{"use strict";Object.defineProperty(Z6e,"__esModule",{value:!0})});var eVe=b(Q6e=>{"use strict";Object.defineProperty(Q6e,"__esModule",{value:!0})});var rVe=b(tVe=>{"use strict";Object.defineProperty(tVe,"__esModule",{value:!0})});var oVe=b(nVe=>{"use strict";Object.defineProperty(nVe,"__esModule",{value:!0})});var aVe=b(iVe=>{"use strict";Object.defineProperty(iVe,"__esModule",{value:!0})});var uVe=b(sVe=>{"use strict";Object.defineProperty(sVe,"__esModule",{value:!0})});var cVe=b(lVe=>{"use strict";Object.defineProperty(lVe,"__esModule",{value:!0})});var fVe=b(dVe=>{"use strict";Object.defineProperty(dVe,"__esModule",{value:!0})});var hVe=b(pVe=>{"use strict";Object.defineProperty(pVe,"__esModule",{value:!0})});var gVe=b(mVe=>{"use strict";Object.defineProperty(mVe,"__esModule",{value:!0})});var bVe=b(yVe=>{"use strict";Object.defineProperty(yVe,"__esModule",{value:!0})});var _Ve=b(MW=>{"use strict";Object.defineProperty(MW,"__esModule",{value:!0});MW.ConnectorAuthStatus=void 0;MW.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var wVe=b(vVe=>{"use strict";Object.defineProperty(vVe,"__esModule",{value:!0})});var xVe=b(SVe=>{"use strict";Object.defineProperty(SVe,"__esModule",{value:!0})});var OVe=b(CVe=>{"use strict";Object.defineProperty(CVe,"__esModule",{value:!0})});var EVe=b(IW=>{"use strict";Object.defineProperty(IW,"__esModule",{value:!0});IW.AuthTokenType=void 0;IW.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var TVe=b(PVe=>{"use strict";Object.defineProperty(PVe,"__esModule",{value:!0})});var IVe=b(MVe=>{"use strict";Object.defineProperty(MVe,"__esModule",{value:!0})});var RVe=b(AVe=>{"use strict";Object.defineProperty(AVe,"__esModule",{value:!0})});var jVe=b(DVe=>{"use strict";Object.defineProperty(DVe,"__esModule",{value:!0})});var LVe=b(NVe=>{"use strict";Object.defineProperty(NVe,"__esModule",{value:!0})});var kVe=b(FVe=>{"use strict";Object.defineProperty(FVe,"__esModule",{value:!0})});var BVe=b(AW=>{"use strict";Object.defineProperty(AW,"__esModule",{value:!0});AW.CompatibleEndpoint=void 0;AW.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var qVe=b($Ve=>{"use strict";Object.defineProperty($Ve,"__esModule",{value:!0})});var zVe=b(UVe=>{"use strict";Object.defineProperty(UVe,"__esModule",{value:!0})});var HVe=b(oe=>{"use strict";var JYt=oe&&oe.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),de=oe&&oe.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&JYt(t,e,r)};Object.defineProperty(oe,"__esModule",{value:!0});de(F3e(),oe);de(k3e(),oe);de($3e(),oe);de(q3e(),oe);de(z3e(),oe);de(V3e(),oe);de(J3e(),oe);de(K3e(),oe);de(Z3e(),oe);de(X3e(),oe);de(Q3e(),oe);de(t8e(),oe);de(r8e(),oe);de(n8e(),oe);de(o8e(),oe);de(i8e(),oe);de(a8e(),oe);de(s8e(),oe);de(l8e(),oe);de(d8e(),oe);de(p8e(),oe);de(m8e(),oe);de(y8e(),oe);de(b8e(),oe);de(v8e(),oe);de(w8e(),oe);de(x8e(),oe);de(O8e(),oe);de(E8e(),oe);de(P8e(),oe);de(T8e(),oe);de(I8e(),oe);de(R8e(),oe);de(j8e(),oe);de(L8e(),oe);de(k8e(),oe);de($8e(),oe);de(U8e(),oe);de(H8e(),oe);de(W8e(),oe);de(G8e(),oe);de(Y8e(),oe);de(X8e(),oe);de(eHe(),oe);de(rHe(),oe);de(oHe(),oe);de(aHe(),oe);de(uHe(),oe);de(cHe(),oe);de(fHe(),oe);de(hHe(),oe);de(mHe(),oe);de(yHe(),oe);de(_He(),oe);de(wHe(),oe);de(xHe(),oe);de(OHe(),oe);de(PHe(),oe);de(MHe(),oe);de(AHe(),oe);de(DHe(),oe);de(NHe(),oe);de(FHe(),oe);de(BHe(),oe);de($He(),oe);de(UHe(),oe);de(HHe(),oe);de(WHe(),oe);de(GHe(),oe);de(YHe(),oe);de(XHe(),oe);de(e6e(),oe);de(r6e(),oe);de(o6e(),oe);de(a6e(),oe);de(u6e(),oe);de(c6e(),oe);de(f6e(),oe);de(h6e(),oe);de(g6e(),oe);de(b6e(),oe);de(v6e(),oe);de(S6e(),oe);de(C6e(),oe);de(E6e(),oe);de(P6e(),oe);de(T6e(),oe);de(I6e(),oe);de(R6e(),oe);de(j6e(),oe);de(N6e(),oe);de(L6e(),oe);de(k6e(),oe);de($6e(),oe);de(U6e(),oe);de(H6e(),oe);de(W6e(),oe);de(J6e(),oe);de(G6e(),oe);de(Y6e(),oe);de(X6e(),oe);de(eVe(),oe);de(rVe(),oe);de(oVe(),oe);de(aVe(),oe);de(uVe(),oe);de(cVe(),oe);de(fVe(),oe);de(hVe(),oe);de(gVe(),oe);de(bVe(),oe);de(_Ve(),oe);de(wVe(),oe);de(xVe(),oe);de(OVe(),oe);de(EVe(),oe);de(TVe(),oe);de(IVe(),oe);de(RVe(),oe);de(jVe(),oe);de(LVe(),oe);de(kVe(),oe);de(BVe(),oe);de(qVe(),oe);de(zVe(),oe)});var VVe=b(RW=>{"use strict";Object.defineProperty(RW,"__esModule",{value:!0});RW.CohereError=void 0;var Ife=class e extends Error{constructor({message:t,statusCode:r,body:n}){super(GYt({message:t,statusCode:r,body:n})),Object.setPrototypeOf(this,e.prototype),r!=null&&(this.statusCode=r),n!==void 0&&(this.body=n)}};RW.CohereError=Ife;function GYt({message:e,statusCode:t,body:r}){let n=[];return e!=null&&n.push(e),t!=null&&n.push(`Status code: ${t.toString()}`),r!=null&&n.push(`Body: ${JSON.stringify(r,void 0,2)}`),n.join(`
`)}});var WVe=b(DW=>{"use strict";Object.defineProperty(DW,"__esModule",{value:!0});DW.CohereTimeoutError=void 0;var Afe=class e extends Error{constructor(){super("Timeout"),Object.setPrototypeOf(this,e.prototype)}};DW.CohereTimeoutError=Afe});var Wa=b(tN=>{"use strict";Object.defineProperty(tN,"__esModule",{value:!0});tN.CohereTimeoutError=tN.CohereError=void 0;var KYt=VVe();Object.defineProperty(tN,"CohereError",{enumerable:!0,get:function(){return KYt.CohereError}});var YYt=WVe();Object.defineProperty(tN,"CohereTimeoutError",{enumerable:!0,get:function(){return YYt.CohereTimeoutError}})});var JVe=b(Oy=>{"use strict";var ZYt=Oy&&Oy.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),XYt=Oy&&Oy.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),QYt=Oy&&Oy.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ZYt(t,e,r);return XYt(t,e),t};Object.defineProperty(Oy,"__esModule",{value:!0});Oy.BadRequestError=void 0;var eZt=QYt(Wa()),Rfe=class e extends eZt.CohereError{constructor(t){super({message:"BadRequestError",statusCode:400,body:t}),Object.setPrototypeOf(this,e.prototype)}};Oy.BadRequestError=Rfe});var GVe=b(Ey=>{"use strict";var tZt=Ey&&Ey.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),rZt=Ey&&Ey.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),nZt=Ey&&Ey.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&tZt(t,e,r);return rZt(t,e),t};Object.defineProperty(Ey,"__esModule",{value:!0});Ey.UnauthorizedError=void 0;var oZt=nZt(Wa()),Dfe=class e extends oZt.CohereError{constructor(t){super({message:"UnauthorizedError",statusCode:401,body:t}),Object.setPrototypeOf(this,e.prototype)}};Ey.UnauthorizedError=Dfe});var KVe=b(Py=>{"use strict";var iZt=Py&&Py.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),aZt=Py&&Py.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),sZt=Py&&Py.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&iZt(t,e,r);return aZt(t,e),t};Object.defineProperty(Py,"__esModule",{value:!0});Py.ForbiddenError=void 0;var uZt=sZt(Wa()),jfe=class e extends uZt.CohereError{constructor(t){super({message:"ForbiddenError",statusCode:403,body:t}),Object.setPrototypeOf(this,e.prototype)}};Py.ForbiddenError=jfe});var YVe=b(Ty=>{"use strict";var lZt=Ty&&Ty.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),cZt=Ty&&Ty.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),dZt=Ty&&Ty.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&lZt(t,e,r);return cZt(t,e),t};Object.defineProperty(Ty,"__esModule",{value:!0});Ty.NotFoundError=void 0;var fZt=dZt(Wa()),Nfe=class e extends fZt.CohereError{constructor(t){super({message:"NotFoundError",statusCode:404,body:t}),Object.setPrototypeOf(this,e.prototype)}};Ty.NotFoundError=Nfe});var ZVe=b(My=>{"use strict";var pZt=My&&My.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hZt=My&&My.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),mZt=My&&My.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&pZt(t,e,r);return hZt(t,e),t};Object.defineProperty(My,"__esModule",{value:!0});My.UnprocessableEntityError=void 0;var gZt=mZt(Wa()),Lfe=class e extends gZt.CohereError{constructor(t){super({message:"UnprocessableEntityError",statusCode:422,body:t}),Object.setPrototypeOf(this,e.prototype)}};My.UnprocessableEntityError=Lfe});var XVe=b(Iy=>{"use strict";var yZt=Iy&&Iy.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),bZt=Iy&&Iy.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_Zt=Iy&&Iy.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&yZt(t,e,r);return bZt(t,e),t};Object.defineProperty(Iy,"__esModule",{value:!0});Iy.TooManyRequestsError=void 0;var vZt=_Zt(Wa()),Ffe=class e extends vZt.CohereError{constructor(t){super({message:"TooManyRequestsError",statusCode:429,body:t}),Object.setPrototypeOf(this,e.prototype)}};Iy.TooManyRequestsError=Ffe});var QVe=b(Ay=>{"use strict";var wZt=Ay&&Ay.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),SZt=Ay&&Ay.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),xZt=Ay&&Ay.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&wZt(t,e,r);return SZt(t,e),t};Object.defineProperty(Ay,"__esModule",{value:!0});Ay.ClientClosedRequestError=void 0;var CZt=xZt(Wa()),kfe=class e extends CZt.CohereError{constructor(t){super({message:"ClientClosedRequestError",statusCode:499,body:t}),Object.setPrototypeOf(this,e.prototype)}};Ay.ClientClosedRequestError=kfe});var e5e=b(Ry=>{"use strict";var OZt=Ry&&Ry.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),EZt=Ry&&Ry.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),PZt=Ry&&Ry.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&OZt(t,e,r);return EZt(t,e),t};Object.defineProperty(Ry,"__esModule",{value:!0});Ry.InternalServerError=void 0;var TZt=PZt(Wa()),Bfe=class e extends TZt.CohereError{constructor(t){super({message:"InternalServerError",statusCode:500,body:t}),Object.setPrototypeOf(this,e.prototype)}};Ry.InternalServerError=Bfe});var t5e=b(Dy=>{"use strict";var MZt=Dy&&Dy.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),IZt=Dy&&Dy.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),AZt=Dy&&Dy.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&MZt(t,e,r);return IZt(t,e),t};Object.defineProperty(Dy,"__esModule",{value:!0});Dy.NotImplementedError=void 0;var RZt=AZt(Wa()),$fe=class e extends RZt.CohereError{constructor(t){super({message:"NotImplementedError",statusCode:501,body:t}),Object.setPrototypeOf(this,e.prototype)}};Dy.NotImplementedError=$fe});var r5e=b(jy=>{"use strict";var DZt=jy&&jy.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),jZt=jy&&jy.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),NZt=jy&&jy.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&DZt(t,e,r);return jZt(t,e),t};Object.defineProperty(jy,"__esModule",{value:!0});jy.ServiceUnavailableError=void 0;var LZt=NZt(Wa()),qfe=class e extends LZt.CohereError{constructor(t){super({message:"ServiceUnavailableError",statusCode:503,body:t}),Object.setPrototypeOf(this,e.prototype)}};jy.ServiceUnavailableError=qfe});var n5e=b(Ny=>{"use strict";var FZt=Ny&&Ny.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),kZt=Ny&&Ny.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),BZt=Ny&&Ny.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&FZt(t,e,r);return kZt(t,e),t};Object.defineProperty(Ny,"__esModule",{value:!0});Ny.GatewayTimeoutError=void 0;var $Zt=BZt(Wa()),Ufe=class e extends $Zt.CohereError{constructor(t){super({message:"GatewayTimeoutError",statusCode:504,body:t}),Object.setPrototypeOf(this,e.prototype)}};Ny.GatewayTimeoutError=Ufe});var o5e=b(Wl=>{"use strict";var qZt=Wl&&Wl.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),rg=Wl&&Wl.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&qZt(t,e,r)};Object.defineProperty(Wl,"__esModule",{value:!0});rg(JVe(),Wl);rg(GVe(),Wl);rg(KVe(),Wl);rg(YVe(),Wl);rg(ZVe(),Wl);rg(XVe(),Wl);rg(QVe(),Wl);rg(e5e(),Wl);rg(t5e(),Wl);rg(r5e(),Wl);rg(n5e(),Wl)});var a5e=b(i5e=>{"use strict";Object.defineProperty(i5e,"__esModule",{value:!0})});var s5e=b(HI=>{"use strict";var UZt=HI&&HI.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),zZt=HI&&HI.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&UZt(t,e,r)};Object.defineProperty(HI,"__esModule",{value:!0});zZt(a5e(),HI)});var rx=b(Ly=>{"use strict";var HZt=Ly&&Ly.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),jW=Ly&&Ly.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&HZt(t,e,r)};Object.defineProperty(Ly,"__esModule",{value:!0});jW(L3e(),Ly);jW(HVe(),Ly);jW(o5e(),Ly);jW(s5e(),Ly)});var Vfe={};Yd(Vfe,{__addDisposableResource:()=>T5e,__assign:()=>NW,__asyncDelegator:()=>v5e,__asyncGenerator:()=>_5e,__asyncValues:()=>w5e,__await:()=>rN,__awaiter:()=>p5e,__classPrivateFieldGet:()=>O5e,__classPrivateFieldIn:()=>P5e,__classPrivateFieldSet:()=>E5e,__createBinding:()=>FW,__decorate:()=>c5e,__disposeResources:()=>M5e,__esDecorate:()=>VZt,__exportStar:()=>m5e,__extends:()=>u5e,__generator:()=>h5e,__importDefault:()=>C5e,__importStar:()=>x5e,__makeTemplateObject:()=>S5e,__metadata:()=>f5e,__param:()=>d5e,__propKey:()=>JZt,__read:()=>Hfe,__rest:()=>l5e,__runInitializers:()=>WZt,__setFunctionName:()=>GZt,__spread:()=>g5e,__spreadArray:()=>b5e,__spreadArrays:()=>y5e,__values:()=>LW,default:()=>ZZt});function u5e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");zfe(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function l5e(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function c5e(e,t,r,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i}function d5e(e,t){return function(r,n){t(r,n,e)}}function VZt(e,t,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=!t&&e?n.static?e:e.prototype:null,c=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var _=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],h);if(s==="accessor"){if(_===void 0)continue;if(_===null||typeof _!="object")throw new TypeError("Object expected");(d=a(_.get))&&(c.get=d),(d=a(_.set))&&(c.set=d),(d=a(_.init))&&o.unshift(d)}else(d=a(_))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function WZt(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function JZt(e){return typeof e=="symbol"?e:"".concat(e)}function GZt(e,t,r){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function f5e(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function p5e(e,t,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(e,t||[])).next())})}function h5e(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function m5e(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&FW(t,e,r)}function LW(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Hfe(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >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 g5e(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Hfe(arguments[t]));return e}function y5e(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),o=0,t=0;t<r;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function b5e(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function rN(e){return this instanceof rN?(this.v=e,this):new rN(e)}function _5e(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(h){return Promise.resolve(h).then(p,d)}}function s(p,h){n[p]&&(o[p]=function(m){return new Promise(function(_,g){i.push([p,m,_,g])>1||u(p,m)})},h&&(o[p]=h(o[p])))}function u(p,h){try{l(n[p](h))}catch(m){f(i[0][3],m)}}function l(p){p.value instanceof rN?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,h){p(h),i.shift(),i.length&&u(i[0][0],i[0][1])}}function v5e(e){var t,r;return t={},n("next"),n("throw",function(o){throw o}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(o,i){t[o]=e[o]?function(a){return(r=!r)?{value:rN(e[o](a)),done:!1}:i?i(a):a}:i}}function w5e(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof LW=="function"?LW(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,u){a=e[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 S5e(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function x5e(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&FW(t,e,r);return KZt(t,e),t}function C5e(e){return e&&e.__esModule?e:{default:e}}function O5e(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}function E5e(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r}function P5e(e,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof e=="function"?t===e:e.has(t)}function T5e(e,t,r){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[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)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}function M5e(e){function t(i){e.error=e.hasError?new YZt(i,e.error,"An error was suppressed during disposal."):i,e.hasError=!0}var r,n=0;function o(){for(;r=e.stack.pop();)try{if(!r.async&&n===1)return n=0,e.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 t(a),o()})}else n|=1}catch(a){t(a)}if(n===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return o()}var zfe,NW,FW,KZt,YZt,ZZt,Wfe=C(()=>{zfe=function(e,t){return zfe=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])},zfe(e,t)};NW=function(){return NW=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},NW.apply(this,arguments)};FW=Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]};KZt=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};YZt=typeof SuppressedError=="function"?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};ZZt={__extends:u5e,__assign:NW,__rest:l5e,__decorate:c5e,__param:d5e,__metadata:f5e,__awaiter:p5e,__generator:h5e,__createBinding:FW,__exportStar:m5e,__values:LW,__read:Hfe,__spread:g5e,__spreadArrays:y5e,__spreadArray:b5e,__await:rN,__asyncGenerator:_5e,__asyncDelegator:v5e,__asyncValues:w5e,__makeTemplateObject:S5e,__importStar:x5e,__importDefault:C5e,__classPrivateFieldGet:O5e,__classPrivateFieldSet:E5e,__classPrivateFieldIn:P5e,__addDisposableResource:T5e,__disposeResources:M5e}});var Jfe=b(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});_h.MAX_HASHABLE_LENGTH=_h.INIT=_h.KEY=_h.DIGEST_LENGTH=_h.BLOCK_SIZE=void 0;_h.BLOCK_SIZE=64;_h.DIGEST_LENGTH=32;_h.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]);_h.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];_h.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var I5e=b(kW=>{"use strict";Object.defineProperty(kW,"__esModule",{value:!0});kW.RawSha256=void 0;var vh=Jfe(),XZt=function(){function e(){this.state=Int32Array.from(vh.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(t){if(this.finished)throw new Error("Attempted to update an already finished hash.");var r=0,n=t.byteLength;if(this.bytesHashed+=n,this.bytesHashed*8>vh.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=t[r++],n--,this.bufferLength===vh.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var t=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%vh.BLOCK_SIZE>=vh.BLOCK_SIZE-8){for(var o=this.bufferLength;o<vh.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<vh.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(vh.BLOCK_SIZE-8,Math.floor(t/4294967296),!0),r.setUint32(vh.BLOCK_SIZE-4,t),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(vh.DIGEST_LENGTH),o=0;o<8;o++)i[o*4]=this.state[o]>>>24&255,i[o*4+1]=this.state[o]>>>16&255,i[o*4+2]=this.state[o]>>>8&255,i[o*4+3]=this.state[o]>>>0&255;return i},e.prototype.hashBuffer=function(){for(var t=this,r=t.buffer,n=t.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<vh.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(r[f*4]&255)<<24|(r[f*4+1]&255)<<16|(r[f*4+2]&255)<<8|r[f*4+3]&255;else{var p=this.temp[f-2],h=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var m=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(m+this.temp[f-16]|0)}var _=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(vh.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+_|0,s=a,a=i,i=o,o=_+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},e}();kW.RawSha256=XZt});var D5e=b((tjn,R5e)=>{var BW=Object.defineProperty,QZt=Object.getOwnPropertyDescriptor,eXt=Object.getOwnPropertyNames,tXt=Object.prototype.hasOwnProperty,rXt=(e,t)=>BW(e,"name",{value:t,configurable:!0}),nXt=(e,t)=>{for(var r in t)BW(e,r,{get:t[r],enumerable:!0})},oXt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of eXt(t))!tXt.call(e,o)&&o!==r&&BW(e,o,{get:()=>t[o],enumerable:!(n=QZt(t,o))||n.enumerable});return e},iXt=e=>oXt(BW({},"__esModule",{value:!0}),e),A5e={};nXt(A5e,{isArrayBuffer:()=>aXt});R5e.exports=iXt(A5e);var aXt=rXt(e=>typeof ArrayBuffer=="function"&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)==="[object ArrayBuffer]","isArrayBuffer")});var F5e=b((rjn,L5e)=>{var $W=Object.defineProperty,sXt=Object.getOwnPropertyDescriptor,uXt=Object.getOwnPropertyNames,lXt=Object.prototype.hasOwnProperty,j5e=(e,t)=>$W(e,"name",{value:t,configurable:!0}),cXt=(e,t)=>{for(var r in t)$W(e,r,{get:t[r],enumerable:!0})},dXt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of uXt(t))!lXt.call(e,o)&&o!==r&&$W(e,o,{get:()=>t[o],enumerable:!(n=sXt(t,o))||n.enumerable});return e},fXt=e=>dXt($W({},"__esModule",{value:!0}),e),N5e={};cXt(N5e,{fromArrayBuffer:()=>hXt,fromString:()=>mXt});L5e.exports=fXt(N5e);var pXt=D5e(),Gfe=Td(),hXt=j5e((e,t=0,r=e.byteLength-t)=>{if(!(0,pXt.isArrayBuffer)(e))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof e} (${e})`);return Gfe.Buffer.from(e,t,r)},"fromArrayBuffer"),mXt=j5e((e,t)=>{if(typeof e!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?Gfe.Buffer.from(e,t):Gfe.Buffer.from(e)},"fromString")});var U5e=b((njn,q5e)=>{var qW=Object.defineProperty,gXt=Object.getOwnPropertyDescriptor,yXt=Object.getOwnPropertyNames,bXt=Object.prototype.hasOwnProperty,Kfe=(e,t)=>qW(e,"name",{value:t,configurable:!0}),_Xt=(e,t)=>{for(var r in t)qW(e,r,{get:t[r],enumerable:!0})},vXt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of yXt(t))!bXt.call(e,o)&&o!==r&&qW(e,o,{get:()=>t[o],enumerable:!(n=gXt(t,o))||n.enumerable});return e},wXt=e=>vXt(qW({},"__esModule",{value:!0}),e),k5e={};_Xt(k5e,{fromUtf8:()=>$5e,toUint8Array:()=>SXt,toUtf8:()=>xXt});q5e.exports=wXt(k5e);var B5e=F5e(),$5e=Kfe(e=>{let t=(0,B5e.fromString)(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),SXt=Kfe(e=>typeof e=="string"?$5e(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),"toUint8Array"),xXt=Kfe(e=>{if(typeof e=="string")return e;if(typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return(0,B5e.fromArrayBuffer)(e.buffer,e.byteOffset,e.byteLength).toString("utf8")},"toUtf8")});var z5e=b(UW=>{"use strict";Object.defineProperty(UW,"__esModule",{value:!0});UW.convertToBuffer=void 0;var CXt=U5e(),OXt=typeof Buffer<"u"&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:CXt.fromUtf8;function EXt(e){return e instanceof Uint8Array?e:typeof e=="string"?OXt(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}UW.convertToBuffer=EXt});var H5e=b(zW=>{"use strict";Object.defineProperty(zW,"__esModule",{value:!0});zW.isEmptyData=void 0;function PXt(e){return typeof e=="string"?e.length===0:e.byteLength===0}zW.isEmptyData=PXt});var V5e=b(HW=>{"use strict";Object.defineProperty(HW,"__esModule",{value:!0});HW.numToUint8=void 0;function TXt(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}HW.numToUint8=TXt});var W5e=b(VW=>{"use strict";Object.defineProperty(VW,"__esModule",{value:!0});VW.uint32ArrayFrom=void 0;function MXt(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),r=0;r<e.length;)t[r]=e[r],r+=1;return t}return Uint32Array.from(e)}VW.uint32ArrayFrom=MXt});var WW=b(Fy=>{"use strict";Object.defineProperty(Fy,"__esModule",{value:!0});Fy.uint32ArrayFrom=Fy.numToUint8=Fy.isEmptyData=Fy.convertToBuffer=void 0;var IXt=z5e();Object.defineProperty(Fy,"convertToBuffer",{enumerable:!0,get:function(){return IXt.convertToBuffer}});var AXt=H5e();Object.defineProperty(Fy,"isEmptyData",{enumerable:!0,get:function(){return AXt.isEmptyData}});var RXt=V5e();Object.defineProperty(Fy,"numToUint8",{enumerable:!0,get:function(){return RXt.numToUint8}});var DXt=W5e();Object.defineProperty(Fy,"uint32ArrayFrom",{enumerable:!0,get:function(){return DXt.uint32ArrayFrom}})});var G5e=b(KW=>{"use strict";Object.defineProperty(KW,"__esModule",{value:!0});KW.Sha256=void 0;var J5e=(Wfe(),sl(Vfe)),GW=Jfe(),JW=I5e(),Yfe=WW(),jXt=function(){function e(t){this.secret=t,this.hash=new JW.RawSha256,this.reset()}return e.prototype.update=function(t){if(!((0,Yfe.isEmptyData)(t)||this.error))try{this.hash.update((0,Yfe.convertToBuffer)(t))}catch(r){this.error=r}},e.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()},e.prototype.digest=function(){return J5e.__awaiter(this,void 0,void 0,function(){return J5e.__generator(this,function(t){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new JW.RawSha256,this.secret){this.outer=new JW.RawSha256;var t=NXt(this.secret),r=new Uint8Array(GW.BLOCK_SIZE);r.set(t);for(var n=0;n<GW.BLOCK_SIZE;n++)t[n]^=54,r[n]^=92;this.hash.update(t),this.outer.update(r);for(var n=0;n<t.byteLength;n++)t[n]=0}},e}();KW.Sha256=jXt;function NXt(e){var t=(0,Yfe.convertToBuffer)(e);if(t.byteLength>GW.BLOCK_SIZE){var r=new JW.RawSha256;r.update(t),t=r.digest()}var n=new Uint8Array(GW.BLOCK_SIZE);return n.set(t),n}});var Xfe=b(Zfe=>{"use strict";Object.defineProperty(Zfe,"__esModule",{value:!0});var LXt=(Wfe(),sl(Vfe));LXt.__exportStar(G5e(),Zfe)});var K5e=C(()=>{});var Y5e=C(()=>{});var Z5e=C(()=>{});var VI,JU=C(()=>{VI=class e extends Error{constructor(t,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(t),this.name="ProviderError",this.tryNextLink=o,Object.setPrototypeOf(this,e.prototype),n?.debug?.(`@smithy/property-provider ${o?"->":"(!)"} ${t}`)}static from(t,r=!0){return Object.assign(new this(t.message,r),t)}}});var zu,X5e=C(()=>{JU();zu=class e extends VI{constructor(t,r=!0){super(t,r),this.name="CredentialsProviderError",Object.setPrototypeOf(this,e.prototype)}}});var Q5e=C(()=>{JU()});var e9e=C(()=>{JU()});var t9e=C(()=>{});var r9e,n9e=C(()=>{r9e=(e,t,r)=>{let n,o,i,a=!1,s=async()=>{o||(o=e());try{n=await o,i=!0,a=!1}finally{o=void 0}return n};return t===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):(t(n)&&await s(),n))}});var nx=C(()=>{X5e();JU();Q5e();e9e();t9e();n9e()});function YW(e){return Promise.all(Object.keys(e).reduce((t,r)=>{let n=e[r];return typeof n=="string"?t.push([r,n]):t.push(n().then(o=>[r,o])),t},[])).then(t=>t.reduce((r,[n,o])=>(r[n]=o,r),{}))}var Qfe=C(()=>{});var o9e=C(()=>{});var i9e=C(()=>{o9e()});var a9e=C(()=>{});var s9e,u9e=C(()=>{(function(e){e.HEADER="header",e.QUERY="query"})(s9e||(s9e={}))});var epe,l9e=C(()=>{(function(e){e.HEADER="header",e.QUERY="query"})(epe||(epe={}))});var c9e=C(()=>{});var d9e=C(()=>{});var f9e=C(()=>{});var p9e=C(()=>{});var h9e=C(()=>{u9e();l9e();c9e();d9e();f9e();p9e()});var m9e=C(()=>{});var g9e=C(()=>{});var y9e=C(()=>{});var b9e=C(()=>{});var _9e=C(()=>{});var v9e=C(()=>{});var w9e=C(()=>{});var S9e=C(()=>{_9e();v9e();w9e()});var x9e=C(()=>{});var C9e=C(()=>{});var nN,O9e=C(()=>{(function(e){e.HTTP="http",e.HTTPS="https"})(nN||(nN={}))});var E9e=C(()=>{});var P9e=C(()=>{});var T9e=C(()=>{});var M9e=C(()=>{});var I9e=C(()=>{});var A9e=C(()=>{E9e();P9e();T9e();M9e();I9e()});var R9e=C(()=>{});var oN,tpe=C(()=>{(function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"})(oN||(oN={}))});var D9e=C(()=>{tpe()});var j9e=C(()=>{});var N9e=C(()=>{D9e();j9e();tpe()});var fp,L9e=C(()=>{(function(e){e[e.HEADER=0]="HEADER",e[e.TRAILER=1]="TRAILER"})(fp||(fp={}))});var F9e=C(()=>{});var k9e=C(()=>{});var B9e=C(()=>{});var $9e=C(()=>{});var q9e=C(()=>{});var U9e=C(()=>{k9e();B9e();$9e();q9e()});var z9e=C(()=>{});var iN,H9e=C(()=>{iN="__smithy_context"});var V9e=C(()=>{});var W9e,J9e=C(()=>{(function(e){e.PROFILE="profile",e.SSO_SESSION="sso-session",e.SERVICES="services"})(W9e||(W9e={}))});var G9e=C(()=>{});var K9e=C(()=>{});var Y9e=C(()=>{});var Z9e=C(()=>{});var X9e=C(()=>{});var Q9e=C(()=>{});var eWe=C(()=>{});var tWe=C(()=>{});var rWe=C(()=>{});var nWe,oWe=C(()=>{(function(e){e.HTTP_0_9="http/0.9",e.HTTP_1_0="http/1.0",e.TDS_8_0="tds/8.0"})(nWe||(nWe={}))});var iWe=C(()=>{});var aWe=C(()=>{});var sWe=C(()=>{});var uWe=C(()=>{});var lWe=C(()=>{});var cWe=C(()=>{});var ls=C(()=>{a9e();h9e();m9e();g9e();y9e();b9e();S9e();x9e();C9e();O9e();A9e();R9e();N9e();L9e();F9e();U9e();z9e();H9e();V9e();J9e();G9e();K9e();Y9e();Z9e();X9e();Q9e();eWe();tWe();rWe();oWe();iWe();aWe();sWe();uWe();lWe();cWe()});var dWe=C(()=>{ls()});var fWe=C(()=>{});var pWe=C(()=>{});function FXt(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}var ZW,hWe=C(()=>{ZW=class e{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=FXt(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}}});var mWe=C(()=>{});var gWe=C(()=>{});var yWe=C(()=>{});var bWe=C(()=>{i9e();dWe();fWe();pWe();hWe();mWe();gWe();yWe()});var kXt,BXt,XW,rpe=C(()=>{bWe();kXt=e=>t=>async r=>{if(!ZW.isInstance(r.request))return t(r);let{request:n}=r,{handlerProtocol:o=""}=e.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 t(r)},BXt={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},XW=e=>({applyToStack:t=>{t.add(kXt(e),BXt)}})});var $Xt,qXt,QW,_We=C(()=>{$Xt=()=>(e,t)=>async r=>{try{let n=await e(r),{clientName:o,commandName:i,logger:a,dynamoDbDocumentClientOptions:s={}}=t,{overrideInputFilterSensitiveLog:u,overrideOutputFilterSensitiveLog:l}=s,c=u??t.inputFilterSensitiveLog,d=l??t.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={}}=t,{overrideInputFilterSensitiveLog:u}=s,l=u??t.inputFilterSensitiveLog;throw a?.error?.({clientName:o,commandName:i,input:l(r.input),error:n,metadata:n.$metadata}),n}},qXt={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},QW=e=>({applyToStack:t=>{t.add($Xt(),qXt)}})});var npe=C(()=>{_We()});var vWe=C(()=>{});var wWe=C(()=>{vWe()});var SWe=C(()=>{ls()});var xWe=C(()=>{});var CWe=C(()=>{});function UXt(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}var eJ,OWe=C(()=>{eJ=class e{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=UXt(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}}});var EWe=C(()=>{});var PWe=C(()=>{});var TWe=C(()=>{});var MWe=C(()=>{wWe();SWe();xWe();CWe();OWe();EWe();PWe();TWe()});var IWe,zXt,HXt,VXt,WXt,tJ,ope=C(()=>{MWe();IWe="X-Amzn-Trace-Id",zXt="AWS_LAMBDA_FUNCTION_NAME",HXt="_X_AMZN_TRACE_ID",VXt=e=>t=>async r=>{let{request:n}=r;if(!eJ.isInstance(n)||e.runtime!=="node"||n.headers.hasOwnProperty(IWe))return t(r);let o=process.env[zXt],i=process.env[HXt],a=s=>typeof s=="string"&&s.length>0;return a(o)&&a(i)&&(n.headers[IWe]=i),t({...r,request:n})},WXt={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},tJ=e=>({applyToStack:t=>{t.add(VXt(e),WXt)}})});function rJ(e){return{...e,customUserAgent:typeof e.customUserAgent=="string"?[[e.customUserAgent]]:e.customUserAgent}}var AWe=C(()=>{});var JXt,GU,ipe=C(()=>{JXt=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}$"),GU=e=>JXt.test(e)||e.startsWith("[")&&e.endsWith("]")});var GXt,KU,ape=C(()=>{GXt=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),KU=(e,t=!1)=>{if(!t)return GXt.test(e);let r=e.split(".");for(let n of r)if(!KU(n))return!1;return!0}});var ox,nJ=C(()=>{ox={}});var ix,RWe=C(()=>{ix="endpoints"});function wh(e){return typeof e!="object"||e==null?e:"ref"in e?`$${wh(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(wh).join(", ")})`:JSON.stringify(e,null,2)}var DWe=C(()=>{});var YU=C(()=>{RWe();DWe()});var ui,jWe=C(()=>{ui=class extends Error{constructor(t){super(t),this.name="EndpointError"}}});var NWe=C(()=>{});var LWe=C(()=>{});var FWe=C(()=>{});var kWe=C(()=>{});var BWe=C(()=>{});var $We=C(()=>{});var Sh=C(()=>{jWe();NWe();LWe();FWe();kWe();BWe();$We()});var qWe,UWe=C(()=>{qWe=(e,t)=>e===t});var zWe,HWe=C(()=>{Sh();zWe=e=>{let t=e.split("."),r=[];for(let n of t){let o=n.indexOf("[");if(o!==-1){if(n.indexOf("]")!==n.length-1)throw new ui(`Path: '${e}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new ui(`Invalid array index: '${i}' in path: '${e}'`);o!==0&&r.push(n.slice(0,o)),r.push(i)}else r.push(n)}return r}});var oJ,VWe=C(()=>{Sh();HWe();oJ=(e,t)=>zWe(t).reduce((r,n)=>{if(typeof r!="object")throw new ui(`Index '${n}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},e)});var WWe,JWe=C(()=>{WWe=e=>e!=null});var GWe,KWe=C(()=>{GWe=e=>!e});var spe,YWe,ZWe=C(()=>{ls();ipe();spe={[nN.HTTP]:80,[nN.HTTPS]:443},YWe=e=>{let t=(()=>{try{if(e instanceof URL)return e;if(typeof e=="object"&&"hostname"in e){let{hostname:f,port:p,protocol:h="",path:m="",query:_={}}=e,g=new URL(`${h}//${f}${p?`:${p}`:""}${m}`);return g.search=Object.entries(_).map(([v,S])=>`${v}=${S}`).join("&"),g}return new URL(e)}catch{return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;let r=t.href,{host:n,hostname:o,pathname:i,protocol:a,search:s}=t;if(s)return null;let u=a.slice(0,-1);if(!Object.values(nN).includes(u))return null;let l=GU(o),c=r.includes(`${n}:${spe[u]}`)||typeof e=="string"&&e.includes(`${n}:${spe[u]}`),d=`${n}${c?`:${spe[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var XWe,QWe=C(()=>{XWe=(e,t)=>e===t});var eJe,tJe=C(()=>{eJe=(e,t,r,n)=>t>=r||e.length<r?null:n?e.substring(e.length-r,e.length-t):e.substring(t,r)});var rJe,nJe=C(()=>{rJe=e=>encodeURIComponent(e).replace(/[!*'()]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)});var upe=C(()=>{UWe();VWe();JWe();ape();KWe();ZWe();QWe();tJe();nJe()});var oJe,iJe=C(()=>{upe();oJe={booleanEquals:qWe,getAttr:oJ,isSet:WWe,isValidHostLabel:KU,not:GWe,parseURL:YWe,stringEquals:XWe,substring:eJe,uriEncode:rJe}});var iJ,lpe=C(()=>{upe();iJ=(e,t)=>{let r=[],n={...t.endpointParams,...t.referenceRecord},o=0;for(;o<e.length;){let i=e.indexOf("{",o);if(i===-1){r.push(e.slice(o));break}r.push(e.slice(o,i));let a=e.indexOf("}",i);if(a===-1){r.push(e.slice(i));break}e[i+1]==="{"&&e[a+1]==="}"&&(r.push(e.slice(i+1,a)),o=a+2);let s=e.substring(i+1,a);if(s.includes("#")){let[u,l]=s.split("#");r.push(oJ(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var aJe,sJe=C(()=>{aJe=({ref:e},t)=>({...t.endpointParams,...t.referenceRecord})[e]});var mE,ZU=C(()=>{Sh();cpe();lpe();sJe();mE=(e,t,r)=>{if(typeof e=="string")return iJ(e,r);if(e.fn)return aJ(e,r);if(e.ref)return aJe(e,r);throw new ui(`'${t}': ${String(e)} is not a string, function or reference.`)}});var aJ,cpe=C(()=>{nJ();iJe();ZU();aJ=({fn:e,argv:t},r)=>{let n=t.map(i=>["boolean","number"].includes(typeof i)?i:mE(i,"arg",r)),o=e.split(".");return o[0]in ox&&o[1]!=null?ox[o[0]][o[1]](...n):oJe[e](...n)}});var uJe,lJe=C(()=>{YU();Sh();cpe();uJe=({assign:e,...t},r)=>{if(e&&e in r.referenceRecord)throw new ui(`'${e}' is already defined in Reference Record.`);let n=aJ(t,r);return r.logger?.debug?.(`${ix} evaluateCondition: ${wh(t)} = ${wh(n)}`),{result:n===""?!0:!!n,...e!=null&&{toAssign:{name:e,value:n}}}}});var aN,sJ=C(()=>{YU();lJe();aN=(e=[],t)=>{let r={};for(let n of e){let{result:o,toAssign:i}=uJe(n,{...t,referenceRecord:{...t.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,t.logger?.debug?.(`${ix} assign: ${i.name} := ${wh(i.value)}`))}return{result:!0,referenceRecord:r}}});var cJe,dJe=C(()=>{Sh();ZU();cJe=(e,t)=>Object.entries(e).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=mE(i,"Header value entry",t);if(typeof a!="string")throw new ui(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var dpe,fJe=C(()=>{Sh();lpe();fpe();dpe=(e,t)=>{if(Array.isArray(e))return e.map(r=>dpe(r,t));switch(typeof e){case"string":return iJ(e,t);case"object":if(e===null)throw new ui(`Unexpected endpoint property: ${e}`);return uJ(e,t);case"boolean":return e;default:throw new ui(`Unexpected endpoint property type: ${typeof e}`)}}});var uJ,fpe=C(()=>{fJe();uJ=(e,t)=>Object.entries(e).reduce((r,[n,o])=>({...r,[n]:dpe(o,t)}),{})});var pJe,hJe=C(()=>{Sh();ZU();pJe=(e,t)=>{let r=mE(e,"Endpoint URL",t);if(typeof r=="string")try{return new URL(r)}catch(n){throw console.error(`Failed to construct URL with ${r}`,n),n}throw new ui(`Endpoint URL must be a string, got ${typeof r}`)}});var mJe,gJe=C(()=>{YU();sJ();dJe();fpe();hJe();mJe=(e,t)=>{let{conditions:r,endpoint:n}=e,{result:o,referenceRecord:i}=aN(r,t);if(!o)return;let a={...t,referenceRecord:{...t.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return t.logger?.debug?.(`${ix} Resolving endpoint from template: ${wh(n)}`),{...l!=null&&{headers:cJe(l,a)},...u!=null&&{properties:uJ(u,a)},url:pJe(s,a)}}});var yJe,bJe=C(()=>{Sh();sJ();ZU();yJe=(e,t)=>{let{conditions:r,error:n}=e,{result:o,referenceRecord:i}=aN(r,t);if(o)throw new ui(mE(n,"Error",{...t,referenceRecord:{...t.referenceRecord,...i}}))}});var _Je,vJe=C(()=>{sJ();ppe();_Je=(e,t)=>{let{conditions:r,rules:n}=e,{result:o,referenceRecord:i}=aN(r,t);if(o)return lJ(n,{...t,referenceRecord:{...t.referenceRecord,...i}})}});var lJ,ppe=C(()=>{Sh();gJe();bJe();vJe();lJ=(e,t)=>{for(let r of e)if(r.type==="endpoint"){let n=mJe(r,t);if(n)return n}else if(r.type==="error")yJe(r,t);else if(r.type==="tree"){let n=_Je(r,t);if(n)return n}else throw new ui(`Unknown endpoint rule: ${r}`);throw new ui("Rules evaluation failed")}});var wJe=C(()=>{nJ();ppe()});var XU,SJe=C(()=>{YU();Sh();wJe();XU=(e,t)=>{let{endpointParams:r,logger:n}=t,{parameters:o,rules:i}=e;t.logger?.debug?.(`${ix} Initial EndpointParams: ${wh(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 ui(`Missing required parameter: '${l}'`);let u=lJ(i,{endpointParams:r,logger:n,referenceRecord:{}});if(t.endpointParams?.Endpoint)try{let l=new URL(t.endpointParams.Endpoint),{protocol:c,port:d}=l;u.url.protocol=c,u.url.port=d}catch{}return t.logger?.debug?.(`${ix} Resolved endpoint: ${wh(u)}`),u}});var gE=C(()=>{ipe();ape();nJ();SJe();Sh()});var hpe=C(()=>{gE()});var mpe,xJe=C(()=>{gE();hpe();mpe=(e,t=!1)=>{if(t){for(let r of e.split("."))if(!mpe(r))return!1;return!0}return!(!KU(e)||e.length<3||e.length>63||e!==e.toLowerCase()||GU(e))}});var CJe,KXt,OJe,EJe=C(()=>{CJe=":",KXt="/",OJe=e=>{let t=e.split(CJe);if(t.length<6)return null;let[r,n,o,i,a,...s]=t;if(r!=="arn"||n===""||o===""||s.join(CJe)==="")return null;let u=s.map(l=>l.split(KXt)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var TJe,PJe=C(()=>{TJe={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 ZXt,XXt,MJe,IJe,gpe=C(()=>{PJe();ZXt=TJe,XXt="",MJe=e=>{let{partitions:t}=ZXt;for(let n of t){let{regions:o,outputs:i}=n;for(let[a,s]of Object.entries(o))if(a===e)return{...i,...s}}for(let n of t){let{regionRegex:o,outputs:i}=n;if(new RegExp(o).test(e))return{...i}}let r=t.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}},IJe=()=>XXt});var QU,AJe=C(()=>{gE();xJe();EJe();gpe();QU={isVirtualHostableS3Bucket:mpe,parseArn:OJe,partition:MJe};ox.aws=QU});var RJe=C(()=>{gE()});var DJe=C(()=>{gE()});var jJe=C(()=>{});var NJe=C(()=>{});var LJe=C(()=>{});var FJe=C(()=>{});var kJe=C(()=>{});var BJe=C(()=>{DJe();jJe();NJe();LJe();FJe();kJe()});var cJ=C(()=>{AJe();gpe();hpe();RJe();BJe()});var $Je=C(()=>{});var qJe=C(()=>{$Je()});var UJe=C(()=>{ls()});var zJe=C(()=>{});var HJe=C(()=>{});function QXt(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}var dJ,VJe=C(()=>{dJ=class e{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=QXt(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}}});var WJe=C(()=>{});var JJe=C(()=>{});var GJe=C(()=>{});var KJe=C(()=>{qJe();UJe();zJe();HJe();VJe();WJe();JJe();GJe()});var ype,fJ,bpe,pJ,YJe,ZJe,_pe,XJe=C(()=>{ype="user-agent",fJ="x-amz-user-agent",bpe=" ",pJ="/",YJe=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,ZJe=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,_pe="-"});var eQt,vpe,tQt,hJ,QJe=C(()=>{cJ();KJe();XJe();eQt=e=>(t,r)=>async n=>{let{request:o}=n;if(!dJ.isInstance(o))return t(n);let{headers:i}=o,a=r?.userAgent?.map(vpe)||[],s=(await e.defaultUserAgentProvider()).map(vpe),u=e?.customUserAgent?.map(vpe)||[],l=IJe(),c=(l?[l]:[]).concat([...s,...a,...u]).join(bpe),d=[...s.filter(f=>f.startsWith("aws-sdk-")),...u].join(bpe);return e.runtime!=="browser"?(d&&(i[fJ]=i[fJ]?`${i[ype]} ${d}`:d),i[ype]=c):i[fJ]=c,t({...n,request:o})},vpe=e=>{let t=e[0].split(pJ).map(a=>a.replace(YJe,_pe)).join(pJ),r=e[1]?.replace(ZJe,_pe),n=t.indexOf(pJ),o=t.substring(0,n),i=t.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}`}},"")},tQt={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},hJ=e=>({applyToStack:t=>{t.add(eQt(e),tQt)}})});var wpe=C(()=>{AWe();QJe()});var eGe=C(()=>{});var tGe=C(()=>{});var mJ,rGe=C(()=>{(function(e){e.ENV="env",e.CONFIG="shared config entry"})(mJ||(mJ={}))});var Spe=C(()=>{eGe();tGe();rGe()});var gJ,nGe=C(()=>{Spe();gJ=!1});var yJ,oGe=C(()=>{Spe();yJ=!1});var ky,iGe=C(()=>{ls();ky=e=>e[iN]||(e[iN]={})});var zc,aGe=C(()=>{zc=e=>{if(typeof e=="function")return e;let t=Promise.resolve(e);return()=>t}});var ng=C(()=>{iGe();aGe()});var sGe=C(()=>{ng()});var uGe=C(()=>{});var lGe=C(()=>{ng();uGe()});var cGe=C(()=>{nGe();oGe();sGe();lGe()});var dGe=C(()=>{});var bJ,xpe=C(()=>{bJ=e=>typeof e=="string"&&(e.startsWith("fips-")||e.endsWith("-fips"))});var Cpe,fGe=C(()=>{xpe();Cpe=e=>bJ(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e});var _J,pGe=C(()=>{fGe();xpe();_J=e=>{let{region:t,useFipsEndpoint:r}=e;if(!t)throw new Error("Region is missing");return{...e,region:async()=>{if(typeof t=="string")return Cpe(t);let n=await t();return Cpe(n)},useFipsEndpoint:async()=>{let n=typeof t=="string"?t:await t();return bJ(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}}});var hGe=C(()=>{dGe();pGe()});var mGe=C(()=>{});var gGe=C(()=>{});var yGe=C(()=>{});var bGe=C(()=>{});var _Ge=C(()=>{});var vGe=C(()=>{});var wGe=C(()=>{yGe();bGe();_Ge();vGe()});var SGe=C(()=>{mGe();gGe();wGe()});var ez=C(()=>{cGe();hGe();SGe()});function nQt(e){let t=new Map;for(let r of e)t.set(r.schemeId,r);return t}var Ope,vJ=C(()=>{ls();ng();Ope=(e,t)=>(r,n)=>async o=>{let i=e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,n,o.input)),a=nQt(e.httpAuthSchemes),s=ky(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 t.identityProviderConfigProvider(e));if(!d){u.push(`HttpAuthScheme \`${l.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:f={},signingProperties:p={}}=l.propertiesExtractor?.(e,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 xGe,oQt,iQt,aQt,sQt,uQt,CGe=C(()=>{xGe=async e=>{let t=e?.Bucket||"";if(typeof e.Bucket=="string"&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),uQt(t)){if(e.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!sQt(t)||t.indexOf(".")!==-1&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e},oQt=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,iQt=/(\d+\.){3}\d+/,aQt=/\.\./,sQt=e=>oQt.test(e)&&!iQt.test(e)&&!aQt.test(e),uQt=e=>{let[t,r,n,,,o]=e.split(":"),i=t==="arn"&&e.split(":").length>=6,a=!!(i&&r&&n&&o);if(i&&!a)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return a}});var OGe=C(()=>{CGe()});var EGe,PGe=C(()=>{EGe=(e,t,r)=>{let n=async()=>{let o=r[e]??r[t];return typeof o=="function"?o():o};return e==="credentialScope"||t==="CredentialScope"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.credentialScope??o?.CredentialScope}:e==="accountId"||t==="AccountId"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.accountId??o?.AccountId}:e==="endpoint"||t==="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 TGe,MGe=C(()=>{TGe=async e=>{}});function IGe(e){let t={};if(e=e.replace(/^\?/,""),e)for(let r of e.split("&")){let[n,o=null]=r.split("=");n=decodeURIComponent(n),o&&(o=decodeURIComponent(o)),n in t?Array.isArray(t[n])?t[n].push(o):t[n]=[t[n],o]:t[n]=o}return t}var AGe=C(()=>{});var yE,wJ=C(()=>{AGe();yE=e=>{if(typeof e=="string")return yE(new URL(e));let{hostname:t,pathname:r,port:n,protocol:o,search:i}=e,a;return i&&(a=IGe(i)),{hostname:t,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var SJ,xJ=C(()=>{wJ();SJ=e=>typeof e=="object"?"url"in e?yE(e.url):e:yE(e)});var RGe,lQt,Epe=C(()=>{OGe();PGe();MGe();xJ();RGe=async(e,t,r,n)=>{if(!r.endpoint){let a=await TGe(r.serviceId||"");a&&(r.endpoint=()=>Promise.resolve(SJ(a)))}let o=await lQt(e,t,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},lQt=async(e,t,r)=>{let n={},o=t?.getEndpointParameterInstructions?.()||{};for(let[i,a]of Object.entries(o))switch(a.type){case"staticContextParams":n[i]=a.value;break;case"contextParams":n[i]=e[a.name];break;case"clientContextParams":case"builtInParams":n[i]=await EGe(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 xGe(n),n}});var DGe=C(()=>{Epe();xJ()});var jGe,Ppe=C(()=>{ng();Epe();jGe=({config:e,instructions:t})=>(r,n)=>async o=>{let i=await RGe(o.input,{getEndpointParameterInstructions(){return t}},{...e},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=ky(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 NGe,Tpe=C(()=>{NGe=(e,t)=>r=>async n=>{let{response:o}=await r(n);try{let i=await t(o,e);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 LGe,Mpe=C(()=>{LGe=(e,t)=>(r,n)=>async o=>{let i=n.endpointV2?.url&&e.urlParser?async()=>e.urlParser(n.endpointV2.url):e.endpoint;if(!i)throw new Error("No valid endpoint provider available.");let a=await t(o.input,{...e,endpoint:i});return r({...o,request:a})}});function dt(e,t,r){return{applyToStack:n=>{n.add(NGe(e,r),cQt),n.add(LGe(e,t),tz)}}}var cQt,tz,FGe=C(()=>{Tpe();Mpe();cQt={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},tz={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var Cn=C(()=>{Tpe();FGe();Mpe()});var Ipe,ft,kGe=C(()=>{Cn();Ppe();Ipe={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:tz.name},ft=(e,t)=>({applyToStack:r=>{r.addRelativeTo(jGe({config:e,instructions:t}),Ipe)}})});var CJ,BGe=C(()=>{ng();xJ();CJ=e=>{let t=e.tls??!0,{endpoint:r}=e,n=r!=null?async()=>SJ(await zc(r)()):void 0;return{...e,endpoint:n,tls:t,isCustomEndpoint:!!r,useDualstackEndpoint:zc(e.useDualstackEndpoint??!1),useFipsEndpoint:zc(e.useFipsEndpoint??!1)}}});var $Ge=C(()=>{});var yn=C(()=>{DGe();Ppe();kGe();BGe();$Ge()});var dQt,OJ,qGe=C(()=>{yn();vJ();dQt={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:Ipe.name},OJ=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(Ope(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r}),dQt)}})});var Bqn,UGe=C(()=>{Cn();vJ();Bqn={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:tz.name}});var zGe=C(()=>{vJ();qGe();UGe()});var HGe=C(()=>{});var VGe=C(()=>{HGe()});var WGe=C(()=>{ls()});var JGe=C(()=>{});var GGe=C(()=>{});function fQt(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}var WI,KGe=C(()=>{WI=class e{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=fQt(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}}});var YGe=C(()=>{});var ZGe=C(()=>{});var XGe=C(()=>{});var rz=C(()=>{VGe();WGe();JGe();GGe();KGe();YGe();ZGe();XGe()});var pQt,hQt,QGe,Ape=C(()=>{rz();ls();ng();pQt=e=>t=>{throw t},hQt=(e,t)=>{},QGe=e=>(t,r)=>async n=>{if(!WI.isInstance(n.request))return t(n);let i=ky(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 t({...n,request:await u.sign(n.request,s,a)}).catch((u.errorHandler||pQt)(a));return(u.successHandler||hQt)(l.response,a),l}});var og,By,nz,EJ=C(()=>{(function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"})(og||(og={}));By=3,nz=og.STANDARD});var eKe,tKe,rKe,nKe,oKe=C(()=>{eKe=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],tKe=["TimeoutError","RequestTimeout","RequestTimeoutException"],rKe=[500,502,503,504],nKe=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"]});var mQt,sN,PJ,iKe,oz=C(()=>{oKe();mQt=e=>e.$metadata?.clockSkewCorrected,sN=e=>e.$metadata?.httpStatusCode===429||eKe.includes(e.name)||e.$retryable?.throttling==!0,PJ=e=>mQt(e)||tKe.includes(e.name)||nKe.includes(e?.code||"")||rKe.includes(e.$metadata?.httpStatusCode||0),iKe=e=>{if(e.$metadata?.httpStatusCode!==void 0){let t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!PJ(e)}return!1}});var iz,Rpe=C(()=>{oz();iz=class{constructor(t){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=t?.beta??.7,this.minCapacity=t?.minCapacity??1,this.minFillRate=t?.minFillRate??.5,this.scaleConstant=t?.scaleConstant??.4,this.smooth=t?.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(t){if(this.enabled){if(this.refillTokenBucket(),t>this.currentCapacity){let r=(t-this.currentCapacity)/this.fillRate*1e3;await new Promise(n=>setTimeout(n,r))}this.currentCapacity=this.currentCapacity-t}}refillTokenBucket(){let t=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=t;return}let r=(t-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+r),this.lastTimestamp=t}updateClientSendingRate(t){let r;if(this.updateMeasuredRate(),sN(t)){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(t){return this.getPrecise(t*this.beta)}cubicSuccess(t){return this.getPrecise(this.scaleConstant*Math.pow(t-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(t){this.refillTokenBucket(),this.fillRate=Math.max(t,this.minFillRate),this.maxCapacity=Math.max(t,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){let t=this.getCurrentTimeInSeconds(),r=Math.floor(t*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(t){return parseFloat(t.toFixed(8))}}});var TJ,MJ,uN=C(()=>{TJ="amz-sdk-invocation-id",MJ="amz-sdk-request"});var aKe,sKe=C(()=>{uN();aKe=()=>{let e=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*e)),setDelayBase:n=>{e=n}}}});var Dpe,uKe=C(()=>{uN();Dpe=({retryDelay:e,retryCount:t,retryCost:r})=>({getRetryCount:()=>t,getRetryDelay:()=>Math.min(2e4,e),getRetryCost:()=>r})});var JI,AJ=C(()=>{EJ();uN();sKe();uKe();JI=class{constructor(t){this.maxAttempts=t,this.mode=og.STANDARD,this.capacity=500,this.retryBackoffStrategy=aKe(),this.maxAttemptsProvider=typeof t=="function"?t:async()=>t}async acquireInitialRetryToken(t){return Dpe({retryDelay:100,retryCount:0})}async refreshRetryTokenForRetry(t,r){let n=await this.getMaxAttempts();if(this.shouldRetry(t,r,n)){let o=r.errorType;this.retryBackoffStrategy.setDelayBase(o==="THROTTLING"?500:100);let i=this.retryBackoffStrategy.computeNextBackoffDelay(t.getRetryCount()),a=r.retryAfterHint?Math.max(r.retryAfterHint.getTime()-Date.now()||0,i):i,s=this.getCapacityCost(o);return this.capacity-=s,Dpe({retryDelay:a,retryCount:t.getRetryCount()+1,retryCost:s})}throw new Error("No retry token available")}recordSuccess(t){this.capacity=Math.max(500,this.capacity+(t.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 ${By}`),By}}shouldRetry(t,r,n){return t.getRetryCount()+1<n&&this.capacity>=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(t){return t==="TRANSIENT"?10:5}isRetryableError(t){return t==="THROTTLING"||t==="TRANSIENT"}}});var RJ,pKe=C(()=>{EJ();Rpe();AJ();RJ=class{constructor(t,r){this.maxAttemptsProvider=t,this.mode=og.ADAPTIVE;let{rateLimiter:n}=r??{};this.rateLimiter=n??new iz,this.standardRetryStrategy=new JI(t)}async acquireInitialRetryToken(t){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(t)}async refreshRetryTokenForRetry(t,r){return this.rateLimiter.updateClientSendingRate(r),this.standardRetryStrategy.refreshRetryTokenForRetry(t,r)}recordSuccess(t){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(t)}}});var hKe=C(()=>{uN();AJ()});var mKe=C(()=>{});var $y=C(()=>{pKe();hKe();Rpe();AJ();EJ();uN();mKe()});var gKe=C(()=>{});var yKe=C(()=>{gKe()});var bKe=C(()=>{ls()});var _Ke=C(()=>{});var vKe=C(()=>{});function gQt(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}var cN,wKe=C(()=>{cN=class e{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=gQt(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}}});var az,SKe=C(()=>{az=class{constructor(t){this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;let r=t;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var xKe=C(()=>{});var CKe=C(()=>{});var DJ=C(()=>{yKe();bKe();_Ke();vKe();wKe();SKe();xKe();CKe()});function Npe(){if(!jJ&&(jJ=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!jJ))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return jJ(yQt)}var jJ,yQt,OKe=C(()=>{yQt=new Uint8Array(16)});function EKe(e,t=0){return Jl[e[t+0]]+Jl[e[t+1]]+Jl[e[t+2]]+Jl[e[t+3]]+"-"+Jl[e[t+4]]+Jl[e[t+5]]+"-"+Jl[e[t+6]]+Jl[e[t+7]]+"-"+Jl[e[t+8]]+Jl[e[t+9]]+"-"+Jl[e[t+10]]+Jl[e[t+11]]+Jl[e[t+12]]+Jl[e[t+13]]+Jl[e[t+14]]+Jl[e[t+15]]}var Jl,PKe=C(()=>{Jl=[];for(let e=0;e<256;++e)Jl.push((e+256).toString(16).slice(1))});var bQt,Lpe,TKe=C(()=>{bQt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Lpe={randomUUID:bQt}});function _Qt(e,t,r){if(Lpe.randomUUID&&!t&&!e)return Lpe.randomUUID();e=e||{};let n=e.random||(e.rng||Npe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let o=0;o<16;++o)t[r+o]=n[o];return t}return EKe(n)}var Fpe,MKe=C(()=>{TKe();OKe();PKe();Fpe=_Qt});var IKe=C(()=>{MKe()});var AKe=C(()=>{$y()});var kpe=C(()=>{$y()});var Bpe=C(()=>{oz()});var $pe,qpe=C(()=>{$pe=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):typeof e=="string"?new Error(e):new Error(`AWS SDK error wrapper for ${e}`)});var Upe=C(()=>{DJ();oz();$y();AKe();kpe();Bpe();qpe()});var RKe=C(()=>{$y();Upe()});var NJ,DKe=C(()=>{ng();$y();NJ=e=>{let{retryStrategy:t}=e,r=zc(e.maxAttempts??By);return{...e,maxAttempts:r,retryStrategy:async()=>t||(await zc(e.retryMode)()===og.ADAPTIVE?new RJ(r):new JI(r))}}});var jKe=C(()=>{DJ();$y()});var bE,NKe=C(()=>{bE=class{trace(){}debug(){}info(){}warn(){}error(){}}});var GI,_E,dN,LKe,FKe,kKe=C(()=>{GI=(e,t)=>{let r=[];if(e&&r.push(e),t)for(let n of t)r.push(n);return r},_E=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,dN=()=>{let e=[],t=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>LKe[p.step]-LKe[f.step]||FKe[p.priority||"normal"]-FKe[f.priority||"normal"]),i=d=>{let f=!1,p=h=>{let m=GI(h.name,h.aliases);if(m.includes(d)){f=!0;for(let _ of m)n.delete(_);return!1}return!0};return e=e.filter(p),t=t.filter(p),f},a=d=>{let f=!1,p=h=>{if(h.middleware===d){f=!0;for(let m of GI(h.name,h.aliases))n.delete(m);return!1}return!0};return e=e.filter(p),t=t.filter(p),f},s=d=>(e.forEach(f=>{d.add(f.middleware,{...f})}),t.forEach(f=>{d.addRelativeTo(f.middleware,{...f})}),d.identifyOnResolve?.(c.identifyOnResolve()),d),u=d=>{let f=[];return d.before.forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f.push(d),d.after.reverse().forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f},l=(d=!1)=>{let f=[],p=[],h={};return e.forEach(_=>{let g={..._,before:[],after:[]};for(let v of GI(g.name,g.aliases))h[v]=g;f.push(g)}),t.forEach(_=>{let g={..._,before:[],after:[]};for(let v of GI(g.name,g.aliases))h[v]=g;p.push(g)}),p.forEach(_=>{if(_.toMiddleware){let g=h[_.toMiddleware];if(g===void 0){if(d)return;throw new Error(`${_.toMiddleware} is not found when adding ${_E(_.name,_.aliases)} middleware ${_.relation} ${_.toMiddleware}`)}_.relation==="after"&&g.after.push(_),_.relation==="before"&&g.before.push(_)}}),o(f).map(u).reduce((_,g)=>(_.push(...g),_),[])},c={add:(d,f={})=>{let{name:p,override:h,aliases:m}=f,_={step:"initialize",priority:"normal",middleware:d,...f},g=GI(p,m);if(g.length>0){if(g.some(v=>n.has(v))){if(!h)throw new Error(`Duplicate middleware name '${_E(p,m)}'`);for(let v of g){let S=e.findIndex(O=>O.name===v||O.aliases?.some(T=>T===v));if(S===-1)continue;let x=e[S];if(x.step!==_.step||_.priority!==x.priority)throw new Error(`"${_E(x.name,x.aliases)}" middleware with ${x.priority} priority in ${x.step} step cannot be overridden by "${_E(p,m)}" middleware with ${_.priority} priority in ${_.step} step.`);e.splice(S,1)}}for(let v of g)n.add(v)}e.push(_)},addRelativeTo:(d,f)=>{let{name:p,override:h,aliases:m}=f,_={middleware:d,...f},g=GI(p,m);if(g.length>0){if(g.some(v=>n.has(v))){if(!h)throw new Error(`Duplicate middleware name '${_E(p,m)}'`);for(let v of g){let S=t.findIndex(O=>O.name===v||O.aliases?.some(T=>T===v));if(S===-1)continue;let x=t[S];if(x.toMiddleware!==_.toMiddleware||x.relation!==_.relation)throw new Error(`"${_E(x.name,x.aliases)}" middleware ${x.relation} "${x.toMiddleware}" middleware cannot be overridden by "${_E(p,m)}" middleware ${_.relation} "${_.toMiddleware}" middleware.`);t.splice(S,1)}}for(let v of g)n.add(v)}t.push(_)},clone:()=>s(dN()),use:d=>{d.applyToStack(c)},remove:d=>typeof d=="string"?i(d):a(d),removeByTag:d=>{let f=!1,p=h=>{let{tags:m,name:_,aliases:g}=h;if(m&&m.includes(d)){let v=GI(_,g);for(let S of v)n.delete(S);return f=!0,!1}return!0};return e=e.filter(p),t=t.filter(p),f},concat:d=>{let f=s(dN());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 _E(d.name,d.aliases)+" - "+f}),identifyOnResolve(d){return typeof d=="boolean"&&(r=d),r},resolve:(d,f)=>{for(let p of l().map(h=>h.middleware).reverse())d=p(d,f);return r&&console.log(c.identify()),d}};return c},LKe={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},FKe={high:3,normal:2,low:1}});var zpe=C(()=>{kKe()});var KI,BKe=C(()=>{zpe();KI=class{constructor(t){this.middlewareStack=dN(),this.config=t}send(t,r,n){let o=typeof r!="function"?r:void 0,i=typeof r=="function"?r:n,a=t.resolveMiddleware(this.middlewareStack,this.config,o);if(i)a(t).then(s=>i(null,s.output),s=>i(s)).catch(()=>{});else return a(t).then(s=>s.output)}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}});var ax,YI,vE,ZI,$Ke,Hpe=C(()=>{ax={},YI=new Array(64);for(let e=0,t=65,r=90;e+t<=r;e++){let n=String.fromCharCode(e+t);ax[n]=e,YI[e]=n}for(let e=0,t=97,r=122;e+t<=r;e++){let n=String.fromCharCode(e+t),o=e+26;ax[n]=o,YI[o]=n}for(let e=0;e<10;e++){ax[e.toString(10)]=e+52;let t=e.toString(10),r=e+52;ax[t]=r,YI[r]=t}ax["+"]=62;YI[62]="+";ax["/"]=63;YI[63]="/";vE=6,ZI=8,$Ke=63});var wE,qKe=C(()=>{Hpe();wE=e=>{let t=e.length/4*3;e.slice(-2)==="=="?t-=2:e.slice(-1)==="="&&t--;let r=new ArrayBuffer(t),n=new DataView(r);for(let o=0;o<e.length;o+=4){let i=0,a=0;for(let l=o,c=o+3;l<=c;l++)if(e[l]!=="="){if(!(e[l]in ax))throw new TypeError(`Invalid character ${e[l]} in base64 string.`);i|=ax[e[l]]<<(c-l)*vE,a+=vE}else i>>=vE;let s=o/4*3;i>>=a%ZI;let u=Math.floor(a/ZI);for(let l=0;l<u;l++){let c=(u-l-1)*ZI;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var Vpe,Wpe=C(()=>{Vpe=e=>new TextEncoder().encode(e)});var UKe=C(()=>{Wpe()});var zKe=C(()=>{});var HKe=C(()=>{Wpe();UKe();zKe()});function SE(e){let t;typeof e=="string"?t=Vpe(e):t=e;let r=typeof t=="object"&&typeof t.length=="number",n=typeof t=="object"&&typeof t.byteOffset=="number"&&typeof t.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<t.length;i+=3){let a=0,s=0;for(let l=i,c=Math.min(i+3,t.length);l<c;l++)a|=t[l]<<(c-l-1)*ZI,s+=ZI;let u=Math.ceil(s/vE);a<<=u*vE-s;for(let l=1;l<=u;l++){let c=(u-l)*vE;o+=YI[(a&$Ke<<c)>>c]}o+="==".slice(0,4-u)}return o}var VKe=C(()=>{HKe();Hpe()});var fN=C(()=>{qKe();VKe()});var Jpe,Gpe=C(()=>{Jpe=e=>new TextEncoder().encode(e)});var WKe=C(()=>{Gpe()});var LJ,JKe=C(()=>{LJ=e=>{if(typeof e=="string")return e;if(typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)}});var Kpe=C(()=>{Gpe();WKe();JKe()});function GKe(e,t="utf-8"){return t==="base64"?SE(e):LJ(e)}function KKe(e,t){return t==="base64"?sx.mutate(wE(e)):sx.mutate(Jpe(e))}var YKe=C(()=>{fN();Kpe();Ype()});var sx,Ype=C(()=>{YKe();sx=class e extends Uint8Array{static fromString(t,r="utf-8"){switch(typeof t){case"string":return KKe(t,r);default:throw new Error(`Unsupported conversion from ${typeof t} to Uint8ArrayBlobAdapter.`)}}static mutate(t){return Object.setPrototypeOf(t,e.prototype),t}transformToString(t="utf-8"){return GKe(this,t)}}});var ZKe=C(()=>{});var XKe=C(()=>{});var QKe=C(()=>{XKe()});var e7e=C(()=>{ls()});var t7e=C(()=>{});var r7e=C(()=>{});var n7e=C(()=>{});var sz,o7e=C(()=>{sz=class{constructor(t){this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;let r=t;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var i7e=C(()=>{});var a7e=C(()=>{});var s7e=C(()=>{QKe();e7e();t7e();r7e();n7e();o7e();i7e();a7e()});var xh,vQt,Zpe=C(()=>{xh=e=>encodeURIComponent(e).replace(/[!'()*]/g,vQt),vQt=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`});var u7e=C(()=>{Zpe()});var FJ=C(()=>{Zpe();u7e()});function l7e(e){let t=[];for(let r of Object.keys(e).sort()){let n=e[r];if(r=xh(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)t.push(`${r}=${xh(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${xh(n)}`),t.push(o)}}return t.join("&")}var c7e=C(()=>{FJ()});function d7e(e=0){return new Promise((t,r)=>{e&&setTimeout(()=>{let n=new Error(`Request did not complete within ${e} ms`);n.name="TimeoutError",r(n)},e)})}var f7e=C(()=>{});var Xpe,xE,p7e=C(()=>{s7e();c7e();f7e();Xpe={supported:void 0},xE=class e{static create(t){return typeof t?.handle=="function"?t:new e(t)}constructor(t){typeof t=="function"?this.configProvider=t().then(r=>r||{}):(this.config=t??{},this.configProvider=Promise.resolve(this.config)),Xpe.supported===void 0&&(Xpe.supported=typeof Request<"u"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(t,{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=t.path,s=l7e(t.query||{});s&&(a+=`?${s}`),t.fragment&&(a+=`#${t.fragment}`);let u="";if(t.username!=null||t.password!=null){let g=t.username??"",v=t.password??"";u=`${g}:${v}@`}let{port:l,method:c}=t,d=`${t.protocol}//${u}${t.hostname}${l?`:${l}`:""}${a}`,f=c==="GET"||c==="HEAD"?void 0:t.body,p={body:f,headers:new Headers(t.headers),method:c,credentials:i};f&&(p.duplex="half"),typeof AbortController<"u"&&(p.signal=r),Xpe.supported&&(p.keepalive=o);let h=()=>{},m=new Request(d,p),_=[fetch(m).then(g=>{let v=g.headers,S={};for(let O of v.entries())S[O[0]]=O[1];return g.body!=null?{response:new sz({headers:S,reason:g.statusText,statusCode:g.status,body:g.body})}:g.blob().then(O=>({response:new sz({headers:S,reason:g.statusText,statusCode:g.status,body:O})}))}),d7e(n)];return r&&_.push(new Promise((g,v)=>{let S=()=>{let x=new Error("Request aborted");x.name="AbortError",v(x)};if(typeof r.addEventListener=="function"){let x=r;x.addEventListener("abort",S,{once:!0}),h=()=>x.removeEventListener("abort",S)}else r.onabort=S})),Promise.race(_).finally(h)}updateHttpClientConfig(t,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[t]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function wQt(e){let t=await xQt(e),r=wE(t);return new Uint8Array(r)}async function SQt(e){let t=[],r=e.getReader(),n=!1,o=0;for(;!n;){let{done:s,value:u}=await r.read();u&&(t.push(u),o+=u.length),n=s}let i=new Uint8Array(o),a=0;for(let s of t)i.set(s,a),a+=s.length;return i}function xQt(e){return new Promise((t,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;t(o.substring(a))},n.onabort=()=>r(new Error("Read aborted")),n.onerror=()=>r(n.error),n.readAsDataURL(e)})}var pN,h7e=C(()=>{fN();pN=e=>typeof Blob=="function"&&e instanceof Blob?wQt(e):SQt(e)});var uz=C(()=>{p7e();h7e()});function g7e(e){let t="";for(let r=0;r<e.byteLength;r++)t+=m7e[e[r]];return t}var m7e,CQt,y7e=C(()=>{m7e={},CQt={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),m7e[e]=t,CQt[t]=e}});var Qpe,ehe=C(()=>{Qpe=e=>typeof ReadableStream=="function"&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream)});var b7e,v7e,_7e,w7e=C(()=>{uz();fN();y7e();Kpe();ehe();b7e="The stream has already been transformed.",v7e=e=>{if(!_7e(e)&&!Qpe(e)){let o=e?.__proto__?.constructor?.name||e;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${o}`)}let t=!1,r=async()=>{if(t)throw new Error(b7e);return t=!0,await pN(e)},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(e,{transformToByteArray:r,transformToString:async o=>{let i=await r();if(o==="base64")return SE(i);if(o==="hex")return g7e(i);if(o===void 0||o==="utf8"||o==="utf-8")return LJ(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(t)throw new Error(b7e);if(t=!0,_7e(e))return n(e);if(Qpe(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},_7e=e=>typeof Blob=="function"&&e instanceof Blob});var S7e=C(()=>{});var x7e=C(()=>{});var the=C(()=>{Ype();ZKe();w7e();S7e();x7e();ehe()});var CE,C7e=C(()=>{the();CE=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return sx.mutate(e);if(!e)return sx.mutate(new Uint8Array);let r=t.streamCollector(e);return sx.mutate(await r)}});var ot,rhe,O7e=C(()=>{zpe();ls();ot=class{constructor(){this.middlewareStack=dN()}static classBuilder(){return new rhe}resolveMiddlewareWithContext(t,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let _ of o.bind(this)(d,t,r,n))this.middlewareStack.use(_);let f=t.concat(this.middlewareStack),{logger:p}=r,h={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[iN]:{commandInstance:this,...l},...c},{requestHandler:m}=r;return f.resolve(_=>m.handle(_.request,n||{}),h)}},rhe=class{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=t=>t,this._outputFilterSensitiveLog=t=>t,this._serializer=null,this._deserializer=null}init(t){this._init=t}ep(t){return this._ep=t,this}m(t){return this._middlewareFn=t,this}s(t,r,n={}){return this._smithyContext={service:t,operation:r,...n},this}c(t={}){return this._additionalContext=t,this}n(t,r){return this._clientName=t,this._commandName=r,this}f(t=n=>n,r=n=>n){return this._inputFilterSensitiveLog=t,this._outputFilterSensitiveLog=r,this}ser(t){return this._serializer=t,this}de(t){return this._deserializer=t,this}build(){let t=this,r;return r=class extends ot{static getEndpointParameterInstructions(){return t._ep}constructor(...[n]){super(),this.serialize=t._serializer,this.deserialize=t._deserializer,this.input=n??{},t._init(this)}resolveMiddleware(n,o,i){return this.resolveMiddlewareWithContext(n,o,i,{CommandCtor:r,middlewareFn:t._middlewareFn,clientName:t._clientName,commandName:t._commandName,inputFilterSensitiveLog:t._inputFilterSensitiveLog,outputFilterSensitiveLog:t._outputFilterSensitiveLog,smithyContext:t._smithyContext,additionalContext:t._additionalContext})}}}}});var kJ,E7e=C(()=>{kJ="***SensitiveInformation***"});var BJ,P7e=C(()=>{BJ=(e,t)=>{for(let r of Object.keys(e)){let n=e[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$/,"");t.prototype[i]=o}}});var XI,OQt,T7e,EQt,M7e,I7e,A7e,nhe,PQt,hN,Lr,R7e,D7e,TQt,lz,cz,ohe,j7e,N7e,L7e,ihe=C(()=>{XI=e=>{if(e!=null){if(typeof e=="string"){let t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&L7e.warn(N7e(`Expected number but observed string: ${e}`)),t}if(typeof e=="number")return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}},OQt=Math.ceil(34028234663852886e22),T7e=e=>{let t=XI(e);if(t!==void 0&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0&&Math.abs(t)>OQt)throw new TypeError(`Expected 32-bit float, got ${e}`);return t},EQt=e=>{if(e!=null){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}},M7e=e=>nhe(e,32),I7e=e=>nhe(e,16),A7e=e=>nhe(e,8),nhe=(e,t)=>{let r=EQt(e);if(r!==void 0&&PQt(r,t)!==r)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return r},PQt=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},hN=(e,t)=>{if(e==null)throw t?new TypeError(`Expected a non-null value for ${t}`):new TypeError("Expected a non-null value");return e},Lr=e=>{if(e!=null){if(typeof e=="string")return e;if(["boolean","number","bigint"].includes(typeof e))return L7e.warn(N7e(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)}},R7e=e=>XI(typeof e=="string"?lz(e):e),D7e=e=>T7e(typeof e=="string"?lz(e):e),TQt=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,lz=e=>{let t=e.match(TQt);if(t===null||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},cz=e=>M7e(typeof e=="string"?lz(e):e),ohe=e=>I7e(typeof e=="string"?lz(e):e),j7e=e=>A7e(typeof e=="string"?lz(e):e),N7e=e=>String(new TypeError(e).stack||e).split(`
`).slice(0,5).filter(t=>!t.includes("stackTraceWarning")).join(`
`),L7e={warn:console.warn}});var MQt,IQt,F7e,AQt,k7e,U4n,z4n,H4n,$J,B7e,V4n,RQt,DQt,jQt,QI,NQt,LQt,ahe,$7e=C(()=>{ihe();MQt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],IQt=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),F7e=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let t=IQt.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=t,c=ohe(ahe(n)),d=QI(o,"month",1,12),f=QI(i,"day",1,31);return B7e(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},AQt=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),k7e=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let t=AQt.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l,c]=t,d=ohe(ahe(n)),f=QI(o,"month",1,12),p=QI(i,"day",1,31),h=B7e(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&h.setTime(h.getTime()-LQt(c)),h},U4n=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$/),z4n=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$/),H4n=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})$/),$J=e=>{if(e==null)return;let t;if(typeof e=="number")t=e;else if(typeof e=="string")t=R7e(e);else if(typeof e=="object"&&e.tag===1)t=e.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(t)||t===1/0||t===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(t*1e3))},B7e=(e,t,r,n)=>{let o=t-1;return DQt(e,o,r),new Date(Date.UTC(e,o,r,QI(n.hours,"hour",0,23),QI(n.minutes,"minute",0,59),QI(n.seconds,"seconds",0,60),NQt(n.fractionalMilliseconds)))},V4n=50*365*24*60*60*1e3,RQt=[31,28,31,30,31,30,31,31,30,31,30,31],DQt=(e,t,r)=>{let n=RQt[t];if(t===1&&jQt(e)&&(n=29),r>n)throw new TypeError(`Invalid day for ${MQt[t]} in ${e}: ${r}`)},jQt=e=>e%4===0&&(e%100!==0||e%400===0),QI=(e,t,r,n)=>{let o=j7e(ahe(e));if(o<r||o>n)throw new TypeError(`${t} must be between ${r} and ${n}, inclusive`);return o},NQt=e=>e==null?0:D7e("0."+e)*1e3,LQt=e=>{let t=e[0],r=1;if(t=="+")r=1;else if(t=="-")r=-1;else throw new TypeError(`Offset direction, ${t}, must be "+" or "-"`);let n=Number(e.substring(1,3)),o=Number(e.substring(4,6));return r*(n*60+o)*60*1e3},ahe=e=>{let t=0;for(;t<e.length-1&&e.charAt(t)==="0";)t++;return t===0?e:e.slice(t)}});var mN,ia,she=C(()=>{mN=class e extends Error{constructor(t){super(t.message),Object.setPrototypeOf(this,e.prototype),this.name=t.name,this.$fault=t.$fault,this.$metadata=t.$metadata}},ia=(e,t={})=>{Object.entries(t).filter(([,n])=>n!==void 0).forEach(([n,o])=>{(e[n]==null||e[n]==="")&&(e[n]=o)});let r=e.message||e.Message||"UnknownError";return e.message=r,delete e.Message,e}});var FQt,qJ,kQt,q7e=C(()=>{she();FQt=({output:e,parsedBody:t,exceptionCtor:r,errorCode:n})=>{let o=kQt(e),i=o.httpStatusCode?o.httpStatusCode+"":void 0,a=new r({name:t?.code||t?.Code||n||i||"UnknownError",$fault:"client",$metadata:o});throw ia(a,t)},qJ=e=>({output:t,parsedBody:r,errorCode:n})=>{FQt({output:t,parsedBody:r,exceptionCtor:e,errorCode:n})},kQt=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]})});var UJ,U7e=C(()=>{UJ=e=>{switch(e){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 z7e=C(()=>{});var H7e,V7e,W7e=C(()=>{ls();H7e=e=>{let t=[];for(let r in oN){let n=oN[r];e[n]!==void 0&&t.push({algorithmId:()=>n,checksumConstructor:()=>e[n]})}return{_checksumAlgorithms:t,addChecksumAlgorithm(r){this._checksumAlgorithms.push(r)},checksumAlgorithms(){return this._checksumAlgorithms}}},V7e=e=>{let t={};return e.checksumAlgorithms().forEach(r=>{t[r.algorithmId()]=r.checksumConstructor()}),t}});var J7e,G7e,K7e=C(()=>{J7e=e=>{let t=e.retryStrategy;return{setRetryStrategy(r){t=r},retryStrategy(){return t}}},G7e=e=>{let t={};return t.retryStrategy=e.retryStrategy(),t}});var zJ,HJ,Y7e=C(()=>{W7e();K7e();zJ=e=>({...H7e(e),...J7e(e)}),HJ=e=>({...V7e(e),...G7e(e)})});var Z7e=C(()=>{Y7e()});function VJ(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}var uhe=C(()=>{});var X7e=C(()=>{});var lhe,Q7e=C(()=>{lhe=e=>{let t="#text";for(let r in e)e.hasOwnProperty(r)&&e[r][t]!==void 0?e[r]=e[r][t]:typeof e[r]=="object"&&e[r]!==null&&(e[r]=lhe(e[r]));return e}});var che,eYe=C(()=>{che=function(){let e=Object.getPrototypeOf(this).constructor,t=Function.bind.apply(String,[null,...arguments]),r=new t;return Object.setPrototypeOf(r,e.prototype),r};che.prototype=Object.create(String.prototype,{constructor:{value:che,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(che,String)});var dz,BQt,$Qt,qQt,tYe=C(()=>{dz=(e,t)=>{let r={};for(let n in t)BQt(r,e,t,n);return r},BQt=(e,t,r,n)=>{if(t!==null){let a=r[n];typeof a=="function"&&(a=[,a]);let[s=$Qt,u=qQt,l=n]=a;(typeof s=="function"&&s(t[l])||typeof s!="function"&&s)&&(e[n]=u(t[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?e[n]=a:u&&(e[n]=i())}else{let a=o===void 0&&i!=null,s=typeof o=="function"&&!!o(i)||typeof o!="function"&&!!o;(a||s)&&(e[n]=i)}},$Qt=e=>e!=null,qQt=e=>e});var rYe=C(()=>{uhe()});var nYe=C(()=>{});var jt,oYe=C(()=>{jt=e=>{if(e==null)return{};if(Array.isArray(e))return e.filter(t=>t!=null).map(jt);if(typeof e=="object"){let t={};for(let r of Object.keys(e))e[r]!=null&&(t[r]=jt(e[r]));return t}return e}});var iYe=C(()=>{});var Nt=C(()=>{NKe();BKe();C7e();O7e();E7e();P7e();$7e();q7e();U7e();z7e();Z7e();she();uhe();X7e();Q7e();eYe();tYe();ihe();rYe();nYe();oYe();iYe()});var aYe,sYe=C(()=>{aYe=e=>e?.body instanceof ReadableStream});var UQt,zQt,HQt,VQt,dhe,WJ,WQt,uYe=C(()=>{DJ();oz();Nt();$y();IKe();sYe();qpe();UQt=e=>(t,r)=>async n=>{let o=await e.retryStrategy(),i=await e.maxAttempts();if(zQt(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=cN.isInstance(c);for(d&&(c.headers[TJ]=Fpe());;)try{d&&(c.headers[MJ]=`attempt=${u+1}; max=${i}`);let{response:f,output:p}=await t(n);return o.recordSuccess(a),p.$metadata.attempts=u+1,p.$metadata.totalRetryDelay=l,{response:f,output:p}}catch(f){let p=HQt(f);if(s=$pe(f),d&&aYe(c))throw(r.logger instanceof bE?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),s;try{a=await o.refreshRetryTokenForRetry(a,p)}catch{throw s.$metadata||(s.$metadata={}),s.$metadata.attempts=u+1,s.$metadata.totalRetryDelay=l,s}u=a.getRetryCount();let h=a.getRetryDelay();l+=h,await new Promise(m=>setTimeout(m,h))}}else return o=o,o?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",o.mode]]),o.retry(t,n)},zQt=e=>typeof e.acquireInitialRetryToken<"u"&&typeof e.refreshRetryTokenForRetry<"u"&&typeof e.recordSuccess<"u",HQt=e=>{let t={error:e,errorType:VQt(e)},r=WQt(e.$response);return r&&(t.retryAfterHint=r),t},VQt=e=>sN(e)?"THROTTLING":PJ(e)?"TRANSIENT":iKe(e)?"SERVER_ERROR":"CLIENT_ERROR",dhe={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},WJ=e=>({applyToStack:t=>{t.add(UQt(e),dhe)}}),WQt=e=>{if(!az.isInstance(e))return;let t=Object.keys(e.headers).find(i=>i.toLowerCase()==="retry-after");if(!t)return;let r=e.headers[t],n=Number(r);return Number.isNaN(n)?new Date(r):new Date(n*1e3)}});var JJ=C(()=>{RKe();Upe();DKe();kpe();jKe();Bpe();uYe()});var JQt,GJ,lYe=C(()=>{JJ();Ape();JQt={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:dhe.name},GJ=e=>({applyToStack:t=>{t.addRelativeTo(QGe(e),JQt)}})});var cYe=C(()=>{Ape();lYe()});var gN,dYe=C(()=>{gN=class{constructor(t){this.authSchemes=new Map;for(let[r,n]of Object.entries(t))n!==void 0&&this.authSchemes.set(r,n)}getIdentityProvider(t){return this.authSchemes.get(t)}}});var fYe=C(()=>{rz();ls()});var pYe=C(()=>{rz()});var yN,hYe=C(()=>{yN=class{async sign(t,r,n){return t}}});var mYe=C(()=>{fYe();pYe();hYe()});var GQt,gYe,fhe,yYe,bYe=C(()=>{GQt=e=>t=>fhe(t)&&t.expiration.getTime()-Date.now()<e,gYe=GQt(3e5),fhe=e=>e.expiration!==void 0,yYe=(e,t,r)=>{if(e===void 0)return;let n=typeof e!="function"?async()=>Promise.resolve(e):e,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 t===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)?(t(o)&&await u(l),o):(s=!0,o))}});var _Ye=C(()=>{dYe();mYe();bYe()});var vYe=C(()=>{ls()});var bN,wYe=C(()=>{bN=e=>{if(typeof e=="function")return e;let t=Promise.resolve(e);return()=>t}});var SYe=C(()=>{rz();Nt()});function phe(e,t,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 e)d=await KQt(t,a.client,s,...u);else throw new Error(`Invalid client, expected instance of ${e.name}`);yield d;let f=l;l=YQt(d,n),c=!!(l&&(!a.stopOnSameToken||l!==f))}return void 0}}var KQt,YQt,xYe=C(()=>{KQt=async(e,t,r,...n)=>await t.send(new e(r),...n);YQt=(e,t)=>{let r=e,n=t.split(".");for(let o of n){if(!r||typeof r!="object")return;r=r[o]}return r}});var OE=C(()=>{zGe();cYe();_Ye();vYe();wYe();SYe();xYe()});var CYe=C(()=>{});var OYe=C(()=>{CYe()});var EYe=C(()=>{ls()});var PYe=C(()=>{});var TYe=C(()=>{});function ZQt(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}var KJ,MYe=C(()=>{KJ=class e{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=ZQt(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}}});var IYe=C(()=>{});var AYe=C(()=>{});var RYe=C(()=>{});var DYe=C(()=>{OYe();EYe();PYe();TYe();MYe();IYe();AYe();RYe()});function XQt(e){return t=>async r=>{let n=r.request;if(KJ.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(jYe)===-1)try{let a=e(o);n.headers={...n.headers,[jYe]:String(a)}}catch{}}return t({...r,request:n})}}var jYe,QQt,YJ,hhe=C(()=>{DYe();jYe="content-length";QQt={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},YJ=e=>({applyToStack:t=>{t.add(XQt(e.bodyLengthChecker),QQt)}})});var NYe=C(()=>{});var LYe=C(()=>{NYe()});var FYe=C(()=>{});var kYe=C(()=>{FYe()});var BYe=C(()=>{ls()});var $Ye=C(()=>{});var qYe=C(()=>{});function eer(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}var EE,UYe=C(()=>{EE=class e{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=eer(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}}});var ZJ,zYe=C(()=>{ZJ=class{constructor(t){this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;let r=t;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var HYe=C(()=>{});var VYe=C(()=>{});var fz=C(()=>{kYe();BYe();$Ye();qYe();UYe();zYe();HYe();VYe()});var mhe,WYe=C(()=>{fz();mhe=e=>ZJ.isInstance(e)?e.headers?.date??e.headers?.Date:void 0});var XJ,ghe=C(()=>{XJ=e=>new Date(Date.now()+e)});var JYe,GYe=C(()=>{ghe();JYe=(e,t)=>Math.abs(XJ(t).getTime()-e)>=3e5});var yhe,KYe=C(()=>{GYe();yhe=(e,t)=>{let r=Date.parse(e);return JYe(r,t)?r-Date.now():t}});var YYe=C(()=>{WYe();ghe();KYe()});var pz,ZYe,eA,XYe=C(()=>{fz();YYe();pz=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},ZYe=async e=>{let t=pz("context",e.context),r=pz("config",e.config),n=t.endpointV2?.properties?.authSchemes?.[0],i=await pz("signer",r.signer)(n),a=e?.signingRegion,s=e?.signingRegionSet,u=e?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},eA=class{async sign(t,r,n){if(!EE.isInstance(t))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await ZYe(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(t,{signingDate:XJ(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(t){return r=>{let n=r.ServerTime??mhe(r.$response);if(n){let o=pz("config",t.config),i=o.systemClockOffset;o.systemClockOffset=yhe(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(t,r){let n=mhe(t);if(n){let o=pz("config",r.config);o.systemClockOffset=yhe(n,o.systemClockOffset)}}}});var QYe=C(()=>{OE();nx()});function tZe(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){let n=e.slice(r,r+2).toLowerCase();if(n in bhe)t[r/2]=bhe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return t}function ig(e){let t="";for(let r=0;r<e.byteLength;r++)t+=eZe[e[r]];return t}var eZe,bhe,hz=C(()=>{eZe={},bhe={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),eZe[e]=t,bhe[t]=e}});var mz,_he=C(()=>{mz=e=>new TextEncoder().encode(e)});var PE,rZe=C(()=>{_he();PE=e=>typeof e=="string"?mz(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)});var nZe=C(()=>{});var gz=C(()=>{_he();rZe();nZe()});var oZe,iZe,vhe,aZe,sZe,whe,She,xhe,Che,ter,uZe,lZe,yz,cZe,dZe,fZe,pZe,QJ,hZe,mZe,gZe,Ohe,yZe,tA=C(()=>{oZe="X-Amz-Algorithm",iZe="X-Amz-Credential",vhe="X-Amz-Date",aZe="X-Amz-SignedHeaders",sZe="X-Amz-Expires",whe="X-Amz-Signature",She="X-Amz-Security-Token",xhe="authorization",Che=vhe.toLowerCase(),ter="date",uZe=[xhe,Che,ter],lZe=whe.toLowerCase(),yz="x-amz-content-sha256",cZe=She.toLowerCase(),dZe={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},fZe=/^proxy-/,pZe=/^sec-/,QJ="AWS4-HMAC-SHA256",hZe="AWS4-HMAC-SHA256-PAYLOAD",mZe="UNSIGNED-PAYLOAD",gZe=50,Ohe="aws4_request",yZe=60*60*24*7});var eG,Ehe,tG,_Ze,bZe,Phe=C(()=>{hz();gz();tA();eG={},Ehe=[],tG=(e,t,r)=>`${e}/${t}/${r}/${Ohe}`,_Ze=async(e,t,r,n,o)=>{let i=await bZe(e,t.secretAccessKey,t.accessKeyId),a=`${r}:${n}:${o}:${ig(i)}:${t.sessionToken}`;if(a in eG)return eG[a];for(Ehe.push(a);Ehe.length>gZe;)delete eG[Ehe.shift()];let s=`AWS4${t.secretAccessKey}`;for(let u of[r,n,o,Ohe])s=await bZe(e,s,u);return eG[a]=s},bZe=(e,t,r)=>{let n=new e(t);return n.update(PE(r)),n.digest()}});var rG,The=C(()=>{tA();rG=({headers:e},t,r)=>{let n={};for(let o of Object.keys(e).sort()){if(e[o]==null)continue;let i=o.toLowerCase();(i in dZe||t?.has(i)||fZe.test(i)||pZe.test(i))&&(!r||r&&!r.has(i))||(n[i]=e[o].trim().replace(/\s+/g," "))}return n}});var Mhe,Ihe=C(()=>{FJ();tA();Mhe=({query:e={}})=>{let t=[],r={};for(let n of Object.keys(e).sort()){if(n.toLowerCase()===lZe)continue;t.push(n);let o=e[n];typeof o=="string"?r[n]=`${xh(n)}=${xh(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).reduce((i,a)=>i.concat([`${xh(n)}=${xh(a)}`]),[]).sort().join("&"))}return t.map(n=>r[n]).filter(n=>n).join("&")}});var vZe,wZe=C(()=>{vZe=e=>typeof ArrayBuffer=="function"&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)==="[object ArrayBuffer]"});var bz,Ahe=C(()=>{wZe();hz();gz();tA();bz=async({headers:e,body:t},r)=>{for(let n of Object.keys(e))if(n.toLowerCase()===yz)return e[n];if(t==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof t=="string"||ArrayBuffer.isView(t)||vZe(t)){let n=new r;return n.update(PE(t)),ig(await n.digest())}return mZe}});function xZe(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var nG,SZe,rer,Rhe,CZe=C(()=>{hz();gz();nG=class{format(t){let r=[];for(let i of Object.keys(t)){let a=mz(i);r.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(t[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(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,t.value,!1),new Uint8Array(r.buffer);case"integer":let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,t.value,!1),new Uint8Array(n.buffer);case"long":let o=new Uint8Array(9);return o[0]=5,o.set(t.value.bytes,1),o;case"binary":let i=new DataView(new ArrayBuffer(3+t.value.byteLength));i.setUint8(0,6),i.setUint16(1,t.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(t.value,3),a;case"string":let s=mz(t.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(Rhe.fromNumber(t.value.valueOf()).bytes,1),c;case"uuid":if(!rer.test(t.value))throw new Error(`Invalid UUID received: ${t.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(tZe(t.value.replace(/\-/g,"")),1),d}}};(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(SZe||(SZe={}));rer=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,Rhe=class e{constructor(t){if(this.bytes=t,t.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>9223372036854776e3||t<-9223372036854776e3)throw new Error(`${t} 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(t));n>-1&&o>0;n--,o/=256)r[n]=o;return t<0&&xZe(r),new e(r)}valueOf(){let t=this.bytes.slice(0),r=t[0]&128;return r&&xZe(t),parseInt(ig(t),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var OZe,EZe=C(()=>{OZe=(e,t)=>{e=e.toLowerCase();for(let r of Object.keys(t))if(e===r.toLowerCase())return!0;return!1}});var Dhe,jhe=C(()=>{fz();Dhe=(e,t={})=>{let{headers:r,query:n={}}=EE.clone(e);for(let o of Object.keys(r)){let i=o.toLowerCase();i.slice(0,6)==="x-amz-"&&!t.unhoistableHeaders?.has(i)&&(n[o]=r[o],delete r[o])}return{...e,headers:r,query:n}}});var oG,Nhe=C(()=>{fz();tA();oG=e=>{e=EE.clone(e);for(let t of Object.keys(e.headers))uZe.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e}});var PZe,ner,TZe=C(()=>{PZe=e=>ner(e).toISOString().replace(/\.\d{3}Z$/,"Z"),ner=e=>typeof e=="number"?new Date(e*1e3):typeof e=="string"?Number(e)?new Date(Number(e)*1e3):new Date(e):e});var _z,iG,MZe,IZe=C(()=>{hz();ng();FJ();gz();tA();Phe();The();Ihe();Ahe();CZe();EZe();jhe();Nhe();TZe();_z=class{constructor({applyChecksum:t,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new nG,this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof t=="boolean"?t:!0,this.regionProvider=zc(n),this.credentialProvider=zc(r)}async presign(t,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}=iG(n);if(o>yZe)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let h=tG(p,d,l??this.service),m=Dhe(oG(t),{unhoistableHeaders:a});c.sessionToken&&(m.query[She]=c.sessionToken),m.query[oZe]=QJ,m.query[iZe]=`${c.accessKeyId}/${h}`,m.query[vhe]=f,m.query[sZe]=o.toString(10);let _=rG(m,i,s);return m.query[aZe]=MZe(_),m.query[whe]=await this.getSignature(f,h,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(m,_,await bz(t,this.sha256))),m}async sign(t,r){return typeof t=="string"?this.signString(t,r):t.headers&&t.payload?this.signEvent(t,r):t.message?this.signMessage(t,r):this.signRequest(t,r)}async signEvent({headers:t,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=iG(n),c=tG(u,s,a??this.service),d=await bz({headers:{},body:r},this.sha256),f=new this.sha256;f.update(t);let p=ig(await f.digest()),h=[hZe,l,c,o,p,d].join(`
`);return this.signString(h,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(t,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerFormatter.format(t.message.headers),payload:t.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:t.priorSignature}).then(a=>({message:t.message,signature:a}))}async signString(t,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=iG(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update(PE(t)),ig(await u.digest())}async signRequest(t,{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=oG(t),{longDate:c,shortDate:d}=iG(r),f=tG(d,u,a??this.service);l.headers[Che]=c,s.sessionToken&&(l.headers[cZe]=s.sessionToken);let p=await bz(l,this.sha256);!OZe(yz,l.headers)&&this.applyChecksum&&(l.headers[yz]=p);let h=rG(l,o,n),m=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,h,p));return l.headers[xhe]=`${QJ} Credential=${s.accessKeyId}/${f}, SignedHeaders=${MZe(h)}, Signature=${m}`,l}createCanonicalRequest(t,r,n){let o=Object.keys(r).sort();return`${t.method}
${this.getCanonicalPath(t)}
${Mhe(t)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}
${o.join(";")}
${n}`}async createStringToSign(t,r,n){let o=new this.sha256;o.update(PE(n));let i=await o.digest();return`${QJ}
${t}
${r}
${ig(i)}`}getCanonicalPath({path:t}){if(this.uriEscapePath){let r=[];for(let i of t.split("/"))i?.length!==0&&i!=="."&&(i===".."?r.pop():r.push(i));let n=`${t?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&t?.endsWith("/")?"/":""}`;return xh(n).replace(/%2F/g,"/")}return t}async getSignature(t,r,n,o){let i=await this.createStringToSign(t,r,o),a=new this.sha256(await n);return a.update(PE(i)),ig(await a.digest())}getSigningKey(t,r,n,o){return _Ze(this.sha256,t,n,r,o||this.service)}validateResolvedCredentials(t){if(typeof t!="object"||typeof t.accessKeyId!="string"||typeof t.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}},iG=e=>{let t=PZe(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.slice(0,8)}},MZe=e=>Object.keys(e).sort().join(";")});var AZe=C(()=>{IZe();The();Ihe();Ahe();jhe();Nhe();Phe()});var aG,RZe=C(()=>{OE();AZe();aG=e=>{let t;e.credentials&&(t=yYe(e.credentials,gYe,fhe)),t||(e.credentialDefaultProvider?t=bN(e.credentialDefaultProvider(Object.assign({},e,{parentClientConfig:e}))):t=async()=>{throw new Error("`credentials` is missing")});let{signingEscapePath:r=!0,systemClockOffset:n=e.systemClockOffset||0,sha256:o}=e,i;return e.signer?i=bN(e.signer):e.regionInfoProvider?i=()=>bN(e.region)().then(async a=>[await e.regionInfoProvider(a,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},a]).then(([a,s])=>{let{signingRegion:u,signingService:l}=a;e.signingRegion=e.signingRegion||u||s,e.signingName=e.signingName||l||e.serviceId;let c={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:r},d=e.signerConstructor||_z;return new d(c)}):i=async a=>{a=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await bN(e.region)(),properties:{}},a);let s=a.signingRegion,u=a.signingName;e.signingRegion=e.signingRegion||s,e.signingName=e.signingName||u||e.serviceId;let l={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:r},c=e.signerConstructor||_z;return new c(l)},{...e,systemClockOffset:n,signingEscapePath:r,credentials:t,signer:i}}});var DZe=C(()=>{XYe();QYe();RZe()});var jZe=C(()=>{DZe()});var NZe=C(()=>{});var LZe=C(()=>{Nt()});var sG,Lhe=C(()=>{Nt();sG=(e,t)=>CE(e,t).then(r=>t.utf8Encoder(r))});var Ja,FZe,kZe,BZe=C(()=>{Lhe();Ja=(e,t)=>sG(e,t).then(r=>{if(r.length)try{return JSON.parse(r)}catch(n){throw n?.name==="SyntaxError"&&Object.defineProperty(n,"$responseBodyText",{value:r}),n}return{}}),FZe=async(e,t)=>{let r=await Ja(e,t);return r.message=r.message??r.Message,r},kZe=(e,t)=>{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(e.headers,"x-amzn-errortype");if(o!==void 0)return n(e.headers[o]);if(t.code!==void 0)return n(t.code);if(t.__type!==void 0)return n(t.__type)}});var uG=b(ux=>{"use strict";var $Ze=":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",oer=$Ze+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",qZe="["+$Ze+"]["+oer+"]*",ier=new RegExp("^"+qZe+"$"),aer=function(e,t){let r=[],n=t.exec(e);for(;n;){let o=[];o.startIndex=t.lastIndex-n[0].length;let i=n.length;for(let a=0;a<i;a++)o.push(n[a]);r.push(o),n=t.exec(e)}return r},ser=function(e){let t=ier.exec(e);return!(t===null||typeof t>"u")};ux.isExist=function(e){return typeof e<"u"};ux.isEmptyObject=function(e){return Object.keys(e).length===0};ux.merge=function(e,t,r){if(t){let n=Object.keys(t),o=n.length;for(let i=0;i<o;i++)r==="strict"?e[n[i]]=[t[n[i]]]:e[n[i]]=t[n[i]]}};ux.getValue=function(e){return ux.isExist(e)?e:""};ux.isName=ser;ux.getAllMatches=aer;ux.nameRegexp=qZe});var khe=b(WZe=>{"use strict";var Fhe=uG(),uer={allowBooleanAttributes:!1,unpairedTags:[]};WZe.validate=function(e,t){t=Object.assign({},uer,t);let r=[],n=!1,o=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=zZe(e,i),i.err)return i}else if(e[i]==="<"){let a=i;if(i++,e[i]==="!"){i=HZe(e,i);continue}else{let s=!1;e[i]==="/"&&(s=!0,i++);let u="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
`&&e[i]!=="\r";i++)u+=e[i];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),i--),!ger(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",Ga("InvalidTag",d,Dd(e,i))}let l=der(e,i);if(l===!1)return Ga("InvalidAttr","Attributes for '"+u+"' have open quote.",Dd(e,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=VZe(c,t);if(f===!0)n=!0;else return Ga(f.err.code,f.err.msg,Dd(e,d+f.err.line))}else if(s)if(l.tagClosed){if(c.trim().length>0)return Ga("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",Dd(e,a));if(r.length===0)return Ga("InvalidTag","Closing tag '"+u+"' has not been opened.",Dd(e,a));{let d=r.pop();if(u!==d.tagName){let f=Dd(e,d.tagStartPos);return Ga("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",Dd(e,a))}r.length==0&&(o=!0)}}else return Ga("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",Dd(e,i));else{let d=VZe(c,t);if(d!==!0)return Ga(d.err.code,d.err.msg,Dd(e,i-c.length+d.err.line));if(o===!0)return Ga("InvalidXml","Multiple possible root nodes found.",Dd(e,i));t.unpairedTags.indexOf(u)!==-1||r.push({tagName:u,tagStartPos:a}),n=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=HZe(e,i);continue}else if(e[i+1]==="?"){if(i=zZe(e,++i),i.err)return i}else break;else if(e[i]==="&"){let d=her(e,i);if(d==-1)return Ga("InvalidChar","char '&' is not expected.",Dd(e,i));i=d}else if(o===!0&&!UZe(e[i]))return Ga("InvalidXml","Extra text at the end",Dd(e,i));e[i]==="<"&&i--}}else{if(UZe(e[i]))continue;return Ga("InvalidChar","char '"+e[i]+"' is not expected.",Dd(e,i))}if(n){if(r.length==1)return Ga("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Dd(e,r[0].tagStartPos));if(r.length>0)return Ga("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Ga("InvalidXml","Start tag expected.",1);return!0};function UZe(e){return e===" "||e===" "||e===`
`||e==="\r"}function zZe(e,t){let r=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let n=e.substr(r,t-r);if(t>5&&n==="xml")return Ga("InvalidXml","XML declaration allowed only at the start of the document.",Dd(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function HZe(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let r=1;for(t+=8;t<e.length;t++)if(e[t]==="<")r++;else if(e[t]===">"&&(r--,r===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}var ler='"',cer="'";function der(e,t){let r="",n="",o=!1;for(;t<e.length;t++){if(e[t]===ler||e[t]===cer)n===""?n=e[t]:n!==e[t]||(n="");else if(e[t]===">"&&n===""){o=!0;break}r+=e[t]}return n!==""?!1:{value:r,index:t,tagClosed:o}}var fer=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function VZe(e,t){let r=Fhe.getAllMatches(e,fer),n={};for(let o=0;o<r.length;o++){if(r[o][1].length===0)return Ga("InvalidAttr","Attribute '"+r[o][2]+"' has no space in starting.",vz(r[o]));if(r[o][3]!==void 0&&r[o][4]===void 0)return Ga("InvalidAttr","Attribute '"+r[o][2]+"' is without value.",vz(r[o]));if(r[o][3]===void 0&&!t.allowBooleanAttributes)return Ga("InvalidAttr","boolean attribute '"+r[o][2]+"' is not allowed.",vz(r[o]));let i=r[o][2];if(!mer(i))return Ga("InvalidAttr","Attribute '"+i+"' is an invalid name.",vz(r[o]));if(!n.hasOwnProperty(i))n[i]=1;else return Ga("InvalidAttr","Attribute '"+i+"' is repeated.",vz(r[o]))}return!0}function per(e,t){let r=/\d/;for(e[t]==="x"&&(t++,r=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(r))break}return-1}function her(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,per(e,t);let r=0;for(;t<e.length;t++,r++)if(!(e[t].match(/\w/)&&r<20)){if(e[t]===";")break;return-1}return t}function Ga(e,t,r){return{err:{code:e,msg:t,line:r.line||r,col:r.col}}}function mer(e){return Fhe.isName(e)}function ger(e){return Fhe.isName(e)}function Dd(e,t){let r=e.substring(0,t).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function vz(e){return e.startIndex+e[1].length}});var GZe=b(Bhe=>{var JZe={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(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,r){return e}},yer=function(e){return Object.assign({},JZe,e)};Bhe.buildOptions=yer;Bhe.defaultOptions=JZe});var YZe=b((mVn,KZe)=>{"use strict";var $he=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,r){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:r})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}};KZe.exports=$he});var XZe=b((gVn,ZZe)=>{var ber=uG();function _er(e,t){let r={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let n=1,o=!1,i=!1,a="";for(;t<e.length;t++)if(e[t]==="<"&&!i){if(o&&Ser(e,t))t+=7,[entityName,val,t]=ver(e,t+1),val.indexOf("&")===-1&&(r[Eer(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(o&&xer(e,t))t+=8;else if(o&&Cer(e,t))t+=8;else if(o&&Oer(e,t))t+=9;else if(wer)i=!0;else throw new Error("Invalid DOCTYPE");n++,a=""}else if(e[t]===">"){if(i?e[t-1]==="-"&&e[t-2]==="-"&&(i=!1,n--):n--,n===0)break}else e[t]==="["?o=!0:a+=e[t];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:t}}function ver(e,t){let r="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)r+=e[t];if(r=r.trim(),r.indexOf(" ")!==-1)throw new Error("External entites are not supported");let n=e[t++],o="";for(;t<e.length&&e[t]!==n;t++)o+=e[t];return[r,o,t]}function wer(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function Ser(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="N"&&e[t+4]==="T"&&e[t+5]==="I"&&e[t+6]==="T"&&e[t+7]==="Y"}function xer(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="L"&&e[t+4]==="E"&&e[t+5]==="M"&&e[t+6]==="E"&&e[t+7]==="N"&&e[t+8]==="T"}function Cer(e,t){return e[t+1]==="!"&&e[t+2]==="A"&&e[t+3]==="T"&&e[t+4]==="T"&&e[t+5]==="L"&&e[t+6]==="I"&&e[t+7]==="S"&&e[t+8]==="T"}function Oer(e,t){return e[t+1]==="!"&&e[t+2]==="N"&&e[t+3]==="O"&&e[t+4]==="T"&&e[t+5]==="A"&&e[t+6]==="T"&&e[t+7]==="I"&&e[t+8]==="O"&&e[t+9]==="N"}function Eer(e){if(ber.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}ZZe.exports=_er});var eXe=b((yVn,QZe)=>{var Per=/^[-+]?0x[a-fA-F0-9]+$/,Ter=/^([\-\+])?(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 Mer={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Ier(e,t={}){if(t=Object.assign({},Mer,t),!e||typeof e!="string")return e;let r=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(r))return e;if(t.hex&&Per.test(r))return Number.parseInt(r,16);{let n=Ter.exec(r);if(n){let o=n[1],i=n[2],a=Aer(n[3]),s=n[4]||n[6];if(!t.leadingZeros&&i.length>0&&o&&r[2]!==".")return e;if(!t.leadingZeros&&i.length>0&&!o&&r[1]!==".")return e;{let u=Number(r),l=""+u;return l.search(/[eE]/)!==-1||s?t.eNotation?u:e:r.indexOf(".")!==-1?l==="0"&&a===""||l===a||o&&l==="-"+a?u:e:i?a===l||o+a===l?u:e:r===l||r===o+l?u:e}}else return e}}function Aer(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substr(0,e.length-1))),e}QZe.exports=Ier});var nXe=b((bVn,rXe)=>{"use strict";var tXe=uG(),wz=YZe(),Rer=XZe(),Der=eXe(),qhe=class{constructor(t){this.options=t,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=jer,this.parseXml=Ber,this.parseTextData=Ner,this.resolveNameSpace=Ler,this.buildAttributesMap=ker,this.isItStopNode=zer,this.replaceEntitiesValue=qer,this.readStopNodeData=Ver,this.saveTextToParentTag=Uer,this.addChild=$er}};function jer(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:e[n]}}}function Ner(e,t,r,n,o,i,a){if(e!==void 0&&(this.options.trimValues&&!n&&(e=e.trim()),e.length>0)){a||(e=this.replaceEntitiesValue(e));let s=this.options.tagValueProcessor(t,e,r,o,i);return s==null?e:typeof s!=typeof e||s!==e?s:this.options.trimValues?zhe(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?zhe(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Ler(e){if(this.options.removeNSPrefix){let t=e.split(":"),r=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=r+t[1])}return e}var Fer=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function ker(e,t,r){if(!this.options.ignoreAttributes&&typeof e=="string"){let n=tXe.getAllMatches(e,Fer),o=n.length,i={};for(let a=0;a<o;a++){let s=this.resolveNameSpace(n[a][1]),u=n[a][4],l=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u);let c=this.options.attributeValueProcessor(s,u,t);c==null?i[l]=u:typeof c!=typeof u||c!==u?i[l]=c:i[l]=zhe(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[l]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){let a={};return a[this.options.attributesGroupName]=i,a}return i}}var Ber=function(e){e=e.replace(/\r\n?/g,`
`);let t=new wz("!xml"),r=t,n="",o="";for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){let s=rA(e,">",i,"Closing Tag is not closed."),u=e.substring(i+2,s).trim();if(this.options.removeNSPrefix){let d=u.indexOf(":");d!==-1&&(u=u.substr(d+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&(n=this.saveTextToParentTag(n,r,o));let l=o.substring(o.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let c=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(c=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=o.lastIndexOf("."),o=o.substring(0,c),r=this.tagsNodeStack.pop(),n="",i=s}else if(e[i+1]==="?"){let s=Uhe(e,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 wz(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(e.substr(i+1,3)==="!--"){let s=rA(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let u=e.substring(i+4,s-2);n=this.saveTextToParentTag(n,r,o),r.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=s}else if(e.substr(i+1,2)==="!D"){let s=Rer(e,i);this.docTypeEntities=s.entities,i=s.i}else if(e.substr(i+1,2)==="!["){let s=rA(e,"]]>",i,"CDATA is not closed.")-2,u=e.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=Uhe(e,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!==t.tagname&&(o+=o?"."+u:u),this.isItStopNode(this.options.stopNodes,o,u)){let h="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),i=s.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=s.closeIndex;else{let _=this.readStopNodeData(e,l,f+1);if(!_)throw new Error(`Unexpected end of ${l}`);i=_.i,h=_.tagContent}let m=new wz(u);u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),h&&(h=this.parseTextData(h,u,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),m.add(this.options.textNodeName,h),this.addChild(r,m,o)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));let h=new wz(u);u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,h,o),o=o.substr(0,o.lastIndexOf("."))}else{let h=new wz(u);this.tagsNodeStack.push(r),u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,h,o),r=h}n="",i=f}}else n+=e[i];return t.child};function $er(e,t,r){let n=this.options.updateTag(t.tagname,r,t[":@"]);n===!1||(typeof n=="string"&&(t.tagname=n),e.addChild(t))}var qer=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){let r=this.docTypeEntities[t];e=e.replace(r.regx,r.val)}for(let t in this.lastEntities){let r=this.lastEntities[t];e=e.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){let r=this.htmlEntities[t];e=e.replace(r.regex,r.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function Uer(e,t,r,n){return e&&(n===void 0&&(n=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,r,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,n),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function zer(e,t,r){let n="*."+r;for(let o in e){let i=e[o];if(n===i||t===i)return!0}return!1}function Her(e,t,r=">"){let n,o="";for(let i=t;i<e.length;i++){let a=e[i];if(n)a===n&&(n="");else if(a==='"'||a==="'")n=a;else if(a===r[0])if(r[1]){if(e[i+1]===r[1])return{data:o,index:i}}else return{data:o,index:i};else a===" "&&(a=" ");o+=a}}function rA(e,t,r,n){let o=e.indexOf(t,r);if(o===-1)throw new Error(n);return o+t.length-1}function Uhe(e,t,r,n=">"){let o=Her(e,t+1,n);if(!o)return;let i=o.data,a=o.index,s=i.search(/\s/),u=i,l=!0;s!==-1&&(u=i.substring(0,s),i=i.substring(s+1).trimStart());let c=u;if(r){let d=u.indexOf(":");d!==-1&&(u=u.substr(d+1),l=u!==o.data.substr(d+1))}return{tagName:u,tagExp:i,closeIndex:a,attrExpPresent:l,rawTagName:c}}function Ver(e,t,r){let n=r,o=1;for(;r<e.length;r++)if(e[r]==="<")if(e[r+1]==="/"){let i=rA(e,">",r,`${t} is not closed`);if(e.substring(r+2,i).trim()===t&&(o--,o===0))return{tagContent:e.substring(n,r),i};r=i}else if(e[r+1]==="?")r=rA(e,"?>",r+1,"StopNode is not closed.");else if(e.substr(r+1,3)==="!--")r=rA(e,"-->",r+3,"StopNode is not closed.");else if(e.substr(r+1,2)==="![")r=rA(e,"]]>",r,"StopNode is not closed.")-2;else{let i=Uhe(e,r,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,r=i.closeIndex)}}function zhe(e,t,r){if(t&&typeof e=="string"){let n=e.trim();return n==="true"?!0:n==="false"?!1:Der(e,r)}else return tXe.isExist(e)?e:""}rXe.exports=qhe});var aXe=b(iXe=>{"use strict";function Wer(e,t){return oXe(e,t)}function oXe(e,t,r){let n,o={};for(let i=0;i<e.length;i++){let a=e[i],s=Jer(a),u="";if(r===void 0?u=s:u=r+"."+s,s===t.textNodeName)n===void 0?n=a[s]:n+=""+a[s];else{if(s===void 0)continue;if(a[s]){let l=oXe(a[s],t,u),c=Ker(l,t);a[":@"]?Ger(l,a[":@"],u,t):Object.keys(l).length===1&&l[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?l=l[t.textNodeName]:Object.keys(l).length===0&&(t.alwaysCreateTextNode?l[t.textNodeName]="":l=""),o[s]!==void 0&&o.hasOwnProperty(s)?(Array.isArray(o[s])||(o[s]=[o[s]]),o[s].push(l)):t.isArray(s,u,c)?o[s]=[l]:o[s]=l}}}return typeof n=="string"?n.length>0&&(o[t.textNodeName]=n):n!==void 0&&(o[t.textNodeName]=n),o}function Jer(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];if(n!==":@")return n}}function Ger(e,t,r,n){if(t){let o=Object.keys(t),i=o.length;for(let a=0;a<i;a++){let s=o[a];n.isArray(s,r+"."+s,!0,!0)?e[s]=[t[s]]:e[s]=t[s]}}}function Ker(e,t){let{textNodeName:r}=t,n=Object.keys(e).length;return!!(n===0||n===1&&(e[r]||typeof e[r]=="boolean"||e[r]===0))}iXe.prettify=Wer});var uXe=b((vVn,sXe)=>{var{buildOptions:Yer}=GZe(),Zer=nXe(),{prettify:Xer}=aXe(),Qer=khe(),Hhe=class{constructor(t){this.externalEntities={},this.options=Yer(t)}parse(t,r){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let i=Qer.validate(t,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new Zer(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(t);return this.options.preserveOrder||o===void 0?o:Xer(o,this.options)}addEntity(t,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=r}};sXe.exports=Hhe});var pXe=b((wVn,fXe)=>{var etr=`
`;function ttr(e,t){let r="";return t.format&&t.indentBy.length>0&&(r=etr),cXe(e,t,"",r)}function cXe(e,t,r,n){let o="",i=!1;for(let a=0;a<e.length;a++){let s=e[a],u=rtr(s);if(u===void 0)continue;let l="";if(r.length===0?l=u:l=`${r}.${u}`,u===t.textNodeName){let h=s[u];ntr(l,t)||(h=t.tagValueProcessor(u,h),h=dXe(h,t)),i&&(o+=n),o+=h,i=!1;continue}else if(u===t.cdataPropName){i&&(o+=n),o+=`<![CDATA[${s[u][0][t.textNodeName]}]]>`,i=!1;continue}else if(u===t.commentPropName){o+=n+`<!--${s[u][0][t.textNodeName]}-->`,i=!0;continue}else if(u[0]==="?"){let h=lXe(s[":@"],t),m=u==="?xml"?"":n,_=s[u][0][t.textNodeName];_=_.length!==0?" "+_:"",o+=m+`<${u}${_}${h}?>`,i=!0;continue}let c=n;c!==""&&(c+=t.indentBy);let d=lXe(s[":@"],t),f=n+`<${u}${d}`,p=cXe(s[u],t,l,c);t.unpairedTags.indexOf(u)!==-1?t.suppressUnpairedNode?o+=f+">":o+=f+"/>":(!p||p.length===0)&&t.suppressEmptyNode?o+=f+"/>":p&&p.endsWith(">")?o+=f+`>${p}${n}</${u}>`:(o+=f+">",p&&n!==""&&(p.includes("/>")||p.includes("</"))?o+=n+t.indentBy+p+n:o+=p,o+=`</${u}>`),i=!0}return o}function rtr(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];if(e.hasOwnProperty(n)&&n!==":@")return n}}function lXe(e,t){let r="";if(e&&!t.ignoreAttributes)for(let n in e){if(!e.hasOwnProperty(n))continue;let o=t.attributeValueProcessor(n,e[n]);o=dXe(o,t),o===!0&&t.suppressBooleanAttributes?r+=` ${n.substr(t.attributeNamePrefix.length)}`:r+=` ${n.substr(t.attributeNamePrefix.length)}="${o}"`}return r}function ntr(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let r=e.substr(e.lastIndexOf(".")+1);for(let n in t.stopNodes)if(t.stopNodes[n]===e||t.stopNodes[n]==="*."+r)return!0;return!1}function dXe(e,t){if(e&&e.length>0&&t.processEntities)for(let r=0;r<t.entities.length;r++){let n=t.entities[r];e=e.replace(n.regex,n.val)}return e}fXe.exports=ttr});var mXe=b((SVn,hXe)=>{"use strict";var otr=pXe(),itr={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function TE(e){this.options=Object.assign({},itr,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=utr),this.processTextOrObjNode=atr,this.options.format?(this.indentate=str,this.tagEndChar=`>
`,this.newLine=`
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}TE.prototype.build=function(e){return this.options.preserveOrder?otr(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};TE.prototype.j2x=function(e,t){let r="",n="";for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o))if(typeof e[o]>"u")this.isAttribute(o)&&(n+="");else if(e[o]===null)this.isAttribute(o)?n+="":o[0]==="?"?n+=this.indentate(t)+"<"+o+"?"+this.tagEndChar:n+=this.indentate(t)+"<"+o+"/"+this.tagEndChar;else if(e[o]instanceof Date)n+=this.buildTextValNode(e[o],o,"",t);else if(typeof e[o]!="object"){let i=this.isAttribute(o);if(i)r+=this.buildAttrPairStr(i,""+e[o]);else if(o===this.options.textNodeName){let a=this.options.tagValueProcessor(o,""+e[o]);n+=this.replaceEntitiesValue(a)}else n+=this.buildTextValNode(e[o],o,"",t)}else if(Array.isArray(e[o])){let i=e[o].length,a="",s="";for(let u=0;u<i;u++){let l=e[o][u];if(!(typeof l>"u"))if(l===null)o[0]==="?"?n+=this.indentate(t)+"<"+o+"?"+this.tagEndChar:n+=this.indentate(t)+"<"+o+"/"+this.tagEndChar;else if(typeof l=="object")if(this.options.oneListGroup){let c=this.j2x(l,t+1);a+=c.val,this.options.attributesGroupName&&l.hasOwnProperty(this.options.attributesGroupName)&&(s+=c.attrStr)}else a+=this.processTextOrObjNode(l,o,t);else if(this.options.oneListGroup){let c=this.options.tagValueProcessor(o,l);c=this.replaceEntitiesValue(c),a+=c}else a+=this.buildTextValNode(l,o,"",t)}this.options.oneListGroup&&(a=this.buildObjectNode(a,o,s,t)),n+=a}else if(this.options.attributesGroupName&&o===this.options.attributesGroupName){let i=Object.keys(e[o]),a=i.length;for(let s=0;s<a;s++)r+=this.buildAttrPairStr(i[s],""+e[o][i[s]])}else n+=this.processTextOrObjNode(e[o],o,t);return{attrStr:r,val:n}};TE.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function atr(e,t,r){let n=this.j2x(e,r+1);return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,n.attrStr,r):this.buildObjectNode(n.val,t,n.attrStr,r)}TE.prototype.buildObjectNode=function(e,t,r,n){if(e==="")return t[0]==="?"?this.indentate(n)+"<"+t+r+"?"+this.tagEndChar:this.indentate(n)+"<"+t+r+this.closeTag(t)+this.tagEndChar;{let o="</"+t+this.tagEndChar,i="";return t[0]==="?"&&(i="?",o=""),(r||r==="")&&e.indexOf("<")===-1?this.indentate(n)+"<"+t+r+i+">"+e+o:this.options.commentPropName!==!1&&t===this.options.commentPropName&&i.length===0?this.indentate(n)+`<!--${e}-->`+this.newLine:this.indentate(n)+"<"+t+r+i+this.tagEndChar+e+this.indentate(n)+o}};TE.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};TE.prototype.buildTextValNode=function(e,t,r,n){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(n)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(n)+"<"+t+r+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),o===""?this.indentate(n)+"<"+t+r+this.closeTag(t)+this.tagEndChar:this.indentate(n)+"<"+t+r+">"+o+"</"+t+this.tagEndChar}};TE.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let r=this.options.entities[t];e=e.replace(r.regex,r.val)}return e};function str(e){return this.options.indentBy.repeat(e)}function utr(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}hXe.exports=TE});var yXe=b((xVn,gXe)=>{"use strict";var ltr=khe(),ctr=uXe(),dtr=mXe();gXe.exports={XMLParser:ctr,XMLValidator:ltr,XMLBuilder:dtr}});var bXe,qy,_Xe,vXe=C(()=>{Nt();bXe=B(yXe());Lhe();qy=(e,t)=>sG(e,t).then(r=>{if(r.length){let n=new bXe.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]),lhe(s)}return{}}),_Xe=async(e,t)=>{let r=await qy(e,t);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r}});var wXe=C(()=>{NZe();LZe();BZe();vXe()});var nA=C(()=>{LYe();jZe();wXe()});function ftr(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:e.region},propertiesExtractor:(t,r)=>({signingProperties:{config:t,context:r}})}}function lG(e){return{schemeId:"smithy.api#noAuth"}}var SXe,xXe,CXe,Vhe=C(()=>{nA();ng();SXe=async(e,t,r)=>({operation:ky(t).operation,region:await zc(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});xXe=e=>{let t=[];switch(e.operation){case"GetCredentialsForIdentity":{t.push(lG(e));break}case"GetId":{t.push(lG(e));break}case"GetOpenIdToken":{t.push(lG(e));break}case"UnlinkIdentity":{t.push(lG(e));break}default:t.push(ftr(e))}return t},CXe=e=>({...aG(e)})});var OXe,Yt,Si=C(()=>{OXe=e=>({...e,useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),Yt={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var PXe,EXe=C(()=>{PXe={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 Whe,Jhe,TXe,MXe=C(()=>{Whe={name:"SHA-256"},Jhe={name:"HMAC",hash:Whe},TXe=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 _N(){return typeof window<"u"?window:typeof self<"u"?self:htr}var htr,Ghe=C(()=>{htr={}});var vN,Khe,Yhe=C(()=>{vN=B(WW());MXe();Ghe();Khe=function(){function e(t){this.toHash=new Uint8Array(0),this.secret=t,this.reset()}return e.prototype.update=function(t){if(!(0,vN.isEmptyData)(t)){var r=(0,vN.convertToBuffer)(t),n=new Uint8Array(this.toHash.byteLength+r.byteLength);n.set(this.toHash,0),n.set(r,this.toHash.byteLength),this.toHash=n}},e.prototype.digest=function(){var t=this;return this.key?this.key.then(function(r){return _N().crypto.subtle.sign(Jhe,r,t.toHash).then(function(n){return new Uint8Array(n)})}):(0,vN.isEmptyData)(this.toHash)?Promise.resolve(TXe):Promise.resolve().then(function(){return _N().crypto.subtle.digest(Whe,t.toHash)}).then(function(r){return Promise.resolve(new Uint8Array(r))})},e.prototype.reset=function(){var t=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(r,n){_N().crypto.subtle.importKey("raw",(0,vN.convertToBuffer)(t.secret),Jhe,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},e}()});function IXe(e){if(gtr(e)&&typeof e.crypto.subtle=="object"){var t=e.crypto.subtle;return ytr(t)}return!1}function gtr(e){if(typeof e=="object"&&typeof e.crypto=="object"){var t=e.crypto.getRandomValues;return typeof t=="function"}return!1}function ytr(e){return e&&mtr.every(function(t){return typeof e[t]=="function"})}var mtr,AXe=C(()=>{mtr=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var RXe=C(()=>{AXe()});var DXe,jXe,cG,NXe=C(()=>{Yhe();DXe=B(Xfe());RXe();Ghe();jXe=B(WW()),cG=function(){function e(t){IXe(_N())?this.hash=new Khe(t):this.hash=new DXe.Sha256(t)}return e.prototype.update=function(t,r){this.hash.update((0,jXe.convertToBuffer)(t))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}()});var Zhe=C(()=>{NXe();Yhe()});var Qhe=b((Sz,Xhe)=>{(function(e,t){typeof Sz=="object"&&typeof Xhe=="object"?Xhe.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Sz=="object"?Sz.bowser=t():e.bowser=t()})(Sz,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,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(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n=r(18),o=function(){function i(){}return i.getFirstMatch=function(a,s){var u=s.match(a);return u&&u.length>0&&u[1]||""},i.getSecondMatch=function(a,s){var u=s.match(a);return u&&u.length>1&&u[2]||""},i.matchAndReturnConst=function(a,s,u){if(a.test(s))return u},i.getWindowsVersionName=function(a){switch(a){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),s[0]===10)switch(s[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},i.getAndroidVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),!(s[0]===1&&s[1]<5))return s[0]===1&&s[1]<6?"Cupcake":s[0]===1&&s[1]>=6?"Donut":s[0]===2&&s[1]<2?"Eclair":s[0]===2&&s[1]===2?"Froyo":s[0]===2&&s[1]>2?"Gingerbread":s[0]===3?"Honeycomb":s[0]===4&&s[1]<1?"Ice Cream Sandwich":s[0]===4&&s[1]<4?"Jelly Bean":s[0]===4&&s[1]>=4?"KitKat":s[0]===5?"Lollipop":s[0]===6?"Marshmallow":s[0]===7?"Nougat":s[0]===8?"Oreo":s[0]===9?"Pie":void 0},i.getVersionPrecision=function(a){return a.split(".").length},i.compareVersions=function(a,s,u){u===void 0&&(u=!1);var l=i.getVersionPrecision(a),c=i.getVersionPrecision(s),d=Math.max(l,c),f=0,p=i.map([a,s],function(h){var m=d-i.getVersionPrecision(h),_=h+new Array(m+1).join(".0");return i.map(_.split("."),function(g){return new Array(20-g.length).join("0")+g}).reverse()});for(u&&(f=d-Math.min(l,c)),d-=1;d>=f;){if(p[0][d]>p[1][d])return 1;if(p[0][d]===p[1][d]){if(d===f)return 0;d-=1}else if(p[0][d]<p[1][d])return-1}},i.map=function(a,s){var u,l=[];if(Array.prototype.map)return Array.prototype.map.call(a,s);for(u=0;u<a.length;u+=1)l.push(s(a[u]));return l},i.find=function(a,s){var u,l;if(Array.prototype.find)return Array.prototype.find.call(a,s);for(u=0,l=a.length;u<l;u+=1){var c=a[u];if(s(c,u))return c}},i.assign=function(a){for(var s,u,l=a,c=arguments.length,d=new Array(c>1?c-1:0),f=1;f<c;f++)d[f-1]=arguments[f];if(Object.assign)return Object.assign.apply(Object,[a].concat(d));var p=function(){var h=d[s];typeof h=="object"&&h!==null&&Object.keys(h).forEach(function(m){l[m]=h[m]})};for(s=0,u=d.length;s<u;s+=1)p();return a},i.getBrowserAlias=function(a){return n.BROWSER_ALIASES_MAP[a]},i.getBrowserTypeByAlias=function(a){return n.BROWSER_MAP[a]||""},i}();t.default=o,e.exports=t.default},18:function(e,t,r){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,o=(n=r(91))&&n.__esModule?n:{default:n},i=r(18);function a(u,l){for(var c=0;c<l.length;c++){var d=l[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(u,d.key,d)}}var s=function(){function u(){}var l,c,d;return u.getParser=function(f,p){if(p===void 0&&(p=!1),typeof f!="string")throw new Error("UserAgent should be a string");return new o.default(f,p)},u.parse=function(f){return new o.default(f).getResult()},l=u,d=[{key:"BROWSER_MAP",get:function(){return i.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return i.ENGINE_MAP}},{key:"OS_MAP",get:function(){return i.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return i.PLATFORMS_MAP}}],(c=null)&&a(l.prototype,c),d&&a(l,d),u}();t.default=s,e.exports=t.default},91:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n=u(r(92)),o=u(r(93)),i=u(r(94)),a=u(r(95)),s=u(r(17));function u(c){return c&&c.__esModule?c:{default:c}}var l=function(){function c(f,p){if(p===void 0&&(p=!1),f==null||f==="")throw new Error("UserAgent parameter can't be empty");this._ua=f,this.parsedResult={},p!==!0&&this.parse()}var d=c.prototype;return d.getUA=function(){return this._ua},d.test=function(f){return f.test(this._ua)},d.parseBrowser=function(){var f=this;this.parsedResult.browser={};var p=s.default.find(n.default,function(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.browser=p.describe(this.getUA())),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(f){return f?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var f=this;this.parsedResult.os={};var p=s.default.find(o.default,function(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.os=p.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(f){var p=this.getOS().name;return f?String(p).toLowerCase()||"":p||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(f){f===void 0&&(f=!1);var p=this.getPlatform().type;return f?String(p).toLowerCase()||"":p||""},d.parsePlatform=function(){var f=this;this.parsedResult.platform={};var p=s.default.find(i.default,function(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.platform=p.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(f){return f?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var f=this;this.parsedResult.engine={};var p=s.default.find(a.default,function(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.engine=p.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return s.default.assign({},this.parsedResult)},d.satisfies=function(f){var p=this,h={},m=0,_={},g=0;if(Object.keys(f).forEach(function(A){var j=f[A];typeof j=="string"?(_[A]=j,g+=1):typeof j=="object"&&(h[A]=j,m+=1)}),m>0){var v=Object.keys(h),S=s.default.find(v,function(A){return p.isOS(A)});if(S){var x=this.satisfies(h[S]);if(x!==void 0)return x}var O=s.default.find(v,function(A){return p.isPlatform(A)});if(O){var T=this.satisfies(h[O]);if(T!==void 0)return T}}if(g>0){var E=Object.keys(_),M=s.default.find(E,function(A){return p.isBrowser(A,!0)});if(M!==void 0)return this.compareVersion(_[M])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var h=this.getBrowserName().toLowerCase(),m=f.toLowerCase(),_=s.default.getBrowserTypeByAlias(m);return p&&_&&(m=_.toLowerCase()),m===h},d.compareVersion=function(f){var p=[0],h=f,m=!1,_=this.getBrowserVersion();if(typeof _=="string")return f[0]===">"||f[0]==="<"?(h=f.substr(1),f[1]==="="?(m=!0,h=f.substr(2)):p=[],f[0]===">"?p.push(1):p.push(-1)):f[0]==="="?h=f.substr(1):f[0]==="~"&&(m=!0,h=f.substr(1)),p.indexOf(s.default.compareVersions(_,h,m))>-1},d.isOS=function(f){return this.getOSName(!0)===String(f).toLowerCase()},d.isPlatform=function(f){return this.getPlatformType(!0)===String(f).toLowerCase()},d.isEngine=function(f){return this.getEngineName(!0)===String(f).toLowerCase()},d.is=function(f,p){return p===void 0&&(p=!1),this.isBrowser(f,p)||this.isOS(f)||this.isPlatform(f)},d.some=function(f){var p=this;return f===void 0&&(f=[]),f.some(function(h){return p.is(h)})},c}();t.default=l,e.exports=t.default},92:function(e,t,r){"use strict";t.__esModule=!0,t.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)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){"use strict";t.__esModule=!0,t.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}}}];t.default=a,e.exports=t.default},94:function(e,t,r){"use strict";t.__esModule=!0,t.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}}}];t.default=a,e.exports=t.default},95:function(e,t,r){"use strict";t.__esModule=!0,t.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}}];t.default=a,e.exports=t.default}})})});var LXe,dG,eme=C(()=>{LXe=B(Qhe()),dG=({serviceId:e,clientVersion:t})=>async()=>{let r=typeof window<"u"&&window?.navigator?.userAgent?LXe.default.parse(window.navigator.userAgent):void 0,n=[["aws-sdk-js",t],["ua","2.0"],[`os/${r?.os?.name||"other"}`,r?.os?.version],["lang/js"],["md/browser",`${r?.browser?.name??"unknown"}_${r?.browser?.version??"unknown"}`]];return e&&n.push([`api/${e}`,t]),n}});var FXe=C(()=>{});var fG,kXe=C(()=>{fG=e=>()=>Promise.reject(e)});var tme=C(()=>{FXe();kXe()});var BXe,pG,$Xe=C(()=>{BXe=typeof TextEncoder=="function"?new TextEncoder:null,pG=e=>{if(typeof e=="string"){if(BXe)return BXe.encode(e).byteLength;let t=e.length;for(let r=t-1;r>=0;r--){let n=e.charCodeAt(r);n>127&&n<=2047?t++:n>2047&&n<=65535&&(t+=2),n>=56320&&n<=57343&&r--}return t}else{if(typeof e.byteLength=="number")return e.byteLength;if(typeof e.size=="number")return e.size}throw new Error(`Body Length computation failed for ${e}`)}});var rme=C(()=>{$Xe()});var nme,ome=C(()=>{nme=e=>new TextEncoder().encode(e)});var qXe=C(()=>{ome()});var UXe,zXe=C(()=>{UXe=e=>{if(typeof e=="string")return e;if(typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)}});var HXe=C(()=>{ome();qXe();zXe()});var eQe,zy,Hy,SN,VXe,Cz,wN,xz,lx,ime,WXe,JXe,GXe,tQe,rQe,Uy,KXe,YXe,ZXe,XXe,QXe,btr,nQe,oQe=C(()=>{eQe="required",zy="fn",Hy="argv",SN="ref",VXe="isSet",Cz="booleanEquals",wN="error",xz="endpoint",lx="tree",ime="PartitionResult",WXe={[eQe]:!1,type:"String"},JXe={[eQe]:!0,default:!1,type:"Boolean"},GXe={[SN]:"Endpoint"},tQe={[zy]:Cz,[Hy]:[{[SN]:"UseFIPS"},!0]},rQe={[zy]:Cz,[Hy]:[{[SN]:"UseDualStack"},!0]},Uy={},KXe={[zy]:"getAttr",[Hy]:[{[SN]:ime},"supportsFIPS"]},YXe={[zy]:Cz,[Hy]:[!0,{[zy]:"getAttr",[Hy]:[{[SN]:ime},"supportsDualStack"]}]},ZXe=[tQe],XXe=[rQe],QXe=[{[SN]:"Region"}],btr={version:"1.0",parameters:{Region:WXe,UseDualStack:JXe,UseFIPS:JXe,Endpoint:WXe},rules:[{conditions:[{[zy]:VXe,[Hy]:[GXe]}],rules:[{conditions:ZXe,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:wN},{conditions:XXe,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:wN},{endpoint:{url:GXe,properties:Uy,headers:Uy},type:xz}],type:lx},{conditions:[{[zy]:VXe,[Hy]:QXe}],rules:[{conditions:[{[zy]:"aws.partition",[Hy]:QXe,assign:ime}],rules:[{conditions:[tQe,rQe],rules:[{conditions:[{[zy]:Cz,[Hy]:[!0,KXe]},YXe],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Uy,headers:Uy},type:xz}],type:lx},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:wN}],type:lx},{conditions:ZXe,rules:[{conditions:[{[zy]:Cz,[Hy]:[KXe,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Uy,headers:Uy},type:xz}],type:lx},{error:"FIPS is enabled but this partition does not support FIPS",type:wN}],type:lx},{conditions:XXe,rules:[{conditions:[YXe],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Uy,headers:Uy},type:xz}],type:lx},{error:"DualStack is enabled but this partition does not support DualStack",type:wN}],type:lx},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:Uy,headers:Uy},type:xz}],type:lx}],type:lx},{error:"Invalid Configuration: Missing Region",type:wN}]},nQe=btr});var iQe,aQe=C(()=>{cJ();gE();oQe();iQe=(e,t={})=>XU(nQe,{endpointParams:e,logger:t.logger});ox.aws=QU});var sQe,uQe=C(()=>{nA();OE();Nt();wJ();fN();HXe();Vhe();aQe();sQe=e=>({apiVersion:"2014-06-30",base64Decoder:e?.base64Decoder??wE,base64Encoder:e?.base64Encoder??SE,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??iQe,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??xXe,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new eA},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new yN}],logger:e?.logger??new bE,serviceId:e?.serviceId??"Cognito Identity",urlParser:e?.urlParser??yE,utf8Decoder:e?.utf8Decoder??nme,utf8Encoder:e?.utf8Encoder??UXe})});var lQe,cQe=C(()=>{lQe=["in-region","cross-region","mobile","standard","legacy"]});var dQe,hG,_tr,fQe=C(()=>{nx();dQe=B(Qhe());cQe();hG=({defaultsMode:e}={})=>r9e(async()=>{let t=typeof e=="function"?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(_tr()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${lQe.join(", ")}, got ${t}`)}}),_tr=()=>{let t=(typeof window<"u"&&window?.navigator?.userAgent?dQe.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return t==="tablet"||t==="mobile"}});var ame=C(()=>{fQe()});var pQe,hQe=C(()=>{EXe();Zhe();eme();ez();uz();tme();rme();$y();uQe();Nt();ame();pQe=e=>{let t=hG(e),r=()=>t().then(UJ),n=sQe(e);return{...n,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??pG,credentialDefaultProvider:e?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??dG({serviceId:n.serviceId,clientVersion:PXe.version}),maxAttempts:e?.maxAttempts??By,region:e?.region??fG("Region is missing"),requestHandler:xE.create(e?.requestHandler??r),retryMode:e?.retryMode??(async()=>(await r()).retryMode||nz),sha256:e?.sha256??cG,streamCollector:e?.streamCollector??pN,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(gJ)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(yJ))}}});var mG,gG,mQe=C(()=>{mG=e=>{let t=async()=>{if(e.region===void 0)throw new Error("Region is missing from runtimeConfig");let r=e.region;return typeof r=="string"?r:r()};return{setRegion(r){t=r},region(){return t}}},gG=e=>({region:e.region()})});var gQe=C(()=>{});var sme=C(()=>{});var yQe=C(()=>{sme()});var bQe=C(()=>{yQe();sme()});var _Qe=C(()=>{gQe();bQe()});var ume=C(()=>{mQe();_Qe()});var vQe,wQe,SQe=C(()=>{vQe=e=>{let t=e.httpHandler;return{setHttpHandler(r){t=r},httpHandler(){return t},updateHttpClientConfig(r,n){t.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return t.httpHandlerConfigs()}}},wQe=e=>({httpHandler:e.httpHandler()})});var xQe=C(()=>{SQe()});var CQe=C(()=>{ls()});var OQe=C(()=>{});var EQe=C(()=>{});function wtr(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}var yG,PQe=C(()=>{yG=class e{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=wtr(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}}});var TQe=C(()=>{});var MQe=C(()=>{});var IQe=C(()=>{});var lme=C(()=>{xQe();CQe();OQe();EQe();PQe();TQe();MQe();IQe()});var AQe,RQe,DQe=C(()=>{AQe=e=>{let t=e.httpAuthSchemes,r=e.httpAuthSchemeProvider,n=e.credentials;return{setHttpAuthScheme(o){let i=t.findIndex(a=>a.schemeId===o.schemeId);i===-1?t.push(o):t.splice(i,1,o)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(o){r=o},httpAuthSchemeProvider(){return r},setCredentials(o){n=o},credentials(){return n}}},RQe=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()})});var bG,jQe,NQe=C(()=>{ume();lme();Nt();DQe();bG=e=>e,jQe=(e,t)=>{let r={...bG(mG(e)),...bG(zJ(e)),...bG(vQe(e)),...bG(AQe(e))};return t.forEach(n=>n.configure(r)),{...e,...gG(r),...HJ(r),...wQe(r),...RQe(r)}}});var ME,_G=C(()=>{rpe();npe();ope();wpe();ez();OE();hhe();yn();JJ();Nt();Vhe();Si();hQe();NQe();ME=class extends KI{constructor(...[t]){let r=pQe(t||{}),n=OXe(r),o=rJ(n),i=NJ(o),a=_J(i),s=a,u=CJ(s),l=CXe(u),c=jQe(l,t?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(hJ(this.config)),this.middlewareStack.use(WJ(this.config)),this.middlewareStack.use(YJ(this.config)),this.middlewareStack.use(XW(this.config)),this.middlewareStack.use(QW(this.config)),this.middlewareStack.use(tJ(this.config)),this.middlewareStack.use(OJ(this.config,{httpAuthSchemeParametersProvider:SXe,identityProviderConfigProvider:async d=>new gN({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(GJ(this.config))}destroy(){super.destroy()}}});var Hc,cme=C(()=>{Nt();Hc=class e extends mN{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}});var vG,wG,SG,xG,CG,OG,EG,PG,TG,MG,IG,dme=C(()=>{cme();vG=class e extends Hc{constructor(t){super({name:"InternalErrorException",$fault:"server",...t}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,e.prototype)}},wG=class e extends Hc{constructor(t){super({name:"InvalidParameterException",$fault:"client",...t}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},SG=class e extends Hc{constructor(t){super({name:"LimitExceededException",$fault:"client",...t}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},xG=class e extends Hc{constructor(t){super({name:"NotAuthorizedException",$fault:"client",...t}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},CG=class e extends Hc{constructor(t){super({name:"ResourceConflictException",$fault:"client",...t}),this.name="ResourceConflictException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},OG=class e extends Hc{constructor(t){super({name:"TooManyRequestsException",$fault:"client",...t}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},EG=class e extends Hc{constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},PG=class e extends Hc{constructor(t){super({name:"ExternalServiceException",$fault:"client",...t}),this.name="ExternalServiceException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},TG=class e extends Hc{constructor(t){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...t}),this.name="InvalidIdentityPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},MG=class e extends Hc{constructor(t){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...t}),this.name="DeveloperUserAlreadyRegisteredException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},IG=class e extends Hc{constructor(t){super({name:"ConcurrentModificationException",$fault:"client",...t}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}}});function ua(e){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${e}`}}var LQe,FQe,kQe,BQe,$Qe,qQe,UQe,zQe,HQe,VQe,WQe,JQe,GQe,KQe,YQe,ZQe,XQe,QQe,eet,tet,ret,net,oet,iet,aet,set,uet,cet,det,fet,pet,het,met,get,yet,bet,_et,vet,wet,xet,Cet,Oet,Eet,Pet,Tet,Met,aa,xtr,Ctr,Otr,Etr,Ptr,Ttr,Mtr,Itr,Atr,Rtr,Dtr,jtr,Ntr,Ltr,Iet,Ftr,On,ktr,sa,$i=C(()=>{nA();lme();Nt();cme();dme();LQe=async(e,t)=>{let r=ua("CreateIdentityPool"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},FQe=async(e,t)=>{let r=ua("DeleteIdentities"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},kQe=async(e,t)=>{let r=ua("DeleteIdentityPool"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},BQe=async(e,t)=>{let r=ua("DescribeIdentity"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},$Qe=async(e,t)=>{let r=ua("DescribeIdentityPool"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},qQe=async(e,t)=>{let r=ua("GetCredentialsForIdentity"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},UQe=async(e,t)=>{let r=ua("GetId"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},zQe=async(e,t)=>{let r=ua("GetIdentityPoolRoles"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},HQe=async(e,t)=>{let r=ua("GetOpenIdToken"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},VQe=async(e,t)=>{let r=ua("GetOpenIdTokenForDeveloperIdentity"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},WQe=async(e,t)=>{let r=ua("GetPrincipalTagAttributeMap"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},JQe=async(e,t)=>{let r=ua("ListIdentities"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},GQe=async(e,t)=>{let r=ua("ListIdentityPools"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},KQe=async(e,t)=>{let r=ua("ListTagsForResource"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},YQe=async(e,t)=>{let r=ua("LookupDeveloperIdentity"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},ZQe=async(e,t)=>{let r=ua("MergeDeveloperIdentities"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},XQe=async(e,t)=>{let r=ua("SetIdentityPoolRoles"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},QQe=async(e,t)=>{let r=ua("SetPrincipalTagAttributeMap"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},eet=async(e,t)=>{let r=ua("TagResource"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},tet=async(e,t)=>{let r=ua("UnlinkDeveloperIdentity"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},ret=async(e,t)=>{let r=ua("UnlinkIdentity"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},net=async(e,t)=>{let r=ua("UntagResource"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},oet=async(e,t)=>{let r=ua("UpdateIdentityPool"),n;return n=JSON.stringify(jt(e)),sa(t,r,"/",void 0,n)},iet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},aet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},set=async(e,t)=>e.statusCode>=300?aa(e,t):(await CE(e.body,t),{$metadata:On(e)}),uet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=Iet(r,t),{$metadata:On(e),...n}},cet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},det=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=Ntr(r,t),{$metadata:On(e),...n}},fet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},pet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},het=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},met=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},get=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},yet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=Ftr(r,t),{$metadata:On(e),...n}},bet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},_et=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},vet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},wet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},xet=async(e,t)=>e.statusCode>=300?aa(e,t):(await CE(e.body,t),{$metadata:On(e)}),Cet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},Oet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},Eet=async(e,t)=>e.statusCode>=300?aa(e,t):(await CE(e.body,t),{$metadata:On(e)}),Pet=async(e,t)=>e.statusCode>=300?aa(e,t):(await CE(e.body,t),{$metadata:On(e)}),Tet=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},Met=async(e,t)=>{if(e.statusCode>=300)return aa(e,t);let r=await Ja(e.body,t),n={};return n=jt(r),{$metadata:On(e),...n}},aa=async(e,t)=>{let r={...e,body:await FZe(e.body,t)},n=kZe(e,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":throw await Etr(r,t);case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":throw await Ttr(r,t);case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":throw await Mtr(r,t);case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":throw await Itr(r,t);case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":throw await Atr(r,t);case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":throw await Dtr(r,t);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":throw await Rtr(r,t);case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":throw await Otr(r,t);case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":throw await Ptr(r,t);case"DeveloperUserAlreadyRegisteredException":case"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException":throw await Ctr(r,t);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentity#ConcurrentModificationException":throw await xtr(r,t);default:let o=r.body;return ktr({output:e,parsedBody:o,errorCode:n})}},xtr=async(e,t)=>{let r=e.body,n=jt(r),o=new IG({$metadata:On(e),...n});return ia(o,r)},Ctr=async(e,t)=>{let r=e.body,n=jt(r),o=new MG({$metadata:On(e),...n});return ia(o,r)},Otr=async(e,t)=>{let r=e.body,n=jt(r),o=new PG({$metadata:On(e),...n});return ia(o,r)},Etr=async(e,t)=>{let r=e.body,n=jt(r),o=new vG({$metadata:On(e),...n});return ia(o,r)},Ptr=async(e,t)=>{let r=e.body,n=jt(r),o=new TG({$metadata:On(e),...n});return ia(o,r)},Ttr=async(e,t)=>{let r=e.body,n=jt(r),o=new wG({$metadata:On(e),...n});return ia(o,r)},Mtr=async(e,t)=>{let r=e.body,n=jt(r),o=new SG({$metadata:On(e),...n});return ia(o,r)},Itr=async(e,t)=>{let r=e.body,n=jt(r),o=new xG({$metadata:On(e),...n});return ia(o,r)},Atr=async(e,t)=>{let r=e.body,n=jt(r),o=new CG({$metadata:On(e),...n});return ia(o,r)},Rtr=async(e,t)=>{let r=e.body,n=jt(r),o=new EG({$metadata:On(e),...n});return ia(o,r)},Dtr=async(e,t)=>{let r=e.body,n=jt(r),o=new OG({$metadata:On(e),...n});return ia(o,r)},jtr=(e,t)=>dz(e,{AccessKeyId:Lr,Expiration:r=>hN($J(XI(r))),SecretKey:Lr,SessionToken:Lr}),Ntr=(e,t)=>dz(e,{Credentials:r=>jtr(r,t),IdentityId:Lr}),Ltr=(e,t)=>(e||[]).filter(n=>n!=null).map(n=>Iet(n,t)),Iet=(e,t)=>dz(e,{CreationDate:r=>hN($J(XI(r))),IdentityId:Lr,LastModifiedDate:r=>hN($J(XI(r))),Logins:jt}),Ftr=(e,t)=>dz(e,{Identities:r=>Ltr(r,t),IdentityPoolId:Lr,NextToken:Lr}),On=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),ktr=qJ(Hc),sa=async(e,t,r,n,o)=>{let{hostname:i,protocol:a="https",port:s,path:u}=await e.endpoint(),l={protocol:a,hostname:i,port:s,method:"POST",path:u.endsWith("/")?u.slice(0,-1)+r:u+r,headers:t};return n!==void 0&&(l.hostname=n),o!==void 0&&(l.body=o),new yG(l)}});var AG,fme=C(()=>{yn();Cn();Nt();Si();$i();AG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").f(void 0,void 0).ser(LQe).de(iet).build(){}});var RG,pme=C(()=>{yn();Cn();Nt();Si();$i();RG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").f(void 0,void 0).ser(FQe).de(aet).build(){}});var DG,hme=C(()=>{yn();Cn();Nt();Si();$i();DG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").f(void 0,void 0).ser(kQe).de(set).build(){}});var jG,mme=C(()=>{yn();Cn();Nt();Si();$i();jG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").f(void 0,void 0).ser(BQe).de(uet).build(){}});var NG,gme=C(()=>{yn();Cn();Nt();Si();$i();NG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").f(void 0,void 0).ser($Qe).de(cet).build(){}});var xN,yme=C(()=>{yn();Cn();Nt();Si();$i();xN=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").f(void 0,void 0).ser(qQe).de(det).build(){}});var CN,bme=C(()=>{yn();Cn();Nt();Si();$i();CN=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").f(void 0,void 0).ser(UQe).de(fet).build(){}});var LG,_me=C(()=>{yn();Cn();Nt();Si();$i();LG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").f(void 0,void 0).ser(zQe).de(pet).build(){}});var FG,vme=C(()=>{yn();Cn();Nt();Si();$i();FG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").f(void 0,void 0).ser(HQe).de(het).build(){}});var kG,wme=C(()=>{yn();Cn();Nt();Si();$i();kG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").f(void 0,void 0).ser(VQe).de(met).build(){}});var BG,Sme=C(()=>{yn();Cn();Nt();Si();$i();BG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(WQe).de(get).build(){}});var $G,xme=C(()=>{yn();Cn();Nt();Si();$i();$G=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").f(void 0,void 0).ser(JQe).de(yet).build(){}});var ON,qG=C(()=>{yn();Cn();Nt();Si();$i();ON=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").f(void 0,void 0).ser(GQe).de(bet).build(){}});var UG,Cme=C(()=>{yn();Cn();Nt();Si();$i();UG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").f(void 0,void 0).ser(KQe).de(_et).build(){}});var zG,Ome=C(()=>{yn();Cn();Nt();Si();$i();zG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").f(void 0,void 0).ser(YQe).de(vet).build(){}});var HG,Eme=C(()=>{yn();Cn();Nt();Si();$i();HG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").f(void 0,void 0).ser(ZQe).de(wet).build(){}});var VG,Pme=C(()=>{yn();Cn();Nt();Si();$i();VG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").f(void 0,void 0).ser(XQe).de(xet).build(){}});var WG,Tme=C(()=>{yn();Cn();Nt();Si();$i();WG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(QQe).de(Cet).build(){}});var JG,Mme=C(()=>{yn();Cn();Nt();Si();$i();JG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").f(void 0,void 0).ser(eet).de(Oet).build(){}});var GG,Ime=C(()=>{yn();Cn();Nt();Si();$i();GG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").f(void 0,void 0).ser(tet).de(Eet).build(){}});var KG,Ame=C(()=>{yn();Cn();Nt();Si();$i();KG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").f(void 0,void 0).ser(ret).de(Pet).build(){}});var YG,Rme=C(()=>{yn();Cn();Nt();Si();$i();YG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").f(void 0,void 0).ser(net).de(Tet).build(){}});var ZG,Dme=C(()=>{yn();Cn();Nt();Si();$i();ZG=class extends ot.classBuilder().ep({...Yt}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").f(void 0,void 0).ser(oet).de(Met).build(){}});var Btr,jme,Aet=C(()=>{Nt();_G();fme();pme();hme();mme();gme();yme();bme();_me();vme();wme();Sme();xme();qG();Cme();Ome();Eme();Pme();Tme();Mme();Ime();Ame();Rme();Dme();Btr={CreateIdentityPoolCommand:AG,DeleteIdentitiesCommand:RG,DeleteIdentityPoolCommand:DG,DescribeIdentityCommand:jG,DescribeIdentityPoolCommand:NG,GetCredentialsForIdentityCommand:xN,GetIdCommand:CN,GetIdentityPoolRolesCommand:LG,GetOpenIdTokenCommand:FG,GetOpenIdTokenForDeveloperIdentityCommand:kG,GetPrincipalTagAttributeMapCommand:BG,ListIdentitiesCommand:$G,ListIdentityPoolsCommand:ON,ListTagsForResourceCommand:UG,LookupDeveloperIdentityCommand:zG,MergeDeveloperIdentitiesCommand:HG,SetIdentityPoolRolesCommand:VG,SetPrincipalTagAttributeMapCommand:WG,TagResourceCommand:JG,UnlinkDeveloperIdentityCommand:GG,UnlinkIdentityCommand:KG,UntagResourceCommand:YG,UpdateIdentityPoolCommand:ZG},jme=class extends ME{};BJ(Btr,jme)});var Ret=C(()=>{fme();pme();hme();mme();gme();yme();bme();_me();vme();wme();Sme();xme();qG();Cme();Ome();Eme();Pme();Tme();Mme();Ime();Ame();Rme();Dme()});var Det=C(()=>{});var LKn,jet=C(()=>{OE();_G();qG();LKn=phe(ME,ON,"NextToken","NextToken","MaxResults")});var Net=C(()=>{Det();jet()});var Let=C(()=>{dme()});var Fet=C(()=>{_G();Aet();Ret();Net();Let()});var Nme={};Yd(Nme,{CognitoIdentityClient:()=>ME,GetCredentialsForIdentityCommand:()=>xN,GetIdCommand:()=>CN});var Lme=C(()=>{Fet()});function XG(e){return async()=>{e.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:t,CognitoIdentityClient:r}=await Promise.resolve().then(()=>(Lme(),Nme)),{Credentials:{AccessKeyId:n=$tr(e.logger),Expiration:o,SecretKey:i=Utr(e.logger),SessionToken:a}=qtr(e.logger)}=await(e.client??new r(Object.assign({},e.clientConfig??{},{region:e.clientConfig?.region??e.parentClientConfig?.region}))).send(new t({CustomRoleArn:e.customRoleArn,IdentityId:e.identityId,Logins:e.logins?await YW(e.logins):void 0}));return{identityId:e.identityId,accessKeyId:n,secretAccessKey:i,sessionToken:a,expiration:o}}}function $tr(e){throw new zu("Response from Amazon Cognito contained no access key ID",{logger:e})}function qtr(e){throw new zu("Response from Amazon Cognito contained no credentials",{logger:e})}function Utr(e){throw new zu("Response from Amazon Cognito contained no secret key",{logger:e})}var Fme=C(()=>{nx();Qfe()});var kme,QG,ket=C(()=>{kme="IdentityIds",QG=class{constructor(t="aws:cognito-identity-ids"){this.dbName=t}getItem(t){return this.withObjectStore("readonly",r=>{let n=r.get(t);return new Promise(o=>{n.onerror=()=>o(null),n.onsuccess=()=>o(n.result?n.result.value:null)})}).catch(()=>null)}removeItem(t){return this.withObjectStore("readwrite",r=>{let n=r.delete(t);return new Promise((o,i)=>{n.onerror=()=>i(n.error),n.onsuccess=()=>o()})})}setItem(t,r){return this.withObjectStore("readwrite",n=>{let o=n.put({id:t,value:r});return new Promise((i,a)=>{o.onerror=()=>a(o.error),o.onsuccess=()=>i()})})}getDb(){let t=self.indexedDB.open(this.dbName,1);return new Promise((r,n)=>{t.onsuccess=()=>{r(t.result)},t.onerror=()=>{n(t.error)},t.onblocked=()=>{n(new Error("Unable to access DB"))},t.onupgradeneeded=()=>{let o=t.result;o.onerror=()=>{n(new Error("Failed to create object store"))},o.createObjectStore(kme,{keyPath:"id"})}})}withObjectStore(t,r){return this.getDb().then(n=>{let o=n.transaction(kme,t);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(kme)))}).catch(i=>{throw n.close(),i})})}}});var eK,Bet=C(()=>{eK=class{constructor(t={}){this.store=t}getItem(t){return t in this.store?this.store[t]:null}removeItem(t){delete this.store[t]}setItem(t,r){this.store[t]=r}}});function $et(){return typeof self=="object"&&self.indexedDB?new QG:typeof window=="object"&&window.localStorage?window.localStorage:ztr}var ztr,qet=C(()=>{ket();Bet();ztr=new eK});function Uet({accountId:e,cache:t=$et(),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(()=>(Lme(),Nme)),h=r??new p(Object.assign({},n??{},{region:n?.region??l?.region})),m=c&&await t.getItem(c);if(!m){let{IdentityId:_=Htr(u)}=await h.send(new f({AccountId:e,IdentityPoolId:i,Logins:a?await YW(a):void 0}));m=_,c&&Promise.resolve(t.setItem(c,m)).catch(()=>{})}return d=XG({client:h,customRoleArn:o,logins:a,identityId:m}),d()};return()=>d().catch(async f=>{throw c&&Promise.resolve(t.removeItem(c)).catch(()=>{}),f})}function Htr(e){throw new zu("Response from Amazon Cognito contained no identity ID",{logger:e})}var zet=C(()=>{nx();Fme();qet();Qfe()});var Bme=C(()=>{K5e();Y5e();Z5e();Fme();zet()});var Vtr,Het=C(()=>{Bme();Vtr=e=>XG({...e})});var Wtr,Vet=C(()=>{Bme();Wtr=e=>Uet({...e})});var Jtr,Gtr,Ktr,Wet,Jet=C(()=>{nx();Jtr="169.254.170.2",Gtr="169.254.170.23",Ktr="[fd00:ec2::23]",Wet=(e,t)=>{if(e.protocol!=="https:"&&!(e.hostname===Jtr||e.hostname===Gtr||e.hostname===Ktr)){if(e.hostname.includes("[")){if(e.hostname==="[::1]"||e.hostname==="[0000:0000:0000:0000:0000:0000:0000:0001]")return}else{if(e.hostname==="localhost")return;let r=e.hostname.split("."),n=o=>{let i=parseInt(o,10);return 0<=i&&i<=255};if(r[0]==="127"&&n(r[1])&&n(r[2])&&n(r[3])&&r.length===4)return}throw new zu(`URL not accepted. It must either be HTTPS or match one of the following:
- loopback CIDR 127.0.0.0/8 or [::1/128]
- ECS container host 169.254.170.2
- EKS container host 169.254.170.23 or [fd00:ec2::23]`,{logger:t})}}});var Get=C(()=>{});var Ket=C(()=>{Get()});var Yet=C(()=>{ls()});var Zet=C(()=>{});var Xet=C(()=>{});function Ytr(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}var tK,Qet=C(()=>{tK=class e{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=Ytr(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}}});var ett=C(()=>{});var ttt=C(()=>{});var rtt=C(()=>{});var ntt=C(()=>{Ket();Yet();Zet();Xet();Qet();ett();ttt();rtt()});function ott(e){return new tK({protocol:e.protocol,hostname:e.hostname,port:Number(e.port),path:e.pathname,query:Array.from(e.searchParams.entries()).reduce((t,[r,n])=>(t[r]=n,t),{}),fragment:e.hash})}async function itt(e,t){let n=await v7e(e.body).transformToString();if(e.statusCode===200){let o=JSON.parse(n);if(typeof o.AccessKeyId!="string"||typeof o.SecretAccessKey!="string"||typeof o.Token!="string"||typeof o.Expiration!="string")throw new zu("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:t});return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.Token,expiration:F7e(o.Expiration)}}if(e.statusCode>=400&&e.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new zu(`Server responded with status: ${e.statusCode}`,{logger:t}),{Code:o.Code,Message:o.Message})}throw new zu(`Server responded with status: ${e.statusCode}`,{logger:t})}var att=C(()=>{nx();ntt();Nt();the()});var stt,utt=C(()=>{stt=(e,t,r)=>async()=>{for(let n=0;n<t;++n)try{return await e()}catch{await new Promise(i=>setTimeout(i,r))}return await e()}});var $me,ltt=C(()=>{uz();nx();Jet();att();utt();$me=(e={})=>{e.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let t,r=e.credentialsFullUri;if(r)t=r;else throw new zu("No HTTP credential provider host provided.",{logger:e.logger});let n=new URL(t);Wet(n,e.logger);let o=new xE;return stt(async()=>{let i=ott(n);e.authorizationToken&&(i.headers.Authorization=e.authorizationToken);let a=await o.handle(i);return itt(a.response)},e.maxRetries??3,e.timeout??1e3)}});var ctt=C(()=>{ltt()});function Ztr(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(t,r)=>({signingProperties:{config:t,context:r}})}}function dtt(e){return{schemeId:"smithy.api#noAuth"}}var ftt,ptt,Xtr,htt,qme=C(()=>{nA();ng();Oz();ftt=async(e,t,r)=>({operation:ky(t).operation,region:await zc(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});ptt=e=>{let t=[];switch(e.operation){case"AssumeRoleWithSAML":{t.push(dtt(e));break}case"AssumeRoleWithWebIdentity":{t.push(dtt(e));break}default:t.push(Ztr(e))}return t},Xtr=e=>({...e,stsClientCtor:Ch}),htt=e=>{let t=Xtr(e);return{...aG(t)}}});var mtt,Vc,Vy=C(()=>{mtt=e=>({...e,useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,useGlobalEndpoint:e.useGlobalEndpoint??!1,defaultSigningName:"sts"}),Vc={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 ytt,gtt=C(()=>{ytt={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 Ume,zme=C(()=>{Ume=e=>new TextEncoder().encode(e)});var btt=C(()=>{zme()});var _tt,vtt=C(()=>{_tt=e=>{if(typeof e=="string")return e;if(typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)}});var wtt=C(()=>{zme();btt();vtt()});var Rtt,Ar,qn,Un,AE,IE,Gl,Dtt,jtt,Ntt,qi,Stt,Wy,EN,Vme,xtt,Hme,Ltt,Ctt,Kl,Ott,Ftt,ktt,Wc,pp,Ett,Btt,$tt,Ptt,qtt,Ttt,Mtt,Itt,Att,err,Utt,ztt=C(()=>{Rtt="required",Ar="type",qn="fn",Un="argv",AE="ref",IE="booleanEquals",Gl="stringEquals",Dtt="sigv4",jtt="sts",Ntt="us-east-1",qi="endpoint",Stt="https://sts.{Region}.{PartitionResult#dnsSuffix}",Wy="tree",EN="error",Vme="getAttr",xtt={[Rtt]:!1,[Ar]:"String"},Hme={[Rtt]:!0,default:!1,[Ar]:"Boolean"},Ltt={[AE]:"Endpoint"},Ctt={[qn]:"isSet",[Un]:[{[AE]:"Region"}]},Kl={[AE]:"Region"},Ott={[qn]:"aws.partition",[Un]:[Kl],assign:"PartitionResult"},Ftt={[AE]:"UseFIPS"},ktt={[AE]:"UseDualStack"},Wc={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:Dtt,signingName:jtt,signingRegion:Ntt}]},headers:{}},pp={},Ett={conditions:[{[qn]:Gl,[Un]:[Kl,"aws-global"]}],[qi]:Wc,[Ar]:qi},Btt={[qn]:IE,[Un]:[Ftt,!0]},$tt={[qn]:IE,[Un]:[ktt,!0]},Ptt={[qn]:Vme,[Un]:[{[AE]:"PartitionResult"},"supportsFIPS"]},qtt={[AE]:"PartitionResult"},Ttt={[qn]:IE,[Un]:[!0,{[qn]:Vme,[Un]:[qtt,"supportsDualStack"]}]},Mtt=[{[qn]:"isSet",[Un]:[Ltt]}],Itt=[Btt],Att=[$tt],err={version:"1.0",parameters:{Region:xtt,UseDualStack:Hme,UseFIPS:Hme,Endpoint:xtt,UseGlobalEndpoint:Hme},rules:[{conditions:[{[qn]:IE,[Un]:[{[AE]:"UseGlobalEndpoint"},!0]},{[qn]:"not",[Un]:Mtt},Ctt,Ott,{[qn]:IE,[Un]:[Ftt,!1]},{[qn]:IE,[Un]:[ktt,!1]}],rules:[{conditions:[{[qn]:Gl,[Un]:[Kl,"ap-northeast-1"]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,"ap-south-1"]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,"ap-southeast-1"]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,"ap-southeast-2"]}],endpoint:Wc,[Ar]:qi},Ett,{conditions:[{[qn]:Gl,[Un]:[Kl,"ca-central-1"]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,"eu-central-1"]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,"eu-north-1"]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,"eu-west-1"]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,"eu-west-2"]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,"eu-west-3"]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,"sa-east-1"]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,Ntt]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,"us-east-2"]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,"us-west-1"]}],endpoint:Wc,[Ar]:qi},{conditions:[{[qn]:Gl,[Un]:[Kl,"us-west-2"]}],endpoint:Wc,[Ar]:qi},{endpoint:{url:Stt,properties:{authSchemes:[{name:Dtt,signingName:jtt,signingRegion:"{Region}"}]},headers:pp},[Ar]:qi}],[Ar]:Wy},{conditions:Mtt,rules:[{conditions:Itt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Ar]:EN},{conditions:Att,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Ar]:EN},{endpoint:{url:Ltt,properties:pp,headers:pp},[Ar]:qi}],[Ar]:Wy},{conditions:[Ctt],rules:[{conditions:[Ott],rules:[{conditions:[Btt,$tt],rules:[{conditions:[{[qn]:IE,[Un]:[!0,Ptt]},Ttt],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:pp,headers:pp},[Ar]:qi}],[Ar]:Wy},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Ar]:EN}],[Ar]:Wy},{conditions:Itt,rules:[{conditions:[{[qn]:IE,[Un]:[Ptt,!0]}],rules:[{conditions:[{[qn]:Gl,[Un]:[{[qn]:Vme,[Un]:[qtt,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:pp,headers:pp},[Ar]:qi},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:pp,headers:pp},[Ar]:qi}],[Ar]:Wy},{error:"FIPS is enabled but this partition does not support FIPS",[Ar]:EN}],[Ar]:Wy},{conditions:Att,rules:[{conditions:[Ttt],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:pp,headers:pp},[Ar]:qi}],[Ar]:Wy},{error:"DualStack is enabled but this partition does not support DualStack",[Ar]:EN}],[Ar]:Wy},Ett,{endpoint:{url:Stt,properties:pp,headers:pp},[Ar]:qi}],[Ar]:Wy}],[Ar]:Wy},{error:"Invalid Configuration: Missing Region",[Ar]:EN}]},Utt=err});var Htt,Vtt=C(()=>{cJ();gE();ztt();Htt=(e,t={})=>XU(Utt,{endpointParams:e,logger:t.logger});ox.aws=QU});var Wtt,Jtt=C(()=>{nA();OE();Nt();wJ();fN();wtt();qme();Vtt();Wtt=e=>({apiVersion:"2011-06-15",base64Decoder:e?.base64Decoder??wE,base64Encoder:e?.base64Encoder??SE,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Htt,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??ptt,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new eA},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new yN}],logger:e?.logger??new bE,serviceId:e?.serviceId??"STS",urlParser:e?.urlParser??yE,utf8Decoder:e?.utf8Decoder??Ume,utf8Encoder:e?.utf8Encoder??_tt})});var Gtt,Ktt=C(()=>{gtt();Zhe();eme();ez();uz();tme();rme();$y();Jtt();Nt();ame();Gtt=e=>{let t=hG(e),r=()=>t().then(UJ),n=Wtt(e);return{...n,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??pG,credentialDefaultProvider:e?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??dG({serviceId:n.serviceId,clientVersion:ytt.version}),maxAttempts:e?.maxAttempts??By,region:e?.region??fG("Region is missing"),requestHandler:xE.create(e?.requestHandler??r),retryMode:e?.retryMode??(async()=>(await r()).retryMode||nz),sha256:e?.sha256??cG,streamCollector:e?.streamCollector??pN,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(gJ)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(yJ))}}});var Ytt,Ztt,Xtt=C(()=>{Ytt=e=>{let t=e.httpHandler;return{setHttpHandler(r){t=r},httpHandler(){return t},updateHttpClientConfig(r,n){t.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return t.httpHandlerConfigs()}}},Ztt=e=>({httpHandler:e.httpHandler()})});var Qtt=C(()=>{Xtt()});var ert=C(()=>{ls()});var trt=C(()=>{});var rrt=C(()=>{});function trr(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}var rK,nrt=C(()=>{rK=class e{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=trr(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}}});var ort=C(()=>{});var irt=C(()=>{});var art=C(()=>{});var Wme=C(()=>{Qtt();ert();trt();rrt();nrt();ort();irt();art()});var srt,urt,lrt=C(()=>{srt=e=>{let t=e.httpAuthSchemes,r=e.httpAuthSchemeProvider,n=e.credentials;return{setHttpAuthScheme(o){let i=t.findIndex(a=>a.schemeId===o.schemeId);i===-1?t.push(o):t.splice(i,1,o)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(o){r=o},httpAuthSchemeProvider(){return r},setCredentials(o){n=o},credentials(){return n}}},urt=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()})});var nK,crt,drt=C(()=>{ume();Wme();Nt();lrt();nK=e=>e,crt=(e,t)=>{let r={...nK(mG(e)),...nK(zJ(e)),...nK(Ytt(e)),...nK(srt(e))};return t.forEach(n=>n.configure(r)),{...e,...gG(r),...HJ(r),...Ztt(r),...urt(r)}}});var Ch,Oz=C(()=>{rpe();npe();ope();wpe();ez();OE();hhe();yn();JJ();Nt();qme();Vy();Ktt();drt();Ch=class extends KI{constructor(...[t]){let r=Gtt(t||{}),n=mtt(r),o=rJ(n),i=NJ(o),a=_J(i),s=a,u=CJ(s),l=htt(u),c=crt(l,t?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(hJ(this.config)),this.middlewareStack.use(WJ(this.config)),this.middlewareStack.use(YJ(this.config)),this.middlewareStack.use(XW(this.config)),this.middlewareStack.use(QW(this.config)),this.middlewareStack.use(tJ(this.config)),this.middlewareStack.use(OJ(this.config,{httpAuthSchemeParametersProvider:ftt,identityProviderConfigProvider:async d=>new gN({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(GJ(this.config))}destroy(){super.destroy()}}});var jd,oK=C(()=>{Nt();jd=class e extends mN{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}});var Ez,Pz,Tz,Mz,Iz,Az,Rz,Dz,PN,Jme,Gme,Kme,Yme,Zme,Xme,Qme,RE=C(()=>{Nt();oK();Ez=class e extends jd{constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},Pz=class e extends jd{constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},Tz=class e extends jd{constructor(t){super({name:"PackedPolicyTooLargeException",$fault:"client",...t}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},Mz=class e extends jd{constructor(t){super({name:"RegionDisabledException",$fault:"client",...t}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},Iz=class e extends jd{constructor(t){super({name:"IDPRejectedClaimException",$fault:"client",...t}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},Az=class e extends jd{constructor(t){super({name:"InvalidIdentityTokenException",$fault:"client",...t}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},Rz=class e extends jd{constructor(t){super({name:"IDPCommunicationErrorException",$fault:"client",...t}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},Dz=class e extends jd{constructor(t){super({name:"InvalidAuthorizationMessageException",$fault:"client",...t}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,e.prototype)}},PN=e=>({...e,...e.SecretAccessKey&&{SecretAccessKey:kJ}}),Jme=e=>({...e,...e.Credentials&&{Credentials:PN(e.Credentials)}}),Gme=e=>({...e,...e.SAMLAssertion&&{SAMLAssertion:kJ}}),Kme=e=>({...e,...e.Credentials&&{Credentials:PN(e.Credentials)}}),Yme=e=>({...e,...e.WebIdentityToken&&{WebIdentityToken:kJ}}),Zme=e=>({...e,...e.Credentials&&{Credentials:PN(e.Credentials)}}),Xme=e=>({...e,...e.Credentials&&{Credentials:PN(e.Credentials)}}),Qme=e=>({...e,...e.Credentials&&{Credentials:PN(e.Credentials)}})});var frt,prt,hrt,mrt,grt,yrt,brt,_rt,vrt,wrt,Srt,xrt,Crt,Ort,Ert,Prt,DE,rrr,nrr,orr,irr,arr,srr,urr,lrr,crr,drr,frr,prr,hrr,mrr,grr,yrr,iK,brr,_rr,vrr,wrr,Srr,Trt,Tge,xrr,Crr,Orr,jz,Err,Prr,Trr,Mrr,Irr,Arr,Rrr,Drr,jrr,Nrr,Lrr,Frr,krr,Brr,Jc,$rr,jE,NE,LE,FE,TN,qrr,ege,cx,Urr,zrr,MN,dx,IN,Nd,tge,Hrr,rge,Ld,nge,oge,ige,age,sge,Vrr,Wrr,Jrr,Grr,uge,lge,cge,dge,Oh,Eh,fge,pge,hge,mge,Ph,gge,fx,AN,yge,bge,_ge,vge,Th,RN,wge,Sge,DN,jN,xge,Cge,kE,Oge,Ege,Pge,Ui,BE,Krr,px=C(()=>{nA();Wme();Nt();RE();oK();frt=async(e,t)=>{let r=NE,n;return n=BE({...crr(e,t),[FE]:qrr,[kE]:LE}),jE(t,r,"/",void 0,n)},prt=async(e,t)=>{let r=NE,n;return n=BE({...drr(e,t),[FE]:Urr,[kE]:LE}),jE(t,r,"/",void 0,n)},hrt=async(e,t)=>{let r=NE,n;return n=BE({...frr(e,t),[FE]:zrr,[kE]:LE}),jE(t,r,"/",void 0,n)},mrt=async(e,t)=>{let r=NE,n;return n=BE({...prr(e,t),[FE]:Hrr,[kE]:LE}),jE(t,r,"/",void 0,n)},grt=async(e,t)=>{let r=NE,n;return n=BE({...hrr(e,t),[FE]:Vrr,[kE]:LE}),jE(t,r,"/",void 0,n)},yrt=async(e,t)=>{let r=NE,n;return n=BE({...mrr(e,t),[FE]:Wrr,[kE]:LE}),jE(t,r,"/",void 0,n)},brt=async(e,t)=>{let r=NE,n;return n=BE({...grr(e,t),[FE]:Jrr,[kE]:LE}),jE(t,r,"/",void 0,n)},_rt=async(e,t)=>{let r=NE,n;return n=BE({...yrr(e,t),[FE]:Grr,[kE]:LE}),jE(t,r,"/",void 0,n)},vrt=async(e,t)=>{if(e.statusCode>=300)return DE(e,t);let r=await qy(e.body,t),n={};return n=xrr(r.AssumeRoleResult,t),{$metadata:Jc(e),...n}},wrt=async(e,t)=>{if(e.statusCode>=300)return DE(e,t);let r=await qy(e.body,t),n={};return n=Crr(r.AssumeRoleWithSAMLResult,t),{$metadata:Jc(e),...n}},Srt=async(e,t)=>{if(e.statusCode>=300)return DE(e,t);let r=await qy(e.body,t),n={};return n=Orr(r.AssumeRoleWithWebIdentityResult,t),{$metadata:Jc(e),...n}},xrt=async(e,t)=>{if(e.statusCode>=300)return DE(e,t);let r=await qy(e.body,t),n={};return n=Err(r.DecodeAuthorizationMessageResult,t),{$metadata:Jc(e),...n}},Crt=async(e,t)=>{if(e.statusCode>=300)return DE(e,t);let r=await qy(e.body,t),n={};return n=Mrr(r.GetAccessKeyInfoResult,t),{$metadata:Jc(e),...n}},Ort=async(e,t)=>{if(e.statusCode>=300)return DE(e,t);let r=await qy(e.body,t),n={};return n=Irr(r.GetCallerIdentityResult,t),{$metadata:Jc(e),...n}},Ert=async(e,t)=>{if(e.statusCode>=300)return DE(e,t);let r=await qy(e.body,t),n={};return n=Arr(r.GetFederationTokenResult,t),{$metadata:Jc(e),...n}},Prt=async(e,t)=>{if(e.statusCode>=300)return DE(e,t);let r=await qy(e.body,t),n={};return n=Rrr(r.GetSessionTokenResult,t),{$metadata:Jc(e),...n}},DE=async(e,t)=>{let r={...e,body:await _Xe(e.body,t)},n=Krr(e,r.body);switch(n){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await rrr(r,t);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await srr(r,t);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await urr(r,t);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await lrr(r,t);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await orr(r,t);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await arr(r,t);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await nrr(r,t);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await irr(r,t);default:let o=r.body;return $rr({output:e,parsedBody:o.Error,errorCode:n})}},rrr=async(e,t)=>{let r=e.body,n=Prr(r.Error,t),o=new Ez({$metadata:Jc(e),...n});return ia(o,r)},nrr=async(e,t)=>{let r=e.body,n=Drr(r.Error,t),o=new Rz({$metadata:Jc(e),...n});return ia(o,r)},orr=async(e,t)=>{let r=e.body,n=jrr(r.Error,t),o=new Iz({$metadata:Jc(e),...n});return ia(o,r)},irr=async(e,t)=>{let r=e.body,n=Nrr(r.Error,t),o=new Dz({$metadata:Jc(e),...n});return ia(o,r)},arr=async(e,t)=>{let r=e.body,n=Lrr(r.Error,t),o=new Az({$metadata:Jc(e),...n});return ia(o,r)},srr=async(e,t)=>{let r=e.body,n=Frr(r.Error,t),o=new Pz({$metadata:Jc(e),...n});return ia(o,r)},urr=async(e,t)=>{let r=e.body,n=krr(r.Error,t),o=new Tz({$metadata:Jc(e),...n});return ia(o,r)},lrr=async(e,t)=>{let r=e.body,n=Brr(r.Error,t),o=new Mz({$metadata:Jc(e),...n});return ia(o,r)},crr=(e,t)=>{let r={};if(e[fx]!=null&&(r[fx]=e[fx]),e[AN]!=null&&(r[AN]=e[AN]),e[Eh]!=null){let n=iK(e[Eh],t);e[Eh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(e[Oh]!=null&&(r[Oh]=e[Oh]),e[Ld]!=null&&(r[Ld]=e[Ld]),e[DN]!=null){let n=Trt(e[DN],t);e[DN]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}if(e[xge]!=null){let n=Srr(e[xge],t);e[xge]?.length===0&&(r.TransitiveTagKeys=[]),Object.entries(n).forEach(([o,i])=>{let a=`TransitiveTagKeys.${o}`;r[a]=i})}if(e[oge]!=null&&(r[oge]=e[oge]),e[RN]!=null&&(r[RN]=e[RN]),e[jN]!=null&&(r[jN]=e[jN]),e[Th]!=null&&(r[Th]=e[Th]),e[hge]!=null){let n=vrr(e[hge],t);e[hge]?.length===0&&(r.ProvidedContexts=[]),Object.entries(n).forEach(([o,i])=>{let a=`ProvidedContexts.${o}`;r[a]=i})}return r},drr=(e,t)=>{let r={};if(e[fx]!=null&&(r[fx]=e[fx]),e[fge]!=null&&(r[fge]=e[fge]),e[_ge]!=null&&(r[_ge]=e[_ge]),e[Eh]!=null){let n=iK(e[Eh],t);e[Eh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return e[Oh]!=null&&(r[Oh]=e[Oh]),e[Ld]!=null&&(r[Ld]=e[Ld]),r},frr=(e,t)=>{let r={};if(e[fx]!=null&&(r[fx]=e[fx]),e[AN]!=null&&(r[AN]=e[AN]),e[Ege]!=null&&(r[Ege]=e[Ege]),e[mge]!=null&&(r[mge]=e[mge]),e[Eh]!=null){let n=iK(e[Eh],t);e[Eh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return e[Oh]!=null&&(r[Oh]=e[Oh]),e[Ld]!=null&&(r[Ld]=e[Ld]),r},prr=(e,t)=>{let r={};return e[ige]!=null&&(r[ige]=e[ige]),r},hrr=(e,t)=>{let r={};return e[TN]!=null&&(r[TN]=e[TN]),r},mrr=(e,t)=>({}),grr=(e,t)=>{let r={};if(e[cge]!=null&&(r[cge]=e[cge]),e[Oh]!=null&&(r[Oh]=e[Oh]),e[Eh]!=null){let n=iK(e[Eh],t);e[Eh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(e[Ld]!=null&&(r[Ld]=e[Ld]),e[DN]!=null){let n=Trt(e[DN],t);e[DN]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}return r},yrr=(e,t)=>{let r={};return e[Ld]!=null&&(r[Ld]=e[Ld]),e[RN]!=null&&(r[RN]=e[RN]),e[jN]!=null&&(r[jN]=e[jN]),r},iK=(e,t)=>{let r={},n=1;for(let o of e){if(o===null)continue;let i=brr(o,t);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},brr=(e,t)=>{let r={};return e[Pge]!=null&&(r[Pge]=e[Pge]),r},_rr=(e,t)=>{let r={};return e[pge]!=null&&(r[pge]=e[pge]),e[tge]!=null&&(r[tge]=e[tge]),r},vrr=(e,t)=>{let r={},n=1;for(let o of e){if(o===null)continue;let i=_rr(o,t);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},wrr=(e,t)=>{let r={};return e[lge]!=null&&(r[lge]=e[lge]),e[Oge]!=null&&(r[Oge]=e[Oge]),r},Srr=(e,t)=>{let r={},n=1;for(let o of e)o!==null&&(r[`member.${n}`]=o,n++);return r},Trt=(e,t)=>{let r={},n=1;for(let o of e){if(o===null)continue;let i=wrr(o,t);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},Tge=(e,t)=>{let r={};return e[ege]!=null&&(r[ege]=Lr(e[ege])),e[dx]!=null&&(r[dx]=Lr(e[dx])),r},xrr=(e,t)=>{let r={};return e[Nd]!=null&&(r[Nd]=jz(e[Nd],t)),e[cx]!=null&&(r[cx]=Tge(e[cx],t)),e[Ph]!=null&&(r[Ph]=cz(e[Ph])),e[Th]!=null&&(r[Th]=Lr(e[Th])),r},Crr=(e,t)=>{let r={};return e[Nd]!=null&&(r[Nd]=jz(e[Nd],t)),e[cx]!=null&&(r[cx]=Tge(e[cx],t)),e[Ph]!=null&&(r[Ph]=cz(e[Ph])),e[yge]!=null&&(r[yge]=Lr(e[yge])),e[wge]!=null&&(r[wge]=Lr(e[wge])),e[uge]!=null&&(r[uge]=Lr(e[uge])),e[IN]!=null&&(r[IN]=Lr(e[IN])),e[dge]!=null&&(r[dge]=Lr(e[dge])),e[Th]!=null&&(r[Th]=Lr(e[Th])),r},Orr=(e,t)=>{let r={};return e[Nd]!=null&&(r[Nd]=jz(e[Nd],t)),e[vge]!=null&&(r[vge]=Lr(e[vge])),e[cx]!=null&&(r[cx]=Tge(e[cx],t)),e[Ph]!=null&&(r[Ph]=cz(e[Ph])),e[gge]!=null&&(r[gge]=Lr(e[gge])),e[IN]!=null&&(r[IN]=Lr(e[IN])),e[Th]!=null&&(r[Th]=Lr(e[Th])),r},jz=(e,t)=>{let r={};return e[TN]!=null&&(r[TN]=Lr(e[TN])),e[bge]!=null&&(r[bge]=Lr(e[bge])),e[Sge]!=null&&(r[Sge]=Lr(e[Sge])),e[nge]!=null&&(r[nge]=hN(k7e(e[nge]))),r},Err=(e,t)=>{let r={};return e[rge]!=null&&(r[rge]=Lr(e[rge])),r},Prr=(e,t)=>{let r={};return e[Ui]!=null&&(r[Ui]=Lr(e[Ui])),r},Trr=(e,t)=>{let r={};return e[sge]!=null&&(r[sge]=Lr(e[sge])),e[dx]!=null&&(r[dx]=Lr(e[dx])),r},Mrr=(e,t)=>{let r={};return e[MN]!=null&&(r[MN]=Lr(e[MN])),r},Irr=(e,t)=>{let r={};return e[Cge]!=null&&(r[Cge]=Lr(e[Cge])),e[MN]!=null&&(r[MN]=Lr(e[MN])),e[dx]!=null&&(r[dx]=Lr(e[dx])),r},Arr=(e,t)=>{let r={};return e[Nd]!=null&&(r[Nd]=jz(e[Nd],t)),e[age]!=null&&(r[age]=Trr(e[age],t)),e[Ph]!=null&&(r[Ph]=cz(e[Ph])),r},Rrr=(e,t)=>{let r={};return e[Nd]!=null&&(r[Nd]=jz(e[Nd],t)),r},Drr=(e,t)=>{let r={};return e[Ui]!=null&&(r[Ui]=Lr(e[Ui])),r},jrr=(e,t)=>{let r={};return e[Ui]!=null&&(r[Ui]=Lr(e[Ui])),r},Nrr=(e,t)=>{let r={};return e[Ui]!=null&&(r[Ui]=Lr(e[Ui])),r},Lrr=(e,t)=>{let r={};return e[Ui]!=null&&(r[Ui]=Lr(e[Ui])),r},Frr=(e,t)=>{let r={};return e[Ui]!=null&&(r[Ui]=Lr(e[Ui])),r},krr=(e,t)=>{let r={};return e[Ui]!=null&&(r[Ui]=Lr(e[Ui])),r},Brr=(e,t)=>{let r={};return e[Ui]!=null&&(r[Ui]=Lr(e[Ui])),r},Jc=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),$rr=qJ(jd),jE=async(e,t,r,n,o)=>{let{hostname:i,protocol:a="https",port:s,path:u}=await e.endpoint(),l={protocol:a,hostname:i,port:s,method:"POST",path:u.endsWith("/")?u.slice(0,-1)+r:u+r,headers:t};return n!==void 0&&(l.hostname=n),o!==void 0&&(l.body=o),new rK(l)},NE={"content-type":"application/x-www-form-urlencoded"},LE="2011-06-15",FE="Action",TN="AccessKeyId",qrr="AssumeRole",ege="AssumedRoleId",cx="AssumedRoleUser",Urr="AssumeRoleWithSAML",zrr="AssumeRoleWithWebIdentity",MN="Account",dx="Arn",IN="Audience",Nd="Credentials",tge="ContextAssertion",Hrr="DecodeAuthorizationMessage",rge="DecodedMessage",Ld="DurationSeconds",nge="Expiration",oge="ExternalId",ige="EncodedMessage",age="FederatedUser",sge="FederatedUserId",Vrr="GetAccessKeyInfo",Wrr="GetCallerIdentity",Jrr="GetFederationToken",Grr="GetSessionToken",uge="Issuer",lge="Key",cge="Name",dge="NameQualifier",Oh="Policy",Eh="PolicyArns",fge="PrincipalArn",pge="ProviderArn",hge="ProvidedContexts",mge="ProviderId",Ph="PackedPolicySize",gge="Provider",fx="RoleArn",AN="RoleSessionName",yge="Subject",bge="SecretAccessKey",_ge="SAMLAssertion",vge="SubjectFromWebIdentityToken",Th="SourceIdentity",RN="SerialNumber",wge="SubjectType",Sge="SessionToken",DN="Tags",jN="TokenCode",xge="TransitiveTagKeys",Cge="UserId",kE="Version",Oge="Value",Ege="WebIdentityToken",Pge="arn",Ui="message",BE=e=>Object.entries(e).map(([t,r])=>VJ(t)+"="+VJ(r)).join("&"),Krr=(e,t)=>{if(t.Error?.Code!==void 0)return t.Error.Code;if(e.statusCode==404)return"NotFound"}});var hx,aK=C(()=>{yn();Cn();Nt();Vy();RE();px();hx=class extends ot.classBuilder().ep({...Vc}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,Jme).ser(frt).de(vrt).build(){}});var Nz,Mge=C(()=>{yn();Cn();Nt();Vy();RE();px();Nz=class extends ot.classBuilder().ep({...Vc}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(Gme,Kme).ser(prt).de(wrt).build(){}});var oA,sK=C(()=>{yn();Cn();Nt();Vy();RE();px();oA=class extends ot.classBuilder().ep({...Vc}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(Yme,Zme).ser(hrt).de(Srt).build(){}});var Lz,Ige=C(()=>{yn();Cn();Nt();Vy();px();Lz=class extends ot.classBuilder().ep({...Vc}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(mrt).de(xrt).build(){}});var Fz,Age=C(()=>{yn();Cn();Nt();Vy();px();Fz=class extends ot.classBuilder().ep({...Vc}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(grt).de(Crt).build(){}});var kz,Rge=C(()=>{yn();Cn();Nt();Vy();px();kz=class extends ot.classBuilder().ep({...Vc}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(yrt).de(Ort).build(){}});var Bz,Dge=C(()=>{yn();Cn();Nt();Vy();RE();px();Bz=class extends ot.classBuilder().ep({...Vc}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,Xme).ser(brt).de(Ert).build(){}});var $z,jge=C(()=>{yn();Cn();Nt();Vy();RE();px();$z=class extends ot.classBuilder().ep({...Vc}).m(function(t,r,n,o){return[dt(n,this.serialize,this.deserialize),ft(n,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,Qme).ser(_rt).de(Prt).build(){}});var Yrr,uK,Mrt=C(()=>{Nt();aK();Mge();sK();Ige();Age();Rge();Dge();jge();Oz();Yrr={AssumeRoleCommand:hx,AssumeRoleWithSAMLCommand:Nz,AssumeRoleWithWebIdentityCommand:oA,DecodeAuthorizationMessageCommand:Lz,GetAccessKeyInfoCommand:Fz,GetCallerIdentityCommand:kz,GetFederationTokenCommand:Bz,GetSessionTokenCommand:$z},uK=class extends Ch{};BJ(Yrr,uK)});var Irt=C(()=>{aK();Mge();sK();Ige();Age();Rge();Dge();jge()});var Art=C(()=>{RE()});var Rrt,Drt,jrt,Nrt,Lrt,Frt,krt=C(()=>{aK();sK();Rrt="us-east-1",Drt=e=>{if(typeof e?.Arn=="string"){let t=e.Arn.split(":");if(t.length>4&&t[4]!=="")return t[4]}},jrt=async(e,t,r)=>{let n=typeof e=="function"?await e():e,o=typeof t=="function"?await t():t;return r?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${n} (provider)`,`${o} (parent client)`,`${Rrt} (STS default)`),n??o??Rrt},Nrt=(e,t)=>{let r,n;return async(o,i)=>{if(n=o,!r){let{logger:l=e?.parentClientConfig?.logger,region:c,requestHandler:d=e?.parentClientConfig?.requestHandler,credentialProviderLogger:f}=e,p=await jrt(c,e?.parentClientConfig?.region,f),h=!Frt(d);r=new t({credentialDefaultProvider:()=>async()=>n,region:p,requestHandler:h?d:void 0,logger:l})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new hx(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=Drt(s);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}}}},Lrt=(e,t)=>{let r;return async n=>{if(!r){let{logger:s=e?.parentClientConfig?.logger,region:u,requestHandler:l=e?.parentClientConfig?.requestHandler,credentialProviderLogger:c}=e,d=await jrt(u,e?.parentClientConfig?.region,c),f=!Frt(l);r=new t({region:d,requestHandler:f?l:void 0,logger:s})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new oA(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=Drt(i);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}}}},Frt=e=>e?.metadata?.handlerProtocol==="h2"});var Brt,$rt,qrt,Zrr,Urt=C(()=>{krt();Oz();Brt=(e,t)=>t?class extends e{constructor(n){super(n);for(let o of t)this.middlewareStack.use(o)}}:e,$rt=(e={},t)=>Nrt(e,Brt(Ch,t)),qrt=(e={},t)=>Lrt(e,Brt(Ch,t)),Zrr=e=>t=>e({roleAssumer:$rt(t),roleAssumerWithWebIdentity:qrt(t),...t})});var zrt={};Yd(zrt,{$Command:()=>ot,AssumeRoleCommand:()=>hx,AssumeRoleResponseFilterSensitiveLog:()=>Jme,AssumeRoleWithSAMLCommand:()=>Nz,AssumeRoleWithSAMLRequestFilterSensitiveLog:()=>Gme,AssumeRoleWithSAMLResponseFilterSensitiveLog:()=>Kme,AssumeRoleWithWebIdentityCommand:()=>oA,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:()=>Yme,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:()=>Zme,CredentialsFilterSensitiveLog:()=>PN,DecodeAuthorizationMessageCommand:()=>Lz,ExpiredTokenException:()=>Ez,GetAccessKeyInfoCommand:()=>Fz,GetCallerIdentityCommand:()=>kz,GetFederationTokenCommand:()=>Bz,GetFederationTokenResponseFilterSensitiveLog:()=>Xme,GetSessionTokenCommand:()=>$z,GetSessionTokenResponseFilterSensitiveLog:()=>Qme,IDPCommunicationErrorException:()=>Rz,IDPRejectedClaimException:()=>Iz,InvalidAuthorizationMessageException:()=>Dz,InvalidIdentityTokenException:()=>Az,MalformedPolicyDocumentException:()=>Pz,PackedPolicyTooLargeException:()=>Tz,RegionDisabledException:()=>Mz,STS:()=>uK,STSClient:()=>Ch,STSServiceException:()=>jd,__Client:()=>KI,decorateDefaultCredentialProvider:()=>Zrr,getDefaultRoleAssumer:()=>$rt,getDefaultRoleAssumerWithWebIdentity:()=>qrt});var Nge=C(()=>{Oz();Mrt();Irt();Art();Urt();oK()});var Hrt={};Yd(Hrt,{AssumeRoleCommand:()=>hx,STSClient:()=>Ch});var Vrt=C(()=>{Nge()});var Xrr,Wrt=C(()=>{nx();Xrr=e=>{let t;return async()=>{e.logger?.debug("@aws-sdk/credential-providers - fromTemporaryCredentials (STS)");let r={...e.params,RoleSessionName:e.params.RoleSessionName??"aws-sdk-js-"+Date.now()};if(r?.SerialNumber){if(!e.mfaCodeProvider)throw new zu("Temporary credential requires multi-factor authentication, but no MFA code callback was provided.",{tryNextLink:!1,logger:e.logger});r.TokenCode=await e.mfaCodeProvider(r?.SerialNumber)}let{AssumeRoleCommand:n,STSClient:o}=await Promise.resolve().then(()=>(Vrt(),Hrt));if(t||(t=new o({...e.clientConfig,credentials:e.masterCredentials})),e.clientPlugins)for(let a of e.clientPlugins)t.middlewareStack.use(a);let{Credentials:i}=await t.send(new n(r));if(!i||!i.AccessKeyId||!i.SecretAccessKey)throw new zu(`Invalid response from STS.assumeRole call with role ${r.RoleArn}`,{logger:e.logger});return{accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,sessionToken:i.SessionToken,expiration:i.Expiration,credentialScope:i.CredentialScope}}}});var Jrt=C(()=>{});var Grt,Krt=C(()=>{Grt=e=>async()=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:t,roleSessionName:r,webIdentityToken:n,providerId:o,policyArns:i,policy:a,durationSeconds:s}=e,{roleAssumerWithWebIdentity:u}=e;if(!u){let{getDefaultRoleAssumerWithWebIdentity:l}=await Promise.resolve().then(()=>(Nge(),zrt));u=l({...e.clientConfig,credentialProviderLogger:e.logger,parentClientConfig:e.parentClientConfig},e.clientPlugins)}return u({RoleArn:t,RoleSessionName:r??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:n,ProviderId:o,PolicyArns:i,Policy:a,DurationSeconds:s})}});var Yrt=C(()=>{Jrt();Krt()});var Qrr,Zrt=C(()=>{Yrt();Qrr=e=>Grt({...e})});var Xrt={};Yd(Xrt,{fromCognitoIdentity:()=>Vtr,fromCognitoIdentityPool:()=>Wtr,fromHttp:()=>$me,fromTemporaryCredentials:()=>Xrr,fromWebToken:()=>Qrr});var Qrt=C(()=>{Het();Vet();ctt();Wrt();Zrt()});var iA={};Yd(iA,{__addDisposableResource:()=>vnt,__assign:()=>lK,__asyncDelegator:()=>fnt,__asyncGenerator:()=>dnt,__asyncValues:()=>pnt,__await:()=>NN,__awaiter:()=>int,__classPrivateFieldGet:()=>ynt,__classPrivateFieldIn:()=>_nt,__classPrivateFieldSet:()=>bnt,__createBinding:()=>dK,__decorate:()=>rnt,__disposeResources:()=>wnt,__esDecorate:()=>enr,__exportStar:()=>snt,__extends:()=>ent,__generator:()=>ant,__importDefault:()=>gnt,__importStar:()=>mnt,__makeTemplateObject:()=>hnt,__metadata:()=>ont,__param:()=>nnt,__propKey:()=>rnr,__read:()=>Fge,__rest:()=>tnt,__runInitializers:()=>tnr,__setFunctionName:()=>nnr,__spread:()=>unt,__spreadArray:()=>cnt,__spreadArrays:()=>lnt,__values:()=>cK,default:()=>anr});function ent(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Lge(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function tnt(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function rnt(e,t,r,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i}function nnt(e,t){return function(r,n){t(r,n,e)}}function enr(e,t,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=!t&&e?n.static?e:e.prototype:null,c=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var _=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],h);if(s==="accessor"){if(_===void 0)continue;if(_===null||typeof _!="object")throw new TypeError("Object expected");(d=a(_.get))&&(c.get=d),(d=a(_.set))&&(c.set=d),(d=a(_.init))&&o.unshift(d)}else(d=a(_))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function tnr(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function rnr(e){return typeof e=="symbol"?e:"".concat(e)}function nnr(e,t,r){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function ont(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function int(e,t,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(e,t||[])).next())})}function ant(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function snt(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&dK(t,e,r)}function cK(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Fge(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >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 unt(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Fge(arguments[t]));return e}function lnt(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),o=0,t=0;t<r;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function cnt(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function NN(e){return this instanceof NN?(this.v=e,this):new NN(e)}function dnt(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(h){return Promise.resolve(h).then(p,d)}}function s(p,h){n[p]&&(o[p]=function(m){return new Promise(function(_,g){i.push([p,m,_,g])>1||u(p,m)})},h&&(o[p]=h(o[p])))}function u(p,h){try{l(n[p](h))}catch(m){f(i[0][3],m)}}function l(p){p.value instanceof NN?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,h){p(h),i.shift(),i.length&&u(i[0][0],i[0][1])}}function fnt(e){var t,r;return t={},n("next"),n("throw",function(o){throw o}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(o,i){t[o]=e[o]?function(a){return(r=!r)?{value:NN(e[o](a)),done:!1}:i?i(a):a}:i}}function pnt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof cK=="function"?cK(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,u){a=e[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 hnt(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function mnt(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&dK(t,e,r);return onr(t,e),t}function gnt(e){return e&&e.__esModule?e:{default:e}}function ynt(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}function bnt(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r}function _nt(e,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof e=="function"?t===e:e.has(t)}function vnt(e,t,r){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[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)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}function wnt(e){function t(i){e.error=e.hasError?new inr(i,e.error,"An error was suppressed during disposal."):i,e.hasError=!0}var r,n=0;function o(){for(;r=e.stack.pop();)try{if(!r.async&&n===1)return n=0,e.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 t(a),o()})}else n|=1}catch(a){t(a)}if(n===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return o()}var Lge,lK,dK,onr,inr,anr,aA=C(()=>{Lge=function(e,t){return Lge=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])},Lge(e,t)};lK=function(){return lK=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},lK.apply(this,arguments)};dK=Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]};onr=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};inr=typeof SuppressedError=="function"?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};anr={__extends:ent,__assign:lK,__rest:tnt,__decorate:rnt,__param:nnt,__metadata:ont,__awaiter:int,__generator:ant,__createBinding:dK,__exportStar:snt,__values:cK,__read:Fge,__spread:unt,__spreadArrays:lnt,__spreadArray:cnt,__await:NN,__asyncGenerator:dnt,__asyncDelegator:fnt,__asyncValues:pnt,__makeTemplateObject:hnt,__importStar:mnt,__importDefault:gnt,__classPrivateFieldGet:ynt,__classPrivateFieldSet:bnt,__classPrivateFieldIn:_nt,__addDisposableResource:vnt,__disposeResources:wnt}});var xnt=b(Snt=>{"use strict";Object.defineProperty(Snt,"__esModule",{value:!0})});var Cnt=b(qz=>{"use strict";Object.defineProperty(qz,"__esModule",{value:!0});qz.HttpAuthLocation=void 0;var snr;(function(e){e.HEADER="header",e.QUERY="query"})(snr=qz.HttpAuthLocation||(qz.HttpAuthLocation={}))});var Ent=b(Ont=>{"use strict";Object.defineProperty(Ont,"__esModule",{value:!0})});var Tnt=b(Pnt=>{"use strict";Object.defineProperty(Pnt,"__esModule",{value:!0})});var Int=b(Mnt=>{"use strict";Object.defineProperty(Mnt,"__esModule",{value:!0})});var Rnt=b(Ant=>{"use strict";Object.defineProperty(Ant,"__esModule",{value:!0})});var jnt=b(Dnt=>{"use strict";Object.defineProperty(Dnt,"__esModule",{value:!0})});var Lnt=b(Nnt=>{"use strict";Object.defineProperty(Nnt,"__esModule",{value:!0})});var knt=b(Fnt=>{"use strict";Object.defineProperty(Fnt,"__esModule",{value:!0})});var Bnt=b(Uz=>{"use strict";Object.defineProperty(Uz,"__esModule",{value:!0});var kge=(aA(),sl(iA));kge.__exportStar(jnt(),Uz);kge.__exportStar(Lnt(),Uz);kge.__exportStar(knt(),Uz)});var qnt=b($nt=>{"use strict";Object.defineProperty($nt,"__esModule",{value:!0})});var znt=b(Unt=>{"use strict";Object.defineProperty(Unt,"__esModule",{value:!0})});var Hnt=b(zz=>{"use strict";Object.defineProperty(zz,"__esModule",{value:!0});zz.EndpointURLScheme=void 0;var unr;(function(e){e.HTTP="http",e.HTTPS="https"})(unr=zz.EndpointURLScheme||(zz.EndpointURLScheme={}))});var Wnt=b(Vnt=>{"use strict";Object.defineProperty(Vnt,"__esModule",{value:!0})});var Gnt=b(Jnt=>{"use strict";Object.defineProperty(Jnt,"__esModule",{value:!0})});var Ynt=b(Knt=>{"use strict";Object.defineProperty(Knt,"__esModule",{value:!0})});var Xnt=b(Znt=>{"use strict";Object.defineProperty(Znt,"__esModule",{value:!0})});var eot=b(Qnt=>{"use strict";Object.defineProperty(Qnt,"__esModule",{value:!0})});var tot=b(sA=>{"use strict";Object.defineProperty(sA,"__esModule",{value:!0});var Hz=(aA(),sl(iA));Hz.__exportStar(Wnt(),sA);Hz.__exportStar(Gnt(),sA);Hz.__exportStar(Ynt(),sA);Hz.__exportStar(Xnt(),sA);Hz.__exportStar(eot(),sA)});var not=b(rot=>{"use strict";Object.defineProperty(rot,"__esModule",{value:!0})});var oot=b(Vz=>{"use strict";Object.defineProperty(Vz,"__esModule",{value:!0});Vz.FieldPosition=void 0;var lnr;(function(e){e[e.HEADER=0]="HEADER",e[e.TRAILER=1]="TRAILER"})(lnr=Vz.FieldPosition||(Vz.FieldPosition={}))});var aot=b(iot=>{"use strict";Object.defineProperty(iot,"__esModule",{value:!0})});var uot=b(sot=>{"use strict";Object.defineProperty(sot,"__esModule",{value:!0})});var cot=b(fK=>{"use strict";Object.defineProperty(fK,"__esModule",{value:!0});var lot=(aA(),sl(iA));lot.__exportStar(aot(),fK);lot.__exportStar(uot(),fK)});var fot=b(dot=>{"use strict";Object.defineProperty(dot,"__esModule",{value:!0})});var hot=b(pot=>{"use strict";Object.defineProperty(pot,"__esModule",{value:!0})});var got=b(mot=>{"use strict";Object.defineProperty(mot,"__esModule",{value:!0})});var bot=b(yot=>{"use strict";Object.defineProperty(yot,"__esModule",{value:!0})});var vot=b(_ot=>{"use strict";Object.defineProperty(_ot,"__esModule",{value:!0})});var Sot=b(wot=>{"use strict";Object.defineProperty(wot,"__esModule",{value:!0})});var Cot=b(xot=>{"use strict";Object.defineProperty(xot,"__esModule",{value:!0})});var Eot=b(Oot=>{"use strict";Object.defineProperty(Oot,"__esModule",{value:!0})});var Tot=b(Pot=>{"use strict";Object.defineProperty(Pot,"__esModule",{value:!0})});var Iot=b(Mot=>{"use strict";Object.defineProperty(Mot,"__esModule",{value:!0})});var Rot=b(Aot=>{"use strict";Object.defineProperty(Aot,"__esModule",{value:!0})});var jot=b(Dot=>{"use strict";Object.defineProperty(Dot,"__esModule",{value:!0})});var Lot=b(Not=>{"use strict";Object.defineProperty(Not,"__esModule",{value:!0})});var Fot=b(Wz=>{"use strict";Object.defineProperty(Wz,"__esModule",{value:!0});Wz.RequestHandlerProtocol=void 0;var cnr;(function(e){e.HTTP_0_9="http/0.9",e.HTTP_1_0="http/1.0",e.TDS_8_0="tds/8.0"})(cnr=Wz.RequestHandlerProtocol||(Wz.RequestHandlerProtocol={}))});var Bot=b(kot=>{"use strict";Object.defineProperty(kot,"__esModule",{value:!0})});var qot=b($ot=>{"use strict";Object.defineProperty($ot,"__esModule",{value:!0})});var zot=b(Uot=>{"use strict";Object.defineProperty(Uot,"__esModule",{value:!0})});var Vot=b(Hot=>{"use strict";Object.defineProperty(Hot,"__esModule",{value:!0})});var Jot=b(Wot=>{"use strict";Object.defineProperty(Wot,"__esModule",{value:!0})});var Got=b(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});var kn=(aA(),sl(iA));kn.__exportStar(xnt(),bn);kn.__exportStar(Cnt(),bn);kn.__exportStar(Ent(),bn);kn.__exportStar(Tnt(),bn);kn.__exportStar(Int(),bn);kn.__exportStar(Rnt(),bn);kn.__exportStar(Bnt(),bn);kn.__exportStar(qnt(),bn);kn.__exportStar(znt(),bn);kn.__exportStar(Hnt(),bn);kn.__exportStar(tot(),bn);kn.__exportStar(not(),bn);kn.__exportStar(oot(),bn);kn.__exportStar(cot(),bn);kn.__exportStar(fot(),bn);kn.__exportStar(hot(),bn);kn.__exportStar(got(),bn);kn.__exportStar(bot(),bn);kn.__exportStar(vot(),bn);kn.__exportStar(Sot(),bn);kn.__exportStar(Cot(),bn);kn.__exportStar(Eot(),bn);kn.__exportStar(Tot(),bn);kn.__exportStar(Iot(),bn);kn.__exportStar(Rot(),bn);kn.__exportStar(jot(),bn);kn.__exportStar(Lot(),bn);kn.__exportStar(Fot(),bn);kn.__exportStar(Bot(),bn);kn.__exportStar(qot(),bn);kn.__exportStar(zot(),bn);kn.__exportStar(Vot(),bn);kn.__exportStar(Jot(),bn)});var Kot=b(pK=>{"use strict";Object.defineProperty(pK,"__esModule",{value:!0});pK.Field=void 0;var dnr=Got(),Bge=class{constructor({name:t,kind:r=dnr.FieldPosition.HEADER,values:n=[]}){this.name=t,this.kind=r,this.values=n}add(t){this.values.push(t)}set(t){this.values=t}remove(t){this.values=this.values.filter(r=>r!==t)}toString(){return this.values.map(t=>t.includes(",")||t.includes(" ")?`"${t}"`:t).join(", ")}get(){return this.values}};pK.Field=Bge});var Yot=b(hK=>{"use strict";Object.defineProperty(hK,"__esModule",{value:!0});hK.Fields=void 0;var $ge=class{constructor({fields:t=[],encoding:r="utf-8"}){this.entries={},t.forEach(this.setField.bind(this)),this.encoding=r}setField(t){this.entries[t.name.toLowerCase()]=t}getField(t){return this.entries[t.toLowerCase()]}removeField(t){delete this.entries[t.toLowerCase()]}getByType(t){return Object.values(this.entries).filter(r=>r.kind===t)}};hK.Fields=$ge});var Xot=b(Zot=>{"use strict";Object.defineProperty(Zot,"__esModule",{value:!0})});var Qot=b(mK=>{"use strict";Object.defineProperty(mK,"__esModule",{value:!0});mK.HttpRequest=void 0;var qge=class e{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){let t=new e({...this,headers:{...this.headers}});return t.query&&(t.query=fnr(t.query)),t}};mK.HttpRequest=qge;function fnr(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}});var eit=b(gK=>{"use strict";Object.defineProperty(gK,"__esModule",{value:!0});gK.HttpResponse=void 0;var Uge=class{constructor(t){this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;let r=t;return typeof r.statusCode=="number"&&typeof r.headers=="object"}};gK.HttpResponse=Uge});var tit=b(yK=>{"use strict";Object.defineProperty(yK,"__esModule",{value:!0});yK.isValidHostname=void 0;function pnr(e){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(e)}yK.isValidHostname=pnr});var nit=b(rit=>{"use strict";Object.defineProperty(rit,"__esModule",{value:!0})});var oit=b(mx=>{"use strict";Object.defineProperty(mx,"__esModule",{value:!0});var uA=(aA(),sl(iA));uA.__exportStar(Kot(),mx);uA.__exportStar(Yot(),mx);uA.__exportStar(Xot(),mx);uA.__exportStar(Qot(),mx);uA.__exportStar(eit(),mx);uA.__exportStar(tit(),mx);uA.__exportStar(nit(),mx)});var iit=b(zge=>{"use strict";Object.defineProperty(zge,"__esModule",{value:!0});var hnr=(aA(),sl(iA));hnr.__exportStar(oit(),zge)});var lA={};Yd(lA,{__addDisposableResource:()=>Eit,__assign:()=>bK,__asyncDelegator:()=>bit,__asyncGenerator:()=>yit,__asyncValues:()=>_it,__await:()=>LN,__awaiter:()=>dit,__classPrivateFieldGet:()=>xit,__classPrivateFieldIn:()=>Oit,__classPrivateFieldSet:()=>Cit,__createBinding:()=>vK,__decorate:()=>uit,__disposeResources:()=>Pit,__esDecorate:()=>mnr,__exportStar:()=>pit,__extends:()=>ait,__generator:()=>fit,__importDefault:()=>Sit,__importStar:()=>wit,__makeTemplateObject:()=>vit,__metadata:()=>cit,__param:()=>lit,__propKey:()=>ynr,__read:()=>Vge,__rest:()=>sit,__runInitializers:()=>gnr,__setFunctionName:()=>bnr,__spread:()=>hit,__spreadArray:()=>git,__spreadArrays:()=>mit,__values:()=>_K,default:()=>wnr});function ait(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Hge(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function sit(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function uit(e,t,r,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i}function lit(e,t){return function(r,n){t(r,n,e)}}function mnr(e,t,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=!t&&e?n.static?e:e.prototype:null,c=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var _=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],h);if(s==="accessor"){if(_===void 0)continue;if(_===null||typeof _!="object")throw new TypeError("Object expected");(d=a(_.get))&&(c.get=d),(d=a(_.set))&&(c.set=d),(d=a(_.init))&&o.unshift(d)}else(d=a(_))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function gnr(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function ynr(e){return typeof e=="symbol"?e:"".concat(e)}function bnr(e,t,r){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function cit(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function dit(e,t,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(e,t||[])).next())})}function fit(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function pit(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&vK(t,e,r)}function _K(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Vge(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >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 hit(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Vge(arguments[t]));return e}function mit(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),o=0,t=0;t<r;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function git(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function LN(e){return this instanceof LN?(this.v=e,this):new LN(e)}function yit(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(h){return Promise.resolve(h).then(p,d)}}function s(p,h){n[p]&&(o[p]=function(m){return new Promise(function(_,g){i.push([p,m,_,g])>1||u(p,m)})},h&&(o[p]=h(o[p])))}function u(p,h){try{l(n[p](h))}catch(m){f(i[0][3],m)}}function l(p){p.value instanceof LN?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,h){p(h),i.shift(),i.length&&u(i[0][0],i[0][1])}}function bit(e){var t,r;return t={},n("next"),n("throw",function(o){throw o}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(o,i){t[o]=e[o]?function(a){return(r=!r)?{value:LN(e[o](a)),done:!1}:i?i(a):a}:i}}function _it(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof _K=="function"?_K(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,u){a=e[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 vit(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function wit(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&vK(t,e,r);return _nr(t,e),t}function Sit(e){return e&&e.__esModule?e:{default:e}}function xit(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}function Cit(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r}function Oit(e,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof e=="function"?t===e:e.has(t)}function Eit(e,t,r){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[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)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}function Pit(e){function t(i){e.error=e.hasError?new vnr(i,e.error,"An error was suppressed during disposal."):i,e.hasError=!0}var r,n=0;function o(){for(;r=e.stack.pop();)try{if(!r.async&&n===1)return n=0,e.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 t(a),o()})}else n|=1}catch(a){t(a)}if(n===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return o()}var Hge,bK,vK,_nr,vnr,wnr,cA=C(()=>{Hge=function(e,t){return Hge=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])},Hge(e,t)};bK=function(){return bK=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},bK.apply(this,arguments)};vK=Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]};_nr=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};vnr=typeof SuppressedError=="function"?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};wnr={__extends:ait,__assign:bK,__rest:sit,__decorate:uit,__param:lit,__metadata:cit,__awaiter:dit,__generator:fit,__createBinding:vK,__exportStar:pit,__values:_K,__read:Vge,__spread:hit,__spreadArrays:mit,__spreadArray:git,__await:LN,__asyncGenerator:yit,__asyncDelegator:bit,__asyncValues:_it,__makeTemplateObject:vit,__importStar:wit,__importDefault:Sit,__classPrivateFieldGet:xit,__classPrivateFieldSet:Cit,__classPrivateFieldIn:Oit,__addDisposableResource:Eit,__disposeResources:Pit}});var Kge={};Yd(Kge,{__assign:()=>Jge,__asyncDelegator:()=>jnr,__asyncGenerator:()=>Dnr,__asyncValues:()=>Nnr,__await:()=>Jz,__awaiter:()=>Pnr,__classPrivateFieldGet:()=>Bnr,__classPrivateFieldSet:()=>$nr,__createBinding:()=>Mnr,__decorate:()=>Cnr,__exportStar:()=>Inr,__extends:()=>Snr,__generator:()=>Tnr,__importDefault:()=>knr,__importStar:()=>Fnr,__makeTemplateObject:()=>Lnr,__metadata:()=>Enr,__param:()=>Onr,__read:()=>Tit,__rest:()=>xnr,__spread:()=>Anr,__spreadArrays:()=>Rnr,__values:()=>Gge});function Snr(e,t){Wge(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function xnr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function Cnr(e,t,r,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i}function Onr(e,t){return function(r,n){t(r,n,e)}}function Enr(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function Pnr(e,t,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(e,t||[])).next())})}function Tnr(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Mnr(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}function Inr(e,t){for(var r in e)r!=="default"&&!t.hasOwnProperty(r)&&(t[r]=e[r])}function Gge(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Tit(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >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 Anr(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Tit(arguments[t]));return e}function Rnr(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),o=0,t=0;t<r;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function Jz(e){return this instanceof Jz?(this.v=e,this):new Jz(e)}function Dnr(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Jz?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 jnr(e){var t,r;return t={},n("next"),n("throw",function(o){throw o}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(o,i){t[o]=e[o]?function(a){return(r=!r)?{value:Jz(e[o](a)),done:o==="return"}:i?i(a):a}:i}}function Nnr(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Gge=="function"?Gge(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,u){a=e[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 Lnr(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Fnr(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function knr(e){return e&&e.__esModule?e:{default:e}}function Bnr(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function $nr(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}var Wge,Jge,Yge=C(()=>{Wge=function(e,t){return Wge=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])},Wge(e,t)};Jge=function(){return Jge=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Jge.apply(this,arguments)}});var Mit=b(FN=>{"use strict";Object.defineProperty(FN,"__esModule",{value:!0});FN.toUtf8=FN.fromUtf8=void 0;var qnr=e=>{let t=[];for(let r=0,n=e.length;r<n;r++){let o=e.charCodeAt(r);if(o<128)t.push(o);else if(o<2048)t.push(o>>6|192,o&63|128);else if(r+1<e.length&&(o&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320){let i=65536+((o&1023)<<10)+(e.charCodeAt(++r)&1023);t.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else t.push(o>>12|224,o>>6&63|128,o&63|128)}return Uint8Array.from(t)};FN.fromUtf8=qnr;var Unr=e=>{let t="";for(let r=0,n=e.length;r<n;r++){let o=e[r];if(o<128)t+=String.fromCharCode(o);else if(192<=o&&o<224){let i=e[++r];t+=String.fromCharCode((o&31)<<6|i&63)}else if(240<=o&&o<365){let a="%"+[o,e[++r],e[++r],e[++r]].map(s=>s.toString(16)).join("%");t+=decodeURIComponent(a)}else t+=String.fromCharCode((o&15)<<12|(e[++r]&63)<<6|e[++r]&63)}return t};FN.toUtf8=Unr});var Iit=b(kN=>{"use strict";Object.defineProperty(kN,"__esModule",{value:!0});kN.toUtf8=kN.fromUtf8=void 0;function znr(e){return new TextEncoder().encode(e)}kN.fromUtf8=znr;function Hnr(e){return new TextDecoder("utf-8").decode(e)}kN.toUtf8=Hnr});var Dit=b(BN=>{"use strict";Object.defineProperty(BN,"__esModule",{value:!0});BN.toUtf8=BN.fromUtf8=void 0;var Ait=Mit(),Rit=Iit(),Vnr=e=>typeof TextEncoder=="function"?(0,Rit.fromUtf8)(e):(0,Ait.fromUtf8)(e);BN.fromUtf8=Vnr;var Wnr=e=>typeof TextDecoder=="function"?(0,Rit.toUtf8)(e):(0,Ait.toUtf8)(e);BN.toUtf8=Wnr});var jit=b(wK=>{"use strict";Object.defineProperty(wK,"__esModule",{value:!0});wK.convertToBuffer=void 0;var Jnr=Dit(),Gnr=typeof Buffer<"u"&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:Jnr.fromUtf8;function Knr(e){return e instanceof Uint8Array?e:typeof e=="string"?Gnr(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}wK.convertToBuffer=Knr});var Nit=b(SK=>{"use strict";Object.defineProperty(SK,"__esModule",{value:!0});SK.isEmptyData=void 0;function Ynr(e){return typeof e=="string"?e.length===0:e.byteLength===0}SK.isEmptyData=Ynr});var Lit=b(xK=>{"use strict";Object.defineProperty(xK,"__esModule",{value:!0});xK.numToUint8=void 0;function Znr(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}xK.numToUint8=Znr});var Fit=b(CK=>{"use strict";Object.defineProperty(CK,"__esModule",{value:!0});CK.uint32ArrayFrom=void 0;function Xnr(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),r=0;r<e.length;)t[r]=e[r],r+=1;return t}return Uint32Array.from(e)}CK.uint32ArrayFrom=Xnr});var Zge=b(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0});Jy.uint32ArrayFrom=Jy.numToUint8=Jy.isEmptyData=Jy.convertToBuffer=void 0;var Qnr=jit();Object.defineProperty(Jy,"convertToBuffer",{enumerable:!0,get:function(){return Qnr.convertToBuffer}});var eor=Nit();Object.defineProperty(Jy,"isEmptyData",{enumerable:!0,get:function(){return eor.isEmptyData}});var tor=Lit();Object.defineProperty(Jy,"numToUint8",{enumerable:!0,get:function(){return tor.numToUint8}});var ror=Fit();Object.defineProperty(Jy,"uint32ArrayFrom",{enumerable:!0,get:function(){return ror.uint32ArrayFrom}})});var $it=b(OK=>{"use strict";Object.defineProperty(OK,"__esModule",{value:!0});OK.AwsCrc32=void 0;var kit=(Yge(),sl(Kge)),Xge=Zge(),Bit=EK(),nor=function(){function e(){this.crc32=new Bit.Crc32}return e.prototype.update=function(t){(0,Xge.isEmptyData)(t)||this.crc32.update((0,Xge.convertToBuffer)(t))},e.prototype.digest=function(){return kit.__awaiter(this,void 0,void 0,function(){return kit.__generator(this,function(t){return[2,(0,Xge.numToUint8)(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new Bit.Crc32},e}();OK.AwsCrc32=nor});var EK=b($E=>{"use strict";Object.defineProperty($E,"__esModule",{value:!0});$E.AwsCrc32=$E.Crc32=$E.crc32=void 0;var oor=(Yge(),sl(Kge)),ior=Zge();function aor(e){return new qit().update(e).digest()}$E.crc32=aor;var qit=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(t){var r,n;try{for(var o=oor.__values(t),i=o.next();!i.done;i=o.next()){var a=i.value;this.checksum=this.checksum>>>8^uor[(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},e.prototype.digest=function(){return(this.checksum^4294967295)>>>0},e}();$E.Crc32=qit;var sor=[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],uor=(0,ior.uint32ArrayFrom)(sor),lor=$it();Object.defineProperty($E,"AwsCrc32",{enumerable:!0,get:function(){return lor.AwsCrc32}})});var qN=b($N=>{"use strict";Object.defineProperty($N,"__esModule",{value:!0});$N.toHex=$N.fromHex=void 0;var Uit={},Qge={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),Uit[e]=t,Qge[t]=e}function cor(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){let n=e.slice(r,r+2).toLowerCase();if(n in Qge)t[r/2]=Qge[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return t}$N.fromHex=cor;function dor(e){let t="";for(let r=0;r<e.byteLength;r++)t+=Uit[e[r]];return t}$N.toHex=dor});var tye=b(PK=>{"use strict";Object.defineProperty(PK,"__esModule",{value:!0});PK.Int64=void 0;var por=qN(),eye=class e{constructor(t){if(this.bytes=t,t.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>9223372036854776e3||t<-9223372036854776e3)throw new Error(`${t} 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(t));n>-1&&o>0;n--,o/=256)r[n]=o;return t<0&&zit(r),new e(r)}valueOf(){let t=this.bytes.slice(0),r=t[0]&128;return r&&zit(t),parseInt((0,por.toHex)(t),16)*(r?-1:1)}toString(){return String(this.valueOf())}};PK.Int64=eye;function zit(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}});var oye=b(TK=>{"use strict";Object.defineProperty(TK,"__esModule",{value:!0});TK.HeaderMarshaller=void 0;var UN=qN(),rye=tye(),nye=class{constructor(t,r){this.toUtf8=t,this.fromUtf8=r}format(t){let r=[];for(let i of Object.keys(t)){let a=this.fromUtf8(i);r.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(t[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(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,t.value,!1),new Uint8Array(r.buffer);case"integer":let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,t.value,!1),new Uint8Array(n.buffer);case"long":let o=new Uint8Array(9);return o[0]=5,o.set(t.value.bytes,1),o;case"binary":let i=new DataView(new ArrayBuffer(3+t.value.byteLength));i.setUint8(0,6),i.setUint16(1,t.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(t.value,3),a;case"string":let s=this.fromUtf8(t.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(rye.Int64.fromNumber(t.value.valueOf()).bytes,1),c;case"uuid":if(!Sor.test(t.value))throw new Error(`Invalid UUID received: ${t.value}`);let d=new Uint8Array(17);return d[0]=9,d.set((0,UN.fromHex)(t.value.replace(/\-/g,"")),1),d}}parse(t){let r={},n=0;for(;n<t.byteLength;){let o=t.getUint8(n++),i=this.toUtf8(new Uint8Array(t.buffer,t.byteOffset+n,o));switch(n+=o,t.getUint8(n++)){case 0:r[i]={type:Vit,value:!0};break;case 1:r[i]={type:Vit,value:!1};break;case 2:r[i]={type:hor,value:t.getInt8(n++)};break;case 3:r[i]={type:mor,value:t.getInt16(n,!1)},n+=2;break;case 4:r[i]={type:gor,value:t.getInt32(n,!1)},n+=4;break;case 5:r[i]={type:yor,value:new rye.Int64(new Uint8Array(t.buffer,t.byteOffset+n,8))},n+=8;break;case 6:let a=t.getUint16(n,!1);n+=2,r[i]={type:bor,value:new Uint8Array(t.buffer,t.byteOffset+n,a)},n+=a;break;case 7:let s=t.getUint16(n,!1);n+=2,r[i]={type:_or,value:this.toUtf8(new Uint8Array(t.buffer,t.byteOffset+n,s))},n+=s;break;case 8:r[i]={type:vor,value:new Date(new rye.Int64(new Uint8Array(t.buffer,t.byteOffset+n,8)).valueOf())},n+=8;break;case 9:let u=new Uint8Array(t.buffer,t.byteOffset+n,16);n+=16,r[i]={type:wor,value:`${(0,UN.toHex)(u.subarray(0,4))}-${(0,UN.toHex)(u.subarray(4,6))}-${(0,UN.toHex)(u.subarray(6,8))}-${(0,UN.toHex)(u.subarray(8,10))}-${(0,UN.toHex)(u.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};TK.HeaderMarshaller=nye;var Hit;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(Hit||(Hit={}));var Vit="boolean",hor="byte",mor="short",gor="integer",yor="long",bor="binary",_or="string",vor="timestamp",wor="uuid",Sor=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});var Jit=b(MK=>{"use strict";Object.defineProperty(MK,"__esModule",{value:!0});MK.splitMessage=void 0;var xor=EK(),Wit=4,qE=Wit*2,dA=4,Cor=qE+dA*2;function Oor({byteLength:e,byteOffset:t,buffer:r}){if(e<Cor)throw new Error("Provided message too short to accommodate event stream message overhead");let n=new DataView(r,t,e),o=n.getUint32(0,!1);if(e!==o)throw new Error("Reported message length does not match received message length");let i=n.getUint32(Wit,!1),a=n.getUint32(qE,!1),s=n.getUint32(e-dA,!1),u=new xor.Crc32().update(new Uint8Array(r,t,qE));if(a!==u.digest())throw new Error(`The prelude checksum specified in the message (${a}) does not match the calculated CRC32 checksum (${u.digest()})`);if(u.update(new Uint8Array(r,t+qE,e-(qE+dA))),s!==u.digest())throw new Error(`The message checksum (${u.digest()}) did not match the expected value of ${s}`);return{headers:new DataView(r,t+qE+dA,i),body:new Uint8Array(r,t+qE+dA+i,o-i-(qE+dA+dA))}}MK.splitMessage=Oor});var Git=b(IK=>{"use strict";Object.defineProperty(IK,"__esModule",{value:!0});IK.EventStreamCodec=void 0;var Eor=EK(),Por=oye(),Tor=Jit(),iye=class{constructor(t,r){this.headerMarshaller=new Por.HeaderMarshaller(t,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(t){this.messageBuffer.push(this.decode(t))}endOfStream(){this.isEndOfStream=!0}getMessage(){let t=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return t},isEndOfStream(){return r}}}getAvailableMessages(){let t=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return t},isEndOfStream(){return r}}}encode({headers:t,body:r}){let n=this.headerMarshaller.format(t),o=n.byteLength+r.byteLength+16,i=new Uint8Array(o),a=new DataView(i.buffer,i.byteOffset,i.byteLength),s=new Eor.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(t){let{headers:r,body:n}=(0,Tor.splitMessage)(t);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(t){return this.headerMarshaller.format(t)}};IK.EventStreamCodec=iye});var Yit=b(Kit=>{"use strict";Object.defineProperty(Kit,"__esModule",{value:!0})});var Zit=b(AK=>{"use strict";Object.defineProperty(AK,"__esModule",{value:!0});AK.MessageDecoderStream=void 0;var aye=class{constructor(t){this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let t of this.options.inputStream)yield this.options.decoder.decode(t)}};AK.MessageDecoderStream=aye});var Xit=b(RK=>{"use strict";Object.defineProperty(RK,"__esModule",{value:!0});RK.MessageEncoderStream=void 0;var sye=class{constructor(t){this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let t of this.options.messageStream)yield this.options.encoder.encode(t);this.options.includeEndFrame&&(yield new Uint8Array(0))}};RK.MessageEncoderStream=sye});var Qit=b(DK=>{"use strict";Object.defineProperty(DK,"__esModule",{value:!0});DK.SmithyMessageDecoderStream=void 0;var uye=class{constructor(t){this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let t of this.options.messageStream){let r=await this.options.deserializer(t);r!==void 0&&(yield r)}}};DK.SmithyMessageDecoderStream=uye});var eat=b(jK=>{"use strict";Object.defineProperty(jK,"__esModule",{value:!0});jK.SmithyMessageEncoderStream=void 0;var lye=class{constructor(t){this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let t of this.options.inputStream)yield this.options.serializer(t)}};jK.SmithyMessageEncoderStream=lye});var tat=b(Gy=>{"use strict";Object.defineProperty(Gy,"__esModule",{value:!0});var UE=(cA(),sl(lA));UE.__exportStar(Git(),Gy);UE.__exportStar(oye(),Gy);UE.__exportStar(tye(),Gy);UE.__exportStar(Yit(),Gy);UE.__exportStar(Zit(),Gy);UE.__exportStar(Xit(),Gy);UE.__exportStar(Qit(),Gy);UE.__exportStar(eat(),Gy)});var rat=b(NK=>{"use strict";Object.defineProperty(NK,"__esModule",{value:!0});NK.normalizeProvider=void 0;var Mor=e=>{if(typeof e=="function")return e;let t=Promise.resolve(e);return()=>t};NK.normalizeProvider=Mor});var nat=b(cye=>{"use strict";Object.defineProperty(cye,"__esModule",{value:!0});var Ior=(cA(),sl(lA));Ior.__exportStar(rat(),cye)});var dye=b(LK=>{"use strict";Object.defineProperty(LK,"__esModule",{value:!0});LK.isArrayBuffer=void 0;var Aor=e=>typeof ArrayBuffer=="function"&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)==="[object ArrayBuffer]";LK.isArrayBuffer=Aor});var pye=b(zN=>{"use strict";Object.defineProperty(zN,"__esModule",{value:!0});zN.fromString=zN.fromArrayBuffer=void 0;var Ror=dye(),fye=Td(),Dor=(e,t=0,r=e.byteLength-t)=>{if(!(0,Ror.isArrayBuffer)(e))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof e} (${e})`);return fye.Buffer.from(e,t,r)};zN.fromArrayBuffer=Dor;var jor=(e,t)=>{if(typeof e!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?fye.Buffer.from(e,t):fye.Buffer.from(e)};zN.fromString=jor});var hye=b(FK=>{"use strict";Object.defineProperty(FK,"__esModule",{value:!0});FK.fromUtf8=void 0;var Nor=pye(),Lor=e=>{let t=(0,Nor.fromString)(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)};FK.fromUtf8=Lor});var oat=b(kK=>{"use strict";Object.defineProperty(kK,"__esModule",{value:!0});kK.toUint8Array=void 0;var For=hye(),kor=e=>typeof e=="string"?(0,For.fromUtf8)(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e);kK.toUint8Array=kor});var iat=b(BK=>{"use strict";Object.defineProperty(BK,"__esModule",{value:!0});BK.toUtf8=void 0;var Bor=pye(),$or=e=>(0,Bor.fromArrayBuffer)(e.buffer,e.byteOffset,e.byteLength).toString("utf8");BK.toUtf8=$or});var $K=b(Gz=>{"use strict";Object.defineProperty(Gz,"__esModule",{value:!0});var mye=(cA(),sl(lA));mye.__exportStar(hye(),Gz);mye.__exportStar(oat(),Gz);mye.__exportStar(iat(),Gz)});var fA=b(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.MAX_PRESIGNED_TTL=pt.KEY_TYPE_IDENTIFIER=pt.MAX_CACHE_SIZE=pt.UNSIGNED_PAYLOAD=pt.EVENT_ALGORITHM_IDENTIFIER=pt.ALGORITHM_IDENTIFIER_V4A=pt.ALGORITHM_IDENTIFIER=pt.UNSIGNABLE_PATTERNS=pt.SEC_HEADER_PATTERN=pt.PROXY_HEADER_PATTERN=pt.ALWAYS_UNSIGNABLE_HEADERS=pt.HOST_HEADER=pt.TOKEN_HEADER=pt.SHA256_HEADER=pt.SIGNATURE_HEADER=pt.GENERATED_HEADERS=pt.DATE_HEADER=pt.AMZ_DATE_HEADER=pt.AUTH_HEADER=pt.REGION_SET_PARAM=pt.TOKEN_QUERY_PARAM=pt.SIGNATURE_QUERY_PARAM=pt.EXPIRES_QUERY_PARAM=pt.SIGNED_HEADERS_QUERY_PARAM=pt.AMZ_DATE_QUERY_PARAM=pt.CREDENTIAL_QUERY_PARAM=pt.ALGORITHM_QUERY_PARAM=void 0;pt.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm";pt.CREDENTIAL_QUERY_PARAM="X-Amz-Credential";pt.AMZ_DATE_QUERY_PARAM="X-Amz-Date";pt.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders";pt.EXPIRES_QUERY_PARAM="X-Amz-Expires";pt.SIGNATURE_QUERY_PARAM="X-Amz-Signature";pt.TOKEN_QUERY_PARAM="X-Amz-Security-Token";pt.REGION_SET_PARAM="X-Amz-Region-Set";pt.AUTH_HEADER="authorization";pt.AMZ_DATE_HEADER=pt.AMZ_DATE_QUERY_PARAM.toLowerCase();pt.DATE_HEADER="date";pt.GENERATED_HEADERS=[pt.AUTH_HEADER,pt.AMZ_DATE_HEADER,pt.DATE_HEADER];pt.SIGNATURE_HEADER=pt.SIGNATURE_QUERY_PARAM.toLowerCase();pt.SHA256_HEADER="x-amz-content-sha256";pt.TOKEN_HEADER=pt.TOKEN_QUERY_PARAM.toLowerCase();pt.HOST_HEADER="host";pt.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};pt.PROXY_HEADER_PATTERN=/^proxy-/;pt.SEC_HEADER_PATTERN=/^sec-/;pt.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i];pt.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256";pt.ALGORITHM_IDENTIFIER_V4A="AWS4-ECDSA-P256-SHA256";pt.EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD";pt.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD";pt.MAX_CACHE_SIZE=50;pt.KEY_TYPE_IDENTIFIER="aws4_request";pt.MAX_PRESIGNED_TTL=60*60*24*7});var yye=b(zE=>{"use strict";Object.defineProperty(zE,"__esModule",{value:!0});zE.clearCredentialCache=zE.getSigningKey=zE.createScope=void 0;var qor=qN(),Uor=$K(),gye=fA(),HN={},qK=[],zor=(e,t,r)=>`${e}/${t}/${r}/${gye.KEY_TYPE_IDENTIFIER}`;zE.createScope=zor;var Hor=async(e,t,r,n,o)=>{let i=await aat(e,t.secretAccessKey,t.accessKeyId),a=`${r}:${n}:${o}:${(0,qor.toHex)(i)}:${t.sessionToken}`;if(a in HN)return HN[a];for(qK.push(a);qK.length>gye.MAX_CACHE_SIZE;)delete HN[qK.shift()];let s=`AWS4${t.secretAccessKey}`;for(let u of[r,n,o,gye.KEY_TYPE_IDENTIFIER])s=await aat(e,s,u);return HN[a]=s};zE.getSigningKey=Hor;var Vor=()=>{qK.length=0,Object.keys(HN).forEach(e=>{delete HN[e]})};zE.clearCredentialCache=Vor;var aat=(e,t,r)=>{let n=new e(t);return n.update((0,Uor.toUint8Array)(r)),n.digest()}});var _ye=b(UK=>{"use strict";Object.defineProperty(UK,"__esModule",{value:!0});UK.getCanonicalHeaders=void 0;var bye=fA(),Wor=({headers:e},t,r)=>{let n={};for(let o of Object.keys(e).sort()){if(e[o]==null)continue;let i=o.toLowerCase();(i in bye.ALWAYS_UNSIGNABLE_HEADERS||t?.has(i)||bye.PROXY_HEADER_PATTERN.test(i)||bye.SEC_HEADER_PATTERN.test(i))&&(!r||r&&!r.has(i))||(n[i]=e[o].trim().replace(/\s+/g," "))}return n};UK.getCanonicalHeaders=Wor});var vye=b(zK=>{"use strict";Object.defineProperty(zK,"__esModule",{value:!0});zK.escapeUri=void 0;var Jor=e=>encodeURIComponent(e).replace(/[!'()*]/g,Gor);zK.escapeUri=Jor;var Gor=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`});var sat=b(HK=>{"use strict";Object.defineProperty(HK,"__esModule",{value:!0});HK.escapeUriPath=void 0;var Kor=vye(),Yor=e=>e.split("/").map(Kor.escapeUri).join("/");HK.escapeUriPath=Yor});var lat=b(VK=>{"use strict";Object.defineProperty(VK,"__esModule",{value:!0});var uat=(cA(),sl(lA));uat.__exportStar(vye(),VK);uat.__exportStar(sat(),VK)});var wye=b(JK=>{"use strict";Object.defineProperty(JK,"__esModule",{value:!0});JK.getCanonicalQuery=void 0;var WK=lat(),Zor=fA(),Xor=({query:e={}})=>{let t=[],r={};for(let n of Object.keys(e).sort()){if(n.toLowerCase()===Zor.SIGNATURE_HEADER)continue;t.push(n);let o=e[n];typeof o=="string"?r[n]=`${(0,WK.escapeUri)(n)}=${(0,WK.escapeUri)(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).sort().reduce((i,a)=>i.concat([`${(0,WK.escapeUri)(n)}=${(0,WK.escapeUri)(a)}`]),[]).join("&"))}return t.map(n=>r[n]).filter(n=>n).join("&")};JK.getCanonicalQuery=Xor});var Sye=b(GK=>{"use strict";Object.defineProperty(GK,"__esModule",{value:!0});GK.getPayloadHash=void 0;var Qor=dye(),eir=qN(),tir=$K(),cat=fA(),rir=async({headers:e,body:t},r)=>{for(let n of Object.keys(e))if(n.toLowerCase()===cat.SHA256_HEADER)return e[n];if(t==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof t=="string"||ArrayBuffer.isView(t)||(0,Qor.isArrayBuffer)(t)){let n=new r;return n.update((0,tir.toUint8Array)(t)),(0,eir.toHex)(await n.digest())}return cat.UNSIGNED_PAYLOAD};GK.getPayloadHash=rir});var dat=b(HE=>{"use strict";Object.defineProperty(HE,"__esModule",{value:!0});HE.deleteHeader=HE.getHeaderValue=HE.hasHeader=void 0;var nir=(e,t)=>{e=e.toLowerCase();for(let r of Object.keys(t))if(e===r.toLowerCase())return!0;return!1};HE.hasHeader=nir;var oir=(e,t)=>{e=e.toLowerCase();for(let r of Object.keys(t))if(e===r.toLowerCase())return t[r]};HE.getHeaderValue=oir;var iir=(e,t)=>{e=e.toLowerCase();for(let r of Object.keys(t))e===r.toLowerCase()&&delete t[r]};HE.deleteHeader=iir});var xye=b(pA=>{"use strict";Object.defineProperty(pA,"__esModule",{value:!0});pA.cloneQuery=pA.cloneRequest=void 0;var air=({headers:e,query:t,...r})=>({...r,headers:{...e},query:t?(0,pA.cloneQuery)(t):void 0});pA.cloneRequest=air;var sir=e=>Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{});pA.cloneQuery=sir});var Cye=b(KK=>{"use strict";Object.defineProperty(KK,"__esModule",{value:!0});KK.moveHeadersToQuery=void 0;var uir=xye(),lir=(e,t={})=>{var r;let{headers:n,query:o={}}=typeof e.clone=="function"?e.clone():(0,uir.cloneRequest)(e);for(let i of Object.keys(n)){let a=i.toLowerCase();a.slice(0,6)==="x-amz-"&&!(!((r=t.unhoistableHeaders)===null||r===void 0)&&r.has(a))&&(o[i]=n[i],delete n[i])}return{...e,headers:n,query:o}};KK.moveHeadersToQuery=lir});var Oye=b(YK=>{"use strict";Object.defineProperty(YK,"__esModule",{value:!0});YK.prepareRequest=void 0;var cir=xye(),dir=fA(),fir=e=>{e=typeof e.clone=="function"?e.clone():(0,cir.cloneRequest)(e);for(let t of Object.keys(e.headers))dir.GENERATED_HEADERS.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e};YK.prepareRequest=fir});var fat=b(hA=>{"use strict";Object.defineProperty(hA,"__esModule",{value:!0});hA.toDate=hA.iso8601=void 0;var pir=e=>(0,hA.toDate)(e).toISOString().replace(/\.\d{3}Z$/,"Z");hA.iso8601=pir;var hir=e=>typeof e=="number"?new Date(e*1e3):typeof e=="string"?Number(e)?new Date(Number(e)*1e3):new Date(e):e;hA.toDate=hir});var yat=b(e7=>{"use strict";Object.defineProperty(e7,"__esModule",{value:!0});e7.SignatureV4=void 0;var mir=tat(),ZK=qN(),pat=nat(),Kz=$K(),Yl=fA(),XK=yye(),hat=_ye(),gir=wye(),Eye=Sye(),yir=dat(),bir=Cye(),mat=Oye(),_ir=fat(),Pye=class{constructor({applyChecksum:t,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerMarshaller=new mir.HeaderMarshaller(Kz.toUtf8,Kz.fromUtf8),this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof t=="boolean"?t:!0,this.regionProvider=(0,pat.normalizeProvider)(n),this.credentialProvider=(0,pat.normalizeProvider)(r)}async presign(t,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}=QK(n);if(o>Yl.MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let h=(0,XK.createScope)(p,d,l??this.service),m=(0,bir.moveHeadersToQuery)((0,mat.prepareRequest)(t),{unhoistableHeaders:a});c.sessionToken&&(m.query[Yl.TOKEN_QUERY_PARAM]=c.sessionToken),m.query[Yl.ALGORITHM_QUERY_PARAM]=Yl.ALGORITHM_IDENTIFIER,m.query[Yl.CREDENTIAL_QUERY_PARAM]=`${c.accessKeyId}/${h}`,m.query[Yl.AMZ_DATE_QUERY_PARAM]=f,m.query[Yl.EXPIRES_QUERY_PARAM]=o.toString(10);let _=(0,hat.getCanonicalHeaders)(m,i,s);return m.query[Yl.SIGNED_HEADERS_QUERY_PARAM]=gat(_),m.query[Yl.SIGNATURE_QUERY_PARAM]=await this.getSignature(f,h,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(m,_,await(0,Eye.getPayloadHash)(t,this.sha256))),m}async sign(t,r){return typeof t=="string"?this.signString(t,r):t.headers&&t.payload?this.signEvent(t,r):t.message?this.signMessage(t,r):this.signRequest(t,r)}async signEvent({headers:t,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=QK(n),c=(0,XK.createScope)(u,s,a??this.service),d=await(0,Eye.getPayloadHash)({headers:{},body:r},this.sha256),f=new this.sha256;f.update(t);let p=(0,ZK.toHex)(await f.digest()),h=[Yl.EVENT_ALGORITHM_IDENTIFIER,l,c,o,p,d].join(`
`);return this.signString(h,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(t,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerMarshaller.format(t.message.headers),payload:t.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:t.priorSignature}).then(a=>({message:t.message,signature:a}))}async signString(t,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=QK(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update((0,Kz.toUint8Array)(t)),(0,ZK.toHex)(await u.digest())}async signRequest(t,{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,mat.prepareRequest)(t),{longDate:c,shortDate:d}=QK(r),f=(0,XK.createScope)(d,u,a??this.service);l.headers[Yl.AMZ_DATE_HEADER]=c,s.sessionToken&&(l.headers[Yl.TOKEN_HEADER]=s.sessionToken);let p=await(0,Eye.getPayloadHash)(l,this.sha256);!(0,yir.hasHeader)(Yl.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[Yl.SHA256_HEADER]=p);let h=(0,hat.getCanonicalHeaders)(l,o,n),m=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,h,p));return l.headers[Yl.AUTH_HEADER]=`${Yl.ALGORITHM_IDENTIFIER} Credential=${s.accessKeyId}/${f}, SignedHeaders=${gat(h)}, Signature=${m}`,l}createCanonicalRequest(t,r,n){let o=Object.keys(r).sort();return`${t.method}
${this.getCanonicalPath(t)}
${(0,gir.getCanonicalQuery)(t)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}
${o.join(";")}
${n}`}async createStringToSign(t,r,n){let o=new this.sha256;o.update((0,Kz.toUint8Array)(n));let i=await o.digest();return`${Yl.ALGORITHM_IDENTIFIER}
${t}
${r}
${(0,ZK.toHex)(i)}`}getCanonicalPath({path:t}){if(this.uriEscapePath){let r=[];for(let i of t.split("/"))i?.length!==0&&i!=="."&&(i===".."?r.pop():r.push(i));let n=`${t?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&t?.endsWith("/")?"/":""}`;return encodeURIComponent(n).replace(/%2F/g,"/")}return t}async getSignature(t,r,n,o){let i=await this.createStringToSign(t,r,o),a=new this.sha256(await n);return a.update((0,Kz.toUint8Array)(i)),(0,ZK.toHex)(await a.digest())}getSigningKey(t,r,n,o){return(0,XK.getSigningKey)(this.sha256,t,n,r,o||this.service)}validateResolvedCredentials(t){if(typeof t!="object"||typeof t.accessKeyId!="string"||typeof t.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}};e7.SignatureV4=Pye;var QK=e=>{let t=(0,_ir.iso8601)(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.slice(0,8)}},gat=e=>Object.keys(e).sort().join(";")});var _at=b(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.prepareRequest=bf.moveHeadersToQuery=bf.getPayloadHash=bf.getCanonicalQuery=bf.getCanonicalHeaders=void 0;var bat=(cA(),sl(lA));bat.__exportStar(yat(),bf);var vir=_ye();Object.defineProperty(bf,"getCanonicalHeaders",{enumerable:!0,get:function(){return vir.getCanonicalHeaders}});var wir=wye();Object.defineProperty(bf,"getCanonicalQuery",{enumerable:!0,get:function(){return wir.getCanonicalQuery}});var Sir=Sye();Object.defineProperty(bf,"getPayloadHash",{enumerable:!0,get:function(){return Sir.getPayloadHash}});var xir=Cye();Object.defineProperty(bf,"moveHeadersToQuery",{enumerable:!0,get:function(){return xir.moveHeadersToQuery}});var Cir=Oye();Object.defineProperty(bf,"prepareRequest",{enumerable:!0,get:function(){return Cir.prepareRequest}});bat.__exportStar(yye(),bf)});var vat=b(Tye=>{"use strict";Object.defineProperty(Tye,"__esModule",{value:!0});var Oir=(cA(),sl(lA));Oir.__exportStar(_at(),Tye)});var la=b((_to,wat)=>{"use strict";wat.exports={ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,r){return e.slice(t,r)},Error,FunctionPrototypeCall(e,t,...r){return e.call(t,...r)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},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(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,r){return Object.defineProperty(e,t,r)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,r){return e.then(t,r)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,r){return e.slice(t,r)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.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(e,t,r){return e.set(t,r)},Boolean,Uint8Array}});var VN=b((vto,t7)=>{"use strict";var{AbortController:Sat,AbortSignal:Eir}=typeof self<"u"?self:typeof window<"u"?window:void 0;t7.exports=Sat;t7.exports.AbortSignal=Eir;t7.exports.default=Sat});var Yz=b((wto,Mye)=>{"use strict";var WN=typeof Reflect=="object"?Reflect:null,xat=WN&&typeof WN.apply=="function"?WN.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},r7;WN&&typeof WN.ownKeys=="function"?r7=WN.ownKeys:Object.getOwnPropertySymbols?r7=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:r7=function(t){return Object.getOwnPropertyNames(t)};function Pir(e){console&&console.warn&&console.warn(e)}var Oat=Number.isNaN||function(t){return t!==t};function Wo(){Wo.init.call(this)}Mye.exports=Wo;Mye.exports.once=Air;Wo.EventEmitter=Wo;Wo.prototype._events=void 0;Wo.prototype._eventsCount=0;Wo.prototype._maxListeners=void 0;var Cat=10;function n7(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(Wo,"defaultMaxListeners",{enumerable:!0,get:function(){return Cat},set:function(e){if(typeof e!="number"||e<0||Oat(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Cat=e}});Wo.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};Wo.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Oat(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Eat(e){return e._maxListeners===void 0?Wo.defaultMaxListeners:e._maxListeners}Wo.prototype.getMaxListeners=function(){return Eat(this)};Wo.prototype.emit=function(t){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var o=t==="error",i=this._events;if(i!==void 0)o=o&&i.error===void 0;else if(!o)return!1;if(o){var a;if(r.length>0&&(a=r[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[t];if(u===void 0)return!1;if(typeof u=="function")xat(u,this,r);else for(var l=u.length,c=Aat(u,l),n=0;n<l;++n)xat(c[n],this,r);return!0};function Pat(e,t,r,n){var o,i,a;if(n7(r),i=e._events,i===void 0?(i=e._events=Object.create(null),e._eventsCount=0):(i.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),a=i[t]),a===void 0)a=i[t]=r,++e._eventsCount;else if(typeof a=="function"?a=i[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),o=Eat(e),o>0&&a.length>o&&!a.warned){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,Pir(s)}return e}Wo.prototype.addListener=function(t,r){return Pat(this,t,r,!1)};Wo.prototype.on=Wo.prototype.addListener;Wo.prototype.prependListener=function(t,r){return Pat(this,t,r,!0)};function Tir(){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 Tat(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=Tir.bind(n);return o.listener=r,n.wrapFn=o,o}Wo.prototype.once=function(t,r){return n7(r),this.on(t,Tat(this,t,r)),this};Wo.prototype.prependOnceListener=function(t,r){return n7(r),this.prependListener(t,Tat(this,t,r)),this};Wo.prototype.removeListener=function(t,r){var n,o,i,a,s;if(n7(r),o=this._events,o===void 0)return this;if(n=o[t],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete o[t],o.removeListener&&this.emit("removeListener",t,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():Mir(n,i),n.length===1&&(o[t]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",t,s||r)}return this};Wo.prototype.off=Wo.prototype.removeListener;Wo.prototype.removeAllListeners=function(t){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[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var i=Object.keys(n),a;for(o=0;o<i.length;++o)a=i[o],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[t],typeof r=="function")this.removeListener(t,r);else if(r!==void 0)for(o=r.length-1;o>=0;o--)this.removeListener(t,r[o]);return this};function Mat(e,t,r){var n=e._events;if(n===void 0)return[];var o=n[t];return o===void 0?[]:typeof o=="function"?r?[o.listener||o]:[o]:r?Iir(o):Aat(o,o.length)}Wo.prototype.listeners=function(t){return Mat(this,t,!0)};Wo.prototype.rawListeners=function(t){return Mat(this,t,!1)};Wo.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):Iat.call(e,t)};Wo.prototype.listenerCount=Iat;function Iat(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Wo.prototype.eventNames=function(){return this._eventsCount>0?r7(this._events):[]};function Aat(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function Mir(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function Iir(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function Air(e,t){return new Promise(function(r,n){function o(a){e.removeListener(t,i),n(a)}function i(){typeof e.removeListener=="function"&&e.removeListener("error",o),r([].slice.call(arguments))}Rat(e,t,i,{once:!0}),t!=="error"&&Rir(e,o,{once:!0})})}function Rir(e,t,r){typeof e.on=="function"&&Rat(e,"error",t,r)}function Rat(e,t,r,n){if(typeof e.on=="function")n.once?e.once(t,r):e.on(t,r);else if(typeof e.addEventListener=="function")e.addEventListener(t,function o(i){n.once&&e.removeEventListener(t,o),r(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}});var Gc=b((Sto,Aye)=>{"use strict";var Dir=Td(),{kResistStopPropagation:jir,SymbolDispose:Nir}=la(),Lir=globalThis.AbortSignal||VN().AbortSignal,Fir=globalThis.AbortController||VN().AbortController,kir=Object.getPrototypeOf(async function(){}).constructor,Dat=globalThis.Blob||Dir.Blob,Bir=typeof Dat<"u"?function(t){return t instanceof Dat}:function(t){return!1},jat=(e,t)=>{if(e!==void 0&&(e===null||typeof e!="object"||!("aborted"in e)))throw new ERR_INVALID_ARG_TYPE(t,"AbortSignal",e)},$ir=(e,t)=>{if(typeof e!="function")throw new ERR_INVALID_ARG_TYPE(t,"Function",e)},Iye=class extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);let r="";for(let n=0;n<t.length;n++)r+=` ${t[n].stack}
`;super(r),this.name="AggregateError",this.errors=t}};Aye.exports={AggregateError:Iye,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...r){t||(t=!0,e.apply(this,r))}},createDeferredPromise:function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}},promisify(e){return new Promise((t,r)=>{e((n,...o)=>n?r(n):t(...o))})},debuglog(){return function(){}},format(e,...t){return e.replace(/%([sdifj])/g,function(...[r,n]){let o=t.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(e){switch(typeof e){case"string":if(e.includes("'"))if(e.includes('"')){if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}else return`"${e}"`;return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return`${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return"{}"}},types:{isAsyncFunction(e){return e instanceof kir},isArrayBufferView(e){return ArrayBuffer.isView(e)}},isBlob:Bir,deprecate(e,t){return e},addAbortListener:Yz().addAbortListener||function(t,r){if(t===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",t);jat(t,"signal"),$ir(r,"listener");let n;return t.aborted?queueMicrotask(()=>r()):(t.addEventListener("abort",r,{__proto__:null,once:!0,[jir]:!0}),n=()=>{t.removeEventListener("abort",r)}),{__proto__:null,[Nir](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:Lir.any||function(t){if(t.length===1)return t[0];let r=new Fir,n=()=>r.abort();return t.forEach(o=>{jat(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{t.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};Aye.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Fd=b((xto,Fat)=>{"use strict";var{format:qir,inspect:o7,AggregateError:Uir}=Gc(),zir=globalThis.AggregateError||Uir,Hir=Symbol("kIsNodeError"),Vir=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Wir=/^([A-Z][a-z0-9]*)+$/,Jir="__node_internal_",i7={};function mA(e,t){if(!e)throw new i7.ERR_INTERNAL_ASSERTION(t)}function Nat(e){let t="",r=e.length,n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function Gir(e,t,r){if(typeof t=="function")return mA(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);let n=(t.match(/%[dfijoOs]/g)||[]).length;return mA(n===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?t:qir(t,...r)}function Zl(e,t,r){r||(r=Error);class n extends r{constructor(...i){super(Gir(e,t,i))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=e,n.prototype[Hir]=!0,i7[e]=n}function Lat(e){let t=Jir+e.name;return Object.defineProperty(e,"name",{value:t}),e}function Kir(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;let r=new zir([t,e],t.message);return r.code=t.code,r}return e||t}var Rye=class extends Error{constructor(t="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new i7.ERR_INVALID_ARG_TYPE("options","Object",r);super(t,r),this.code="ABORT_ERR",this.name="AbortError"}};Zl("ERR_ASSERTION","%s",Error);Zl("ERR_INVALID_ARG_TYPE",(e,t,r)=>{mA(typeof e=="string","'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";e.endsWith(" argument")?n+=`${e} `:n+=`"${e}" ${e.includes(".")?"property":"argument"} `,n+="must be ";let o=[],i=[],a=[];for(let u of t)mA(typeof u=="string","All expected entries have to be of type string"),Vir.includes(u)?o.push(u.toLowerCase()):Wir.test(u)?i.push(u):(mA(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=o7(r,{depth:-1});n+=`. Received ${u}`}}else{let u=o7(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);Zl("ERR_INVALID_ARG_VALUE",(e,t,r="is invalid")=>{let n=o7(t);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`},TypeError);Zl("ERR_INVALID_RETURN_VALUE",(e,t,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 ${e} to be returned from the "${t}" function but got ${o}.`},TypeError);Zl("ERR_MISSING_ARGS",(...e)=>{mA(e.length>0,"At least one arg needs to be specified");let t,r=e.length;switch(e=(Array.isArray(e)?e:[e]).map(n=>`"${n}"`).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{let n=e.pop();t+=`The ${e.join(", ")}, and ${n} arguments`}break}return`${t} must be specified`},TypeError);Zl("ERR_OUT_OF_RANGE",(e,t,r)=>{mA(t,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=Nat(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=Nat(n)),n+="n"):n=o7(r),`The value of "${e}" is out of range. It must be ${t}. Received ${n}`},RangeError);Zl("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Zl("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Zl("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Zl("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Zl("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Zl("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Zl("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Zl("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Zl("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Zl("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Zl("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Fat.exports={AbortError:Rye,aggregateTwoErrors:Lat(Kir),hideStackFrames:Lat,codes:i7}});var GN=b((Cto,Jat)=>{"use strict";var{ArrayIsArray:jye,ArrayPrototypeIncludes:qat,ArrayPrototypeJoin:Uat,ArrayPrototypeMap:Yir,NumberIsInteger:Nye,NumberIsNaN:Zir,NumberMAX_SAFE_INTEGER:Xir,NumberMIN_SAFE_INTEGER:Qir,NumberParseInt:ear,ObjectPrototypeHasOwnProperty:tar,RegExpPrototypeExec:zat,String:rar,StringPrototypeToUpperCase:nar,StringPrototypeTrim:oar}=la(),{hideStackFrames:Mh,codes:{ERR_SOCKET_BAD_PORT:iar,ERR_INVALID_ARG_TYPE:Kc,ERR_INVALID_ARG_VALUE:JN,ERR_OUT_OF_RANGE:gA,ERR_UNKNOWN_SIGNAL:kat}}=Fd(),{normalizeEncoding:aar}=Gc(),{isAsyncFunction:sar,isArrayBufferView:uar}=Gc().types,Bat={};function lar(e){return e===(e|0)}function car(e){return e===e>>>0}var dar=/^[0-7]+$/,far="must be a 32-bit unsigned integer or an octal string";function par(e,t,r){if(typeof e>"u"&&(e=r),typeof e=="string"){if(zat(dar,e)===null)throw new JN(t,e,far);e=ear(e,8)}return Hat(e,t),e}var har=Mh((e,t,r=Qir,n=Xir)=>{if(typeof e!="number")throw new Kc(t,"number",e);if(!Nye(e))throw new gA(t,"an integer",e);if(e<r||e>n)throw new gA(t,`>= ${r} && <= ${n}`,e)}),mar=Mh((e,t,r=-2147483648,n=2147483647)=>{if(typeof e!="number")throw new Kc(t,"number",e);if(!Nye(e))throw new gA(t,"an integer",e);if(e<r||e>n)throw new gA(t,`>= ${r} && <= ${n}`,e)}),Hat=Mh((e,t,r=!1)=>{if(typeof e!="number")throw new Kc(t,"number",e);if(!Nye(e))throw new gA(t,"an integer",e);let n=r?1:0,o=4294967295;if(e<n||e>o)throw new gA(t,`>= ${n} && <= ${o}`,e)});function Lye(e,t){if(typeof e!="string")throw new Kc(t,"string",e)}function gar(e,t,r=void 0,n){if(typeof e!="number")throw new Kc(t,"number",e);if(r!=null&&e<r||n!=null&&e>n||(r!=null||n!=null)&&Zir(e))throw new gA(t,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,e)}var yar=Mh((e,t,r)=>{if(!qat(r,e)){let o="must be one of: "+Uat(Yir(r,i=>typeof i=="string"?`'${i}'`:rar(i)),", ");throw new JN(t,e,o)}});function Vat(e,t){if(typeof e!="boolean")throw new Kc(t,"boolean",e)}function Dye(e,t,r){return e==null||!tar(e,t)?r:e[t]}var bar=Mh((e,t,r=null)=>{let n=Dye(r,"allowArray",!1),o=Dye(r,"allowFunction",!1);if(!Dye(r,"nullable",!1)&&e===null||!n&&jye(e)||typeof e!="object"&&(!o||typeof e!="function"))throw new Kc(t,"Object",e)}),_ar=Mh((e,t)=>{if(e!=null&&typeof e!="object"&&typeof e!="function")throw new Kc(t,"a dictionary",e)}),a7=Mh((e,t,r=0)=>{if(!jye(e))throw new Kc(t,"Array",e);if(e.length<r){let n=`must be longer than ${r}`;throw new JN(t,e,n)}});function war(e,t){a7(e,t);for(let r=0;r<e.length;r++)Lye(e[r],`${t}[${r}]`)}function Sar(e,t){a7(e,t);for(let r=0;r<e.length;r++)Vat(e[r],`${t}[${r}]`)}function xar(e,t){a7(e,t);for(let r=0;r<e.length;r++){let n=e[r],o=`${t}[${r}]`;if(n==null)throw new Kc(o,"AbortSignal",n);Wat(n,o)}}function Car(e,t="signal"){if(Lye(e,t),Bat[e]===void 0)throw Bat[nar(e)]!==void 0?new kat(e+" (signals must use all capital letters)"):new kat(e)}var Oar=Mh((e,t="buffer")=>{if(!uar(e))throw new Kc(t,["Buffer","TypedArray","DataView"],e)});function Ear(e,t){let r=aar(t),n=e.length;if(r==="hex"&&n%2!==0)throw new JN("encoding",t,`is invalid for data of length ${n}`)}function Par(e,t="Port",r=!0){if(typeof e!="number"&&typeof e!="string"||typeof e=="string"&&oar(e).length===0||+e!==+e>>>0||e>65535||e===0&&!r)throw new iar(t,e,r);return e|0}var Wat=Mh((e,t)=>{if(e!==void 0&&(e===null||typeof e!="object"||!("aborted"in e)))throw new Kc(t,"AbortSignal",e)}),Tar=Mh((e,t)=>{if(typeof e!="function")throw new Kc(t,"Function",e)}),Mar=Mh((e,t)=>{if(typeof e!="function"||sar(e))throw new Kc(t,"Function",e)}),Iar=Mh((e,t)=>{if(e!==void 0)throw new Kc(t,"undefined",e)});function Aar(e,t,r){if(!qat(r,e))throw new Kc(t,`('${Uat(r,"|")}')`,e)}var Rar=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function $at(e,t){if(typeof e>"u"||!zat(Rar,e))throw new JN(t,e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function Dar(e){if(typeof e=="string")return $at(e,"hints"),e;if(jye(e)){let t=e.length,r="";if(t===0)return r;for(let n=0;n<t;n++){let o=e[n];$at(o,"hints"),r+=o,n!==t-1&&(r+=", ")}return r}throw new JN("hints",e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Jat.exports={isInt32:lar,isUint32:car,parseFileMode:par,validateArray:a7,validateStringArray:war,validateBooleanArray:Sar,validateAbortSignalArray:xar,validateBoolean:Vat,validateBuffer:Oar,validateDictionary:_ar,validateEncoding:Ear,validateFunction:Tar,validateInt32:mar,validateInteger:har,validateNumber:gar,validateObject:bar,validateOneOf:yar,validatePlainFunction:Mar,validatePort:Par,validateSignalName:Car,validateString:Lye,validateUint32:Hat,validateUndefined:Iar,validateUnion:Aar,validateAbortSignal:Wat,validateLinkHeaderValue:Dar}});var VE=b((Oto,Zat)=>{var Ka=Zat.exports={},Ky,Yy;function Fye(){throw new Error("setTimeout has not been defined")}function kye(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Ky=setTimeout:Ky=Fye}catch{Ky=Fye}try{typeof clearTimeout=="function"?Yy=clearTimeout:Yy=kye}catch{Yy=kye}})();function Gat(e){if(Ky===setTimeout)return setTimeout(e,0);if((Ky===Fye||!Ky)&&setTimeout)return Ky=setTimeout,setTimeout(e,0);try{return Ky(e,0)}catch{try{return Ky.call(null,e,0)}catch{return Ky.call(this,e,0)}}}function jar(e){if(Yy===clearTimeout)return clearTimeout(e);if((Yy===kye||!Yy)&&clearTimeout)return Yy=clearTimeout,clearTimeout(e);try{return Yy(e)}catch{try{return Yy.call(null,e)}catch{return Yy.call(this,e)}}}var gx=[],KN=!1,yA,s7=-1;function Nar(){!KN||!yA||(KN=!1,yA.length?gx=yA.concat(gx):s7=-1,gx.length&&Kat())}function Kat(){if(!KN){var e=Gat(Nar);KN=!0;for(var t=gx.length;t;){for(yA=gx,gx=[];++s7<t;)yA&&yA[s7].run();s7=-1,t=gx.length}yA=null,KN=!1,jar(e)}}Ka.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];gx.push(new Yat(e,t)),gx.length===1&&!KN&&Gat(Kat)};function Yat(e,t){this.fun=e,this.array=t}Yat.prototype.run=function(){this.fun.apply(null,this.array)};Ka.title="browser";Ka.browser=!0;Ka.env={};Ka.argv=[];Ka.version="";Ka.versions={};function yx(){}Ka.on=yx;Ka.addListener=yx;Ka.once=yx;Ka.off=yx;Ka.removeListener=yx;Ka.removeAllListeners=yx;Ka.emit=yx;Ka.prependListener=yx;Ka.prependOnceListener=yx;Ka.listeners=function(e){return[]};Ka.binding=function(e){throw new Error("process.binding is not supported")};Ka.cwd=function(){return"/"};Ka.chdir=function(e){throw new Error("process.chdir is not supported")};Ka.umask=function(){return 0}});var Xy=b((Eto,fst)=>{"use strict";var{SymbolAsyncIterator:Xat,SymbolIterator:Qat,SymbolFor:bA}=la(),est=bA("nodejs.stream.destroyed"),tst=bA("nodejs.stream.errored"),Bye=bA("nodejs.stream.readable"),$ye=bA("nodejs.stream.writable"),rst=bA("nodejs.stream.disturbed"),Lar=bA("nodejs.webstream.isClosedPromise"),Far=bA("nodejs.webstream.controllerErrorFunction");function u7(e,t=!1){var r;return!!(e&&typeof e.pipe=="function"&&typeof e.on=="function"&&(!t||typeof e.pause=="function"&&typeof e.resume=="function")&&(!e._writableState||((r=e._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!e._writableState||e._readableState))}function l7(e){var t;return!!(e&&typeof e.write=="function"&&typeof e.on=="function"&&(!e._readableState||((t=e._writableState)===null||t===void 0?void 0:t.writable)!==!1))}function kar(e){return!!(e&&typeof e.pipe=="function"&&e._readableState&&typeof e.on=="function"&&typeof e.write=="function")}function Zy(e){return e&&(e._readableState||e._writableState||typeof e.write=="function"&&typeof e.on=="function"||typeof e.pipe=="function"&&typeof e.on=="function")}function nst(e){return!!(e&&!Zy(e)&&typeof e.pipeThrough=="function"&&typeof e.getReader=="function"&&typeof e.cancel=="function")}function ost(e){return!!(e&&!Zy(e)&&typeof e.getWriter=="function"&&typeof e.abort=="function")}function ist(e){return!!(e&&!Zy(e)&&typeof e.readable=="object"&&typeof e.writable=="object")}function Bar(e){return nst(e)||ost(e)||ist(e)}function $ar(e,t){return e==null?!1:t===!0?typeof e[Xat]=="function":t===!1?typeof e[Qat]=="function":typeof e[Xat]=="function"||typeof e[Qat]=="function"}function c7(e){if(!Zy(e))return null;let t=e._writableState,r=e._readableState,n=t||r;return!!(e.destroyed||e[est]||n!=null&&n.destroyed)}function ast(e){if(!l7(e))return null;if(e.writableEnded===!0)return!0;let t=e._writableState;return t!=null&&t.errored?!1:typeof t?.ended!="boolean"?null:t.ended}function qar(e,t){if(!l7(e))return null;if(e.writableFinished===!0)return!0;let r=e._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||t===!1&&r.ended===!0&&r.length===0)}function Uar(e){if(!u7(e))return null;if(e.readableEnded===!0)return!0;let t=e._readableState;return!t||t.errored?!1:typeof t?.ended!="boolean"?null:t.ended}function sst(e,t){if(!u7(e))return null;let r=e._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||t===!1&&r.ended===!0&&r.length===0)}function ust(e){return e&&e[Bye]!=null?e[Bye]:typeof e?.readable!="boolean"?null:c7(e)?!1:u7(e)&&e.readable&&!sst(e)}function lst(e){return e&&e[$ye]!=null?e[$ye]:typeof e?.writable!="boolean"?null:c7(e)?!1:l7(e)&&e.writable&&!ast(e)}function zar(e,t){return Zy(e)?c7(e)?!0:!(t?.readable!==!1&&ust(e)||t?.writable!==!1&&lst(e)):null}function Har(e){var t,r;return Zy(e)?e.writableErrored?e.writableErrored:(t=(r=e._writableState)===null||r===void 0?void 0:r.errored)!==null&&t!==void 0?t:null:null}function Var(e){var t,r;return Zy(e)?e.readableErrored?e.readableErrored:(t=(r=e._readableState)===null||r===void 0?void 0:r.errored)!==null&&t!==void 0?t:null:null}function War(e){if(!Zy(e))return null;if(typeof e.closed=="boolean")return e.closed;let t=e._writableState,r=e._readableState;return typeof t?.closed=="boolean"||typeof r?.closed=="boolean"?t?.closed||r?.closed:typeof e._closed=="boolean"&&cst(e)?e._closed:null}function cst(e){return typeof e._closed=="boolean"&&typeof e._defaultKeepAlive=="boolean"&&typeof e._removedConnection=="boolean"&&typeof e._removedContLen=="boolean"}function dst(e){return typeof e._sent100=="boolean"&&cst(e)}function Jar(e){var t;return typeof e._consuming=="boolean"&&typeof e._dumped=="boolean"&&((t=e.req)===null||t===void 0?void 0:t.upgradeOrConnect)===void 0}function Gar(e){if(!Zy(e))return null;let t=e._writableState,r=e._readableState,n=t||r;return!n&&dst(e)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function Kar(e){var t;return!!(e&&((t=e[rst])!==null&&t!==void 0?t:e.readableDidRead||e.readableAborted))}function Yar(e){var t,r,n,o,i,a,s,u,l,c;return!!(e&&((t=(r=(n=(o=(i=(a=e[tst])!==null&&a!==void 0?a:e.readableErrored)!==null&&i!==void 0?i:e.writableErrored)!==null&&o!==void 0?o:(s=e._readableState)===null||s===void 0?void 0:s.errorEmitted)!==null&&n!==void 0?n:(u=e._writableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&r!==void 0?r:(l=e._readableState)===null||l===void 0?void 0:l.errored)!==null&&t!==void 0?t:!((c=e._writableState)===null||c===void 0)&&c.errored))}fst.exports={isDestroyed:c7,kIsDestroyed:est,isDisturbed:Kar,kIsDisturbed:rst,isErrored:Yar,kIsErrored:tst,isReadable:ust,kIsReadable:Bye,kIsClosedPromise:Lar,kControllerErrorFunction:Far,kIsWritable:$ye,isClosed:War,isDuplexNodeStream:kar,isFinished:zar,isIterable:$ar,isReadableNodeStream:u7,isReadableStream:nst,isReadableEnded:Uar,isReadableFinished:sst,isReadableErrored:Var,isNodeStream:Zy,isWebStream:Bar,isWritable:lst,isWritableNodeStream:l7,isWritableStream:ost,isWritableEnded:ast,isWritableFinished:qar,isWritableErrored:Har,isServerRequest:Jar,isServerResponse:dst,willEmitClose:Gar,isTransformStream:ist}});var bx=b((Pto,Vye)=>{var WE=VE(),{AbortError:wst,codes:Zar}=Fd(),{ERR_INVALID_ARG_TYPE:Xar,ERR_STREAM_PREMATURE_CLOSE:pst}=Zar,{kEmptyObject:Uye,once:zye}=Gc(),{validateAbortSignal:Qar,validateFunction:esr,validateObject:tsr,validateBoolean:rsr}=GN(),{Promise:nsr,PromisePrototypeThen:osr,SymbolDispose:Sst}=la(),{isClosed:isr,isReadable:hst,isReadableNodeStream:qye,isReadableStream:asr,isReadableFinished:mst,isReadableErrored:gst,isWritable:yst,isWritableNodeStream:bst,isWritableStream:ssr,isWritableFinished:_st,isWritableErrored:vst,isNodeStream:usr,willEmitClose:lsr,kIsClosedPromise:csr}=Xy(),YN;function dsr(e){return e.setHeader&&typeof e.abort=="function"}var Hye=()=>{};function xst(e,t,r){var n,o;if(arguments.length===2?(r=t,t=Uye):t==null?t=Uye:tsr(t,"options"),esr(r,"callback"),Qar(t.signal,"options.signal"),r=zye(r),asr(e)||ssr(e))return fsr(e,t,r);if(!usr(e))throw new Xar("stream",["ReadableStream","WritableStream","Stream"],e);let i=(n=t.readable)!==null&&n!==void 0?n:qye(e),a=(o=t.writable)!==null&&o!==void 0?o:bst(e),s=e._writableState,u=e._readableState,l=()=>{e.writable||f()},c=lsr(e)&&qye(e)===i&&bst(e)===a,d=_st(e,!1),f=()=>{d=!0,e.destroyed&&(c=!1),!(c&&(!e.readable||i))&&(!i||p)&&r.call(e)},p=mst(e,!1),h=()=>{p=!0,e.destroyed&&(c=!1),!(c&&(!e.writable||a))&&(!a||d)&&r.call(e)},m=O=>{r.call(e,O)},_=isr(e),g=()=>{_=!0;let O=vst(e)||gst(e);if(O&&typeof O!="boolean")return r.call(e,O);if(i&&!p&&qye(e,!0)&&!mst(e,!1))return r.call(e,new pst);if(a&&!d&&!_st(e,!1))return r.call(e,new pst);r.call(e)},v=()=>{_=!0;let O=vst(e)||gst(e);if(O&&typeof O!="boolean")return r.call(e,O);r.call(e)},S=()=>{e.req.on("finish",f)};dsr(e)?(e.on("complete",f),c||e.on("abort",g),e.req?S():e.on("request",S)):a&&!s&&(e.on("end",l),e.on("close",l)),!c&&typeof e.aborted=="boolean"&&e.on("aborted",g),e.on("end",h),e.on("finish",f),t.error!==!1&&e.on("error",m),e.on("close",g),_?WE.nextTick(g):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||WE.nextTick(v):(!i&&(!c||hst(e))&&(d||yst(e)===!1)||!a&&(!c||yst(e))&&(p||hst(e)===!1)||u&&e.req&&e.aborted)&&WE.nextTick(v);let x=()=>{r=Hye,e.removeListener("aborted",g),e.removeListener("complete",f),e.removeListener("abort",g),e.removeListener("request",S),e.req&&e.req.removeListener("finish",f),e.removeListener("end",l),e.removeListener("close",l),e.removeListener("finish",f),e.removeListener("end",h),e.removeListener("error",m),e.removeListener("close",g)};if(t.signal&&!_){let O=()=>{let T=r;x(),T.call(e,new wst(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)WE.nextTick(O);else{YN=YN||Gc().addAbortListener;let T=YN(t.signal,O),E=r;r=zye((...M)=>{T[Sst](),E.apply(e,M)})}}return x}function fsr(e,t,r){let n=!1,o=Hye;if(t.signal)if(o=()=>{n=!0,r.call(e,new wst(void 0,{cause:t.signal.reason}))},t.signal.aborted)WE.nextTick(o);else{YN=YN||Gc().addAbortListener;let a=YN(t.signal,o),s=r;r=zye((...u)=>{a[Sst](),s.apply(e,u)})}let i=(...a)=>{n||WE.nextTick(()=>r.apply(e,a))};return osr(e[csr].promise,i,i),Hye}function psr(e,t){var r;let n=!1;return t===null&&(t=Uye),(r=t)!==null&&r!==void 0&&r.cleanup&&(rsr(t.cleanup,"cleanup"),n=t.cleanup),new nsr((o,i)=>{let a=xst(e,t,s=>{n&&a(),s?i(s):o()})})}Vye.exports=xst;Vye.exports.finished=psr});var _A=b((Tto,Ast)=>{"use strict";var Qy=VE(),{aggregateTwoErrors:hsr,codes:{ERR_MULTIPLE_CALLBACK:msr},AbortError:gsr}=Fd(),{Symbol:Est}=la(),{kIsDestroyed:ysr,isDestroyed:bsr,isFinished:_sr,isServerRequest:vsr}=Xy(),Pst=Est("kDestroy"),Wye=Est("kConstruct");function Tst(e,t,r){e&&(e.stack,t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e))}function wsr(e,t){let r=this._readableState,n=this._writableState,o=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof t=="function"&&t(),this):(Tst(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?Cst(this,e,t):this.once(Pst,function(i){Cst(this,hsr(i,e),t)}),this)}function Cst(e,t,r){let n=!1;function o(i){if(n)return;n=!0;let a=e._readableState,s=e._writableState;Tst(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?Qy.nextTick(Ssr,e,i):Qy.nextTick(Mst,e)}try{e._destroy(t||null,o)}catch(i){o(i)}}function Ssr(e,t){Jye(e,t),Mst(e)}function Mst(e){let t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(r!=null&&r.emitClose||t!=null&&t.emitClose)&&e.emit("close")}function Jye(e,t){let r=e._readableState,n=e._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t))}function xsr(){let e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=e.readable===!1,e.endEmitted=e.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function Gye(e,t,r){let n=e._readableState,o=e._writableState;if(o!=null&&o.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||o!=null&&o.autoDestroy?e.destroy(t):t&&(t.stack,o&&!o.errored&&(o.errored=t),n&&!n.errored&&(n.errored=t),r?Qy.nextTick(Jye,e,t):Jye(e,t))}function Csr(e,t){if(typeof e._construct!="function")return;let r=e._readableState,n=e._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),e.once(Wye,t),!(e.listenerCount(Wye)>1)&&Qy.nextTick(Osr,e)}function Osr(e){let t=!1;function r(n){if(t){Gye(e,n??new msr);return}t=!0;let o=e._readableState,i=e._writableState,a=i||o;o&&(o.constructed=!0),i&&(i.constructed=!0),a.destroyed?e.emit(Pst,n):n?Gye(e,n,!0):Qy.nextTick(Esr,e)}try{e._construct(n=>{Qy.nextTick(r,n)})}catch(n){Qy.nextTick(r,n)}}function Esr(e){e.emit(Wye)}function Ost(e){return e?.setHeader&&typeof e.abort=="function"}function Ist(e){e.emit("close")}function Psr(e,t){e.emit("error",t),Qy.nextTick(Ist,e)}function Tsr(e,t){!e||bsr(e)||(!t&&!_sr(e)&&(t=new gsr),vsr(e)?(e.socket=null,e.destroy(t)):Ost(e)?e.abort():Ost(e.req)?e.req.abort():typeof e.destroy=="function"?e.destroy(t):typeof e.close=="function"?e.close():t?Qy.nextTick(Psr,e,t):Qy.nextTick(Ist,e),e.destroyed||(e[ysr]=!0))}Ast.exports={construct:Csr,destroyer:Tsr,destroy:wsr,undestroy:xsr,errorOrDestroy:Gye}});var p7=b((Mto,Dst)=>{"use strict";var{ArrayIsArray:Msr,ObjectSetPrototypeOf:Rst}=la(),{EventEmitter:d7}=Yz();function f7(e){d7.call(this,e)}Rst(f7.prototype,d7.prototype);Rst(f7,d7);f7.prototype.pipe=function(e,t){let r=this;function n(c){e.writable&&e.write(c)===!1&&r.pause&&r.pause()}r.on("data",n);function o(){r.readable&&r.resume&&r.resume()}e.on("drain",o),!e._isStdio&&(!t||t.end!==!1)&&(r.on("end",a),r.on("close",s));let i=!1;function a(){i||(i=!0,e.end())}function s(){i||(i=!0,typeof e.destroy=="function"&&e.destroy())}function u(c){l(),d7.listenerCount(this,"error")===0&&this.emit("error",c)}Kye(r,"error",u),Kye(e,"error",u);function l(){r.removeListener("data",n),e.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",s),r.removeListener("error",u),e.removeListener("error",u),r.removeListener("end",l),r.removeListener("close",l),e.removeListener("close",l)}return r.on("end",l),r.on("close",l),e.on("close",l),e.emit("pipe",r),e};function Kye(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):Msr(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}Dst.exports={Stream:f7,prependListener:Kye}});var Zz=b((Ito,h7)=>{"use strict";var{SymbolDispose:Isr}=la(),{AbortError:jst,codes:Asr}=Fd(),{isNodeStream:Nst,isWebStream:Rsr,kControllerErrorFunction:Dsr}=Xy(),jsr=bx(),{ERR_INVALID_ARG_TYPE:Lst}=Asr,Yye,Nsr=(e,t)=>{if(typeof e!="object"||!("aborted"in e))throw new Lst(t,"AbortSignal",e)};h7.exports.addAbortSignal=function(t,r){if(Nsr(t,"signal"),!Nst(r)&&!Rsr(r))throw new Lst("stream",["ReadableStream","WritableStream","Stream"],r);return h7.exports.addAbortSignalNoValidate(t,r)};h7.exports.addAbortSignalNoValidate=function(e,t){if(typeof e!="object"||!("aborted"in e))return t;let r=Nst(t)?()=>{t.destroy(new jst(void 0,{cause:e.reason}))}:()=>{t[Dsr](new jst(void 0,{cause:e.reason}))};if(e.aborted)r();else{Yye=Yye||Gc().addAbortListener;let n=Yye(e,r);jsr(t,n[Isr])}return t}});var Bst=b((Rto,kst)=>{"use strict";var{StringPrototypeSlice:Fst,SymbolIterator:Lsr,TypedArrayPrototypeSet:m7,Uint8Array:Fsr}=la(),{Buffer:Zye}=Td(),{inspect:ksr}=Gc();kst.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(t){let r={data:t,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(t){let r={data:t,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let t=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,t}clear(){this.head=this.tail=null,this.length=0}join(t){if(this.length===0)return"";let r=this.head,n=""+r.data;for(;(r=r.next)!==null;)n+=t+r.data;return n}concat(t){if(this.length===0)return Zye.alloc(0);let r=Zye.allocUnsafe(t>>>0),n=this.head,o=0;for(;n;)m7(r,n.data,o),o+=n.data.length,n=n.next;return r}consume(t,r){let n=this.head.data;if(t<n.length){let o=n.slice(0,t);return this.head.data=n.slice(t),o}return t===n.length?this.shift():r?this._getString(t):this._getBuffer(t)}first(){return this.head.data}*[Lsr](){for(let t=this.head;t;t=t.next)yield t.data}_getString(t){let r="",n=this.head,o=0;do{let i=n.data;if(t>i.length)r+=i,t-=i.length;else{t===i.length?(r+=i,++o,n.next?this.head=n.next:this.head=this.tail=null):(r+=Fst(i,0,t),this.head=n,n.data=Fst(i,t));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(t){let r=Zye.allocUnsafe(t),n=t,o=this.head,i=0;do{let a=o.data;if(t>a.length)m7(r,a,n-t),t-=a.length;else{t===a.length?(m7(r,a,n-t),++i,o.next?this.head=o.next:this.head=this.tail=null):(m7(r,new Fsr(a.buffer,a.byteOffset,t),n-t),this.head=o,o.data=a.slice(t));break}++i}while((o=o.next)!==null);return this.length-=i,r}[Symbol.for("nodejs.util.inspect.custom")](t,r){return ksr(this,{...r,depth:0,customInspect:!1})}}});var Xz=b((Dto,zst)=>{"use strict";var{MathFloor:Bsr,NumberIsInteger:$sr}=la(),{validateInteger:qsr}=GN(),{ERR_INVALID_ARG_VALUE:Usr}=Fd().codes,$st=16*1024,qst=16;function zsr(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function Ust(e){return e?qst:$st}function Hsr(e,t){qsr(t,"value",0),e?qst=t:$st=t}function Vsr(e,t,r,n){let o=zsr(t,n,r);if(o!=null){if(!$sr(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new Usr(i,o)}return Bsr(o)}return Ust(e.objectMode)}zst.exports={getHighWaterMark:Vsr,getDefaultHighWaterMark:Ust,setDefaultHighWaterMark:Hsr}});var Wst=b((Xye,Vst)=>{var g7=Td(),eb=g7.Buffer;function Hst(e,t){for(var r in e)t[r]=e[r]}eb.from&&eb.alloc&&eb.allocUnsafe&&eb.allocUnsafeSlow?Vst.exports=g7:(Hst(g7,Xye),Xye.Buffer=vA);function vA(e,t,r){return eb(e,t,r)}vA.prototype=Object.create(eb.prototype);Hst(eb,vA);vA.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return eb(e,t,r)};vA.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=eb(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};vA.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return eb(e)};vA.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return g7.SlowBuffer(e)}});var Kst=b(Gst=>{"use strict";var ebe=Wst().Buffer,Jst=ebe.isEncoding||function(e){switch(e=""+e,e&&e.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 Wsr(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function Jsr(e){var t=Wsr(e);if(typeof t!="string"&&(ebe.isEncoding===Jst||!Jst(e)))throw new Error("Unknown encoding: "+e);return t||e}Gst.StringDecoder=Qz;function Qz(e){this.encoding=Jsr(e);var t;switch(this.encoding){case"utf16le":this.text=Qsr,this.end=eur,t=4;break;case"utf8":this.fillLast=Ysr,t=4;break;case"base64":this.text=tur,this.end=rur,t=3;break;default:this.write=nur,this.end=our;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=ebe.allocUnsafe(t)}Qz.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};Qz.prototype.end=Xsr;Qz.prototype.text=Zsr;Qz.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function Qye(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function Gsr(e,t,r){var n=t.length-1;if(n<r)return 0;var o=Qye(t[n]);return o>=0?(o>0&&(e.lastNeed=o-1),o):--n<r||o===-2?0:(o=Qye(t[n]),o>=0?(o>0&&(e.lastNeed=o-2),o):--n<r||o===-2?0:(o=Qye(t[n]),o>=0?(o>0&&(o===2?o=0:e.lastNeed=o-3),o):0))}function Ksr(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function Ysr(e){var t=this.lastTotal-this.lastNeed,r=Ksr(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function Zsr(e,t){var r=Gsr(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function Xsr(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function Qsr(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function eur(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function tur(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function rur(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function nur(e){return e.toString(this.encoding)}function our(e){return e&&e.length?this.write(e):""}});var tbe=b((Nto,Qst)=>{"use strict";var Yst=VE(),{PromisePrototypeThen:iur,SymbolAsyncIterator:Zst,SymbolIterator:Xst}=la(),{Buffer:aur}=Td(),{ERR_INVALID_ARG_TYPE:sur,ERR_STREAM_NULL_VALUES:uur}=Fd().codes;function lur(e,t,r){let n;if(typeof t=="string"||t instanceof aur)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null)}});let o;if(t&&t[Zst])o=!0,n=t[Zst]();else if(t&&t[Xst])o=!1,n=t[Xst]();else throw new sur("iterable",["Iterable"],t);let i=new e({objectMode:!0,highWaterMark:1,...r}),a=!1;i._read=function(){a||(a=!0,u())},i._destroy=function(l,c){iur(s(l),()=>Yst.nextTick(c,l),d=>Yst.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 uur;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}Qst.exports=lur});var t2=b((Lto,yut)=>{var ag=VE(),{ArrayPrototypeIndexOf:cur,NumberIsInteger:dur,NumberIsNaN:fur,NumberParseInt:pur,ObjectDefineProperties:lbe,ObjectKeys:hur,ObjectSetPrototypeOf:rut,Promise:nut,SafeSet:mur,SymbolAsyncDispose:gur,SymbolAsyncIterator:yur,Symbol:bur}=la();yut.exports=Fr;Fr.ReadableState=v7;var{EventEmitter:_ur}=Yz(),{Stream:JE,prependListener:vur}=p7(),{Buffer:rbe}=Td(),{addAbortSignal:wur}=Zz(),out=bx(),sn=Gc().debuglog("stream",e=>{sn=e}),Sur=Bst(),QN=_A(),{getHighWaterMark:xur,getDefaultHighWaterMark:Cur}=Xz(),{aggregateTwoErrors:eut,codes:{ERR_INVALID_ARG_TYPE:Our,ERR_METHOD_NOT_IMPLEMENTED:Eur,ERR_OUT_OF_RANGE:Pur,ERR_STREAM_PUSH_AFTER_EOF:Tur,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Mur},AbortError:Iur}=Fd(),{validateObject:Aur}=GN(),wA=bur("kPaused"),{StringDecoder:iut}=Kst(),Rur=tbe();rut(Fr.prototype,JE.prototype);rut(Fr,JE);var nbe=()=>{},{errorOrDestroy:ZN}=QN,XN=1,Dur=2,aut=4,e2=8,sut=16,y7=32,b7=64,uut=128,jur=256,Nur=512,Lur=1024,sbe=2048,ube=4096,Fur=8192,kur=16384,Bur=32768,lut=65536,$ur=1<<17,qur=1<<18;function Hu(e){return{enumerable:!1,get(){return(this.state&e)!==0},set(t){t?this.state|=e:this.state&=~e}}}lbe(v7.prototype,{objectMode:Hu(XN),ended:Hu(Dur),endEmitted:Hu(aut),reading:Hu(e2),constructed:Hu(sut),sync:Hu(y7),needReadable:Hu(b7),emittedReadable:Hu(uut),readableListening:Hu(jur),resumeScheduled:Hu(Nur),errorEmitted:Hu(Lur),emitClose:Hu(sbe),autoDestroy:Hu(ube),destroyed:Hu(Fur),closed:Hu(kur),closeEmitted:Hu(Bur),multiAwaitDrain:Hu(lut),readingMore:Hu($ur),dataEmitted:Hu(qur)});function v7(e,t,r){typeof r!="boolean"&&(r=t instanceof tb()),this.state=sbe|ube|sut|y7,e&&e.objectMode&&(this.state|=XN),r&&e&&e.readableObjectMode&&(this.state|=XN),this.highWaterMark=e?xur(this,e,"readableHighWaterMark",r):Cur(!1),this.buffer=new Sur,this.length=0,this.pipes=[],this.flowing=null,this[wA]=null,e&&e.emitClose===!1&&(this.state&=~sbe),e&&e.autoDestroy===!1&&(this.state&=~ube),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new iut(e.encoding),this.encoding=e.encoding)}function Fr(e){if(!(this instanceof Fr))return new Fr(e);let t=this instanceof tb();this._readableState=new v7(e,this,t),e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.construct=="function"&&(this._construct=e.construct),e.signal&&!t&&wur(e.signal,this)),JE.call(this,e),QN.construct(this,()=>{this._readableState.needReadable&&_7(this,this._readableState)})}Fr.prototype.destroy=QN.destroy;Fr.prototype._undestroy=QN.undestroy;Fr.prototype._destroy=function(e,t){t(e)};Fr.prototype[_ur.captureRejectionSymbol]=function(e){this.destroy(e)};Fr.prototype[gur]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new Iur,this.destroy(e)),new nut((t,r)=>out(this,n=>n&&n!==e?r(n):t(null)))};Fr.prototype.push=function(e,t){return cut(this,e,t,!1)};Fr.prototype.unshift=function(e,t){return cut(this,e,t,!0)};function cut(e,t,r,n){sn("readableAddChunk",t);let o=e._readableState,i;if((o.state&XN)===0&&(typeof t=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?t=rbe.from(t,r).toString(o.encoding):(t=rbe.from(t,r),r=""))):t instanceof rbe?r="":JE._isUint8Array(t)?(t=JE._uint8ArrayToBuffer(t),r=""):t!=null&&(i=new Our("chunk",["string","Buffer","Uint8Array"],t))),i)ZN(e,i);else if(t===null)o.state&=~e2,Hur(e,o);else if((o.state&XN)!==0||t&&t.length>0)if(n)if((o.state&aut)!==0)ZN(e,new Mur);else{if(o.destroyed||o.errored)return!1;obe(e,o,t,!0)}else if(o.ended)ZN(e,new Tur);else{if(o.destroyed||o.errored)return!1;o.state&=~e2,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||t.length!==0?obe(e,o,t,!1):_7(e,o)):obe(e,o,t,!1)}else n||(o.state&=~e2,_7(e,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function obe(e,t,r,n){t.flowing&&t.length===0&&!t.sync&&e.listenerCount("data")>0?((t.state&lut)!==0?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),(t.state&b7)!==0&&w7(e)),_7(e,t)}Fr.prototype.isPaused=function(){let e=this._readableState;return e[wA]===!0||e.flowing===!1};Fr.prototype.setEncoding=function(e){let t=new iut(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let o of r)n+=t.write(o);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var Uur=1073741824;function zur(e){if(e>Uur)throw new Pur("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++,e}function tut(e,t){return e<=0||t.length===0&&t.ended?0:(t.state&XN)!==0?1:fur(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}Fr.prototype.read=function(e){sn("read",e),e===void 0?e=NaN:dur(e)||(e=pur(e,10));let t=this._readableState,r=e;if(e>t.highWaterMark&&(t.highWaterMark=zur(e)),e!==0&&(t.state&=~uut),e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended))return sn("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?ibe(this):w7(this),null;if(e=tut(e,t),e===0&&t.ended)return t.length===0&&ibe(this),null;let n=(t.state&b7)!==0;if(sn("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,sn("length less than watermark",n)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)n=!1,sn("reading, ended or constructing",n);else if(n){sn("do read"),t.state|=e2|y7,t.length===0&&(t.state|=b7);try{this._read(t.highWaterMark)}catch(i){ZN(this,i)}t.state&=~y7,t.reading||(e=tut(r,t))}let o;return e>0?o=mut(e,t):o=null,o===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&ibe(this)),o!==null&&!t.errorEmitted&&!t.closeEmitted&&(t.dataEmitted=!0,this.emit("data",o)),o};function Hur(e,t){if(sn("onEofChunk"),!t.ended){if(t.decoder){let r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?w7(e):(t.needReadable=!1,t.emittedReadable=!0,dut(e))}}function w7(e){let t=e._readableState;sn("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(sn("emitReadable",t.flowing),t.emittedReadable=!0,ag.nextTick(dut,e))}function dut(e){let t=e._readableState;sn("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&!t.errored&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,put(e)}function _7(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,ag.nextTick(Vur,e,t))}function Vur(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){let r=t.length;if(sn("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}Fr.prototype._read=function(e){throw new Eur("_read()")};Fr.prototype.pipe=function(e,t){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new mur(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(e),sn("pipe count=%d opts=%j",n.pipes.length,t);let i=(!t||t.end!==!1)&&e!==ag.stdout&&e!==ag.stderr?s:_;n.endEmitted?ag.nextTick(i):r.once("end",i),e.on("unpipe",a);function a(g,v){sn("onunpipe"),g===r&&v&&v.hasUnpiped===!1&&(v.hasUnpiped=!0,c())}function s(){sn("onend"),e.end()}let u,l=!1;function c(){sn("cleanup"),e.removeListener("close",h),e.removeListener("finish",m),u&&e.removeListener("drain",u),e.removeListener("error",p),e.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",_),r.removeListener("data",f),l=!0,u&&n.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&u()}function d(){l||(n.pipes.length===1&&n.pipes[0]===e?(sn("false write response, pause",0),n.awaitDrainWriters=e,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(e)&&(sn("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(e)),r.pause()),u||(u=Wur(r,e),e.on("drain",u))}r.on("data",f);function f(g){sn("ondata");let v=e.write(g);sn("dest.write",v),v===!1&&d()}function p(g){if(sn("onerror",g),_(),e.removeListener("error",p),e.listenerCount("error")===0){let v=e._writableState||e._readableState;v&&!v.errorEmitted?ZN(e,g):e.emit("error",g)}}vur(e,"error",p);function h(){e.removeListener("finish",m),_()}e.once("close",h);function m(){sn("onfinish"),e.removeListener("close",h),_()}e.once("finish",m);function _(){sn("unpipe"),r.unpipe(e)}return e.emit("pipe",r),e.writableNeedDrain===!0?d():n.flowing||(sn("pipe resume"),r.resume()),e};function Wur(e,t){return function(){let n=e._readableState;n.awaitDrainWriters===t?(sn("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(sn("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(t)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&e.listenerCount("data")&&e.resume()}}Fr.prototype.unpipe=function(e){let t=this._readableState,r={hasUnpiped:!1};if(t.pipes.length===0)return this;if(!e){let o=t.pipes;t.pipes=[],this.pause();for(let i=0;i<o.length;i++)o[i].emit("unpipe",this,{hasUnpiped:!1});return this}let n=cur(t.pipes,e);return n===-1?this:(t.pipes.splice(n,1),t.pipes.length===0&&this.pause(),e.emit("unpipe",this,r),this)};Fr.prototype.on=function(e,t){let r=JE.prototype.on.call(this,e,t),n=this._readableState;return e==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):e==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,sn("on readable",n.length,n.reading),n.length?w7(this):n.reading||ag.nextTick(Jur,this)),r};Fr.prototype.addListener=Fr.prototype.on;Fr.prototype.removeListener=function(e,t){let r=JE.prototype.removeListener.call(this,e,t);return e==="readable"&&ag.nextTick(fut,this),r};Fr.prototype.off=Fr.prototype.removeListener;Fr.prototype.removeAllListeners=function(e){let t=JE.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&ag.nextTick(fut,this),t};function fut(e){let t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&t[wA]===!1?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function Jur(e){sn("readable nexttick read 0"),e.read(0)}Fr.prototype.resume=function(){let e=this._readableState;return e.flowing||(sn("resume"),e.flowing=!e.readableListening,Gur(this,e)),e[wA]=!1,this};function Gur(e,t){t.resumeScheduled||(t.resumeScheduled=!0,ag.nextTick(Kur,e,t))}function Kur(e,t){sn("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),put(e),t.flowing&&!t.reading&&e.read(0)}Fr.prototype.pause=function(){return sn("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(sn("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[wA]=!0,this};function put(e){let t=e._readableState;for(sn("flow",t.flowing);t.flowing&&e.read()!==null;);}Fr.prototype.wrap=function(e){let t=!1;e.on("data",n=>{!this.push(n)&&e.pause&&(t=!0,e.pause())}),e.on("end",()=>{this.push(null)}),e.on("error",n=>{ZN(this,n)}),e.on("close",()=>{this.destroy()}),e.on("destroy",()=>{this.destroy()}),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};let r=hur(e);for(let n=1;n<r.length;n++){let o=r[n];this[o]===void 0&&typeof e[o]=="function"&&(this[o]=e[o].bind(e))}return this};Fr.prototype[yur]=function(){return hut(this)};Fr.prototype.iterator=function(e){return e!==void 0&&Aur(e,"options"),hut(this,e)};function hut(e,t){typeof e.read!="function"&&(e=Fr.wrap(e,{objectMode:!0}));let r=Yur(e,t);return r.stream=e,r}async function*Yur(e,t){let r=nbe;function n(a){this===e?(r(),r=nbe):r=a}e.on("readable",n);let o,i=out(e,{writable:!1},a=>{o=a?eut(o,a):null,r(),r=nbe});try{for(;;){let a=e.destroyed?null:e.read();if(a!==null)yield a;else{if(o)throw o;if(o===null)return;await new nut(n)}}}catch(a){throw o=eut(o,a),o}finally{(o||t?.destroyOnReturn!==!1)&&(o===void 0||e._readableState.autoDestroy)?QN.destroyer(e,null):(e.off("readable",n),i())}}lbe(Fr.prototype,{readable:{__proto__:null,get(){let e=this._readableState;return!!e&&e.readable!==!1&&!e.destroyed&&!e.errorEmitted&&!e.endEmitted},set(e){this._readableState&&(this._readableState.readable=!!e)}},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(e){this._readableState&&(this._readableState.flowing=e)}},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(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});lbe(v7.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[wA]!==!1},set(e){this[wA]=!!e}}});Fr._fromList=mut;function mut(e,t){if(t.length===0)return null;let r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.first():r=t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function ibe(e){let t=e._readableState;sn("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,ag.nextTick(Zur,t,e))}function Zur(e,t){if(sn("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&e.length===0){if(e.endEmitted=!0,t.emit("end"),t.writable&&t.allowHalfOpen===!1)ag.nextTick(Xur,t);else if(e.autoDestroy){let r=t._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&t.destroy()}}}function Xur(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}Fr.from=function(e,t){return Rur(Fr,e,t)};var abe;function gut(){return abe===void 0&&(abe={}),abe}Fr.fromWeb=function(e,t){return gut().newStreamReadableFromReadableStream(e,t)};Fr.toWeb=function(e,t){return gut().newReadableStreamFromStreamReadable(e,t)};Fr.wrap=function(e,t){var r,n;return new Fr({objectMode:(r=(n=e.readableObjectMode)!==null&&n!==void 0?n:e.objectMode)!==null&&r!==void 0?r:!0,...t,destroy(o,i){QN.destroyer(e,o),i(o)}}).wrap(e)}});var E7=b((Fto,Mut)=>{var SA=VE(),{ArrayPrototypeSlice:vut,Error:Qur,FunctionPrototypeSymbolHasInstance:wut,ObjectDefineProperty:Sut,ObjectDefineProperties:elr,ObjectSetPrototypeOf:xut,StringPrototypeToLowerCase:tlr,Symbol:rlr,SymbolHasInstance:nlr}=la();Mut.exports=ca;ca.WritableState=o2;var{EventEmitter:olr}=Yz(),r2=p7().Stream,{Buffer:S7}=Td(),O7=_A(),{addAbortSignal:ilr}=Zz(),{getHighWaterMark:alr,getDefaultHighWaterMark:slr}=Xz(),{ERR_INVALID_ARG_TYPE:ulr,ERR_METHOD_NOT_IMPLEMENTED:llr,ERR_MULTIPLE_CALLBACK:Cut,ERR_STREAM_CANNOT_PIPE:clr,ERR_STREAM_DESTROYED:n2,ERR_STREAM_ALREADY_FINISHED:dlr,ERR_STREAM_NULL_VALUES:flr,ERR_STREAM_WRITE_AFTER_END:plr,ERR_UNKNOWN_ENCODING:Out}=Fd().codes,{errorOrDestroy:eL}=O7;xut(ca.prototype,r2.prototype);xut(ca,r2);function fbe(){}var tL=rlr("kOnFinished");function o2(e,t,r){typeof r!="boolean"&&(r=t instanceof tb()),this.objectMode=!!(e&&e.objectMode),r&&(this.objectMode=this.objectMode||!!(e&&e.writableObjectMode)),this.highWaterMark=e?alr(this,e,"writableHighWaterMark",r):slr(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(e&&e.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=mlr.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,C7(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||e.emitClose!==!1,this.autoDestroy=!e||e.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[tL]=[]}function C7(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}o2.prototype.getBuffer=function(){return vut(this.buffered,this.bufferedIndex)};Sut(o2.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ca(e){let t=this instanceof tb();if(!t&&!wut(ca,this))return new ca(e);this._writableState=new o2(e,this,t),e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final),typeof e.construct=="function"&&(this._construct=e.construct),e.signal&&ilr(e.signal,this)),r2.call(this,e),O7.construct(this,()=>{let r=this._writableState;r.writing||hbe(this,r),mbe(this,r)})}Sut(ca,nlr,{__proto__:null,value:function(e){return wut(this,e)?!0:this!==ca?!1:e&&e._writableState instanceof o2}});ca.prototype.pipe=function(){eL(this,new clr)};function Eut(e,t,r,n){let o=e._writableState;if(typeof r=="function")n=r,r=o.defaultEncoding;else{if(!r)r=o.defaultEncoding;else if(r!=="buffer"&&!S7.isEncoding(r))throw new Out(r);typeof n!="function"&&(n=fbe)}if(t===null)throw new flr;if(!o.objectMode)if(typeof t=="string")o.decodeStrings!==!1&&(t=S7.from(t,r),r="buffer");else if(t instanceof S7)r="buffer";else if(r2._isUint8Array(t))t=r2._uint8ArrayToBuffer(t),r="buffer";else throw new ulr("chunk",["string","Buffer","Uint8Array"],t);let i;return o.ending?i=new plr:o.destroyed&&(i=new n2("write")),i?(SA.nextTick(n,i),eL(e,i,!0),i):(o.pendingcb++,hlr(e,o,t,r,n))}ca.prototype.write=function(e,t,r){return Eut(this,e,t,r)===!0};ca.prototype.cork=function(){this._writableState.corked++};ca.prototype.uncork=function(){let e=this._writableState;e.corked&&(e.corked--,e.writing||hbe(this,e))};ca.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=tlr(t)),!S7.isEncoding(t))throw new Out(t);return this._writableState.defaultEncoding=t,this};function hlr(e,t,r,n,o){let i=t.objectMode?1:r.length;t.length+=i;let a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:r,encoding:n,callback:o}),t.allBuffers&&n!=="buffer"&&(t.allBuffers=!1),t.allNoop&&o!==fbe&&(t.allNoop=!1)):(t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,e._write(r,n,t.onwrite),t.sync=!1),a&&!t.errored&&!t.destroyed}function but(e,t,r,n,o,i,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new n2("write")):r?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function _ut(e,t,r,n){--t.pendingcb,n(r),pbe(t),eL(e,r)}function mlr(e,t){let r=e._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){eL(e,new Cut);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(t.stack,r.errored||(r.errored=t),e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),n?SA.nextTick(_ut,e,r,t,o):_ut(e,r,t,o)):(r.buffered.length>r.bufferedIndex&&hbe(e,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:e,state:r},SA.nextTick(glr,r.afterWriteTickInfo)):Put(e,r,1,o))}function glr({stream:e,state:t,count:r,cb:n}){return t.afterWriteTickInfo=null,Put(e,t,r,n)}function Put(e,t,r,n){for(!t.ending&&!e.destroyed&&t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,n();t.destroyed&&pbe(t),mbe(e,t)}function pbe(e){if(e.writing)return;for(let o=e.bufferedIndex;o<e.buffered.length;++o){var t;let{chunk:i,callback:a}=e.buffered[o],s=e.objectMode?1:i.length;e.length-=s,a((t=e.errored)!==null&&t!==void 0?t:new n2("write"))}let r=e[tL].splice(0);for(let o=0;o<r.length;o++){var n;r[o]((n=e.errored)!==null&&n!==void 0?n:new n2("end"))}C7(e)}function hbe(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:o}=t,i=r.length-n;if(!i)return;let a=n;if(t.bufferProcessing=!0,i>1&&e._writev){t.pendingcb-=i-1;let s=t.allNoop?fbe:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=t.allNoop&&a===0?r:vut(r,a);u.allBuffers=t.allBuffers,but(e,t,!0,t.length,u,"",s),C7(t)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;but(e,t,!1,c,s,u,l)}while(a<r.length&&!t.writing);a===r.length?C7(t):a>256?(r.splice(0,a),t.bufferedIndex=0):t.bufferedIndex=a}t.bufferProcessing=!1}ca.prototype._write=function(e,t,r){if(this._writev)this._writev([{chunk:e,encoding:t}],r);else throw new llr("_write()")};ca.prototype._writev=null;ca.prototype.end=function(e,t,r){let n=this._writableState;typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null);let o;if(e!=null){let i=Eut(this,e,t);i instanceof Qur&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,mbe(this,n,!0),n.ended=!0):n.finished?o=new dlr("end"):n.destroyed&&(o=new n2("end"))),typeof r=="function"&&(o||n.finished?SA.nextTick(r,o):n[tL].push(r)),this};function x7(e){return e.ending&&!e.destroyed&&e.constructed&&e.length===0&&!e.errored&&e.buffered.length===0&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function ylr(e,t){let r=!1;function n(o){if(r){eL(e,o??Cut());return}if(r=!0,t.pendingcb--,o){let i=t[tL].splice(0);for(let a=0;a<i.length;a++)i[a](o);eL(e,o,t.sync)}else x7(t)&&(t.prefinished=!0,e.emit("prefinish"),t.pendingcb++,SA.nextTick(dbe,e,t))}t.sync=!0,t.pendingcb++;try{e._final(n)}catch(o){n(o)}t.sync=!1}function blr(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.finalCalled=!0,ylr(e,t)):(t.prefinished=!0,e.emit("prefinish")))}function mbe(e,t,r){x7(t)&&(blr(e,t),t.pendingcb===0&&(r?(t.pendingcb++,SA.nextTick((n,o)=>{x7(o)?dbe(n,o):o.pendingcb--},e,t)):x7(t)&&(t.pendingcb++,dbe(e,t))))}function dbe(e,t){t.pendingcb--,t.finished=!0;let r=t[tL].splice(0);for(let n=0;n<r.length;n++)r[n]();if(e.emit("finish"),t.autoDestroy){let n=e._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&e.destroy()}}elr(ca.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){let e=this._writableState;return!!e&&e.writable!==!1&&!e.destroyed&&!e.errored&&!e.ending&&!e.ended},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let e=this._writableState;return e?!e.destroyed&&!e.ending&&e.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var _lr=O7.destroy;ca.prototype.destroy=function(e,t){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[tL].length)&&SA.nextTick(pbe,r),_lr.call(this,e,t),this};ca.prototype._undestroy=O7.undestroy;ca.prototype._destroy=function(e,t){t(e)};ca.prototype[olr.captureRejectionSymbol]=function(e){this.destroy(e)};var cbe;function Tut(){return cbe===void 0&&(cbe={}),cbe}ca.fromWeb=function(e,t){return Tut().newStreamWritableFromWritableStream(e,t)};ca.toWeb=function(e){return Tut().newWritableStreamFromStreamWritable(e)}});var Hut=b((kto,zut)=>{var gbe=VE(),vlr=Td(),{isReadable:wlr,isWritable:Slr,isIterable:Iut,isNodeStream:xlr,isReadableNodeStream:Aut,isWritableNodeStream:Rut,isDuplexNodeStream:Clr,isReadableStream:Dut,isWritableStream:jut}=Xy(),Nut=bx(),{AbortError:qut,codes:{ERR_INVALID_ARG_TYPE:Olr,ERR_INVALID_RETURN_VALUE:Lut}}=Fd(),{destroyer:nL}=_A(),Elr=tb(),Uut=t2(),Plr=E7(),{createDeferredPromise:Fut}=Gc(),kut=tbe(),But=globalThis.Blob||vlr.Blob,Tlr=typeof But<"u"?function(t){return t instanceof But}:function(t){return!1},Mlr=globalThis.AbortController||VN().AbortController,{FunctionPrototypeCall:$ut}=la(),GE=class extends Elr{constructor(t){super(t),t?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};zut.exports=function e(t,r){if(Clr(t))return t;if(Aut(t))return rL({readable:t});if(Rut(t))return rL({writable:t});if(xlr(t))return rL({writable:!1,readable:!1});if(Dut(t))return rL({readable:Uut.fromWeb(t)});if(jut(t))return rL({writable:Plr.fromWeb(t)});if(typeof t=="function"){let{value:o,write:i,final:a,destroy:s}=Ilr(t);if(Iut(o))return kut(GE,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=$ut(u,o,d=>{if(d!=null)throw new Lut("nully","body",d)},d=>{nL(l,d)});return l=new GE({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,gbe.nextTick(d,null)}catch(f){gbe.nextTick(d,f)}})},destroy:s})}throw new Lut("Iterable, AsyncIterable or AsyncFunction",r,o)}if(Tlr(t))return e(t.arrayBuffer());if(Iut(t))return kut(GE,t,{objectMode:!0,writable:!1});if(Dut(t?.readable)&&jut(t?.writable))return GE.fromWeb(t);if(typeof t?.writable=="object"||typeof t?.readable=="object"){let o=t!=null&&t.readable?Aut(t?.readable)?t?.readable:e(t.readable):void 0,i=t!=null&&t.writable?Rut(t?.writable)?t?.writable:e(t.writable):void 0;return rL({readable:o,writable:i})}let n=t?.then;if(typeof n=="function"){let o;return $ut(n,t,i=>{i!=null&&o.push(i),o.push(null)},i=>{nL(o,i)}),o=new GE({objectMode:!0,writable:!1,read(){}})}throw new Olr(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)};function Ilr(e){let{promise:t,resolve:r}=Fut(),n=new Mlr,o=n.signal;return{value:e(async function*(){for(;;){let a=t;t=null;let{chunk:s,done:u,cb:l}=await a;if(gbe.nextTick(l),u)return;if(o.aborted)throw new qut(void 0,{cause:o.reason});({promise:t,resolve:r}=Fut()),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 rL(e){let t=e.readable&&typeof e.readable.read!="function"?Uut.wrap(e.readable):e.readable,r=e.writable,n=!!wlr(t),o=!!Slr(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new GE({readableObjectMode:!!(t!=null&&t.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(Nut(r,d=>{o=!1,d&&nL(t,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&&(Nut(t,d=>{n=!1,d&&nL(t,d),c(d)}),t.on("readable",function(){if(s){let d=s;s=null,d()}}),t.on("end",function(){l.push(null)}),l._read=function(){for(;;){let d=t.read();if(d===null){s=l._read;return}if(!l.push(d))return}}),l._destroy=function(d,f){!d&&u!==null&&(d=new qut),s=null,i=null,a=null,u===null?f(d):(u=f,nL(r,d),nL(t,d))},l}});var tb=b((Bto,Jut)=>{"use strict";var{ObjectDefineProperties:Alr,ObjectGetOwnPropertyDescriptor:_x,ObjectKeys:Rlr,ObjectSetPrototypeOf:Vut}=la();Jut.exports=sg;var _be=t2(),Ih=E7();Vut(sg.prototype,_be.prototype);Vut(sg,_be);{let e=Rlr(Ih.prototype);for(let t=0;t<e.length;t++){let r=e[t];sg.prototype[r]||(sg.prototype[r]=Ih.prototype[r])}}function sg(e){if(!(this instanceof sg))return new sg(e);_be.call(this,e),Ih.call(this,e),e?(this.allowHalfOpen=e.allowHalfOpen!==!1,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)):this.allowHalfOpen=!0}Alr(sg.prototype,{writable:{__proto__:null,..._x(Ih.prototype,"writable")},writableHighWaterMark:{__proto__:null,..._x(Ih.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,..._x(Ih.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,..._x(Ih.prototype,"writableBuffer")},writableLength:{__proto__:null,..._x(Ih.prototype,"writableLength")},writableFinished:{__proto__:null,..._x(Ih.prototype,"writableFinished")},writableCorked:{__proto__:null,..._x(Ih.prototype,"writableCorked")},writableEnded:{__proto__:null,..._x(Ih.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,..._x(Ih.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}});var ybe;function Wut(){return ybe===void 0&&(ybe={}),ybe}sg.fromWeb=function(e,t){return Wut().newStreamDuplexFromReadableWritablePair(e,t)};sg.toWeb=function(e){return Wut().newReadableWritablePairFromDuplex(e)};var bbe;sg.from=function(e){return bbe||(bbe=Hut()),bbe(e,"body")}});var Sbe=b(($to,Kut)=>{"use strict";var{ObjectSetPrototypeOf:Gut,Symbol:Dlr}=la();Kut.exports=vx;var{ERR_METHOD_NOT_IMPLEMENTED:jlr}=Fd().codes,wbe=tb(),{getHighWaterMark:Nlr}=Xz();Gut(vx.prototype,wbe.prototype);Gut(vx,wbe);var i2=Dlr("kCallback");function vx(e){if(!(this instanceof vx))return new vx(e);let t=e?Nlr(this,e,"readableHighWaterMark",!0):null;t===0&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),wbe.call(this,e),this._readableState.sync=!1,this[i2]=null,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",Llr)}function vbe(e){typeof this._flush=="function"&&!this.destroyed?this._flush((t,r)=>{if(t){e?e(t):this.destroy(t);return}r!=null&&this.push(r),this.push(null),e&&e()}):(this.push(null),e&&e())}function Llr(){this._final!==vbe&&vbe.call(this)}vx.prototype._final=vbe;vx.prototype._transform=function(e,t,r){throw new jlr("_transform()")};vx.prototype._write=function(e,t,r){let n=this._readableState,o=this._writableState,i=n.length;this._transform(e,t,(a,s)=>{if(a){r(a);return}s!=null&&this.push(s),o.ended||i===n.length||n.length<n.highWaterMark?r():this[i2]=r})};vx.prototype._read=function(){if(this[i2]){let e=this[i2];this[i2]=null,e()}}});var Cbe=b((qto,Zut)=>{"use strict";var{ObjectSetPrototypeOf:Yut}=la();Zut.exports=oL;var xbe=Sbe();Yut(oL.prototype,xbe.prototype);Yut(oL,xbe);function oL(e){if(!(this instanceof oL))return new oL(e);xbe.call(this,e)}oL.prototype._transform=function(e,t,r){r(null,e)}});var I7=b((Uto,rlt)=>{var a2=VE(),{ArrayIsArray:Flr,Promise:klr,SymbolAsyncIterator:Blr,SymbolDispose:$lr}=la(),M7=bx(),{once:qlr}=Gc(),Ulr=_A(),Xut=tb(),{aggregateTwoErrors:zlr,codes:{ERR_INVALID_ARG_TYPE:Dbe,ERR_INVALID_RETURN_VALUE:Obe,ERR_MISSING_ARGS:Hlr,ERR_STREAM_DESTROYED:Vlr,ERR_STREAM_PREMATURE_CLOSE:Wlr},AbortError:Jlr}=Fd(),{validateFunction:Glr,validateAbortSignal:Klr}=GN(),{isIterable:xA,isReadable:Ebe,isReadableNodeStream:T7,isNodeStream:Qut,isTransformStream:iL,isWebStream:Ylr,isReadableStream:Pbe,isReadableFinished:Zlr}=Xy(),Xlr=globalThis.AbortController||VN().AbortController,Tbe,Mbe,Ibe;function elt(e,t,r){let n=!1;e.on("close",()=>{n=!0});let o=M7(e,{readable:t,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,Ulr.destroyer(e,i||new Vlr("pipe")))},cleanup:o}}function Qlr(e){return Glr(e[e.length-1],"streams[stream.length - 1]"),e.pop()}function Abe(e){if(xA(e))return e;if(T7(e))return ecr(e);throw new Dbe("val",["Readable","Iterable","AsyncIterable"],e)}async function*ecr(e){Mbe||(Mbe=t2()),yield*Mbe.prototype[Blr].call(e)}async function P7(e,t,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new klr((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});t.on("drain",a);let u=M7(t,{readable:!1},a);try{t.writableNeedDrain&&await s();for await(let l of e)t.write(l)||await s();n&&(t.end(),await s()),r()}catch(l){r(o!==l?zlr(o,l):l)}finally{u(),t.off("drain",a)}}async function Rbe(e,t,r,{end:n}){iL(t)&&(t=t.writable);let o=t.getWriter();try{for await(let i of e)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 tcr(...e){return tlt(e,qlr(Qlr(e)))}function tlt(e,t,r){if(e.length===1&&Flr(e[0])&&(e=e[0]),e.length<2)throw new Hlr("streams");let n=new Xlr,o=n.signal,i=r?.signal,a=[];Klr(i,"options.signal");function s(){h(new Jlr)}Ibe=Ibe||Gc().addAbortListener;let u;i&&(u=Ibe(i,s));let l,c,d=[],f=0;function p(S){h(S,--f===0)}function h(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[$lr](),n.abort(),x&&(l||a.forEach(T=>T()),a2.nextTick(t,l,c))}}let m;for(let S=0;S<e.length;S++){let x=e[S],O=S<e.length-1,T=S>0,E=O||r?.end!==!1,M=S===e.length-1;if(Qut(x)){let A=function(j){j&&j.name!=="AbortError"&&j.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(j)};var v=A;if(E){let{destroy:j,cleanup:N}=elt(x,O,T);d.push(j),Ebe(x)&&M&&a.push(N)}x.on("error",A),Ebe(x)&&M&&a.push(()=>{x.removeListener("error",A)})}if(S===0)if(typeof x=="function"){if(m=x({signal:o}),!xA(m))throw new Obe("Iterable, AsyncIterable or Stream","source",m)}else xA(x)||T7(x)||iL(x)?m=x:m=Xut.from(x);else if(typeof x=="function"){if(iL(m)){var _;m=Abe((_=m)===null||_===void 0?void 0:_.readable)}else m=Abe(m);if(m=x(m,{signal:o}),O){if(!xA(m,!0))throw new Obe("AsyncIterable",`transform[${S-1}]`,m)}else{var g;Tbe||(Tbe=Cbe());let A=new Tbe({objectMode:!0}),j=(g=m)===null||g===void 0?void 0:g.then;if(typeof j=="function")f++,j.call(m,k=>{c=k,k!=null&&A.write(k),E&&A.end(),a2.nextTick(p)},k=>{A.destroy(k),a2.nextTick(p,k)});else if(xA(m,!0))f++,P7(m,A,p,{end:E});else if(Pbe(m)||iL(m)){let k=m.readable||m;f++,P7(k,A,p,{end:E})}else throw new Obe("AsyncIterable or Promise","destination",m);m=A;let{destroy:N,cleanup:F}=elt(m,!1,!0);d.push(N),M&&a.push(F)}}else if(Qut(x)){if(T7(m)){f+=2;let A=rcr(m,x,p,{end:E});Ebe(x)&&M&&a.push(A)}else if(iL(m)||Pbe(m)){let A=m.readable||m;f++,P7(A,x,p,{end:E})}else if(xA(m))f++,P7(m,x,p,{end:E});else throw new Dbe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],m);m=x}else if(Ylr(x)){if(T7(m))f++,Rbe(Abe(m),x,p,{end:E});else if(Pbe(m)||xA(m))f++,Rbe(m,x,p,{end:E});else if(iL(m))f++,Rbe(m.readable,x,p,{end:E});else throw new Dbe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],m);m=x}else m=Xut.from(x)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&a2.nextTick(s),m}function rcr(e,t,r,{end:n}){let o=!1;if(t.on("close",()=>{o||r(new Wlr)}),e.pipe(t,{end:!1}),n){let a=function(){o=!0,t.end()};var i=a;Zlr(e)?a2.nextTick(a):e.once("end",a)}else r();return M7(e,{readable:!0,writable:!1},a=>{let s=e._readableState;a&&a.code==="ERR_STREAM_PREMATURE_CLOSE"&&s&&s.ended&&!s.errored&&!s.errorEmitted?e.once("end",r).once("error",r):r(a)}),M7(t,{readable:!1,writable:!0},r)}rlt.exports={pipelineImpl:tlt,pipeline:tcr}});var Nbe=b((zto,ult)=>{"use strict";var{pipeline:ncr}=I7(),A7=tb(),{destroyer:ocr}=_A(),{isNodeStream:R7,isReadable:nlt,isWritable:olt,isWebStream:jbe,isTransformStream:CA,isWritableStream:ilt,isReadableStream:alt}=Xy(),{AbortError:icr,codes:{ERR_INVALID_ARG_VALUE:slt,ERR_MISSING_ARGS:acr}}=Fd(),scr=bx();ult.exports=function(...t){if(t.length===0)throw new acr("streams");if(t.length===1)return A7.from(t[0]);let r=[...t];if(typeof t[0]=="function"&&(t[0]=A7.from(t[0])),typeof t[t.length-1]=="function"){let p=t.length-1;t[p]=A7.from(t[p])}for(let p=0;p<t.length;++p)if(!(!R7(t[p])&&!jbe(t[p]))){if(p<t.length-1&&!(nlt(t[p])||alt(t[p])||CA(t[p])))throw new slt(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(olt(t[p])||ilt(t[p])||CA(t[p])))throw new slt(`streams[${p}]`,r[p],"must be writable")}let n,o,i,a,s;function u(p){let h=a;a=null,h?h(p):p?s.destroy(p):!f&&!d&&s.destroy()}let l=t[0],c=ncr(t,u),d=!!(olt(l)||ilt(l)||CA(l)),f=!!(nlt(c)||alt(c)||CA(c));if(s=new A7({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(R7(l))s._write=function(h,m,_){l.write(h,m)?_():n=_},s._final=function(h){l.end(),o=h},l.on("drain",function(){if(n){let h=n;n=null,h()}});else if(jbe(l)){let m=(CA(l)?l.writable:l).getWriter();s._write=async function(_,g,v){try{await m.ready,m.write(_).catch(()=>{}),v()}catch(S){v(S)}},s._final=async function(_){try{await m.ready,m.close().catch(()=>{}),o=_}catch(g){_(g)}}}let p=CA(c)?c.readable:c;scr(p,()=>{if(o){let h=o;o=null,h()}})}if(f){if(R7(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(jbe(c)){let h=(CA(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:m,done:_}=await h.read();if(!s.push(m))return;if(_){s.push(null);return}}catch{return}}}}return s._destroy=function(p,h){!p&&a!==null&&(p=new icr),i=null,n=null,o=null,a===null?h(p):(a=h,R7(c)&&ocr(c,p))},s}});var blt=b((Hto,kbe)=>{"use strict";var ucr=globalThis.AbortController||VN().AbortController,{codes:{ERR_INVALID_ARG_VALUE:lcr,ERR_INVALID_ARG_TYPE:s2,ERR_MISSING_ARGS:ccr,ERR_OUT_OF_RANGE:dcr},AbortError:rb}=Fd(),{validateAbortSignal:OA,validateInteger:llt,validateObject:EA}=GN(),fcr=la().Symbol("kWeak"),pcr=la().Symbol("kResistStopPropagation"),{finished:hcr}=bx(),mcr=Nbe(),{addAbortSignalNoValidate:gcr}=Zz(),{isWritable:ycr,isNodeStream:bcr}=Xy(),{deprecate:_cr}=Gc(),{ArrayPrototypePush:vcr,Boolean:wcr,MathFloor:clt,Number:Scr,NumberIsNaN:xcr,Promise:dlt,PromiseReject:flt,PromiseResolve:Ccr,PromisePrototypeThen:plt,Symbol:mlt}=la(),D7=mlt("kEmpty"),hlt=mlt("kEof");function Ocr(e,t){if(t!=null&&EA(t,"options"),t?.signal!=null&&OA(t.signal,"options.signal"),bcr(e)&&!ycr(e))throw new lcr("stream",e,"must be writable");let r=mcr(this,e);return t!=null&&t.signal&&gcr(t.signal,r),r}function j7(e,t){if(typeof e!="function")throw new s2("fn",["Function","AsyncFunction"],e);t!=null&&EA(t,"options"),t?.signal!=null&&OA(t.signal,"options.signal");let r=1;t?.concurrency!=null&&(r=clt(t.concurrency));let n=r-1;return t?.highWaterMark!=null&&(n=clt(t.highWaterMark)),llt(r,"options.concurrency",1),llt(n,"options.highWaterMark",0),n+=r,async function*(){let i=Gc().AbortSignalAny([t?.signal].filter(wcr)),a=this,s=[],u={signal:i},l,c,d=!1,f=0;function p(){d=!0,h()}function h(){f-=1,m()}function m(){c&&!d&&f<r&&s.length<n&&(c(),c=null)}async function _(){try{for await(let g of a){if(d)return;if(i.aborted)throw new rb;try{if(g=e(g,u),g===D7)continue;g=Ccr(g)}catch(v){g=flt(v)}f+=1,plt(g,h,p),s.push(g),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new dlt(v=>{c=v})}s.push(hlt)}catch(g){let v=flt(g);plt(v,h,p),s.push(v)}finally{d=!0,l&&(l(),l=null)}}_();try{for(;;){for(;s.length>0;){let g=await s[0];if(g===hlt)return;if(i.aborted)throw new rb;g!==D7&&(yield g),s.shift(),m()}await new dlt(g=>{l=g})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function Ecr(e=void 0){return e!=null&&EA(e,"options"),e?.signal!=null&&OA(e.signal,"options.signal"),async function*(){let r=0;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new rb({cause:e.signal.reason});yield[r++,o]}}.call(this)}async function glt(e,t=void 0){for await(let r of Fbe.call(this,e,t))return!0;return!1}async function Pcr(e,t=void 0){if(typeof e!="function")throw new s2("fn",["Function","AsyncFunction"],e);return!await glt.call(this,async(...r)=>!await e(...r),t)}async function Tcr(e,t){for await(let r of Fbe.call(this,e,t))return r}async function Mcr(e,t){if(typeof e!="function")throw new s2("fn",["Function","AsyncFunction"],e);async function r(n,o){return await e(n,o),D7}for await(let n of j7.call(this,r,t));}function Fbe(e,t){if(typeof e!="function")throw new s2("fn",["Function","AsyncFunction"],e);async function r(n,o){return await e(n,o)?n:D7}return j7.call(this,r,t)}var Lbe=class extends ccr{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function Icr(e,t,r){var n;if(typeof e!="function")throw new s2("reducer",["Function","AsyncFunction"],e);r!=null&&EA(r,"options"),r?.signal!=null&&OA(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new rb(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await hcr(this.destroy(l)),l}let i=new ucr,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[fcr]:this,[pcr]:!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 rb;o?t=await e(t,l,{signal:a}):(t=l,o=!0)}if(!s&&!o)throw new Lbe}finally{i.abort()}return t}async function Acr(e){e!=null&&EA(e,"options"),e?.signal!=null&&OA(e.signal,"options.signal");let t=[];for await(let n of this){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new rb(void 0,{cause:e.signal.reason});vcr(t,n)}return t}function Rcr(e,t){let r=j7.call(this,e,t);return async function*(){for await(let o of r)yield*o}.call(this)}function ylt(e){if(e=Scr(e),xcr(e))return 0;if(e<0)throw new dcr("number",">= 0",e);return e}function Dcr(e,t=void 0){return t!=null&&EA(t,"options"),t?.signal!=null&&OA(t.signal,"options.signal"),e=ylt(e),async function*(){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new rb;for await(let i of this){var o;if(t!=null&&(o=t.signal)!==null&&o!==void 0&&o.aborted)throw new rb;e--<=0&&(yield i)}}.call(this)}function jcr(e,t=void 0){return t!=null&&EA(t,"options"),t?.signal!=null&&OA(t.signal,"options.signal"),e=ylt(e),async function*(){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new rb;for await(let i of this){var o;if(t!=null&&(o=t.signal)!==null&&o!==void 0&&o.aborted)throw new rb;if(e-- >0&&(yield i),e<=0)return}}.call(this)}kbe.exports.streamReturningOperators={asIndexedPairs:_cr(Ecr,"readable.asIndexedPairs will be removed in a future version."),drop:Dcr,filter:Fbe,flatMap:Rcr,map:j7,take:jcr,compose:Ocr};kbe.exports.promiseReturningOperators={every:Pcr,forEach:Mcr,reduce:Icr,toArray:Acr,some:glt,find:Tcr}});var Bbe=b((Vto,_lt)=>{"use strict";var{ArrayPrototypePop:Ncr,Promise:Lcr}=la(),{isIterable:Fcr,isNodeStream:kcr,isWebStream:Bcr}=Xy(),{pipelineImpl:$cr}=I7(),{finished:qcr}=bx();$be();function Ucr(...e){return new Lcr((t,r)=>{let n,o,i=e[e.length-1];if(i&&typeof i=="object"&&!kcr(i)&&!Fcr(i)&&!Bcr(i)){let a=Ncr(e);n=a.signal,o=a.end}$cr(e,(a,s)=>{a?r(a):t(s)},{signal:n,end:o})})}_lt.exports={finished:qcr,pipeline:Ucr}});var $be=b((Wto,Tlt)=>{var{Buffer:zcr}=Td(),{ObjectDefineProperty:wx,ObjectKeys:Slt,ReflectApply:xlt}=la(),{promisify:{custom:Clt}}=Gc(),{streamReturningOperators:vlt,promiseReturningOperators:wlt}=blt(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Olt}}=Fd(),Hcr=Nbe(),{setDefaultHighWaterMark:Vcr,getDefaultHighWaterMark:Wcr}=Xz(),{pipeline:Elt}=I7(),{destroyer:Jcr}=_A(),Plt=bx(),qbe=Bbe(),u2=Xy(),xi=Tlt.exports=p7().Stream;xi.isDestroyed=u2.isDestroyed;xi.isDisturbed=u2.isDisturbed;xi.isErrored=u2.isErrored;xi.isReadable=u2.isReadable;xi.isWritable=u2.isWritable;xi.Readable=t2();for(let e of Slt(vlt)){let r=function(...n){if(new.target)throw Olt();return xi.Readable.from(xlt(t,this,n))};Ube=r;let t=vlt[e];wx(r,"name",{__proto__:null,value:t.name}),wx(r,"length",{__proto__:null,value:t.length}),wx(xi.Readable.prototype,e,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var Ube;for(let e of Slt(wlt)){let r=function(...o){if(new.target)throw Olt();return xlt(t,this,o)};Ube=r;let t=wlt[e];wx(r,"name",{__proto__:null,value:t.name}),wx(r,"length",{__proto__:null,value:t.length}),wx(xi.Readable.prototype,e,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var Ube;xi.Writable=E7();xi.Duplex=tb();xi.Transform=Sbe();xi.PassThrough=Cbe();xi.pipeline=Elt;var{addAbortSignal:Gcr}=Zz();xi.addAbortSignal=Gcr;xi.finished=Plt;xi.destroy=Jcr;xi.compose=Hcr;xi.setDefaultHighWaterMark=Vcr;xi.getDefaultHighWaterMark=Wcr;wx(xi,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return qbe}});wx(Elt,Clt,{__proto__:null,enumerable:!0,get(){return qbe.pipeline}});wx(Plt,Clt,{__proto__:null,enumerable:!0,get(){return qbe.finished}});xi.Stream=xi;xi._isUint8Array=function(t){return t instanceof Uint8Array};xi._uint8ArrayToBuffer=function(t){return zcr.from(t.buffer,t.byteOffset,t.byteLength)}});var l2=b((Jto,Ya)=>{"use strict";var Vu=$be(),Kcr=Bbe(),Ycr=Vu.Readable.destroy;Ya.exports=Vu.Readable;Ya.exports._uint8ArrayToBuffer=Vu._uint8ArrayToBuffer;Ya.exports._isUint8Array=Vu._isUint8Array;Ya.exports.isDisturbed=Vu.isDisturbed;Ya.exports.isErrored=Vu.isErrored;Ya.exports.isReadable=Vu.isReadable;Ya.exports.Readable=Vu.Readable;Ya.exports.Writable=Vu.Writable;Ya.exports.Duplex=Vu.Duplex;Ya.exports.Transform=Vu.Transform;Ya.exports.PassThrough=Vu.PassThrough;Ya.exports.addAbortSignal=Vu.addAbortSignal;Ya.exports.finished=Vu.finished;Ya.exports.destroy=Vu.destroy;Ya.exports.destroy=Ycr;Ya.exports.pipeline=Vu.pipeline;Ya.exports.compose=Vu.compose;Object.defineProperty(Vu,"promises",{configurable:!0,enumerable:!0,get(){return Kcr}});Ya.exports.Stream=Vu.Stream;Ya.exports.default=Ya.exports});var PA=b((Gto,Mlt)=>{"use strict";Mlt.exports=TypeError});var Ilt=b(()=>{});var p2=b((Zto,Ylt)=>{var Xbe=typeof Map=="function"&&Map.prototype,zbe=Object.getOwnPropertyDescriptor&&Xbe?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,L7=Xbe&&zbe&&typeof zbe.get=="function"?zbe.get:null,Alt=Xbe&&Map.prototype.forEach,Qbe=typeof Set=="function"&&Set.prototype,Hbe=Object.getOwnPropertyDescriptor&&Qbe?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,F7=Qbe&&Hbe&&typeof Hbe.get=="function"?Hbe.get:null,Rlt=Qbe&&Set.prototype.forEach,Zcr=typeof WeakMap=="function"&&WeakMap.prototype,d2=Zcr?WeakMap.prototype.has:null,Xcr=typeof WeakSet=="function"&&WeakSet.prototype,f2=Xcr?WeakSet.prototype.has:null,Qcr=typeof WeakRef=="function"&&WeakRef.prototype,Dlt=Qcr?WeakRef.prototype.deref:null,edr=Boolean.prototype.valueOf,tdr=Object.prototype.toString,rdr=Function.prototype.toString,ndr=String.prototype.match,e_e=String.prototype.slice,KE=String.prototype.replace,odr=String.prototype.toUpperCase,jlt=String.prototype.toLowerCase,zlt=RegExp.prototype.test,Nlt=Array.prototype.concat,nb=Array.prototype.join,idr=Array.prototype.slice,Llt=Math.floor,Jbe=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Vbe=Object.getOwnPropertySymbols,Gbe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,aL=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Yc=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===aL||!0)?Symbol.toStringTag:null,Hlt=Object.prototype.propertyIsEnumerable,Flt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function klt(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||zlt.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e=="number"){var n=e<0?-Llt(-e):Llt(e);if(n!==e){var o=String(n),i=e_e.call(t,o.length+1);return KE.call(o,r,"$&_")+"."+KE.call(KE.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return KE.call(t,r,"$&_")}var Kbe=Ilt(),Blt=Kbe.custom,$lt=Jlt(Blt)?Blt:null,Vlt={__proto__:null,double:'"',single:"'"},adr={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Ylt.exports=function e(t,r,n,o){var i=r||{};if(Sx(i,"quoteStyle")&&!Sx(Vlt,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Sx(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=Sx(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(Sx(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(Sx(i,"numericSeparator")&&typeof i.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var s=i.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return Klt(t,i);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var u=String(t);return s?klt(t,u):u}if(typeof t=="bigint"){var l=String(t)+"n";return s?klt(t,l):l}var c=typeof i.depth>"u"?5:i.depth;if(typeof n>"u"&&(n=0),n>=c&&c>0&&typeof t=="object")return Ybe(t)?"[Array]":"[Object]";var d=Cdr(i,n);if(typeof o>"u")o=[];else if(Glt(o,t)>=0)return"[Circular]";function f(k,L,q){if(L&&(o=idr.call(o),o.push(L)),q){var U={depth:i.depth};return Sx(i,"quoteStyle")&&(U.quoteStyle=i.quoteStyle),e(k,U,n+1,o)}return e(k,i,n+1,o)}if(typeof t=="function"&&!qlt(t)){var p=mdr(t),h=N7(t,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(h.length>0?" { "+nb.call(h,", ")+" }":"")}if(Jlt(t)){var m=aL?KE.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Gbe.call(t);return typeof t=="object"&&!aL?c2(m):m}if(wdr(t)){for(var _="<"+jlt.call(String(t.nodeName)),g=t.attributes||[],v=0;v<g.length;v++)_+=" "+g[v].name+"="+Wlt(sdr(g[v].value),"double",i);return _+=">",t.childNodes&&t.childNodes.length&&(_+="..."),_+="</"+jlt.call(String(t.nodeName))+">",_}if(Ybe(t)){if(t.length===0)return"[]";var S=N7(t,f);return d&&!xdr(S)?"["+Zbe(S,d)+"]":"[ "+nb.call(S,", ")+" ]"}if(ldr(t)){var x=N7(t,f);return!("cause"in Error.prototype)&&"cause"in t&&!Hlt.call(t,"cause")?"{ ["+String(t)+"] "+nb.call(Nlt.call("[cause]: "+f(t.cause),x),", ")+" }":x.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+nb.call(x,", ")+" }"}if(typeof t=="object"&&a){if($lt&&typeof t[$lt]=="function"&&Kbe)return Kbe(t,{depth:c-n});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(gdr(t)){var O=[];return Alt&&Alt.call(t,function(k,L){O.push(f(L,t,!0)+" => "+f(k,t))}),Ult("Map",L7.call(t),O,d)}if(_dr(t)){var T=[];return Rlt&&Rlt.call(t,function(k){T.push(f(k,t))}),Ult("Set",F7.call(t),T,d)}if(ydr(t))return Wbe("WeakMap");if(vdr(t))return Wbe("WeakSet");if(bdr(t))return Wbe("WeakRef");if(ddr(t))return c2(f(Number(t)));if(pdr(t))return c2(f(Jbe.call(t)));if(fdr(t))return c2(edr.call(t));if(cdr(t))return c2(f(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof window<"u"&&t===window)return"{ [object globalThis] }";if(!udr(t)&&!qlt(t)){var E=N7(t,f),M=Flt?Flt(t)===Object.prototype:t instanceof Object||t.constructor===Object,A=t instanceof Object?"":"null prototype",j=!M&&Yc&&Object(t)===t&&Yc in t?e_e.call(YE(t),8,-1):A?"Object":"",N=M||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",F=N+(j||A?"["+nb.call(Nlt.call([],j||[],A||[]),": ")+"] ":"");return E.length===0?F+"{}":d?F+"{"+Zbe(E,d)+"}":F+"{ "+nb.call(E,", ")+" }"}return String(t)};function Wlt(e,t,r){var n=r.quoteStyle||t,o=Vlt[n];return o+e+o}function sdr(e){return KE.call(String(e),/"/g,"&quot;")}function Ybe(e){return YE(e)==="[object Array]"&&(!Yc||!(typeof e=="object"&&Yc in e))}function udr(e){return YE(e)==="[object Date]"&&(!Yc||!(typeof e=="object"&&Yc in e))}function qlt(e){return YE(e)==="[object RegExp]"&&(!Yc||!(typeof e=="object"&&Yc in e))}function ldr(e){return YE(e)==="[object Error]"&&(!Yc||!(typeof e=="object"&&Yc in e))}function cdr(e){return YE(e)==="[object String]"&&(!Yc||!(typeof e=="object"&&Yc in e))}function ddr(e){return YE(e)==="[object Number]"&&(!Yc||!(typeof e=="object"&&Yc in e))}function fdr(e){return YE(e)==="[object Boolean]"&&(!Yc||!(typeof e=="object"&&Yc in e))}function Jlt(e){if(aL)return e&&typeof e=="object"&&e instanceof Symbol;if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||!Gbe)return!1;try{return Gbe.call(e),!0}catch{}return!1}function pdr(e){if(!e||typeof e!="object"||!Jbe)return!1;try{return Jbe.call(e),!0}catch{}return!1}var hdr=Object.prototype.hasOwnProperty||function(e){return e in this};function Sx(e,t){return hdr.call(e,t)}function YE(e){return tdr.call(e)}function mdr(e){if(e.name)return e.name;var t=ndr.call(rdr.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function Glt(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function gdr(e){if(!L7||!e||typeof e!="object")return!1;try{L7.call(e);try{F7.call(e)}catch{return!0}return e instanceof Map}catch{}return!1}function ydr(e){if(!d2||!e||typeof e!="object")return!1;try{d2.call(e,d2);try{f2.call(e,f2)}catch{return!0}return e instanceof WeakMap}catch{}return!1}function bdr(e){if(!Dlt||!e||typeof e!="object")return!1;try{return Dlt.call(e),!0}catch{}return!1}function _dr(e){if(!F7||!e||typeof e!="object")return!1;try{F7.call(e);try{L7.call(e)}catch{return!0}return e instanceof Set}catch{}return!1}function vdr(e){if(!f2||!e||typeof e!="object")return!1;try{f2.call(e,f2);try{d2.call(e,d2)}catch{return!0}return e instanceof WeakSet}catch{}return!1}function wdr(e){return!e||typeof e!="object"?!1:typeof HTMLElement<"u"&&e instanceof HTMLElement?!0:typeof e.nodeName=="string"&&typeof e.getAttribute=="function"}function Klt(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Klt(e_e.call(e,0,t.maxStringLength),t)+n}var o=adr[t.quoteStyle||"single"];o.lastIndex=0;var i=KE.call(KE.call(e,o,"\\$1"),/[\x00-\x1f]/g,Sdr);return Wlt(i,"single",t)}function Sdr(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+odr.call(t.toString(16))}function c2(e){return"Object("+e+")"}function Wbe(e){return e+" { ? }"}function Ult(e,t,r,n){var o=n?Zbe(r,n):nb.call(r,", ");return e+" ("+t+") {"+o+"}"}function xdr(e){for(var t=0;t<e.length;t++)if(Glt(e[t],`
`)>=0)return!1;return!0}function Cdr(e,t){var r;if(e.indent===" ")r=" ";else if(typeof e.indent=="number"&&e.indent>0)r=nb.call(Array(e.indent+1)," ");else return null;return{base:r,prev:nb.call(Array(t+1),r)}}function Zbe(e,t){if(e.length===0)return"";var r=`
`+t.prev+t.base;return r+nb.call(e,","+r)+`
`+t.prev}function N7(e,t){var r=Ybe(e),n=[];if(r){n.length=e.length;for(var o=0;o<e.length;o++)n[o]=Sx(e,o)?t(e[o],e):""}var i=typeof Vbe=="function"?Vbe(e):[],a;if(aL){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in e)Sx(e,u)&&(r&&String(Number(u))===u&&u<e.length||aL&&a["$"+u]instanceof Symbol||(zlt.call(/[^\w$]/,u)?n.push(t(u,e)+": "+t(e[u],e)):n.push(u+": "+t(e[u],e))));if(typeof Vbe=="function")for(var l=0;l<i.length;l++)Hlt.call(e,i[l])&&n.push("["+t(i[l])+"]: "+t(e[i[l]],e));return n}});var Xlt=b((Xto,Zlt)=>{"use strict";var Odr=p2(),Edr=PA(),k7=function(e,t,r){for(var n=e,o;(o=n.next)!=null;n=o)if(o.key===t)return n.next=o.next,r||(o.next=e.next,e.next=o),o},Pdr=function(e,t){if(e){var r=k7(e,t);return r&&r.value}},Tdr=function(e,t,r){var n=k7(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}},Mdr=function(e,t){return e?!!k7(e,t):!1},Idr=function(e,t){if(e)return k7(e,t,!0)};Zlt.exports=function(){var t,r={assert:function(n){if(!r.has(n))throw new Edr("Side channel does not contain "+Odr(n))},delete:function(n){var o=t&&t.next,i=Idr(t,n);return i&&o&&o===i&&(t=void 0),!!i},get:function(n){return Pdr(t,n)},has:function(n){return Mdr(t,n)},set:function(n,o){t||(t={next:void 0}),Tdr(t,n,o)}};return r}});var t_e=b((Qto,Qlt)=>{"use strict";Qlt.exports=Object});var tct=b((ero,ect)=>{"use strict";ect.exports=Error});var nct=b((tro,rct)=>{"use strict";rct.exports=EvalError});var ict=b((rro,oct)=>{"use strict";oct.exports=RangeError});var sct=b((nro,act)=>{"use strict";act.exports=ReferenceError});var lct=b((oro,uct)=>{"use strict";uct.exports=SyntaxError});var dct=b((iro,cct)=>{"use strict";cct.exports=URIError});var pct=b((aro,fct)=>{"use strict";fct.exports=Math.abs});var mct=b((sro,hct)=>{"use strict";hct.exports=Math.floor});var yct=b((uro,gct)=>{"use strict";gct.exports=Math.max});var _ct=b((lro,bct)=>{"use strict";bct.exports=Math.min});var wct=b((cro,vct)=>{"use strict";vct.exports=Math.pow});var xct=b((dro,Sct)=>{"use strict";Sct.exports=Math.round});var Oct=b((fro,Cct)=>{"use strict";Cct.exports=Number.isNaN||function(t){return t!==t}});var Pct=b((pro,Ect)=>{"use strict";var Adr=Oct();Ect.exports=function(t){return Adr(t)||t===0?t:t<0?-1:1}});var Mct=b((hro,Tct)=>{"use strict";Tct.exports=Object.getOwnPropertyDescriptor});var r_e=b((mro,Ict)=>{"use strict";var B7=Mct();if(B7)try{B7([],"length")}catch{B7=null}Ict.exports=B7});var Rct=b((gro,Act)=>{"use strict";var $7=Object.defineProperty||!1;if($7)try{$7({},"a",{value:1})}catch{$7=!1}Act.exports=$7});var jct=b((yro,Dct)=>{"use strict";Dct.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},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;t[r]=o;for(var i in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var a=Object.getOwnPropertySymbols(t);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(t,r);if(s.value!==o||s.enumerable!==!0)return!1}return!0}});var Fct=b((bro,Lct)=>{"use strict";var Nct=typeof Symbol<"u"&&Symbol,Rdr=jct();Lct.exports=function(){return typeof Nct!="function"||typeof Symbol!="function"||typeof Nct("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Rdr()}});var n_e=b((_ro,kct)=>{"use strict";kct.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var o_e=b((vro,Bct)=>{"use strict";var Ddr=t_e();Bct.exports=Ddr.getPrototypeOf||null});var Uct=b((wro,qct)=>{"use strict";var jdr="Function.prototype.bind called on incompatible ",Ndr=Object.prototype.toString,Ldr=Math.max,Fdr="[object Function]",$ct=function(t,r){for(var n=[],o=0;o<t.length;o+=1)n[o]=t[o];for(var i=0;i<r.length;i+=1)n[i+t.length]=r[i];return n},kdr=function(t,r){for(var n=[],o=r||0,i=0;o<t.length;o+=1,i+=1)n[i]=t[o];return n},Bdr=function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r};qct.exports=function(t){var r=this;if(typeof r!="function"||Ndr.apply(r)!==Fdr)throw new TypeError(jdr+r);for(var n=kdr(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,$ct(n,arguments));return Object(c)===c?c:this}return r.apply(t,$ct(n,arguments))},a=Ldr(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+Bdr(s,",")+"){ return binder.apply(this,arguments); }")(i),r.prototype){var l=function(){};l.prototype=r.prototype,o.prototype=new l,l.prototype=null}return o}});var h2=b((Sro,zct)=>{"use strict";var $dr=Uct();zct.exports=Function.prototype.bind||$dr});var q7=b((xro,Hct)=>{"use strict";Hct.exports=Function.prototype.call});var i_e=b((Cro,Vct)=>{"use strict";Vct.exports=Function.prototype.apply});var Jct=b((Oro,Wct)=>{"use strict";Wct.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Kct=b((Ero,Gct)=>{"use strict";var qdr=h2(),Udr=i_e(),zdr=q7(),Hdr=Jct();Gct.exports=Hdr||qdr.call(zdr,Udr)});var a_e=b((Pro,Yct)=>{"use strict";var Vdr=h2(),Wdr=PA(),Jdr=q7(),Gdr=Kct();Yct.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new Wdr("a function is required");return Gdr(Vdr,Jdr,t)}});var rdt=b((Tro,tdt)=>{"use strict";var Kdr=a_e(),Zct=r_e(),Qct;try{Qct=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var s_e=!!Qct&&Zct&&Zct(Object.prototype,"__proto__"),edt=Object,Xct=edt.getPrototypeOf;tdt.exports=s_e&&typeof s_e.get=="function"?Kdr([s_e.get]):typeof Xct=="function"?function(t){return Xct(t==null?t:edt(t))}:!1});var sdt=b((Mro,adt)=>{"use strict";var ndt=n_e(),odt=o_e(),idt=rdt();adt.exports=ndt?function(t){return ndt(t)}:odt?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return odt(t)}:idt?function(t){return idt(t)}:null});var ldt=b((Iro,udt)=>{"use strict";var Ydr=Function.prototype.call,Zdr=Object.prototype.hasOwnProperty,Xdr=h2();udt.exports=Xdr.call(Ydr,Zdr)});var H7=b((Aro,mdt)=>{"use strict";var un,Qdr=t_e(),efr=tct(),tfr=nct(),rfr=ict(),nfr=sct(),cL=lct(),lL=PA(),ofr=dct(),ifr=pct(),afr=mct(),sfr=yct(),ufr=_ct(),lfr=wct(),cfr=xct(),dfr=Pct(),pdt=Function,u_e=function(e){try{return pdt('"use strict"; return ('+e+").constructor;")()}catch{}},m2=r_e(),ffr=Rct(),l_e=function(){throw new lL},pfr=m2?function(){try{return arguments.callee,l_e}catch{try{return m2(arguments,"callee").get}catch{return l_e}}}():l_e,sL=Fct()(),ml=sdt(),hfr=o_e(),mfr=n_e(),hdt=i_e(),g2=q7(),uL={},gfr=typeof Uint8Array>"u"||!ml?un:ml(Uint8Array),TA={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?un:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?un:ArrayBuffer,"%ArrayIteratorPrototype%":sL&&ml?ml([][Symbol.iterator]()):un,"%AsyncFromSyncIteratorPrototype%":un,"%AsyncFunction%":uL,"%AsyncGenerator%":uL,"%AsyncGeneratorFunction%":uL,"%AsyncIteratorPrototype%":uL,"%Atomics%":typeof Atomics>"u"?un:Atomics,"%BigInt%":typeof BigInt>"u"?un:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?un:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?un:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?un:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":efr,"%eval%":eval,"%EvalError%":tfr,"%Float32Array%":typeof Float32Array>"u"?un:Float32Array,"%Float64Array%":typeof Float64Array>"u"?un:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?un:FinalizationRegistry,"%Function%":pdt,"%GeneratorFunction%":uL,"%Int8Array%":typeof Int8Array>"u"?un:Int8Array,"%Int16Array%":typeof Int16Array>"u"?un:Int16Array,"%Int32Array%":typeof Int32Array>"u"?un:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":sL&&ml?ml(ml([][Symbol.iterator]())):un,"%JSON%":typeof JSON=="object"?JSON:un,"%Map%":typeof Map>"u"?un:Map,"%MapIteratorPrototype%":typeof Map>"u"||!sL||!ml?un:ml(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Qdr,"%Object.getOwnPropertyDescriptor%":m2,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?un:Promise,"%Proxy%":typeof Proxy>"u"?un:Proxy,"%RangeError%":rfr,"%ReferenceError%":nfr,"%Reflect%":typeof Reflect>"u"?un:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?un:Set,"%SetIteratorPrototype%":typeof Set>"u"||!sL||!ml?un:ml(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?un:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":sL&&ml?ml(""[Symbol.iterator]()):un,"%Symbol%":sL?Symbol:un,"%SyntaxError%":cL,"%ThrowTypeError%":pfr,"%TypedArray%":gfr,"%TypeError%":lL,"%Uint8Array%":typeof Uint8Array>"u"?un:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?un:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?un:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?un:Uint32Array,"%URIError%":ofr,"%WeakMap%":typeof WeakMap>"u"?un:WeakMap,"%WeakRef%":typeof WeakRef>"u"?un:WeakRef,"%WeakSet%":typeof WeakSet>"u"?un:WeakSet,"%Function.prototype.call%":g2,"%Function.prototype.apply%":hdt,"%Object.defineProperty%":ffr,"%Object.getPrototypeOf%":hfr,"%Math.abs%":ifr,"%Math.floor%":afr,"%Math.max%":sfr,"%Math.min%":ufr,"%Math.pow%":lfr,"%Math.round%":cfr,"%Math.sign%":dfr,"%Reflect.getPrototypeOf%":mfr};if(ml)try{null.error}catch(e){cdt=ml(ml(e)),TA["%Error.prototype%"]=cdt}var cdt,yfr=function e(t){var r;if(t==="%AsyncFunction%")r=u_e("async function () {}");else if(t==="%GeneratorFunction%")r=u_e("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=u_e("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var o=e("%AsyncGenerator%");o&&ml&&(r=ml(o.prototype))}return TA[t]=r,r},ddt={__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"]},y2=h2(),U7=ldt(),bfr=y2.call(g2,Array.prototype.concat),_fr=y2.call(hdt,Array.prototype.splice),fdt=y2.call(g2,String.prototype.replace),z7=y2.call(g2,String.prototype.slice),vfr=y2.call(g2,RegExp.prototype.exec),wfr=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Sfr=/\\(\\)?/g,xfr=function(t){var r=z7(t,0,1),n=z7(t,-1);if(r==="%"&&n!=="%")throw new cL("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new cL("invalid intrinsic syntax, expected opening `%`");var o=[];return fdt(t,wfr,function(i,a,s,u){o[o.length]=s?fdt(u,Sfr,"$1"):a||i}),o},Cfr=function(t,r){var n=t,o;if(U7(ddt,n)&&(o=ddt[n],n="%"+o[0]+"%"),U7(TA,n)){var i=TA[n];if(i===uL&&(i=yfr(n)),typeof i>"u"&&!r)throw new lL("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new cL("intrinsic "+t+" does not exist!")};mdt.exports=function(t,r){if(typeof t!="string"||t.length===0)throw new lL("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new lL('"allowMissing" argument must be a boolean');if(vfr(/^%?[^%]*%?$/,t)===null)throw new cL("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=xfr(t),o=n.length>0?n[0]:"",i=Cfr("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],_fr(n,bfr([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=z7(f,0,1),h=z7(f,-1);if((p==='"'||p==="'"||p==="`"||h==='"'||h==="'"||h==="`")&&p!==h)throw new cL("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",U7(TA,a))s=TA[a];else if(s!=null){if(!(f in s)){if(!r)throw new lL("base intrinsic for "+t+" exists, but the property is not available.");return}if(m2&&c+1>=n.length){var m=m2(s,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[f]}else d=U7(s,f),s=s[f];d&&!u&&(TA[a]=s)}}return s}});var c_e=b((Rro,bdt)=>{"use strict";var gdt=H7(),ydt=a_e(),Ofr=ydt([gdt("%String.prototype.indexOf%")]);bdt.exports=function(t,r){var n=gdt(t,!!r);return typeof n=="function"&&Ofr(t,".prototype.")>-1?ydt([n]):n}});var d_e=b((Dro,vdt)=>{"use strict";var Efr=H7(),b2=c_e(),Pfr=p2(),Tfr=PA(),_dt=Efr("%Map%",!0),Mfr=b2("Map.prototype.get",!0),Ifr=b2("Map.prototype.set",!0),Afr=b2("Map.prototype.has",!0),Rfr=b2("Map.prototype.delete",!0),Dfr=b2("Map.prototype.size",!0);vdt.exports=!!_dt&&function(){var t,r={assert:function(n){if(!r.has(n))throw new Tfr("Side channel does not contain "+Pfr(n))},delete:function(n){if(t){var o=Rfr(t,n);return Dfr(t)===0&&(t=void 0),o}return!1},get:function(n){if(t)return Mfr(t,n)},has:function(n){return t?Afr(t,n):!1},set:function(n,o){t||(t=new _dt),Ifr(t,n,o)}};return r}});var Sdt=b((jro,wdt)=>{"use strict";var jfr=H7(),W7=c_e(),Nfr=p2(),V7=d_e(),Lfr=PA(),dL=jfr("%WeakMap%",!0),Ffr=W7("WeakMap.prototype.get",!0),kfr=W7("WeakMap.prototype.set",!0),Bfr=W7("WeakMap.prototype.has",!0),$fr=W7("WeakMap.prototype.delete",!0);wdt.exports=dL?function(){var t,r,n={assert:function(o){if(!n.has(o))throw new Lfr("Side channel does not contain "+Nfr(o))},delete:function(o){if(dL&&o&&(typeof o=="object"||typeof o=="function")){if(t)return $fr(t,o)}else if(V7&&r)return r.delete(o);return!1},get:function(o){return dL&&o&&(typeof o=="object"||typeof o=="function")&&t?Ffr(t,o):r&&r.get(o)},has:function(o){return dL&&o&&(typeof o=="object"||typeof o=="function")&&t?Bfr(t,o):!!r&&r.has(o)},set:function(o,i){dL&&o&&(typeof o=="object"||typeof o=="function")?(t||(t=new dL),kfr(t,o,i)):V7&&(r||(r=V7()),r.set(o,i))}};return n}:V7});var Cdt=b((Nro,xdt)=>{"use strict";var qfr=PA(),Ufr=p2(),zfr=Xlt(),Hfr=d_e(),Vfr=Sdt(),Wfr=Vfr||Hfr||zfr;xdt.exports=function(){var t,r={assert:function(n){if(!r.has(n))throw new qfr("Side channel does not contain "+Ufr(n))},delete:function(n){return!!t&&t.delete(n)},get:function(n){return t&&t.get(n)},has:function(n){return!!t&&t.has(n)},set:function(n,o){t||(t=Wfr()),t.set(n,o)}};return r}});var J7=b((Lro,Odt)=>{"use strict";var Jfr=String.prototype.replace,Gfr=/%20/g,f_e={RFC1738:"RFC1738",RFC3986:"RFC3986"};Odt.exports={default:f_e.RFC3986,formatters:{RFC1738:function(e){return Jfr.call(e,Gfr,"+")},RFC3986:function(e){return String(e)}},RFC1738:f_e.RFC1738,RFC3986:f_e.RFC3986}});var h_e=b((Fro,Pdt)=>{"use strict";var Kfr=J7(),p_e=Object.prototype.hasOwnProperty,MA=Array.isArray,ob=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),Yfr=function(t){for(;t.length>1;){var r=t.pop(),n=r.obj[r.prop];if(MA(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},Edt=function(t,r){for(var n=r&&r.plainObjects?Object.create(null):{},o=0;o<t.length;++o)typeof t[o]<"u"&&(n[o]=t[o]);return n},Zfr=function e(t,r,n){if(!r)return t;if(typeof r!="object"){if(MA(t))t.push(r);else if(t&&typeof t=="object")(n&&(n.plainObjects||n.allowPrototypes)||!p_e.call(Object.prototype,r))&&(t[r]=!0);else return[t,r];return t}if(!t||typeof t!="object")return[t].concat(r);var o=t;return MA(t)&&!MA(r)&&(o=Edt(t,n)),MA(t)&&MA(r)?(r.forEach(function(i,a){if(p_e.call(t,a)){var s=t[a];s&&typeof s=="object"&&i&&typeof i=="object"?t[a]=e(s,i,n):t.push(i)}else t[a]=i}),t):Object.keys(r).reduce(function(i,a){var s=r[a];return p_e.call(i,a)?i[a]=e(i[a],s,n):i[a]=s,i},o)},Xfr=function(t,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},t)},Qfr=function(e,t,r){var n=e.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},epr=function(t,r,n,o,i){if(t.length===0)return t;var a=t;if(typeof t=="symbol"?a=Symbol.prototype.toString.call(t):typeof t!="string"&&(a=String(t)),n==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var s="",u=0;u<a.length;++u){var l=a.charCodeAt(u);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===Kfr.RFC1738&&(l===40||l===41)){s+=a.charAt(u);continue}if(l<128){s=s+ob[l];continue}if(l<2048){s=s+(ob[192|l>>6]+ob[128|l&63]);continue}if(l<55296||l>=57344){s=s+(ob[224|l>>12]+ob[128|l>>6&63]+ob[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|a.charCodeAt(u)&1023),s+=ob[240|l>>18]+ob[128|l>>12&63]+ob[128|l>>6&63]+ob[128|l&63]}return s},tpr=function(t){for(var r=[{obj:{o:t},prop:"o"}],n=[],o=0;o<r.length;++o)for(var i=r[o],a=i.obj[i.prop],s=Object.keys(a),u=0;u<s.length;++u){var l=s[u],c=a[l];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(r.push({obj:a,prop:l}),n.push(c))}return Yfr(r),t},rpr=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},npr=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},opr=function(t,r){return[].concat(t,r)},ipr=function(t,r){if(MA(t)){for(var n=[],o=0;o<t.length;o+=1)n.push(r(t[o]));return n}return r(t)};Pdt.exports={arrayToObject:Edt,assign:Xfr,combine:opr,compact:tpr,decode:Qfr,encode:epr,isBuffer:npr,isRegExp:rpr,maybeMap:ipr,merge:Zfr}});var Ddt=b((kro,Rdt)=>{"use strict";var Idt=Cdt(),G7=h_e(),_2=J7(),apr=Object.prototype.hasOwnProperty,Tdt={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,r){return t+"["+r+"]"},repeat:function(t){return t}},xx=Array.isArray,spr=Array.prototype.push,Adt=function(e,t){spr.apply(e,xx(t)?t:[t])},upr=Date.prototype.toISOString,Mdt=_2.default,Zc={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:G7.encode,encodeValuesOnly:!1,format:Mdt,formatter:_2.formatters[Mdt],indices:!1,serializeDate:function(t){return upr.call(t)},skipNulls:!1,strictNullHandling:!1},lpr=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},m_e={},cpr=function e(t,r,n,o,i,a,s,u,l,c,d,f,p,h,m,_){for(var g=t,v=_,S=0,x=!1;(v=v.get(m_e))!==void 0&&!x;){var O=v.get(t);if(S+=1,typeof O<"u"){if(O===S)throw new RangeError("Cyclic object value");x=!0}typeof v.get(m_e)>"u"&&(S=0)}if(typeof u=="function"?g=u(r,g):g instanceof Date?g=d(g):n==="comma"&&xx(g)&&(g=G7.maybeMap(g,function(U){return U instanceof Date?d(U):U})),g===null){if(i)return s&&!h?s(r,Zc.encoder,m,"key",f):r;g=""}if(lpr(g)||G7.isBuffer(g)){if(s){var T=h?r:s(r,Zc.encoder,m,"key",f);return[p(T)+"="+p(s(g,Zc.encoder,m,"value",f))]}return[p(r)+"="+p(String(g))]}var E=[];if(typeof g>"u")return E;var M;if(n==="comma"&&xx(g))h&&s&&(g=G7.maybeMap(g,s)),M=[{value:g.length>0?g.join(",")||null:void 0}];else if(xx(u))M=u;else{var A=Object.keys(g);M=l?A.sort(l):A}for(var j=o&&xx(g)&&g.length===1?r+"[]":r,N=0;N<M.length;++N){var F=M[N],k=typeof F=="object"&&typeof F.value<"u"?F.value:g[F];if(!(a&&k===null)){var L=xx(g)?typeof n=="function"?n(j,F):j:j+(c?"."+F:"["+F+"]");_.set(t,S);var q=Idt();q.set(m_e,_),Adt(E,e(k,L,n,o,i,a,n==="comma"&&h&&xx(g)?null:s,u,l,c,d,f,p,h,m,q))}}return E},dpr=function(t){if(!t)return Zc;if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=t.charset||Zc.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=_2.default;if(typeof t.format<"u"){if(!apr.call(_2.formatters,t.format))throw new TypeError("Unknown format option provided.");n=t.format}var o=_2.formatters[n],i=Zc.filter;return(typeof t.filter=="function"||xx(t.filter))&&(i=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Zc.addQueryPrefix,allowDots:typeof t.allowDots>"u"?Zc.allowDots:!!t.allowDots,charset:r,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Zc.charsetSentinel,delimiter:typeof t.delimiter>"u"?Zc.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Zc.encode,encoder:typeof t.encoder=="function"?t.encoder:Zc.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Zc.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Zc.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Zc.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Zc.strictNullHandling}};Rdt.exports=function(e,t){var r=e,n=dpr(t),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):xx(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s;t&&t.arrayFormat in Tdt?s=t.arrayFormat:t&&"indices"in t?s=t.indices?"indices":"repeat":s="indices";var u=Tdt[s];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=u==="comma"&&t&&t.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);for(var c=Idt(),d=0;d<o.length;++d){var f=o[d];n.skipNulls&&r[f]===null||Adt(a,cpr(r[f],f,u,l,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,c))}var p=a.join(n.delimiter),h=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),p.length>0?h+p:""}});var Ldt=b((Bro,Ndt)=>{"use strict";var fL=h_e(),g_e=Object.prototype.hasOwnProperty,fpr=Array.isArray,gl={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:fL.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},ppr=function(e){return e.replace(/&#(\d+);/g,function(t,r){return String.fromCharCode(parseInt(r,10))})},jdt=function(e,t){return e&&typeof e=="string"&&t.comma&&e.indexOf(",")>-1?e.split(","):e},hpr="utf8=%26%2310003%3B",mpr="utf8=%E2%9C%93",gpr=function(t,r){var n={__proto__:null},o=r.ignoreQueryPrefix?t.replace(/^\?/,""):t,i=r.parameterLimit===1/0?void 0:r.parameterLimit,a=o.split(r.delimiter,i),s=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u<a.length;++u)a[u].indexOf("utf8=")===0&&(a[u]===mpr?l="utf-8":a[u]===hpr&&(l="iso-8859-1"),s=u,u=a.length);for(u=0;u<a.length;++u)if(u!==s){var c=a[u],d=c.indexOf("]="),f=d===-1?c.indexOf("="):d+1,p,h;f===-1?(p=r.decoder(c,gl.decoder,l,"key"),h=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),gl.decoder,l,"key"),h=fL.maybeMap(jdt(c.slice(f+1),r),function(m){return r.decoder(m,gl.decoder,l,"value")})),h&&r.interpretNumericEntities&&l==="iso-8859-1"&&(h=ppr(h)),c.indexOf("[]=")>-1&&(h=fpr(h)?[h]:h),g_e.call(n,p)?n[p]=fL.combine(n[p],h):n[p]=h}return n},ypr=function(e,t,r,n){for(var o=n?t:jdt(t,r),i=e.length-1;i>=0;--i){var a,s=e[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},bpr=function(t,r,n,o){if(t){var i=n.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,u=n.depth>0&&a.exec(i),l=u?i.slice(0,u.index):i,c=[];if(l){if(!n.plainObjects&&g_e.call(Object.prototype,l)&&!n.allowPrototypes)return;c.push(l)}for(var d=0;n.depth>0&&(u=s.exec(i))!==null&&d<n.depth;){if(d+=1,!n.plainObjects&&g_e.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(u[1])}return u&&c.push("["+i.slice(u.index)+"]"),ypr(c,r,n,o)}},_pr=function(t){if(!t)return gl;if(t.decoder!==null&&t.decoder!==void 0&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=typeof t.charset>"u"?gl.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?gl.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:gl.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:gl.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:gl.arrayLimit,charset:r,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:gl.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:gl.comma,decoder:typeof t.decoder=="function"?t.decoder:gl.decoder,delimiter:typeof t.delimiter=="string"||fL.isRegExp(t.delimiter)?t.delimiter:gl.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:gl.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:gl.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:gl.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:gl.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:gl.strictNullHandling}};Ndt.exports=function(e,t){var r=_pr(t);if(e===""||e===null||typeof e>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof e=="string"?gpr(e,r):e,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=bpr(s,n[s],r,typeof e=="string");o=fL.merge(o,u,r)}return r.allowSparse===!0?o:fL.compact(o)}});var kdt=b(($ro,Fdt)=>{"use strict";var vpr=Ddt(),wpr=Ldt(),Spr=J7();Fdt.exports={formats:Spr,parse:wpr,stringify:vpr}});var Bdt=b(pL=>{"use strict";var xpr=pL&&pL.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pL,"__esModule",{value:!0});pL.createRequestUrl=void 0;var Cpr=xpr(kdt());function Opr(e,t){return Object.keys(t??{}).length>0?`${e}?${Cpr.default.stringify(t,{arrayFormat:"repeat"})}`:e}pL.createRequestUrl=Opr});var Udt=b(K7=>{"use strict";var y_e,b_e,__e,v_e,w_e;Object.defineProperty(K7,"__esModule",{value:!0});K7.RUNTIME=void 0;var Epr=typeof window<"u"&&typeof window.document<"u",Ppr=typeof self=="object"&&typeof self?.importScripts=="function"&&(((y_e=self.constructor)===null||y_e===void 0?void 0:y_e.name)==="DedicatedWorkerGlobalScope"||((b_e=self.constructor)===null||b_e===void 0?void 0:b_e.name)==="ServiceWorkerGlobalScope"||((__e=self.constructor)===null||__e===void 0?void 0:__e.name)==="SharedWorkerGlobalScope"),$dt=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",qdt=typeof Bun<"u"&&typeof Bun.version<"u",Tpr=typeof process<"u"&&!!process.version&&!!(!((v_e=process.versions)===null||v_e===void 0)&&v_e.node)&&!$dt&&!qdt,Mpr=typeof navigator<"u"&&navigator?.product==="ReactNative",Ipr=typeof globalThis<"u"&&((w_e=globalThis?.navigator)===null||w_e===void 0?void 0:w_e.userAgent)==="Cloudflare-Workers";K7.RUNTIME=Apr();function Apr(){return Epr?{type:"browser",version:window.navigator.userAgent}:Ipr?{type:"workerd"}:Ppr?{type:"web-worker"}:$dt?{type:"deno",version:Deno.version.deno}:qdt?{type:"bun",version:Bun.version}:Tpr?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:Mpr?{type:"react-native"}:{type:"unknown"}}});var hL=b(Y7=>{"use strict";Object.defineProperty(Y7,"__esModule",{value:!0});Y7.RUNTIME=void 0;var Rpr=Udt();Object.defineProperty(Y7,"RUNTIME",{enumerable:!0,get:function(){return Rpr.RUNTIME}})});var S_e=b((mL,zdt)=>{"use strict";var Dpr=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},IA=Dpr();zdt.exports=mL=IA.fetch;IA.fetch&&(mL.default=IA.fetch.bind(IA));mL.Headers=IA.Headers;mL.Request=IA.Request;mL.Response=IA.Response});var Vdt=b(Ah=>{"use strict";var jpr=Ah&&Ah.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Npr=Ah&&Ah.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Hdt=Ah&&Ah.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&jpr(t,e,r);return Npr(t,e),t},Lpr=Ah&&Ah.__awaiter||function(e,t,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(e,t||[])).next())})};Object.defineProperty(Ah,"__esModule",{value:!0});Ah.getFetchFn=void 0;var Z7=hL();function Fpr(){return Lpr(this,void 0,void 0,function*(){return Z7.RUNTIME.type==="node"&&Z7.RUNTIME.parsedVersion!=null&&Z7.RUNTIME.parsedVersion>=18?fetch:Z7.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>Hdt(S_e()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>Hdt(S_e()))).default})}Ah.getFetchFn=Fpr});var Wdt=b(gL=>{"use strict";var kpr=gL&&gL.__awaiter||function(e,t,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(e,t||[])).next())})};Object.defineProperty(gL,"__esModule",{value:!0});gL.getRequestBody=void 0;function Bpr({body:e,type:t}){return kpr(this,void 0,void 0,function*(){return t.includes("json")?JSON.stringify(e):e})}gL.getRequestBody=Bpr});var Jdt=b(yL=>{"use strict";var ug=yL&&yL.__awaiter||function(e,t,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(e,t||[])).next())})};Object.defineProperty(yL,"__esModule",{value:!0});yL.Node18UniversalStreamWrapper=void 0;var x_e=class e{constructor(t){this.readableStream=t,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(t,r){var n;(n=this.events[t])===null||n===void 0||n.push(r)}off(t,r){var n;this.events[t]=(n=this.events[t])===null||n===void 0?void 0:n.filter(o=>o!==r)}pipe(t){return this.on("data",r=>ug(this,void 0,void 0,function*(){if(t instanceof e)t._write(r);else if(t instanceof WritableStream){let n=t.getWriter();n.write(r).then(()=>n.releaseLock())}else t.write(r)})),this.on("end",()=>ug(this,void 0,void 0,function*(){t instanceof e?t._end():t instanceof WritableStream?t.getWriter().close():t.end()})),this.on("error",r=>ug(this,void 0,void 0,function*(){t instanceof e?t._error(r):t instanceof WritableStream?t.getWriter().abort(r):t.destroy(r)})),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",r=>ug(this,void 0,void 0,function*(){if(t instanceof e)t._write(r);else if(t instanceof WritableStream){let n=t.getWriter();n.write(r).then(()=>n.releaseLock())}else t.write(r)})),this.off("end",()=>ug(this,void 0,void 0,function*(){t instanceof e?t._end():t instanceof WritableStream?t.getWriter().close():t.end()})),this.off("error",r=>ug(this,void 0,void 0,function*(){t instanceof e?t._error(r):t instanceof WritableStream?t.getWriter().abort(r):t.destroy(r)}))}destroy(t){this.reader.cancel(t).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 ug(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:t,value:r}=yield this.reader.read();if(!t)return r})}setEncoding(t){this.encoding=t}text(){return ug(this,void 0,void 0,function*(){let t=[];for(;;){let{done:n,value:o}=yield this.reader.read();if(n)break;o&&t.push(o)}return new TextDecoder(this.encoding||"utf-8").decode(yield new Blob(t).arrayBuffer())})}json(){return ug(this,void 0,void 0,function*(){let t=yield this.text();return JSON.parse(t)})}_write(t){this._emit("data",t)}_end(){this._emit("end")}_error(t){this._emit("error",t)}_emit(t,r){if(this.events[t])for(let n of this.events[t]||[])n(r)}_startReading(){return ug(this,void 0,void 0,function*(){try{for(this._emit("readable");;){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:t,value:r}=yield this.reader.read();if(t){this._emit("end"),this._emit("close");break}r&&this._emit("data",r)}}catch(t){this._emit("error",t)}})}[Symbol.asyncIterator](){return{next:()=>ug(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:t,value:r}=yield this.reader.read();return t?{done:!0,value:void 0}:{done:!1,value:r}}),[Symbol.asyncIterator](){return this}}}};yL.Node18UniversalStreamWrapper=x_e});var Gdt=b(bL=>{"use strict";var v2=bL&&bL.__awaiter||function(e,t,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(e,t||[])).next())})};Object.defineProperty(bL,"__esModule",{value:!0});bL.UndiciStreamWrapper=void 0;var C_e=class e{constructor(t){this.readableStream=t,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(t,r){var n;(n=this.events[t])===null||n===void 0||n.push(r)}off(t,r){var n;this.events[t]=(n=this.events[t])===null||n===void 0?void 0:n.filter(o=>o!==r)}pipe(t){return this.on("data",r=>{if(t instanceof e)t._write(r);else{let n=t.getWriter();n.write(r).then(()=>n.releaseLock())}}),this.on("end",()=>{t instanceof e?t._end():t.getWriter().close()}),this.on("error",r=>{t instanceof e?t._error(r):t.getWriter().abort(r)}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",r=>{if(t instanceof e)t._write(r);else{let n=t.getWriter();n.write(r).then(()=>n.releaseLock())}}),this.off("end",()=>{t instanceof e?t._end():t.getWriter().close()}),this.off("error",r=>{t instanceof e?t._error(r):t.getWriter().abort(r)})}destroy(t){this.reader.cancel(t).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 v2(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:t,value:r}=yield this.reader.read();if(!t)return r})}setEncoding(t){this.encoding=t}text(){return v2(this,void 0,void 0,function*(){let t=[];for(;;){let{done:n,value:o}=yield this.reader.read();if(n)break;o&&t.push(o)}return new TextDecoder(this.encoding||"utf-8").decode(yield new Blob(t).arrayBuffer())})}json(){return v2(this,void 0,void 0,function*(){let t=yield this.text();return JSON.parse(t)})}_write(t){this._emit("data",t)}_end(){this._emit("end")}_error(t){this._emit("error",t)}_emit(t,r){if(this.events[t])for(let n of this.events[t]||[])n(r)}_startReading(){return v2(this,void 0,void 0,function*(){try{for(this._emit("readable");;){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:t,value:r}=yield this.reader.read();if(t){this._emit("end"),this._emit("close");break}r&&this._emit("data",r)}}catch(t){this._emit("error",t)}})}[Symbol.asyncIterator](){return{next:()=>v2(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:t,value:r}=yield this.reader.read();return t?{done:!0,value:void 0}:{done:!1,value:r}}),[Symbol.asyncIterator](){return this}}}};bL.UndiciStreamWrapper=C_e});var Kdt=b(ZE=>{"use strict";var X7=ZE&&ZE.__awaiter||function(e,t,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(e,t||[])).next())})},$pr=ZE&&ZE.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values=="function"?__values(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,u){a=e[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(ZE,"__esModule",{value:!0});ZE.NodePre18StreamWrapper=void 0;var O_e=class{constructor(t){this.readableStream=t}on(t,r){this.readableStream.on(t,r)}off(t,r){this.readableStream.off(t,r)}pipe(t){return this.readableStream.pipe(t),t}pipeTo(t){return this.pipe(t)}unpipe(t){t?this.readableStream.unpipe(t):this.readableStream.unpipe()}destroy(t){this.readableStream.destroy(t)}pause(){this.readableStream.pause()}resume(){this.readableStream.resume()}get isPaused(){return this.readableStream.isPaused()}read(){return X7(this,void 0,void 0,function*(){return new Promise((t,r)=>{let n=this.readableStream.read();n?t(n):(this.readableStream.once("readable",()=>{let o=this.readableStream.read();t(o)}),this.readableStream.once("error",r))})})}setEncoding(t){this.readableStream.setEncoding(t),this.encoding=t}text(){var t,r;return X7(this,void 0,void 0,function*(){let n=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var i=$pr(this.readableStream),a;a=yield i.next(),!a.done;){let u=a.value;n.push(o.encode(u))}}catch(u){t={error:u}}finally{try{a&&!a.done&&(r=i.return)&&(yield r.call(i))}finally{if(t)throw t.error}}return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(n))})}json(){return X7(this,void 0,void 0,function*(){let t=yield this.text();return JSON.parse(t)})}[Symbol.asyncIterator](){let r=this.readableStream[Symbol.asyncIterator]();return{next(){return X7(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};ZE.NodePre18StreamWrapper=O_e});var Ydt=b(Rh=>{"use strict";var qpr=Rh&&Rh.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Upr=Rh&&Rh.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),E_e=Rh&&Rh.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&qpr(t,e,r);return Upr(t,e),t},zpr=Rh&&Rh.__awaiter||function(e,t,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(e,t||[])).next())})};Object.defineProperty(Rh,"__esModule",{value:!0});Rh.chooseStreamWrapper=void 0;var Q7=hL();function Hpr(e){return zpr(this,void 0,void 0,function*(){return Q7.RUNTIME.type==="node"&&Q7.RUNTIME.parsedVersion!=null&&Q7.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>E_e(Jdt()))).Node18UniversalStreamWrapper(e):Q7.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>E_e(Gdt()))).UndiciStreamWrapper(e):new(yield Promise.resolve().then(()=>E_e(Kdt()))).NodePre18StreamWrapper(e)})}Rh.chooseStreamWrapper=Hpr});var Zdt=b(_L=>{"use strict";var Vpr=_L&&_L.__awaiter||function(e,t,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(e,t||[])).next())})};Object.defineProperty(_L,"__esModule",{value:!0});_L.getResponseBody=void 0;var Wpr=Ydt();function Jpr(e,t){return Vpr(this,void 0,void 0,function*(){if(e.body!=null&&t==="blob")return yield e.blob();if(e.body!=null&&t==="sse")return e.body;if(e.body!=null&&t==="streaming")return(0,Wpr.chooseStreamWrapper)(e.body);if(e.body!=null&&t==="text")return yield e.text();{let r=yield e.text();if(r.length>0)try{return JSON.parse(r)}catch{return{ok:!1,error:{reason:"non-json",statusCode:e.status,rawBody:r}}}else return}})}_L.getResponseBody=Jpr});var Xdt=b(vL=>{"use strict";Object.defineProperty(vL,"__esModule",{value:!0});vL.anySignal=vL.getTimeoutSignal=void 0;var Gpr="timeout";function Kpr(e){let t=new AbortController,r=setTimeout(()=>t.abort(Gpr),e);return{signal:t.signal,abortId:r}}vL.getTimeoutSignal=Kpr;function Ypr(...e){let t=e.length===1&&Array.isArray(e[0])?e[0]:e,r=new AbortController;for(let n of t){if(n.aborted){r.abort(n?.reason);break}n.addEventListener("abort",()=>r.abort(n?.reason),{signal:r.signal})}return r.signal}vL.anySignal=Ypr});var eft=b(wL=>{"use strict";var Zpr=wL&&wL.__awaiter||function(e,t,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(e,t||[])).next())})};Object.defineProperty(wL,"__esModule",{value:!0});wL.makeRequest=void 0;var Qdt=Xdt(),Xpr=(e,t,r,n,o,i,a,s,u)=>Zpr(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:h}=(0,Qdt.getTimeoutSignal)(i);c=h,l.push(p)}a!=null&&l.push(a);let d=(0,Qdt.anySignal)(l),f=yield e(t,{method:r,headers:n,body:o,signal:d,credentials:s?"include":void 0,duplex:u});return c!=null&&clearTimeout(c),f});wL.makeRequest=Xpr});var tft=b(SL=>{"use strict";var Qpr=SL&&SL.__awaiter||function(e,t,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(e,t||[])).next())})};Object.defineProperty(SL,"__esModule",{value:!0});SL.requestWithRetries=void 0;var ehr=1,thr=60,rhr=2;function nhr(e,t=rhr){return Qpr(this,void 0,void 0,function*(){let r=yield e();for(let n=0;n<t&&([408,409,429].includes(r.status)||r.status>=500);++n){let o=Math.min(ehr*Math.pow(2,n),thr);yield new Promise(i=>setTimeout(i,o)),r=yield e()}return r})}SL.requestWithRetries=nhr});var oft=b(XE=>{"use strict";var rft=XE&&XE.__awaiter||function(e,t,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(e,t||[])).next())})};Object.defineProperty(XE,"__esModule",{value:!0});XE.fetcher=XE.fetcherImpl=void 0;var ohr=Bdt(),ihr=Vdt(),ahr=Wdt(),shr=Zdt(),uhr=eft(),lhr=tft();function nft(e){return rft(this,void 0,void 0,function*(){let t={};if(e.body!==void 0&&e.contentType!=null&&(t["Content-Type"]=e.contentType),e.headers!=null)for(let[i,a]of Object.entries(e.headers))a!=null&&(t[i]=a);let r=(0,ohr.createRequestUrl)(e.url,e.queryParameters),n=yield(0,ahr.getRequestBody)({body:e.body,type:e.requestType==="json"?"json":"other"}),o=yield(0,ihr.getFetchFn)();try{let i=yield(0,lhr.requestWithRetries)(()=>rft(this,void 0,void 0,function*(){return(0,uhr.makeRequest)(o,r,e.method,t,n,e.timeoutMs,e.abortSignal,e.withCredentials,e.duplex)}),e.maxRetries),a=yield(0,shr.getResponseBody)(i,e.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 e.abortSignal!=null&&e.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)}}}})}XE.fetcherImpl=nft;XE.fetcher=nft});var ift=b(eY=>{"use strict";Object.defineProperty(eY,"__esModule",{value:!0});eY.getHeader=void 0;function chr(e,t){for(let[r,n]of Object.entries(e))if(r.toLowerCase()===t.toLowerCase())return n}eY.getHeader=chr});var aft=b(xL=>{"use strict";var dhr=xL&&xL.__awaiter||function(e,t,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(e,t||[])).next())})};Object.defineProperty(xL,"__esModule",{value:!0});xL.Supplier=void 0;xL.Supplier={get:e=>dhr(void 0,void 0,void 0,function*(){return typeof e=="function"?e():e})}});var sft=b(QE=>{"use strict";Object.defineProperty(QE,"__esModule",{value:!0});QE.Supplier=QE.getHeader=QE.fetcher=void 0;var fhr=oft();Object.defineProperty(QE,"fetcher",{enumerable:!0,get:function(){return fhr.fetcher}});var phr=ift();Object.defineProperty(QE,"getHeader",{enumerable:!0,get:function(){return phr.getHeader}});var hhr=aft();Object.defineProperty(QE,"Supplier",{enumerable:!0,get:function(){return hhr.Supplier}})});var uft=b((P_e,T_e)=>{(function(e,t){typeof P_e=="object"&&typeof T_e<"u"?T_e.exports=t():typeof define=="function"&&define.amd?define(t):function(){var r=e.Base64,n=t();n.noConflict=function(){return e.Base64=r,n},e.Meteor&&(Base64=n),e.Base64=n}()})(typeof self<"u"?self:typeof window<"u"||typeof window<"u"?window:P_e,function(){"use strict";var e="3.7.2",t=e,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(Z){var X={};return Z.forEach(function(ne,Pe){return X[ne]=Pe}),X}(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(Z,X){return X===void 0&&(X=function(ne){return ne}),new Uint8Array(Array.prototype.slice.call(Z,0).map(X))},p=function(Z){return Z.replace(/=/g,"").replace(/[+\/]/g,function(X){return X=="+"?"-":"_"})},h=function(Z){return Z.replace(/[^A-Za-z0-9\+\/]/g,"")},m=function(Z){for(var X,ne,Pe,ht,we="",ae=Z.length%3,ee=0;ee<Z.length;){if((ne=Z.charCodeAt(ee++))>255||(Pe=Z.charCodeAt(ee++))>255||(ht=Z.charCodeAt(ee++))>255)throw new TypeError("invalid character found");X=ne<<16|Pe<<8|ht,we+=u[X>>18&63]+u[X>>12&63]+u[X>>6&63]+u[X&63]}return ae?we.slice(0,ae-3)+"===".substring(ae):we},_=n?function(Z){return btoa(Z)}:o?function(Z){return Buffer.from(Z,"binary").toString("base64")}:m,g=o?function(Z){return Buffer.from(Z).toString("base64")}:function(Z){for(var X=4096,ne=[],Pe=0,ht=Z.length;Pe<ht;Pe+=X)ne.push(d.apply(null,Z.subarray(Pe,Pe+X)));return _(ne.join(""))},v=function(Z,X){return X===void 0&&(X=!1),X?p(g(Z)):g(Z)},S=function(Z){if(Z.length<2){var X=Z.charCodeAt(0);return X<128?Z:X<2048?d(192|X>>>6)+d(128|X&63):d(224|X>>>12&15)+d(128|X>>>6&63)+d(128|X&63)}else{var X=65536+(Z.charCodeAt(0)-55296)*1024+(Z.charCodeAt(1)-56320);return d(240|X>>>18&7)+d(128|X>>>12&63)+d(128|X>>>6&63)+d(128|X&63)}},x=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,O=function(Z){return Z.replace(x,S)},T=o?function(Z){return Buffer.from(Z,"utf8").toString("base64")}:a?function(Z){return g(a.encode(Z))}:function(Z){return _(O(Z))},E=function(Z,X){return X===void 0&&(X=!1),X?p(T(Z)):T(Z)},M=function(Z){return E(Z,!0)},A=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,j=function(Z){switch(Z.length){case 4:var X=(7&Z.charCodeAt(0))<<18|(63&Z.charCodeAt(1))<<12|(63&Z.charCodeAt(2))<<6|63&Z.charCodeAt(3),ne=X-65536;return d((ne>>>10)+55296)+d((ne&1023)+56320);case 3:return d((15&Z.charCodeAt(0))<<12|(63&Z.charCodeAt(1))<<6|63&Z.charCodeAt(2));default:return d((31&Z.charCodeAt(0))<<6|63&Z.charCodeAt(1))}},N=function(Z){return Z.replace(A,j)},F=function(Z){if(Z=Z.replace(/\s+/g,""),!c.test(Z))throw new TypeError("malformed base64.");Z+="==".slice(2-(Z.length&3));for(var X,ne="",Pe,ht,we=0;we<Z.length;)X=l[Z.charAt(we++)]<<18|l[Z.charAt(we++)]<<12|(Pe=l[Z.charAt(we++)])<<6|(ht=l[Z.charAt(we++)]),ne+=Pe===64?d(X>>16&255):ht===64?d(X>>16&255,X>>8&255):d(X>>16&255,X>>8&255,X&255);return ne},k=r?function(Z){return atob(h(Z))}:o?function(Z){return Buffer.from(Z,"base64").toString("binary")}:F,L=o?function(Z){return f(Buffer.from(Z,"base64"))}:function(Z){return f(k(Z),function(X){return X.charCodeAt(0)})},q=function(Z){return L(G(Z))},U=o?function(Z){return Buffer.from(Z,"base64").toString("utf8")}:i?function(Z){return i.decode(L(Z))}:function(Z){return N(k(Z))},G=function(Z){return h(Z.replace(/[-_]/g,function(X){return X=="-"?"+":"/"}))},V=function(Z){return U(G(Z))},D=function(Z){if(typeof Z!="string")return!1;var X=Z.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(X)||!/[^\s0-9a-zA-Z\-_]/.test(X)},z=function(Z){return{value:Z,enumerable:!1,writable:!0,configurable:!0}},W=function(){var Z=function(X,ne){return Object.defineProperty(String.prototype,X,z(ne))};Z("fromBase64",function(){return V(this)}),Z("toBase64",function(X){return E(this,X)}),Z("toBase64URI",function(){return E(this,!0)}),Z("toBase64URL",function(){return E(this,!0)}),Z("toUint8Array",function(){return q(this)})},J=function(){var Z=function(X,ne){return Object.defineProperty(Uint8Array.prototype,X,z(ne))};Z("toBase64",function(X){return v(this,X)}),Z("toBase64URI",function(){return v(this,!0)}),Z("toBase64URL",function(){return v(this,!0)})},te=function(){W(),J()},Ie={version:e,VERSION:t,atob:k,atobPolyfill:F,btoa:_,btoaPolyfill:m,fromBase64:V,toBase64:E,encode:E,encodeURI:M,encodeURL:M,utob:O,btou:N,decode:V,isValid:D,fromUint8Array:v,toUint8Array:q,extendString:W,extendUint8Array:J,extendBuiltins:te};return Ie.Base64={},Object.keys(Ie).forEach(function(Z){return Ie.Base64[Z]=Ie[Z]}),Ie})});var cft=b(tY=>{"use strict";Object.defineProperty(tY,"__esModule",{value:!0});tY.BasicAuth=void 0;var lft=uft(),mhr=/^Basic /i;tY.BasicAuth={toAuthorizationHeader:e=>e==null?void 0:`Basic ${lft.Base64.encode(`${e.username}:${e.password}`)}`,fromAuthorizationHeader:e=>{let t=e.replace(mhr,""),r=lft.Base64.decode(t),[n,o]=r.split(":",2);if(n==null||o==null)throw new Error("Invalid basic auth");return{username:n,password:o}}}});var dft=b(rY=>{"use strict";Object.defineProperty(rY,"__esModule",{value:!0});rY.BearerToken=void 0;var ghr=/^Bearer /i;rY.BearerToken={toAuthorizationHeader:e=>{if(e!=null)return`Bearer ${e}`},fromAuthorizationHeader:e=>e.replace(ghr,"").trim()}});var fft=b(CL=>{"use strict";Object.defineProperty(CL,"__esModule",{value:!0});CL.BearerToken=CL.BasicAuth=void 0;var yhr=cft();Object.defineProperty(CL,"BasicAuth",{enumerable:!0,get:function(){return yhr.BasicAuth}});var bhr=dft();Object.defineProperty(CL,"BearerToken",{enumerable:!0,get:function(){return bhr.BearerToken}})});var I_e=b(_f=>{"use strict";var pft=_f&&_f.__awaiter||function(e,t,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(e,t||[])).next())})},hft=_f&&_f.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values=="function"?__values(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,u){a=e[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)}},lg=_f&&_f.__await||function(e){return this instanceof lg?(this.v=e,this):new lg(e)},mft=_f&&_f.__asyncGenerator||function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof lg?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(_f,"__esModule",{value:!0});_f.readableStreamAsyncIterable=_f.Stream=void 0;var _hr=hL(),vhr="data:",M_e=class{constructor({stream:t,parse:r,eventShape:n,signal:o}){this.controller=new AbortController,this.stream=t,this.parse=r,n.type==="sse"?(this.prefix=vhr,this.messageTerminator=`
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return mft(this,arguments,function*(){var r,n;this.controller.signal;let o=gft(this.stream),i="",a=!1;try{for(var s=hft(o),u;u=yield lg(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 lg(void 0);let f=yield lg(this.parse(JSON.parse(d)));yield yield lg(f),a=!1}}}catch(l){r={error:l}}finally{try{u&&!u.done&&(n=s.return)&&(yield lg(n.call(s)))}finally{if(r)throw r.error}}})}[Symbol.asyncIterator](){return mft(this,arguments,function*(){var r,n;try{for(var o=hft(this.iterMessages()),i;i=yield lg(o.next()),!i.done;){let a=i.value;yield yield lg(a)}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&(yield lg(n.call(o)))}finally{if(r)throw r.error}}})}decodeChunk(t){let r="";if(typeof TextDecoder<"u"){let n=new TextDecoder("utf8");r+=n.decode(t)}else _hr.RUNTIME.type==="node"&&typeof t<"u"&&(r+=Buffer.isBuffer(t)?t:Buffer.from(t));return r}};_f.Stream=M_e;function gft(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{next(){return pft(this,void 0,void 0,function*(){try{let r=yield t.read();return r?.done&&t.releaseLock(),r}catch(r){throw t.releaseLock(),r}})},return(){return pft(this,void 0,void 0,function*(){let r=t.cancel();return t.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}_f.readableStreamAsyncIterable=gft});var yft=b(nY=>{"use strict";Object.defineProperty(nY,"__esModule",{value:!0});nY.Stream=void 0;var whr=I_e();Object.defineProperty(nY,"Stream",{enumerable:!0,get:function(){return whr.Stream}})});var vft=b((lno,_ft)=>{"use strict";var A_e=Object.defineProperty,Shr=Object.getOwnPropertyDescriptor,xhr=Object.getOwnPropertyNames,Chr=Object.prototype.hasOwnProperty,Ohr=(e,t)=>{for(var r in t)A_e(e,r,{get:t[r],enumerable:!0})},Ehr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xhr(t))!Chr.call(e,o)&&o!==r&&A_e(e,o,{get:()=>t[o],enumerable:!(n=Shr(t,o))||n.enumerable});return e},Phr=e=>Ehr(A_e({},"__esModule",{value:!0}),e),bft={};Ohr(bft,{Blob:()=>Ihr,File:()=>Ahr,FormData:()=>Mhr});_ft.exports=Phr(bft);var Thr=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:Mhr,Blob:Ihr,File:Ahr}=Thr});var Dft=b((cno,Rft)=>{"use strict";var j_e=Object.defineProperty,Rhr=Object.getOwnPropertyDescriptor,Dhr=Object.getOwnPropertyNames,jhr=Object.prototype.hasOwnProperty,Nhr=(e,t)=>{for(var r in t)j_e(e,r,{get:t[r],enumerable:!0})},Lhr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Dhr(t))!jhr.call(e,o)&&o!==r&&j_e(e,o,{get:()=>t[o],enumerable:!(n=Rhr(t,o))||n.enumerable});return e},Fhr=e=>Lhr(j_e({},"__esModule",{value:!0}),e),N_e=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ia=(e,t,r)=>(N_e(e,t,"read from private field"),r?r.call(e):t.get(e)),ib=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},w2=(e,t,r,n)=>(N_e(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),R_e=(e,t,r)=>(N_e(e,t,"access private method"),r),Pft={};Nhr(Pft,{FormDataEncoder:()=>Vhr,isFile:()=>RA,isFormData:()=>Ift});Rft.exports=Fhr(Pft);var Cx=e=>typeof e=="function",khr=e=>Cx(e[Symbol.asyncIterator]),wft=65536;function*Tft(e){if(e.byteLength<=wft){yield e;return}let t=0;for(;t<e.byteLength;){let r=Math.min(e.byteLength-t,wft),n=e.buffer.slice(t,t+r);t+=n.byteLength,yield new Uint8Array(n)}}async function*Bhr(e){let t=e.getReader();for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}async function*Sft(e){for await(let t of e)yield*Tft(t)}var $hr=e=>{if(khr(e))return Sft(e);if(Cx(e.getReader))return Sft(Bhr(e));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},xft="abcdefghijklmnopqrstuvwxyz0123456789";function qhr(){let e=16,t="";for(;e--;)t+=xft[Math.random()*xft.length<<0];return t}var Mft=e=>String(e).replace(/\r|\n/g,(t,r,n)=>t==="\r"&&n[r+1]!==`
`||t===`
`&&n[r-1]!=="\r"?`\r
`:t),Uhr=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase();function Cft(e){if(Uhr(e)!=="object")return!1;let t=Object.getPrototypeOf(e);return t==null?!0:(t.constructor&&t.constructor.toString())===Object.toString()}function Oft(e,t){if(typeof t=="string"){for(let[r,n]of Object.entries(e))if(t.toLowerCase()===r.toLowerCase())return n}}var zhr=e=>new Proxy(e,{get:(t,r)=>Oft(t,r),has:(t,r)=>Oft(t,r)!==void 0}),Ift=e=>!!(e&&Cx(e.constructor)&&e[Symbol.toStringTag]==="FormData"&&Cx(e.append)&&Cx(e.getAll)&&Cx(e.entries)&&Cx(e[Symbol.iterator])),Eft=e=>String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),RA=e=>!!(e&&typeof e=="object"&&Cx(e.constructor)&&e[Symbol.toStringTag]==="File"&&Cx(e.stream)&&e.name!=null),Hhr={enableAdditionalHeaders:!1},oY={writable:!1,configurable:!1},eP,S2,iY,x2,AA,C2,O2,aY,sY,L_e,D_e,Aft,Vhr=class{constructor(e,t,r){if(ib(this,sY),ib(this,D_e),ib(this,eP,`\r
`),ib(this,S2,void 0),ib(this,iY,void 0),ib(this,x2,"-".repeat(2)),ib(this,AA,new TextEncoder),ib(this,C2,void 0),ib(this,O2,void 0),ib(this,aY,void 0),!Ift(e))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(Cft(t)?r=t:n=t,n||(n=qhr()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!Cft(r))throw new TypeError("Expected options argument to be an object.");w2(this,O2,Array.from(e.entries())),w2(this,aY,{...Hhr,...r}),w2(this,S2,Ia(this,AA).encode(Ia(this,eP))),w2(this,iY,Ia(this,S2).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,w2(this,C2,Ia(this,AA).encode(`${Ia(this,x2)}${this.boundary}${Ia(this,x2)}${Ia(this,eP).repeat(2)}`));let o={"Content-Type":this.contentType},i=R_e(this,D_e,Aft).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=zhr(Object.freeze(o)),Object.defineProperties(this,{boundary:oY,contentType:oY,contentLength:oY,headers:oY})}*values(){for(let[e,t]of Ia(this,O2)){let r=RA(t)?t:Ia(this,AA).encode(Mft(t));yield R_e(this,sY,L_e).call(this,e,r),yield r,yield Ia(this,S2)}yield Ia(this,C2)}async*encode(){for(let e of this.values())RA(e)?yield*$hr(e.stream()):yield*Tft(e)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};eP=new WeakMap;S2=new WeakMap;iY=new WeakMap;x2=new WeakMap;AA=new WeakMap;C2=new WeakMap;O2=new WeakMap;aY=new WeakMap;sY=new WeakSet;L_e=function(e,t){let r="";if(r+=`${Ia(this,x2)}${this.boundary}${Ia(this,eP)}`,r+=`Content-Disposition: form-data; name="${Eft(e)}"`,RA(t)&&(r+=`; filename="${Eft(t.name)}"${Ia(this,eP)}`,r+=`Content-Type: ${t.type||"application/octet-stream"}`),Ia(this,aY).enableAdditionalHeaders===!0){let n=RA(t)?t.size:t.byteLength;n!=null&&!isNaN(n)&&(r+=`${Ia(this,eP)}Content-Length: ${n}`)}return Ia(this,AA).encode(`${r}${Ia(this,eP).repeat(2)}`)};D_e=new WeakSet;Aft=function(){let e=0;for(let[t,r]of Ia(this,O2)){let n=RA(r)?r:Ia(this,AA).encode(Mft(r)),o=RA(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;e+=R_e(this,sY,L_e).call(this,t,n).byteLength,e+=o,e+=Ia(this,iY)}return String(e+Ia(this,C2).byteLength)}});var Nft=b((fno,jft)=>{jft.exports=typeof self=="object"?self.FormData:window.FormData});var Lft=b(yl=>{"use strict";var Whr=yl&&yl.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Jhr=yl&&yl.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),OL=yl&&yl.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Whr(t,e,r);return Jhr(t,e),t},tP=yl&&yl.__awaiter||function(e,t,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(e,t||[])).next())})};Object.defineProperty(yl,"__esModule",{value:!0});yl.WebFormData=yl.Node16FormData=yl.Node18FormData=yl.newFormData=void 0;var uY=hL();function F_e(e){return typeof e=="object"&&e!=null&&"name"in e}function Ghr(){return tP(this,void 0,void 0,function*(){let e;return uY.RUNTIME.type==="node"&&uY.RUNTIME.parsedVersion!=null&&uY.RUNTIME.parsedVersion>=18?e=new lY:uY.RUNTIME.type==="node"?e=new cY:e=new dY,yield e.setup(),e})}yl.newFormData=Ghr;var lY=class{setup(){return tP(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>OL(vft()))).FormData})}append(t,r){var n;(n=this.fd)===null||n===void 0||n.append(t,r)}appendFile(t,r,n){var o,i;return tP(this,void 0,void 0,function*(){n==null&&F_e(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>OL(l2()))).Readable?(o=this.fd)===null||o===void 0||o.append(t,{type:void 0,name:n,[Symbol.toStringTag]:"File",stream(){return r}}):(i=this.fd)===null||i===void 0||i.append(t,r,n)})}getRequest(){return tP(this,void 0,void 0,function*(){let t=new(yield Promise.resolve().then(()=>OL(Dft()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>OL(l2()))).Readable.from(t),headers:t.headers,duplex:"half"}})}};yl.Node18FormData=lY;var cY=class{setup(){return tP(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>OL(Nft()))).default})}append(t,r){var n;(n=this.fd)===null||n===void 0||n.append(t,r)}appendFile(t,r,n){var o,i;return tP(this,void 0,void 0,function*(){n==null&&F_e(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>OL(l2()))).Readable?a=r:a=Buffer.from(yield r.arrayBuffer()),n==null?(o=this.fd)===null||o===void 0||o.append(t,a):(i=this.fd)===null||i===void 0||i.append(t,a,{filename:n})})}getRequest(){return{body:this.fd,headers:this.fd?this.fd.getHeaders():{}}}};yl.Node16FormData=cY;var dY=class{setup(){return tP(this,void 0,void 0,function*(){this.fd=new FormData})}append(t,r){var n;(n=this.fd)===null||n===void 0||n.append(t,r)}appendFile(t,r,n){var o;return tP(this,void 0,void 0,function*(){n==null&&F_e(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(t,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};yl.WebFormData=dY});var Fft=b(DA=>{"use strict";var Khr=DA&&DA.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Yhr=DA&&DA.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Khr(t,e,r)};Object.defineProperty(DA,"__esModule",{value:!0});Yhr(Lft(),DA)});var Xl=b(fY=>{"use strict";Object.defineProperty(fY,"__esModule",{value:!0});fY.SchemaType=void 0;fY.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 vf=b(pY=>{"use strict";Object.defineProperty(pY,"__esModule",{value:!0});pY.getErrorMessageForIncorrectType=void 0;function Zhr(e,t){return`Expected ${t}. Received ${Xhr(e)}.`}pY.getErrorMessageForIncorrectType=Zhr;function Xhr(e){if(Array.isArray(e))return"list";if(e===null)return"null";switch(typeof e){case"string":return`"${e}"`;case"number":case"boolean":case"undefined":return`${e}`}return typeof e}});var Ox=b(hY=>{"use strict";Object.defineProperty(hY,"__esModule",{value:!0});hY.maybeSkipValidation=void 0;function Qhr(e){return Object.assign(Object.assign({},e),{json:kft(e.json),parse:kft(e.parse)})}hY.maybeSkipValidation=Qhr;function kft(e){return(t,r)=>{let n=e(t,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:t}):n}}});var k_e=b(mY=>{"use strict";Object.defineProperty(mY,"__esModule",{value:!0});mY.stringifyValidationError=void 0;function emr(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}mY.stringifyValidationError=emr});var $_e=b(gY=>{"use strict";Object.defineProperty(gY,"__esModule",{value:!0});gY.JsonError=void 0;var tmr=k_e(),B_e=class e extends Error{constructor(t){super(t.map(tmr.stringifyValidationError).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};gY.JsonError=B_e});var U_e=b(yY=>{"use strict";Object.defineProperty(yY,"__esModule",{value:!0});yY.ParseError=void 0;var rmr=k_e(),q_e=class e extends Error{constructor(t){super(t.map(rmr.stringifyValidationError).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};yY.ParseError=q_e});var qft=b(rP=>{"use strict";Object.defineProperty(rP,"__esModule",{value:!0});rP.transform=rP.optional=rP.getSchemaUtils=void 0;var nmr=Xl(),omr=$_e(),imr=U_e();function z_e(e){return{optional:()=>Bft(e),transform:t=>$ft(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new imr.ParseError(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new omr.JsonError(n.errors)}}}rP.getSchemaUtils=z_e;function Bft(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>nmr.SchemaType.OPTIONAL};return Object.assign(Object.assign({},t),z_e(t))}rP.optional=Bft;function $ft(e,t){let r={parse:(n,o)=>{let i=e.parse(n,o);return i.ok?{ok:!0,value:t.transform(i.value)}:i},json:(n,o)=>{let i=t.untransform(n);return e.json(i,o)},getType:()=>e.getType()};return Object.assign(Object.assign({},r),z_e(r))}rP.transform=$ft});var hp=b(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.ParseError=Dh.JsonError=Dh.transform=Dh.optional=Dh.getSchemaUtils=void 0;var H_e=qft();Object.defineProperty(Dh,"getSchemaUtils",{enumerable:!0,get:function(){return H_e.getSchemaUtils}});Object.defineProperty(Dh,"optional",{enumerable:!0,get:function(){return H_e.optional}});Object.defineProperty(Dh,"transform",{enumerable:!0,get:function(){return H_e.transform}});var amr=$_e();Object.defineProperty(Dh,"JsonError",{enumerable:!0,get:function(){return amr.JsonError}});var smr=U_e();Object.defineProperty(Dh,"ParseError",{enumerable:!0,get:function(){return smr.ParseError}})});var Uft=b(bY=>{"use strict";Object.defineProperty(bY,"__esModule",{value:!0});bY.date=void 0;var umr=Xl(),V_e=vf(),lmr=Ox(),cmr=hp(),dmr=/^([+-]?\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 fmr(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:(0,V_e.getErrorMessageForIncorrectType)(t,"string")}]}:dmr.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:(0,V_e.getErrorMessageForIncorrectType)(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:(0,V_e.getErrorMessageForIncorrectType)(t,"Date object")}]},getType:()=>umr.SchemaType.DATE};return Object.assign(Object.assign({},(0,lmr.maybeSkipValidation)(e)),(0,cmr.getSchemaUtils)(e))}bY.date=fmr});var zft=b(_Y=>{"use strict";Object.defineProperty(_Y,"__esModule",{value:!0});_Y.date=void 0;var pmr=Uft();Object.defineProperty(_Y,"date",{enumerable:!0,get:function(){return pmr.date}})});var Ex=b(vY=>{"use strict";Object.defineProperty(vY,"__esModule",{value:!0});vY.createIdentitySchemaCreator=void 0;var hmr=hp(),mmr=Ox();function gmr(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return Object.assign(Object.assign({},(0,mmr.maybeSkipValidation)(r)),(0,hmr.getSchemaUtils)(r))}}vY.createIdentitySchemaCreator=gmr});var Vft=b(wY=>{"use strict";Object.defineProperty(wY,"__esModule",{value:!0});wY.enum_=void 0;var ymr=Xl(),bmr=Ex(),Hft=vf();function _mr(e){let t=new Set(e);return(0,bmr.createIdentitySchemaCreator)(ymr.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,Hft.getErrorMessageForIncorrectType)(n,"string")}]}:!t.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,Hft.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}wY.enum_=_mr});var W_e=b(SY=>{"use strict";Object.defineProperty(SY,"__esModule",{value:!0});SY.enum_=void 0;var vmr=Vft();Object.defineProperty(SY,"enum_",{enumerable:!0,get:function(){return vmr.enum_}})});var J_e=b(nP=>{"use strict";Object.defineProperty(nP,"__esModule",{value:!0});nP.getMemoizedSchema=nP.constructLazyBaseSchema=nP.lazy=void 0;var wmr=hp();function Smr(e){let t=Wft(e);return Object.assign(Object.assign({},t),(0,wmr.getSchemaUtils)(t))}nP.lazy=Smr;function Wft(e){return{parse:(t,r)=>xY(e).parse(t,r),json:(t,r)=>xY(e).json(t,r),getType:()=>xY(e).getType()}}nP.constructLazyBaseSchema=Wft;function xY(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}nP.getMemoizedSchema=xY});var G_e=b(CY=>{"use strict";Object.defineProperty(CY,"__esModule",{value:!0});CY.entries=void 0;function xmr(e){return Object.entries(e)}CY.entries=xmr});var K_e=b(OY=>{"use strict";Object.defineProperty(OY,"__esModule",{value:!0});OY.filterObject=void 0;function Cmr(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}OY.filterObject=Cmr});var E2=b(EY=>{"use strict";Object.defineProperty(EY,"__esModule",{value:!0});EY.isPlainObject=void 0;function Omr(e){if(typeof e!="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}EY.isPlainObject=Omr});var Y_e=b(PY=>{"use strict";Object.defineProperty(PY,"__esModule",{value:!0});PY.keys=void 0;function Emr(e){return Object.keys(e)}PY.keys=Emr});var Jft=b(TY=>{"use strict";Object.defineProperty(TY,"__esModule",{value:!0});TY.partition=void 0;function Pmr(e,t){let r=[],n=[];for(let o of e)t(o)?r.push(o):n.push(o);return[r,n]}TY.partition=Pmr});var Yft=b(EL=>{"use strict";Object.defineProperty(EL,"__esModule",{value:!0});EL.withParsedProperties=EL.getObjectLikeUtils=void 0;var Tmr=K_e(),Mmr=vf(),Imr=E2(),Amr=hp();function Gft(e){return{withParsedProperties:t=>Kft(e,t)}}EL.getObjectLikeUtils=Gft;function Kft(e,t){let r={parse:(n,o)=>{let i=e.parse(n,o);if(!i.ok)return i;let a=Object.entries(t).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,Imr.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,Mmr.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(t)),s=(0,Tmr.filterObject)(n,Object.keys(n).filter(u=>!a.has(u)));return e.json(s,o)},getType:()=>e.getType()};return Object.assign(Object.assign(Object.assign({},r),(0,Amr.getSchemaUtils)(r)),Gft(r))}EL.withParsedProperties=Kft});var P2=b(PL=>{"use strict";Object.defineProperty(PL,"__esModule",{value:!0});PL.withParsedProperties=PL.getObjectLikeUtils=void 0;var Zft=Yft();Object.defineProperty(PL,"getObjectLikeUtils",{enumerable:!0,get:function(){return Zft.getObjectLikeUtils}});Object.defineProperty(PL,"withParsedProperties",{enumerable:!0,get:function(){return Zft.withParsedProperties}})});var Z_e=b(TL=>{"use strict";Object.defineProperty(TL,"__esModule",{value:!0});TL.isProperty=TL.property=void 0;function Rmr(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}TL.property=Rmr;function Dmr(e){return e.isProperty}TL.isProperty=Dmr});var Q_e=b(ML=>{"use strict";Object.defineProperty(ML,"__esModule",{value:!0});ML.getObjectUtils=ML.object=void 0;var M2=Xl(),Xft=G_e(),Qft=K_e(),jmr=vf(),Nmr=E2(),npt=Y_e(),Lmr=Ox(),Fmr=Jft(),opt=P2(),ipt=hp(),T2=Z_e();function kmr(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>(0,T2.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,npt.keys)(e),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,Xft.entries)(e)){let u=(0,T2.isProperty)(s)?s.rawKey:a,l=(0,T2.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,rpt(l)&&i.push(u)}return ept({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,Xft.entries)(e)){let s=(0,T2.isProperty)(a)?a.valueSchema:a;rpt(s)&&o.push(i)}return ept({value:r,requiredKeys:o,getProperty:i=>{let a=e[i];if(a!=null)return(0,T2.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:()=>M2.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,Lmr.maybeSkipValidation)(t)),(0,ipt.getSchemaUtils)(t)),(0,opt.getObjectLikeUtils)(t)),X_e(t))}ML.object=kmr;function ept({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,Nmr.isPlainObject)(e))return{ok:!1,errors:[{path:i,message:(0,jmr.getErrorMessageForIncorrectType)(e,"object")}]};let a=new Set(t),s=[],u={};for(let[l,c]of Object.entries(e)){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(...t.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 X_e(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,o)=>tpt({extensionKeys:t._getRawProperties(),value:n,transformBase:i=>e.parse(i,o),transformExtension:i=>t.parse(i,o)}),json:(n,o)=>tpt({extensionKeys:t._getParsedProperties(),value:n,transformBase:i=>e.json(i,o),transformExtension:i=>t.json(i,o)}),getType:()=>M2.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,ipt.getSchemaUtils)(r)),(0,opt.getObjectLikeUtils)(r)),X_e(r))}}}ML.getObjectUtils=X_e;function tpt({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let o=new Set(e),[i,a]=(0,Fmr.partition)((0,npt.keys)(t),l=>o.has(l)),s=r((0,Qft.filterObject)(t,a)),u=n((0,Qft.filterObject)(t,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 rpt(e){return!Bmr(e)}function Bmr(e){switch(e.getType()){case M2.SchemaType.ANY:case M2.SchemaType.UNKNOWN:case M2.SchemaType.OPTIONAL:return!0;default:return!1}}});var apt=b(MY=>{"use strict";Object.defineProperty(MY,"__esModule",{value:!0});MY.objectWithoutOptionalProperties=void 0;var $mr=Q_e();function qmr(e){return(0,$mr.object)(e)}MY.objectWithoutOptionalProperties=qmr});var eve=b(jh=>{"use strict";Object.defineProperty(jh,"__esModule",{value:!0});jh.property=jh.isProperty=jh.objectWithoutOptionalProperties=jh.object=jh.getObjectUtils=void 0;var spt=Q_e();Object.defineProperty(jh,"getObjectUtils",{enumerable:!0,get:function(){return spt.getObjectUtils}});Object.defineProperty(jh,"object",{enumerable:!0,get:function(){return spt.object}});var Umr=apt();Object.defineProperty(jh,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return Umr.objectWithoutOptionalProperties}});var upt=Z_e();Object.defineProperty(jh,"isProperty",{enumerable:!0,get:function(){return upt.isProperty}});Object.defineProperty(jh,"property",{enumerable:!0,get:function(){return upt.property}})});var lpt=b(IY=>{"use strict";Object.defineProperty(IY,"__esModule",{value:!0});IY.lazyObject=void 0;var zmr=eve(),Hmr=P2(),Vmr=hp(),tve=J_e();function Wmr(e){let t=Object.assign(Object.assign({},(0,tve.constructLazyBaseSchema)(e)),{_getRawProperties:()=>(0,tve.getMemoizedSchema)(e)._getRawProperties(),_getParsedProperties:()=>(0,tve.getMemoizedSchema)(e)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},t),(0,Vmr.getSchemaUtils)(t)),(0,Hmr.getObjectLikeUtils)(t)),(0,zmr.getObjectUtils)(t))}IY.lazyObject=Wmr});var cpt=b(IL=>{"use strict";Object.defineProperty(IL,"__esModule",{value:!0});IL.lazyObject=IL.lazy=void 0;var Jmr=J_e();Object.defineProperty(IL,"lazy",{enumerable:!0,get:function(){return Jmr.lazy}});var Gmr=lpt();Object.defineProperty(IL,"lazyObject",{enumerable:!0,get:function(){return Gmr.lazyObject}})});var fpt=b(AY=>{"use strict";Object.defineProperty(AY,"__esModule",{value:!0});AY.list=void 0;var Kmr=Xl(),Ymr=vf(),Zmr=Ox(),Xmr=hp();function Qmr(e){let t={parse:(r,n)=>dpt(r,(o,i)=>{var a;return e.parse(o,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(a=n?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`[${i}]`]}))}),json:(r,n)=>dpt(r,(o,i)=>{var a;return e.json(o,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(a=n?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`[${i}]`]}))}),getType:()=>Kmr.SchemaType.LIST};return Object.assign(Object.assign({},(0,Zmr.maybeSkipValidation)(t)),(0,Xmr.getSchemaUtils)(t))}AY.list=Qmr;function dpt(e,t){return Array.isArray(e)?e.map((n,o)=>t(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,Ymr.getErrorMessageForIncorrectType)(e,"list"),path:[]}]}}});var rve=b(RY=>{"use strict";Object.defineProperty(RY,"__esModule",{value:!0});RY.list=void 0;var egr=fpt();Object.defineProperty(RY,"list",{enumerable:!0,get:function(){return egr.list}})});var ppt=b(DY=>{"use strict";Object.defineProperty(DY,"__esModule",{value:!0});DY.stringLiteral=void 0;var tgr=Xl(),rgr=Ex(),ngr=vf();function ogr(e){return(0,rgr.createIdentitySchemaCreator)(tgr.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:(0,ngr.getErrorMessageForIncorrectType)(r,`"${e}"`)}]})()}DY.stringLiteral=ogr});var hpt=b(jY=>{"use strict";Object.defineProperty(jY,"__esModule",{value:!0});jY.booleanLiteral=void 0;var igr=Xl(),agr=Ex(),sgr=vf();function ugr(e){return(0,agr.createIdentitySchemaCreator)(igr.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:(0,sgr.getErrorMessageForIncorrectType)(r,`${e.toString()}`)}]})()}jY.booleanLiteral=ugr});var mpt=b(AL=>{"use strict";Object.defineProperty(AL,"__esModule",{value:!0});AL.booleanLiteral=AL.stringLiteral=void 0;var lgr=ppt();Object.defineProperty(AL,"stringLiteral",{enumerable:!0,get:function(){return lgr.stringLiteral}});var cgr=hpt();Object.defineProperty(AL,"booleanLiteral",{enumerable:!0,get:function(){return cgr.booleanLiteral}})});var gpt=b(NY=>{"use strict";Object.defineProperty(NY,"__esModule",{value:!0});NY.any=void 0;var dgr=Xl(),fgr=Ex();NY.any=(0,fgr.createIdentitySchemaCreator)(dgr.SchemaType.ANY,e=>({ok:!0,value:e}))});var ypt=b(LY=>{"use strict";Object.defineProperty(LY,"__esModule",{value:!0});LY.boolean=void 0;var pgr=Xl(),hgr=Ex(),mgr=vf();LY.boolean=(0,hgr.createIdentitySchemaCreator)(pgr.SchemaType.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:(0,mgr.getErrorMessageForIncorrectType)(e,"boolean")}]})});var bpt=b(FY=>{"use strict";Object.defineProperty(FY,"__esModule",{value:!0});FY.number=void 0;var ggr=Xl(),ygr=Ex(),bgr=vf();FY.number=(0,ygr.createIdentitySchemaCreator)(ggr.SchemaType.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:(0,bgr.getErrorMessageForIncorrectType)(e,"number")}]})});var _pt=b(kY=>{"use strict";Object.defineProperty(kY,"__esModule",{value:!0});kY.string=void 0;var _gr=Xl(),vgr=Ex(),wgr=vf();kY.string=(0,vgr.createIdentitySchemaCreator)(_gr.SchemaType.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:(0,wgr.getErrorMessageForIncorrectType)(e,"string")}]})});var vpt=b(BY=>{"use strict";Object.defineProperty(BY,"__esModule",{value:!0});BY.unknown=void 0;var Sgr=Xl(),xgr=Ex();BY.unknown=(0,xgr.createIdentitySchemaCreator)(Sgr.SchemaType.UNKNOWN,e=>({ok:!0,value:e}))});var wpt=b(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.unknown=Nh.string=Nh.number=Nh.boolean=Nh.any=void 0;var Cgr=gpt();Object.defineProperty(Nh,"any",{enumerable:!0,get:function(){return Cgr.any}});var Ogr=ypt();Object.defineProperty(Nh,"boolean",{enumerable:!0,get:function(){return Ogr.boolean}});var Egr=bpt();Object.defineProperty(Nh,"number",{enumerable:!0,get:function(){return Egr.number}});var Pgr=_pt();Object.defineProperty(Nh,"string",{enumerable:!0,get:function(){return Pgr.string}});var Tgr=vpt();Object.defineProperty(Nh,"unknown",{enumerable:!0,get:function(){return Tgr.unknown}})});var xpt=b($Y=>{"use strict";Object.defineProperty($Y,"__esModule",{value:!0});$Y.record=void 0;var nve=Xl(),Mgr=G_e(),Igr=vf(),Agr=E2(),Rgr=Ox(),Dgr=hp();function jgr(e,t){let r={parse:(n,o)=>Spt({value:n,isKeyNumeric:e.getType()===nve.SchemaType.NUMBER,transformKey:i=>{var a;return e.parse(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(a=o?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`${i} (key)`]}))},transformValue:(i,a)=>{var s;return t.parse(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(s=o?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],`${a}`]}))},breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(n,o)=>Spt({value:n,isKeyNumeric:e.getType()===nve.SchemaType.NUMBER,transformKey:i=>{var a;return e.json(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(a=o?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`${i} (key)`]}))},transformValue:(i,a)=>{var s;return t.json(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(s=o?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],`${a}`]}))},breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>nve.SchemaType.RECORD};return Object.assign(Object.assign({},(0,Rgr.maybeSkipValidation)(r)),(0,Dgr.getSchemaUtils)(r))}$Y.record=jgr;function Spt({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,Agr.isPlainObject)(e)?(0,Mgr.entries)(e).reduce((i,[a,s])=>{if(s==null)return i;let u=i,l=a;if(t){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,Igr.getErrorMessageForIncorrectType)(e,"object")}]}}});var Cpt=b(qY=>{"use strict";Object.defineProperty(qY,"__esModule",{value:!0});qY.record=void 0;var Ngr=xpt();Object.defineProperty(qY,"record",{enumerable:!0,get:function(){return Ngr.record}})});var Opt=b(UY=>{"use strict";Object.defineProperty(UY,"__esModule",{value:!0});UY.set=void 0;var Lgr=Xl(),Fgr=vf(),kgr=Ox(),Bgr=rve(),$gr=hp();function qgr(e){let t=(0,Bgr.list)(e),r={parse:(n,o)=>{let i=t.parse(n,o);return i.ok?{ok:!0,value:new Set(i.value)}:i},json:(n,o)=>{var i;return n instanceof Set?t.json([...n],o):{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,Fgr.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>Lgr.SchemaType.SET};return Object.assign(Object.assign({},(0,kgr.maybeSkipValidation)(r)),(0,$gr.getSchemaUtils)(r))}UY.set=qgr});var Ept=b(zY=>{"use strict";Object.defineProperty(zY,"__esModule",{value:!0});zY.set=void 0;var Ugr=Opt();Object.defineProperty(zY,"set",{enumerable:!0,get:function(){return Ugr.set}})});var Tpt=b(HY=>{"use strict";Object.defineProperty(HY,"__esModule",{value:!0});HY.undiscriminatedUnion=void 0;var zgr=Xl(),Hgr=Ox(),Vgr=hp();function Wgr(e){let t={parse:(r,n)=>Ppt((o,i)=>o.parse(r,i),e,n),json:(r,n)=>Ppt((o,i)=>o.json(r,i),e,n),getType:()=>zgr.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,Hgr.maybeSkipValidation)(t)),(0,Vgr.getSchemaUtils)(t))}HY.undiscriminatedUnion=Wgr;function Ppt(e,t,r){let n=[];for(let[o,i]of t.entries()){let a=e(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 Mpt=b(VY=>{"use strict";Object.defineProperty(VY,"__esModule",{value:!0});VY.undiscriminatedUnion=void 0;var Jgr=Tpt();Object.defineProperty(VY,"undiscriminatedUnion",{enumerable:!0,get:function(){return Jgr.undiscriminatedUnion}})});var Ipt=b(WY=>{"use strict";Object.defineProperty(WY,"__esModule",{value:!0});WY.discriminant=void 0;function Ggr(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}WY.discriminant=Ggr});var Rpt=b(RL=>{"use strict";var Kgr=RL&&RL.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};Object.defineProperty(RL,"__esModule",{value:!0});RL.union=void 0;var Ygr=Xl(),Zgr=vf(),Xgr=E2(),Qgr=Y_e(),eyr=Ox(),tyr=W_e(),ryr=P2(),nyr=hp();function oyr(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,o=(0,tyr.enum_)((0,Qgr.keys)(t)),i={parse:(a,s)=>Apt({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=>t[u],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,l)=>l.parse(u,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(a,s)=>Apt({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=>t[u],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,l)=>l.json(u,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>Ygr.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,eyr.maybeSkipValidation)(i)),(0,nyr.getSchemaUtils)(i)),(0,ryr.getObjectLikeUtils)(i))}RL.union=oyr;function Apt({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,Xgr.isPlainObject)(e))return{ok:!1,errors:[{path:s,message:(0,Zgr.getErrorMessageForIncorrectType)(e,"object")}]};let u=e,l=t,c=u[l],d=Kgr(u,[typeof l=="symbol"?l:l+""]);if(c==null)return{ok:!1,errors:[{path:s,message:`Missing discriminant ("${t}")`}]};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,t],message:"Unexpected discriminant value"}]};let h=a(d,p);return h.ok?{ok:!0,value:Object.assign({[r]:c},h.value)}:h}});var Dpt=b(DL=>{"use strict";Object.defineProperty(DL,"__esModule",{value:!0});DL.union=DL.discriminant=void 0;var iyr=Ipt();Object.defineProperty(DL,"discriminant",{enumerable:!0,get:function(){return iyr.discriminant}});var ayr=Rpt();Object.defineProperty(DL,"union",{enumerable:!0,get:function(){return ayr.union}})});var jpt=b(Wu=>{"use strict";var syr=Wu&&Wu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),mp=Wu&&Wu.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&syr(t,e,r)};Object.defineProperty(Wu,"__esModule",{value:!0});mp(zft(),Wu);mp(W_e(),Wu);mp(cpt(),Wu);mp(rve(),Wu);mp(mpt(),Wu);mp(eve(),Wu);mp(P2(),Wu);mp(wpt(),Wu);mp(Cpt(),Wu);mp(hp(),Wu);mp(Ept(),Wu);mp(Mpt(),Wu);mp(Dpt(),Wu)});var Npt=b(jA=>{"use strict";var uyr=jA&&jA.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),lyr=jA&&jA.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&uyr(t,e,r)};Object.defineProperty(jA,"__esModule",{value:!0});lyr(jpt(),jA)});var $=b(Ql=>{"use strict";var Lpt=Ql&&Ql.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),cyr=Ql&&Ql.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),I2=Ql&&Ql.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Lpt(t,e,r)},dyr=Ql&&Ql.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Lpt(t,e,r);return cyr(t,e),t};Object.defineProperty(Ql,"__esModule",{value:!0});Ql.serialization=void 0;I2(sft(),Ql);I2(fft(),Ql);I2(yft(),Ql);I2(hL(),Ql);I2(Fft(),Ql);Ql.serialization=dyr(Npt())});var kpt=b(cs=>{"use strict";var A2=cs&&cs.__awaiter||function(e,t,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(e,t||[])).next())})},R2=cs&&cs.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values=="function"?__values(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,u){a=e[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)}},zi=cs&&cs.__await||function(e){return this instanceof zi?(this.v=e,this):new zi(e)},D2=cs&&cs.__asyncGenerator||function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof zi?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(cs,"__esModule",{value:!0});cs.readableStreamAsyncIterable=cs._decodeChunks=cs.LineDecoder=cs._iterSSEMessages=cs.StreamUtils=void 0;var jL=Wa(),ove=class e{constructor(t,r){this.iterator=t,this.controller=r}static fromSSEResponse(t,r){let n=!1;function o(){return D2(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=R2(Fpt(t,r)),c;c=yield zi(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 jL.CohereError({message:`Error: ${f.error}`});yield yield zi(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 jL.CohereError({message:`Error: ${f.message}, ${f.error}`});yield yield zi({event:d.event,data:f})}}}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&(yield zi(s.call(l)))}finally{if(a)throw a.error}}u=!0}catch(d){if(d instanceof Error&&d.name==="AbortError")return yield zi(void 0);throw d}finally{u||r?.abort()}})}return new e(o,r)}static fromReadableStream(t,r){let n=!1;function o(){return D2(this,arguments,function*(){var s,u;let l=new oP,c=ave(t);try{for(var d=R2(c),f;f=yield zi(d.next()),!f.done;){let p=f.value;for(let h of l.decode(p))yield yield zi(h)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(u=d.return)&&(yield zi(u.call(d)))}finally{if(s)throw s.error}}for(let p of l.flush())yield yield zi(p)})}function i(){return D2(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=R2(o()),d;d=yield zi(c.next()),!d.done;){let f=d.value;l||f&&(yield yield zi(JSON.parse(f)))}}catch(f){s={error:f}}finally{try{d&&!d.done&&(u=c.return)&&(yield zi(u.call(c)))}finally{if(s)throw s.error}}l=!0}catch(f){if(f instanceof Error&&f.name==="AbortError")return yield zi(void 0);throw f}finally{l||r?.abort()}})}return new e(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let t=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();t.push(a),r.push(a)}return i.shift()}});return[new e(()=>o(t),this.controller),new e(()=>o(r),this.controller)]}toReadableStream(){let t=this,r,n=new TextEncoder;return new ReadableStream({start(){return A2(this,void 0,void 0,function*(){r=t[Symbol.asyncIterator]()})},pull(o){return A2(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 A2(this,void 0,void 0,function*(){yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};cs.StreamUtils=ove;function Fpt(e,t){return D2(this,arguments,function*(){var n,o;if(!e.body)throw t?.abort(),new jL.CohereError({message:"Attempted to iterate over a response with no body"});let i=new ive,a=new oP,s=ave(e.body);try{for(var u=R2(fyr(s)),l;l=yield zi(u.next()),!l.done;){let c=l.value;for(let d of a.decode(c)){let f=i.decode(d);f&&(yield yield zi(f))}}}catch(c){n={error:c}}finally{try{l&&!l.done&&(o=u.return)&&(yield zi(o.call(u)))}finally{if(n)throw n.error}}for(let c of a.flush()){let d=i.decode(c);d&&(yield yield zi(d))}})}cs._iterSSEMessages=Fpt;function fyr(e){return D2(this,arguments,function*(){var r,n;let o=new Uint8Array;try{for(var i=R2(e),a;a=yield zi(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=pyr(o))!==-1;)yield yield zi(o.slice(0,c)),o=o.slice(c)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&(yield zi(n.call(i)))}finally{if(r)throw r.error}}o.length>0&&(yield yield zi(o))})}function pyr(e){for(let n=0;n<e.length-2;n++){if(e[n]===10&&e[n+1]===10||e[n]===13&&e[n+1]===13)return n+2;if(e[n]===13&&e[n+1]===10&&n+3<e.length&&e[n+2]===13&&e[n+3]===10)return n+4}return-1}var ive=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;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(t),t.startsWith(":"))return null;let[r,n,o]=myr(t,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},oP=class e{constructor(){this.buffer=[],this.trailingCR=!1}decode(t){let r=this.decodeText(t);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=e.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(e.NEWLINE_REGEXP);return n&&o.pop(),o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(t){var r;if(t==null)return"";if(typeof t=="string")return t;if(typeof Buffer<"u"){if(t instanceof Buffer)return t.toString();if(t instanceof Uint8Array)return Buffer.from(t).toString();throw new jL.CohereError({message:`Unexpected: received non-Uint8Array (${t.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(t instanceof Uint8Array||t instanceof ArrayBuffer)return(r=this.textDecoder)!==null&&r!==void 0||(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(t);throw new jL.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${t.constructor.name}) in a web platform. Please report this error.`})}throw new jL.CohereError({message:"Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error."})}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let t=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,t}};cs.LineDecoder=oP;oP.NEWLINE_CHARS=new Set([`
`,"\r"]);oP.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function hyr(e){let t=new oP,r=[];for(let n of e)r.push(...t.decode(n));return r}cs._decodeChunks=hyr;function myr(e,t){let r=e.indexOf(t);return r!==-1?[e.substring(0,r),t,e.substring(r+t.length)]:[e,"",""]}function ave(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{next(){return A2(this,void 0,void 0,function*(){try{let r=yield t.read();return r?.done&&t.releaseLock(),r}catch(r){throw t.releaseLock(),r}})},return(){return A2(this,void 0,void 0,function*(){let r=t.cancel();return t.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}cs.readableStreamAsyncIterable=ave});var sve=b(ab=>{"use strict";var gyr=ab&&ab.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),yyr=ab&&ab.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),byr=ab&&ab.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&gyr(t,e,r);return yyr(t,e),t};Object.defineProperty(ab,"__esModule",{value:!0});ab.V2ChatStreamRequestCitationMode=void 0;var _yr=byr($());ab.V2ChatStreamRequestCitationMode=_yr.serialization.enum_(["FAST","ACCURATE","OFF"])});var uve=b(sb=>{"use strict";var vyr=sb&&sb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),wyr=sb&&sb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Syr=sb&&sb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&vyr(t,e,r);return wyr(t,e),t};Object.defineProperty(sb,"__esModule",{value:!0});sb.V2ChatRequestCitationMode=void 0;var xyr=Syr($());sb.V2ChatRequestCitationMode=xyr.serialization.enum_(["FAST","ACCURATE","OFF"])});var NL=b(ub=>{"use strict";var Cyr=ub&&ub.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Oyr=ub&&ub.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Eyr=ub&&ub.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Cyr(t,e,r);return Oyr(t,e),t};Object.defineProperty(ub,"__esModule",{value:!0});ub.TextContent=void 0;var Bpt=Eyr($());ub.TextContent=Bpt.serialization.object({text:Bpt.serialization.string()})});var lve=b(lb=>{"use strict";var Pyr=lb&&lb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Tyr=lb&&lb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Myr=lb&&lb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Pyr(t,e,r);return Tyr(t,e),t};Object.defineProperty(lb,"__esModule",{value:!0});lb.Content=void 0;var Iyr=Myr($()),Ayr=NL();lb.Content=Iyr.serialization.union("type",{text:Ayr.TextContent}).transform({transform:e=>e,untransform:e=>e})});var dve=b(cb=>{"use strict";var Ryr=cb&&cb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Dyr=cb&&cb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),jyr=cb&&cb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ryr(t,e,r);return Dyr(t,e),t};Object.defineProperty(cb,"__esModule",{value:!0});cb.UserMessageContent=void 0;var cve=jyr($()),Nyr=lve();cb.UserMessageContent=cve.serialization.undiscriminatedUnion([cve.serialization.string(),cve.serialization.list(Nyr.Content)])});var NA=b(db=>{"use strict";var Lyr=db&&db.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Fyr=db&&db.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),kyr=db&&db.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Lyr(t,e,r);return Fyr(t,e),t};Object.defineProperty(db,"__esModule",{value:!0});db.ChatDocument=void 0;var fve=kyr($());db.ChatDocument=fve.serialization.record(fve.serialization.string(),fve.serialization.string())});var pve=b(fb=>{"use strict";var Byr=fb&&fb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),$yr=fb&&fb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),qyr=fb&&fb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Byr(t,e,r);return $yr(t,e),t};Object.defineProperty(fb,"__esModule",{value:!0});fb.UserMessage=void 0;var $pt=qyr($()),Uyr=dve(),zyr=NA();fb.UserMessage=$pt.serialization.object({content:Uyr.UserMessageContent,documents:$pt.serialization.list(zyr.ChatDocument).optional()})});var mve=b(pb=>{"use strict";var Hyr=pb&&pb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Vyr=pb&&pb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Wyr=pb&&pb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Hyr(t,e,r);return Vyr(t,e),t};Object.defineProperty(pb,"__esModule",{value:!0});pb.ToolCall2Function=void 0;var hve=Wyr($());pb.ToolCall2Function=hve.serialization.object({name:hve.serialization.string().optional(),arguments:hve.serialization.string().optional()})});var JY=b(hb=>{"use strict";var Jyr=hb&&hb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Gyr=hb&&hb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Kyr=hb&&hb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Jyr(t,e,r);return Gyr(t,e),t};Object.defineProperty(hb,"__esModule",{value:!0});hb.ToolCall2=void 0;var gve=Kyr($()),Yyr=mve();hb.ToolCall2=gve.serialization.object({id:gve.serialization.string().optional(),type:gve.serialization.stringLiteral("function").optional(),function:Yyr.ToolCall2Function.optional()})});var yve=b(mb=>{"use strict";var Zyr=mb&&mb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Xyr=mb&&mb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Qyr=mb&&mb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Zyr(t,e,r);return Xyr(t,e),t};Object.defineProperty(mb,"__esModule",{value:!0});mb.ToolSource=void 0;var LL=Qyr($());mb.ToolSource=LL.serialization.object({id:LL.serialization.string().optional(),toolOutput:LL.serialization.property("tool_output",LL.serialization.record(LL.serialization.string(),LL.serialization.unknown()).optional())})});var bve=b(gb=>{"use strict";var ebr=gb&&gb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),tbr=gb&&gb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),rbr=gb&&gb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ebr(t,e,r);return tbr(t,e),t};Object.defineProperty(gb,"__esModule",{value:!0});gb.DocumentSource=void 0;var j2=rbr($());gb.DocumentSource=j2.serialization.object({id:j2.serialization.string().optional(),document:j2.serialization.record(j2.serialization.string(),j2.serialization.unknown()).optional()})});var _ve=b(yb=>{"use strict";var nbr=yb&&yb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),obr=yb&&yb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ibr=yb&&yb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&nbr(t,e,r);return obr(t,e),t};Object.defineProperty(yb,"__esModule",{value:!0});yb.Source=void 0;var abr=ibr($()),sbr=yve(),ubr=bve();yb.Source=abr.serialization.union("type",{tool:sbr.ToolSource,document:ubr.DocumentSource}).transform({transform:e=>e,untransform:e=>e})});var L2=b(bb=>{"use strict";var lbr=bb&&bb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),cbr=bb&&bb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),dbr=bb&&bb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&lbr(t,e,r);return cbr(t,e),t};Object.defineProperty(bb,"__esModule",{value:!0});bb.Citation=void 0;var N2=dbr($()),fbr=_ve();bb.Citation=N2.serialization.object({start:N2.serialization.number().optional(),end:N2.serialization.number().optional(),text:N2.serialization.string().optional(),sources:N2.serialization.list(fbr.Source).optional()})});var vve=b(_b=>{"use strict";var pbr=_b&&_b.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hbr=_b&&_b.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),mbr=_b&&_b.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&pbr(t,e,r);return hbr(t,e),t};Object.defineProperty(_b,"__esModule",{value:!0});_b.AssistantMessageContentItem=void 0;var gbr=mbr($()),ybr=NL();_b.AssistantMessageContentItem=gbr.serialization.union("type",{text:ybr.TextContent}).transform({transform:e=>e,untransform:e=>e})});var Sve=b(vb=>{"use strict";var bbr=vb&&vb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),_br=vb&&vb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vbr=vb&&vb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&bbr(t,e,r);return _br(t,e),t};Object.defineProperty(vb,"__esModule",{value:!0});vb.AssistantMessageContent=void 0;var wve=vbr($()),wbr=vve();vb.AssistantMessageContent=wve.serialization.undiscriminatedUnion([wve.serialization.string(),wve.serialization.list(wbr.AssistantMessageContentItem)])});var xve=b(wb=>{"use strict";var Sbr=wb&&wb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),xbr=wb&&wb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Cbr=wb&&wb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Sbr(t,e,r);return xbr(t,e),t};Object.defineProperty(wb,"__esModule",{value:!0});wb.AssistantMessage=void 0;var FL=Cbr($()),Obr=JY(),Ebr=Sve(),Pbr=L2();wb.AssistantMessage=FL.serialization.object({toolCalls:FL.serialization.property("tool_calls",FL.serialization.list(Obr.ToolCall2).optional()),toolPlan:FL.serialization.property("tool_plan",FL.serialization.string().optional()),content:Ebr.AssistantMessageContent.optional(),citations:FL.serialization.list(Pbr.Citation).optional()})});var Cve=b(Sb=>{"use strict";var Tbr=Sb&&Sb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Mbr=Sb&&Sb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ibr=Sb&&Sb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Tbr(t,e,r);return Mbr(t,e),t};Object.defineProperty(Sb,"__esModule",{value:!0});Sb.SystemMessageContentItem=void 0;var Abr=Ibr($()),Rbr=NL();Sb.SystemMessageContentItem=Abr.serialization.union("type",{text:Rbr.TextContent}).transform({transform:e=>e,untransform:e=>e})});var Eve=b(xb=>{"use strict";var Dbr=xb&&xb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),jbr=xb&&xb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Nbr=xb&&xb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Dbr(t,e,r);return jbr(t,e),t};Object.defineProperty(xb,"__esModule",{value:!0});xb.SystemMessageContent=void 0;var Ove=Nbr($()),Lbr=Cve();xb.SystemMessageContent=Ove.serialization.undiscriminatedUnion([Ove.serialization.string(),Ove.serialization.list(Lbr.SystemMessageContentItem)])});var Pve=b(Cb=>{"use strict";var Fbr=Cb&&Cb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),kbr=Cb&&Cb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Bbr=Cb&&Cb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Fbr(t,e,r);return kbr(t,e),t};Object.defineProperty(Cb,"__esModule",{value:!0});Cb.SystemMessage=void 0;var $br=Bbr($()),qbr=Eve();Cb.SystemMessage=$br.serialization.object({content:qbr.SystemMessageContent})});var Tve=b(Ob=>{"use strict";var Ubr=Ob&&Ob.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),zbr=Ob&&Ob.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Hbr=Ob&&Ob.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ubr(t,e,r);return zbr(t,e),t};Object.defineProperty(Ob,"__esModule",{value:!0});Ob.ToolContent=void 0;var GY=Hbr($());Ob.ToolContent=GY.serialization.object({output:GY.serialization.record(GY.serialization.string(),GY.serialization.unknown())})});var Mve=b(Eb=>{"use strict";var Vbr=Eb&&Eb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Wbr=Eb&&Eb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Jbr=Eb&&Eb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Vbr(t,e,r);return Wbr(t,e),t};Object.defineProperty(Eb,"__esModule",{value:!0});Eb.ToolMessage2ToolContentItem=void 0;var Gbr=Jbr($()),Kbr=Tve();Eb.ToolMessage2ToolContentItem=Gbr.serialization.union("type",{tool_result_object:Kbr.ToolContent}).transform({transform:e=>e,untransform:e=>e})});var Ive=b(Pb=>{"use strict";var Ybr=Pb&&Pb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Zbr=Pb&&Pb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Xbr=Pb&&Pb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ybr(t,e,r);return Zbr(t,e),t};Object.defineProperty(Pb,"__esModule",{value:!0});Pb.ToolMessage2=void 0;var F2=Xbr($()),Qbr=Mve();Pb.ToolMessage2=F2.serialization.object({toolCallId:F2.serialization.property("tool_call_id",F2.serialization.string()),toolContent:F2.serialization.property("tool_content",F2.serialization.list(Qbr.ToolMessage2ToolContentItem))})});var Ave=b(Tb=>{"use strict";var e_r=Tb&&Tb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),t_r=Tb&&Tb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r_r=Tb&&Tb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&e_r(t,e,r);return t_r(t,e),t};Object.defineProperty(Tb,"__esModule",{value:!0});Tb.ChatMessage2=void 0;var n_r=r_r($()),o_r=pve(),i_r=xve(),a_r=Pve(),s_r=Ive();Tb.ChatMessage2=n_r.serialization.union("role",{user:o_r.UserMessage,assistant:i_r.AssistantMessage,system:a_r.SystemMessage,tool:s_r.ToolMessage2}).transform({transform:e=>e,untransform:e=>e})});var KY=b(Mb=>{"use strict";var u_r=Mb&&Mb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),l_r=Mb&&Mb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c_r=Mb&&Mb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&u_r(t,e,r);return l_r(t,e),t};Object.defineProperty(Mb,"__esModule",{value:!0});Mb.ChatMessages=void 0;var d_r=c_r($()),f_r=Ave();Mb.ChatMessages=d_r.serialization.list(f_r.ChatMessage2)});var Rve=b(Ib=>{"use strict";var p_r=Ib&&Ib.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),h_r=Ib&&Ib.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),m_r=Ib&&Ib.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&p_r(t,e,r);return h_r(t,e),t};Object.defineProperty(Ib,"__esModule",{value:!0});Ib.Tool2Function=void 0;var kL=m_r($());Ib.Tool2Function=kL.serialization.object({name:kL.serialization.string().optional(),description:kL.serialization.string().optional(),parameters:kL.serialization.record(kL.serialization.string(),kL.serialization.unknown()).optional()})});var YY=b(Ab=>{"use strict";var g_r=Ab&&Ab.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),y_r=Ab&&Ab.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),b_r=Ab&&Ab.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&g_r(t,e,r);return y_r(t,e),t};Object.defineProperty(Ab,"__esModule",{value:!0});Ab.Tool2=void 0;var qpt=b_r($()),__r=Rve();Ab.Tool2=qpt.serialization.object({type:qpt.serialization.stringLiteral("function").optional(),function:__r.Tool2Function.optional()})});var ZY=b(Rb=>{"use strict";var v_r=Rb&&Rb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),w_r=Rb&&Rb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),S_r=Rb&&Rb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&v_r(t,e,r);return w_r(t,e),t};Object.defineProperty(Rb,"__esModule",{value:!0});Rb.ChatFinishReason=void 0;var x_r=S_r($());Rb.ChatFinishReason=x_r.serialization.enum_(["complete","stop_sequence","max_tokens","tool_call","error","content_blocked","error_limit"])});var Dve=b(Db=>{"use strict";var C_r=Db&&Db.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),O_r=Db&&Db.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),E_r=Db&&Db.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&C_r(t,e,r);return O_r(t,e),t};Object.defineProperty(Db,"__esModule",{value:!0});Db.AssistantMessageResponseContentItem=void 0;var P_r=E_r($()),T_r=NL();Db.AssistantMessageResponseContentItem=P_r.serialization.union("type",{text:T_r.TextContent}).transform({transform:e=>e,untransform:e=>e})});var jve=b(jb=>{"use strict";var M_r=jb&&jb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),I_r=jb&&jb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),A_r=jb&&jb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&M_r(t,e,r);return I_r(t,e),t};Object.defineProperty(jb,"__esModule",{value:!0});jb.AssistantMessageResponse=void 0;var iP=A_r($()),R_r=JY(),D_r=Dve(),j_r=L2();jb.AssistantMessageResponse=iP.serialization.object({role:iP.serialization.stringLiteral("assistant"),toolCalls:iP.serialization.property("tool_calls",iP.serialization.list(R_r.ToolCall2).optional()),toolPlan:iP.serialization.property("tool_plan",iP.serialization.string().optional()),content:iP.serialization.list(D_r.AssistantMessageResponseContentItem).optional(),citations:iP.serialization.list(j_r.Citation).optional()})});var Nve=b(Nb=>{"use strict";var N_r=Nb&&Nb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),L_r=Nb&&Nb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),F_r=Nb&&Nb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&N_r(t,e,r);return L_r(t,e),t};Object.defineProperty(Nb,"__esModule",{value:!0});Nb.UsageBilledUnits=void 0;var aP=F_r($());Nb.UsageBilledUnits=aP.serialization.object({inputTokens:aP.serialization.property("input_tokens",aP.serialization.number().optional()),outputTokens:aP.serialization.property("output_tokens",aP.serialization.number().optional()),searchUnits:aP.serialization.property("search_units",aP.serialization.number().optional()),classifications:aP.serialization.number().optional()})});var Lve=b(Lb=>{"use strict";var k_r=Lb&&Lb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),B_r=Lb&&Lb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$_r=Lb&&Lb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&k_r(t,e,r);return B_r(t,e),t};Object.defineProperty(Lb,"__esModule",{value:!0});Lb.UsageTokens=void 0;var k2=$_r($());Lb.UsageTokens=k2.serialization.object({inputTokens:k2.serialization.property("input_tokens",k2.serialization.number().optional()),outputTokens:k2.serialization.property("output_tokens",k2.serialization.number().optional())})});var XY=b(Fb=>{"use strict";var q_r=Fb&&Fb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),U_r=Fb&&Fb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),z_r=Fb&&Fb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&q_r(t,e,r);return U_r(t,e),t};Object.defineProperty(Fb,"__esModule",{value:!0});Fb.Usage=void 0;var Upt=z_r($()),H_r=Nve(),V_r=Lve();Fb.Usage=Upt.serialization.object({billedUnits:Upt.serialization.property("billed_units",H_r.UsageBilledUnits.optional()),tokens:V_r.UsageTokens.optional()})});var zpt=b(kb=>{"use strict";var W_r=kb&&kb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),J_r=kb&&kb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),G_r=kb&&kb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&W_r(t,e,r);return J_r(t,e),t};Object.defineProperty(kb,"__esModule",{value:!0});kb.NonStreamedChatResponse2=void 0;var QY=G_r($()),K_r=ZY(),Y_r=jve(),Z_r=XY();kb.NonStreamedChatResponse2=QY.serialization.object({id:QY.serialization.string(),finishReason:QY.serialization.property("finish_reason",K_r.ChatFinishReason),prompt:QY.serialization.string().optional(),message:Y_r.AssistantMessageResponse.optional(),usage:Z_r.Usage.optional()})});var gp=b(Bb=>{"use strict";var X_r=Bb&&Bb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Q_r=Bb&&Bb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),evr=Bb&&Bb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&X_r(t,e,r);return Q_r(t,e),t};Object.defineProperty(Bb,"__esModule",{value:!0});Bb.ChatStreamEventType=void 0;var tvr=evr($());Bb.ChatStreamEventType=tvr.serialization.object({})});var Fve=b($b=>{"use strict";var rvr=$b&&$b.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),nvr=$b&&$b.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ovr=$b&&$b.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&rvr(t,e,r);return nvr(t,e),t};Object.defineProperty($b,"__esModule",{value:!0});$b.ChatMessageStartEventDeltaMessage=void 0;var Hpt=ovr($());$b.ChatMessageStartEventDeltaMessage=Hpt.serialization.object({role:Hpt.serialization.stringLiteral("assistant").optional()})});var kve=b(qb=>{"use strict";var ivr=qb&&qb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),avr=qb&&qb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),svr=qb&&qb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ivr(t,e,r);return avr(t,e),t};Object.defineProperty(qb,"__esModule",{value:!0});qb.ChatMessageStartEventDelta=void 0;var uvr=svr($()),lvr=Fve();qb.ChatMessageStartEventDelta=uvr.serialization.object({message:lvr.ChatMessageStartEventDeltaMessage.optional()})});var Bve=b(Ub=>{"use strict";var cvr=Ub&&Ub.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),dvr=Ub&&Ub.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),fvr=Ub&&Ub.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&cvr(t,e,r);return dvr(t,e),t};Object.defineProperty(Ub,"__esModule",{value:!0});Ub.ChatMessageStartEvent=void 0;var Vpt=fvr($()),pvr=kve(),hvr=gp();Ub.ChatMessageStartEvent=Vpt.serialization.object({id:Vpt.serialization.string().optional(),delta:pvr.ChatMessageStartEventDelta.optional()}).extend(hvr.ChatStreamEventType)});var qve=b(zb=>{"use strict";var mvr=zb&&zb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),gvr=zb&&zb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),yvr=zb&&zb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&mvr(t,e,r);return gvr(t,e),t};Object.defineProperty(zb,"__esModule",{value:!0});zb.ChatContentStartEventDeltaMessageContent=void 0;var $ve=yvr($());zb.ChatContentStartEventDeltaMessageContent=$ve.serialization.object({text:$ve.serialization.string().optional(),type:$ve.serialization.stringLiteral("text").optional()})});var Uve=b(Hb=>{"use strict";var bvr=Hb&&Hb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),_vr=Hb&&Hb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vvr=Hb&&Hb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&bvr(t,e,r);return _vr(t,e),t};Object.defineProperty(Hb,"__esModule",{value:!0});Hb.ChatContentStartEventDeltaMessage=void 0;var wvr=vvr($()),Svr=qve();Hb.ChatContentStartEventDeltaMessage=wvr.serialization.object({content:Svr.ChatContentStartEventDeltaMessageContent.optional()})});var zve=b(Vb=>{"use strict";var xvr=Vb&&Vb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Cvr=Vb&&Vb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ovr=Vb&&Vb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&xvr(t,e,r);return Cvr(t,e),t};Object.defineProperty(Vb,"__esModule",{value:!0});Vb.ChatContentStartEventDelta=void 0;var Evr=Ovr($()),Pvr=Uve();Vb.ChatContentStartEventDelta=Evr.serialization.object({message:Pvr.ChatContentStartEventDeltaMessage.optional()})});var Hve=b(Wb=>{"use strict";var Tvr=Wb&&Wb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Mvr=Wb&&Wb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ivr=Wb&&Wb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Tvr(t,e,r);return Mvr(t,e),t};Object.defineProperty(Wb,"__esModule",{value:!0});Wb.ChatContentStartEvent=void 0;var Wpt=Ivr($()),Avr=zve(),Rvr=gp();Wb.ChatContentStartEvent=Wpt.serialization.object({index:Wpt.serialization.number().optional(),delta:Avr.ChatContentStartEventDelta.optional()}).extend(Rvr.ChatStreamEventType)});var Vve=b(Jb=>{"use strict";var Dvr=Jb&&Jb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),jvr=Jb&&Jb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Nvr=Jb&&Jb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Dvr(t,e,r);return jvr(t,e),t};Object.defineProperty(Jb,"__esModule",{value:!0});Jb.ChatContentDeltaEventDeltaMessageContent=void 0;var Jpt=Nvr($());Jb.ChatContentDeltaEventDeltaMessageContent=Jpt.serialization.object({text:Jpt.serialization.string().optional()})});var Wve=b(Gb=>{"use strict";var Lvr=Gb&&Gb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Fvr=Gb&&Gb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),kvr=Gb&&Gb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Lvr(t,e,r);return Fvr(t,e),t};Object.defineProperty(Gb,"__esModule",{value:!0});Gb.ChatContentDeltaEventDeltaMessage=void 0;var Bvr=kvr($()),$vr=Vve();Gb.ChatContentDeltaEventDeltaMessage=Bvr.serialization.object({content:$vr.ChatContentDeltaEventDeltaMessageContent.optional()})});var Jve=b(Kb=>{"use strict";var qvr=Kb&&Kb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Uvr=Kb&&Kb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),zvr=Kb&&Kb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&qvr(t,e,r);return Uvr(t,e),t};Object.defineProperty(Kb,"__esModule",{value:!0});Kb.ChatContentDeltaEventDelta=void 0;var Hvr=zvr($()),Vvr=Wve();Kb.ChatContentDeltaEventDelta=Hvr.serialization.object({message:Vvr.ChatContentDeltaEventDeltaMessage.optional()})});var Gve=b(Yb=>{"use strict";var Wvr=Yb&&Yb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Jvr=Yb&&Yb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Gvr=Yb&&Yb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Wvr(t,e,r);return Jvr(t,e),t};Object.defineProperty(Yb,"__esModule",{value:!0});Yb.ChatContentDeltaEvent=void 0;var Gpt=Gvr($()),Kvr=Jve(),Yvr=gp();Yb.ChatContentDeltaEvent=Gpt.serialization.object({index:Gpt.serialization.number().optional(),delta:Kvr.ChatContentDeltaEventDelta.optional()}).extend(Yvr.ChatStreamEventType)});var Kve=b(Zb=>{"use strict";var Zvr=Zb&&Zb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Xvr=Zb&&Zb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Qvr=Zb&&Zb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Zvr(t,e,r);return Xvr(t,e),t};Object.defineProperty(Zb,"__esModule",{value:!0});Zb.ChatContentEndEvent=void 0;var Kpt=Qvr($()),e0r=gp();Zb.ChatContentEndEvent=Kpt.serialization.object({index:Kpt.serialization.number().optional()}).extend(e0r.ChatStreamEventType)});var Zve=b(Xb=>{"use strict";var t0r=Xb&&Xb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),r0r=Xb&&Xb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n0r=Xb&&Xb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&t0r(t,e,r);return r0r(t,e),t};Object.defineProperty(Xb,"__esModule",{value:!0});Xb.ChatToolPlanDeltaEventDelta=void 0;var Yve=n0r($());Xb.ChatToolPlanDeltaEventDelta=Yve.serialization.object({toolPlan:Yve.serialization.property("tool_plan",Yve.serialization.string().optional())})});var Xve=b(Qb=>{"use strict";var o0r=Qb&&Qb.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),i0r=Qb&&Qb.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a0r=Qb&&Qb.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&o0r(t,e,r);return i0r(t,e),t};Object.defineProperty(Qb,"__esModule",{value:!0});Qb.ChatToolPlanDeltaEvent=void 0;var s0r=a0r($()),u0r=Zve(),l0r=gp();Qb.ChatToolPlanDeltaEvent=s0r.serialization.object({delta:u0r.ChatToolPlanDeltaEventDelta.optional()}).extend(l0r.ChatStreamEventType)});var e0e=b(e_=>{"use strict";var c0r=e_&&e_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),d0r=e_&&e_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),f0r=e_&&e_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&c0r(t,e,r);return d0r(t,e),t};Object.defineProperty(e_,"__esModule",{value:!0});e_.ChatToolCallStartEventDeltaToolCallFunction=void 0;var Qve=f0r($());e_.ChatToolCallStartEventDeltaToolCallFunction=Qve.serialization.object({name:Qve.serialization.string().optional(),arguments:Qve.serialization.string().optional()})});var r0e=b(t_=>{"use strict";var p0r=t_&&t_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),h0r=t_&&t_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),m0r=t_&&t_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&p0r(t,e,r);return h0r(t,e),t};Object.defineProperty(t_,"__esModule",{value:!0});t_.ChatToolCallStartEventDeltaToolCall=void 0;var t0e=m0r($()),g0r=e0e();t_.ChatToolCallStartEventDeltaToolCall=t0e.serialization.object({id:t0e.serialization.string().optional(),type:t0e.serialization.stringLiteral("function").optional(),function:g0r.ChatToolCallStartEventDeltaToolCallFunction.optional()})});var n0e=b(r_=>{"use strict";var y0r=r_&&r_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),b0r=r_&&r_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_0r=r_&&r_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&y0r(t,e,r);return b0r(t,e),t};Object.defineProperty(r_,"__esModule",{value:!0});r_.ChatToolCallStartEventDelta=void 0;var Ypt=_0r($()),v0r=r0e();r_.ChatToolCallStartEventDelta=Ypt.serialization.object({toolCall:Ypt.serialization.property("tool_call",v0r.ChatToolCallStartEventDeltaToolCall.optional())})});var o0e=b(n_=>{"use strict";var w0r=n_&&n_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),S0r=n_&&n_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),x0r=n_&&n_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&w0r(t,e,r);return S0r(t,e),t};Object.defineProperty(n_,"__esModule",{value:!0});n_.ChatToolCallStartEvent=void 0;var Zpt=x0r($()),C0r=n0e(),O0r=gp();n_.ChatToolCallStartEvent=Zpt.serialization.object({index:Zpt.serialization.number().optional(),delta:C0r.ChatToolCallStartEventDelta.optional()}).extend(O0r.ChatStreamEventType)});var i0e=b(o_=>{"use strict";var E0r=o_&&o_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),P0r=o_&&o_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),T0r=o_&&o_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&E0r(t,e,r);return P0r(t,e),t};Object.defineProperty(o_,"__esModule",{value:!0});o_.ChatToolCallDeltaEventDeltaToolCallFunction=void 0;var Xpt=T0r($());o_.ChatToolCallDeltaEventDeltaToolCallFunction=Xpt.serialization.object({arguments:Xpt.serialization.string().optional()})});var a0e=b(i_=>{"use strict";var M0r=i_&&i_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),I0r=i_&&i_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),A0r=i_&&i_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&M0r(t,e,r);return I0r(t,e),t};Object.defineProperty(i_,"__esModule",{value:!0});i_.ChatToolCallDeltaEventDeltaToolCall=void 0;var R0r=A0r($()),D0r=i0e();i_.ChatToolCallDeltaEventDeltaToolCall=R0r.serialization.object({function:D0r.ChatToolCallDeltaEventDeltaToolCallFunction.optional()})});var s0e=b(a_=>{"use strict";var j0r=a_&&a_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),N0r=a_&&a_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),L0r=a_&&a_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&j0r(t,e,r);return N0r(t,e),t};Object.defineProperty(a_,"__esModule",{value:!0});a_.ChatToolCallDeltaEventDelta=void 0;var Qpt=L0r($()),F0r=a0e();a_.ChatToolCallDeltaEventDelta=Qpt.serialization.object({toolCall:Qpt.serialization.property("tool_call",F0r.ChatToolCallDeltaEventDeltaToolCall.optional())})});var u0e=b(s_=>{"use strict";var k0r=s_&&s_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),B0r=s_&&s_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$0r=s_&&s_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&k0r(t,e,r);return B0r(t,e),t};Object.defineProperty(s_,"__esModule",{value:!0});s_.ChatToolCallDeltaEvent=void 0;var eht=$0r($()),q0r=s0e(),U0r=gp();s_.ChatToolCallDeltaEvent=eht.serialization.object({index:eht.serialization.number().optional(),delta:q0r.ChatToolCallDeltaEventDelta.optional()}).extend(U0r.ChatStreamEventType)});var l0e=b(u_=>{"use strict";var z0r=u_&&u_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),H0r=u_&&u_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),V0r=u_&&u_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&z0r(t,e,r);return H0r(t,e),t};Object.defineProperty(u_,"__esModule",{value:!0});u_.ChatToolCallEndEvent=void 0;var tht=V0r($()),W0r=gp();u_.ChatToolCallEndEvent=tht.serialization.object({index:tht.serialization.number().optional()}).extend(W0r.ChatStreamEventType)});var c0e=b(l_=>{"use strict";var J0r=l_&&l_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),G0r=l_&&l_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),K0r=l_&&l_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&J0r(t,e,r);return G0r(t,e),t};Object.defineProperty(l_,"__esModule",{value:!0});l_.ChatMessageEndEventDelta=void 0;var rht=K0r($()),Y0r=ZY(),Z0r=XY();l_.ChatMessageEndEventDelta=rht.serialization.object({finishReason:rht.serialization.property("finish_reason",Y0r.ChatFinishReason.optional()),usage:Z0r.Usage.optional()})});var d0e=b(c_=>{"use strict";var X0r=c_&&c_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Q0r=c_&&c_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ewr=c_&&c_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&X0r(t,e,r);return Q0r(t,e),t};Object.defineProperty(c_,"__esModule",{value:!0});c_.ChatMessageEndEvent=void 0;var nht=ewr($()),twr=c0e(),rwr=gp();c_.ChatMessageEndEvent=nht.serialization.object({id:nht.serialization.string().optional(),delta:twr.ChatMessageEndEventDelta.optional()}).extend(rwr.ChatStreamEventType)});var f0e=b(d_=>{"use strict";var nwr=d_&&d_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),owr=d_&&d_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),iwr=d_&&d_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&nwr(t,e,r);return owr(t,e),t};Object.defineProperty(d_,"__esModule",{value:!0});d_.CitationStartEventDeltaMessage=void 0;var awr=iwr($()),swr=L2();d_.CitationStartEventDeltaMessage=awr.serialization.object({citations:swr.Citation.optional()})});var p0e=b(f_=>{"use strict";var uwr=f_&&f_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),lwr=f_&&f_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),cwr=f_&&f_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&uwr(t,e,r);return lwr(t,e),t};Object.defineProperty(f_,"__esModule",{value:!0});f_.CitationStartEventDelta=void 0;var dwr=cwr($()),fwr=f0e();f_.CitationStartEventDelta=dwr.serialization.object({message:fwr.CitationStartEventDeltaMessage.optional()})});var h0e=b(p_=>{"use strict";var pwr=p_&&p_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hwr=p_&&p_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),mwr=p_&&p_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&pwr(t,e,r);return hwr(t,e),t};Object.defineProperty(p_,"__esModule",{value:!0});p_.CitationStartEvent=void 0;var oht=mwr($()),gwr=p0e(),ywr=gp();p_.CitationStartEvent=oht.serialization.object({index:oht.serialization.number().optional(),delta:gwr.CitationStartEventDelta.optional()}).extend(ywr.ChatStreamEventType)});var m0e=b(h_=>{"use strict";var bwr=h_&&h_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),_wr=h_&&h_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vwr=h_&&h_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&bwr(t,e,r);return _wr(t,e),t};Object.defineProperty(h_,"__esModule",{value:!0});h_.CitationEndEvent=void 0;var iht=vwr($()),wwr=gp();h_.CitationEndEvent=iht.serialization.object({index:iht.serialization.number().optional()}).extend(wwr.ChatStreamEventType)});var aht=b(m_=>{"use strict";var Swr=m_&&m_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),xwr=m_&&m_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Cwr=m_&&m_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Swr(t,e,r);return xwr(t,e),t};Object.defineProperty(m_,"__esModule",{value:!0});m_.StreamedChatResponse2=void 0;var Owr=Cwr($()),Ewr=Bve(),Pwr=Hve(),Twr=Gve(),Mwr=Kve(),Iwr=Xve(),Awr=o0e(),Rwr=u0e(),Dwr=l0e(),jwr=h0e(),Nwr=m0e(),Lwr=d0e();m_.StreamedChatResponse2=Owr.serialization.union("type",{"message-start":Ewr.ChatMessageStartEvent,"content-start":Pwr.ChatContentStartEvent,"content-delta":Twr.ChatContentDeltaEvent,"content-end":Mwr.ChatContentEndEvent,"tool-plan-delta":Iwr.ChatToolPlanDeltaEvent,"tool-call-start":Awr.ChatToolCallStartEvent,"tool-call-delta":Rwr.ChatToolCallDeltaEvent,"tool-call-end":Dwr.ChatToolCallEndEvent,"citation-start":jwr.CitationStartEvent,"citation-end":Nwr.CitationEndEvent,"message-end":Lwr.ChatMessageEndEvent}).transform({transform:e=>e,untransform:e=>e})});var g0e=b(st=>{"use strict";var Fwr=st&&st.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),bt=st&&st.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Fwr(t,e,r)};Object.defineProperty(st,"__esModule",{value:!0});bt(sve(),st);bt(uve(),st);bt(NL(),st);bt(lve(),st);bt(dve(),st);bt(pve(),st);bt(mve(),st);bt(JY(),st);bt(yve(),st);bt(bve(),st);bt(_ve(),st);bt(L2(),st);bt(vve(),st);bt(Sve(),st);bt(xve(),st);bt(Cve(),st);bt(Eve(),st);bt(Pve(),st);bt(Tve(),st);bt(Mve(),st);bt(Ive(),st);bt(Ave(),st);bt(KY(),st);bt(Rve(),st);bt(YY(),st);bt(ZY(),st);bt(Dve(),st);bt(jve(),st);bt(Nve(),st);bt(Lve(),st);bt(XY(),st);bt(zpt(),st);bt(gp(),st);bt(Fve(),st);bt(kve(),st);bt(Bve(),st);bt(qve(),st);bt(Uve(),st);bt(zve(),st);bt(Hve(),st);bt(Vve(),st);bt(Wve(),st);bt(Jve(),st);bt(Gve(),st);bt(Kve(),st);bt(Zve(),st);bt(Xve(),st);bt(e0e(),st);bt(r0e(),st);bt(n0e(),st);bt(o0e(),st);bt(i0e(),st);bt(a0e(),st);bt(s0e(),st);bt(u0e(),st);bt(l0e(),st);bt(c0e(),st);bt(d0e(),st);bt(aht(),st)});var eZ=b(g_=>{"use strict";var kwr=g_&&g_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Bwr=g_&&g_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$wr=g_&&g_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&kwr(t,e,r);return Bwr(t,e),t};Object.defineProperty(g_,"__esModule",{value:!0});g_.TextResponseFormat=void 0;var qwr=$wr($());g_.TextResponseFormat=qwr.serialization.object({})});var y0e=b(y_=>{"use strict";var Uwr=y_&&y_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),zwr=y_&&y_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Hwr=y_&&y_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Uwr(t,e,r);return zwr(t,e),t};Object.defineProperty(y_,"__esModule",{value:!0});y_.JsonResponseFormat2=void 0;var B2=Hwr($());y_.JsonResponseFormat2=B2.serialization.object({jsonSchema:B2.serialization.property("json_schema",B2.serialization.record(B2.serialization.string(),B2.serialization.unknown()).optional())})});var tZ=b(b_=>{"use strict";var Vwr=b_&&b_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Wwr=b_&&b_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Jwr=b_&&b_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Vwr(t,e,r);return Wwr(t,e),t};Object.defineProperty(b_,"__esModule",{value:!0});b_.ResponseFormat2=void 0;var Gwr=Jwr($()),Kwr=eZ(),Ywr=y0e();b_.ResponseFormat2=Gwr.serialization.union("type",{text:Kwr.TextResponseFormat,json_object:Ywr.JsonResponseFormat2}).transform({transform:e=>e,untransform:e=>e})});var sht=b(__=>{"use strict";var Zwr=__&&__.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Xwr=__&&__.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Qwr=__&&__.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Zwr(t,e,r);return Xwr(t,e),t};Object.defineProperty(__,"__esModule",{value:!0});__.V2ChatStreamRequest=void 0;var ds=Qwr($()),eSr=KY(),tSr=YY(),rSr=sve(),nSr=tZ();__.V2ChatStreamRequest=ds.serialization.object({model:ds.serialization.string(),messages:eSr.ChatMessages,tools:ds.serialization.list(tSr.Tool2).optional(),citationMode:ds.serialization.property("citation_mode",rSr.V2ChatStreamRequestCitationMode.optional()),responseFormat:ds.serialization.property("response_format",nSr.ResponseFormat2.optional()),maxTokens:ds.serialization.property("max_tokens",ds.serialization.number().optional()),stopSequences:ds.serialization.property("stop_sequences",ds.serialization.list(ds.serialization.string()).optional()),temperature:ds.serialization.number().optional(),seed:ds.serialization.number().optional(),frequencyPenalty:ds.serialization.property("frequency_penalty",ds.serialization.number().optional()),presencePenalty:ds.serialization.property("presence_penalty",ds.serialization.number().optional()),k:ds.serialization.number().optional(),p:ds.serialization.number().optional(),returnPrompt:ds.serialization.property("return_prompt",ds.serialization.boolean().optional())})});var uht=b(v_=>{"use strict";var oSr=v_&&v_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),iSr=v_&&v_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),aSr=v_&&v_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&oSr(t,e,r);return iSr(t,e),t};Object.defineProperty(v_,"__esModule",{value:!0});v_.V2ChatRequest=void 0;var fs=aSr($()),sSr=KY(),uSr=YY(),lSr=uve(),cSr=tZ();v_.V2ChatRequest=fs.serialization.object({model:fs.serialization.string(),messages:sSr.ChatMessages,tools:fs.serialization.list(uSr.Tool2).optional(),citationMode:fs.serialization.property("citation_mode",lSr.V2ChatRequestCitationMode.optional()),responseFormat:fs.serialization.property("response_format",cSr.ResponseFormat2.optional()),maxTokens:fs.serialization.property("max_tokens",fs.serialization.number().optional()),stopSequences:fs.serialization.property("stop_sequences",fs.serialization.list(fs.serialization.string()).optional()),temperature:fs.serialization.number().optional(),seed:fs.serialization.number().optional(),frequencyPenalty:fs.serialization.property("frequency_penalty",fs.serialization.number().optional()),presencePenalty:fs.serialization.property("presence_penalty",fs.serialization.number().optional()),k:fs.serialization.number().optional(),p:fs.serialization.number().optional(),returnPrompt:fs.serialization.property("return_prompt",fs.serialization.boolean().optional())})});var b0e=b(BL=>{"use strict";Object.defineProperty(BL,"__esModule",{value:!0});BL.V2ChatRequest=BL.V2ChatStreamRequest=void 0;var dSr=sht();Object.defineProperty(BL,"V2ChatStreamRequest",{enumerable:!0,get:function(){return dSr.V2ChatStreamRequest}});var fSr=uht();Object.defineProperty(BL,"V2ChatRequest",{enumerable:!0,get:function(){return fSr.V2ChatRequest}})});var lht=b(LA=>{"use strict";var pSr=LA&&LA.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hSr=LA&&LA.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&pSr(t,e,r)};Object.defineProperty(LA,"__esModule",{value:!0});hSr(b0e(),LA)});var dht=b(sP=>{"use strict";var mSr=sP&&sP.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),cht=sP&&sP.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&mSr(t,e,r)};Object.defineProperty(sP,"__esModule",{value:!0});cht(g0e(),sP);cht(lht(),sP)});var _0e=b(w_=>{"use strict";var gSr=w_&&w_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ySr=w_&&w_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),bSr=w_&&w_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&gSr(t,e,r);return ySr(t,e),t};Object.defineProperty(w_,"__esModule",{value:!0});w_.CreateEmbedJobRequestTruncate=void 0;var _Sr=bSr($());w_.CreateEmbedJobRequestTruncate=_Sr.serialization.enum_(["START","END"])});var v0e=b(FA=>{"use strict";var vSr=FA&&FA.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),wSr=FA&&FA.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&vSr(t,e,r)};Object.defineProperty(FA,"__esModule",{value:!0});wSr(_0e(),FA)});var rZ=b(S_=>{"use strict";var SSr=S_&&S_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),xSr=S_&&S_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),CSr=S_&&S_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&SSr(t,e,r);return xSr(t,e),t};Object.defineProperty(S_,"__esModule",{value:!0});S_.EmbedInputType=void 0;var OSr=CSr($());S_.EmbedInputType=OSr.serialization.enum_(["search_document","search_query","classification","clustering"])});var nZ=b(x_=>{"use strict";var ESr=x_&&x_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),PSr=x_&&x_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),TSr=x_&&x_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ESr(t,e,r);return PSr(t,e),t};Object.defineProperty(x_,"__esModule",{value:!0});x_.EmbeddingType=void 0;var MSr=TSr($());x_.EmbeddingType=MSr.serialization.enum_(["float","int8","uint8","binary","ubinary"])});var fht=b(C_=>{"use strict";var ISr=C_&&C_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ASr=C_&&C_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),RSr=C_&&C_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ISr(t,e,r);return ASr(t,e),t};Object.defineProperty(C_,"__esModule",{value:!0});C_.CreateEmbedJobRequest=void 0;var uP=RSr($()),DSr=rZ(),jSr=nZ(),NSr=_0e();C_.CreateEmbedJobRequest=uP.serialization.object({model:uP.serialization.string(),datasetId:uP.serialization.property("dataset_id",uP.serialization.string()),inputType:uP.serialization.property("input_type",DSr.EmbedInputType),name:uP.serialization.string().optional(),embeddingTypes:uP.serialization.property("embedding_types",uP.serialization.list(jSr.EmbeddingType).optional()),truncate:NSr.CreateEmbedJobRequestTruncate.optional()})});var w0e=b(oZ=>{"use strict";Object.defineProperty(oZ,"__esModule",{value:!0});oZ.CreateEmbedJobRequest=void 0;var LSr=fht();Object.defineProperty(oZ,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return LSr.CreateEmbedJobRequest}})});var pht=b(kA=>{"use strict";var FSr=kA&&kA.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),kSr=kA&&kA.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&FSr(t,e,r)};Object.defineProperty(kA,"__esModule",{value:!0});kSr(w0e(),kA)});var mht=b(lP=>{"use strict";var BSr=lP&&lP.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hht=lP&&lP.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&BSr(t,e,r)};Object.defineProperty(lP,"__esModule",{value:!0});hht(v0e(),lP);hht(pht(),lP)});var S0e=b(O_=>{"use strict";var $Sr=O_&&O_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),qSr=O_&&O_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),USr=O_&&O_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$Sr(t,e,r);return qSr(t,e),t};Object.defineProperty(O_,"__esModule",{value:!0});O_.DatasetType=void 0;var zSr=USr($());O_.DatasetType=zSr.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 x0e=b(E_=>{"use strict";var HSr=E_&&E_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),VSr=E_&&E_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),WSr=E_&&E_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&HSr(t,e,r);return VSr(t,e),t};Object.defineProperty(E_,"__esModule",{value:!0});E_.DatasetValidationStatus=void 0;var JSr=WSr($());E_.DatasetValidationStatus=JSr.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var C0e=b(P_=>{"use strict";var GSr=P_&&P_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),KSr=P_&&P_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),YSr=P_&&P_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&GSr(t,e,r);return KSr(t,e),t};Object.defineProperty(P_,"__esModule",{value:!0});P_.DatasetPart=void 0;var yp=YSr($());P_.DatasetPart=yp.serialization.object({id:yp.serialization.string(),name:yp.serialization.string(),url:yp.serialization.string().optional(),index:yp.serialization.number().optional(),sizeBytes:yp.serialization.property("size_bytes",yp.serialization.number().optional()),numRows:yp.serialization.property("num_rows",yp.serialization.number().optional()),originalUrl:yp.serialization.property("original_url",yp.serialization.string().optional()),samples:yp.serialization.list(yp.serialization.string()).optional()})});var iZ=b(T_=>{"use strict";var ZSr=T_&&T_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),XSr=T_&&T_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),QSr=T_&&T_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ZSr(t,e,r);return XSr(t,e),t};Object.defineProperty(T_,"__esModule",{value:!0});T_.Dataset=void 0;var da=QSr($()),exr=S0e(),txr=x0e(),rxr=C0e();T_.Dataset=da.serialization.object({id:da.serialization.string(),name:da.serialization.string(),createdAt:da.serialization.property("created_at",da.serialization.date()),updatedAt:da.serialization.property("updated_at",da.serialization.date()),datasetType:da.serialization.property("dataset_type",exr.DatasetType),validationStatus:da.serialization.property("validation_status",txr.DatasetValidationStatus),validationError:da.serialization.property("validation_error",da.serialization.string().optional()),schema:da.serialization.string().optional(),requiredFields:da.serialization.property("required_fields",da.serialization.list(da.serialization.string()).optional()),preserveFields:da.serialization.property("preserve_fields",da.serialization.list(da.serialization.string()).optional()),datasetParts:da.serialization.property("dataset_parts",da.serialization.list(rxr.DatasetPart).optional()),validationWarnings:da.serialization.property("validation_warnings",da.serialization.list(da.serialization.string()).optional())})});var yht=b(M_=>{"use strict";var nxr=M_&&M_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),oxr=M_&&M_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ixr=M_&&M_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&nxr(t,e,r);return oxr(t,e),t};Object.defineProperty(M_,"__esModule",{value:!0});M_.DatasetsListResponse=void 0;var ght=ixr($()),axr=iZ();M_.DatasetsListResponse=ght.serialization.object({datasets:ght.serialization.list(axr.Dataset).optional()})});var bht=b(I_=>{"use strict";var sxr=I_&&I_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),uxr=I_&&I_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),lxr=I_&&I_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&sxr(t,e,r);return uxr(t,e),t};Object.defineProperty(I_,"__esModule",{value:!0});I_.DatasetsCreateResponseDatasetPartsItem=void 0;var cP=lxr($());I_.DatasetsCreateResponseDatasetPartsItem=cP.serialization.object({name:cP.serialization.string().optional(),numRows:cP.serialization.property("num_rows",cP.serialization.number().optional()),samples:cP.serialization.list(cP.serialization.string()).optional(),partKind:cP.serialization.property("part_kind",cP.serialization.string().optional())})});var vht=b(A_=>{"use strict";var cxr=A_&&A_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),dxr=A_&&A_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),fxr=A_&&A_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&cxr(t,e,r);return dxr(t,e),t};Object.defineProperty(A_,"__esModule",{value:!0});A_.DatasetsCreateResponse=void 0;var _ht=fxr($());A_.DatasetsCreateResponse=_ht.serialization.object({id:_ht.serialization.string().optional()})});var wht=b(R_=>{"use strict";var pxr=R_&&R_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hxr=R_&&R_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),mxr=R_&&R_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&pxr(t,e,r);return hxr(t,e),t};Object.defineProperty(R_,"__esModule",{value:!0});R_.DatasetsGetUsageResponse=void 0;var O0e=mxr($());R_.DatasetsGetUsageResponse=O0e.serialization.object({organizationUsage:O0e.serialization.property("organization_usage",O0e.serialization.number().optional())})});var Sht=b(D_=>{"use strict";var gxr=D_&&D_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),yxr=D_&&D_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),bxr=D_&&D_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&gxr(t,e,r);return yxr(t,e),t};Object.defineProperty(D_,"__esModule",{value:!0});D_.DatasetsGetResponse=void 0;var _xr=bxr($()),vxr=iZ();D_.DatasetsGetResponse=_xr.serialization.object({dataset:vxr.Dataset})});var E0e=b(cg=>{"use strict";var wxr=cg&&cg.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),$2=cg&&cg.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&wxr(t,e,r)};Object.defineProperty(cg,"__esModule",{value:!0});$2(yht(),cg);$2(bht(),cg);$2(vht(),cg);$2(wht(),cg);$2(Sht(),cg)});var xht=b(j_=>{"use strict";var Sxr=j_&&j_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),xxr=j_&&j_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Cxr=j_&&j_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Sxr(t,e,r);return xxr(t,e),t};Object.defineProperty(j_,"__esModule",{value:!0});j_.Response=void 0;var P0e=Cxr($());j_.Response=P0e.serialization.record(P0e.serialization.string(),P0e.serialization.unknown())});var Cht=b(N_=>{"use strict";var Oxr=N_&&N_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Exr=N_&&N_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Pxr=N_&&N_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Oxr(t,e,r);return Exr(t,e),t};Object.defineProperty(N_,"__esModule",{value:!0});N_.delete=void 0;N_.delete=Pxr(xht())});var Eht=b(dP=>{"use strict";var Txr=dP&&dP.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Oht=dP&&dP.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Txr(t,e,r)};Object.defineProperty(dP,"__esModule",{value:!0});Oht(E0e(),dP);Oht(Cht(),dP)});var T0e=b(L_=>{"use strict";var Mxr=L_&&L_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Ixr=L_&&L_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Axr=L_&&L_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Mxr(t,e,r);return Ixr(t,e),t};Object.defineProperty(L_,"__esModule",{value:!0});L_.BaseType=void 0;var Rxr=Axr($());L_.BaseType=Rxr.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var M0e=b(F_=>{"use strict";var Dxr=F_&&F_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),jxr=F_&&F_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Nxr=F_&&F_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Dxr(t,e,r);return jxr(t,e),t};Object.defineProperty(F_,"__esModule",{value:!0});F_.Strategy=void 0;var Lxr=Nxr($());F_.Strategy=Lxr.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var I0e=b(k_=>{"use strict";var Fxr=k_&&k_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),kxr=k_&&k_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Bxr=k_&&k_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Fxr(t,e,r);return kxr(t,e),t};Object.defineProperty(k_,"__esModule",{value:!0});k_.BaseModel=void 0;var aZ=Bxr($()),$xr=T0e(),qxr=M0e();k_.BaseModel=aZ.serialization.object({name:aZ.serialization.string().optional(),version:aZ.serialization.string().optional(),baseType:aZ.serialization.property("base_type",$xr.BaseType),strategy:qxr.Strategy.optional()})});var A0e=b(B_=>{"use strict";var Uxr=B_&&B_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),zxr=B_&&B_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Hxr=B_&&B_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Uxr(t,e,r);return zxr(t,e),t};Object.defineProperty(B_,"__esModule",{value:!0});B_.Hyperparameters=void 0;var dg=Hxr($());B_.Hyperparameters=dg.serialization.object({earlyStoppingPatience:dg.serialization.property("early_stopping_patience",dg.serialization.number().optional()),earlyStoppingThreshold:dg.serialization.property("early_stopping_threshold",dg.serialization.number().optional()),trainBatchSize:dg.serialization.property("train_batch_size",dg.serialization.number().optional()),trainEpochs:dg.serialization.property("train_epochs",dg.serialization.number().optional()),learningRate:dg.serialization.property("learning_rate",dg.serialization.number().optional())})});var R0e=b($_=>{"use strict";var Vxr=$_&&$_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Wxr=$_&&$_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Jxr=$_&&$_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Vxr(t,e,r);return Wxr(t,e),t};Object.defineProperty($_,"__esModule",{value:!0});$_.WandbConfig=void 0;var q2=Jxr($());$_.WandbConfig=q2.serialization.object({project:q2.serialization.string(),apiKey:q2.serialization.property("api_key",q2.serialization.string()),entity:q2.serialization.string().optional()})});var sZ=b(q_=>{"use strict";var Gxr=q_&&q_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Kxr=q_&&q_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Yxr=q_&&q_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Gxr(t,e,r);return Kxr(t,e),t};Object.defineProperty(q_,"__esModule",{value:!0});q_.Settings=void 0;var $L=Yxr($()),Zxr=I0e(),Xxr=A0e(),Qxr=R0e();q_.Settings=$L.serialization.object({baseModel:$L.serialization.property("base_model",Zxr.BaseModel),datasetId:$L.serialization.property("dataset_id",$L.serialization.string()),hyperparameters:Xxr.Hyperparameters.optional(),multiLabel:$L.serialization.property("multi_label",$L.serialization.boolean().optional()),wandb:Qxr.WandbConfig.optional()})});var U2=b(U_=>{"use strict";var eCr=U_&&U_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),tCr=U_&&U_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),rCr=U_&&U_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&eCr(t,e,r);return tCr(t,e),t};Object.defineProperty(U_,"__esModule",{value:!0});U_.Status=void 0;var nCr=rCr($());U_.Status=nCr.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var qL=b(z_=>{"use strict";var oCr=z_&&z_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),iCr=z_&&z_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),aCr=z_&&z_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&oCr(t,e,r);return iCr(t,e),t};Object.defineProperty(z_,"__esModule",{value:!0});z_.FinetunedModel=void 0;var kd=aCr($()),sCr=sZ(),uCr=U2();z_.FinetunedModel=kd.serialization.object({id:kd.serialization.string().optional(),name:kd.serialization.string(),creatorId:kd.serialization.property("creator_id",kd.serialization.string().optional()),organizationId:kd.serialization.property("organization_id",kd.serialization.string().optional()),settings:sCr.Settings,status:uCr.Status.optional(),createdAt:kd.serialization.property("created_at",kd.serialization.date().optional()),updatedAt:kd.serialization.property("updated_at",kd.serialization.date().optional()),completedAt:kd.serialization.property("completed_at",kd.serialization.date().optional()),lastUsed:kd.serialization.property("last_used",kd.serialization.date().optional())})});var Pht=b(H_=>{"use strict";var lCr=H_&&H_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),cCr=H_&&H_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),dCr=H_&&H_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&lCr(t,e,r);return cCr(t,e),t};Object.defineProperty(H_,"__esModule",{value:!0});H_.ListFinetunedModelsResponse=void 0;var BA=dCr($()),fCr=qL();H_.ListFinetunedModelsResponse=BA.serialization.object({finetunedModels:BA.serialization.property("finetuned_models",BA.serialization.list(fCr.FinetunedModel).optional()),nextPageToken:BA.serialization.property("next_page_token",BA.serialization.string().optional()),totalSize:BA.serialization.property("total_size",BA.serialization.number().optional())})});var Mht=b(V_=>{"use strict";var pCr=V_&&V_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hCr=V_&&V_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),mCr=V_&&V_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&pCr(t,e,r);return hCr(t,e),t};Object.defineProperty(V_,"__esModule",{value:!0});V_.CreateFinetunedModelResponse=void 0;var Tht=mCr($()),gCr=qL();V_.CreateFinetunedModelResponse=Tht.serialization.object({finetunedModel:Tht.serialization.property("finetuned_model",gCr.FinetunedModel.optional())})});var Aht=b(W_=>{"use strict";var yCr=W_&&W_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),bCr=W_&&W_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_Cr=W_&&W_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&yCr(t,e,r);return bCr(t,e),t};Object.defineProperty(W_,"__esModule",{value:!0});W_.GetFinetunedModelResponse=void 0;var Iht=_Cr($()),vCr=qL();W_.GetFinetunedModelResponse=Iht.serialization.object({finetunedModel:Iht.serialization.property("finetuned_model",vCr.FinetunedModel.optional())})});var Rht=b(J_=>{"use strict";var wCr=J_&&J_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),SCr=J_&&J_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),xCr=J_&&J_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&wCr(t,e,r);return SCr(t,e),t};Object.defineProperty(J_,"__esModule",{value:!0});J_.DeleteFinetunedModelResponse=void 0;var D0e=xCr($());J_.DeleteFinetunedModelResponse=D0e.serialization.record(D0e.serialization.string(),D0e.serialization.unknown())});var jht=b(G_=>{"use strict";var CCr=G_&&G_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),OCr=G_&&G_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ECr=G_&&G_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&CCr(t,e,r);return OCr(t,e),t};Object.defineProperty(G_,"__esModule",{value:!0});G_.UpdateFinetunedModelResponse=void 0;var Dht=ECr($()),PCr=qL();G_.UpdateFinetunedModelResponse=Dht.serialization.object({finetunedModel:Dht.serialization.property("finetuned_model",PCr.FinetunedModel.optional())})});var j0e=b(K_=>{"use strict";var TCr=K_&&K_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),MCr=K_&&K_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ICr=K_&&K_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&TCr(t,e,r);return MCr(t,e),t};Object.defineProperty(K_,"__esModule",{value:!0});K_.Event=void 0;var z2=ICr($()),ACr=U2();K_.Event=z2.serialization.object({userId:z2.serialization.property("user_id",z2.serialization.string().optional()),status:ACr.Status.optional(),createdAt:z2.serialization.property("created_at",z2.serialization.date().optional())})});var Nht=b(Y_=>{"use strict";var RCr=Y_&&Y_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),DCr=Y_&&Y_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),jCr=Y_&&Y_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&RCr(t,e,r);return DCr(t,e),t};Object.defineProperty(Y_,"__esModule",{value:!0});Y_.ListEventsResponse=void 0;var UL=jCr($()),NCr=j0e();Y_.ListEventsResponse=UL.serialization.object({events:UL.serialization.list(NCr.Event).optional(),nextPageToken:UL.serialization.property("next_page_token",UL.serialization.string().optional()),totalSize:UL.serialization.property("total_size",UL.serialization.number().optional())})});var N0e=b(Z_=>{"use strict";var LCr=Z_&&Z_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),FCr=Z_&&Z_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),kCr=Z_&&Z_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&LCr(t,e,r);return FCr(t,e),t};Object.defineProperty(Z_,"__esModule",{value:!0});Z_.TrainingStepMetrics=void 0;var fP=kCr($());Z_.TrainingStepMetrics=fP.serialization.object({createdAt:fP.serialization.property("created_at",fP.serialization.date().optional()),stepNumber:fP.serialization.property("step_number",fP.serialization.number().optional()),metrics:fP.serialization.record(fP.serialization.string(),fP.serialization.number()).optional()})});var Lht=b(X_=>{"use strict";var BCr=X_&&X_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),$Cr=X_&&X_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),qCr=X_&&X_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&BCr(t,e,r);return $Cr(t,e),t};Object.defineProperty(X_,"__esModule",{value:!0});X_.ListTrainingStepMetricsResponse=void 0;var H2=qCr($()),UCr=N0e();X_.ListTrainingStepMetricsResponse=H2.serialization.object({stepMetrics:H2.serialization.property("step_metrics",H2.serialization.list(UCr.TrainingStepMetrics).optional()),nextPageToken:H2.serialization.property("next_page_token",H2.serialization.string().optional())})});var L0e=b(fa=>{"use strict";var zCr=fa&&fa.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ec=fa&&fa.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&zCr(t,e,r)};Object.defineProperty(fa,"__esModule",{value:!0});ec(T0e(),fa);ec(M0e(),fa);ec(I0e(),fa);ec(A0e(),fa);ec(R0e(),fa);ec(sZ(),fa);ec(U2(),fa);ec(qL(),fa);ec(Pht(),fa);ec(Mht(),fa);ec(Aht(),fa);ec(Rht(),fa);ec(jht(),fa);ec(j0e(),fa);ec(Nht(),fa);ec(N0e(),fa);ec(Lht(),fa)});var Fht=b($A=>{"use strict";var HCr=$A&&$A.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),VCr=$A&&$A.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&HCr(t,e,r)};Object.defineProperty($A,"__esModule",{value:!0});VCr(L0e(),$A)});var Bht=b(bp=>{"use strict";var kht=bp&&bp.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),WCr=bp&&bp.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),JCr=bp&&bp.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&kht(t,e,r);return WCr(t,e),t},GCr=bp&&bp.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&kht(t,e,r)};Object.defineProperty(bp,"__esModule",{value:!0});bp.finetuning=void 0;bp.finetuning=JCr(Fht());GCr(L0e(),bp)});var $ht=b(Q_=>{"use strict";var KCr=Q_&&Q_.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),YCr=Q_&&Q_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ZCr=Q_&&Q_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&KCr(t,e,r);return YCr(t,e),t};Object.defineProperty(Q_,"__esModule",{value:!0});Q_.FinetuningUpdateFinetunedModelRequest=void 0;var wf=ZCr($()),XCr=sZ(),QCr=U2();Q_.FinetuningUpdateFinetunedModelRequest=wf.serialization.object({name:wf.serialization.string(),creatorId:wf.serialization.property("creator_id",wf.serialization.string().optional()),organizationId:wf.serialization.property("organization_id",wf.serialization.string().optional()),settings:XCr.Settings,status:QCr.Status.optional(),createdAt:wf.serialization.property("created_at",wf.serialization.date().optional()),updatedAt:wf.serialization.property("updated_at",wf.serialization.date().optional()),completedAt:wf.serialization.property("completed_at",wf.serialization.date().optional()),lastUsed:wf.serialization.property("last_used",wf.serialization.date().optional())})});var F0e=b(uZ=>{"use strict";Object.defineProperty(uZ,"__esModule",{value:!0});uZ.FinetuningUpdateFinetunedModelRequest=void 0;var eOr=$ht();Object.defineProperty(uZ,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return eOr.FinetuningUpdateFinetunedModelRequest}})});var qht=b(qA=>{"use strict";var tOr=qA&&qA.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),rOr=qA&&qA.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&tOr(t,e,r)};Object.defineProperty(qA,"__esModule",{value:!0});rOr(F0e(),qA)});var zht=b(pP=>{"use strict";var nOr=pP&&pP.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Uht=pP&&pP.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&nOr(t,e,r)};Object.defineProperty(pP,"__esModule",{value:!0});Uht(Bht(),pP);Uht(qht(),pP)});var lZ=b(tv=>{"use strict";var oOr=tv&&tv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),iOr=tv&&tv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),aOr=tv&&tv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&oOr(t,e,r);return iOr(t,e),t};Object.defineProperty(tv,"__esModule",{value:!0});tv.CreateConnectorOAuth=void 0;var ev=aOr($());tv.CreateConnectorOAuth=ev.serialization.object({clientId:ev.serialization.property("client_id",ev.serialization.string().optional()),clientSecret:ev.serialization.property("client_secret",ev.serialization.string().optional()),authorizeUrl:ev.serialization.property("authorize_url",ev.serialization.string().optional()),tokenUrl:ev.serialization.property("token_url",ev.serialization.string().optional()),scope:ev.serialization.string().optional()})});var k0e=b(rv=>{"use strict";var sOr=rv&&rv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),uOr=rv&&rv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),lOr=rv&&rv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&sOr(t,e,r);return uOr(t,e),t};Object.defineProperty(rv,"__esModule",{value:!0});rv.AuthTokenType=void 0;var cOr=lOr($());rv.AuthTokenType=cOr.serialization.enum_(["bearer","basic","noscheme"])});var cZ=b(nv=>{"use strict";var dOr=nv&&nv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),fOr=nv&&nv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),pOr=nv&&nv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&dOr(t,e,r);return fOr(t,e),t};Object.defineProperty(nv,"__esModule",{value:!0});nv.CreateConnectorServiceAuth=void 0;var Hht=pOr($()),hOr=k0e();nv.CreateConnectorServiceAuth=Hht.serialization.object({type:hOr.AuthTokenType,token:Hht.serialization.string()})});var Vht=b(iv=>{"use strict";var mOr=iv&&iv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),gOr=iv&&iv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),yOr=iv&&iv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&mOr(t,e,r);return gOr(t,e),t};Object.defineProperty(iv,"__esModule",{value:!0});iv.CreateConnectorRequest=void 0;var ov=yOr($()),bOr=lZ(),_Or=cZ();iv.CreateConnectorRequest=ov.serialization.object({name:ov.serialization.string(),description:ov.serialization.string().optional(),url:ov.serialization.string(),excludes:ov.serialization.list(ov.serialization.string()).optional(),oauth:bOr.CreateConnectorOAuth.optional(),active:ov.serialization.boolean().optional(),continueOnFailure:ov.serialization.property("continue_on_failure",ov.serialization.boolean().optional()),serviceAuth:ov.serialization.property("service_auth",_Or.CreateConnectorServiceAuth.optional())})});var Wht=b(av=>{"use strict";var vOr=av&&av.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),wOr=av&&av.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),SOr=av&&av.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&vOr(t,e,r);return wOr(t,e),t};Object.defineProperty(av,"__esModule",{value:!0});av.UpdateConnectorRequest=void 0;var Px=SOr($()),xOr=lZ(),COr=cZ();av.UpdateConnectorRequest=Px.serialization.object({name:Px.serialization.string().optional(),url:Px.serialization.string().optional(),excludes:Px.serialization.list(Px.serialization.string()).optional(),oauth:xOr.CreateConnectorOAuth.optional(),active:Px.serialization.boolean().optional(),continueOnFailure:Px.serialization.property("continue_on_failure",Px.serialization.boolean().optional()),serviceAuth:Px.serialization.property("service_auth",COr.CreateConnectorServiceAuth.optional())})});var B0e=b(zL=>{"use strict";Object.defineProperty(zL,"__esModule",{value:!0});zL.UpdateConnectorRequest=zL.CreateConnectorRequest=void 0;var OOr=Vht();Object.defineProperty(zL,"CreateConnectorRequest",{enumerable:!0,get:function(){return OOr.CreateConnectorRequest}});var EOr=Wht();Object.defineProperty(zL,"UpdateConnectorRequest",{enumerable:!0,get:function(){return EOr.UpdateConnectorRequest}})});var Jht=b(UA=>{"use strict";var POr=UA&&UA.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),TOr=UA&&UA.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&POr(t,e,r)};Object.defineProperty(UA,"__esModule",{value:!0});TOr(B0e(),UA)});var Ght=b(zA=>{"use strict";var MOr=zA&&zA.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),IOr=zA&&zA.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&MOr(t,e,r)};Object.defineProperty(zA,"__esModule",{value:!0});IOr(Jht(),zA)});var Yht=b(Qo=>{"use strict";var Kht=Qo&&Qo.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),AOr=Qo&&Qo.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),V2=Qo&&Qo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Kht(t,e,r);return AOr(t,e),t},HA=Qo&&Qo.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Kht(t,e,r)};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.connectors=Qo.finetuning=Qo.datasets=Qo.embedJobs=Qo.v2=void 0;Qo.v2=V2(dht());HA(g0e(),Qo);Qo.embedJobs=V2(mht());HA(v0e(),Qo);Qo.datasets=V2(Eht());HA(E0e(),Qo);Qo.finetuning=V2(zht());HA(b0e(),Qo);HA(w0e(),Qo);Qo.connectors=V2(Ght());HA(B0e(),Qo);HA(F0e(),Qo)});var $0e=b(sv=>{"use strict";var ROr=sv&&sv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),DOr=sv&&sv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),jOr=sv&&sv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ROr(t,e,r);return DOr(t,e),t};Object.defineProperty(sv,"__esModule",{value:!0});sv.ChatStreamRequestPromptTruncation=void 0;var NOr=jOr($());sv.ChatStreamRequestPromptTruncation=NOr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var q0e=b(uv=>{"use strict";var LOr=uv&&uv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),FOr=uv&&uv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),kOr=uv&&uv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&LOr(t,e,r);return FOr(t,e),t};Object.defineProperty(uv,"__esModule",{value:!0});uv.ChatStreamRequestCitationQuality=void 0;var BOr=kOr($());uv.ChatStreamRequestCitationQuality=BOr.serialization.enum_(["fast","accurate","off"])});var Xht=b(lv=>{"use strict";var $Or=lv&&lv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),qOr=lv&&lv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),UOr=lv&&lv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$Or(t,e,r);return qOr(t,e),t};Object.defineProperty(lv,"__esModule",{value:!0});lv.ChatStreamRequestConnectorsSearchOptions=void 0;var Zht=UOr($());lv.ChatStreamRequestConnectorsSearchOptions=Zht.serialization.object({seed:Zht.serialization.number().optional()})});var U0e=b(cv=>{"use strict";var zOr=cv&&cv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),HOr=cv&&cv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),VOr=cv&&cv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&zOr(t,e,r);return HOr(t,e),t};Object.defineProperty(cv,"__esModule",{value:!0});cv.ChatStreamRequestSafetyMode=void 0;var WOr=VOr($());cv.ChatStreamRequestSafetyMode=WOr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var emt=b(dv=>{"use strict";var JOr=dv&&dv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),GOr=dv&&dv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),KOr=dv&&dv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&JOr(t,e,r);return GOr(t,e),t};Object.defineProperty(dv,"__esModule",{value:!0});dv.UnprocessableEntityErrorBody=void 0;var Qht=KOr($());dv.UnprocessableEntityErrorBody=Qht.serialization.object({data:Qht.serialization.string().optional()})});var rmt=b(fv=>{"use strict";var YOr=fv&&fv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ZOr=fv&&fv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),XOr=fv&&fv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&YOr(t,e,r);return ZOr(t,e),t};Object.defineProperty(fv,"__esModule",{value:!0});fv.TooManyRequestsErrorBody=void 0;var tmt=XOr($());fv.TooManyRequestsErrorBody=tmt.serialization.object({data:tmt.serialization.string().optional()})});var omt=b(pv=>{"use strict";var QOr=pv&&pv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),eEr=pv&&pv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),tEr=pv&&pv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&QOr(t,e,r);return eEr(t,e),t};Object.defineProperty(pv,"__esModule",{value:!0});pv.ClientClosedRequestErrorBody=void 0;var nmt=tEr($());pv.ClientClosedRequestErrorBody=nmt.serialization.object({data:nmt.serialization.string().optional()})});var amt=b(hv=>{"use strict";var rEr=hv&&hv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),nEr=hv&&hv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),oEr=hv&&hv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&rEr(t,e,r);return nEr(t,e),t};Object.defineProperty(hv,"__esModule",{value:!0});hv.NotImplementedErrorBody=void 0;var imt=oEr($());hv.NotImplementedErrorBody=imt.serialization.object({data:imt.serialization.string().optional()})});var umt=b(mv=>{"use strict";var iEr=mv&&mv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),aEr=mv&&mv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),sEr=mv&&mv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&iEr(t,e,r);return aEr(t,e),t};Object.defineProperty(mv,"__esModule",{value:!0});mv.GatewayTimeoutErrorBody=void 0;var smt=sEr($());mv.GatewayTimeoutErrorBody=smt.serialization.object({data:smt.serialization.string().optional()})});var z0e=b(gv=>{"use strict";var uEr=gv&&gv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),lEr=gv&&gv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),cEr=gv&&gv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&uEr(t,e,r);return lEr(t,e),t};Object.defineProperty(gv,"__esModule",{value:!0});gv.ChatRequestPromptTruncation=void 0;var dEr=cEr($());gv.ChatRequestPromptTruncation=dEr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var H0e=b(yv=>{"use strict";var fEr=yv&&yv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),pEr=yv&&yv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),hEr=yv&&yv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&fEr(t,e,r);return pEr(t,e),t};Object.defineProperty(yv,"__esModule",{value:!0});yv.ChatRequestCitationQuality=void 0;var mEr=hEr($());yv.ChatRequestCitationQuality=mEr.serialization.enum_(["fast","accurate","off"])});var cmt=b(bv=>{"use strict";var gEr=bv&&bv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),yEr=bv&&bv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),bEr=bv&&bv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&gEr(t,e,r);return yEr(t,e),t};Object.defineProperty(bv,"__esModule",{value:!0});bv.ChatRequestConnectorsSearchOptions=void 0;var lmt=bEr($());bv.ChatRequestConnectorsSearchOptions=lmt.serialization.object({seed:lmt.serialization.number().optional()})});var V0e=b(_v=>{"use strict";var _Er=_v&&_v.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),vEr=_v&&_v.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),wEr=_v&&_v.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_Er(t,e,r);return vEr(t,e),t};Object.defineProperty(_v,"__esModule",{value:!0});_v.ChatRequestSafetyMode=void 0;var SEr=wEr($());_v.ChatRequestSafetyMode=SEr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var W0e=b(vv=>{"use strict";var xEr=vv&&vv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),CEr=vv&&vv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),OEr=vv&&vv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&xEr(t,e,r);return CEr(t,e),t};Object.defineProperty(vv,"__esModule",{value:!0});vv.GenerateStreamRequestTruncate=void 0;var EEr=OEr($());vv.GenerateStreamRequestTruncate=EEr.serialization.enum_(["NONE","START","END"])});var J0e=b(wv=>{"use strict";var PEr=wv&&wv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),TEr=wv&&wv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),MEr=wv&&wv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&PEr(t,e,r);return TEr(t,e),t};Object.defineProperty(wv,"__esModule",{value:!0});wv.GenerateStreamRequestReturnLikelihoods=void 0;var IEr=MEr($());wv.GenerateStreamRequestReturnLikelihoods=IEr.serialization.enum_(["GENERATION","ALL","NONE"])});var G0e=b(Sv=>{"use strict";var AEr=Sv&&Sv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),REr=Sv&&Sv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),DEr=Sv&&Sv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&AEr(t,e,r);return REr(t,e),t};Object.defineProperty(Sv,"__esModule",{value:!0});Sv.GenerateRequestTruncate=void 0;var jEr=DEr($());Sv.GenerateRequestTruncate=jEr.serialization.enum_(["NONE","START","END"])});var K0e=b(xv=>{"use strict";var NEr=xv&&xv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),LEr=xv&&xv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),FEr=xv&&xv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&NEr(t,e,r);return LEr(t,e),t};Object.defineProperty(xv,"__esModule",{value:!0});xv.GenerateRequestReturnLikelihoods=void 0;var kEr=FEr($());xv.GenerateRequestReturnLikelihoods=kEr.serialization.enum_(["GENERATION","ALL","NONE"])});var Y0e=b(Cv=>{"use strict";var BEr=Cv&&Cv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),$Er=Cv&&Cv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),qEr=Cv&&Cv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&BEr(t,e,r);return $Er(t,e),t};Object.defineProperty(Cv,"__esModule",{value:!0});Cv.EmbedRequestTruncate=void 0;var UEr=qEr($());Cv.EmbedRequestTruncate=UEr.serialization.enum_(["NONE","START","END"])});var Z0e=b(Ov=>{"use strict";var zEr=Ov&&Ov.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),HEr=Ov&&Ov.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),VEr=Ov&&Ov.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&zEr(t,e,r);return HEr(t,e),t};Object.defineProperty(Ov,"__esModule",{value:!0});Ov.ApiMetaApiVersion=void 0;var HL=VEr($());Ov.ApiMetaApiVersion=HL.serialization.object({version:HL.serialization.string(),isDeprecated:HL.serialization.property("is_deprecated",HL.serialization.boolean().optional()),isExperimental:HL.serialization.property("is_experimental",HL.serialization.boolean().optional())})});var X0e=b(Ev=>{"use strict";var WEr=Ev&&Ev.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),JEr=Ev&&Ev.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),GEr=Ev&&Ev.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&WEr(t,e,r);return JEr(t,e),t};Object.defineProperty(Ev,"__esModule",{value:!0});Ev.ApiMetaBilledUnits=void 0;var hP=GEr($());Ev.ApiMetaBilledUnits=hP.serialization.object({inputTokens:hP.serialization.property("input_tokens",hP.serialization.number().optional()),outputTokens:hP.serialization.property("output_tokens",hP.serialization.number().optional()),searchUnits:hP.serialization.property("search_units",hP.serialization.number().optional()),classifications:hP.serialization.number().optional()})});var Q0e=b(Pv=>{"use strict";var KEr=Pv&&Pv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),YEr=Pv&&Pv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ZEr=Pv&&Pv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&KEr(t,e,r);return YEr(t,e),t};Object.defineProperty(Pv,"__esModule",{value:!0});Pv.ApiMetaTokens=void 0;var W2=ZEr($());Pv.ApiMetaTokens=W2.serialization.object({inputTokens:W2.serialization.property("input_tokens",W2.serialization.number().optional()),outputTokens:W2.serialization.property("output_tokens",W2.serialization.number().optional())})});var _p=b(Tv=>{"use strict";var XEr=Tv&&Tv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),QEr=Tv&&Tv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ePr=Tv&&Tv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&XEr(t,e,r);return QEr(t,e),t};Object.defineProperty(Tv,"__esModule",{value:!0});Tv.ApiMeta=void 0;var J2=ePr($()),tPr=Z0e(),rPr=X0e(),nPr=Q0e();Tv.ApiMeta=J2.serialization.object({apiVersion:J2.serialization.property("api_version",tPr.ApiMetaApiVersion.optional()),billedUnits:J2.serialization.property("billed_units",rPr.ApiMetaBilledUnits.optional()),tokens:nPr.ApiMetaTokens.optional(),warnings:J2.serialization.list(J2.serialization.string()).optional()})});var ewe=b(Mv=>{"use strict";var oPr=Mv&&Mv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),iPr=Mv&&Mv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),aPr=Mv&&Mv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&oPr(t,e,r);return iPr(t,e),t};Object.defineProperty(Mv,"__esModule",{value:!0});Mv.EmbedFloatsResponse=void 0;var VA=aPr($()),sPr=_p();Mv.EmbedFloatsResponse=VA.serialization.object({id:VA.serialization.string(),embeddings:VA.serialization.list(VA.serialization.list(VA.serialization.number())),texts:VA.serialization.list(VA.serialization.string()),meta:sPr.ApiMeta.optional()})});var twe=b(Iv=>{"use strict";var uPr=Iv&&Iv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),lPr=Iv&&Iv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),cPr=Iv&&Iv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&uPr(t,e,r);return lPr(t,e),t};Object.defineProperty(Iv,"__esModule",{value:!0});Iv.EmbedByTypeResponseEmbeddings=void 0;var Xc=cPr($());Iv.EmbedByTypeResponseEmbeddings=Xc.serialization.object({float:Xc.serialization.list(Xc.serialization.list(Xc.serialization.number())).optional(),int8:Xc.serialization.list(Xc.serialization.list(Xc.serialization.number())).optional(),uint8:Xc.serialization.list(Xc.serialization.list(Xc.serialization.number())).optional(),binary:Xc.serialization.list(Xc.serialization.list(Xc.serialization.number())).optional(),ubinary:Xc.serialization.list(Xc.serialization.list(Xc.serialization.number())).optional()})});var rwe=b(Av=>{"use strict";var dPr=Av&&Av.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),fPr=Av&&Av.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),pPr=Av&&Av.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&dPr(t,e,r);return fPr(t,e),t};Object.defineProperty(Av,"__esModule",{value:!0});Av.EmbedByTypeResponse=void 0;var dZ=pPr($()),hPr=twe(),mPr=_p();Av.EmbedByTypeResponse=dZ.serialization.object({id:dZ.serialization.string(),embeddings:hPr.EmbedByTypeResponseEmbeddings,texts:dZ.serialization.list(dZ.serialization.string()),meta:mPr.ApiMeta.optional()})});var fmt=b(Rv=>{"use strict";var gPr=Rv&&Rv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),yPr=Rv&&Rv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),bPr=Rv&&Rv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&gPr(t,e,r);return yPr(t,e),t};Object.defineProperty(Rv,"__esModule",{value:!0});Rv.EmbedResponse=void 0;var dmt=bPr($()),_Pr=ewe(),vPr=rwe();Rv.EmbedResponse=dmt.serialization.union(dmt.serialization.discriminant("responseType","response_type"),{embeddings_floats:_Pr.EmbedFloatsResponse,embeddings_by_type:vPr.EmbedByTypeResponse}).transform({transform:e=>e,untransform:e=>e})});var owe=b(Dv=>{"use strict";var wPr=Dv&&Dv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),SPr=Dv&&Dv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),xPr=Dv&&Dv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&wPr(t,e,r);return SPr(t,e),t};Object.defineProperty(Dv,"__esModule",{value:!0});Dv.RerankDocument=void 0;var nwe=xPr($());Dv.RerankDocument=nwe.serialization.record(nwe.serialization.string(),nwe.serialization.string())});var iwe=b(jv=>{"use strict";var CPr=jv&&jv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),OPr=jv&&jv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),EPr=jv&&jv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&CPr(t,e,r);return OPr(t,e),t};Object.defineProperty(jv,"__esModule",{value:!0});jv.RerankRequestDocumentsItem=void 0;var pmt=EPr($()),PPr=owe();jv.RerankRequestDocumentsItem=pmt.serialization.undiscriminatedUnion([pmt.serialization.string(),PPr.RerankDocument])});var awe=b(Nv=>{"use strict";var TPr=Nv&&Nv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),MPr=Nv&&Nv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),IPr=Nv&&Nv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&TPr(t,e,r);return MPr(t,e),t};Object.defineProperty(Nv,"__esModule",{value:!0});Nv.RerankResponseResultsItemDocument=void 0;var hmt=IPr($());Nv.RerankResponseResultsItemDocument=hmt.serialization.object({text:hmt.serialization.string()})});var swe=b(Lv=>{"use strict";var APr=Lv&&Lv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),RPr=Lv&&Lv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),DPr=Lv&&Lv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&APr(t,e,r);return RPr(t,e),t};Object.defineProperty(Lv,"__esModule",{value:!0});Lv.RerankResponseResultsItem=void 0;var fZ=DPr($()),jPr=awe();Lv.RerankResponseResultsItem=fZ.serialization.object({document:jPr.RerankResponseResultsItemDocument.optional(),index:fZ.serialization.number(),relevanceScore:fZ.serialization.property("relevance_score",fZ.serialization.number())})});var mmt=b(Fv=>{"use strict";var NPr=Fv&&Fv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),LPr=Fv&&Fv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),FPr=Fv&&Fv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&NPr(t,e,r);return LPr(t,e),t};Object.defineProperty(Fv,"__esModule",{value:!0});Fv.RerankResponse=void 0;var uwe=FPr($()),kPr=swe(),BPr=_p();Fv.RerankResponse=uwe.serialization.object({id:uwe.serialization.string().optional(),results:uwe.serialization.list(kPr.RerankResponseResultsItem),meta:BPr.ApiMeta.optional()})});var lwe=b(kv=>{"use strict";var $Pr=kv&&kv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),qPr=kv&&kv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),UPr=kv&&kv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$Pr(t,e,r);return qPr(t,e),t};Object.defineProperty(kv,"__esModule",{value:!0});kv.ClassifyRequestTruncate=void 0;var zPr=UPr($());kv.ClassifyRequestTruncate=zPr.serialization.enum_(["NONE","START","END"])});var cwe=b(Bv=>{"use strict";var HPr=Bv&&Bv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),VPr=Bv&&Bv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),WPr=Bv&&Bv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&HPr(t,e,r);return VPr(t,e),t};Object.defineProperty(Bv,"__esModule",{value:!0});Bv.ClassifyResponseClassificationsItemLabelsValue=void 0;var gmt=WPr($());Bv.ClassifyResponseClassificationsItemLabelsValue=gmt.serialization.object({confidence:gmt.serialization.number().optional()})});var dwe=b($v=>{"use strict";var JPr=$v&&$v.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),GPr=$v&&$v.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),KPr=$v&&$v.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&JPr(t,e,r);return GPr(t,e),t};Object.defineProperty($v,"__esModule",{value:!0});$v.ClassifyResponseClassificationsItemClassificationType=void 0;var YPr=KPr($());$v.ClassifyResponseClassificationsItemClassificationType=YPr.serialization.enum_(["single-label","multi-label"])});var fwe=b(qv=>{"use strict";var ZPr=qv&&qv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),XPr=qv&&qv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),QPr=qv&&qv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ZPr(t,e,r);return XPr(t,e),t};Object.defineProperty(qv,"__esModule",{value:!0});qv.ClassifyResponseClassificationsItem=void 0;var Lh=QPr($()),eTr=cwe(),tTr=dwe();qv.ClassifyResponseClassificationsItem=Lh.serialization.object({id:Lh.serialization.string(),input:Lh.serialization.string().optional(),prediction:Lh.serialization.string().optional(),predictions:Lh.serialization.list(Lh.serialization.string()),confidence:Lh.serialization.number().optional(),confidences:Lh.serialization.list(Lh.serialization.number()),labels:Lh.serialization.record(Lh.serialization.string(),eTr.ClassifyResponseClassificationsItemLabelsValue),classificationType:Lh.serialization.property("classification_type",tTr.ClassifyResponseClassificationsItemClassificationType)})});var ymt=b(Uv=>{"use strict";var rTr=Uv&&Uv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),nTr=Uv&&Uv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),oTr=Uv&&Uv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&rTr(t,e,r);return nTr(t,e),t};Object.defineProperty(Uv,"__esModule",{value:!0});Uv.ClassifyResponse=void 0;var pwe=oTr($()),iTr=fwe(),aTr=_p();Uv.ClassifyResponse=pwe.serialization.object({id:pwe.serialization.string(),classifications:pwe.serialization.list(iTr.ClassifyResponseClassificationsItem),meta:aTr.ApiMeta.optional()})});var hwe=b(zv=>{"use strict";var sTr=zv&&zv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),uTr=zv&&zv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),lTr=zv&&zv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&sTr(t,e,r);return uTr(t,e),t};Object.defineProperty(zv,"__esModule",{value:!0});zv.SummarizeRequestLength=void 0;var cTr=lTr($());zv.SummarizeRequestLength=cTr.serialization.enum_(["short","medium","long"])});var mwe=b(Hv=>{"use strict";var dTr=Hv&&Hv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),fTr=Hv&&Hv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),pTr=Hv&&Hv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&dTr(t,e,r);return fTr(t,e),t};Object.defineProperty(Hv,"__esModule",{value:!0});Hv.SummarizeRequestFormat=void 0;var hTr=pTr($());Hv.SummarizeRequestFormat=hTr.serialization.enum_(["paragraph","bullets"])});var gwe=b(Vv=>{"use strict";var mTr=Vv&&Vv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),gTr=Vv&&Vv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),yTr=Vv&&Vv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&mTr(t,e,r);return gTr(t,e),t};Object.defineProperty(Vv,"__esModule",{value:!0});Vv.SummarizeRequestExtractiveness=void 0;var bTr=yTr($());Vv.SummarizeRequestExtractiveness=bTr.serialization.enum_(["low","medium","high"])});var bmt=b(Wv=>{"use strict";var _Tr=Wv&&Wv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),vTr=Wv&&Wv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),wTr=Wv&&Wv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_Tr(t,e,r);return vTr(t,e),t};Object.defineProperty(Wv,"__esModule",{value:!0});Wv.SummarizeResponse=void 0;var ywe=wTr($()),STr=_p();Wv.SummarizeResponse=ywe.serialization.object({id:ywe.serialization.string().optional(),summary:ywe.serialization.string().optional(),meta:STr.ApiMeta.optional()})});var _mt=b(Jv=>{"use strict";var xTr=Jv&&Jv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),CTr=Jv&&Jv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),OTr=Jv&&Jv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&xTr(t,e,r);return CTr(t,e),t};Object.defineProperty(Jv,"__esModule",{value:!0});Jv.TokenizeResponse=void 0;var VL=OTr($()),ETr=_p();Jv.TokenizeResponse=VL.serialization.object({tokens:VL.serialization.list(VL.serialization.number()),tokenStrings:VL.serialization.property("token_strings",VL.serialization.list(VL.serialization.string())),meta:ETr.ApiMeta.optional()})});var wmt=b(Gv=>{"use strict";var PTr=Gv&&Gv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),TTr=Gv&&Gv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),MTr=Gv&&Gv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&PTr(t,e,r);return TTr(t,e),t};Object.defineProperty(Gv,"__esModule",{value:!0});Gv.DetokenizeResponse=void 0;var vmt=MTr($()),ITr=_p();Gv.DetokenizeResponse=vmt.serialization.object({text:vmt.serialization.string(),meta:ITr.ApiMeta.optional()})});var Smt=b(Kv=>{"use strict";var ATr=Kv&&Kv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),RTr=Kv&&Kv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),DTr=Kv&&Kv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ATr(t,e,r);return RTr(t,e),t};Object.defineProperty(Kv,"__esModule",{value:!0});Kv.CheckApiKeyResponse=void 0;var WL=DTr($());Kv.CheckApiKeyResponse=WL.serialization.object({valid:WL.serialization.boolean(),organizationId:WL.serialization.property("organization_id",WL.serialization.string().optional()),ownerId:WL.serialization.property("owner_id",WL.serialization.string().optional())})});var JL=b(Yv=>{"use strict";var jTr=Yv&&Yv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),NTr=Yv&&Yv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),LTr=Yv&&Yv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&jTr(t,e,r);return NTr(t,e),t};Object.defineProperty(Yv,"__esModule",{value:!0});Yv.ToolCall=void 0;var G2=LTr($());Yv.ToolCall=G2.serialization.object({name:G2.serialization.string(),parameters:G2.serialization.record(G2.serialization.string(),G2.serialization.unknown())})});var bwe=b(Zv=>{"use strict";var FTr=Zv&&Zv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),kTr=Zv&&Zv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),BTr=Zv&&Zv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&FTr(t,e,r);return kTr(t,e),t};Object.defineProperty(Zv,"__esModule",{value:!0});Zv.ChatMessage=void 0;var pZ=BTr($()),$Tr=JL();Zv.ChatMessage=pZ.serialization.object({message:pZ.serialization.string(),toolCalls:pZ.serialization.property("tool_calls",pZ.serialization.list($Tr.ToolCall).optional())})});var Y2=b(Xv=>{"use strict";var qTr=Xv&&Xv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),UTr=Xv&&Xv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),zTr=Xv&&Xv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&qTr(t,e,r);return UTr(t,e),t};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.ToolResult=void 0;var K2=zTr($()),HTr=JL();Xv.ToolResult=K2.serialization.object({call:HTr.ToolCall,outputs:K2.serialization.list(K2.serialization.record(K2.serialization.string(),K2.serialization.unknown()))})});var vwe=b(Qv=>{"use strict";var VTr=Qv&&Qv.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),WTr=Qv&&Qv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),JTr=Qv&&Qv.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&VTr(t,e,r);return WTr(t,e),t};Object.defineProperty(Qv,"__esModule",{value:!0});Qv.ToolMessage=void 0;var _we=JTr($()),GTr=Y2();Qv.ToolMessage=_we.serialization.object({toolResults:_we.serialization.property("tool_results",_we.serialization.list(GTr.ToolResult).optional())})});var Z2=b(e0=>{"use strict";var KTr=e0&&e0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),YTr=e0&&e0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ZTr=e0&&e0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&KTr(t,e,r);return YTr(t,e),t};Object.defineProperty(e0,"__esModule",{value:!0});e0.Message=void 0;var XTr=ZTr($()),wwe=bwe(),QTr=vwe();e0.Message=XTr.serialization.union("role",{CHATBOT:wwe.ChatMessage,SYSTEM:wwe.ChatMessage,USER:wwe.ChatMessage,TOOL:QTr.ToolMessage}).transform({transform:e=>e,untransform:e=>e})});var hZ=b(t0=>{"use strict";var eMr=t0&&t0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),tMr=t0&&t0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),rMr=t0&&t0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&eMr(t,e,r);return tMr(t,e),t};Object.defineProperty(t0,"__esModule",{value:!0});t0.ChatConnector=void 0;var Tx=rMr($());t0.ChatConnector=Tx.serialization.object({id:Tx.serialization.string(),userAccessToken:Tx.serialization.property("user_access_token",Tx.serialization.string().optional()),continueOnFailure:Tx.serialization.property("continue_on_failure",Tx.serialization.boolean().optional()),options:Tx.serialization.record(Tx.serialization.string(),Tx.serialization.unknown()).optional()})});var Swe=b(r0=>{"use strict";var nMr=r0&&r0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),oMr=r0&&r0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),iMr=r0&&r0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&nMr(t,e,r);return oMr(t,e),t};Object.defineProperty(r0,"__esModule",{value:!0});r0.ToolParameterDefinitionsValue=void 0;var mZ=iMr($());r0.ToolParameterDefinitionsValue=mZ.serialization.object({description:mZ.serialization.string().optional(),type:mZ.serialization.string(),required:mZ.serialization.boolean().optional()})});var gZ=b(n0=>{"use strict";var aMr=n0&&n0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),sMr=n0&&n0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),uMr=n0&&n0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&aMr(t,e,r);return sMr(t,e),t};Object.defineProperty(n0,"__esModule",{value:!0});n0.Tool=void 0;var GL=uMr($()),lMr=Swe();n0.Tool=GL.serialization.object({name:GL.serialization.string(),description:GL.serialization.string(),parameterDefinitions:GL.serialization.property("parameter_definitions",GL.serialization.record(GL.serialization.string(),lMr.ToolParameterDefinitionsValue).optional())})});var xwe=b(o0=>{"use strict";var cMr=o0&&o0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),dMr=o0&&o0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),fMr=o0&&o0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&cMr(t,e,r);return dMr(t,e),t};Object.defineProperty(o0,"__esModule",{value:!0});o0.JsonResponseFormat=void 0;var yZ=fMr($());o0.JsonResponseFormat=yZ.serialization.object({schema:yZ.serialization.record(yZ.serialization.string(),yZ.serialization.unknown()).optional()})});var bZ=b(i0=>{"use strict";var pMr=i0&&i0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hMr=i0&&i0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),mMr=i0&&i0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&pMr(t,e,r);return hMr(t,e),t};Object.defineProperty(i0,"__esModule",{value:!0});i0.ResponseFormat=void 0;var gMr=mMr($()),yMr=eZ(),bMr=xwe();i0.ResponseFormat=gMr.serialization.union("type",{text:yMr.TextResponseFormat,json_object:bMr.JsonResponseFormat}).transform({transform:e=>e,untransform:e=>e})});var _Z=b(a0=>{"use strict";var _Mr=a0&&a0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),vMr=a0&&a0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),wMr=a0&&a0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_Mr(t,e,r);return vMr(t,e),t};Object.defineProperty(a0,"__esModule",{value:!0});a0.ChatCitation=void 0;var WA=wMr($());a0.ChatCitation=WA.serialization.object({start:WA.serialization.number(),end:WA.serialization.number(),text:WA.serialization.string(),documentIds:WA.serialization.property("document_ids",WA.serialization.list(WA.serialization.string()))})});var X2=b(s0=>{"use strict";var SMr=s0&&s0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),xMr=s0&&s0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),CMr=s0&&s0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&SMr(t,e,r);return xMr(t,e),t};Object.defineProperty(s0,"__esModule",{value:!0});s0.ChatSearchQuery=void 0;var vZ=CMr($());s0.ChatSearchQuery=vZ.serialization.object({text:vZ.serialization.string(),generationId:vZ.serialization.property("generation_id",vZ.serialization.string())})});var Cwe=b(u0=>{"use strict";var OMr=u0&&u0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),EMr=u0&&u0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),PMr=u0&&u0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&OMr(t,e,r);return EMr(t,e),t};Object.defineProperty(u0,"__esModule",{value:!0});u0.ChatSearchResultConnector=void 0;var xmt=PMr($());u0.ChatSearchResultConnector=xmt.serialization.object({id:xmt.serialization.string()})});var wZ=b(l0=>{"use strict";var TMr=l0&&l0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),MMr=l0&&l0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),IMr=l0&&l0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&TMr(t,e,r);return MMr(t,e),t};Object.defineProperty(l0,"__esModule",{value:!0});l0.ChatSearchResult=void 0;var Mx=IMr($()),AMr=X2(),RMr=Cwe();l0.ChatSearchResult=Mx.serialization.object({searchQuery:Mx.serialization.property("search_query",AMr.ChatSearchQuery.optional()),connector:RMr.ChatSearchResultConnector,documentIds:Mx.serialization.property("document_ids",Mx.serialization.list(Mx.serialization.string())),errorMessage:Mx.serialization.property("error_message",Mx.serialization.string().optional()),continueOnFailure:Mx.serialization.property("continue_on_failure",Mx.serialization.boolean().optional())})});var KL=b(c0=>{"use strict";var DMr=c0&&c0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),jMr=c0&&c0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),NMr=c0&&c0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&DMr(t,e,r);return jMr(t,e),t};Object.defineProperty(c0,"__esModule",{value:!0});c0.FinishReason=void 0;var LMr=NMr($());c0.FinishReason=LMr.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var Owe=b(d0=>{"use strict";var FMr=d0&&d0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),kMr=d0&&d0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),BMr=d0&&d0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&FMr(t,e,r);return kMr(t,e),t};Object.defineProperty(d0,"__esModule",{value:!0});d0.NonStreamedChatResponse=void 0;var bl=BMr($()),$Mr=_Z(),qMr=NA(),UMr=X2(),zMr=wZ(),HMr=KL(),VMr=JL(),WMr=Z2(),JMr=_p();d0.NonStreamedChatResponse=bl.serialization.object({text:bl.serialization.string(),generationId:bl.serialization.property("generation_id",bl.serialization.string().optional()),citations:bl.serialization.list($Mr.ChatCitation).optional(),documents:bl.serialization.list(qMr.ChatDocument).optional(),isSearchRequired:bl.serialization.property("is_search_required",bl.serialization.boolean().optional()),searchQueries:bl.serialization.property("search_queries",bl.serialization.list(UMr.ChatSearchQuery).optional()),searchResults:bl.serialization.property("search_results",bl.serialization.list(zMr.ChatSearchResult).optional()),finishReason:bl.serialization.property("finish_reason",HMr.FinishReason.optional()),toolCalls:bl.serialization.property("tool_calls",bl.serialization.list(VMr.ToolCall).optional()),chatHistory:bl.serialization.property("chat_history",bl.serialization.list(WMr.Message).optional()),prompt:bl.serialization.string().optional(),meta:JMr.ApiMeta.optional()})});var p0=b(f0=>{"use strict";var GMr=f0&&f0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),KMr=f0&&f0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),YMr=f0&&f0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&GMr(t,e,r);return KMr(t,e),t};Object.defineProperty(f0,"__esModule",{value:!0});f0.ChatStreamEvent=void 0;var ZMr=YMr($());f0.ChatStreamEvent=ZMr.serialization.object({})});var Pwe=b(h0=>{"use strict";var XMr=h0&&h0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),QMr=h0&&h0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),eIr=h0&&h0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&XMr(t,e,r);return QMr(t,e),t};Object.defineProperty(h0,"__esModule",{value:!0});h0.ChatStreamStartEvent=void 0;var Ewe=eIr($()),tIr=p0();h0.ChatStreamStartEvent=Ewe.serialization.object({generationId:Ewe.serialization.property("generation_id",Ewe.serialization.string())}).extend(tIr.ChatStreamEvent)});var Mwe=b(m0=>{"use strict";var rIr=m0&&m0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),nIr=m0&&m0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),oIr=m0&&m0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&rIr(t,e,r);return nIr(t,e),t};Object.defineProperty(m0,"__esModule",{value:!0});m0.ChatSearchQueriesGenerationEvent=void 0;var Twe=oIr($()),iIr=X2(),aIr=p0();m0.ChatSearchQueriesGenerationEvent=Twe.serialization.object({searchQueries:Twe.serialization.property("search_queries",Twe.serialization.list(iIr.ChatSearchQuery))}).extend(aIr.ChatStreamEvent)});var Iwe=b(g0=>{"use strict";var sIr=g0&&g0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),uIr=g0&&g0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),lIr=g0&&g0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&sIr(t,e,r);return uIr(t,e),t};Object.defineProperty(g0,"__esModule",{value:!0});g0.ChatSearchResultsEvent=void 0;var SZ=lIr($()),cIr=wZ(),dIr=NA(),fIr=p0();g0.ChatSearchResultsEvent=SZ.serialization.object({searchResults:SZ.serialization.property("search_results",SZ.serialization.list(cIr.ChatSearchResult).optional()),documents:SZ.serialization.list(dIr.ChatDocument).optional()}).extend(fIr.ChatStreamEvent)});var Awe=b(y0=>{"use strict";var pIr=y0&&y0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hIr=y0&&y0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),mIr=y0&&y0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&pIr(t,e,r);return hIr(t,e),t};Object.defineProperty(y0,"__esModule",{value:!0});y0.ChatTextGenerationEvent=void 0;var Cmt=mIr($()),gIr=p0();y0.ChatTextGenerationEvent=Cmt.serialization.object({text:Cmt.serialization.string()}).extend(gIr.ChatStreamEvent)});var Rwe=b(b0=>{"use strict";var yIr=b0&&b0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),bIr=b0&&b0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_Ir=b0&&b0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&yIr(t,e,r);return bIr(t,e),t};Object.defineProperty(b0,"__esModule",{value:!0});b0.ChatCitationGenerationEvent=void 0;var Omt=_Ir($()),vIr=_Z(),wIr=p0();b0.ChatCitationGenerationEvent=Omt.serialization.object({citations:Omt.serialization.list(vIr.ChatCitation)}).extend(wIr.ChatStreamEvent)});var Dwe=b(_0=>{"use strict";var SIr=_0&&_0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),xIr=_0&&_0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),CIr=_0&&_0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&SIr(t,e,r);return xIr(t,e),t};Object.defineProperty(_0,"__esModule",{value:!0});_0.ChatToolCallsGenerationEvent=void 0;var xZ=CIr($()),OIr=JL(),EIr=p0();_0.ChatToolCallsGenerationEvent=xZ.serialization.object({text:xZ.serialization.string().optional(),toolCalls:xZ.serialization.property("tool_calls",xZ.serialization.list(OIr.ToolCall))}).extend(EIr.ChatStreamEvent)});var jwe=b(v0=>{"use strict";var PIr=v0&&v0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),TIr=v0&&v0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),MIr=v0&&v0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&PIr(t,e,r);return TIr(t,e),t};Object.defineProperty(v0,"__esModule",{value:!0});v0.ChatStreamEndEventFinishReason=void 0;var IIr=MIr($());v0.ChatStreamEndEventFinishReason=IIr.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var Nwe=b(w0=>{"use strict";var AIr=w0&&w0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),RIr=w0&&w0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),DIr=w0&&w0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&AIr(t,e,r);return RIr(t,e),t};Object.defineProperty(w0,"__esModule",{value:!0});w0.ChatStreamEndEvent=void 0;var Emt=DIr($()),jIr=jwe(),NIr=Owe(),LIr=p0();w0.ChatStreamEndEvent=Emt.serialization.object({finishReason:Emt.serialization.property("finish_reason",jIr.ChatStreamEndEventFinishReason),response:NIr.NonStreamedChatResponse}).extend(LIr.ChatStreamEvent)});var Lwe=b(S0=>{"use strict";var FIr=S0&&S0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),kIr=S0&&S0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),BIr=S0&&S0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&FIr(t,e,r);return kIr(t,e),t};Object.defineProperty(S0,"__esModule",{value:!0});S0.ToolCallDelta=void 0;var Q2=BIr($());S0.ToolCallDelta=Q2.serialization.object({name:Q2.serialization.string().optional(),index:Q2.serialization.number().optional(),parameters:Q2.serialization.string().optional(),text:Q2.serialization.string().optional()})});var Fwe=b(x0=>{"use strict";var $Ir=x0&&x0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),qIr=x0&&x0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),UIr=x0&&x0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$Ir(t,e,r);return qIr(t,e),t};Object.defineProperty(x0,"__esModule",{value:!0});x0.ChatToolCallsChunkEvent=void 0;var Pmt=UIr($()),zIr=Lwe(),HIr=p0();x0.ChatToolCallsChunkEvent=Pmt.serialization.object({toolCallDelta:Pmt.serialization.property("tool_call_delta",zIr.ToolCallDelta)}).extend(HIr.ChatStreamEvent)});var Mmt=b(C0=>{"use strict";var VIr=C0&&C0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),WIr=C0&&C0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),JIr=C0&&C0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&VIr(t,e,r);return WIr(t,e),t};Object.defineProperty(C0,"__esModule",{value:!0});C0.StreamedChatResponse=void 0;var Tmt=JIr($()),GIr=Pwe(),KIr=Mwe(),YIr=Iwe(),ZIr=Awe(),XIr=Rwe(),QIr=Dwe(),eAr=Nwe(),tAr=Fwe();C0.StreamedChatResponse=Tmt.serialization.union(Tmt.serialization.discriminant("eventType","event_type"),{"stream-start":GIr.ChatStreamStartEvent,"search-queries-generation":KIr.ChatSearchQueriesGenerationEvent,"search-results":YIr.ChatSearchResultsEvent,"text-generation":ZIr.ChatTextGenerationEvent,"citation-generation":XIr.ChatCitationGenerationEvent,"tool-calls-generation":QIr.ChatToolCallsGenerationEvent,"stream-end":eAr.ChatStreamEndEvent,"tool-calls-chunk":tAr.ChatToolCallsChunkEvent}).transform({transform:e=>e,untransform:e=>e})});var Bwe=b(O0=>{"use strict";var rAr=O0&&O0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),nAr=O0&&O0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),oAr=O0&&O0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&rAr(t,e,r);return nAr(t,e),t};Object.defineProperty(O0,"__esModule",{value:!0});O0.SingleGenerationTokenLikelihoodsItem=void 0;var kwe=oAr($());O0.SingleGenerationTokenLikelihoodsItem=kwe.serialization.object({token:kwe.serialization.string(),likelihood:kwe.serialization.number()})});var $we=b(E0=>{"use strict";var iAr=E0&&E0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),aAr=E0&&E0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),sAr=E0&&E0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&iAr(t,e,r);return aAr(t,e),t};Object.defineProperty(E0,"__esModule",{value:!0});E0.SingleGeneration=void 0;var JA=sAr($()),uAr=Bwe();E0.SingleGeneration=JA.serialization.object({id:JA.serialization.string(),text:JA.serialization.string(),index:JA.serialization.number().optional(),likelihood:JA.serialization.number().optional(),tokenLikelihoods:JA.serialization.property("token_likelihoods",JA.serialization.list(uAr.SingleGenerationTokenLikelihoodsItem).optional())})});var Imt=b(P0=>{"use strict";var lAr=P0&&P0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),cAr=P0&&P0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),dAr=P0&&P0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&lAr(t,e,r);return cAr(t,e),t};Object.defineProperty(P0,"__esModule",{value:!0});P0.Generation=void 0;var CZ=dAr($()),fAr=$we(),pAr=_p();P0.Generation=CZ.serialization.object({id:CZ.serialization.string(),prompt:CZ.serialization.string().optional(),generations:CZ.serialization.list(fAr.SingleGeneration),meta:pAr.ApiMeta.optional()})});var e4=b(T0=>{"use strict";var hAr=T0&&T0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),mAr=T0&&T0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),gAr=T0&&T0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&hAr(t,e,r);return mAr(t,e),t};Object.defineProperty(T0,"__esModule",{value:!0});T0.GenerateStreamEvent=void 0;var yAr=gAr($());T0.GenerateStreamEvent=yAr.serialization.object({})});var qwe=b(M0=>{"use strict";var bAr=M0&&M0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),_Ar=M0&&M0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vAr=M0&&M0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&bAr(t,e,r);return _Ar(t,e),t};Object.defineProperty(M0,"__esModule",{value:!0});M0.GenerateStreamText=void 0;var t4=vAr($()),wAr=e4();M0.GenerateStreamText=t4.serialization.object({text:t4.serialization.string(),index:t4.serialization.number().optional(),isFinished:t4.serialization.property("is_finished",t4.serialization.boolean())}).extend(wAr.GenerateStreamEvent)});var Uwe=b(I0=>{"use strict";var SAr=I0&&I0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),xAr=I0&&I0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),CAr=I0&&I0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&SAr(t,e,r);return xAr(t,e),t};Object.defineProperty(I0,"__esModule",{value:!0});I0.SingleGenerationInStream=void 0;var r4=CAr($()),OAr=KL();I0.SingleGenerationInStream=r4.serialization.object({id:r4.serialization.string(),text:r4.serialization.string(),index:r4.serialization.number().optional(),finishReason:r4.serialization.property("finish_reason",OAr.FinishReason)})});var zwe=b(A0=>{"use strict";var EAr=A0&&A0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),PAr=A0&&A0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),TAr=A0&&A0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&EAr(t,e,r);return PAr(t,e),t};Object.defineProperty(A0,"__esModule",{value:!0});A0.GenerateStreamEndResponse=void 0;var OZ=TAr($()),MAr=Uwe();A0.GenerateStreamEndResponse=OZ.serialization.object({id:OZ.serialization.string(),prompt:OZ.serialization.string().optional(),generations:OZ.serialization.list(MAr.SingleGenerationInStream).optional()})});var Hwe=b(R0=>{"use strict";var IAr=R0&&R0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),AAr=R0&&R0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),RAr=R0&&R0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&IAr(t,e,r);return AAr(t,e),t};Object.defineProperty(R0,"__esModule",{value:!0});R0.GenerateStreamEnd=void 0;var EZ=RAr($()),DAr=KL(),jAr=zwe(),NAr=e4();R0.GenerateStreamEnd=EZ.serialization.object({isFinished:EZ.serialization.property("is_finished",EZ.serialization.boolean()),finishReason:EZ.serialization.property("finish_reason",DAr.FinishReason.optional()),response:jAr.GenerateStreamEndResponse}).extend(NAr.GenerateStreamEvent)});var Vwe=b(D0=>{"use strict";var LAr=D0&&D0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),FAr=D0&&D0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),kAr=D0&&D0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&LAr(t,e,r);return FAr(t,e),t};Object.defineProperty(D0,"__esModule",{value:!0});D0.GenerateStreamError=void 0;var YL=kAr($()),BAr=KL(),$Ar=e4();D0.GenerateStreamError=YL.serialization.object({index:YL.serialization.number().optional(),isFinished:YL.serialization.property("is_finished",YL.serialization.boolean()),finishReason:YL.serialization.property("finish_reason",BAr.FinishReason),err:YL.serialization.string()}).extend($Ar.GenerateStreamEvent)});var Rmt=b(j0=>{"use strict";var qAr=j0&&j0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),UAr=j0&&j0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),zAr=j0&&j0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&qAr(t,e,r);return UAr(t,e),t};Object.defineProperty(j0,"__esModule",{value:!0});j0.GenerateStreamedResponse=void 0;var Amt=zAr($()),HAr=qwe(),VAr=Hwe(),WAr=Vwe();j0.GenerateStreamedResponse=Amt.serialization.union(Amt.serialization.discriminant("eventType","event_type"),{"text-generation":HAr.GenerateStreamText,"stream-end":VAr.GenerateStreamEnd,"stream-error":WAr.GenerateStreamError}).transform({transform:e=>e,untransform:e=>e})});var Wwe=b(N0=>{"use strict";var JAr=N0&&N0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),GAr=N0&&N0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),KAr=N0&&N0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&JAr(t,e,r);return GAr(t,e),t};Object.defineProperty(N0,"__esModule",{value:!0});N0.EmbedJobStatus=void 0;var YAr=KAr($());N0.EmbedJobStatus=YAr.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var Jwe=b(L0=>{"use strict";var ZAr=L0&&L0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),XAr=L0&&L0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),QAr=L0&&L0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ZAr(t,e,r);return XAr(t,e),t};Object.defineProperty(L0,"__esModule",{value:!0});L0.EmbedJobTruncate=void 0;var eRr=QAr($());L0.EmbedJobTruncate=eRr.serialization.enum_(["START","END"])});var Gwe=b(F0=>{"use strict";var tRr=F0&&F0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),rRr=F0&&F0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),nRr=F0&&F0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&tRr(t,e,r);return rRr(t,e),t};Object.defineProperty(F0,"__esModule",{value:!0});F0.EmbedJob=void 0;var fg=nRr($()),oRr=Wwe(),iRr=Jwe(),aRr=_p();F0.EmbedJob=fg.serialization.object({jobId:fg.serialization.property("job_id",fg.serialization.string()),name:fg.serialization.string().optional(),status:oRr.EmbedJobStatus,createdAt:fg.serialization.property("created_at",fg.serialization.date()),inputDatasetId:fg.serialization.property("input_dataset_id",fg.serialization.string()),outputDatasetId:fg.serialization.property("output_dataset_id",fg.serialization.string().optional()),model:fg.serialization.string(),truncate:iRr.EmbedJobTruncate,meta:aRr.ApiMeta.optional()})});var Dmt=b(k0=>{"use strict";var sRr=k0&&k0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),uRr=k0&&k0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),lRr=k0&&k0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&sRr(t,e,r);return uRr(t,e),t};Object.defineProperty(k0,"__esModule",{value:!0});k0.ListEmbedJobResponse=void 0;var Kwe=lRr($()),cRr=Gwe();k0.ListEmbedJobResponse=Kwe.serialization.object({embedJobs:Kwe.serialization.property("embed_jobs",Kwe.serialization.list(cRr.EmbedJob).optional())})});var jmt=b(B0=>{"use strict";var dRr=B0&&B0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),fRr=B0&&B0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),pRr=B0&&B0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&dRr(t,e,r);return fRr(t,e),t};Object.defineProperty(B0,"__esModule",{value:!0});B0.CreateEmbedJobResponse=void 0;var Ywe=pRr($()),hRr=_p();B0.CreateEmbedJobResponse=Ywe.serialization.object({jobId:Ywe.serialization.property("job_id",Ywe.serialization.string()),meta:hRr.ApiMeta.optional()})});var Xwe=b($0=>{"use strict";var mRr=$0&&$0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),gRr=$0&&$0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),yRr=$0&&$0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&mRr(t,e,r);return gRr(t,e),t};Object.defineProperty($0,"__esModule",{value:!0});$0.ClassifyExample=void 0;var Zwe=yRr($());$0.ClassifyExample=Zwe.serialization.object({text:Zwe.serialization.string().optional(),label:Zwe.serialization.string().optional()})});var Nmt=b(q0=>{"use strict";var bRr=q0&&q0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),_Rr=q0&&q0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vRr=q0&&q0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&bRr(t,e,r);return _Rr(t,e),t};Object.defineProperty(q0,"__esModule",{value:!0});q0.ParseInfo=void 0;var Qwe=vRr($());q0.ParseInfo=Qwe.serialization.object({separator:Qwe.serialization.string().optional(),delimiter:Qwe.serialization.string().optional()})});var Lmt=b(U0=>{"use strict";var wRr=U0&&U0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),SRr=U0&&U0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),xRr=U0&&U0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&wRr(t,e,r);return SRr(t,e),t};Object.defineProperty(U0,"__esModule",{value:!0});U0.RerankerDataMetrics=void 0;var vp=xRr($());U0.RerankerDataMetrics=vp.serialization.object({numTrainQueries:vp.serialization.property("num_train_queries",vp.serialization.number().optional()),numTrainRelevantPassages:vp.serialization.property("num_train_relevant_passages",vp.serialization.number().optional()),numTrainHardNegatives:vp.serialization.property("num_train_hard_negatives",vp.serialization.number().optional()),numEvalQueries:vp.serialization.property("num_eval_queries",vp.serialization.number().optional()),numEvalRelevantPassages:vp.serialization.property("num_eval_relevant_passages",vp.serialization.number().optional()),numEvalHardNegatives:vp.serialization.property("num_eval_hard_negatives",vp.serialization.number().optional())})});var Fmt=b(z0=>{"use strict";var CRr=z0&&z0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ORr=z0&&z0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ERr=z0&&z0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&CRr(t,e,r);return ORr(t,e),t};Object.defineProperty(z0,"__esModule",{value:!0});z0.ChatDataMetrics=void 0;var ZL=ERr($());z0.ChatDataMetrics=ZL.serialization.object({numTrainTurns:ZL.serialization.property("num_train_turns",ZL.serialization.number().optional()),numEvalTurns:ZL.serialization.property("num_eval_turns",ZL.serialization.number().optional()),preamble:ZL.serialization.string().optional()})});var eSe=b(H0=>{"use strict";var PRr=H0&&H0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),TRr=H0&&H0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),MRr=H0&&H0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&PRr(t,e,r);return TRr(t,e),t};Object.defineProperty(H0,"__esModule",{value:!0});H0.LabelMetric=void 0;var XL=MRr($());H0.LabelMetric=XL.serialization.object({totalExamples:XL.serialization.property("total_examples",XL.serialization.number().optional()),label:XL.serialization.string().optional(),samples:XL.serialization.list(XL.serialization.string()).optional()})});var kmt=b(V0=>{"use strict";var IRr=V0&&V0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ARr=V0&&V0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),RRr=V0&&V0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&IRr(t,e,r);return ARr(t,e),t};Object.defineProperty(V0,"__esModule",{value:!0});V0.ClassifyDataMetrics=void 0;var tSe=RRr($()),DRr=eSe();V0.ClassifyDataMetrics=tSe.serialization.object({labelMetrics:tSe.serialization.property("label_metrics",tSe.serialization.list(DRr.LabelMetric).optional())})});var rSe=b(W0=>{"use strict";var jRr=W0&&W0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),NRr=W0&&W0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),LRr=W0&&W0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&jRr(t,e,r);return NRr(t,e),t};Object.defineProperty(W0,"__esModule",{value:!0});W0.FinetuneDatasetMetrics=void 0;var wp=LRr($());W0.FinetuneDatasetMetrics=wp.serialization.object({trainableTokenCount:wp.serialization.property("trainable_token_count",wp.serialization.number().optional()),totalExamples:wp.serialization.property("total_examples",wp.serialization.number().optional()),trainExamples:wp.serialization.property("train_examples",wp.serialization.number().optional()),trainSizeBytes:wp.serialization.property("train_size_bytes",wp.serialization.number().optional()),evalExamples:wp.serialization.property("eval_examples",wp.serialization.number().optional()),evalSizeBytes:wp.serialization.property("eval_size_bytes",wp.serialization.number().optional())})});var oSe=b(J0=>{"use strict";var FRr=J0&&J0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),kRr=J0&&J0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),BRr=J0&&J0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&FRr(t,e,r);return kRr(t,e),t};Object.defineProperty(J0,"__esModule",{value:!0});J0.MetricsEmbedDataFieldsItem=void 0;var nSe=BRr($());J0.MetricsEmbedDataFieldsItem=nSe.serialization.object({name:nSe.serialization.string().optional(),count:nSe.serialization.number().optional()})});var iSe=b(G0=>{"use strict";var $Rr=G0&&G0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),qRr=G0&&G0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),URr=G0&&G0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$Rr(t,e,r);return qRr(t,e),t};Object.defineProperty(G0,"__esModule",{value:!0});G0.MetricsEmbedData=void 0;var Bmt=URr($()),zRr=oSe();G0.MetricsEmbedData=Bmt.serialization.object({fields:Bmt.serialization.list(zRr.MetricsEmbedDataFieldsItem).optional()})});var $mt=b(K0=>{"use strict";var HRr=K0&&K0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),VRr=K0&&K0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),WRr=K0&&K0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&HRr(t,e,r);return VRr(t,e),t};Object.defineProperty(K0,"__esModule",{value:!0});K0.Metrics=void 0;var aSe=WRr($()),JRr=rSe(),GRr=iSe();K0.Metrics=aSe.serialization.object({finetuneDatasetMetrics:aSe.serialization.property("finetune_dataset_metrics",JRr.FinetuneDatasetMetrics.optional()),embedData:aSe.serialization.property("embed_data",GRr.MetricsEmbedData.optional())})});var sSe=b(Z0=>{"use strict";var KRr=Z0&&Z0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),YRr=Z0&&Z0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ZRr=Z0&&Z0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&KRr(t,e,r);return YRr(t,e),t};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.ConnectorOAuth=void 0;var Y0=ZRr($());Z0.ConnectorOAuth=Y0.serialization.object({clientId:Y0.serialization.property("client_id",Y0.serialization.string().optional()),clientSecret:Y0.serialization.property("client_secret",Y0.serialization.string().optional()),authorizeUrl:Y0.serialization.property("authorize_url",Y0.serialization.string()),tokenUrl:Y0.serialization.property("token_url",Y0.serialization.string()),scope:Y0.serialization.string().optional()})});var uSe=b(X0=>{"use strict";var XRr=X0&&X0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),QRr=X0&&X0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),e1r=X0&&X0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&XRr(t,e,r);return QRr(t,e),t};Object.defineProperty(X0,"__esModule",{value:!0});X0.ConnectorAuthStatus=void 0;var t1r=e1r($());X0.ConnectorAuthStatus=t1r.serialization.enum_(["valid","expired"])});var QL=b(Q0=>{"use strict";var r1r=Q0&&Q0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),n1r=Q0&&Q0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o1r=Q0&&Q0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&r1r(t,e,r);return n1r(t,e),t};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.Connector=void 0;var Ju=o1r($()),i1r=sSe(),a1r=uSe();Q0.Connector=Ju.serialization.object({id:Ju.serialization.string(),organizationId:Ju.serialization.property("organization_id",Ju.serialization.string().optional()),name:Ju.serialization.string(),description:Ju.serialization.string().optional(),url:Ju.serialization.string().optional(),createdAt:Ju.serialization.property("created_at",Ju.serialization.date()),updatedAt:Ju.serialization.property("updated_at",Ju.serialization.date()),excludes:Ju.serialization.list(Ju.serialization.string()).optional(),authType:Ju.serialization.property("auth_type",Ju.serialization.string().optional()),oauth:i1r.ConnectorOAuth.optional(),authStatus:Ju.serialization.property("auth_status",a1r.ConnectorAuthStatus.optional()),active:Ju.serialization.boolean().optional(),continueOnFailure:Ju.serialization.property("continue_on_failure",Ju.serialization.boolean().optional())})});var qmt=b(ew=>{"use strict";var s1r=ew&&ew.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),u1r=ew&&ew.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l1r=ew&&ew.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&s1r(t,e,r);return u1r(t,e),t};Object.defineProperty(ew,"__esModule",{value:!0});ew.ListConnectorsResponse=void 0;var PZ=l1r($()),c1r=QL();ew.ListConnectorsResponse=PZ.serialization.object({connectors:PZ.serialization.list(c1r.Connector),totalCount:PZ.serialization.property("total_count",PZ.serialization.number().optional())})});var Umt=b(tw=>{"use strict";var d1r=tw&&tw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),f1r=tw&&tw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),p1r=tw&&tw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&d1r(t,e,r);return f1r(t,e),t};Object.defineProperty(tw,"__esModule",{value:!0});tw.CreateConnectorResponse=void 0;var h1r=p1r($()),m1r=QL();tw.CreateConnectorResponse=h1r.serialization.object({connector:m1r.Connector})});var zmt=b(rw=>{"use strict";var g1r=rw&&rw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),y1r=rw&&rw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),b1r=rw&&rw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&g1r(t,e,r);return y1r(t,e),t};Object.defineProperty(rw,"__esModule",{value:!0});rw.GetConnectorResponse=void 0;var _1r=b1r($()),v1r=QL();rw.GetConnectorResponse=_1r.serialization.object({connector:v1r.Connector})});var Hmt=b(nw=>{"use strict";var w1r=nw&&nw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),S1r=nw&&nw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),x1r=nw&&nw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&w1r(t,e,r);return S1r(t,e),t};Object.defineProperty(nw,"__esModule",{value:!0});nw.DeleteConnectorResponse=void 0;var lSe=x1r($());nw.DeleteConnectorResponse=lSe.serialization.record(lSe.serialization.string(),lSe.serialization.unknown())});var Vmt=b(ow=>{"use strict";var C1r=ow&&ow.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),O1r=ow&&ow.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),E1r=ow&&ow.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&C1r(t,e,r);return O1r(t,e),t};Object.defineProperty(ow,"__esModule",{value:!0});ow.UpdateConnectorResponse=void 0;var P1r=E1r($()),T1r=QL();ow.UpdateConnectorResponse=P1r.serialization.object({connector:T1r.Connector})});var Wmt=b(iw=>{"use strict";var M1r=iw&&iw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),I1r=iw&&iw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),A1r=iw&&iw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&M1r(t,e,r);return I1r(t,e),t};Object.defineProperty(iw,"__esModule",{value:!0});iw.OAuthAuthorizeResponse=void 0;var cSe=A1r($());iw.OAuthAuthorizeResponse=cSe.serialization.object({redirectUrl:cSe.serialization.property("redirect_url",cSe.serialization.string().optional())})});var dSe=b(aw=>{"use strict";var R1r=aw&&aw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),D1r=aw&&aw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),j1r=aw&&aw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&R1r(t,e,r);return D1r(t,e),t};Object.defineProperty(aw,"__esModule",{value:!0});aw.CompatibleEndpoint=void 0;var N1r=j1r($());aw.CompatibleEndpoint=N1r.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var fSe=b(uw=>{"use strict";var L1r=uw&&uw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),F1r=uw&&uw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),k1r=uw&&uw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&L1r(t,e,r);return F1r(t,e),t};Object.defineProperty(uw,"__esModule",{value:!0});uw.GetModelResponse=void 0;var sw=k1r($()),Jmt=dSe();uw.GetModelResponse=sw.serialization.object({name:sw.serialization.string().optional(),endpoints:sw.serialization.list(Jmt.CompatibleEndpoint).optional(),finetuned:sw.serialization.boolean().optional(),contextLength:sw.serialization.property("context_length",sw.serialization.number().optional()),tokenizerUrl:sw.serialization.property("tokenizer_url",sw.serialization.string().optional()),defaultEndpoints:sw.serialization.property("default_endpoints",sw.serialization.list(Jmt.CompatibleEndpoint).optional())})});var Gmt=b(lw=>{"use strict";var B1r=lw&&lw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),$1r=lw&&lw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),q1r=lw&&lw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&B1r(t,e,r);return $1r(t,e),t};Object.defineProperty(lw,"__esModule",{value:!0});lw.ListModelsResponse=void 0;var TZ=q1r($()),U1r=fSe();lw.ListModelsResponse=TZ.serialization.object({models:TZ.serialization.list(U1r.GetModelResponse),nextPageToken:TZ.serialization.property("next_page_token",TZ.serialization.string().optional())})});var Kmt=b(ie=>{"use strict";var z1r=ie&&ie.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),fe=ie&&ie.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&z1r(t,e,r)};Object.defineProperty(ie,"__esModule",{value:!0});fe($0e(),ie);fe(q0e(),ie);fe(Xht(),ie);fe(U0e(),ie);fe(emt(),ie);fe(rmt(),ie);fe(omt(),ie);fe(amt(),ie);fe(umt(),ie);fe(z0e(),ie);fe(H0e(),ie);fe(cmt(),ie);fe(V0e(),ie);fe(W0e(),ie);fe(J0e(),ie);fe(G0e(),ie);fe(K0e(),ie);fe(Y0e(),ie);fe(fmt(),ie);fe(iwe(),ie);fe(awe(),ie);fe(swe(),ie);fe(mmt(),ie);fe(lwe(),ie);fe(cwe(),ie);fe(dwe(),ie);fe(fwe(),ie);fe(ymt(),ie);fe(hwe(),ie);fe(mwe(),ie);fe(gwe(),ie);fe(bmt(),ie);fe(_mt(),ie);fe(wmt(),ie);fe(Smt(),ie);fe(JL(),ie);fe(bwe(),ie);fe(Y2(),ie);fe(vwe(),ie);fe(Z2(),ie);fe(hZ(),ie);fe(NA(),ie);fe(Swe(),ie);fe(gZ(),ie);fe(eZ(),ie);fe(xwe(),ie);fe(bZ(),ie);fe(_Z(),ie);fe(X2(),ie);fe(Cwe(),ie);fe(wZ(),ie);fe(KL(),ie);fe(Z0e(),ie);fe(X0e(),ie);fe(Q0e(),ie);fe(_p(),ie);fe(Owe(),ie);fe(p0(),ie);fe(Pwe(),ie);fe(Mwe(),ie);fe(Iwe(),ie);fe(Awe(),ie);fe(Rwe(),ie);fe(Dwe(),ie);fe(jwe(),ie);fe(Nwe(),ie);fe(Lwe(),ie);fe(Fwe(),ie);fe(Mmt(),ie);fe(y0e(),ie);fe(tZ(),ie);fe(f0e(),ie);fe(p0e(),ie);fe(h0e(),ie);fe(m0e(),ie);fe(Bwe(),ie);fe($we(),ie);fe(Imt(),ie);fe(e4(),ie);fe(qwe(),ie);fe(Uwe(),ie);fe(zwe(),ie);fe(Hwe(),ie);fe(Vwe(),ie);fe(Rmt(),ie);fe(rZ(),ie);fe(nZ(),ie);fe(ewe(),ie);fe(twe(),ie);fe(rwe(),ie);fe(Wwe(),ie);fe(Jwe(),ie);fe(Gwe(),ie);fe(Dmt(),ie);fe(jmt(),ie);fe(owe(),ie);fe(Xwe(),ie);fe(x0e(),ie);fe(S0e(),ie);fe(C0e(),ie);fe(Nmt(),ie);fe(Lmt(),ie);fe(Fmt(),ie);fe(eSe(),ie);fe(kmt(),ie);fe(rSe(),ie);fe(oSe(),ie);fe(iSe(),ie);fe($mt(),ie);fe(iZ(),ie);fe(sSe(),ie);fe(uSe(),ie);fe(QL(),ie);fe(qmt(),ie);fe(lZ(),ie);fe(k0e(),ie);fe(cZ(),ie);fe(Umt(),ie);fe(zmt(),ie);fe(Hmt(),ie);fe(Vmt(),ie);fe(Wmt(),ie);fe(dSe(),ie);fe(fSe(),ie);fe(Gmt(),ie)});var Ymt=b(cw=>{"use strict";var H1r=cw&&cw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),V1r=cw&&cw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),W1r=cw&&cw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&H1r(t,e,r);return V1r(t,e),t};Object.defineProperty(cw,"__esModule",{value:!0});cw.ChatStreamRequest=void 0;var kr=W1r($()),J1r=Z2(),G1r=$0e(),K1r=hZ(),Y1r=NA(),Z1r=q0e(),X1r=gZ(),Q1r=Y2(),eDr=bZ(),tDr=U0e();cw.ChatStreamRequest=kr.serialization.object({message:kr.serialization.string(),model:kr.serialization.string().optional(),preamble:kr.serialization.string().optional(),chatHistory:kr.serialization.property("chat_history",kr.serialization.list(J1r.Message).optional()),conversationId:kr.serialization.property("conversation_id",kr.serialization.string().optional()),promptTruncation:kr.serialization.property("prompt_truncation",G1r.ChatStreamRequestPromptTruncation.optional()),connectors:kr.serialization.list(K1r.ChatConnector).optional(),searchQueriesOnly:kr.serialization.property("search_queries_only",kr.serialization.boolean().optional()),documents:kr.serialization.list(Y1r.ChatDocument).optional(),citationQuality:kr.serialization.property("citation_quality",Z1r.ChatStreamRequestCitationQuality.optional()),temperature:kr.serialization.number().optional(),maxTokens:kr.serialization.property("max_tokens",kr.serialization.number().optional()),maxInputTokens:kr.serialization.property("max_input_tokens",kr.serialization.number().optional()),k:kr.serialization.number().optional(),p:kr.serialization.number().optional(),seed:kr.serialization.number().optional(),stopSequences:kr.serialization.property("stop_sequences",kr.serialization.list(kr.serialization.string()).optional()),frequencyPenalty:kr.serialization.property("frequency_penalty",kr.serialization.number().optional()),presencePenalty:kr.serialization.property("presence_penalty",kr.serialization.number().optional()),rawPrompting:kr.serialization.property("raw_prompting",kr.serialization.boolean().optional()),returnPrompt:kr.serialization.property("return_prompt",kr.serialization.boolean().optional()),tools:kr.serialization.list(X1r.Tool).optional(),toolResults:kr.serialization.property("tool_results",kr.serialization.list(Q1r.ToolResult).optional()),forceSingleStep:kr.serialization.property("force_single_step",kr.serialization.boolean().optional()),responseFormat:kr.serialization.property("response_format",eDr.ResponseFormat.optional()),safetyMode:kr.serialization.property("safety_mode",tDr.ChatStreamRequestSafetyMode.optional())})});var Zmt=b(dw=>{"use strict";var rDr=dw&&dw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),nDr=dw&&dw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),oDr=dw&&dw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&rDr(t,e,r);return nDr(t,e),t};Object.defineProperty(dw,"__esModule",{value:!0});dw.ChatRequest=void 0;var Br=oDr($()),iDr=Z2(),aDr=z0e(),sDr=hZ(),uDr=NA(),lDr=H0e(),cDr=gZ(),dDr=Y2(),fDr=bZ(),pDr=V0e();dw.ChatRequest=Br.serialization.object({message:Br.serialization.string(),model:Br.serialization.string().optional(),preamble:Br.serialization.string().optional(),chatHistory:Br.serialization.property("chat_history",Br.serialization.list(iDr.Message).optional()),conversationId:Br.serialization.property("conversation_id",Br.serialization.string().optional()),promptTruncation:Br.serialization.property("prompt_truncation",aDr.ChatRequestPromptTruncation.optional()),connectors:Br.serialization.list(sDr.ChatConnector).optional(),searchQueriesOnly:Br.serialization.property("search_queries_only",Br.serialization.boolean().optional()),documents:Br.serialization.list(uDr.ChatDocument).optional(),citationQuality:Br.serialization.property("citation_quality",lDr.ChatRequestCitationQuality.optional()),temperature:Br.serialization.number().optional(),maxTokens:Br.serialization.property("max_tokens",Br.serialization.number().optional()),maxInputTokens:Br.serialization.property("max_input_tokens",Br.serialization.number().optional()),k:Br.serialization.number().optional(),p:Br.serialization.number().optional(),seed:Br.serialization.number().optional(),stopSequences:Br.serialization.property("stop_sequences",Br.serialization.list(Br.serialization.string()).optional()),frequencyPenalty:Br.serialization.property("frequency_penalty",Br.serialization.number().optional()),presencePenalty:Br.serialization.property("presence_penalty",Br.serialization.number().optional()),rawPrompting:Br.serialization.property("raw_prompting",Br.serialization.boolean().optional()),returnPrompt:Br.serialization.property("return_prompt",Br.serialization.boolean().optional()),tools:Br.serialization.list(cDr.Tool).optional(),toolResults:Br.serialization.property("tool_results",Br.serialization.list(dDr.ToolResult).optional()),forceSingleStep:Br.serialization.property("force_single_step",Br.serialization.boolean().optional()),responseFormat:Br.serialization.property("response_format",fDr.ResponseFormat.optional()),safetyMode:Br.serialization.property("safety_mode",pDr.ChatRequestSafetyMode.optional())})});var Xmt=b(fw=>{"use strict";var hDr=fw&&fw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),mDr=fw&&fw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),gDr=fw&&fw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&hDr(t,e,r);return mDr(t,e),t};Object.defineProperty(fw,"__esModule",{value:!0});fw.GenerateStreamRequest=void 0;var Ci=gDr($()),yDr=W0e(),bDr=J0e();fw.GenerateStreamRequest=Ci.serialization.object({prompt:Ci.serialization.string(),model:Ci.serialization.string().optional(),numGenerations:Ci.serialization.property("num_generations",Ci.serialization.number().optional()),maxTokens:Ci.serialization.property("max_tokens",Ci.serialization.number().optional()),truncate:yDr.GenerateStreamRequestTruncate.optional(),temperature:Ci.serialization.number().optional(),seed:Ci.serialization.number().optional(),preset:Ci.serialization.string().optional(),endSequences:Ci.serialization.property("end_sequences",Ci.serialization.list(Ci.serialization.string()).optional()),stopSequences:Ci.serialization.property("stop_sequences",Ci.serialization.list(Ci.serialization.string()).optional()),k:Ci.serialization.number().optional(),p:Ci.serialization.number().optional(),frequencyPenalty:Ci.serialization.property("frequency_penalty",Ci.serialization.number().optional()),presencePenalty:Ci.serialization.property("presence_penalty",Ci.serialization.number().optional()),returnLikelihoods:Ci.serialization.property("return_likelihoods",bDr.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:Ci.serialization.property("raw_prompting",Ci.serialization.boolean().optional())})});var Qmt=b(pw=>{"use strict";var _Dr=pw&&pw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),vDr=pw&&pw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),wDr=pw&&pw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_Dr(t,e,r);return vDr(t,e),t};Object.defineProperty(pw,"__esModule",{value:!0});pw.GenerateRequest=void 0;var Oi=wDr($()),SDr=G0e(),xDr=K0e();pw.GenerateRequest=Oi.serialization.object({prompt:Oi.serialization.string(),model:Oi.serialization.string().optional(),numGenerations:Oi.serialization.property("num_generations",Oi.serialization.number().optional()),maxTokens:Oi.serialization.property("max_tokens",Oi.serialization.number().optional()),truncate:SDr.GenerateRequestTruncate.optional(),temperature:Oi.serialization.number().optional(),seed:Oi.serialization.number().optional(),preset:Oi.serialization.string().optional(),endSequences:Oi.serialization.property("end_sequences",Oi.serialization.list(Oi.serialization.string()).optional()),stopSequences:Oi.serialization.property("stop_sequences",Oi.serialization.list(Oi.serialization.string()).optional()),k:Oi.serialization.number().optional(),p:Oi.serialization.number().optional(),frequencyPenalty:Oi.serialization.property("frequency_penalty",Oi.serialization.number().optional()),presencePenalty:Oi.serialization.property("presence_penalty",Oi.serialization.number().optional()),returnLikelihoods:Oi.serialization.property("return_likelihoods",xDr.GenerateRequestReturnLikelihoods.optional()),rawPrompting:Oi.serialization.property("raw_prompting",Oi.serialization.boolean().optional())})});var egt=b(hw=>{"use strict";var CDr=hw&&hw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ODr=hw&&hw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),EDr=hw&&hw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&CDr(t,e,r);return ODr(t,e),t};Object.defineProperty(hw,"__esModule",{value:!0});hw.EmbedRequest=void 0;var GA=EDr($()),PDr=rZ(),TDr=nZ(),MDr=Y0e();hw.EmbedRequest=GA.serialization.object({texts:GA.serialization.list(GA.serialization.string()),model:GA.serialization.string().optional(),inputType:GA.serialization.property("input_type",PDr.EmbedInputType.optional()),embeddingTypes:GA.serialization.property("embedding_types",GA.serialization.list(TDr.EmbeddingType).optional()),truncate:MDr.EmbedRequestTruncate.optional()})});var tgt=b(mw=>{"use strict";var IDr=mw&&mw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ADr=mw&&mw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),RDr=mw&&mw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&IDr(t,e,r);return ADr(t,e),t};Object.defineProperty(mw,"__esModule",{value:!0});mw.RerankRequest=void 0;var Sp=RDr($()),DDr=iwe();mw.RerankRequest=Sp.serialization.object({model:Sp.serialization.string().optional(),query:Sp.serialization.string(),documents:Sp.serialization.list(DDr.RerankRequestDocumentsItem),topN:Sp.serialization.property("top_n",Sp.serialization.number().optional()),rankFields:Sp.serialization.property("rank_fields",Sp.serialization.list(Sp.serialization.string()).optional()),returnDocuments:Sp.serialization.property("return_documents",Sp.serialization.boolean().optional()),maxChunksPerDoc:Sp.serialization.property("max_chunks_per_doc",Sp.serialization.number().optional())})});var rgt=b(gw=>{"use strict";var jDr=gw&&gw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),NDr=gw&&gw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),LDr=gw&&gw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&jDr(t,e,r);return NDr(t,e),t};Object.defineProperty(gw,"__esModule",{value:!0});gw.ClassifyRequest=void 0;var eF=LDr($()),FDr=Xwe(),kDr=lwe();gw.ClassifyRequest=eF.serialization.object({inputs:eF.serialization.list(eF.serialization.string()),examples:eF.serialization.list(FDr.ClassifyExample).optional(),model:eF.serialization.string().optional(),preset:eF.serialization.string().optional(),truncate:kDr.ClassifyRequestTruncate.optional()})});var ngt=b(yw=>{"use strict";var BDr=yw&&yw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),$Dr=yw&&yw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),qDr=yw&&yw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&BDr(t,e,r);return $Dr(t,e),t};Object.defineProperty(yw,"__esModule",{value:!0});yw.SummarizeRequest=void 0;var tF=qDr($()),UDr=hwe(),zDr=mwe(),HDr=gwe();yw.SummarizeRequest=tF.serialization.object({text:tF.serialization.string(),length:UDr.SummarizeRequestLength.optional(),format:zDr.SummarizeRequestFormat.optional(),model:tF.serialization.string().optional(),extractiveness:HDr.SummarizeRequestExtractiveness.optional(),temperature:tF.serialization.number().optional(),additionalCommand:tF.serialization.property("additional_command",tF.serialization.string().optional())})});var ogt=b(bw=>{"use strict";var VDr=bw&&bw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),WDr=bw&&bw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),JDr=bw&&bw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&VDr(t,e,r);return WDr(t,e),t};Object.defineProperty(bw,"__esModule",{value:!0});bw.TokenizeRequest=void 0;var pSe=JDr($());bw.TokenizeRequest=pSe.serialization.object({text:pSe.serialization.string(),model:pSe.serialization.string()})});var igt=b(_w=>{"use strict";var GDr=_w&&_w.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),KDr=_w&&_w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),YDr=_w&&_w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&GDr(t,e,r);return KDr(t,e),t};Object.defineProperty(_w,"__esModule",{value:!0});_w.DetokenizeRequest=void 0;var MZ=YDr($());_w.DetokenizeRequest=MZ.serialization.object({tokens:MZ.serialization.list(MZ.serialization.number()),model:MZ.serialization.string()})});var agt=b(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.DetokenizeRequest=Aa.TokenizeRequest=Aa.SummarizeRequest=Aa.ClassifyRequest=Aa.RerankRequest=Aa.EmbedRequest=Aa.GenerateRequest=Aa.GenerateStreamRequest=Aa.ChatRequest=Aa.ChatStreamRequest=void 0;var ZDr=Ymt();Object.defineProperty(Aa,"ChatStreamRequest",{enumerable:!0,get:function(){return ZDr.ChatStreamRequest}});var XDr=Zmt();Object.defineProperty(Aa,"ChatRequest",{enumerable:!0,get:function(){return XDr.ChatRequest}});var QDr=Xmt();Object.defineProperty(Aa,"GenerateStreamRequest",{enumerable:!0,get:function(){return QDr.GenerateStreamRequest}});var ejr=Qmt();Object.defineProperty(Aa,"GenerateRequest",{enumerable:!0,get:function(){return ejr.GenerateRequest}});var tjr=egt();Object.defineProperty(Aa,"EmbedRequest",{enumerable:!0,get:function(){return tjr.EmbedRequest}});var rjr=tgt();Object.defineProperty(Aa,"RerankRequest",{enumerable:!0,get:function(){return rjr.RerankRequest}});var njr=rgt();Object.defineProperty(Aa,"ClassifyRequest",{enumerable:!0,get:function(){return njr.ClassifyRequest}});var ojr=ngt();Object.defineProperty(Aa,"SummarizeRequest",{enumerable:!0,get:function(){return ojr.SummarizeRequest}});var ijr=ogt();Object.defineProperty(Aa,"TokenizeRequest",{enumerable:!0,get:function(){return ijr.TokenizeRequest}});var ajr=igt();Object.defineProperty(Aa,"DetokenizeRequest",{enumerable:!0,get:function(){return ajr.DetokenizeRequest}})});var sgt=b(KA=>{"use strict";var sjr=KA&&KA.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ujr=KA&&KA.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&sjr(t,e,r)};Object.defineProperty(KA,"__esModule",{value:!0});ujr(agt(),KA)});var Ax=b(Ix=>{"use strict";var ljr=Ix&&Ix.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hSe=Ix&&Ix.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ljr(t,e,r)};Object.defineProperty(Ix,"__esModule",{value:!0});hSe(Yht(),Ix);hSe(Kmt(),Ix);hSe(sgt(),Ix)});var mSe=b(_o=>{"use strict";var cjr=_o&&_o.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),djr=_o&&_o.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),fjr=_o&&_o.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&cjr(t,e,r);return djr(t,e),t},IZ=_o&&_o.__awaiter||function(e,t,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(e,t||[])).next())})},pjr=_o&&_o.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values=="function"?__values(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,u){a=e[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(_o,"__esModule",{value:!0});_o.fetchOverride=_o.parseAWSEvent=_o.getEndpointFromUrl=_o.getAuthHeaders=_o.getUrl=_o.mapResponseFromBedrock=void 0;var hjr=Xfe(),mjr=(Qrt(),sl(Xrt)),gjr=iit(),yjr=vat(),bjr=l2(),_jr=$(),vjr=I_e(),wjr=kpt(),n4=fjr(Ax()),Sjr=(e,t)=>IZ(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return e(),yield t()}finally{process.env=r}}),xjr={chat:n4.StreamedChatResponse,generate:n4.GenerateStreamedResponse},Cjr={chat:n4.NonStreamedChatResponse,embed:n4.EmbedResponse,generate:n4.Generation},Ojr=(e,t,r)=>IZ(void 0,void 0,void 0,function*(){let n=e?xjr[t]:Cjr[t],o={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},i=yield n.parseOrThrow(r,o);return n.jsonOrThrow(i,o)});_o.mapResponseFromBedrock=Ojr;var Ejr=(e,t,r,n)=>{let o={bedrock:n?"invoke-with-response-stream":"invoke",sagemaker:n?"invocations-response-stream":"invocations"}[e];return{bedrock:`https://${e}-runtime.${t}.amazonaws.com/model/${r}/${o}`,sagemaker:`https://runtime.sagemaker.${t}.amazonaws.com/endpoints/${r}/${o}`}[e]};_o.getUrl=Ejr;var Pjr=(e,t,r,n,o,i)=>IZ(void 0,void 0,void 0,function*(){let a=(0,mjr.fromNodeProviderChain)(),s=yield Sjr(()=>{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 yjr.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:hjr.Sha256});delete r.connection,r.host=e.hostname;let l=new gjr.HttpRequest({method:t.toUpperCase(),protocol:e.protocol,path:e.pathname,headers:r,body:n});return(yield u.sign(l)).headers});_o.getAuthHeaders=Pjr;var Tjr=(e,t,r,n)=>{if(t&&e.includes(t))return"chat";if(r&&e.includes(r))return"embed";if(n&&e.includes(n))return"generate";throw new Error(`Unknown endpoint in url: ${e}`)};_o.getEndpointFromUrl=Tjr;var Mjr=e=>{let t=/{[^\}]*}/,r=e.match(t);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}}};_o.parseAWSEvent=Mjr;var Ijr=(e,{awsRegion:t,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>IZ(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,_o.getUrl)(e,t,l.model,c);delete l.stream,delete l.model,delete i.headers.Authorization,i.headers.Host=new URL(d).hostname;let f=yield(0,_o.getAuthHeaders)(new URL(d),i.method,i.headers,JSON.stringify(l),e,{awsRegion:t,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o});i.url=d,i.headers=f;let p=yield(0,_jr.fetcher)(i);if(!p.ok)return p;try{if(c){let _=(0,vjr.readableStreamAsyncIterable)(p.body),g=new wjr.LineDecoder,v=new bjr.PassThrough;try{for(var h=pjr(_),m;m=yield h.next(),!m.done;){let S=m.value;for(let x of g.decode(S)){let O=(0,_o.parseAWSEvent)(x);if(O){let T=yield(0,_o.mapResponseFromBedrock)(c,u,O);v.push(JSON.stringify(T)+`
`)}}}}catch(S){a={error:S}}finally{try{m&&!m.done&&(s=h.return)&&(yield s.call(h))}finally{if(a)throw a.error}}for(let S of g.flush()){let x=(0,_o.parseAWSEvent)(S);if(x){let O=yield(0,_o.mapResponseFromBedrock)(c,u,x);v.push(JSON.stringify(O)+`
`)}}return v.end(),{ok:!0,body:v}}else{let _=yield p.body;return{ok:!0,body:yield(0,_o.mapResponseFromBedrock)(c,u,_)}}}catch(_){throw _}});_o.fetchOverride=Ijr});var Rx=b(AZ=>{"use strict";Object.defineProperty(AZ,"__esModule",{value:!0});AZ.CohereEnvironment=void 0;AZ.CohereEnvironment={Production:"https://api.cohere.com"}});var mP=b((ugt,RZ)=>{(function(e,t,r){typeof RZ<"u"&&RZ.exports?RZ.exports=r():typeof define=="function"&&define.amd?define(r):t[e]=r()})("urljoin",ugt,function(){function e(t){var r=[];if(t.length===0)return"";if(typeof t[0]!="string")throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var n=t.shift();t[0]=n+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var o=0;o<t.length;o++){var i=t[o];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(o>0&&(i=i.replace(/^[\/]+/,"")),o<t.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),r.push(i))}var a=r.join("/");a=a.replace(/\/(\?|&|#[^!])/g,"$1");var s=a.split("?");return a=s.shift()+(s.length>0?"?":"")+s.join("&"),a}return function(){var t;return typeof arguments[0]=="object"?t=arguments[0]:t=[].slice.call(arguments),e(t)}})});var ySe=b(Cf=>{"use strict";var Ajr=Cf&&Cf.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Rjr=Cf&&Cf.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o4=Cf&&Cf.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ajr(t,e,r);return Rjr(t,e),t},DZ=Cf&&Cf.__awaiter||function(e,t,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(e,t||[])).next())})},Djr=Cf&&Cf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Cf,"__esModule",{value:!0});Cf.V2=void 0;var lgt=o4(Rx()),Sf=o4($()),Ra=o4(rx()),xf=o4(Ax()),cgt=Djr(mP()),Dx=o4(Wa()),gSe=class{constructor(t={}){this._options=t}chatStream(t,r){var n,o;return DZ(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Sf.fetcher)({url:(0,cgt.default)((o=yield Sf.Supplier.get(this._options.environment))!==null&&o!==void 0?o:lgt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Sf.Supplier.get(this._options.clientName))!=null?yield Sf.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":Sf.RUNTIME.type,"X-Fern-Runtime-Version":Sf.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},xf.V2ChatStreamRequest.jsonOrThrow(t,{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 Sf.Stream({stream:i.body,parse:a=>DZ(this,void 0,void 0,function*(){return xf.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 Ra.BadRequestError(i.error.body);case 401:throw new Ra.UnauthorizedError(i.error.body);case 403:throw new Ra.ForbiddenError(i.error.body);case 404:throw new Ra.NotFoundError(i.error.body);case 422:throw new Ra.UnprocessableEntityError(xf.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ra.TooManyRequestsError(xf.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ra.ClientClosedRequestError(xf.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ra.InternalServerError(i.error.body);case 501:throw new Ra.NotImplementedError(xf.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ra.ServiceUnavailableError(i.error.body);case 504:throw new Ra.GatewayTimeoutError(xf.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Dx.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Dx.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Dx.CohereTimeoutError;case"unknown":throw new Dx.CohereError({message:i.error.errorMessage})}})}chat(t,r){var n,o;return DZ(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Sf.fetcher)({url:(0,cgt.default)((o=yield Sf.Supplier.get(this._options.environment))!==null&&o!==void 0?o:lgt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Sf.Supplier.get(this._options.clientName))!=null?yield Sf.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":Sf.RUNTIME.type,"X-Fern-Runtime-Version":Sf.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},xf.V2ChatRequest.jsonOrThrow(t,{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 xf.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 Ra.BadRequestError(i.error.body);case 401:throw new Ra.UnauthorizedError(i.error.body);case 403:throw new Ra.ForbiddenError(i.error.body);case 404:throw new Ra.NotFoundError(i.error.body);case 422:throw new Ra.UnprocessableEntityError(xf.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ra.TooManyRequestsError(xf.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ra.ClientClosedRequestError(xf.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ra.InternalServerError(i.error.body);case 501:throw new Ra.NotImplementedError(xf.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ra.ServiceUnavailableError(i.error.body);case 504:throw new Ra.GatewayTimeoutError(xf.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Dx.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Dx.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Dx.CohereTimeoutError;case"unknown":throw new Dx.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var t;return DZ(this,void 0,void 0,function*(){let r=(t=yield Sf.Supplier.get(this._options.token))!==null&&t!==void 0?t:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Dx.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Cf.V2=gSe});var dgt=b(Of=>{"use strict";var jjr=Of&&Of.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Njr=Of&&Of.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a4=Of&&Of.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&jjr(t,e,r);return Njr(t,e),t},i4=Of&&Of.__awaiter||function(e,t,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(e,t||[])).next())})},Ljr=Of&&Of.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Of,"__esModule",{value:!0});Of.EmbedJobs=void 0;var jZ=a4(Rx()),Ei=a4($()),ur=a4(rx()),NZ=Ljr(mP()),Hi=a4(Ax()),tc=a4(Wa()),bSe=class{constructor(t={}){this._options=t}list(t){var r,n;return i4(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Ei.fetcher)({url:(0,NZ.default)((n=yield Ei.Supplier.get(this._options.environment))!==null&&n!==void 0?n:jZ.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ei.Supplier.get(this._options.clientName))!=null?yield Ei.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":Ei.RUNTIME.type,"X-Fern-Runtime-Version":Ei.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:3e5,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return Hi.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 ur.BadRequestError(o.error.body);case 401:throw new ur.UnauthorizedError(o.error.body);case 403:throw new ur.ForbiddenError(o.error.body);case 404:throw new ur.NotFoundError(o.error.body);case 422:throw new ur.UnprocessableEntityError(Hi.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ur.TooManyRequestsError(Hi.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ur.ClientClosedRequestError(Hi.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ur.InternalServerError(o.error.body);case 501:throw new ur.NotImplementedError(Hi.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ur.ServiceUnavailableError(o.error.body);case 504:throw new ur.GatewayTimeoutError(Hi.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new tc.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new tc.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new tc.CohereTimeoutError;case"unknown":throw new tc.CohereError({message:o.error.errorMessage})}})}create(t,r){var n,o;return i4(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ei.fetcher)({url:(0,NZ.default)((o=yield Ei.Supplier.get(this._options.environment))!==null&&o!==void 0?o:jZ.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ei.Supplier.get(this._options.clientName))!=null?yield Ei.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":Ei.RUNTIME.type,"X-Fern-Runtime-Version":Ei.RUNTIME.version},contentType:"application/json",requestType:"json",body:Hi.CreateEmbedJobRequest.jsonOrThrow(t,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Hi.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 ur.BadRequestError(i.error.body);case 401:throw new ur.UnauthorizedError(i.error.body);case 403:throw new ur.ForbiddenError(i.error.body);case 404:throw new ur.NotFoundError(i.error.body);case 422:throw new ur.UnprocessableEntityError(Hi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ur.TooManyRequestsError(Hi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ur.ClientClosedRequestError(Hi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ur.InternalServerError(i.error.body);case 501:throw new ur.NotImplementedError(Hi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ur.ServiceUnavailableError(i.error.body);case 504:throw new ur.GatewayTimeoutError(Hi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new tc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new tc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new tc.CohereTimeoutError;case"unknown":throw new tc.CohereError({message:i.error.errorMessage})}})}get(t,r){var n,o;return i4(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ei.fetcher)({url:(0,NZ.default)((o=yield Ei.Supplier.get(this._options.environment))!==null&&o!==void 0?o:jZ.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(t)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ei.Supplier.get(this._options.clientName))!=null?yield Ei.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":Ei.RUNTIME.type,"X-Fern-Runtime-Version":Ei.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 Hi.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 ur.BadRequestError(i.error.body);case 401:throw new ur.UnauthorizedError(i.error.body);case 403:throw new ur.ForbiddenError(i.error.body);case 404:throw new ur.NotFoundError(i.error.body);case 422:throw new ur.UnprocessableEntityError(Hi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ur.TooManyRequestsError(Hi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ur.ClientClosedRequestError(Hi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ur.InternalServerError(i.error.body);case 501:throw new ur.NotImplementedError(Hi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ur.ServiceUnavailableError(i.error.body);case 504:throw new ur.GatewayTimeoutError(Hi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new tc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new tc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new tc.CohereTimeoutError;case"unknown":throw new tc.CohereError({message:i.error.errorMessage})}})}cancel(t,r){var n,o;return i4(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ei.fetcher)({url:(0,NZ.default)((o=yield Ei.Supplier.get(this._options.environment))!==null&&o!==void 0?o:jZ.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(t)}/cancel`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ei.Supplier.get(this._options.clientName))!=null?yield Ei.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":Ei.RUNTIME.type,"X-Fern-Runtime-Version":Ei.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 ur.BadRequestError(i.error.body);case 401:throw new ur.UnauthorizedError(i.error.body);case 403:throw new ur.ForbiddenError(i.error.body);case 404:throw new ur.NotFoundError(i.error.body);case 422:throw new ur.UnprocessableEntityError(Hi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ur.TooManyRequestsError(Hi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ur.ClientClosedRequestError(Hi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ur.InternalServerError(i.error.body);case 501:throw new ur.NotImplementedError(Hi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ur.ServiceUnavailableError(i.error.body);case 504:throw new ur.GatewayTimeoutError(Hi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new tc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new tc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new tc.CohereTimeoutError;case"unknown":throw new tc.CohereError({message:i.error.errorMessage})}}})}_getAuthorizationHeader(){var t;return i4(this,void 0,void 0,function*(){let r=(t=yield Ei.Supplier.get(this._options.token))!==null&&t!==void 0?t:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new tc.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Of.EmbedJobs=bSe});var fgt=b(Ef=>{"use strict";var Fjr=Ef&&Ef.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),kjr=Ef&&Ef.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l4=Ef&&Ef.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Fjr(t,e,r);return kjr(t,e),t},rF=Ef&&Ef.__awaiter||function(e,t,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(e,t||[])).next())})},Bjr=Ef&&Ef.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ef,"__esModule",{value:!0});Ef.Datasets=void 0;var s4=l4(Rx()),zn=l4($()),Rt=l4(rx()),u4=Bjr(mP()),To=l4(Ax()),Za=l4(Wa()),_Se=class{constructor(t={}){this._options=t}list(t={},r){var n,o;return rF(this,void 0,void 0,function*(){let{datasetType:i,before:a,after:s,limit:u,offset:l,validationStatus:c}=t,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:zn.fetcher)({url:(0,u4.default)((o=yield zn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:s4.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zn.Supplier.get(this._options.clientName))!=null?yield zn.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":zn.RUNTIME.type,"X-Fern-Runtime-Version":zn.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 To.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 Rt.BadRequestError(f.error.body);case 401:throw new Rt.UnauthorizedError(f.error.body);case 403:throw new Rt.ForbiddenError(f.error.body);case 404:throw new Rt.NotFoundError(f.error.body);case 422:throw new Rt.UnprocessableEntityError(To.UnprocessableEntityErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(To.TooManyRequestsErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(To.ClientClosedRequestErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(f.error.body);case 501:throw new Rt.NotImplementedError(To.NotImplementedErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(f.error.body);case 504:throw new Rt.GatewayTimeoutError(To.GatewayTimeoutErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Za.CohereError({statusCode:f.error.statusCode,body:f.error.body})}switch(f.error.reason){case"non-json":throw new Za.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody});case"timeout":throw new Za.CohereTimeoutError;case"unknown":throw new Za.CohereError({message:f.error.errorMessage})}})}create(t,r,n,o){var i,a;return rF(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 zn.newFormData();yield u.appendFile("data",t,t?.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:zn.fetcher)({url:(0,u4.default)((a=yield zn.Supplier.get(this._options.environment))!==null&&a!==void 0?a:s4.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zn.Supplier.get(this._options.clientName))!=null?yield zn.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":zn.RUNTIME.type,"X-Fern-Runtime-Version":zn.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 To.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 Rt.BadRequestError(c.error.body);case 401:throw new Rt.UnauthorizedError(c.error.body);case 403:throw new Rt.ForbiddenError(c.error.body);case 404:throw new Rt.NotFoundError(c.error.body);case 422:throw new Rt.UnprocessableEntityError(To.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(To.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(To.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(c.error.body);case 501:throw new Rt.NotImplementedError(To.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(c.error.body);case 504:throw new Rt.GatewayTimeoutError(To.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Za.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new Za.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new Za.CohereTimeoutError;case"unknown":throw new Za.CohereError({message:c.error.errorMessage})}})}getUsage(t){var r,n;return rF(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:zn.fetcher)({url:(0,u4.default)((n=yield zn.Supplier.get(this._options.environment))!==null&&n!==void 0?n:s4.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zn.Supplier.get(this._options.clientName))!=null?yield zn.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":zn.RUNTIME.type,"X-Fern-Runtime-Version":zn.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:3e5,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return To.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 Rt.BadRequestError(o.error.body);case 401:throw new Rt.UnauthorizedError(o.error.body);case 403:throw new Rt.ForbiddenError(o.error.body);case 404:throw new Rt.NotFoundError(o.error.body);case 422:throw new Rt.UnprocessableEntityError(To.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(To.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(To.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(o.error.body);case 501:throw new Rt.NotImplementedError(To.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(o.error.body);case 504:throw new Rt.GatewayTimeoutError(To.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Za.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Za.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Za.CohereTimeoutError;case"unknown":throw new Za.CohereError({message:o.error.errorMessage})}})}get(t,r){var n,o;return rF(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:zn.fetcher)({url:(0,u4.default)((o=yield zn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:s4.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(t)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zn.Supplier.get(this._options.clientName))!=null?yield zn.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":zn.RUNTIME.type,"X-Fern-Runtime-Version":zn.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 To.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 Rt.BadRequestError(i.error.body);case 401:throw new Rt.UnauthorizedError(i.error.body);case 403:throw new Rt.ForbiddenError(i.error.body);case 404:throw new Rt.NotFoundError(i.error.body);case 422:throw new Rt.UnprocessableEntityError(To.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(To.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(To.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(i.error.body);case 501:throw new Rt.NotImplementedError(To.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(i.error.body);case 504:throw new Rt.GatewayTimeoutError(To.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Za.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Za.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Za.CohereTimeoutError;case"unknown":throw new Za.CohereError({message:i.error.errorMessage})}})}delete(t,r){var n,o;return rF(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:zn.fetcher)({url:(0,u4.default)((o=yield zn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:s4.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(t)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zn.Supplier.get(this._options.clientName))!=null?yield zn.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":zn.RUNTIME.type,"X-Fern-Runtime-Version":zn.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 To.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 Rt.BadRequestError(i.error.body);case 401:throw new Rt.UnauthorizedError(i.error.body);case 403:throw new Rt.ForbiddenError(i.error.body);case 404:throw new Rt.NotFoundError(i.error.body);case 422:throw new Rt.UnprocessableEntityError(To.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(To.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(To.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(i.error.body);case 501:throw new Rt.NotImplementedError(To.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(i.error.body);case 504:throw new Rt.GatewayTimeoutError(To.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Za.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Za.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Za.CohereTimeoutError;case"unknown":throw new Za.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var t;return rF(this,void 0,void 0,function*(){let r=(t=yield zn.Supplier.get(this._options.token))!==null&&t!==void 0?t:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Za.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Ef.Datasets=_Se});var pgt=b(Pf=>{"use strict";var $jr=Pf&&Pf.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),qjr=Pf&&Pf.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c4=Pf&&Pf.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$jr(t,e,r);return qjr(t,e),t},YA=Pf&&Pf.__awaiter||function(e,t,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(e,t||[])).next())})},Ujr=Pf&&Pf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Pf,"__esModule",{value:!0});Pf.Connectors=void 0;var nF=c4(Rx()),rn=c4($()),it=c4(rx()),oF=Ujr(mP()),Kr=c4(Ax()),Pi=c4(Wa()),vSe=class{constructor(t={}){this._options=t}list(t={},r){var n,o;return YA(this,void 0,void 0,function*(){let{limit:i,offset:a}=t,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:rn.fetcher)({url:(0,oF.default)((o=yield rn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:nF.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield rn.Supplier.get(this._options.clientName))!=null?yield rn.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":rn.RUNTIME.type,"X-Fern-Runtime-Version":rn.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 Kr.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 it.BadRequestError(u.error.body);case 401:throw new it.UnauthorizedError(u.error.body);case 403:throw new it.ForbiddenError(u.error.body);case 404:throw new it.NotFoundError(u.error.body);case 422:throw new it.UnprocessableEntityError(Kr.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new it.TooManyRequestsError(Kr.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new it.ClientClosedRequestError(Kr.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new it.InternalServerError(u.error.body);case 501:throw new it.NotImplementedError(Kr.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new it.ServiceUnavailableError(u.error.body);case 504:throw new it.GatewayTimeoutError(Kr.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Pi.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new Pi.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new Pi.CohereTimeoutError;case"unknown":throw new Pi.CohereError({message:u.error.errorMessage})}})}create(t,r){var n,o;return YA(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:rn.fetcher)({url:(0,oF.default)((o=yield rn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:nF.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield rn.Supplier.get(this._options.clientName))!=null?yield rn.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":rn.RUNTIME.type,"X-Fern-Runtime-Version":rn.RUNTIME.version},contentType:"application/json",requestType:"json",body:Kr.CreateConnectorRequest.jsonOrThrow(t,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Kr.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 it.BadRequestError(i.error.body);case 401:throw new it.UnauthorizedError(i.error.body);case 403:throw new it.ForbiddenError(i.error.body);case 404:throw new it.NotFoundError(i.error.body);case 422:throw new it.UnprocessableEntityError(Kr.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new it.TooManyRequestsError(Kr.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new it.ClientClosedRequestError(Kr.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new it.InternalServerError(i.error.body);case 501:throw new it.NotImplementedError(Kr.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new it.ServiceUnavailableError(i.error.body);case 504:throw new it.GatewayTimeoutError(Kr.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Pi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Pi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Pi.CohereTimeoutError;case"unknown":throw new Pi.CohereError({message:i.error.errorMessage})}})}get(t,r){var n,o;return YA(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:rn.fetcher)({url:(0,oF.default)((o=yield rn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:nF.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(t)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield rn.Supplier.get(this._options.clientName))!=null?yield rn.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":rn.RUNTIME.type,"X-Fern-Runtime-Version":rn.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 Kr.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 it.BadRequestError(i.error.body);case 401:throw new it.UnauthorizedError(i.error.body);case 403:throw new it.ForbiddenError(i.error.body);case 404:throw new it.NotFoundError(i.error.body);case 422:throw new it.UnprocessableEntityError(Kr.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new it.TooManyRequestsError(Kr.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new it.ClientClosedRequestError(Kr.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new it.InternalServerError(i.error.body);case 501:throw new it.NotImplementedError(Kr.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new it.ServiceUnavailableError(i.error.body);case 504:throw new it.GatewayTimeoutError(Kr.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Pi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Pi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Pi.CohereTimeoutError;case"unknown":throw new Pi.CohereError({message:i.error.errorMessage})}})}delete(t,r){var n,o;return YA(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:rn.fetcher)({url:(0,oF.default)((o=yield rn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:nF.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(t)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield rn.Supplier.get(this._options.clientName))!=null?yield rn.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":rn.RUNTIME.type,"X-Fern-Runtime-Version":rn.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 Kr.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 it.BadRequestError(i.error.body);case 401:throw new it.UnauthorizedError(i.error.body);case 403:throw new it.ForbiddenError(i.error.body);case 404:throw new it.NotFoundError(i.error.body);case 422:throw new it.UnprocessableEntityError(Kr.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new it.TooManyRequestsError(Kr.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new it.ClientClosedRequestError(Kr.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new it.InternalServerError(i.error.body);case 501:throw new it.NotImplementedError(Kr.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new it.ServiceUnavailableError(i.error.body);case 504:throw new it.GatewayTimeoutError(Kr.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Pi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Pi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Pi.CohereTimeoutError;case"unknown":throw new Pi.CohereError({message:i.error.errorMessage})}})}update(t,r={},n){var o,i;return YA(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:rn.fetcher)({url:(0,oF.default)((i=yield rn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:nF.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(t)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield rn.Supplier.get(this._options.clientName))!=null?yield rn.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":rn.RUNTIME.type,"X-Fern-Runtime-Version":rn.RUNTIME.version},contentType:"application/json",requestType:"json",body:Kr.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 Kr.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 it.BadRequestError(a.error.body);case 401:throw new it.UnauthorizedError(a.error.body);case 403:throw new it.ForbiddenError(a.error.body);case 404:throw new it.NotFoundError(a.error.body);case 422:throw new it.UnprocessableEntityError(Kr.UnprocessableEntityErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new it.TooManyRequestsError(Kr.TooManyRequestsErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new it.ClientClosedRequestError(Kr.ClientClosedRequestErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new it.InternalServerError(a.error.body);case 501:throw new it.NotImplementedError(Kr.NotImplementedErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new it.ServiceUnavailableError(a.error.body);case 504:throw new it.GatewayTimeoutError(Kr.GatewayTimeoutErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Pi.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new Pi.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new Pi.CohereTimeoutError;case"unknown":throw new Pi.CohereError({message:a.error.errorMessage})}})}oAuthAuthorize(t,r={},n){var o,i;return YA(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:rn.fetcher)({url:(0,oF.default)((i=yield rn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:nF.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(t)}/oauth/authorize`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield rn.Supplier.get(this._options.clientName))!=null?yield rn.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":rn.RUNTIME.type,"X-Fern-Runtime-Version":rn.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 Kr.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 it.BadRequestError(u.error.body);case 401:throw new it.UnauthorizedError(u.error.body);case 403:throw new it.ForbiddenError(u.error.body);case 404:throw new it.NotFoundError(u.error.body);case 422:throw new it.UnprocessableEntityError(Kr.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new it.TooManyRequestsError(Kr.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new it.ClientClosedRequestError(Kr.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new it.InternalServerError(u.error.body);case 501:throw new it.NotImplementedError(Kr.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new it.ServiceUnavailableError(u.error.body);case 504:throw new it.GatewayTimeoutError(Kr.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Pi.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new Pi.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new Pi.CohereTimeoutError;case"unknown":throw new Pi.CohereError({message:u.error.errorMessage})}})}_getAuthorizationHeader(){var t;return YA(this,void 0,void 0,function*(){let r=(t=yield rn.Supplier.get(this._options.token))!==null&&t!==void 0?t:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Pi.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Pf.Connectors=vSe});var ggt=b(Tf=>{"use strict";var zjr=Tf&&Tf.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Hjr=Tf&&Tf.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),d4=Tf&&Tf.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&zjr(t,e,r);return Hjr(t,e),t},wSe=Tf&&Tf.__awaiter||function(e,t,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(e,t||[])).next())})},Vjr=Tf&&Tf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Tf,"__esModule",{value:!0});Tf.Models=void 0;var hgt=d4(Rx()),xp=d4($()),Da=d4(rx()),mgt=Vjr(mP()),Fh=d4(Ax()),jx=d4(Wa()),SSe=class{constructor(t={}){this._options=t}get(t,r){var n,o;return wSe(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xp.fetcher)({url:(0,mgt.default)((o=yield xp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:hgt.CohereEnvironment.Production,`v1/models/${encodeURIComponent(t)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xp.Supplier.get(this._options.clientName))!=null?yield xp.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":xp.RUNTIME.type,"X-Fern-Runtime-Version":xp.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 Fh.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 Da.BadRequestError(i.error.body);case 401:throw new Da.UnauthorizedError(i.error.body);case 403:throw new Da.ForbiddenError(i.error.body);case 404:throw new Da.NotFoundError(i.error.body);case 422:throw new Da.UnprocessableEntityError(Fh.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Da.TooManyRequestsError(Fh.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Da.ClientClosedRequestError(Fh.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Da.InternalServerError(i.error.body);case 501:throw new Da.NotImplementedError(Fh.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Da.ServiceUnavailableError(i.error.body);case 504:throw new Da.GatewayTimeoutError(Fh.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jx.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jx.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jx.CohereTimeoutError;case"unknown":throw new jx.CohereError({message:i.error.errorMessage})}})}list(t={},r){var n,o;return wSe(this,void 0,void 0,function*(){let{pageSize:i,pageToken:a,endpoint:s,defaultOnly:u}=t,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:xp.fetcher)({url:(0,mgt.default)((o=yield xp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:hgt.CohereEnvironment.Production,"v1/models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xp.Supplier.get(this._options.clientName))!=null?yield xp.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":xp.RUNTIME.type,"X-Fern-Runtime-Version":xp.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 Fh.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 Da.BadRequestError(c.error.body);case 401:throw new Da.UnauthorizedError(c.error.body);case 403:throw new Da.ForbiddenError(c.error.body);case 404:throw new Da.NotFoundError(c.error.body);case 422:throw new Da.UnprocessableEntityError(Fh.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Da.TooManyRequestsError(Fh.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Da.ClientClosedRequestError(Fh.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Da.InternalServerError(c.error.body);case 501:throw new Da.NotImplementedError(Fh.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Da.ServiceUnavailableError(c.error.body);case 504:throw new Da.GatewayTimeoutError(Fh.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jx.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new jx.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new jx.CohereTimeoutError;case"unknown":throw new jx.CohereError({message:c.error.errorMessage})}})}_getAuthorizationHeader(){var t;return wSe(this,void 0,void 0,function*(){let r=(t=yield xp.Supplier.get(this._options.token))!==null&&t!==void 0?t:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new jx.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Tf.Models=SSe});var ygt=b(Mf=>{"use strict";var Wjr=Mf&&Mf.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Jjr=Mf&&Mf.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),f4=Mf&&Mf.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Wjr(t,e,r);return Jjr(t,e),t},gP=Mf&&Mf.__awaiter||function(e,t,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(e,t||[])).next())})},Gjr=Mf&&Mf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Mf,"__esModule",{value:!0});Mf.Finetuning=void 0;var ZA=f4(Rx()),hr=f4($()),vr=f4(rx()),XA=Gjr(mP()),Nx=f4(Ax()),Fo=f4(Wa()),xSe=class{constructor(t={}){this._options=t}listFinetunedModels(t={},r){var n,o;return gP(this,void 0,void 0,function*(){let{pageSize:i,pageToken:a,orderBy:s}=t,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:hr.fetcher)({url:(0,XA.default)((o=yield hr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ZA.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield hr.Supplier.get(this._options.clientName))!=null?yield hr.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":hr.RUNTIME.type,"X-Fern-Runtime-Version":hr.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 Nx.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 vr.BadRequestError(l.error.body);case 401:throw new vr.UnauthorizedError(l.error.body);case 403:throw new vr.ForbiddenError(l.error.body);case 404:throw new vr.NotFoundError(l.error.body);case 500:throw new vr.InternalServerError(l.error.body);case 503:throw new vr.ServiceUnavailableError(l.error.body);default:throw new Fo.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new Fo.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new Fo.CohereTimeoutError;case"unknown":throw new Fo.CohereError({message:l.error.errorMessage})}})}createFinetunedModel(t,r){var n,o;return gP(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:hr.fetcher)({url:(0,XA.default)((o=yield hr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ZA.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield hr.Supplier.get(this._options.clientName))!=null?yield hr.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":hr.RUNTIME.type,"X-Fern-Runtime-Version":hr.RUNTIME.version},contentType:"application/json",requestType:"json",body:Nx.finetuning.FinetunedModel.jsonOrThrow(t,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Nx.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 vr.BadRequestError(i.error.body);case 401:throw new vr.UnauthorizedError(i.error.body);case 403:throw new vr.ForbiddenError(i.error.body);case 404:throw new vr.NotFoundError(i.error.body);case 500:throw new vr.InternalServerError(i.error.body);case 503:throw new vr.ServiceUnavailableError(i.error.body);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})}})}getFinetunedModel(t,r){var n,o;return gP(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:hr.fetcher)({url:(0,XA.default)((o=yield hr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ZA.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(t)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield hr.Supplier.get(this._options.clientName))!=null?yield hr.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":hr.RUNTIME.type,"X-Fern-Runtime-Version":hr.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 Nx.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 vr.BadRequestError(i.error.body);case 401:throw new vr.UnauthorizedError(i.error.body);case 403:throw new vr.ForbiddenError(i.error.body);case 404:throw new vr.NotFoundError(i.error.body);case 500:throw new vr.InternalServerError(i.error.body);case 503:throw new vr.ServiceUnavailableError(i.error.body);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})}})}deleteFinetunedModel(t,r){var n,o;return gP(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:hr.fetcher)({url:(0,XA.default)((o=yield hr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ZA.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(t)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield hr.Supplier.get(this._options.clientName))!=null?yield hr.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":hr.RUNTIME.type,"X-Fern-Runtime-Version":hr.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 Nx.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 vr.BadRequestError(i.error.body);case 401:throw new vr.UnauthorizedError(i.error.body);case 403:throw new vr.ForbiddenError(i.error.body);case 404:throw new vr.NotFoundError(i.error.body);case 500:throw new vr.InternalServerError(i.error.body);case 503:throw new vr.ServiceUnavailableError(i.error.body);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})}})}updateFinetunedModel(t,r,n){var o,i;return gP(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:hr.fetcher)({url:(0,XA.default)((i=yield hr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:ZA.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(t)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield hr.Supplier.get(this._options.clientName))!=null?yield hr.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":hr.RUNTIME.type,"X-Fern-Runtime-Version":hr.RUNTIME.version},contentType:"application/json",requestType:"json",body:Nx.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 Nx.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 vr.BadRequestError(a.error.body);case 401:throw new vr.UnauthorizedError(a.error.body);case 403:throw new vr.ForbiddenError(a.error.body);case 404:throw new vr.NotFoundError(a.error.body);case 500:throw new vr.InternalServerError(a.error.body);case 503:throw new vr.ServiceUnavailableError(a.error.body);default:throw new Fo.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new Fo.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new Fo.CohereTimeoutError;case"unknown":throw new Fo.CohereError({message:a.error.errorMessage})}})}listEvents(t,r={},n){var o,i;return gP(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:hr.fetcher)({url:(0,XA.default)((i=yield hr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:ZA.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(t)}/events`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield hr.Supplier.get(this._options.clientName))!=null?yield hr.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":hr.RUNTIME.type,"X-Fern-Runtime-Version":hr.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 Nx.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 vr.BadRequestError(c.error.body);case 401:throw new vr.UnauthorizedError(c.error.body);case 403:throw new vr.ForbiddenError(c.error.body);case 404:throw new vr.NotFoundError(c.error.body);case 500:throw new vr.InternalServerError(c.error.body);case 503:throw new vr.ServiceUnavailableError(c.error.body);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})}})}listTrainingStepMetrics(t,r={},n){var o,i;return gP(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:hr.fetcher)({url:(0,XA.default)((i=yield hr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:ZA.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(t)}/training-step-metrics`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield hr.Supplier.get(this._options.clientName))!=null?yield hr.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":hr.RUNTIME.type,"X-Fern-Runtime-Version":hr.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 Nx.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 vr.BadRequestError(l.error.body);case 401:throw new vr.UnauthorizedError(l.error.body);case 403:throw new vr.ForbiddenError(l.error.body);case 404:throw new vr.NotFoundError(l.error.body);case 500:throw new vr.InternalServerError(l.error.body);case 503:throw new vr.ServiceUnavailableError(l.error.body);default:throw new Fo.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new Fo.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new Fo.CohereTimeoutError;case"unknown":throw new Fo.CohereError({message:l.error.errorMessage})}})}_getAuthorizationHeader(){var t;return gP(this,void 0,void 0,function*(){let r=(t=yield hr.Supplier.get(this._options.token))!==null&&t!==void 0?t: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}`})}};Mf.Finetuning=xSe});var LZ=b(Af=>{"use strict";var Kjr=Af&&Af.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Yjr=Af&&Af.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),p4=Af&&Af.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Kjr(t,e,r);return Yjr(t,e),t},If=Af&&Af.__awaiter||function(e,t,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(e,t||[])).next())})},Zjr=Af&&Af.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Af,"__esModule",{value:!0});Af.CohereClient=void 0;var pg=p4(Rx()),et=p4($()),he=p4(rx()),ze=p4(Ax()),hg=Zjr(mP()),ir=p4(Wa()),Xjr=ySe(),Qjr=dgt(),eNr=fgt(),tNr=pgt(),rNr=ggt(),nNr=ygt(),CSe=class{constructor(t={}){this._options=t}chatStream(t,r){var n,o;return If(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,hg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:pg.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield et.Supplier.get(this._options.clientName))!=null?yield et.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":et.RUNTIME.type,"X-Fern-Runtime-Version":et.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},ze.ChatStreamRequest.jsonOrThrow(t,{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 et.Stream({stream:i.body,parse:a=>If(this,void 0,void 0,function*(){return ze.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 he.BadRequestError(i.error.body);case 401:throw new he.UnauthorizedError(i.error.body);case 403:throw new he.ForbiddenError(i.error.body);case 404:throw new he.NotFoundError(i.error.body);case 422:throw new he.UnprocessableEntityError(ze.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new he.TooManyRequestsError(ze.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new he.ClientClosedRequestError(ze.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new he.InternalServerError(i.error.body);case 501:throw new he.NotImplementedError(ze.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new he.ServiceUnavailableError(i.error.body);case 504:throw new he.GatewayTimeoutError(ze.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ir.CohereTimeoutError;case"unknown":throw new ir.CohereError({message:i.error.errorMessage})}})}chat(t,r){var n,o;return If(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,hg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:pg.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield et.Supplier.get(this._options.clientName))!=null?yield et.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":et.RUNTIME.type,"X-Fern-Runtime-Version":et.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},ze.ChatRequest.jsonOrThrow(t,{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 ze.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 he.BadRequestError(i.error.body);case 401:throw new he.UnauthorizedError(i.error.body);case 403:throw new he.ForbiddenError(i.error.body);case 404:throw new he.NotFoundError(i.error.body);case 422:throw new he.UnprocessableEntityError(ze.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new he.TooManyRequestsError(ze.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new he.ClientClosedRequestError(ze.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new he.InternalServerError(i.error.body);case 501:throw new he.NotImplementedError(ze.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new he.ServiceUnavailableError(i.error.body);case 504:throw new he.GatewayTimeoutError(ze.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ir.CohereTimeoutError;case"unknown":throw new ir.CohereError({message:i.error.errorMessage})}})}generateStream(t,r){var n,o;return If(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,hg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:pg.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield et.Supplier.get(this._options.clientName))!=null?yield et.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":et.RUNTIME.type,"X-Fern-Runtime-Version":et.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},ze.GenerateStreamRequest.jsonOrThrow(t,{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 et.Stream({stream:i.body,parse:a=>If(this,void 0,void 0,function*(){return ze.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 he.BadRequestError(i.error.body);case 401:throw new he.UnauthorizedError(i.error.body);case 403:throw new he.ForbiddenError(i.error.body);case 404:throw new he.NotFoundError(i.error.body);case 422:throw new he.UnprocessableEntityError(ze.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new he.TooManyRequestsError(ze.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new he.ClientClosedRequestError(ze.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new he.InternalServerError(i.error.body);case 501:throw new he.NotImplementedError(ze.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new he.ServiceUnavailableError(i.error.body);case 504:throw new he.GatewayTimeoutError(ze.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ir.CohereTimeoutError;case"unknown":throw new ir.CohereError({message:i.error.errorMessage})}})}generate(t,r){var n,o;return If(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,hg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:pg.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield et.Supplier.get(this._options.clientName))!=null?yield et.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":et.RUNTIME.type,"X-Fern-Runtime-Version":et.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},ze.GenerateRequest.jsonOrThrow(t,{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 ze.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 he.BadRequestError(i.error.body);case 401:throw new he.UnauthorizedError(i.error.body);case 403:throw new he.ForbiddenError(i.error.body);case 404:throw new he.NotFoundError(i.error.body);case 422:throw new he.UnprocessableEntityError(ze.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new he.TooManyRequestsError(ze.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new he.ClientClosedRequestError(ze.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new he.InternalServerError(i.error.body);case 501:throw new he.NotImplementedError(ze.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new he.ServiceUnavailableError(i.error.body);case 504:throw new he.GatewayTimeoutError(ze.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ir.CohereTimeoutError;case"unknown":throw new ir.CohereError({message:i.error.errorMessage})}})}embed(t,r){var n,o;return If(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,hg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:pg.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield et.Supplier.get(this._options.clientName))!=null?yield et.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":et.RUNTIME.type,"X-Fern-Runtime-Version":et.RUNTIME.version},contentType:"application/json",requestType:"json",body:ze.EmbedRequest.jsonOrThrow(t,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ze.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 he.BadRequestError(i.error.body);case 401:throw new he.UnauthorizedError(i.error.body);case 403:throw new he.ForbiddenError(i.error.body);case 404:throw new he.NotFoundError(i.error.body);case 422:throw new he.UnprocessableEntityError(ze.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new he.TooManyRequestsError(ze.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new he.ClientClosedRequestError(ze.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new he.InternalServerError(i.error.body);case 501:throw new he.NotImplementedError(ze.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new he.ServiceUnavailableError(i.error.body);case 504:throw new he.GatewayTimeoutError(ze.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ir.CohereTimeoutError;case"unknown":throw new ir.CohereError({message:i.error.errorMessage})}})}rerank(t,r){var n,o;return If(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,hg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:pg.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield et.Supplier.get(this._options.clientName))!=null?yield et.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":et.RUNTIME.type,"X-Fern-Runtime-Version":et.RUNTIME.version},contentType:"application/json",requestType:"json",body:ze.RerankRequest.jsonOrThrow(t,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ze.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 he.BadRequestError(i.error.body);case 401:throw new he.UnauthorizedError(i.error.body);case 403:throw new he.ForbiddenError(i.error.body);case 404:throw new he.NotFoundError(i.error.body);case 422:throw new he.UnprocessableEntityError(ze.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new he.TooManyRequestsError(ze.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new he.ClientClosedRequestError(ze.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new he.InternalServerError(i.error.body);case 501:throw new he.NotImplementedError(ze.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new he.ServiceUnavailableError(i.error.body);case 504:throw new he.GatewayTimeoutError(ze.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ir.CohereTimeoutError;case"unknown":throw new ir.CohereError({message:i.error.errorMessage})}})}classify(t,r){var n,o;return If(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,hg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:pg.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield et.Supplier.get(this._options.clientName))!=null?yield et.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":et.RUNTIME.type,"X-Fern-Runtime-Version":et.RUNTIME.version},contentType:"application/json",requestType:"json",body:ze.ClassifyRequest.jsonOrThrow(t,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ze.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 he.BadRequestError(i.error.body);case 401:throw new he.UnauthorizedError(i.error.body);case 403:throw new he.ForbiddenError(i.error.body);case 404:throw new he.NotFoundError(i.error.body);case 422:throw new he.UnprocessableEntityError(ze.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new he.TooManyRequestsError(ze.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new he.ClientClosedRequestError(ze.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new he.InternalServerError(i.error.body);case 501:throw new he.NotImplementedError(ze.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new he.ServiceUnavailableError(i.error.body);case 504:throw new he.GatewayTimeoutError(ze.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ir.CohereTimeoutError;case"unknown":throw new ir.CohereError({message:i.error.errorMessage})}})}summarize(t,r){var n,o;return If(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,hg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:pg.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield et.Supplier.get(this._options.clientName))!=null?yield et.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":et.RUNTIME.type,"X-Fern-Runtime-Version":et.RUNTIME.version},contentType:"application/json",requestType:"json",body:ze.SummarizeRequest.jsonOrThrow(t,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ze.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 he.BadRequestError(i.error.body);case 401:throw new he.UnauthorizedError(i.error.body);case 403:throw new he.ForbiddenError(i.error.body);case 404:throw new he.NotFoundError(i.error.body);case 422:throw new he.UnprocessableEntityError(ze.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new he.TooManyRequestsError(ze.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new he.ClientClosedRequestError(ze.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new he.InternalServerError(i.error.body);case 501:throw new he.NotImplementedError(ze.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new he.ServiceUnavailableError(i.error.body);case 504:throw new he.GatewayTimeoutError(ze.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ir.CohereTimeoutError;case"unknown":throw new ir.CohereError({message:i.error.errorMessage})}})}tokenize(t,r){var n,o;return If(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,hg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:pg.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield et.Supplier.get(this._options.clientName))!=null?yield et.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":et.RUNTIME.type,"X-Fern-Runtime-Version":et.RUNTIME.version},contentType:"application/json",requestType:"json",body:ze.TokenizeRequest.jsonOrThrow(t,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ze.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 he.BadRequestError(i.error.body);case 401:throw new he.UnauthorizedError(i.error.body);case 403:throw new he.ForbiddenError(i.error.body);case 404:throw new he.NotFoundError(i.error.body);case 422:throw new he.UnprocessableEntityError(ze.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new he.TooManyRequestsError(ze.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new he.ClientClosedRequestError(ze.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new he.InternalServerError(i.error.body);case 501:throw new he.NotImplementedError(ze.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new he.ServiceUnavailableError(i.error.body);case 504:throw new he.GatewayTimeoutError(ze.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ir.CohereTimeoutError;case"unknown":throw new ir.CohereError({message:i.error.errorMessage})}})}detokenize(t,r){var n,o;return If(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,hg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:pg.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield et.Supplier.get(this._options.clientName))!=null?yield et.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":et.RUNTIME.type,"X-Fern-Runtime-Version":et.RUNTIME.version},contentType:"application/json",requestType:"json",body:ze.DetokenizeRequest.jsonOrThrow(t,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ze.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 he.BadRequestError(i.error.body);case 401:throw new he.UnauthorizedError(i.error.body);case 403:throw new he.ForbiddenError(i.error.body);case 404:throw new he.NotFoundError(i.error.body);case 422:throw new he.UnprocessableEntityError(ze.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new he.TooManyRequestsError(ze.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new he.ClientClosedRequestError(ze.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new he.InternalServerError(i.error.body);case 501:throw new he.NotImplementedError(ze.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new he.ServiceUnavailableError(i.error.body);case 504:throw new he.GatewayTimeoutError(ze.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ir.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ir.CohereTimeoutError;case"unknown":throw new ir.CohereError({message:i.error.errorMessage})}})}checkApiKey(t){var r,n;return If(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:et.fetcher)({url:(0,hg.default)((n=yield et.Supplier.get(this._options.environment))!==null&&n!==void 0?n:pg.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield et.Supplier.get(this._options.clientName))!=null?yield et.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":et.RUNTIME.type,"X-Fern-Runtime-Version":et.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:3e5,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return ze.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 he.BadRequestError(o.error.body);case 401:throw new he.UnauthorizedError(o.error.body);case 403:throw new he.ForbiddenError(o.error.body);case 404:throw new he.NotFoundError(o.error.body);case 422:throw new he.UnprocessableEntityError(ze.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new he.TooManyRequestsError(ze.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new he.ClientClosedRequestError(ze.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new he.InternalServerError(o.error.body);case 501:throw new he.NotImplementedError(ze.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new he.ServiceUnavailableError(o.error.body);case 504:throw new he.GatewayTimeoutError(ze.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ir.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new ir.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new ir.CohereTimeoutError;case"unknown":throw new ir.CohereError({message:o.error.errorMessage})}})}get v2(){var t;return(t=this._v2)!==null&&t!==void 0?t:this._v2=new Xjr.V2(this._options)}get embedJobs(){var t;return(t=this._embedJobs)!==null&&t!==void 0?t:this._embedJobs=new Qjr.EmbedJobs(this._options)}get datasets(){var t;return(t=this._datasets)!==null&&t!==void 0?t:this._datasets=new eNr.Datasets(this._options)}get connectors(){var t;return(t=this._connectors)!==null&&t!==void 0?t:this._connectors=new tNr.Connectors(this._options)}get models(){var t;return(t=this._models)!==null&&t!==void 0?t:this._models=new rNr.Models(this._options)}get finetuning(){var t;return(t=this._finetuning)!==null&&t!==void 0?t:this._finetuning=new nNr.Finetuning(this._options)}_getAuthorizationHeader(){var t;return If(this,void 0,void 0,function*(){let r=(t=yield et.Supplier.get(this._options.token))!==null&&t!==void 0?t:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new ir.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Af.CohereClient=CSe});var ESe=b(FZ=>{"use strict";Object.defineProperty(FZ,"__esModule",{value:!0});FZ.AwsClient=void 0;var oNr=LZ(),OSe=class extends oNr.CohereClient{constructor(t){t.token="n/a",super(t)}};FZ.AwsClient=OSe});var bgt=b(kZ=>{"use strict";Object.defineProperty(kZ,"__esModule",{value:!0});kZ.BedrockClient=void 0;var iNr=mSe(),aNr=ESe(),PSe=class extends aNr.AwsClient{constructor(t){super(Object.assign(Object.assign({},t),{fetcher:(0,iNr.fetchOverride)("bedrock",t)}))}};kZ.BedrockClient=PSe});var _gt=b(BZ=>{"use strict";Object.defineProperty(BZ,"__esModule",{value:!0});BZ.CohereClientV2=void 0;var sNr=ySe(),uNr=LZ(),TSe=class{constructor(t){this._options=t,this.client=new uNr.CohereClient(this._options),this.clientV2=new sNr.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}};BZ.CohereClientV2=TSe});var vgt=b($Z=>{"use strict";Object.defineProperty($Z,"__esModule",{value:!0});$Z.CustomClient=void 0;var lNr=LZ(),MSe=class extends lNr.CohereClient{constructor(t={}){var r,n;try{let o=/\/v1\/?$/,i=(r=t.environment)===null||r===void 0?void 0:r.toString().replace(o,"");i!==((n=t.environment)===null||n===void 0?void 0:n.toString())&&(t.environment=i)}catch{}super(t),this._options=t}};$Z.CustomClient=MSe});var wgt=b(qZ=>{"use strict";Object.defineProperty(qZ,"__esModule",{value:!0});qZ.SagemakerClient=void 0;var cNr=ESe(),dNr=mSe(),ISe=class extends cNr.AwsClient{constructor(t){super(Object.assign(Object.assign({},t),{fetcher:(0,dNr.fetchOverride)("sagemaker",t)}))}};qZ.SagemakerClient=ISe});var h4=b(Vi=>{"use strict";var fNr=Vi&&Vi.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),pNr=Vi&&Vi.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),hNr=Vi&&Vi.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&fNr(t,e,r);return pNr(t,e),t};Object.defineProperty(Vi,"__esModule",{value:!0});Vi.SagemakerClient=Vi.CohereTimeoutError=Vi.CohereError=Vi.CohereEnvironment=Vi.CohereClient=Vi.CohereClientV2=Vi.BedrockClient=Vi.Cohere=void 0;Vi.Cohere=hNr(rx());var mNr=bgt();Object.defineProperty(Vi,"BedrockClient",{enumerable:!0,get:function(){return mNr.BedrockClient}});var gNr=_gt();Object.defineProperty(Vi,"CohereClientV2",{enumerable:!0,get:function(){return gNr.CohereClientV2}});var yNr=vgt();Object.defineProperty(Vi,"CohereClient",{enumerable:!0,get:function(){return yNr.CustomClient}});var bNr=Rx();Object.defineProperty(Vi,"CohereEnvironment",{enumerable:!0,get:function(){return bNr.CohereEnvironment}});var Sgt=Wa();Object.defineProperty(Vi,"CohereError",{enumerable:!0,get:function(){return Sgt.CohereError}});Object.defineProperty(Vi,"CohereTimeoutError",{enumerable:!0,get:function(){return Sgt.CohereTimeoutError}});var _Nr=wgt();Object.defineProperty(Vi,"SagemakerClient",{enumerable:!0,get:function(){return _Nr.SagemakerClient}})});function gg(e){e?(_l[0]=_l[16]=_l[1]=_l[2]=_l[3]=_l[4]=_l[5]=_l[6]=_l[7]=_l[8]=_l[9]=_l[10]=_l[11]=_l[12]=_l[13]=_l[14]=_l[15]=0,this.blocks=_l):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 vNr,$r,wNr,mg,_l,ASe,xgt=C(()=>{"use strict";vNr=typeof window=="object"?window:{},$r="0123456789abcdef".split(""),wNr=[-2147483648,8388608,32768,128],mg=[24,16,8,0],_l=[];gg.prototype.update=function(e){if(!this.finalized){var t=typeof e!="string";t&&e.constructor===vNr.ArrayBuffer&&(e=new Uint8Array(e));for(var r,n=0,o,i=e.length||0,a=this.blocks;n<i;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),t)for(o=this.start;n<i&&o<64;++n)a[o>>2]|=e[n]<<mg[o++&3];else for(o=this.start;n<i&&o<64;++n)r=e.charCodeAt(n),r<128?a[o>>2]|=r<<mg[o++&3]:r<2048?(a[o>>2]|=(192|r>>6)<<mg[o++&3],a[o>>2]|=(128|r&63)<<mg[o++&3]):r<55296||r>=57344?(a[o>>2]|=(224|r>>12)<<mg[o++&3],a[o>>2]|=(128|r>>6&63)<<mg[o++&3],a[o>>2]|=(128|r&63)<<mg[o++&3]):(r=65536+((r&1023)<<10|e.charCodeAt(++n)&1023),a[o>>2]|=(240|r>>18)<<mg[o++&3],a[o>>2]|=(128|r>>12&63)<<mg[o++&3],a[o>>2]|=(128|r>>6&63)<<mg[o++&3],a[o>>2]|=(128|r&63)<<mg[o++&3]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=a[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};gg.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=wNr[t&3],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}};gg.prototype.hash=function(){var e=this.h0,t=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=t&r|~t&n,s=e<<5|e>>>27,o=s+i+o+1518500249+u[a]<<0,t=t<<30|t>>>2,i=e&t|~e&r,s=o<<5|o>>>27,n=s+i+n+1518500249+u[a+1]<<0,e=e<<30|e>>>2,i=o&e|~o&t,s=n<<5|n>>>27,r=s+i+r+1518500249+u[a+2]<<0,o=o<<30|o>>>2,i=n&o|~n&e,s=r<<5|r>>>27,t=s+i+t+1518500249+u[a+3]<<0,n=n<<30|n>>>2,i=r&n|~r&o,s=t<<5|t>>>27,e=s+i+e+1518500249+u[a+4]<<0,r=r<<30|r>>>2;for(;a<40;a+=5)i=t^r^n,s=e<<5|e>>>27,o=s+i+o+1859775393+u[a]<<0,t=t<<30|t>>>2,i=e^t^r,s=o<<5|o>>>27,n=s+i+n+1859775393+u[a+1]<<0,e=e<<30|e>>>2,i=o^e^t,s=n<<5|n>>>27,r=s+i+r+1859775393+u[a+2]<<0,o=o<<30|o>>>2,i=n^o^e,s=r<<5|r>>>27,t=s+i+t+1859775393+u[a+3]<<0,n=n<<30|n>>>2,i=r^n^o,s=t<<5|t>>>27,e=s+i+e+1859775393+u[a+4]<<0,r=r<<30|r>>>2;for(;a<60;a+=5)i=t&r|t&n|r&n,s=e<<5|e>>>27,o=s+i+o-1894007588+u[a]<<0,t=t<<30|t>>>2,i=e&t|e&r|t&r,s=o<<5|o>>>27,n=s+i+n-1894007588+u[a+1]<<0,e=e<<30|e>>>2,i=o&e|o&t|e&t,s=n<<5|n>>>27,r=s+i+r-1894007588+u[a+2]<<0,o=o<<30|o>>>2,i=n&o|n&e|o&e,s=r<<5|r>>>27,t=s+i+t-1894007588+u[a+3]<<0,n=n<<30|n>>>2,i=r&n|r&o|n&o,s=t<<5|t>>>27,e=s+i+e-1894007588+u[a+4]<<0,r=r<<30|r>>>2;for(;a<80;a+=5)i=t^r^n,s=e<<5|e>>>27,o=s+i+o-899497514+u[a]<<0,t=t<<30|t>>>2,i=e^t^r,s=o<<5|o>>>27,n=s+i+n-899497514+u[a+1]<<0,e=e<<30|e>>>2,i=o^e^t,s=n<<5|n>>>27,r=s+i+r-899497514+u[a+2]<<0,o=o<<30|o>>>2,i=n^o^e,s=r<<5|r>>>27,t=s+i+t-899497514+u[a+3]<<0,n=n<<30|n>>>2,i=r^n^o,s=t<<5|t>>>27,e=s+i+e-899497514+u[a+4]<<0,r=r<<30|r>>>2;this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0};gg.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,n=this.h3,o=this.h4;return $r[e>>28&15]+$r[e>>24&15]+$r[e>>20&15]+$r[e>>16&15]+$r[e>>12&15]+$r[e>>8&15]+$r[e>>4&15]+$r[e&15]+$r[t>>28&15]+$r[t>>24&15]+$r[t>>20&15]+$r[t>>16&15]+$r[t>>12&15]+$r[t>>8&15]+$r[t>>4&15]+$r[t&15]+$r[r>>28&15]+$r[r>>24&15]+$r[r>>20&15]+$r[r>>16&15]+$r[r>>12&15]+$r[r>>8&15]+$r[r>>4&15]+$r[r&15]+$r[n>>28&15]+$r[n>>24&15]+$r[n>>20&15]+$r[n>>16&15]+$r[n>>12&15]+$r[n>>8&15]+$r[n>>4&15]+$r[n&15]+$r[o>>28&15]+$r[o>>24&15]+$r[o>>20&15]+$r[o>>16&15]+$r[o>>12&15]+$r[o>>8&15]+$r[o>>4&15]+$r[o&15]};gg.prototype.toString=gg.prototype.hex;gg.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,n=this.h3,o=this.h4;return[e>>24&255,e>>16&255,e>>8&255,e&255,t>>24&255,t>>16&255,t>>8&255,t&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]};gg.prototype.array=gg.prototype.digest;gg.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(20),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),e};ASe=e=>new gg(!0).update(e).hex()});var Cgt=C(()=>{xgt()});var Ogt,RSe,SNr,UZ,Egt=C(()=>{Cgt();_O();Ogt=(...e)=>ASe(e.join("_")),RSe=class{},SNr=new Map,UZ=class e extends RSe{constructor(t){super(),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cache=t??new Map}lookup(t,r){return Promise.resolve(this.cache.get(Ogt(t,r))??null)}async update(t,r,n){this.cache.set(Ogt(t,r),n)}static global(){return new e(SNr)}}});function ENr(e,t){let r=Array.from({length:e.length},(n,o)=>({start:o,end:o+1}));for(;r.length>1;){let n=null;for(let o=0;o<r.length-1;o++){let i=e.slice(r[o].start,r[o+1].end),a=t.get(i.join(","));a!=null&&(n==null||a<n[0])&&(n=[a,o])}if(n!=null){let o=n[1];r[o]={start:r[o].start,end:r[o+1].end},r.splice(o+1,1)}else break}return r}function PNr(e,t){return e.length===1?[t.get(e.join(","))]:ENr(e,t).map(r=>t.get(e.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function TNr(e){return e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function jSe(e){switch(e){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 Pgt,xNr,CNr,ONr,DSe,zZ,Tgt=C(()=>{Pgt=B(Ole(),1),xNr=Object.defineProperty,CNr=(e,t,r)=>t in e?xNr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ONr=(e,t,r)=>(CNr(e,typeof t!="symbol"?t+"":t,r),r);DSe=class{constructor(e,t){Ll(this,"specialTokens");Ll(this,"inverseSpecialTokens");Ll(this,"patStr");Ll(this,"textEncoder",new TextEncoder);Ll(this,"textDecoder",new TextDecoder("utf-8"));Ll(this,"rankMap",new Map);Ll(this,"textMap",new Map);this.patStr=e.pat_str;let r=e.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=Pgt.default.toByteArray(n);this.rankMap.set(i.join(","),o),this.textMap.set(o,i)}this.specialTokens={...e.special_tokens,...t},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[o,i])=>(n[i]=this.textEncoder.encode(o),n),{})}encode(e,t=[],r="all"){let n=new RegExp(this.patStr,"ug"),o=DSe.specialTokenRegex(Object.keys(this.specialTokens)),i=[],a=new Set(t==="all"?Object.keys(this.specialTokens):t),s=new Set(r==="all"?Object.keys(this.specialTokens).filter(l=>!a.has(l)):r);if(s.size>0){let l=DSe.specialTokenRegex([...s]),c=e.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(e),!(l==null||a.has(l[0]));)c=l.index+1;let d=l?.index??e.length;for(let p of e.substring(u,d).matchAll(n)){let h=this.textEncoder.encode(p[0]),m=this.rankMap.get(h.join(","));if(m!=null){i.push(m);continue}i.push(...PNr(h,this.rankMap))}if(l==null)break;let f=this.specialTokens[l[0]];i.push(f),u=l.index+l[0].length}return i}decode(e){let t=[],r=0;for(let i=0;i<e.length;++i){let a=e[i],s=this.textMap.get(a)??this.inverseSpecialTokens[a];s!=null&&(t.push(s),r+=s.length)}let n=new Uint8Array(r),o=0;for(let i of t)n.set(i,o),o+=i.length;return this.textDecoder.decode(n)}},zZ=DSe;ONr(zZ,"specialTokenRegex",e=>new RegExp(e.map(t=>TNr(t)).join("|"),"g"))});var Mgt=C(()=>{Tgt()});async function Igt(e){return e in HZ||(HZ[e]=MNr.fetch(`https://tiktoken.pages.dev/js/${e}.json`).then(t=>t.json()).then(t=>new zZ(t)).catch(t=>{throw delete HZ[e],t})),await HZ[e]}async function Agt(e){return Igt(jSe(e))}var HZ,MNr,NSe=C(()=>{Mgt();HD();HZ={},MNr=new rp({})});function vw(e){return typeof e!="object"||!e?!1:!!("type"in e&&e.type==="function"&&"function"in e&&typeof e.function=="object"&&e.function&&"name"in e.function&&"parameters"in e.function)}var INr,ANr,iF,aF,m4=C(()=>{Egt();fq();_O();HD();NSe();lf();INr=e=>e.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":e.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":e.startsWith("gpt-4-32k")?"gpt-4-32k":e.startsWith("gpt-4-")?"gpt-4":e.startsWith("gpt-4o")?"gpt-4o":e;ANr=()=>!1,iF=class extends on{get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(t){super(t),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=t.verbose??ANr(),this.callbacks=t.callbacks,this.tags=t.tags??[],this.metadata=t.metadata??{}}},aF=class extends iF{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}constructor({callbacks:t,callbackManager:r,...n}){let{cache:o,...i}=n;super({callbacks:t??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=UZ.global():this.cache=void 0,this.caller=new rp(n??{})}async getNumTokens(t){if(typeof t!="string")return 0;let r=Math.ceil(t.length/4);if(!this._encoding)try{this._encoding=await Agt("modelName"in this?INr(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(t).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(t){return typeof t=="string"?new JD(t):Array.isArray(t)?new GD(t.map(Lm)):t}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:t,...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(t){throw new Error("Use .toJSON() instead")}}});var Lx=C(()=>{m4()});var kh=C(()=>{zD()});var tvt=b(()=>{});var ln=b((QX,rvt)=>{(function(e,t){typeof QX=="object"?rvt.exports=QX=t():typeof define=="function"&&define.amd?define([],t):e.CryptoJS=t()})(QX,function(){var e=e||function(t,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=tvt()}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(v){var S;return g.prototype=v,S=new g,g.prototype=null,S}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(g){var v=i(this);return g&&v.mixIn(g),(!v.hasOwnProperty("init")||this.init===v.init)&&(v.init=function(){v.$super.init.apply(this,arguments)}),v.init.prototype=v,v.$super=this,v},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var v in g)g.hasOwnProperty(v)&&(this[v]=g[v]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(g,v){g=this.words=g||[],v!=r?this.sigBytes=v:this.sigBytes=g.length*4},toString:function(g){return(g||d).stringify(this)},concat:function(g){var v=this.words,S=g.words,x=this.sigBytes,O=g.sigBytes;if(this.clamp(),x%4)for(var T=0;T<O;T++){var E=S[T>>>2]>>>24-T%4*8&255;v[x+T>>>2]|=E<<24-(x+T)%4*8}else for(var M=0;M<O;M+=4)v[x+M>>>2]=S[M>>>2];return this.sigBytes+=O,this},clamp:function(){var g=this.words,v=this.sigBytes;g[v>>>2]&=4294967295<<32-v%4*8,g.length=t.ceil(v/4)},clone:function(){var g=u.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var v=[],S=0;S<g;S+=4)v.push(o());return new l.init(v,g)}}),c=a.enc={},d=c.Hex={stringify:function(g){for(var v=g.words,S=g.sigBytes,x=[],O=0;O<S;O++){var T=v[O>>>2]>>>24-O%4*8&255;x.push((T>>>4).toString(16)),x.push((T&15).toString(16))}return x.join("")},parse:function(g){for(var v=g.length,S=[],x=0;x<v;x+=2)S[x>>>3]|=parseInt(g.substr(x,2),16)<<24-x%8*4;return new l.init(S,v/2)}},f=c.Latin1={stringify:function(g){for(var v=g.words,S=g.sigBytes,x=[],O=0;O<S;O++){var T=v[O>>>2]>>>24-O%4*8&255;x.push(String.fromCharCode(T))}return x.join("")},parse:function(g){for(var v=g.length,S=[],x=0;x<v;x++)S[x>>>2]|=(g.charCodeAt(x)&255)<<24-x%4*8;return new l.init(S,v)}},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)))}},h=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 v,S=this._data,x=S.words,O=S.sigBytes,T=this.blockSize,E=T*4,M=O/E;g?M=t.ceil(M):M=t.max((M|0)-this._minBufferSize,0);var A=M*T,j=t.min(A*4,O);if(A){for(var N=0;N<A;N+=T)this._doProcessBlock(x,N);v=x.splice(0,A),S.sigBytes-=j}return new l.init(v,j)},clone:function(){var g=u.clone.call(this);return g._data=this._data.clone(),g},_minBufferSize:0}),m=s.Hasher=h.extend({cfg:u.extend(),init:function(g){this.cfg=this.cfg.extend(g),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(g){return this._append(g),this._process(),this},finalize:function(g){g&&this._append(g);var v=this._doFinalize();return v},blockSize:512/32,_createHelper:function(g){return function(v,S){return new g.init(S).finalize(v)}},_createHmacHelper:function(g){return function(v,S){return new _.HMAC.init(g,S).finalize(v)}}}),_=a.algo={};return a}(Math);return e})});var H4=b((eQ,nvt)=>{(function(e,t){typeof eQ=="object"?nvt.exports=eQ=t(ln()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(eQ,function(e){return function(t){var r=e,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!=t?this.sigBytes=c:this.sigBytes=l.length*8},toX32:function(){for(var l=this.words,c=l.length,d=[],f=0;f<c;f++){var p=l[f];d.push(p.high),d.push(p.low)}return i.create(d,this.sigBytes)},clone:function(){for(var l=o.clone.call(this),c=l.words=this.words.slice(0),d=c.length,f=0;f<d;f++)c[f]=c[f].clone();return l}})}(),e})});var ivt=b((tQ,ovt)=>{(function(e,t){typeof tQ=="object"?ovt.exports=tQ=t(ln()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(tQ,function(e){return function(){if(typeof ArrayBuffer=="function"){var t=e,r=t.lib,n=r.WordArray,o=n.init,i=n.init=function(a){if(a instanceof ArrayBuffer&&(a=new Uint8Array(a)),(a instanceof Int8Array||typeof Uint8ClampedArray<"u"&&a instanceof Uint8ClampedArray||a instanceof Int16Array||a instanceof Uint16Array||a instanceof Int32Array||a instanceof Uint32Array||a instanceof Float32Array||a instanceof Float64Array)&&(a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength)),a instanceof Uint8Array){for(var s=a.byteLength,u=[],l=0;l<s;l++)u[l>>>2]|=a[l]<<24-l%4*8;o.call(this,u,s)}else o.apply(this,arguments)};i.prototype=n}}(),e.lib.WordArray})});var svt=b((rQ,avt)=>{(function(e,t){typeof rQ=="object"?avt.exports=rQ=t(ln()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(rQ,function(e){return function(){var t=e,r=t.lib,n=r.WordArray,o=t.enc,i=o.Utf16=o.Utf16BE={stringify:function(s){for(var u=s.words,l=s.sigBytes,c=[],d=0;d<l;d+=2){var f=u[d>>>2]>>>16-d%4*8&65535;c.push(String.fromCharCode(f))}return c.join("")},parse:function(s){for(var u=s.length,l=[],c=0;c<u;c++)l[c>>>1]|=s.charCodeAt(c)<<16-c%2*16;return n.create(l,u*2)}};o.Utf16LE={stringify:function(s){for(var u=s.words,l=s.sigBytes,c=[],d=0;d<l;d+=2){var f=a(u[d>>>2]>>>16-d%4*8&65535);c.push(String.fromCharCode(f))}return c.join("")},parse:function(s){for(var u=s.length,l=[],c=0;c<u;c++)l[c>>>1]|=a(s.charCodeAt(c)<<16-c%2*16);return n.create(l,u*2)}};function a(s){return s<<8&4278255360|s>>>8&16711935}}(),e.enc.Utf16})});var AP=b((nQ,uvt)=>{(function(e,t){typeof nQ=="object"?uvt.exports=nQ=t(ln()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(nQ,function(e){return function(){var t=e,r=t.lib,n=r.WordArray,o=t.enc,i=o.Base64={stringify:function(s){var u=s.words,l=s.sigBytes,c=this._map;s.clamp();for(var d=[],f=0;f<l;f+=3)for(var p=u[f>>>2]>>>24-f%4*8&255,h=u[f+1>>>2]>>>24-(f+1)%4*8&255,m=u[f+2>>>2]>>>24-(f+2)%4*8&255,_=p<<16|h<<8|m,g=0;g<4&&f+g*.75<l;g++)d.push(c.charAt(_>>>6*(3-g)&63));var v=c.charAt(64);if(v)for(;d.length%4;)d.push(v);return d.join("")},parse:function(s){var u=s.length,l=this._map,c=this._reverseMap;if(!c){c=this._reverseMap=[];for(var d=0;d<l.length;d++)c[l.charCodeAt(d)]=d}var f=l.charAt(64);if(f){var p=s.indexOf(f);p!==-1&&(u=p)}return a(s,u,c)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(s,u,l){for(var c=[],d=0,f=0;f<u;f++)if(f%4){var p=l[s.charCodeAt(f-1)]<<f%4*2,h=l[s.charCodeAt(f)]>>>6-f%4*2,m=p|h;c[d>>>2]|=m<<24-d%4*8,d++}return n.create(c,d)}}(),e.enc.Base64})});var cvt=b((oQ,lvt)=>{(function(e,t){typeof oQ=="object"?lvt.exports=oQ=t(ln()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(oQ,function(e){return function(){var t=e,r=t.lib,n=r.WordArray,o=t.enc,i=o.Base64url={stringify:function(s,u){u===void 0&&(u=!0);var l=s.words,c=s.sigBytes,d=u?this._safe_map:this._map;s.clamp();for(var f=[],p=0;p<c;p+=3)for(var h=l[p>>>2]>>>24-p%4*8&255,m=l[p+1>>>2]>>>24-(p+1)%4*8&255,_=l[p+2>>>2]>>>24-(p+2)%4*8&255,g=h<<16|m<<8|_,v=0;v<4&&p+v*.75<c;v++)f.push(d.charAt(g>>>6*(3-v)&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<c.length;f++)d[c.charCodeAt(f)]=f}var p=c.charAt(64);if(p){var h=s.indexOf(p);h!==-1&&(l=h)}return a(s,l,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function a(s,u,l){for(var c=[],d=0,f=0;f<u;f++)if(f%4){var p=l[s.charCodeAt(f-1)]<<f%4*2,h=l[s.charCodeAt(f)]>>>6-f%4*2,m=p|h;c[d>>>2]|=m<<24-d%4*8,d++}return n.create(c,d)}}(),e.enc.Base64url})});var RP=b((iQ,dvt)=>{(function(e,t){typeof iQ=="object"?dvt.exports=iQ=t(ln()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(iQ,function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[];(function(){for(var p=0;p<64;p++)s[p]=t.abs(t.sin(p+1))*4294967296|0})();var u=a.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,h){for(var m=0;m<16;m++){var _=h+m,g=p[_];p[_]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var v=this._hash.words,S=p[h+0],x=p[h+1],O=p[h+2],T=p[h+3],E=p[h+4],M=p[h+5],A=p[h+6],j=p[h+7],N=p[h+8],F=p[h+9],k=p[h+10],L=p[h+11],q=p[h+12],U=p[h+13],G=p[h+14],V=p[h+15],D=v[0],z=v[1],W=v[2],J=v[3];D=l(D,z,W,J,S,7,s[0]),J=l(J,D,z,W,x,12,s[1]),W=l(W,J,D,z,O,17,s[2]),z=l(z,W,J,D,T,22,s[3]),D=l(D,z,W,J,E,7,s[4]),J=l(J,D,z,W,M,12,s[5]),W=l(W,J,D,z,A,17,s[6]),z=l(z,W,J,D,j,22,s[7]),D=l(D,z,W,J,N,7,s[8]),J=l(J,D,z,W,F,12,s[9]),W=l(W,J,D,z,k,17,s[10]),z=l(z,W,J,D,L,22,s[11]),D=l(D,z,W,J,q,7,s[12]),J=l(J,D,z,W,U,12,s[13]),W=l(W,J,D,z,G,17,s[14]),z=l(z,W,J,D,V,22,s[15]),D=c(D,z,W,J,x,5,s[16]),J=c(J,D,z,W,A,9,s[17]),W=c(W,J,D,z,L,14,s[18]),z=c(z,W,J,D,S,20,s[19]),D=c(D,z,W,J,M,5,s[20]),J=c(J,D,z,W,k,9,s[21]),W=c(W,J,D,z,V,14,s[22]),z=c(z,W,J,D,E,20,s[23]),D=c(D,z,W,J,F,5,s[24]),J=c(J,D,z,W,G,9,s[25]),W=c(W,J,D,z,T,14,s[26]),z=c(z,W,J,D,N,20,s[27]),D=c(D,z,W,J,U,5,s[28]),J=c(J,D,z,W,O,9,s[29]),W=c(W,J,D,z,j,14,s[30]),z=c(z,W,J,D,q,20,s[31]),D=d(D,z,W,J,M,4,s[32]),J=d(J,D,z,W,N,11,s[33]),W=d(W,J,D,z,L,16,s[34]),z=d(z,W,J,D,G,23,s[35]),D=d(D,z,W,J,x,4,s[36]),J=d(J,D,z,W,E,11,s[37]),W=d(W,J,D,z,j,16,s[38]),z=d(z,W,J,D,k,23,s[39]),D=d(D,z,W,J,U,4,s[40]),J=d(J,D,z,W,S,11,s[41]),W=d(W,J,D,z,T,16,s[42]),z=d(z,W,J,D,A,23,s[43]),D=d(D,z,W,J,F,4,s[44]),J=d(J,D,z,W,q,11,s[45]),W=d(W,J,D,z,V,16,s[46]),z=d(z,W,J,D,O,23,s[47]),D=f(D,z,W,J,S,6,s[48]),J=f(J,D,z,W,j,10,s[49]),W=f(W,J,D,z,G,15,s[50]),z=f(z,W,J,D,M,21,s[51]),D=f(D,z,W,J,q,6,s[52]),J=f(J,D,z,W,T,10,s[53]),W=f(W,J,D,z,k,15,s[54]),z=f(z,W,J,D,x,21,s[55]),D=f(D,z,W,J,N,6,s[56]),J=f(J,D,z,W,V,10,s[57]),W=f(W,J,D,z,A,15,s[58]),z=f(z,W,J,D,U,21,s[59]),D=f(D,z,W,J,E,6,s[60]),J=f(J,D,z,W,L,10,s[61]),W=f(W,J,D,z,O,15,s[62]),z=f(z,W,J,D,F,21,s[63]),v[0]=v[0]+D|0,v[1]=v[1]+z|0,v[2]=v[2]+W|0,v[3]=v[3]+J|0},_doFinalize:function(){var p=this._data,h=p.words,m=this._nDataBytes*8,_=p.sigBytes*8;h[_>>>5]|=128<<24-_%32;var g=t.floor(m/4294967296),v=m;h[(_+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,h[(_+64>>>9<<4)+14]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,p.sigBytes=(h.length+1)*4,this._process();for(var S=this._hash,x=S.words,O=0;O<4;O++){var T=x[O];x[O]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}return S},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,h,m,_,g,v,S){var x=p+(h&m|~h&_)+g+S;return(x<<v|x>>>32-v)+h}function c(p,h,m,_,g,v,S){var x=p+(h&_|m&~_)+g+S;return(x<<v|x>>>32-v)+h}function d(p,h,m,_,g,v,S){var x=p+(h^m^_)+g+S;return(x<<v|x>>>32-v)+h}function f(p,h,m,_,g,v,S){var x=p+(m^(h|~_))+g+S;return(x<<v|x>>>32-v)+h}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),e.MD5})});var xCe=b((aQ,fvt)=>{(function(e,t){typeof aQ=="object"?fvt.exports=aQ=t(ln()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(aQ,function(e){return function(){var t=e,r=t.lib,n=r.WordArray,o=r.Hasher,i=t.algo,a=[],s=i.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,l){for(var c=this._hash.words,d=c[0],f=c[1],p=c[2],h=c[3],m=c[4],_=0;_<80;_++){if(_<16)a[_]=u[l+_]|0;else{var g=a[_-3]^a[_-8]^a[_-14]^a[_-16];a[_]=g<<1|g>>>31}var v=(d<<5|d>>>27)+m+a[_];_<20?v+=(f&p|~f&h)+1518500249:_<40?v+=(f^p^h)+1859775393:_<60?v+=(f&p|f&h|p&h)-1894007588:v+=(f^p^h)-899497514,m=h,h=p,p=f<<30|f>>>2,f=d,d=v}c[0]=c[0]+d|0,c[1]=c[1]+f|0,c[2]=c[2]+p|0,c[3]=c[3]+h|0,c[4]=c[4]+m|0},_doFinalize:function(){var u=this._data,l=u.words,c=this._nDataBytes*8,d=u.sigBytes*8;return l[d>>>5]|=128<<24-d%32,l[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),l[(d+64>>>9<<4)+15]=c,u.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var u=o.clone.call(this);return u._hash=this._hash.clone(),u}});t.SHA1=o._createHelper(s),t.HmacSHA1=o._createHmacHelper(s)}(),e.SHA1})});var uQ=b((sQ,pvt)=>{(function(e,t){typeof sQ=="object"?pvt.exports=sQ=t(ln()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(sQ,function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[],u=[];(function(){function d(m){for(var _=t.sqrt(m),g=2;g<=_;g++)if(!(m%g))return!1;return!0}function f(m){return(m-(m|0))*4294967296|0}for(var p=2,h=0;h<64;)d(p)&&(h<8&&(s[h]=f(t.pow(p,1/2))),u[h]=f(t.pow(p,1/3)),h++),p++})();var l=[],c=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(d,f){for(var p=this._hash.words,h=p[0],m=p[1],_=p[2],g=p[3],v=p[4],S=p[5],x=p[6],O=p[7],T=0;T<64;T++){if(T<16)l[T]=d[f+T]|0;else{var E=l[T-15],M=(E<<25|E>>>7)^(E<<14|E>>>18)^E>>>3,A=l[T-2],j=(A<<15|A>>>17)^(A<<13|A>>>19)^A>>>10;l[T]=M+l[T-7]+j+l[T-16]}var N=v&S^~v&x,F=h&m^h&_^m&_,k=(h<<30|h>>>2)^(h<<19|h>>>13)^(h<<10|h>>>22),L=(v<<26|v>>>6)^(v<<21|v>>>11)^(v<<7|v>>>25),q=O+L+N+u[T]+l[T],U=k+F;O=x,x=S,S=v,v=g+q|0,g=_,_=m,m=h,h=q+U|0}p[0]=p[0]+h|0,p[1]=p[1]+m|0,p[2]=p[2]+_|0,p[3]=p[3]+g|0,p[4]=p[4]+v|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,h=d.sigBytes*8;return f[h>>>5]|=128<<24-h%32,f[(h+64>>>9<<4)+14]=t.floor(p/4294967296),f[(h+64>>>9<<4)+15]=p,d.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var d=i.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA256=i._createHelper(c),r.HmacSHA256=i._createHmacHelper(c)}(Math),e.SHA256})});var mvt=b((lQ,hvt)=>{(function(e,t,r){typeof lQ=="object"?hvt.exports=lQ=t(ln(),uQ()):typeof define=="function"&&define.amd?define(["./core","./sha256"],t):t(e.CryptoJS)})(lQ,function(e){return function(){var t=e,r=t.lib,n=r.WordArray,o=t.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}});t.SHA224=i._createHelper(a),t.HmacSHA224=i._createHmacHelper(a)}(),e.SHA224})});var CCe=b((cQ,gvt)=>{(function(e,t,r){typeof cQ=="object"?gvt.exports=cQ=t(ln(),H4()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],t):t(e.CryptoJS)})(cQ,function(e){return function(){var t=e,r=t.lib,n=r.Hasher,o=t.x64,i=o.Word,a=o.WordArray,s=t.algo;function u(){return i.create.apply(i,arguments)}var l=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],c=[];(function(){for(var f=0;f<80;f++)c[f]=u()})();var d=s.SHA512=n.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(f,p){for(var h=this._hash.words,m=h[0],_=h[1],g=h[2],v=h[3],S=h[4],x=h[5],O=h[6],T=h[7],E=m.high,M=m.low,A=_.high,j=_.low,N=g.high,F=g.low,k=v.high,L=v.low,q=S.high,U=S.low,G=x.high,V=x.low,D=O.high,z=O.low,W=T.high,J=T.low,te=E,Ie=M,Z=A,X=j,ne=N,Pe=F,ht=k,we=L,ae=q,ee=U,ge=G,Ue=V,ct=D,Je=z,cr=W,Qr=J,dr=0;dr<80;dr++){var Ut,$o,Xi=c[dr];if(dr<16)$o=Xi.high=f[p+dr*2]|0,Ut=Xi.low=f[p+dr*2+1]|0;else{var No=c[dr-15],Ae=No.high,Ze=No.low,fr=(Ae>>>1|Ze<<31)^(Ae>>>8|Ze<<24)^Ae>>>7,Xe=(Ze>>>1|Ae<<31)^(Ze>>>8|Ae<<24)^(Ze>>>7|Ae<<25),Bn=c[dr-2],Qi=Bn.high,al=Bn.low,Pc=(Qi>>>19|al<<13)^(Qi<<3|al>>>29)^Qi>>>6,Tm=(al>>>19|Qi<<13)^(al<<3|Qi>>>29)^(al>>>6|Qi<<26),Mm=c[dr-7],Oa=Mm.high,Wp=Mm.low,Zf=c[dr-16],Jp=Zf.high,mn=Zf.low;Ut=Xe+Wp,$o=fr+Oa+(Ut>>>0<Xe>>>0?1:0),Ut=Ut+Tm,$o=$o+Pc+(Ut>>>0<Tm>>>0?1:0),Ut=Ut+mn,$o=$o+Jp+(Ut>>>0<mn>>>0?1:0),Xi.high=$o,Xi.low=Ut}var aO=ae&ge^~ae&ct,yM=ee&Ue^~ee&Je,sO=te&Z^te&ne^Z&ne,Ea=Ie&X^Ie&Pe^X&Pe,ns=(te>>>28|Ie<<4)^(te<<30|Ie>>>2)^(te<<25|Ie>>>7),ea=(Ie>>>28|te<<4)^(Ie<<30|te>>>2)^(Ie<<25|te>>>7),pd=(ae>>>14|ee<<18)^(ae>>>18|ee<<14)^(ae<<23|ee>>>9),Tc=(ee>>>14|ae<<18)^(ee>>>18|ae<<14)^(ee<<23|ae>>>9),Ba=l[dr],Kd=Ba.high,hd=Ba.low,nn=Qr+Tc,je=cr+pd+(nn>>>0<Qr>>>0?1:0),nn=nn+yM,je=je+aO+(nn>>>0<yM>>>0?1:0),nn=nn+hd,je=je+Kd+(nn>>>0<hd>>>0?1:0),nn=nn+Ut,je=je+$o+(nn>>>0<Ut>>>0?1:0),md=ea+Ea,Xf=ns+sO+(md>>>0<ea>>>0?1:0);cr=ct,Qr=Je,ct=ge,Je=Ue,ge=ae,Ue=ee,ee=we+nn|0,ae=ht+je+(ee>>>0<we>>>0?1:0)|0,ht=ne,we=Pe,ne=Z,Pe=X,Z=te,X=Ie,Ie=nn+md|0,te=je+Xf+(Ie>>>0<nn>>>0?1:0)|0}M=m.low=M+Ie,m.high=E+te+(M>>>0<Ie>>>0?1:0),j=_.low=j+X,_.high=A+Z+(j>>>0<X>>>0?1:0),F=g.low=F+Pe,g.high=N+ne+(F>>>0<Pe>>>0?1:0),L=v.low=L+we,v.high=k+ht+(L>>>0<we>>>0?1:0),U=S.low=U+ee,S.high=q+ae+(U>>>0<ee>>>0?1:0),V=x.low=V+Ue,x.high=G+ge+(V>>>0<Ue>>>0?1:0),z=O.low=z+Je,O.high=D+ct+(z>>>0<Je>>>0?1:0),J=T.low=J+Qr,T.high=W+cr+(J>>>0<Qr>>>0?1:0)},_doFinalize:function(){var f=this._data,p=f.words,h=this._nDataBytes*8,m=f.sigBytes*8;p[m>>>5]|=128<<24-m%32,p[(m+128>>>10<<5)+30]=Math.floor(h/4294967296),p[(m+128>>>10<<5)+31]=h,f.sigBytes=p.length*4,this._process();var _=this._hash.toX32();return _},clone:function(){var f=n.clone.call(this);return f._hash=this._hash.clone(),f},blockSize:1024/32});t.SHA512=n._createHelper(d),t.HmacSHA512=n._createHmacHelper(d)}(),e.SHA512})});var bvt=b((dQ,yvt)=>{(function(e,t,r){typeof dQ=="object"?yvt.exports=dQ=t(ln(),H4(),CCe()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],t):t(e.CryptoJS)})(dQ,function(e){return function(){var t=e,r=t.x64,n=r.Word,o=r.WordArray,i=t.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}});t.SHA384=a._createHelper(s),t.HmacSHA384=a._createHmacHelper(s)}(),e.SHA384})});var vvt=b((fQ,_vt)=>{(function(e,t,r){typeof fQ=="object"?_vt.exports=fQ=t(ln(),H4()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],t):t(e.CryptoJS)})(fQ,function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.x64,s=a.Word,u=r.algo,l=[],c=[],d=[];(function(){for(var h=1,m=0,_=0;_<24;_++){l[h+5*m]=(_+1)*(_+2)/2%64;var g=m%5,v=(2*h+3*m)%5;h=g,m=v}for(var h=0;h<5;h++)for(var m=0;m<5;m++)c[h+5*m]=m+(2*h+3*m)%5*5;for(var S=1,x=0;x<24;x++){for(var O=0,T=0,E=0;E<7;E++){if(S&1){var M=(1<<E)-1;M<32?T^=1<<M:O^=1<<M-32}S&128?S=S<<1^113:S<<=1}d[x]=s.create(O,T)}})();var f=[];(function(){for(var h=0;h<25;h++)f[h]=s.create()})();var p=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var h=this._state=[],m=0;m<25;m++)h[m]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(h,m){for(var _=this._state,g=this.blockSize/2,v=0;v<g;v++){var S=h[m+2*v],x=h[m+2*v+1];S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,x=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360;var O=_[v];O.high^=x,O.low^=S}for(var T=0;T<24;T++){for(var E=0;E<5;E++){for(var M=0,A=0,j=0;j<5;j++){var O=_[E+5*j];M^=O.high,A^=O.low}var N=f[E];N.high=M,N.low=A}for(var E=0;E<5;E++)for(var F=f[(E+4)%5],k=f[(E+1)%5],L=k.high,q=k.low,M=F.high^(L<<1|q>>>31),A=F.low^(q<<1|L>>>31),j=0;j<5;j++){var O=_[E+5*j];O.high^=M,O.low^=A}for(var U=1;U<25;U++){var M,A,O=_[U],G=O.high,V=O.low,D=l[U];D<32?(M=G<<D|V>>>32-D,A=V<<D|G>>>32-D):(M=V<<D-32|G>>>64-D,A=G<<D-32|V>>>64-D);var z=f[c[U]];z.high=M,z.low=A}var W=f[0],J=_[0];W.high=J.high,W.low=J.low;for(var E=0;E<5;E++)for(var j=0;j<5;j++){var U=E+5*j,O=_[U],te=f[U],Ie=f[(E+1)%5+5*j],Z=f[(E+2)%5+5*j];O.high=te.high^~Ie.high&Z.high,O.low=te.low^~Ie.low&Z.low}var O=_[0],X=d[T];O.high^=X.high,O.low^=X.low}},_doFinalize:function(){var h=this._data,m=h.words,_=this._nDataBytes*8,g=h.sigBytes*8,v=this.blockSize*32;m[g>>>5]|=1<<24-g%32,m[(t.ceil((g+1)/v)*v>>>5)-1]|=128,h.sigBytes=m.length*4,this._process();for(var S=this._state,x=this.cfg.outputLength/8,O=x/8,T=[],E=0;E<O;E++){var M=S[E],A=M.high,j=M.low;A=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360,j=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360,T.push(j),T.push(A)}return new o.init(T,x)},clone:function(){for(var h=i.clone.call(this),m=h._state=this._state.slice(0),_=0;_<25;_++)m[_]=m[_].clone();return h}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),e.SHA3})});var Svt=b((pQ,wvt)=>{(function(e,t){typeof pQ=="object"?wvt.exports=pQ=t(ln()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(pQ,function(e){return function(t){var r=e,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 T=0;T<16;T++){var E=O+T,M=x[E];x[E]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}var A=this._hash.words,j=d.words,N=f.words,F=s.words,k=u.words,L=l.words,q=c.words,U,G,V,D,z,W,J,te,Ie,Z;W=U=A[0],J=G=A[1],te=V=A[2],Ie=D=A[3],Z=z=A[4];for(var X,T=0;T<80;T+=1)X=U+x[O+F[T]]|0,T<16?X+=h(G,V,D)+j[0]:T<32?X+=m(G,V,D)+j[1]:T<48?X+=_(G,V,D)+j[2]:T<64?X+=g(G,V,D)+j[3]:X+=v(G,V,D)+j[4],X=X|0,X=S(X,L[T]),X=X+z|0,U=z,z=D,D=S(V,10),V=G,G=X,X=W+x[O+k[T]]|0,T<16?X+=v(J,te,Ie)+N[0]:T<32?X+=g(J,te,Ie)+N[1]:T<48?X+=_(J,te,Ie)+N[2]:T<64?X+=m(J,te,Ie)+N[3]:X+=h(J,te,Ie)+N[4],X=X|0,X=S(X,q[T]),X=X+Z|0,W=Z,Z=Ie,Ie=S(te,10),te=J,J=X;X=A[1]+V+Ie|0,A[1]=A[2]+D+Z|0,A[2]=A[3]+z+W|0,A[3]=A[4]+U+J|0,A[4]=A[0]+G+te|0,A[0]=X},_doFinalize:function(){var x=this._data,O=x.words,T=this._nDataBytes*8,E=x.sigBytes*8;O[E>>>5]|=128<<24-E%32,O[(E+64>>>9<<4)+14]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,x.sigBytes=(O.length+1)*4,this._process();for(var M=this._hash,A=M.words,j=0;j<5;j++){var N=A[j];A[j]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360}return M},clone:function(){var x=i.clone.call(this);return x._hash=this._hash.clone(),x}});function h(x,O,T){return x^O^T}function m(x,O,T){return x&O|~x&T}function _(x,O,T){return(x|~O)^T}function g(x,O,T){return x&T|O&~T}function v(x,O,T){return x^(O|~T)}function S(x,O){return x<<O|x>>>32-O}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),e.RIPEMD160})});var mQ=b((hQ,xvt)=>{(function(e,t){typeof hQ=="object"?xvt.exports=hQ=t(ln()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(hQ,function(e){(function(){var t=e,r=t.lib,n=r.Base,o=t.enc,i=o.Utf8,a=t.algo,s=a.HMAC=n.extend({init:function(u,l){u=this._hasher=new u.init,typeof l=="string"&&(l=i.parse(l));var c=u.blockSize,d=c*4;l.sigBytes>d&&(l=u.finalize(l)),l.clamp();for(var f=this._oKey=l.clone(),p=this._iKey=l.clone(),h=f.words,m=p.words,_=0;_<c;_++)h[_]^=1549556828,m[_]^=909522486;f.sigBytes=p.sigBytes=d,this.reset()},reset:function(){var u=this._hasher;u.reset(),u.update(this._iKey)},update:function(u){return this._hasher.update(u),this},finalize:function(u){var l=this._hasher,c=l.finalize(u);l.reset();var d=l.finalize(this._oKey.clone().concat(c));return d}})})()})});var Ovt=b((gQ,Cvt)=>{(function(e,t,r){typeof gQ=="object"?Cvt.exports=gQ=t(ln(),uQ(),mQ()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],t):t(e.CryptoJS)})(gQ,function(e){return function(){var t=e,r=t.lib,n=r.Base,o=r.WordArray,i=t.algo,a=i.SHA256,s=i.HMAC,u=i.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:25e4}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,c){for(var d=this.cfg,f=s.create(d.hasher,l),p=o.create(),h=o.create([1]),m=p.words,_=h.words,g=d.keySize,v=d.iterations;m.length<g;){var S=f.update(c).finalize(h);f.reset();for(var x=S.words,O=x.length,T=S,E=1;E<v;E++){T=f.finalize(T),f.reset();for(var M=T.words,A=0;A<O;A++)x[A]^=M[A]}p.concat(S),_[0]++}return p.sigBytes=g*4,p}});t.PBKDF2=function(l,c,d){return u.create(d).compute(l,c)}}(),e.PBKDF2})});var Vx=b((yQ,Evt)=>{(function(e,t,r){typeof yQ=="object"?Evt.exports=yQ=t(ln(),xCe(),mQ()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],t):t(e.CryptoJS)})(yQ,function(e){return function(){var t=e,r=t.lib,n=r.Base,o=r.WordArray,i=t.algo,a=i.MD5,s=i.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:1}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,l){for(var c,d=this.cfg,f=d.hasher.create(),p=o.create(),h=p.words,m=d.keySize,_=d.iterations;h.length<m;){c&&f.update(c),c=f.update(u).finalize(l),f.reset();for(var g=1;g<_;g++)c=f.finalize(c),f.reset();p.concat(c)}return p.sigBytes=m*4,p}});t.EvpKDF=function(u,l,c){return s.create(c).compute(u,l)}}(),e.EvpKDF})});var Zu=b((bQ,Pvt)=>{(function(e,t,r){typeof bQ=="object"?Pvt.exports=bQ=t(ln(),Vx()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],t):t(e.CryptoJS)})(bQ,function(e){e.lib.Cipher||function(t){var r=e,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,F){return this.create(this._ENC_XFORM_MODE,N,F)},createDecryptor:function(N,F){return this.create(this._DEC_XFORM_MODE,N,F)},init:function(N,F,k){this.cfg=this.cfg.extend(k),this._xformMode=N,this._key=F,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 F=this._doFinalize();return F},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function N(F){return typeof F=="string"?j:E}return function(F){return{encrypt:function(k,L,q){return N(L).encrypt(F,k,L,q)},decrypt:function(k,L,q){return N(L).decrypt(F,k,L,q)}}}}()}),p=n.StreamCipher=f.extend({_doFinalize:function(){var N=this._process(!0);return N},blockSize:1}),h=r.mode={},m=n.BlockCipherMode=o.extend({createEncryptor:function(N,F){return this.Encryptor.create(N,F)},createDecryptor:function(N,F){return this.Decryptor.create(N,F)},init:function(N,F){this._cipher=N,this._iv=F}}),_=h.CBC=function(){var N=m.extend();N.Encryptor=N.extend({processBlock:function(k,L){var q=this._cipher,U=q.blockSize;F.call(this,k,L,U),q.encryptBlock(k,L),this._prevBlock=k.slice(L,L+U)}}),N.Decryptor=N.extend({processBlock:function(k,L){var q=this._cipher,U=q.blockSize,G=k.slice(L,L+U);q.decryptBlock(k,L),F.call(this,k,L,U),this._prevBlock=G}});function F(k,L,q){var U,G=this._iv;G?(U=G,this._iv=t):U=this._prevBlock;for(var V=0;V<q;V++)k[L+V]^=U[V]}return N}(),g=r.pad={},v=g.Pkcs7={pad:function(N,F){for(var k=F*4,L=k-N.sigBytes%k,q=L<<24|L<<16|L<<8|L,U=[],G=0;G<L;G+=4)U.push(q);var V=i.create(U,L);N.concat(V)},unpad:function(N){var F=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=F}},S=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:_,padding:v}),reset:function(){var N;f.reset.call(this);var F=this.cfg,k=F.iv,L=F.mode;this._xformMode==this._ENC_XFORM_MODE?N=L.createEncryptor:(N=L.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==N?this._mode.init(this,k&&k.words):(this._mode=N.call(L,this,k&&k.words),this._mode.__creator=N)},_doProcessBlock:function(N,F){this._mode.processBlock(N,F)},_doFinalize:function(){var N,F=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(F.pad(this._data,this.blockSize),N=this._process(!0)):(N=this._process(!0),F.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={},T=O.OpenSSL={stringify:function(N){var F,k=N.ciphertext,L=N.salt;return L?F=i.create([1398893684,1701076831]).concat(L).concat(k):F=k,F.toString(l)},parse:function(N){var F,k=l.parse(N),L=k.words;return L[0]==1398893684&&L[1]==1701076831&&(F=i.create(L.slice(2,4)),L.splice(0,4),k.sigBytes-=16),x.create({ciphertext:k,salt:F})}},E=n.SerializableCipher=o.extend({cfg:o.extend({format:T}),encrypt:function(N,F,k,L){L=this.cfg.extend(L);var q=N.createEncryptor(k,L),U=q.finalize(F),G=q.cfg;return x.create({ciphertext:U,key:k,iv:G.iv,algorithm:N,mode:G.mode,padding:G.padding,blockSize:N.blockSize,formatter:L.format})},decrypt:function(N,F,k,L){L=this.cfg.extend(L),F=this._parse(F,L.format);var q=N.createDecryptor(k,L).finalize(F.ciphertext);return q},_parse:function(N,F){return typeof N=="string"?F.parse(N,this):N}}),M=r.kdf={},A=M.OpenSSL={execute:function(N,F,k,L,q){if(L||(L=i.random(64/8)),q)var U=d.create({keySize:F+k,hasher:q}).compute(N,L);else var U=d.create({keySize:F+k}).compute(N,L);var G=i.create(U.words.slice(F),k*4);return U.sigBytes=F*4,x.create({key:U,iv:G,salt:L})}},j=n.PasswordBasedCipher=E.extend({cfg:E.cfg.extend({kdf:A}),encrypt:function(N,F,k,L){L=this.cfg.extend(L);var q=L.kdf.execute(k,N.keySize,N.ivSize,L.salt,L.hasher);L.iv=q.iv;var U=E.encrypt.call(this,N,F,q.key,L);return U.mixIn(q),U},decrypt:function(N,F,k,L){L=this.cfg.extend(L),F=this._parse(F,L.format);var q=L.kdf.execute(k,N.keySize,N.ivSize,F.salt,L.hasher);L.iv=q.iv;var U=E.decrypt.call(this,N,F,q.key,L);return U}})}()})});var Mvt=b((_Q,Tvt)=>{(function(e,t,r){typeof _Q=="object"?Tvt.exports=_Q=t(ln(),Zu()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],t):t(e.CryptoJS)})(_Q,function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();t.Encryptor=t.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)}}),t.Decryptor=t.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=n.slice(o,o+a);r.call(this,n,o,a,i),this._prevBlock=s}});function r(n,o,i,a){var s,u=this._iv;u?(s=u.slice(0),this._iv=void 0):s=this._prevBlock,a.encryptBlock(s,0);for(var l=0;l<i;l++)n[o+l]^=s[l]}return t}(),e.mode.CFB})});var Avt=b((vQ,Ivt)=>{(function(e,t,r){typeof vQ=="object"?Ivt.exports=vQ=t(ln(),Zu()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],t):t(e.CryptoJS)})(vQ,function(e){return e.mode.CTR=function(){var t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=this._iv,u=this._counter;s&&(u=this._counter=s.slice(0),this._iv=void 0);var l=u.slice(0);i.encryptBlock(l,0),u[a-1]=u[a-1]+1|0;for(var c=0;c<a;c++)n[o+c]^=l[c]}});return t.Decryptor=r,t}(),e.mode.CTR})});var Dvt=b((wQ,Rvt)=>{(function(e,t,r){typeof wQ=="object"?Rvt.exports=wQ=t(ln(),Zu()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],t):t(e.CryptoJS)})(wQ,function(e){return e.mode.CTRGladman=function(){var t=e.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=t.Encryptor=t.extend({processBlock:function(i,a){var s=this._cipher,u=s.blockSize,l=this._iv,c=this._counter;l&&(c=this._counter=l.slice(0),this._iv=void 0),n(c);var d=c.slice(0);s.encryptBlock(d,0);for(var f=0;f<u;f++)i[a+f]^=d[f]}});return t.Decryptor=o,t}(),e.mode.CTRGladman})});var Nvt=b((SQ,jvt)=>{(function(e,t,r){typeof SQ=="object"?jvt.exports=SQ=t(ln(),Zu()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],t):t(e.CryptoJS)})(SQ,function(e){return e.mode.OFB=function(){var t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=this._iv,u=this._keystream;s&&(u=this._keystream=s.slice(0),this._iv=void 0),i.encryptBlock(u,0);for(var l=0;l<a;l++)n[o+l]^=u[l]}});return t.Decryptor=r,t}(),e.mode.OFB})});var Fvt=b((xQ,Lvt)=>{(function(e,t,r){typeof xQ=="object"?Lvt.exports=xQ=t(ln(),Zu()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],t):t(e.CryptoJS)})(xQ,function(e){return e.mode.ECB=function(){var t=e.lib.BlockCipherMode.extend();return t.Encryptor=t.extend({processBlock:function(r,n){this._cipher.encryptBlock(r,n)}}),t.Decryptor=t.extend({processBlock:function(r,n){this._cipher.decryptBlock(r,n)}}),t}(),e.mode.ECB})});var Bvt=b((CQ,kvt)=>{(function(e,t,r){typeof CQ=="object"?kvt.exports=CQ=t(ln(),Zu()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],t):t(e.CryptoJS)})(CQ,function(e){return e.pad.AnsiX923={pad:function(t,r){var n=t.sigBytes,o=r*4,i=o-n%o,a=n+i-1;t.clamp(),t.words[a>>>2]|=i<<24-a%4*8,t.sigBytes+=i},unpad:function(t){var r=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=r}},e.pad.Ansix923})});var qvt=b((OQ,$vt)=>{(function(e,t,r){typeof OQ=="object"?$vt.exports=OQ=t(ln(),Zu()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],t):t(e.CryptoJS)})(OQ,function(e){return e.pad.Iso10126={pad:function(t,r){var n=r*4,o=n-t.sigBytes%n;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(t){var r=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=r}},e.pad.Iso10126})});var zvt=b((EQ,Uvt)=>{(function(e,t,r){typeof EQ=="object"?Uvt.exports=EQ=t(ln(),Zu()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],t):t(e.CryptoJS)})(EQ,function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971})});var Vvt=b((PQ,Hvt)=>{(function(e,t,r){typeof PQ=="object"?Hvt.exports=PQ=t(ln(),Zu()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],t):t(e.CryptoJS)})(PQ,function(e){return e.pad.ZeroPadding={pad:function(t,r){var n=r*4;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){for(var r=t.words,n=t.sigBytes-1,n=t.sigBytes-1;n>=0;n--)if(r[n>>>2]>>>24-n%4*8&255){t.sigBytes=n+1;break}}},e.pad.ZeroPadding})});var Jvt=b((TQ,Wvt)=>{(function(e,t,r){typeof TQ=="object"?Wvt.exports=TQ=t(ln(),Zu()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],t):t(e.CryptoJS)})(TQ,function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding})});var Kvt=b((MQ,Gvt)=>{(function(e,t,r){typeof MQ=="object"?Gvt.exports=MQ=t(ln(),Zu()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],t):t(e.CryptoJS)})(MQ,function(e){return function(t){var r=e,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})}}}(),e.format.Hex})});var Zvt=b((IQ,Yvt)=>{(function(e,t,r){typeof IQ=="object"?Yvt.exports=IQ=t(ln(),AP(),RP(),Vx(),Zu()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],t):t(e.CryptoJS)})(IQ,function(e){return function(){var t=e,r=t.lib,n=r.BlockCipher,o=t.algo,i=[],a=[],s=[],u=[],l=[],c=[],d=[],f=[],p=[],h=[];(function(){for(var g=[],v=0;v<256;v++)v<128?g[v]=v<<1:g[v]=v<<1^283;for(var S=0,x=0,v=0;v<256;v++){var O=x^x<<1^x<<2^x<<3^x<<4;O=O>>>8^O&255^99,i[S]=O,a[O]=S;var T=g[S],E=g[T],M=g[E],A=g[O]*257^O*16843008;s[S]=A<<24|A>>>8,u[S]=A<<16|A>>>16,l[S]=A<<8|A>>>24,c[S]=A;var A=M*16843009^E*65537^T*257^S*16843008;d[O]=A<<24|A>>>8,f[O]=A<<16|A>>>16,p[O]=A<<8|A>>>24,h[O]=A,S?(S=T^g[g[g[M^T]]],x^=g[g[x]]):S=x=1}})();var m=[0,1,2,4,8,16,32,64,128,27,54],_=o.AES=n.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var v=this._keyPriorReset=this._key,S=v.words,x=v.sigBytes/4,O=this._nRounds=x+6,T=(O+1)*4,E=this._keySchedule=[],M=0;M<T;M++)M<x?E[M]=S[M]:(g=E[M-1],M%x?x>6&&M%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^=m[M/x|0]<<24),E[M]=E[M-x]^g);for(var A=this._invKeySchedule=[],j=0;j<T;j++){var M=T-j;if(j%4)var g=E[M];else var g=E[M-4];j<4||M<=4?A[j]=g:A[j]=d[i[g>>>24]]^f[i[g>>>16&255]]^p[i[g>>>8&255]]^h[i[g&255]]}}},encryptBlock:function(g,v){this._doCryptBlock(g,v,this._keySchedule,s,u,l,c,i)},decryptBlock:function(g,v){var S=g[v+1];g[v+1]=g[v+3],g[v+3]=S,this._doCryptBlock(g,v,this._invKeySchedule,d,f,p,h,a);var S=g[v+1];g[v+1]=g[v+3],g[v+3]=S},_doCryptBlock:function(g,v,S,x,O,T,E,M){for(var A=this._nRounds,j=g[v]^S[0],N=g[v+1]^S[1],F=g[v+2]^S[2],k=g[v+3]^S[3],L=4,q=1;q<A;q++){var U=x[j>>>24]^O[N>>>16&255]^T[F>>>8&255]^E[k&255]^S[L++],G=x[N>>>24]^O[F>>>16&255]^T[k>>>8&255]^E[j&255]^S[L++],V=x[F>>>24]^O[k>>>16&255]^T[j>>>8&255]^E[N&255]^S[L++],D=x[k>>>24]^O[j>>>16&255]^T[N>>>8&255]^E[F&255]^S[L++];j=U,N=G,F=V,k=D}var U=(M[j>>>24]<<24|M[N>>>16&255]<<16|M[F>>>8&255]<<8|M[k&255])^S[L++],G=(M[N>>>24]<<24|M[F>>>16&255]<<16|M[k>>>8&255]<<8|M[j&255])^S[L++],V=(M[F>>>24]<<24|M[k>>>16&255]<<16|M[j>>>8&255]<<8|M[N&255])^S[L++],D=(M[k>>>24]<<24|M[j>>>16&255]<<16|M[N>>>8&255]<<8|M[F&255])^S[L++];g[v]=U,g[v+1]=G,g[v+2]=V,g[v+3]=D},keySize:256/32});t.AES=n._createHelper(_)}(),e.AES})});var Qvt=b((AQ,Xvt)=>{(function(e,t,r){typeof AQ=="object"?Xvt.exports=AQ=t(ln(),AP(),RP(),Vx(),Zu()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],t):t(e.CryptoJS)})(AQ,function(e){return function(){var t=e,r=t.lib,n=r.WordArray,o=r.BlockCipher,i=t.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=i.DES=o.extend({_doReset:function(){for(var m=this._key,_=m.words,g=[],v=0;v<56;v++){var S=a[v]-1;g[v]=_[S>>>5]>>>31-S%32&1}for(var x=this._subKeys=[],O=0;O<16;O++){for(var T=x[O]=[],E=u[O],v=0;v<24;v++)T[v/6|0]|=g[(s[v]-1+E)%28]<<31-v%6,T[4+(v/6|0)]|=g[28+(s[v+24]-1+E)%28]<<31-v%6;T[0]=T[0]<<1|T[0]>>>31;for(var v=1;v<7;v++)T[v]=T[v]>>>(v-1)*4+3;T[7]=T[7]<<5|T[7]>>>27}for(var M=this._invSubKeys=[],v=0;v<16;v++)M[v]=x[15-v]},encryptBlock:function(m,_){this._doCryptBlock(m,_,this._subKeys)},decryptBlock:function(m,_){this._doCryptBlock(m,_,this._invSubKeys)},_doCryptBlock:function(m,_,g){this._lBlock=m[_],this._rBlock=m[_+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 v=0;v<16;v++){for(var S=g[v],x=this._lBlock,O=this._rBlock,T=0,E=0;E<8;E++)T|=l[E][((O^S[E])&c[E])>>>0];this._lBlock=O,this._rBlock=x^T}var M=this._lBlock;this._lBlock=this._rBlock,this._rBlock=M,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),m[_]=this._lBlock,m[_+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(m,_){var g=(this._lBlock>>>m^this._rBlock)&_;this._rBlock^=g,this._lBlock^=g<<m}function p(m,_){var g=(this._rBlock>>>m^this._lBlock)&_;this._lBlock^=g,this._rBlock^=g<<m}t.DES=o._createHelper(d);var h=i.TripleDES=o.extend({_doReset:function(){var m=this._key,_=m.words;if(_.length!==2&&_.length!==4&&_.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var g=_.slice(0,2),v=_.length<4?_.slice(0,2):_.slice(2,4),S=_.length<6?_.slice(0,2):_.slice(4,6);this._des1=d.createEncryptor(n.create(g)),this._des2=d.createEncryptor(n.create(v)),this._des3=d.createEncryptor(n.create(S))},encryptBlock:function(m,_){this._des1.encryptBlock(m,_),this._des2.decryptBlock(m,_),this._des3.encryptBlock(m,_)},decryptBlock:function(m,_){this._des3.decryptBlock(m,_),this._des2.encryptBlock(m,_),this._des1.decryptBlock(m,_)},keySize:192/32,ivSize:64/32,blockSize:64/32});t.TripleDES=o._createHelper(h)}(),e.TripleDES})});var t0t=b((RQ,e0t)=>{(function(e,t,r){typeof RQ=="object"?e0t.exports=RQ=t(ln(),AP(),RP(),Vx(),Zu()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],t):t(e.CryptoJS)})(RQ,function(e){return function(){var t=e,r=t.lib,n=r.StreamCipher,o=t.algo,i=o.RC4=n.extend({_doReset:function(){for(var u=this._key,l=u.words,c=u.sigBytes,d=this._S=[],f=0;f<256;f++)d[f]=f;for(var f=0,p=0;f<256;f++){var h=f%c,m=l[h>>>2]>>>24-h%4*8&255;p=(p+d[f]+m)%256;var _=d[f];d[f]=d[p],d[p]=_}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}t.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)}});t.RC4Drop=n._createHelper(s)}(),e.RC4})});var n0t=b((DQ,r0t)=>{(function(e,t,r){typeof DQ=="object"?r0t.exports=DQ=t(ln(),AP(),RP(),Vx(),Zu()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],t):t(e.CryptoJS)})(DQ,function(e){return function(){var t=e,r=t.lib,n=r.StreamCipher,o=t.algo,i=[],a=[],s=[],u=o.Rabbit=n.extend({_doReset:function(){for(var c=this._key.words,d=this.cfg.iv,f=0;f<4;f++)c[f]=(c[f]<<8|c[f]>>>24)&16711935|(c[f]<<24|c[f]>>>8)&4278255360;var p=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],h=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var f=0;f<4;f++)l.call(this);for(var f=0;f<8;f++)h[f]^=p[f+4&7];if(d){var m=d.words,_=m[0],g=m[1],v=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,S=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=v>>>16|S&4294901760,O=S<<16|v&65535;h[0]^=v,h[1]^=x,h[2]^=S,h[3]^=O,h[4]^=v,h[5]^=x,h[6]^=S,h[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<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],h=p&65535,m=p>>>16,_=((h*h>>>17)+h*m>>>15)+m*m,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=_^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}t.Rabbit=n._createHelper(u)}(),e.Rabbit})});var i0t=b((jQ,o0t)=>{(function(e,t,r){typeof jQ=="object"?o0t.exports=jQ=t(ln(),AP(),RP(),Vx(),Zu()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],t):t(e.CryptoJS)})(jQ,function(e){return function(){var t=e,r=t.lib,n=r.StreamCipher,o=t.algo,i=[],a=[],s=[],u=o.RabbitLegacy=n.extend({_doReset:function(){var c=this._key.words,d=this.cfg.iv,f=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],p=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var h=0;h<4;h++)l.call(this);for(var h=0;h<8;h++)p[h]^=f[h+4&7];if(d){var m=d.words,_=m[0],g=m[1],v=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,S=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=v>>>16|S&4294901760,O=S<<16|v&65535;p[0]^=v,p[1]^=x,p[2]^=S,p[3]^=O,p[4]^=v,p[5]^=x,p[6]^=S,p[7]^=O;for(var h=0;h<4;h++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],h=p&65535,m=p>>>16,_=((h*h>>>17)+h*m>>>15)+m*m,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=_^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}t.RabbitLegacy=n._createHelper(u)}(),e.RabbitLegacy})});var s0t=b((NQ,a0t)=>{(function(e,t,r){typeof NQ=="object"?a0t.exports=NQ=t(ln(),AP(),RP(),Vx(),Zu()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],t):t(e.CryptoJS)})(NQ,function(e){return function(){var t=e,r=t.lib,n=r.BlockCipher,o=t.algo;let i=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var u={pbox:[],sbox:[]};function l(h,m){let _=m>>24&255,g=m>>16&255,v=m>>8&255,S=m&255,x=h.sbox[0][_]+h.sbox[1][g];return x=x^h.sbox[2][v],x=x+h.sbox[3][S],x}function c(h,m,_){let g=m,v=_,S;for(let x=0;x<i;++x)g=g^h.pbox[x],v=l(h,g)^v,S=g,g=v,v=S;return S=g,g=v,v=S,v=v^h.pbox[i],g=g^h.pbox[i+1],{left:g,right:v}}function d(h,m,_){let g=m,v=_,S;for(let x=i+1;x>1;--x)g=g^h.pbox[x],v=l(h,g)^v,S=g,g=v,v=S;return S=g,g=v,v=S,v=v^h.pbox[1],g=g^h.pbox[0],{left:g,right:v}}function f(h,m,_){for(let O=0;O<4;O++){h.sbox[O]=[];for(let T=0;T<256;T++)h.sbox[O][T]=s[O][T]}let g=0;for(let O=0;O<i+2;O++)h.pbox[O]=a[O]^m[g],g++,g>=_&&(g=0);let v=0,S=0,x=0;for(let O=0;O<i+2;O+=2)x=c(h,v,S),v=x.left,S=x.right,h.pbox[O]=v,h.pbox[O+1]=S;for(let O=0;O<4;O++)for(let T=0;T<256;T+=2)x=c(h,v,S),v=x.left,S=x.right,h.sbox[O][T]=v,h.sbox[O][T+1]=S;return!0}var p=o.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var h=this._keyPriorReset=this._key,m=h.words,_=h.sigBytes/4;f(u,m,_)}},encryptBlock:function(h,m){var _=c(u,h[m],h[m+1]);h[m]=_.left,h[m+1]=_.right},decryptBlock:function(h,m){var _=d(u,h[m],h[m+1]);h[m]=_.left,h[m+1]=_.right},blockSize:64/32,keySize:128/32,ivSize:64/32});t.Blowfish=n._createHelper(p)}(),e.Blowfish})});var FQ=b((LQ,u0t)=>{(function(e,t,r){typeof LQ=="object"?u0t.exports=LQ=t(ln(),H4(),ivt(),svt(),AP(),cvt(),RP(),xCe(),uQ(),mvt(),CCe(),bvt(),vvt(),Svt(),mQ(),Ovt(),Vx(),Zu(),Mvt(),Avt(),Dvt(),Nvt(),Fvt(),Bvt(),qvt(),zvt(),Vvt(),Jvt(),Kvt(),Zvt(),Qvt(),t0t(),n0t(),i0t(),s0t()):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"],t):e.CryptoJS=t(e.CryptoJS)})(LQ,function(e){return e})});var Jx,h0t=C(()=>{Jx=class{constructor(t){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=t.pageContent!==void 0?t.pageContent.toString():"",this.metadata=t.metadata??{},this.id=t.id}}});var Hn=b(bOe=>{"use strict";Object.defineProperty(bOe,"__esModule",{value:!0});bOe.pathToFunc=jqr;var Dqr=Object.prototype.hasOwnProperty;function jqr(e,t){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return e.replace(r,function(i,a){if(!Dqr.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 t?.charEncoding==="percent"?encodeURIComponent(`${s}`):`${s}`})}}});var Iee=b(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.SDK_METADATA=Wh.ServerList=Wh.ServerEu=void 0;Wh.serverURLFromOptions=Lqr;var Nqr=Hn();Wh.ServerEu="eu";Wh.ServerList={[Wh.ServerEu]:"https://api.mistral.ai"};function Lqr(e){let t=e.serverURL,r={};if(!t){let o=e.server??Wh.ServerEu;t=Wh.ServerList[o]||""}let n=(0,Nqr.pathToFunc)(t)(r);return new URL(n)}Wh.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 vOe=b(_Oe=>{"use strict";Object.defineProperty(_Oe,"__esModule",{value:!0});_Oe.readableStreamToArrayBuffer=Fqr;async function Fqr(e){let t=e.getReader(),r=[],n=0,o=!1;for(;!o;){let{value:s,done:u}=await t.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 hwt=b(Aee=>{"use strict";Object.defineProperty(Aee,"__esModule",{value:!0});Aee.CustomUserAgentHook=void 0;var kqr=Iee(),wOe=class{beforeRequest(t,r){let o=`mistral-client-typescript/${kqr.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};Aee.CustomUserAgentHook=wOe});var gwt=b(Ree=>{"use strict";Object.defineProperty(Ree,"__esModule",{value:!0});Ree.DeprecationWarningHook=void 0;var mwt="x-model-deprecation-timestamp",SOe=class{afterSuccess(t,r){return r.headers.has(mwt)&&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(mwt)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};Ree.DeprecationWarningHook=SOe});var ywt=b(xOe=>{"use strict";Object.defineProperty(xOe,"__esModule",{value:!0});xOe.initHooks=qqr;var Bqr=hwt(),$qr=gwt();function qqr(e){let t=new Bqr.CustomUserAgentHook;e.registerBeforeRequestHook(t);let r=new $qr.DeprecationWarningHook;e.registerAfterSuccessHook(r)}});var bwt=b(Dee=>{"use strict";Object.defineProperty(Dee,"__esModule",{value:!0});Dee.SDKHooks=void 0;var Uqr=ywt(),COe=class{constructor(){this.sdkInitHooks=[],this.beforeCreateRequestHooks=[],this.beforeRequestHooks=[],this.afterSuccessHooks=[],this.afterErrorHooks=[];let t=[];for(let r of t)"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,Uqr.initHooks)(this)}registerSDKInitHook(t){this.sdkInitHooks.push(t)}registerBeforeCreateRequestHook(t){this.beforeCreateRequestHooks.push(t)}registerBeforeRequestHook(t){this.beforeRequestHooks.push(t)}registerAfterSuccessHook(t){this.afterSuccessHooks.push(t)}registerAfterErrorHook(t){this.afterErrorHooks.push(t)}sdkInit(t){return this.sdkInitHooks.reduce((r,n)=>n.sdkInit(r),t)}beforeCreateRequest(t,r){let n=r;for(let o of this.beforeCreateRequestHooks)n=o.beforeCreateRequest(t,n);return n}async beforeRequest(t,r){let n=r;for(let o of this.beforeRequestHooks)n=await o.beforeRequest(t,n);return n}async afterSuccess(t,r){let n=r;for(let o of this.afterSuccessHooks)n=await o.afterSuccess(t,n);return n}async afterError(t,r,n){let o=r,i=n;for(let a of this.afterErrorHooks){let s=await a.afterError(t,o,i);o=s.response,i=s.error}return{response:o,error:i}}};Dee.SDKHooks=COe});var IOe=b(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});Lf.ConnectionError=Lf.RequestTimeoutError=Lf.RequestAbortedError=Lf.InvalidRequestError=Lf.UnexpectedClientError=Lf.HTTPClientError=void 0;var WP=class extends Error{constructor(t,r){let n=t;r?.cause&&(n+=`: ${r.cause}`),super(n,r),this.name="HTTPClientError",typeof this.cause>"u"&&(this.cause=r?.cause)}};Lf.HTTPClientError=WP;var OOe=class extends WP{constructor(){super(...arguments),this.name="UnexpectedClientError"}};Lf.UnexpectedClientError=OOe;var EOe=class extends WP{constructor(){super(...arguments),this.name="InvalidRequestError"}};Lf.InvalidRequestError=EOe;var POe=class extends WP{constructor(){super(...arguments),this.name="RequestAbortedError"}};Lf.RequestAbortedError=POe;var TOe=class extends WP{constructor(){super(...arguments),this.name="RequestTimeoutError"}};Lf.RequestTimeoutError=TOe;var MOe=class extends WP{constructor(){super(...arguments),this.name="ConnectionError"}};Lf.ConnectionError=MOe});var Jh=b(Mk=>{"use strict";Object.defineProperty(Mk,"__esModule",{value:!0});Mk.OK=zqr;Mk.ERR=Hqr;Mk.unwrap=Vqr;Mk.unwrapAsync=Wqr;function zqr(e){return{ok:!0,value:e}}function Hqr(e){return{ok:!1,error:e}}function Vqr(e){if(!e.ok)throw e.error;return e.value}async function Wqr(e){let t=await e;if(!t.ok)throw t.error;return t.value}});var i3=b(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.getParsedType=ci.ZodParsedType=ci.objectUtil=ci.util=void 0;var AOe;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.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},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.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)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(AOe||(ci.util=AOe={}));var _wt;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(_wt||(ci.objectUtil=_wt={}));ci.ZodParsedType=AOe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Jqr=e=>{switch(typeof e){case"undefined":return ci.ZodParsedType.undefined;case"string":return ci.ZodParsedType.string;case"number":return isNaN(e)?ci.ZodParsedType.nan:ci.ZodParsedType.number;case"boolean":return ci.ZodParsedType.boolean;case"function":return ci.ZodParsedType.function;case"bigint":return ci.ZodParsedType.bigint;case"symbol":return ci.ZodParsedType.symbol;case"object":return Array.isArray(e)?ci.ZodParsedType.array:e===null?ci.ZodParsedType.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ci.ZodParsedType.promise:typeof Map<"u"&&e instanceof Map?ci.ZodParsedType.map:typeof Set<"u"&&e instanceof Set?ci.ZodParsedType.set:typeof Date<"u"&&e instanceof Date?ci.ZodParsedType.date:ci.ZodParsedType.object;default:return ci.ZodParsedType.unknown}};ci.getParsedType=Jqr});var jee=b(JP=>{"use strict";Object.defineProperty(JP,"__esModule",{value:!0});JP.ZodError=JP.quotelessJson=JP.ZodIssueCode=void 0;var vwt=i3();JP.ZodIssueCode=vwt.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 Gqr=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");JP.quotelessJson=Gqr;var a3=class e extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,vwt.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};JP.ZodError=a3;a3.create=e=>new a3(e)});var DOe=b(ROe=>{"use strict";Object.defineProperty(ROe,"__esModule",{value:!0});var WR=i3(),rd=jee(),Kqr=(e,t)=>{let r;switch(e.code){case rd.ZodIssueCode.invalid_type:e.received===WR.ZodParsedType.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case rd.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,WR.util.jsonStringifyReplacer)}`;break;case rd.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${WR.util.joinValues(e.keys,", ")}`;break;case rd.ZodIssueCode.invalid_union:r="Invalid input";break;case rd.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${WR.util.joinValues(e.options)}`;break;case rd.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${WR.util.joinValues(e.options)}, received '${e.received}'`;break;case rd.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case rd.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case rd.ZodIssueCode.invalid_date:r="Invalid date";break;case rd.ZodIssueCode.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:WR.util.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case rd.ZodIssueCode.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case rd.ZodIssueCode.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case rd.ZodIssueCode.custom:r="Invalid input";break;case rd.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case rd.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case rd.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError,WR.util.assertNever(e)}return{message:r}};ROe.default=Kqr});var Nee=b(Fw=>{"use strict";var Yqr=Fw&&Fw.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Fw,"__esModule",{value:!0});Fw.getErrorMap=Fw.setErrorMap=Fw.defaultErrorMap=void 0;var wwt=Yqr(DOe());Fw.defaultErrorMap=wwt.default;var Swt=wwt.default;function Zqr(e){Swt=e}Fw.setErrorMap=Zqr;function Xqr(){return Swt}Fw.getErrorMap=Xqr});var NOe=b(Mo=>{"use strict";var Qqr=Mo&&Mo.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.isAsync=Mo.isValid=Mo.isDirty=Mo.isAborted=Mo.OK=Mo.DIRTY=Mo.INVALID=Mo.ParseStatus=Mo.addIssueToContext=Mo.EMPTY_PATH=Mo.makeIssue=void 0;var eUr=Nee(),xwt=Qqr(DOe()),tUr=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,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:t,defaultError:s}).message;return{...o,path:i,message:s}};Mo.makeIssue=tUr;Mo.EMPTY_PATH=[];function rUr(e,t){let r=(0,eUr.getErrorMap)(),n=(0,Mo.makeIssue)({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===xwt.default?void 0:xwt.default].filter(o=>!!o)});e.common.issues.push(n)}Mo.addIssueToContext=rUr;var jOe=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return Mo.INVALID;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return Mo.INVALID;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}};Mo.ParseStatus=jOe;Mo.INVALID=Object.freeze({status:"aborted"});var nUr=e=>({status:"dirty",value:e});Mo.DIRTY=nUr;var oUr=e=>({status:"valid",value:e});Mo.OK=oUr;var iUr=e=>e.status==="aborted";Mo.isAborted=iUr;var aUr=e=>e.status==="dirty";Mo.isDirty=aUr;var sUr=e=>e.status==="valid";Mo.isValid=sUr;var uUr=e=>typeof Promise<"u"&&e instanceof Promise;Mo.isAsync=uUr});var Owt=b(Cwt=>{"use strict";Object.defineProperty(Cwt,"__esModule",{value:!0})});var Pwt=b(Lee=>{"use strict";Object.defineProperty(Lee,"__esModule",{value:!0});Lee.errorUtil=void 0;var Ewt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Ewt||(Lee.errorUtil=Ewt={}))});var Bwt=b(K=>{"use strict";var kee=K&&K.__classPrivateFieldGet||function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},Mwt=K&&K.__classPrivateFieldSet||function(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},s3,u3;Object.defineProperty(K,"__esModule",{value:!0});K.boolean=K.bigint=K.array=K.any=K.coerce=K.ZodFirstPartyTypeKind=K.late=K.ZodSchema=K.Schema=K.custom=K.ZodReadonly=K.ZodPipeline=K.ZodBranded=K.BRAND=K.ZodNaN=K.ZodCatch=K.ZodDefault=K.ZodNullable=K.ZodOptional=K.ZodTransformer=K.ZodEffects=K.ZodPromise=K.ZodNativeEnum=K.ZodEnum=K.ZodLiteral=K.ZodLazy=K.ZodFunction=K.ZodSet=K.ZodMap=K.ZodRecord=K.ZodTuple=K.ZodIntersection=K.ZodDiscriminatedUnion=K.ZodUnion=K.ZodObject=K.ZodArray=K.ZodVoid=K.ZodNever=K.ZodUnknown=K.ZodAny=K.ZodNull=K.ZodUndefined=K.ZodSymbol=K.ZodDate=K.ZodBoolean=K.ZodBigInt=K.ZodNumber=K.ZodString=K.datetimeRegex=K.ZodType=void 0;K.NEVER=K.void=K.unknown=K.union=K.undefined=K.tuple=K.transformer=K.symbol=K.string=K.strictObject=K.set=K.record=K.promise=K.preprocess=K.pipeline=K.ostring=K.optional=K.onumber=K.oboolean=K.object=K.number=K.nullable=K.null=K.never=K.nativeEnum=K.nan=K.map=K.literal=K.lazy=K.intersection=K.instanceof=K.function=K.enum=K.effect=K.discriminatedUnion=K.date=void 0;var Fee=Nee(),vt=Pwt(),Q=NOe(),$e=i3(),Re=jee(),Kh=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,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}},Twt=(e,t)=>{if((0,Q.isValid)(t))return{success:!0,data:t.value};if(!e.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 Re.ZodError(e.common.issues);return this._error=r,this._error}}};function Sr(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{var u,l;let{message:c}=e;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(t){return(0,$e.getParsedType)(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:(0,$e.getParsedType)(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Q.ParseStatus,ctx:{common:t.parent.common,data:t.data,parsedType:(0,$e.getParsedType)(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if((0,Q.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,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:t,parsedType:(0,$e.getParsedType)(t)},i=this._parseSync({data:t,path:o.path,parent:o});return Twt(o,i)}"~validate"(t){var r,n;let o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:(0,$e.getParsedType)(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:o});return(0,Q.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:t,path:[],parent:o}).then(i=>(0,Q.isValid)(i)?{value:i.value}:{issues:o.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:(0,$e.getParsedType)(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await((0,Q.isAsync)(o)?o:Promise.resolve(o));return Twt(n,i)}refine(t,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=t(o),s=()=>i.addIssue({code:Re.ZodIssueCode.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Mp({schema:this,typeName:Ht.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 Gh.create(this,this._def)}nullable(){return Bw.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return eC.create(this)}promise(){return YP.create(this,this._def)}or(t){return QR.create([this,t],this._def)}and(t){return e1.create(this,t,this._def)}transform(t){return new Mp({...Sr(this._def),schema:this,typeName:Ht.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new i1({...Sr(this._def),innerType:this,defaultValue:r,typeName:Ht.ZodDefault})}brand(){return new l3({typeName:Ht.ZodBranded,type:this,...Sr(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new a1({...Sr(this._def),innerType:this,catchValue:r,typeName:Ht.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return c3.create(this,t)}readonly(){return s1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};K.ZodType=xr;K.Schema=xr;K.ZodSchema=xr;var lUr=/^c[^\s-]{8,}$/i,cUr=/^[0-9a-z]+$/,dUr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fUr=/^[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,pUr=/^[a-z0-9_-]{21}$/i,hUr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mUr=/^[-+]?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)?)??$/,gUr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yUr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",LOe,bUr=/^(?:(?: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])$/,_Ur=/^(?:(?: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])$/,vUr=/^(([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]))$/,wUr=/^(([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])$/,SUr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xUr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Iwt="((\\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])))",CUr=new RegExp(`^${Iwt}$`);function Awt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function OUr(e){return new RegExp(`^${Awt(e)}$`)}function Rwt(e){let t=`${Iwt}T${Awt(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}K.datetimeRegex=Rwt;function EUr(e,t){return!!((t==="v4"||!t)&&bUr.test(e)||(t==="v6"||!t)&&vUr.test(e))}function PUr(e,t){if(!hUr.test(e))return!1;try{let[r]=e.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||t&&o.alg!==t)}catch{return!1}}function TUr(e,t){return!!((t==="v4"||!t)&&_Ur.test(e)||(t==="v6"||!t)&&wUr.test(e))}var GP=class e extends xr{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==$e.ZodParsedType.string){let i=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(i,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.string,received:i.parsedType}),Q.INVALID}let n=new Q.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{code:Re.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{code:Re.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?(0,Q.addIssueToContext)(o,{code:Re.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,Q.addIssueToContext)(o,{code:Re.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")gUr.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"email",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")LOe||(LOe=new RegExp(yUr,"u")),LOe.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"emoji",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")fUr.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"uuid",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")pUr.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"nanoid",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")lUr.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"cuid",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")cUr.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"cuid2",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")dUr.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"ulid",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"url",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"regex",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{code:Re.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{code:Re.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{code:Re.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Rwt(i).test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{code:Re.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?CUr.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{code:Re.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?OUr(i).test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{code:Re.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?mUr.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"duration",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?EUr(t.data,i.version)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"ip",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?PUr(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"jwt",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?TUr(t.data,i.version)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"cidr",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?SUr.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"base64",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?xUr.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{validation:"base64url",code:Re.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):$e.util.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:Re.ZodIssueCode.invalid_string,...vt.errorUtil.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...vt.errorUtil.errToObj(t)})}url(t){return this._addCheck({kind:"url",...vt.errorUtil.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...vt.errorUtil.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...vt.errorUtil.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...vt.errorUtil.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...vt.errorUtil.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...vt.errorUtil.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...vt.errorUtil.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...vt.errorUtil.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...vt.errorUtil.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...vt.errorUtil.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...vt.errorUtil.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...vt.errorUtil.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(r=t?.offset)!==null&&r!==void 0?r:!1,local:(n=t?.local)!==null&&n!==void 0?n:!1,...vt.errorUtil.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...vt.errorUtil.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...vt.errorUtil.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...vt.errorUtil.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...vt.errorUtil.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...vt.errorUtil.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...vt.errorUtil.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...vt.errorUtil.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...vt.errorUtil.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...vt.errorUtil.errToObj(r)})}nonempty(t){return this.min(1,vt.errorUtil.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};K.ZodString=GP;GP.create=e=>{var t;return new GP({checks:[],typeName:Ht.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Sr(e)})};function MUr(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=parseInt(e.toFixed(o).replace(".","")),a=parseInt(t.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}var JR=class e extends xr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==$e.ZodParsedType.number){let i=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(i,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.number,received:i.parsedType}),Q.INVALID}let n,o=new Q.ParseStatus;for(let i of this._def.checks)i.kind==="int"?$e.util.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?MUr(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.not_finite,message:i.message}),o.dirty()):$e.util.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,vt.errorUtil.toString(r))}gt(t,r){return this.setLimit("min",t,!1,vt.errorUtil.toString(r))}lte(t,r){return this.setLimit("max",t,!0,vt.errorUtil.toString(r))}lt(t,r){return this.setLimit("max",t,!1,vt.errorUtil.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:vt.errorUtil.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:vt.errorUtil.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:vt.errorUtil.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:vt.errorUtil.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:vt.errorUtil.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:vt.errorUtil.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:vt.errorUtil.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:vt.errorUtil.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:vt.errorUtil.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:vt.errorUtil.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&$e.util.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};K.ZodNumber=JR;JR.create=e=>new JR({checks:[],typeName:Ht.ZodNumber,coerce:e?.coerce||!1,...Sr(e)});var GR=class e extends xr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==$e.ZodParsedType.bigint)return this._getInvalidInput(t);let n,o=new Q.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):$e.util.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(r,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.bigint,received:r.parsedType}),Q.INVALID}gte(t,r){return this.setLimit("min",t,!0,vt.errorUtil.toString(r))}gt(t,r){return this.setLimit("min",t,!1,vt.errorUtil.toString(r))}lte(t,r){return this.setLimit("max",t,!0,vt.errorUtil.toString(r))}lt(t,r){return this.setLimit("max",t,!1,vt.errorUtil.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:vt.errorUtil.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:vt.errorUtil.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:vt.errorUtil.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:vt.errorUtil.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:vt.errorUtil.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:vt.errorUtil.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};K.ZodBigInt=GR;GR.create=e=>{var t;return new GR({checks:[],typeName:Ht.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Sr(e)})};var KR=class extends xr{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==$e.ZodParsedType.boolean){let n=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.boolean,received:n.parsedType}),Q.INVALID}return(0,Q.OK)(t.data)}};K.ZodBoolean=KR;KR.create=e=>new KR({typeName:Ht.ZodBoolean,coerce:e?.coerce||!1,...Sr(e)});var YR=class e extends xr{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==$e.ZodParsedType.date){let i=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(i,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.date,received:i.parsedType}),Q.INVALID}if(isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(i,{code:Re.ZodIssueCode.invalid_date}),Q.INVALID}let n=new Q.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{code:Re.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),(0,Q.addIssueToContext)(o,{code:Re.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):$e.util.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:vt.errorUtil.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:vt.errorUtil.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};K.ZodDate=YR;YR.create=e=>new YR({checks:[],coerce:e?.coerce||!1,typeName:Ht.ZodDate,...Sr(e)});var Ak=class extends xr{_parse(t){if(this._getType(t)!==$e.ZodParsedType.symbol){let n=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.symbol,received:n.parsedType}),Q.INVALID}return(0,Q.OK)(t.data)}};K.ZodSymbol=Ak;Ak.create=e=>new Ak({typeName:Ht.ZodSymbol,...Sr(e)});var ZR=class extends xr{_parse(t){if(this._getType(t)!==$e.ZodParsedType.undefined){let n=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.undefined,received:n.parsedType}),Q.INVALID}return(0,Q.OK)(t.data)}};K.ZodUndefined=ZR;ZR.create=e=>new ZR({typeName:Ht.ZodUndefined,...Sr(e)});var XR=class extends xr{_parse(t){if(this._getType(t)!==$e.ZodParsedType.null){let n=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.null,received:n.parsedType}),Q.INVALID}return(0,Q.OK)(t.data)}};K.ZodNull=XR;XR.create=e=>new XR({typeName:Ht.ZodNull,...Sr(e)});var KP=class extends xr{constructor(){super(...arguments),this._any=!0}_parse(t){return(0,Q.OK)(t.data)}};K.ZodAny=KP;KP.create=e=>new KP({typeName:Ht.ZodAny,...Sr(e)});var Qx=class extends xr{constructor(){super(...arguments),this._unknown=!0}_parse(t){return(0,Q.OK)(t.data)}};K.ZodUnknown=Qx;Qx.create=e=>new Qx({typeName:Ht.ZodUnknown,...Sr(e)});var Pg=class extends xr{_parse(t){let r=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(r,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.never,received:r.parsedType}),Q.INVALID}};K.ZodNever=Pg;Pg.create=e=>new Pg({typeName:Ht.ZodNever,...Sr(e)});var Rk=class extends xr{_parse(t){if(this._getType(t)!==$e.ZodParsedType.undefined){let n=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.void,received:n.parsedType}),Q.INVALID}return(0,Q.OK)(t.data)}};K.ZodVoid=Rk;Rk.create=e=>new Rk({typeName:Ht.ZodVoid,...Sr(e)});var eC=class e extends xr{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==$e.ZodParsedType.array)return(0,Q.addIssueToContext)(r,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.array,received:r.parsedType}),Q.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,Q.addIssueToContext)(r,{code:a?Re.ZodIssueCode.too_big:Re.ZodIssueCode.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,Q.addIssueToContext)(r,{code:Re.ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&((0,Q.addIssueToContext)(r,{code:Re.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 Kh(r,a,r.path,s)))).then(a=>Q.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Kh(r,a,r.path,s)));return Q.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:vt.errorUtil.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:vt.errorUtil.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:vt.errorUtil.toString(r)}})}nonempty(t){return this.min(1,t)}};K.ZodArray=eC;eC.create=(e,t)=>new eC({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ht.ZodArray,...Sr(t)});function Ik(e){if(e instanceof Ff){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Gh.create(Ik(n))}return new Ff({...e._def,shape:()=>t})}else return e instanceof eC?new eC({...e._def,type:Ik(e.element)}):e instanceof Gh?Gh.create(Ik(e.unwrap())):e instanceof Bw?Bw.create(Ik(e.unwrap())):e instanceof kw?kw.create(e.items.map(t=>Ik(t))):e}var Ff=class e 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 t=this._def.shape(),r=$e.util.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==$e.ZodParsedType.object){let l=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(l,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.object,received:l.parsedType}),Q.INVALID}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Pg&&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 Kh(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Pg){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,Q.addIssueToContext)(o,{code:Re.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 Kh(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=>Q.ParseStatus.mergeObjectSync(n,l)):Q.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return vt.errorUtil.errToObj,new e({...this._def,unknownKeys:"strict",...t!==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=vt.errorUtil.errToObj(t).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ht.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};return $e.util.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new e({...this._def,shape:()=>r})}omit(t){let r={};return $e.util.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new e({...this._def,shape:()=>r})}deepPartial(){return Ik(this)}partial(t){let r={};return $e.util.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}),new e({...this._def,shape:()=>r})}required(t){let r={};return $e.util.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Gh;)i=i._def.innerType;r[n]=i}}),new e({...this._def,shape:()=>r})}keyof(){return Dwt($e.util.objectKeys(this.shape))}};K.ZodObject=Ff;Ff.create=(e,t)=>new Ff({shape:()=>e,unknownKeys:"strip",catchall:Pg.create(),typeName:Ht.ZodObject,...Sr(t)});Ff.strictCreate=(e,t)=>new Ff({shape:()=>e,unknownKeys:"strict",catchall:Pg.create(),typeName:Ht.ZodObject,...Sr(t)});Ff.lazycreate=(e,t)=>new Ff({shape:e,unknownKeys:"strip",catchall:Pg.create(),typeName:Ht.ZodObject,...Sr(t)});var QR=class extends xr{_parse(t){let{ctx:r}=this._processInputParams(t),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 Re.ZodError(s.ctx.common.issues));return(0,Q.addIssueToContext)(r,{code:Re.ZodIssueCode.invalid_union,unionErrors:a}),Q.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 Re.ZodError(u));return(0,Q.addIssueToContext)(r,{code:Re.ZodIssueCode.invalid_union,unionErrors:s}),Q.INVALID}}get options(){return this._def.options}};K.ZodUnion=QR;QR.create=(e,t)=>new QR({options:e,typeName:Ht.ZodUnion,...Sr(t)});var Xx=e=>e instanceof t1?Xx(e.schema):e instanceof Mp?Xx(e.innerType()):e instanceof r1?[e.value]:e instanceof n1?e.options:e instanceof o1?$e.util.objectValues(e.enum):e instanceof i1?Xx(e._def.innerType):e instanceof ZR?[void 0]:e instanceof XR?[null]:e instanceof Gh?[void 0,...Xx(e.unwrap())]:e instanceof Bw?[null,...Xx(e.unwrap())]:e instanceof l3||e instanceof s1?Xx(e.unwrap()):e instanceof a1?Xx(e._def.innerType):[],Bee=class e extends xr{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==$e.ZodParsedType.object)return(0,Q.addIssueToContext)(r,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.object,received:r.parsedType}),Q.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,Q.addIssueToContext)(r,{code:Re.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Q.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=Xx(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:Ht.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Sr(n)})}};K.ZodDiscriminatedUnion=Bee;function FOe(e,t){let r=(0,$e.getParsedType)(e),n=(0,$e.getParsedType)(t);if(e===t)return{valid:!0,data:e};if(r===$e.ZodParsedType.object&&n===$e.ZodParsedType.object){let o=$e.util.objectKeys(t),i=$e.util.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let u=FOe(e[s],t[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===$e.ZodParsedType.array&&n===$e.ZodParsedType.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],u=FOe(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===$e.ZodParsedType.date&&n===$e.ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var e1=class extends xr{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if((0,Q.isAborted)(i)||(0,Q.isAborted)(a))return Q.INVALID;let s=FOe(i.value,a.value);return s.valid?(((0,Q.isDirty)(i)||(0,Q.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.invalid_intersection_types}),Q.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}))}};K.ZodIntersection=e1;e1.create=(e,t,r)=>new e1({left:e,right:t,typeName:Ht.ZodIntersection,...Sr(r)});var kw=class e extends xr{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==$e.ZodParsedType.array)return(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.array,received:n.parsedType}),Q.INVALID;if(n.data.length<this._def.items.length)return(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,Q.addIssueToContext)(n,{code:Re.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 Kh(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Q.ParseStatus.mergeArray(r,a)):Q.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};K.ZodTuple=kw;kw.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new kw({items:e,typeName:Ht.ZodTuple,rest:null,...Sr(t)})};var $ee=class e extends xr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==$e.ZodParsedType.object)return(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.object,received:n.parsedType}),Q.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Kh(n,s,n.path,s)),value:a._parse(new Kh(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Q.ParseStatus.mergeObjectAsync(r,o):Q.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof xr?new e({keyType:t,valueType:r,typeName:Ht.ZodRecord,...Sr(n)}):new e({keyType:GP.create(),valueType:t,typeName:Ht.ZodRecord,...Sr(r)})}};K.ZodRecord=$ee;var Dk=class extends xr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==$e.ZodParsedType.map)return(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.map,received:n.parsedType}),Q.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Kh(n,s,n.path,[l,"key"])),value:i._parse(new Kh(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 Q.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 Q.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};K.ZodMap=Dk;Dk.create=(e,t,r)=>new Dk({valueType:t,keyType:e,typeName:Ht.ZodMap,...Sr(r)});var jk=class e extends xr{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==$e.ZodParsedType.set)return(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.set,received:n.parsedType}),Q.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&((0,Q.addIssueToContext)(n,{code:Re.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 Q.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 Kh(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:vt.errorUtil.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:vt.errorUtil.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};K.ZodSet=jk;jk.create=(e,t)=>new jk({valueType:e,minSize:null,maxSize:null,typeName:Ht.ZodSet,...Sr(t)});var qee=class e extends xr{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==$e.ZodParsedType.function)return(0,Q.addIssueToContext)(r,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.function,received:r.parsedType}),Q.INVALID;function n(s,u){return(0,Q.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Fee.getErrorMap)(),Fee.defaultErrorMap].filter(l=>!!l),issueData:{code:Re.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,Q.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Fee.getErrorMap)(),Fee.defaultErrorMap].filter(l=>!!l),issueData:{code:Re.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof YP){let s=this;return(0,Q.OK)(async function(...u){let l=new Re.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,Q.OK)(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new Re.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 Re.ZodError([o(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:kw.create(t).rest(Qx.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||kw.create([]).rest(Qx.create()),returns:r||Qx.create(),typeName:Ht.ZodFunction,...Sr(n)})}};K.ZodFunction=qee;var t1=class extends xr{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};K.ZodLazy=t1;t1.create=(e,t)=>new t1({getter:e,typeName:Ht.ZodLazy,...Sr(t)});var r1=class extends xr{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(r,{received:r.data,code:Re.ZodIssueCode.invalid_literal,expected:this._def.value}),Q.INVALID}return{status:"valid",value:t.data}}get value(){return this._def.value}};K.ZodLiteral=r1;r1.create=(e,t)=>new r1({value:e,typeName:Ht.ZodLiteral,...Sr(t)});function Dwt(e,t){return new n1({values:e,typeName:Ht.ZodEnum,...Sr(t)})}var n1=class e extends xr{constructor(){super(...arguments),s3.set(this,void 0)}_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return(0,Q.addIssueToContext)(r,{expected:$e.util.joinValues(n),received:r.parsedType,code:Re.ZodIssueCode.invalid_type}),Q.INVALID}if(kee(this,s3,"f")||Mwt(this,s3,new Set(this._def.values),"f"),!kee(this,s3,"f").has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return(0,Q.addIssueToContext)(r,{received:r.data,code:Re.ZodIssueCode.invalid_enum_value,options:n}),Q.INVALID}return(0,Q.OK)(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};K.ZodEnum=n1;s3=new WeakMap;n1.create=Dwt;var o1=class extends xr{constructor(){super(...arguments),u3.set(this,void 0)}_parse(t){let r=$e.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==$e.ZodParsedType.string&&n.parsedType!==$e.ZodParsedType.number){let o=$e.util.objectValues(r);return(0,Q.addIssueToContext)(n,{expected:$e.util.joinValues(o),received:n.parsedType,code:Re.ZodIssueCode.invalid_type}),Q.INVALID}if(kee(this,u3,"f")||Mwt(this,u3,new Set($e.util.getValidEnumValues(this._def.values)),"f"),!kee(this,u3,"f").has(t.data)){let o=$e.util.objectValues(r);return(0,Q.addIssueToContext)(n,{received:n.data,code:Re.ZodIssueCode.invalid_enum_value,options:o}),Q.INVALID}return(0,Q.OK)(t.data)}get enum(){return this._def.values}};K.ZodNativeEnum=o1;u3=new WeakMap;o1.create=(e,t)=>new o1({values:e,typeName:Ht.ZodNativeEnum,...Sr(t)});var YP=class extends xr{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==$e.ZodParsedType.promise&&r.common.async===!1)return(0,Q.addIssueToContext)(r,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.promise,received:r.parsedType}),Q.INVALID;let n=r.parsedType===$e.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,Q.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};K.ZodPromise=YP;YP.create=(e,t)=>new YP({type:e,typeName:Ht.ZodPromise,...Sr(t)});var Mp=class extends xr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ht.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{(0,Q.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 Q.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?Q.INVALID:u.status==="dirty"||r.value==="dirty"?(0,Q.DIRTY)(u.value):u});{if(r.value==="aborted")return Q.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Q.INVALID:s.status==="dirty"||r.value==="dirty"?(0,Q.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"?Q.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"?Q.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,Q.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,Q.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);$e.util.assertNever(o)}};K.ZodEffects=Mp;K.ZodTransformer=Mp;Mp.create=(e,t,r)=>new Mp({schema:e,typeName:Ht.ZodEffects,effect:t,...Sr(r)});Mp.createWithPreprocess=(e,t,r)=>new Mp({schema:t,effect:{type:"preprocess",transform:e},typeName:Ht.ZodEffects,...Sr(r)});var Gh=class extends xr{_parse(t){return this._getType(t)===$e.ZodParsedType.undefined?(0,Q.OK)(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};K.ZodOptional=Gh;Gh.create=(e,t)=>new Gh({innerType:e,typeName:Ht.ZodOptional,...Sr(t)});var Bw=class extends xr{_parse(t){return this._getType(t)===$e.ZodParsedType.null?(0,Q.OK)(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};K.ZodNullable=Bw;Bw.create=(e,t)=>new Bw({innerType:e,typeName:Ht.ZodNullable,...Sr(t)});var i1=class extends xr{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===$e.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};K.ZodDefault=i1;i1.create=(e,t)=>new i1({innerType:e,typeName:Ht.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Sr(t)});var a1=class extends xr{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,Q.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Re.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Re.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};K.ZodCatch=a1;a1.create=(e,t)=>new a1({innerType:e,typeName:Ht.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Sr(t)});var Nk=class extends xr{_parse(t){if(this._getType(t)!==$e.ZodParsedType.nan){let n=this._getOrReturnCtx(t);return(0,Q.addIssueToContext)(n,{code:Re.ZodIssueCode.invalid_type,expected:$e.ZodParsedType.nan,received:n.parsedType}),Q.INVALID}return{status:"valid",value:t.data}}};K.ZodNaN=Nk;Nk.create=e=>new Nk({typeName:Ht.ZodNaN,...Sr(e)});K.BRAND=Symbol("zod_brand");var l3=class extends xr{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};K.ZodBranded=l3;var c3=class e extends xr{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);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"?Q.INVALID:i.status==="dirty"?(r.dirty(),(0,Q.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"?Q.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(t,r){return new e({in:t,out:r,typeName:Ht.ZodPipeline})}};K.ZodPipeline=c3;var s1=class extends xr{_parse(t){let r=this._def.innerType._parse(t),n=o=>((0,Q.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,Q.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};K.ZodReadonly=s1;s1.create=(e,t)=>new s1({innerType:e,typeName:Ht.ZodReadonly,...Sr(t)});function jwt(e,t={},r){return e?KP.create().superRefine((n,o)=>{var i,a;if(!e(n)){let s=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,u=(a=(i=s.fatal)!==null&&i!==void 0?i:r)!==null&&a!==void 0?a:!0,l=typeof s=="string"?{message:s}:s;o.addIssue({code:"custom",...l,fatal:u})}}):KP.create()}K.custom=jwt;K.late={object:Ff.lazycreate};var Ht;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ht||(K.ZodFirstPartyTypeKind=Ht={}));var IUr=(e,t={message:`Input not instance of ${e.name}`})=>jwt(r=>r instanceof e,t);K.instanceof=IUr;var Nwt=GP.create;K.string=Nwt;var Lwt=JR.create;K.number=Lwt;var AUr=Nk.create;K.nan=AUr;var RUr=GR.create;K.bigint=RUr;var Fwt=KR.create;K.boolean=Fwt;var DUr=YR.create;K.date=DUr;var jUr=Ak.create;K.symbol=jUr;var NUr=ZR.create;K.undefined=NUr;var LUr=XR.create;K.null=LUr;var FUr=KP.create;K.any=FUr;var kUr=Qx.create;K.unknown=kUr;var BUr=Pg.create;K.never=BUr;var $Ur=Rk.create;K.void=$Ur;var qUr=eC.create;K.array=qUr;var UUr=Ff.create;K.object=UUr;var zUr=Ff.strictCreate;K.strictObject=zUr;var HUr=QR.create;K.union=HUr;var VUr=Bee.create;K.discriminatedUnion=VUr;var WUr=e1.create;K.intersection=WUr;var JUr=kw.create;K.tuple=JUr;var GUr=$ee.create;K.record=GUr;var KUr=Dk.create;K.map=KUr;var YUr=jk.create;K.set=YUr;var ZUr=qee.create;K.function=ZUr;var XUr=t1.create;K.lazy=XUr;var QUr=r1.create;K.literal=QUr;var ezr=n1.create;K.enum=ezr;var tzr=o1.create;K.nativeEnum=tzr;var rzr=YP.create;K.promise=rzr;var kwt=Mp.create;K.effect=kwt;K.transformer=kwt;var nzr=Gh.create;K.optional=nzr;var ozr=Bw.create;K.nullable=ozr;var izr=Mp.createWithPreprocess;K.preprocess=izr;var azr=c3.create;K.pipeline=azr;var szr=()=>Nwt().optional();K.ostring=szr;var uzr=()=>Lwt().optional();K.onumber=uzr;var lzr=()=>Fwt().optional();K.oboolean=lzr;K.coerce={string:e=>GP.create({...e,coerce:!0}),number:e=>JR.create({...e,coerce:!0}),boolean:e=>KR.create({...e,coerce:!0}),bigint:e=>GR.create({...e,coerce:!0}),date:e=>YR.create({...e,coerce:!0})};K.NEVER=Q.INVALID});var kOe=b(Yh=>{"use strict";var czr=Yh&&Yh.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Lk=Yh&&Yh.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&czr(t,e,r)};Object.defineProperty(Yh,"__esModule",{value:!0});Lk(Nee(),Yh);Lk(NOe(),Yh);Lk(Owt(),Yh);Lk(i3(),Yh);Lk(Bwt(),Yh);Lk(jee(),Yh)});var me=b(kf=>{"use strict";var $wt=kf&&kf.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),dzr=kf&&kf.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),fzr=kf&&kf.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$wt(t,e,r);return dzr(t,e),t},pzr=kf&&kf.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&$wt(t,e,r)};Object.defineProperty(kf,"__esModule",{value:!0});kf.z=void 0;var qwt=fzr(kOe());kf.z=qwt;pzr(kOe(),kf);kf.default=qwt});var qOe=b(Cl=>{"use strict";var hzr=Cl&&Cl.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),mzr=Cl&&Cl.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),gzr=Cl&&Cl.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&hzr(t,e,r);return mzr(t,e),t};Object.defineProperty(Cl,"__esModule",{value:!0});Cl.zodInbound=Cl.zodOutbound=void 0;Cl.bytesToBase64=Uwt;Cl.bytesFromBase64=BOe;Cl.stringToBytes=$Oe;Cl.stringFromBytes=zwt;Cl.stringToBase64=yzr;Cl.stringFromBase64=bzr;var Uee=gzr(me());function Uwt(e){return btoa(String.fromCodePoint(...e))}function BOe(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}function $Oe(e){return new TextEncoder().encode(e)}function zwt(e){return new TextDecoder().decode(e)}function yzr(e){return Uwt($Oe(e))}function bzr(e){return zwt(BOe(e))}Cl.zodOutbound=Uee.instanceof(Uint8Array).or(Uee.string().transform($Oe));Cl.zodInbound=Uee.instanceof(Uint8Array).or(Uee.string().transform(BOe))});var zOe=b(UOe=>{"use strict";Object.defineProperty(UOe,"__esModule",{value:!0});UOe.isPlainObject=_zr;function _zr(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}});var vo=b(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.encodeDeepObjectQuery=En.encodePipeDelimitedQuery=En.encodeSpaceDelimitedQuery=En.encodeFormQuery=En.encodeJSONQuery=En.encodeSimple=En.encodePipeDelimited=En.encodeSpaceDelimited=En.encodeForm=En.EncodingError=void 0;En.encodeMatrix=vzr;En.encodeLabel=wzr;En.encodeBodyForm=Szr;En.encodeDeepObject=Vwt;En.encodeDeepObjectObject=VOe;En.encodeJSON=Wwt;En.queryJoin=Jwt;En.queryEncoder=kk;En.appendForm=Czr;var Hwt=qOe(),Tg=zOe(),d3=class extends Error{constructor(t){super(t),this.name="EncodingError"}};En.EncodingError=d3;function vzr(e,t,r){let n="",o=r?.explode?f3(e,t):[[e,t]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(Fk(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=p3(u,f=>`${a(f)}`)?.join(","):(0,Tg.isPlainObject)(u)?c=Hee(Object.entries(u),([p,h])=>`,${i(p)},${a(h)}`)?.join("").slice(1):c=`${a(u)}`,c==null))return;let d=i(s);l=`${d}=${c}`,l===`${d}=`&&(l=l.slice(0,-1)),l&&(n+=`;${l}`)}),n}function wzr(e,t,r){let n="",o=r?.explode?f3(e,t):[[e,t]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(Fk(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=p3(u,c=>`${a(c)}`)?.join("."):(0,Tg.isPlainObject)(u)?l=Hee(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,Tg.isPlainObject)(t)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function HOe(e){return(t,r,n)=>{let o="",i=n?.explode?f3(t,r):[[t,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(Fk(l)),u=a(e);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=p3(c,p=>`${s(p)}`)?.join(u):(0,Tg.isPlainObject)(c)?f=Hee(Object.entries(c),([p,h])=>`${a(p)}${u}${s(h)}`)?.join(u):f=`${s(c)}`,f!=null&&(d=`${a(l)}=${f}`,!(!d||d==="=")&&(o+=`&${d}`)))}),o.slice(1)}}En.encodeForm=HOe(",");En.encodeSpaceDelimited=HOe(" ");En.encodePipeDelimited=HOe("|");function Szr(e,t,r){let n="",o=r?.explode?f3(e,t):[[e,t]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(Fk(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,Tg.isPlainObject)(u)?c=JSON.stringify(u,zee):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function Vwt(e,t,r){if(t!=null){if(!(0,Tg.isPlainObject)(t))throw new d3(`Value of parameter '${e}' which uses deepObject encoding must be an object or null`);return VOe(e,t,r)}}function VOe(e,t,r){if(t==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,Tg.isPlainObject)(t))throw new d3(`Expected parameter '${e}' to be an object.`);return Object.entries(t).forEach(([i,a])=>{if(a==null)return;let s=`${e}[${i}]`;if((0,Tg.isPlainObject)(a)){let c=VOe(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=p3(u,c=>`${o(s)}=${o(Fk(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function Wwt(e,t,r){if(typeof t>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(t,zee));return r?.explode?o:`${n(e)}=${o}`}var xzr=(e,t,r)=>{let n="",o=r?.explode?f3(e,t):[[e,t]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(Fk(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=p3(u,c=>`${a(c)}`)?.join(","):(0,Tg.isPlainObject)(u)?l=Hee(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,Tg.isPlainObject)(t)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};En.encodeSimple=xzr;function f3(e,t){return Array.isArray(t)?t.map(r=>[e,r]):(0,Tg.isPlainObject)(t)?Object.entries(t??{}).map(([n,o])=>[n,o]):[[e,t]]}function Fk(e){return e==null?"":e instanceof Date?e.toISOString():e instanceof Uint8Array?(0,Hwt.bytesToBase64)(e):typeof e=="object"?JSON.stringify(e,zee):`${e}`}function zee(e,t){return t instanceof Uint8Array?(0,Hwt.bytesToBase64)(t):t}function p3(e,t){let r=e.reduce((n,o)=>{if(o==null)return n;let i=t(o);return i==null||n.push(i),n},[]);return r.length?r:null}function Hee(e,t){let r=[];for(let[n,o]of e){if(o==null)continue;let i=t([n,o]);i!=null&&r.push(i)}return r.length?r:null}function Jwt(...e){return e.filter(Boolean).join("&")}function kk(e){return function(r,n){let o={...n,explode:n?.explode??!0,charEncoding:n?.charEncoding??"percent"},i=Object.entries(r).map(([a,s])=>e(a,s,o));return Jwt(...i)}}En.encodeJSONQuery=kk(Wwt);En.encodeFormQuery=kk(En.encodeForm);En.encodeSpaceDelimitedQuery=kk(En.encodeSpaceDelimited);En.encodePipeDelimitedQuery=kk(En.encodePipeDelimited);En.encodeDeepObjectQuery=kk(Vwt);function Czr(e,t,r,n){r!=null&&(r instanceof Blob&&n?e.append(t,r,n):r instanceof Blob?e.append(t,r):e.append(t,String(r)))}});var Gwt=b(WOe=>{"use strict";Object.defineProperty(WOe,"__esModule",{value:!0});WOe.dlv=Ozr;function Ozr(e,t,r,n,o){for(t=Array.isArray(t)?t:t.split("."),n=0;n<t.length;n++){let i=t[n];e=i!=null&&e?e[i]:o}return e===o?r:e}});var GOe=b(Ip=>{"use strict";var Ezr=Ip&&Ip.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Pzr=Ip&&Ip.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Tzr=Ip&&Ip.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ezr(t,e,r);return Pzr(t,e),t};Object.defineProperty(Ip,"__esModule",{value:!0});Ip.envSchema=void 0;Ip.env=Mzr;Ip.resetEnv=Izr;var Kwt=Gwt(),JOe=Tzr(me());Ip.envSchema=JOe.object({MISTRAL_API_KEY:JOe.string().optional(),MISTRAL_DEBUG:JOe.coerce.boolean().optional()});var h3;function Mzr(){return h3||(h3=Ip.envSchema.parse((0,Kwt.dlv)(globalThis,"process.env")??(0,Kwt.dlv)(globalThis,"Deno.env")??{}),h3)}function Izr(){h3=void 0}});var m3=b($w=>{"use strict";Object.defineProperty($w,"__esModule",{value:!0});$w.HTTPClient=void 0;$w.matchContentType=Zwt;$w.matchStatusCode=Xwt;$w.matchResponse=Dzr;$w.isConnectionError=jzr;$w.isTimeoutError=Nzr;$w.isAbortError=Lzr;var Azr=(e,t)=>t==null?fetch(e):fetch(e,t),KOe=class e{constructor(t={}){this.options=t,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=t.fetcher||Azr}async request(t){let r=t;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(...t){if(t[0]==="beforeRequest")this.requestHooks.push(t[1]);else if(t[0]==="requestError")this.requestErrorHooks.push(t[1]);else if(t[0]==="response")this.responseHooks.push(t[1]);else throw new Error(`Invalid hook type: ${t[0]}`);return this}removeHook(...t){let r;if(t[0]==="beforeRequest")r=this.requestHooks;else if(t[0]==="requestError")r=this.requestErrorHooks;else if(t[0]==="response")r=this.responseHooks;else throw new Error(`Invalid hook type: ${t[0]}`);let n=r.findIndex(o=>o===t[1]);return n>=0&&r.splice(n,1),this}clone(){let t=new e(this.options);return t.requestHooks=this.requestHooks.slice(),t.requestErrorHooks=this.requestErrorHooks.slice(),t.responseHooks=this.responseHooks.slice(),t}};$w.HTTPClient=KOe;var Ywt=/\s*;\s*/g;function Zwt(e,t){if(t==="*")return!0;let r=e.headers.get("content-type")?.trim()||"application/octet-stream";r=r.toLowerCase();let n=t.toLowerCase().trim().split(Ywt),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(Ywt),[s="",...u]=a,[l="",c=""]=s.split("/");if(!l||!c||o!=="*/*"&&s!==o&&`${l}/*`!==o&&`*/${c}`!==o||u.length<i.length)return!1;let d=new Set(u);for(let f of i)if(!d.has(f))return!1;return!0}var Rzr=new RegExp("^[0-9]xx$","i");function Xwt(e,t){let r=`${e.status}`,n=Array.isArray(t)?t:[t];return n.length?n.some(o=>{let i=`${o}`;if(i==="default")return!0;if(!Rzr.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 Dzr(e,t,r){return Xwt(e,t)&&Zwt(e,r)}function jzr(e){if(typeof e!="object"||e==null)return!1;let t=e instanceof TypeError&&e.message.toLowerCase().startsWith("failed to fetch"),r=e instanceof TypeError&&e.message.toLowerCase().startsWith("fetch failed"),n="name"in e&&e.name==="ConnectionError",o="code"in e&&typeof e.code=="string"&&e.code.toLowerCase()==="econnreset";return t||r||o||n}function Nzr(e){if(typeof e!="object"||e==null)return!1;let t="name"in e&&e.name==="TimeoutError",r="code"in e&&e.code===23,n="code"in e&&typeof e.code=="string"&&e.code.toLowerCase()==="econnaborted";return t||r||n}function Lzr(e){if(typeof e!="object"||e==null)return!1;let t="name"in e&&e.name==="AbortError",r="code"in e&&e.code===20,n="code"in e&&typeof e.code=="string"&&e.code.toLowerCase()==="econnaborted";return t||r||n}});var eSt=b(l1=>{"use strict";Object.defineProperty(l1,"__esModule",{value:!0});l1.TemporaryError=l1.PermanentError=void 0;l1.retry=kzr;var Qwt=m3(),Fzr={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},g3=class e extends Error{constructor(t,r){let n=t;r?.cause&&(n+=`: ${r.cause}`),super(n,r),this.name="PermanentError",typeof this.cause>"u"&&(this.cause=r?.cause),Object.setPrototypeOf(this,e.prototype)}};l1.PermanentError=g3;var u1=class e extends Error{constructor(t,r){super(t),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,e.prototype)}};l1.TemporaryError=u1;async function kzr(e,t){switch(t.config.strategy){case"backoff":return Uzr(Bzr(e,{statusCodes:t.statusCodes,retryConnectionErrors:!!t.config.retryConnectionErrors}),t.config.backoff??Fzr);default:return await e()}}function Bzr(e,t){return async()=>{try{let r=await e();if(qzr(r,t.statusCodes))throw new u1("Response failed with retryable status code",r);return r}catch(r){throw r instanceof u1||t.retryConnectionErrors&&((0,Qwt.isTimeoutError)(r)||(0,Qwt.isConnectionError)(r))?r:new g3("Permanent error",{cause:r})}}}var $zr=new RegExp("^[0-9]xx$","i");function qzr(e,t){let r=`${e.status}`;return t.some(n=>{if(!$zr.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 Uzr(e,t){let{maxElapsedTime:r,initialInterval:n,exponent:o,maxInterval:i}=t,a=Date.now(),s=0;for(;;)try{return await e()}catch(u){if(u instanceof g3)throw u.cause;if(Date.now()-a>r){if(u instanceof u1)return u.response;throw u}let c=0;u instanceof u1&&(c=zzr(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await Hzr(d),s++}}function zzr(e){let t=e.headers.get("retry-after")||"";if(!t)return 0;let r=Number(t);if(Number.isInteger(r))return r*1e3;let n=Date.parse(t);if(Number.isInteger(n)){let o=n-Date.now();return o>0?Math.ceil(o):0}return 0}async function Hzr(e){return new Promise(t=>setTimeout(t,e))}});var Ap=b(XP=>{"use strict";var y3=XP&&XP.__classPrivateFieldSet||function(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},Zh=XP&&XP.__classPrivateFieldGet||function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},Wee,qw,tC;Object.defineProperty(XP,"__esModule",{value:!0});XP.ClientSDK=void 0;var tSt=bwt(),Bk=IOe(),ZP=Jh(),Vzr=qOe(),rSt=Iee(),Wzr=vo(),Jzr=GOe(),rC=m3(),Gzr=eSt(),Vee=typeof globalThis>"u"?null:globalThis,Kzr=typeof Vee=="object"&&Vee!=null&&"importScripts"in Vee&&typeof Vee.importScripts=="function",Yzr=Kzr||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",YOe=class{constructor(t={}){Wee.set(this,void 0),qw.set(this,void 0),tC.set(this,void 0);let r=t;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof tSt.SDKHooks?y3(this,qw,r.hooks,"f"):y3(this,qw,new tSt.SDKHooks,"f"),this._options={...t,hooks:Zh(this,qw,"f")};let n=(0,rSt.serverURLFromOptions)(t);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=Zh(this,qw,"f").sdkInit({baseURL:n,client:t.httpClient||new rC.HTTPClient});this._baseURL=o,y3(this,Wee,i,"f"),y3(this,tC,t.debugLogger,"f"),!Zh(this,tC,"f")&&(0,Jzr.env)().MISTRAL_DEBUG&&y3(this,tC,console,"f")}_createRequest(t,r,n){let{method:o,path:i,query:a,headers:s,security:u}=r,l=r.baseURL??this._baseURL;if(!l)return(0,ZP.ERR)(new Bk.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[T,E]of Object.entries(u?.queryParams||{})){let M=(0,Wzr.encodeForm)(T,E,{charEncoding:"percent"});typeof M<"u"&&p.push(M)}if(p.length&&(f+=`&${p.join("&")}`),f){let T=f.startsWith("&")?f.slice(1):f;c.search=`?${T}`}let h=new Headers(s),m=u?.basic.username,_=u?.basic.password;if(m!=null||_!=null){let T=(0,Vzr.stringToBase64)([m||"",_||""].join(":"));h.set("Authorization",`Basic ${T}`)}let g=new Headers(u?.headers||{});for(let[T,E]of g)h.set(T,E);let v=h.get("cookie")||"";for(let[T,E]of Object.entries(u?.cookies||{}))v+=`; ${T}=${E}`;v=v.startsWith("; ")?v.slice(2):v,h.set("cookie",v);let S=new Headers(n?.fetchOptions?.headers);for(let[T,E]of S)h.set(T,E);Yzr||h.set(r.uaHeader??"user-agent",rSt.SDK_METADATA.userAgent);let x=n?.fetchOptions;if(!x?.signal&&r.timeoutMs&&r.timeoutMs>0){let T=AbortSignal.timeout(r.timeoutMs);x?x.signal=T:x={signal:T}}r.body instanceof ReadableStream&&(x?x.duplex="half":x={duplex:"half"});let O;try{O=Zh(this,qw,"f").beforeCreateRequest(t,{url:c,options:{...x,body:r.body??null,headers:h,method:o}})}catch(T){return(0,ZP.ERR)(new Bk.UnexpectedClientError("Create request hook failed to execute",{cause:T}))}return(0,ZP.OK)(new Request(O.url,O.options))}async _do(t,r){let{context:n,errorCodes:o}=r;return(0,Gzr.retry)(async()=>{let i=await Zh(this,qw,"f").beforeRequest(n,t.clone());await Zzr(Zh(this,tC,"f"),i).catch(s=>Zh(this,tC,"f")?.log("Failed to log request:",s));let a=await Zh(this,Wee,"f").request(i);try{if((0,rC.matchStatusCode)(a,o)){let s=await Zh(this,qw,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await Zh(this,qw,"f").afterSuccess(n,a)}finally{await Xzr(Zh(this,tC,"f"),a,i).catch(s=>Zh(this,tC,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,ZP.OK)(i),i=>{switch(!0){case(0,rC.isAbortError)(i):return(0,ZP.ERR)(new Bk.RequestAbortedError("Request aborted by client",{cause:i}));case(0,rC.isTimeoutError)(i):return(0,ZP.ERR)(new Bk.RequestTimeoutError("Request timed out",{cause:i}));case(0,rC.isConnectionError)(i):return(0,ZP.ERR)(new Bk.ConnectionError("Unable to make request",{cause:i}));default:return(0,ZP.ERR)(new Bk.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};XP.ClientSDK=YOe;Wee=new WeakMap,qw=new WeakMap,tC=new WeakMap;var nSt=/^application\/(?:.{0,100}\+)?json/;async function Zzr(e,t){if(!e)return;let r=t.headers.get("content-type"),n=r?.split(";")[0]||"";e.group(`> Request: ${t.method} ${t.url}`),e.group("Headers:");for(let[o,i]of t.headers.entries())e.log(`${o}: ${i}`);switch(e.groupEnd(),e.group("Body:"),!0){case nSt.test(n):e.log(await t.clone().json());break;case n.startsWith("text/"):e.log(await t.clone().text());break;case n==="multipart/form-data":{let o=await t.clone().formData();for(let[i,a]of o){let s=a instanceof Blob?"<Blob>":a;e.log(`${i}: ${s}`)}break}default:e.log(`<${r}>`);break}e.groupEnd(),e.groupEnd()}async function Xzr(e,t,r){if(!e)return;let n=t.headers.get("content-type"),o=n?.split(";")[0]||"";e.group(`< Response: ${r.method} ${r.url}`),e.log("Status Code:",t.status,t.statusText),e.group("Headers:");for(let[i,a]of t.headers.entries())e.log(`${i}: ${a}`);switch(e.groupEnd(),e.group("Body:"),!0){case((0,rC.matchContentType)(t,"application/json")||nSt.test(o)):e.log(await t.clone().json());break;case(0,rC.matchContentType)(t,"text/event-stream"):e.log(`<${n}>`);break;case(0,rC.matchContentType)(t,"text/*"):e.log(await t.clone().text());break;case(0,rC.matchContentType)(t,"multipart/form-data"):{let i=await t.clone().formData();for(let[a,s]of i){let u=s instanceof Blob?"<Blob>":s;e.log(`${a}: ${u}`)}break}default:e.log(`<${n}>`);break}e.groupEnd(),e.groupEnd()}});var XOe=b(Jee=>{"use strict";Object.defineProperty(Jee,"__esModule",{value:!0});Jee.SDKError=void 0;var ZOe=class extends Error{constructor(t,r,n=""){let o=r.status,i=r.headers.get("content-type")||"",a=n.length>0?`
${n}`:"";super(`${t}: Status ${o} Content-Type ${i} Body ${a}`),this.rawResponse=r,this.body=n,this.statusCode=o,this.contentType=i,this.name="SDKError"}};Jee.SDKError=ZOe});var w3=b(v3=>{"use strict";Object.defineProperty(v3,"__esModule",{value:!0});v3.EventStream=void 0;v3.discardSentinel=t2r;var b3=10,_3=13,oSt=new Set([b3,_3]),Qzr=[new Uint8Array([_3,b3,_3,b3]),new Uint8Array([_3,_3]),new Uint8Array([b3,b3])],QOe=class{constructor(t){this.stream=t.stream,this.decoder=t.decoder}async*[Symbol.asyncIterator](){let t=this.stream.getReader(),r=new Uint8Array([]),n=0;try{for(;;){let{done:o,value:i}=await t.read();if(o)break;let a=new Uint8Array(r.length+i.length);a.set(r),a.set(i,r.length),r=a;for(let s=n;s<r.length;s++){let u=iSt(r,s);if(u==null)continue;let l=r.slice(n,s);n=s+u.length;let c=eEe(l,this.decoder);c!=null&&(yield c)}n>0&&(r=r.slice(n),n=0)}if(r.length>0){let o=eEe(r,this.decoder);o!=null&&(yield o)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{t.releaseLock()}}};v3.EventStream=QOe;function iSt(e,t){let r=e[t],n=e[t+1];if(r==null||n==null||!oSt.has(r)||!oSt.has(n))return null;for(let o of Qzr){let i=e2r(t,e,o);if(i!=null)return i}return null}function e2r(e,t,r){if(r.length>t.length-e)return null;for(let n=0;n<r.length;n++)if(t[e+n]!==r[n])return null;return r}function eEe(e,t){if(!e.length)return null;let o=new TextDecoder().decode(e).split(/\r?\n|\r/g),i=!1,a={};for(let s of o){if(!s)continue;let u=s.indexOf(":");if(u===0)continue;let l=u>0?s.substring(0,u):"",c=u>0?s.substring(u+1):"";switch(c.charAt(0)===" "&&(c=c.substring(1)),l){case"event":{i=!0,a.event=c;break}case"data":{i=!0,a.data??(a.data=""),a.data+=c+`
`;break}case"id":{i=!0,a.id=c;break}case"retry":{let d=parseInt(c,10);Number.isNaN(d)||(i=!0,a.retry=d);break}}}return i?(a.data!=null&&(a.data=a.data.slice(0,-1)),t(a)):null}function t2r(e,t){return new ReadableStream({async start(r){let n=new Uint8Array([]),o=0,i=!1,a=!1,s=e.getReader();try{for(;!i;){let u=await s.read(),l=u.value;if(i=i||u.done,a||typeof l>"u")continue;let c=new Uint8Array(n.length+l.length);c.set(n),c.set(l,n.length),n=c;for(let d=o;d<n.length;d++){let f=iSt(n,d);if(f==null)continue;let p=o,h=n.slice(p,d);o=d+f.length,eEe(h,r2r)?.data===t?(r.enqueue(n.slice(0,p)),a=!0):(r.enqueue(n.slice(0,o)),n=n.slice(o),o=0)}}}catch(u){r.error(u)}finally{r.close(),s.releaseLock()}}})}function r2r(e){return e}});var nEe=b(Mg=>{"use strict";var n2r=Mg&&Mg.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),o2r=Mg&&Mg.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i2r=Mg&&Mg.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&n2r(t,e,r);return o2r(t,e),t};Object.defineProperty(Mg,"__esModule",{value:!0});Mg.SDKValidationError=void 0;Mg.formatZodError=rEe;var a2r=i2r(me()),tEe=class extends Error{constructor(t,r,n){super(`${t}: ${r}`),this.name="SDKValidationError",this.cause=r,this.rawValue=n,this.rawMessage=t}pretty(){return this.cause instanceof a2r.ZodError?`${this.rawMessage}
${rEe(this.cause)}`:this.toString()}};Mg.SDKValidationError=tEe;function rEe(e,t=0){let r=" ".repeat(t);r=t>0?`\u2502${r}`:r,r+=" ".repeat(t);let n="",o=s=>n+=`
${r}${s}`,i=e.issues.length,a=i===1?`${i} issue found`:`${i} issues found`;i&&o(`\u250C ${a}:`);for(let s of e.issues){let u=s.path.join(".");switch(u=u?`<root>.${u}`:"<root>",o(`\u2502 \u2022 [${u}]: ${s.message} (${s.code})`),s.code){case"invalid_literal":case"invalid_type":{o(`\u2502 Want: ${s.expected}`),o(`\u2502 Got: ${s.received}`);break}case"unrecognized_keys":{o(`\u2502 Keys: ${s.keys.join(", ")}`);break}case"invalid_enum_value":{o(`\u2502 Allowed: ${s.options.join(", ")}`),o(`\u2502 Got: ${s.received}`);break}case"invalid_union_discriminator":{o(`\u2502 Allowed: ${s.options.join(", ")}`);break}case"invalid_union":{let l=s.unionErrors.length;o(`\u2502 \u2716\uFE0E Attemped to deserialize into one of ${l} union members:`),s.unionErrors.forEach((c,d)=>{o(`\u2502 \u2716\uFE0E Member ${d+1} of ${l}`),o(`${rEe(c,t+1)}`)})}}}return e.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var ce=b(S3=>{"use strict";Object.defineProperty(S3,"__esModule",{value:!0});S3.parse=u2r;S3.safeParse=l2r;S3.collectExtraKeys=c2r;var s2r=me(),sSt=nEe(),aSt=Jh();function u2r(e,t,r){try{return t(e)}catch(n){throw n instanceof s2r.ZodError?new sSt.SDKValidationError(r,n,e):n}}function l2r(e,t,r){try{return(0,aSt.OK)(t(e))}catch(n){return(0,aSt.ERR)(new sSt.SDKValidationError(r,n,e))}}function c2r(e,t,r){return e.transform(n=>{let o={},{shape:i}=e;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,[t]:o}})}});var wo=b(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.jsonErr=p2r;Ol.json=h2r;Ol.textErr=m2r;Ol.text=g2r;Ol.bytesErr=y2r;Ol.bytes=b2r;Ol.streamErr=_2r;Ol.stream=v2r;Ol.sseErr=w2r;Ol.sse=S2r;Ol.nilErr=x2r;Ol.nil=C2r;Ol.fail=O2r;Ol.match=E2r;Ol.unpackHeaders=Gee;Ol.discardResponseBody=fSt;var uSt=XOe(),d2r=w3(),lSt=m3(),cSt=zOe(),dSt=ce(),f2r={json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function p2r(e,t,r){return{...r,err:!0,enc:"json",codes:e,schema:t}}function h2r(e,t,r){return{...r,enc:"json",codes:e,schema:t}}function m2r(e,t,r){return{...r,err:!0,enc:"text",codes:e,schema:t}}function g2r(e,t,r){return{...r,enc:"text",codes:e,schema:t}}function y2r(e,t,r){return{...r,err:!0,enc:"bytes",codes:e,schema:t}}function b2r(e,t,r){return{...r,enc:"bytes",codes:e,schema:t}}function _2r(e,t,r){return{...r,err:!0,enc:"stream",codes:e,schema:t}}function v2r(e,t,r){return{...r,enc:"stream",codes:e,schema:t}}function w2r(e,t,r){return{...r,err:!0,enc:"sse",codes:e,schema:t}}function S2r(e,t,r){return{...r,enc:"sse",codes:e,schema:t}}function x2r(e,t,r){return{...r,err:!0,enc:"nil",codes:e,schema:t}}function C2r(e,t,r){return{...r,enc:"nil",codes:e,schema:t}}function O2r(e){return{enc:"fail",codes:e}}function E2r(...e){return async function(r,n){let o,i;for(let l of e){let{codes:c}=l,d="ctype"in l?l.ctype:f2r[l.enc];if(d&&(0,lSt.matchResponse)(r,c,d)){i=l;break}else if(!d&&(0,lSt.matchStatusCode)(r,c)){i=l;break}}if(!i){let l=await r.text();return[{ok:!1,error:new uSt.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,d2r.discardSentinel)(r.body,i.sseSentinel):r.body;break;case"nil":o=await fSt(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 uSt.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:Gee(r.headers)}:null,...(0,cSt.isPlainObject)(o)?o:null}:s?u={...n?.extraFields,...i.hdrs?{Headers:Gee(r.headers)}:null,[s]:o}:i.hdrs?u={...n?.extraFields,...i.hdrs?{Headers:Gee(r.headers)}:null,...(0,cSt.isPlainObject)(o)?o:null}:u=o,"err"in i){let l=(0,dSt.safeParse)(u,c=>i.schema.parse(c),"Response validation failed");return[l.ok?{ok:!1,error:l.value}:l,o]}else return[(0,dSt.safeParse)(u,l=>i.schema.parse(l),"Response validation failed"),o]}}var P2r=/, */;function Gee(e){let t={};for(let[r,n]of e.entries())t[r]=n.split(P2r);return t}async function fSt(e){let t=e.body?.getReader();if(t!=null)try{let r=!1;for(;!r;)r=(await t.read()).done}finally{t.releaseLock()}}});var Oe=b(c1=>{"use strict";Object.defineProperty(c1,"__esModule",{value:!0});c1.invariant=T2r;c1.remap=M2r;c1.combineSignals=I2r;c1.abortSignalAny=pSt;c1.compactMap=A2r;var oEe=class extends Error{constructor(t){super(t),this.name="InvariantError"}};function T2r(e,t){if(!e)throw new oEe(t)}function M2r(e,t){let r={};if(!Object.keys(t).length)return r=e,r;for(let[n,o]of Object.entries(e)){let i=t[n];i!==null&&(r[i??n]=o)}return r}function I2r(...e){let t=[];for(let r of e)r&&t.push(r);switch(t.length){case 0:case 1:return t[0]||null;default:return"any"in AbortSignal&&typeof AbortSignal.any=="function"?AbortSignal.any(t):pSt(t)}}function pSt(e){let t=new AbortController,r=t.signal;if(!e.length)return t.signal;if(e.length===1)return e[0]||t.signal;for(let a of e)if(a.aborted)return a;function n(){t.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 e)o.push(new WeakRef(a)),a.addEventListener("abort",n);return r}function A2r(e){let t={};for(let[r,n]of Object.entries(e))typeof n<"u"&&(t[r]=n);return t}});var So=b(nC=>{"use strict";Object.defineProperty(nC,"__esModule",{value:!0});nC.SecurityError=nC.SecurityErrorCode=void 0;nC.resolveSecurity=hSt;nC.resolveGlobalSecurity=j2r;nC.extractSecurity=N2r;var R2r=GOe(),Yee;(function(e){e.Incomplete="incomplete",e.UnrecognisedSecurityType="unrecognized_security_type"})(Yee||(nC.SecurityErrorCode=Yee={}));var Zee=class e extends Error{constructor(t,r){super(r),this.code=t,this.name="SecurityError"}static incomplete(){return new e(Yee.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(t){return new e(Yee.UnrecognisedSecurityType,`Unrecognised security type: ${t}`)}};nC.SecurityError=Zee;function hSt(...e){let t={basic:{},headers:{},queryParams:{},cookies:{},oauth2:{type:"none"}},r=e.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":t.headers[n.fieldName]=n.value;break;case"apiKey:query":t.queryParams[n.fieldName]=n.value;break;case"apiKey:cookie":t.cookies[n.fieldName]=n.value;break;case"http:basic":D2r(t,n);break;case"http:custom":break;case"http:bearer":Kee(t,n);break;case"oauth2":Kee(t,n);break;case"oauth2:password":Kee(t,n);break;case"oauth2:client_credentials":break;case"openIdConnect":Kee(t,n);break;default:throw Zee.unrecognizedType(o)}}),t)}function D2r(e,t){t.value!=null&&(e.basic=t.value)}function Kee(e,t){if(typeof t.value!="string"||!t.value)return;let r=t.value;r.slice(0,7).toLowerCase()!=="bearer "&&(r=`Bearer ${r}`),e.headers[t.fieldName]=r}function j2r(e){return hSt([{fieldName:"Authorization",type:"http:bearer",value:e?.apiKey??(0,R2r.env)().MISTRAL_API_KEY}])}async function N2r(e){if(e!=null)return typeof e=="function"?e():e}});var iEe=b(ys=>{"use strict";var L2r=ys&&ys.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),F2r=ys&&ys.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),k2r=ys&&ys.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&L2r(t,e,r);return F2r(t,e),t};Object.defineProperty(ys,"__esModule",{value:!0});ys.ImageURL$=ys.ImageURL$outboundSchema=ys.ImageURL$inboundSchema=void 0;ys.imageURLToJSON=$2r;ys.imageURLFromJSON=q2r;var QP=k2r(me()),B2r=ce();ys.ImageURL$inboundSchema=QP.object({url:QP.string(),detail:QP.nullable(QP.string()).optional()});ys.ImageURL$outboundSchema=QP.object({url:QP.string(),detail:QP.nullable(QP.string()).optional()});var mSt;(function(e){e.inboundSchema=ys.ImageURL$inboundSchema,e.outboundSchema=ys.ImageURL$outboundSchema})(mSt||(ys.ImageURL$=mSt={}));function $2r(e){return JSON.stringify(ys.ImageURL$outboundSchema.parse(e))}function q2r(e){return(0,B2r.safeParse)(e,t=>ys.ImageURL$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ImageURL' from JSON")}});var aEe=b(Zt=>{"use strict";var U2r=Zt&&Zt.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),z2r=Zt&&Zt.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),H2r=Zt&&Zt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&U2r(t,e,r);return z2r(t,e),t};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.ImageURLChunk$=Zt.ImageURLChunk$outboundSchema=Zt.ImageURLChunk$inboundSchema=Zt.ImageURLChunkType$=Zt.ImageURLChunkType$outboundSchema=Zt.ImageURLChunkType$inboundSchema=Zt.ImageURLChunkImageURL$=Zt.ImageURLChunkImageURL$outboundSchema=Zt.ImageURLChunkImageURL$inboundSchema=Zt.ImageURLChunkType=void 0;Zt.imageURLChunkImageURLToJSON=V2r;Zt.imageURLChunkImageURLFromJSON=W2r;Zt.imageURLChunkToJSON=J2r;Zt.imageURLChunkFromJSON=G2r;var Ig=H2r(me()),_St=Oe(),vSt=ce(),Xee=iEe();Zt.ImageURLChunkType={ImageUrl:"image_url"};Zt.ImageURLChunkImageURL$inboundSchema=Ig.union([Xee.ImageURL$inboundSchema,Ig.string()]);Zt.ImageURLChunkImageURL$outboundSchema=Ig.union([Xee.ImageURL$outboundSchema,Ig.string()]);var gSt;(function(e){e.inboundSchema=Zt.ImageURLChunkImageURL$inboundSchema,e.outboundSchema=Zt.ImageURLChunkImageURL$outboundSchema})(gSt||(Zt.ImageURLChunkImageURL$=gSt={}));function V2r(e){return JSON.stringify(Zt.ImageURLChunkImageURL$outboundSchema.parse(e))}function W2r(e){return(0,vSt.safeParse)(e,t=>Zt.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}Zt.ImageURLChunkType$inboundSchema=Ig.nativeEnum(Zt.ImageURLChunkType);Zt.ImageURLChunkType$outboundSchema=Zt.ImageURLChunkType$inboundSchema;var ySt;(function(e){e.inboundSchema=Zt.ImageURLChunkType$inboundSchema,e.outboundSchema=Zt.ImageURLChunkType$outboundSchema})(ySt||(Zt.ImageURLChunkType$=ySt={}));Zt.ImageURLChunk$inboundSchema=Ig.object({image_url:Ig.union([Xee.ImageURL$inboundSchema,Ig.string()]),type:Zt.ImageURLChunkType$inboundSchema.default("image_url")}).transform(e=>(0,_St.remap)(e,{image_url:"imageUrl"}));Zt.ImageURLChunk$outboundSchema=Ig.object({imageUrl:Ig.union([Xee.ImageURL$outboundSchema,Ig.string()]),type:Zt.ImageURLChunkType$outboundSchema.default("image_url")}).transform(e=>(0,_St.remap)(e,{imageUrl:"image_url"}));var bSt;(function(e){e.inboundSchema=Zt.ImageURLChunk$inboundSchema,e.outboundSchema=Zt.ImageURLChunk$outboundSchema})(bSt||(Zt.ImageURLChunk$=bSt={}));function J2r(e){return JSON.stringify(Zt.ImageURLChunk$outboundSchema.parse(e))}function G2r(e){return(0,vSt.safeParse)(e,t=>Zt.ImageURLChunk$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ImageURLChunk' from JSON")}});var sEe=b(Pn=>{"use strict";var K2r=Pn&&Pn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Y2r=Pn&&Pn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Z2r=Pn&&Pn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&K2r(t,e,r);return Y2r(t,e),t};Object.defineProperty(Pn,"__esModule",{value:!0});Pn.ReferenceChunk$=Pn.ReferenceChunk$outboundSchema=Pn.ReferenceChunk$inboundSchema=Pn.ReferenceChunkType$=Pn.ReferenceChunkType$outboundSchema=Pn.ReferenceChunkType$inboundSchema=Pn.ReferenceChunkType=void 0;Pn.referenceChunkToJSON=Q2r;Pn.referenceChunkFromJSON=e4r;var d1=Z2r(me()),xSt=Oe(),X2r=ce();Pn.ReferenceChunkType={Reference:"reference"};Pn.ReferenceChunkType$inboundSchema=d1.nativeEnum(Pn.ReferenceChunkType);Pn.ReferenceChunkType$outboundSchema=Pn.ReferenceChunkType$inboundSchema;var wSt;(function(e){e.inboundSchema=Pn.ReferenceChunkType$inboundSchema,e.outboundSchema=Pn.ReferenceChunkType$outboundSchema})(wSt||(Pn.ReferenceChunkType$=wSt={}));Pn.ReferenceChunk$inboundSchema=d1.object({reference_ids:d1.array(d1.number().int()),type:Pn.ReferenceChunkType$inboundSchema.default("reference")}).transform(e=>(0,xSt.remap)(e,{reference_ids:"referenceIds"}));Pn.ReferenceChunk$outboundSchema=d1.object({referenceIds:d1.array(d1.number().int()),type:Pn.ReferenceChunkType$outboundSchema.default("reference")}).transform(e=>(0,xSt.remap)(e,{referenceIds:"reference_ids"}));var SSt;(function(e){e.inboundSchema=Pn.ReferenceChunk$inboundSchema,e.outboundSchema=Pn.ReferenceChunk$outboundSchema})(SSt||(Pn.ReferenceChunk$=SSt={}));function Q2r(e){return JSON.stringify(Pn.ReferenceChunk$outboundSchema.parse(e))}function e4r(e){return(0,X2r.safeParse)(e,t=>Pn.ReferenceChunk$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ReferenceChunk' from JSON")}});var Qee=b(Tn=>{"use strict";var t4r=Tn&&Tn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),r4r=Tn&&Tn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n4r=Tn&&Tn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&t4r(t,e,r);return r4r(t,e),t};Object.defineProperty(Tn,"__esModule",{value:!0});Tn.TextChunk$=Tn.TextChunk$outboundSchema=Tn.TextChunk$inboundSchema=Tn.TextChunkType$=Tn.TextChunkType$outboundSchema=Tn.TextChunkType$inboundSchema=Tn.TextChunkType=void 0;Tn.textChunkToJSON=i4r;Tn.textChunkFromJSON=a4r;var x3=n4r(me()),o4r=ce();Tn.TextChunkType={Text:"text"};Tn.TextChunkType$inboundSchema=x3.nativeEnum(Tn.TextChunkType);Tn.TextChunkType$outboundSchema=Tn.TextChunkType$inboundSchema;var CSt;(function(e){e.inboundSchema=Tn.TextChunkType$inboundSchema,e.outboundSchema=Tn.TextChunkType$outboundSchema})(CSt||(Tn.TextChunkType$=CSt={}));Tn.TextChunk$inboundSchema=x3.object({text:x3.string(),type:Tn.TextChunkType$inboundSchema.default("text")});Tn.TextChunk$outboundSchema=x3.object({text:x3.string(),type:Tn.TextChunkType$outboundSchema.default("text")});var OSt;(function(e){e.inboundSchema=Tn.TextChunk$inboundSchema,e.outboundSchema=Tn.TextChunk$outboundSchema})(OSt||(Tn.TextChunk$=OSt={}));function i4r(e){return JSON.stringify(Tn.TextChunk$outboundSchema.parse(e))}function a4r(e){return(0,o4r.safeParse)(e,t=>Tn.TextChunk$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'TextChunk' from JSON")}});var $k=b(bs=>{"use strict";var s4r=bs&&bs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),u4r=bs&&bs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l4r=bs&&bs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&s4r(t,e,r);return u4r(t,e),t};Object.defineProperty(bs,"__esModule",{value:!0});bs.ContentChunk$=bs.ContentChunk$outboundSchema=bs.ContentChunk$inboundSchema=void 0;bs.contentChunkToJSON=d4r;bs.contentChunkFromJSON=f4r;var Bf=l4r(me()),c4r=ce(),PSt=aEe(),TSt=sEe(),MSt=Qee();bs.ContentChunk$inboundSchema=Bf.union([PSt.ImageURLChunk$inboundSchema.and(Bf.object({type:Bf.literal("image_url")}).transform(e=>({type:e.type}))),MSt.TextChunk$inboundSchema.and(Bf.object({type:Bf.literal("text")}).transform(e=>({type:e.type}))),TSt.ReferenceChunk$inboundSchema.and(Bf.object({type:Bf.literal("reference")}).transform(e=>({type:e.type})))]);bs.ContentChunk$outboundSchema=Bf.union([PSt.ImageURLChunk$outboundSchema.and(Bf.object({type:Bf.literal("image_url")}).transform(e=>({type:e.type}))),MSt.TextChunk$outboundSchema.and(Bf.object({type:Bf.literal("text")}).transform(e=>({type:e.type}))),TSt.ReferenceChunk$outboundSchema.and(Bf.object({type:Bf.literal("reference")}).transform(e=>({type:e.type})))]);var ESt;(function(e){e.inboundSchema=bs.ContentChunk$inboundSchema,e.outboundSchema=bs.ContentChunk$outboundSchema})(ESt||(bs.ContentChunk$=ESt={}));function d4r(e){return JSON.stringify(bs.ContentChunk$outboundSchema.parse(e))}function f4r(e){return(0,c4r.safeParse)(e,t=>bs.ContentChunk$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ContentChunk' from JSON")}});var uEe=b(Vn=>{"use strict";var p4r=Vn&&Vn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),h4r=Vn&&Vn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),m4r=Vn&&Vn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&p4r(t,e,r);return h4r(t,e),t};Object.defineProperty(Vn,"__esModule",{value:!0});Vn.FunctionCall$=Vn.FunctionCall$outboundSchema=Vn.FunctionCall$inboundSchema=Vn.Arguments$=Vn.Arguments$outboundSchema=Vn.Arguments$inboundSchema=void 0;Vn.argumentsToJSON=g4r;Vn.argumentsFromJSON=y4r;Vn.functionCallToJSON=b4r;Vn.functionCallFromJSON=_4r;var _s=m4r(me()),RSt=ce();Vn.Arguments$inboundSchema=_s.union([_s.record(_s.any()),_s.string()]);Vn.Arguments$outboundSchema=_s.union([_s.record(_s.any()),_s.string()]);var ISt;(function(e){e.inboundSchema=Vn.Arguments$inboundSchema,e.outboundSchema=Vn.Arguments$outboundSchema})(ISt||(Vn.Arguments$=ISt={}));function g4r(e){return JSON.stringify(Vn.Arguments$outboundSchema.parse(e))}function y4r(e){return(0,RSt.safeParse)(e,t=>Vn.Arguments$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Arguments' from JSON")}Vn.FunctionCall$inboundSchema=_s.object({name:_s.string(),arguments:_s.union([_s.record(_s.any()),_s.string()])});Vn.FunctionCall$outboundSchema=_s.object({name:_s.string(),arguments:_s.union([_s.record(_s.any()),_s.string()])});var ASt;(function(e){e.inboundSchema=Vn.FunctionCall$inboundSchema,e.outboundSchema=Vn.FunctionCall$outboundSchema})(ASt||(Vn.FunctionCall$=ASt={}));function b4r(e){return JSON.stringify(Vn.FunctionCall$outboundSchema.parse(e))}function _4r(e){return(0,RSt.safeParse)(e,t=>Vn.FunctionCall$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FunctionCall' from JSON")}});var eT=b(lEe=>{"use strict";Object.defineProperty(lEe,"__esModule",{value:!0});lEe.catchUnrecognizedEnum=v4r;function v4r(e){return e}});var C3=b(vs=>{"use strict";var w4r=vs&&vs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),S4r=vs&&vs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),x4r=vs&&vs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&w4r(t,e,r);return S4r(t,e),t};Object.defineProperty(vs,"__esModule",{value:!0});vs.ToolTypes$=vs.ToolTypes$outboundSchema=vs.ToolTypes$inboundSchema=vs.ToolTypes=void 0;var f1=x4r(me()),C4r=eT();vs.ToolTypes={Function:"function"};vs.ToolTypes$inboundSchema=f1.union([f1.nativeEnum(vs.ToolTypes),f1.string().transform(C4r.catchUnrecognizedEnum)]);vs.ToolTypes$outboundSchema=f1.union([f1.nativeEnum(vs.ToolTypes),f1.string().and(f1.custom())]);var DSt;(function(e){e.inboundSchema=vs.ToolTypes$inboundSchema,e.outboundSchema=vs.ToolTypes$outboundSchema})(DSt||(vs.ToolTypes$=DSt={}))});var ete=b(ws=>{"use strict";var O4r=ws&&ws.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),E4r=ws&&ws.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),P4r=ws&&ws.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&O4r(t,e,r);return E4r(t,e),t};Object.defineProperty(ws,"__esModule",{value:!0});ws.ToolCall$=ws.ToolCall$outboundSchema=ws.ToolCall$inboundSchema=void 0;ws.toolCallToJSON=M4r;ws.toolCallFromJSON=I4r;var qk=P4r(me()),T4r=ce(),NSt=uEe(),LSt=C3();ws.ToolCall$inboundSchema=qk.object({id:qk.string().default("null"),type:LSt.ToolTypes$inboundSchema.optional(),function:NSt.FunctionCall$inboundSchema,index:qk.number().int().default(0)});ws.ToolCall$outboundSchema=qk.object({id:qk.string().default("null"),type:LSt.ToolTypes$outboundSchema.optional(),function:NSt.FunctionCall$outboundSchema,index:qk.number().int().default(0)});var jSt;(function(e){e.inboundSchema=ws.ToolCall$inboundSchema,e.outboundSchema=ws.ToolCall$outboundSchema})(jSt||(ws.ToolCall$=jSt={}));function M4r(e){return JSON.stringify(ws.ToolCall$outboundSchema.parse(e))}function I4r(e){return(0,T4r.safeParse)(e,t=>ws.ToolCall$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ToolCall' from JSON")}});var tT=b(Xt=>{"use strict";var A4r=Xt&&Xt.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),R4r=Xt&&Xt.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),D4r=Xt&&Xt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&A4r(t,e,r);return R4r(t,e),t};Object.defineProperty(Xt,"__esModule",{value:!0});Xt.AssistantMessage$=Xt.AssistantMessage$outboundSchema=Xt.AssistantMessage$inboundSchema=Xt.AssistantMessageRole$=Xt.AssistantMessageRole$outboundSchema=Xt.AssistantMessageRole$inboundSchema=Xt.AssistantMessageContent$=Xt.AssistantMessageContent$outboundSchema=Xt.AssistantMessageContent$inboundSchema=Xt.AssistantMessageRole=void 0;Xt.assistantMessageContentToJSON=j4r;Xt.assistantMessageContentFromJSON=N4r;Xt.assistantMessageToJSON=L4r;Xt.assistantMessageFromJSON=F4r;var ga=D4r(me()),$St=Oe(),qSt=ce(),tte=$k(),USt=ete();Xt.AssistantMessageRole={Assistant:"assistant"};Xt.AssistantMessageContent$inboundSchema=ga.union([ga.string(),ga.array(tte.ContentChunk$inboundSchema)]);Xt.AssistantMessageContent$outboundSchema=ga.union([ga.string(),ga.array(tte.ContentChunk$outboundSchema)]);var FSt;(function(e){e.inboundSchema=Xt.AssistantMessageContent$inboundSchema,e.outboundSchema=Xt.AssistantMessageContent$outboundSchema})(FSt||(Xt.AssistantMessageContent$=FSt={}));function j4r(e){return JSON.stringify(Xt.AssistantMessageContent$outboundSchema.parse(e))}function N4r(e){return(0,qSt.safeParse)(e,t=>Xt.AssistantMessageContent$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'AssistantMessageContent' from JSON")}Xt.AssistantMessageRole$inboundSchema=ga.nativeEnum(Xt.AssistantMessageRole);Xt.AssistantMessageRole$outboundSchema=Xt.AssistantMessageRole$inboundSchema;var kSt;(function(e){e.inboundSchema=Xt.AssistantMessageRole$inboundSchema,e.outboundSchema=Xt.AssistantMessageRole$outboundSchema})(kSt||(Xt.AssistantMessageRole$=kSt={}));Xt.AssistantMessage$inboundSchema=ga.object({content:ga.nullable(ga.union([ga.string(),ga.array(tte.ContentChunk$inboundSchema)])).optional(),tool_calls:ga.nullable(ga.array(USt.ToolCall$inboundSchema)).optional(),prefix:ga.boolean().default(!1),role:Xt.AssistantMessageRole$inboundSchema.default("assistant")}).transform(e=>(0,$St.remap)(e,{tool_calls:"toolCalls"}));Xt.AssistantMessage$outboundSchema=ga.object({content:ga.nullable(ga.union([ga.string(),ga.array(tte.ContentChunk$outboundSchema)])).optional(),toolCalls:ga.nullable(ga.array(USt.ToolCall$outboundSchema)).optional(),prefix:ga.boolean().default(!1),role:Xt.AssistantMessageRole$outboundSchema.default("assistant")}).transform(e=>(0,$St.remap)(e,{toolCalls:"tool_calls"}));var BSt;(function(e){e.inboundSchema=Xt.AssistantMessage$inboundSchema,e.outboundSchema=Xt.AssistantMessage$outboundSchema})(BSt||(Xt.AssistantMessage$=BSt={}));function L4r(e){return JSON.stringify(Xt.AssistantMessage$outboundSchema.parse(e))}function F4r(e){return(0,qSt.safeParse)(e,t=>Xt.AssistantMessage$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'AssistantMessage' from JSON")}});var Uk=b(Wn=>{"use strict";var k4r=Wn&&Wn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),B4r=Wn&&Wn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$4r=Wn&&Wn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&k4r(t,e,r);return B4r(t,e),t};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.Prediction$=Wn.Prediction$outboundSchema=Wn.Prediction$inboundSchema=Wn.PredictionType$=Wn.PredictionType$outboundSchema=Wn.PredictionType$inboundSchema=Wn.PredictionType=void 0;Wn.predictionToJSON=U4r;Wn.predictionFromJSON=z4r;var p1=$4r(me()),q4r=ce();Wn.PredictionType={Content:"content"};Wn.PredictionType$inboundSchema=p1.nativeEnum(Wn.PredictionType);Wn.PredictionType$outboundSchema=Wn.PredictionType$inboundSchema;var zSt;(function(e){e.inboundSchema=Wn.PredictionType$inboundSchema,e.outboundSchema=Wn.PredictionType$outboundSchema})(zSt||(Wn.PredictionType$=zSt={}));Wn.Prediction$inboundSchema=p1.object({type:p1.literal("content").default("content"),content:p1.string().default("")});Wn.Prediction$outboundSchema=p1.object({type:p1.literal("content").default("content"),content:p1.string().default("")});var HSt;(function(e){e.inboundSchema=Wn.Prediction$inboundSchema,e.outboundSchema=Wn.Prediction$outboundSchema})(HSt||(Wn.Prediction$=HSt={}));function U4r(e){return JSON.stringify(Wn.Prediction$outboundSchema.parse(e))}function z4r(e){return(0,q4r.safeParse)(e,t=>Wn.Prediction$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Prediction' from JSON")}});var cEe=b(Ss=>{"use strict";var H4r=Ss&&Ss.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),V4r=Ss&&Ss.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),W4r=Ss&&Ss.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&H4r(t,e,r);return V4r(t,e),t};Object.defineProperty(Ss,"__esModule",{value:!0});Ss.JsonSchema$=Ss.JsonSchema$outboundSchema=Ss.JsonSchema$inboundSchema=void 0;Ss.jsonSchemaToJSON=G4r;Ss.jsonSchemaFromJSON=K4r;var $f=W4r(me()),WSt=Oe(),J4r=ce();Ss.JsonSchema$inboundSchema=$f.object({name:$f.string(),description:$f.nullable($f.string()).optional(),schema:$f.record($f.any()),strict:$f.boolean().default(!1)}).transform(e=>(0,WSt.remap)(e,{schema:"schemaDefinition"}));Ss.JsonSchema$outboundSchema=$f.object({name:$f.string(),description:$f.nullable($f.string()).optional(),schemaDefinition:$f.record($f.any()),strict:$f.boolean().default(!1)}).transform(e=>(0,WSt.remap)(e,{schemaDefinition:"schema"}));var VSt;(function(e){e.inboundSchema=Ss.JsonSchema$inboundSchema,e.outboundSchema=Ss.JsonSchema$outboundSchema})(VSt||(Ss.JsonSchema$=VSt={}));function G4r(e){return JSON.stringify(Ss.JsonSchema$outboundSchema.parse(e))}function K4r(e){return(0,J4r.safeParse)(e,t=>Ss.JsonSchema$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JsonSchema' from JSON")}});var dEe=b(xs=>{"use strict";var Y4r=xs&&xs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Z4r=xs&&xs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),X4r=xs&&xs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Y4r(t,e,r);return Z4r(t,e),t};Object.defineProperty(xs,"__esModule",{value:!0});xs.ResponseFormats$=xs.ResponseFormats$outboundSchema=xs.ResponseFormats$inboundSchema=xs.ResponseFormats=void 0;var Q4r=X4r(me());xs.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};xs.ResponseFormats$inboundSchema=Q4r.nativeEnum(xs.ResponseFormats);xs.ResponseFormats$outboundSchema=xs.ResponseFormats$inboundSchema;var JSt;(function(e){e.inboundSchema=xs.ResponseFormats$inboundSchema,e.outboundSchema=xs.ResponseFormats$outboundSchema})(JSt||(xs.ResponseFormats$=JSt={}))});var zk=b(Cs=>{"use strict";var e3r=Cs&&Cs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),t3r=Cs&&Cs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r3r=Cs&&Cs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&e3r(t,e,r);return t3r(t,e),t};Object.defineProperty(Cs,"__esModule",{value:!0});Cs.ResponseFormat$=Cs.ResponseFormat$outboundSchema=Cs.ResponseFormat$inboundSchema=void 0;Cs.responseFormatToJSON=o3r;Cs.responseFormatFromJSON=i3r;var rte=r3r(me()),KSt=Oe(),n3r=ce(),YSt=cEe(),ZSt=dEe();Cs.ResponseFormat$inboundSchema=rte.object({type:ZSt.ResponseFormats$inboundSchema.optional(),json_schema:rte.nullable(YSt.JsonSchema$inboundSchema).optional()}).transform(e=>(0,KSt.remap)(e,{json_schema:"jsonSchema"}));Cs.ResponseFormat$outboundSchema=rte.object({type:ZSt.ResponseFormats$outboundSchema.optional(),jsonSchema:rte.nullable(YSt.JsonSchema$outboundSchema).optional()}).transform(e=>(0,KSt.remap)(e,{jsonSchema:"json_schema"}));var GSt;(function(e){e.inboundSchema=Cs.ResponseFormat$inboundSchema,e.outboundSchema=Cs.ResponseFormat$outboundSchema})(GSt||(Cs.ResponseFormat$=GSt={}));function o3r(e){return JSON.stringify(Cs.ResponseFormat$outboundSchema.parse(e))}function i3r(e){return(0,n3r.safeParse)(e,t=>Cs.ResponseFormat$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ResponseFormat' from JSON")}});var h1=b(Qt=>{"use strict";var a3r=Qt&&Qt.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),s3r=Qt&&Qt.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),u3r=Qt&&Qt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&a3r(t,e,r);return s3r(t,e),t};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.SystemMessage$=Qt.SystemMessage$outboundSchema=Qt.SystemMessage$inboundSchema=Qt.Role$=Qt.Role$outboundSchema=Qt.Role$inboundSchema=Qt.SystemMessageContent$=Qt.SystemMessageContent$outboundSchema=Qt.SystemMessageContent$inboundSchema=Qt.Role=void 0;Qt.systemMessageContentToJSON=l3r;Qt.systemMessageContentFromJSON=c3r;Qt.systemMessageToJSON=d3r;Qt.systemMessageFromJSON=f3r;var $d=u3r(me()),txt=ce(),nte=Qee();Qt.Role={System:"system"};Qt.SystemMessageContent$inboundSchema=$d.union([$d.string(),$d.array(nte.TextChunk$inboundSchema)]);Qt.SystemMessageContent$outboundSchema=$d.union([$d.string(),$d.array(nte.TextChunk$outboundSchema)]);var XSt;(function(e){e.inboundSchema=Qt.SystemMessageContent$inboundSchema,e.outboundSchema=Qt.SystemMessageContent$outboundSchema})(XSt||(Qt.SystemMessageContent$=XSt={}));function l3r(e){return JSON.stringify(Qt.SystemMessageContent$outboundSchema.parse(e))}function c3r(e){return(0,txt.safeParse)(e,t=>Qt.SystemMessageContent$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'SystemMessageContent' from JSON")}Qt.Role$inboundSchema=$d.nativeEnum(Qt.Role);Qt.Role$outboundSchema=Qt.Role$inboundSchema;var QSt;(function(e){e.inboundSchema=Qt.Role$inboundSchema,e.outboundSchema=Qt.Role$outboundSchema})(QSt||(Qt.Role$=QSt={}));Qt.SystemMessage$inboundSchema=$d.object({content:$d.union([$d.string(),$d.array(nte.TextChunk$inboundSchema)]),role:Qt.Role$inboundSchema.default("system")});Qt.SystemMessage$outboundSchema=$d.object({content:$d.union([$d.string(),$d.array(nte.TextChunk$outboundSchema)]),role:Qt.Role$outboundSchema.default("system")});var ext;(function(e){e.inboundSchema=Qt.SystemMessage$inboundSchema,e.outboundSchema=Qt.SystemMessage$outboundSchema})(ext||(Qt.SystemMessage$=ext={}));function d3r(e){return JSON.stringify(Qt.SystemMessage$outboundSchema.parse(e))}function f3r(e){return(0,txt.safeParse)(e,t=>Qt.SystemMessage$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'SystemMessage' from JSON")}});var fEe=b(Os=>{"use strict";var p3r=Os&&Os.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),h3r=Os&&Os.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),m3r=Os&&Os.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&p3r(t,e,r);return h3r(t,e),t};Object.defineProperty(Os,"__esModule",{value:!0});Os.FunctionT$=Os.FunctionT$outboundSchema=Os.FunctionT$inboundSchema=void 0;Os.functionToJSON=y3r;Os.functionFromJSON=b3r;var Xh=m3r(me()),g3r=ce();Os.FunctionT$inboundSchema=Xh.object({name:Xh.string(),description:Xh.string().default(""),strict:Xh.boolean().default(!1),parameters:Xh.record(Xh.any())});Os.FunctionT$outboundSchema=Xh.object({name:Xh.string(),description:Xh.string().default(""),strict:Xh.boolean().default(!1),parameters:Xh.record(Xh.any())});var rxt;(function(e){e.inboundSchema=Os.FunctionT$inboundSchema,e.outboundSchema=Os.FunctionT$outboundSchema})(rxt||(Os.FunctionT$=rxt={}));function y3r(e){return JSON.stringify(Os.FunctionT$outboundSchema.parse(e))}function b3r(e){return(0,g3r.safeParse)(e,t=>Os.FunctionT$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FunctionT' from JSON")}});var Hk=b(Es=>{"use strict";var _3r=Es&&Es.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),v3r=Es&&Es.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),w3r=Es&&Es.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_3r(t,e,r);return v3r(t,e),t};Object.defineProperty(Es,"__esModule",{value:!0});Es.Tool$=Es.Tool$outboundSchema=Es.Tool$inboundSchema=void 0;Es.toolToJSON=x3r;Es.toolFromJSON=C3r;var oxt=w3r(me()),S3r=ce(),ixt=fEe(),axt=C3();Es.Tool$inboundSchema=oxt.object({type:axt.ToolTypes$inboundSchema.optional(),function:ixt.FunctionT$inboundSchema});Es.Tool$outboundSchema=oxt.object({type:axt.ToolTypes$outboundSchema.optional(),function:ixt.FunctionT$outboundSchema});var nxt;(function(e){e.inboundSchema=Es.Tool$inboundSchema,e.outboundSchema=Es.Tool$outboundSchema})(nxt||(Es.Tool$=nxt={}));function x3r(e){return JSON.stringify(Es.Tool$outboundSchema.parse(e))}function C3r(e){return(0,S3r.safeParse)(e,t=>Es.Tool$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Tool' from JSON")}});var pEe=b(Ps=>{"use strict";var O3r=Ps&&Ps.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),E3r=Ps&&Ps.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),P3r=Ps&&Ps.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&O3r(t,e,r);return E3r(t,e),t};Object.defineProperty(Ps,"__esModule",{value:!0});Ps.FunctionName$=Ps.FunctionName$outboundSchema=Ps.FunctionName$inboundSchema=void 0;Ps.functionNameToJSON=M3r;Ps.functionNameFromJSON=I3r;var ote=P3r(me()),T3r=ce();Ps.FunctionName$inboundSchema=ote.object({name:ote.string()});Ps.FunctionName$outboundSchema=ote.object({name:ote.string()});var sxt;(function(e){e.inboundSchema=Ps.FunctionName$inboundSchema,e.outboundSchema=Ps.FunctionName$outboundSchema})(sxt||(Ps.FunctionName$=sxt={}));function M3r(e){return JSON.stringify(Ps.FunctionName$outboundSchema.parse(e))}function I3r(e){return(0,T3r.safeParse)(e,t=>Ps.FunctionName$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FunctionName' from JSON")}});var Vk=b(Ts=>{"use strict";var A3r=Ts&&Ts.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),R3r=Ts&&Ts.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),D3r=Ts&&Ts.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&A3r(t,e,r);return R3r(t,e),t};Object.defineProperty(Ts,"__esModule",{value:!0});Ts.ToolChoice$=Ts.ToolChoice$outboundSchema=Ts.ToolChoice$inboundSchema=void 0;Ts.toolChoiceToJSON=N3r;Ts.toolChoiceFromJSON=L3r;var lxt=D3r(me()),j3r=ce(),cxt=pEe(),dxt=C3();Ts.ToolChoice$inboundSchema=lxt.object({type:dxt.ToolTypes$inboundSchema.optional(),function:cxt.FunctionName$inboundSchema});Ts.ToolChoice$outboundSchema=lxt.object({type:dxt.ToolTypes$outboundSchema.optional(),function:cxt.FunctionName$outboundSchema});var uxt;(function(e){e.inboundSchema=Ts.ToolChoice$inboundSchema,e.outboundSchema=Ts.ToolChoice$outboundSchema})(uxt||(Ts.ToolChoice$=uxt={}));function N3r(e){return JSON.stringify(Ts.ToolChoice$outboundSchema.parse(e))}function L3r(e){return(0,j3r.safeParse)(e,t=>Ts.ToolChoice$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ToolChoice' from JSON")}});var Wk=b(Ms=>{"use strict";var F3r=Ms&&Ms.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),k3r=Ms&&Ms.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),B3r=Ms&&Ms.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&F3r(t,e,r);return k3r(t,e),t};Object.defineProperty(Ms,"__esModule",{value:!0});Ms.ToolChoiceEnum$=Ms.ToolChoiceEnum$outboundSchema=Ms.ToolChoiceEnum$inboundSchema=Ms.ToolChoiceEnum=void 0;var $3r=B3r(me());Ms.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};Ms.ToolChoiceEnum$inboundSchema=$3r.nativeEnum(Ms.ToolChoiceEnum);Ms.ToolChoiceEnum$outboundSchema=Ms.ToolChoiceEnum$inboundSchema;var fxt;(function(e){e.inboundSchema=Ms.ToolChoiceEnum$inboundSchema,e.outboundSchema=Ms.ToolChoiceEnum$outboundSchema})(fxt||(Ms.ToolChoiceEnum$=fxt={}))});var m1=b(er=>{"use strict";var q3r=er&&er.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),U3r=er&&er.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),z3r=er&&er.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&q3r(t,e,r);return U3r(t,e),t};Object.defineProperty(er,"__esModule",{value:!0});er.ToolMessage$=er.ToolMessage$outboundSchema=er.ToolMessage$inboundSchema=er.ToolMessageRole$=er.ToolMessageRole$outboundSchema=er.ToolMessageRole$inboundSchema=er.ToolMessageContent$=er.ToolMessageContent$outboundSchema=er.ToolMessageContent$inboundSchema=er.ToolMessageRole=void 0;er.toolMessageContentToJSON=H3r;er.toolMessageContentFromJSON=V3r;er.toolMessageToJSON=W3r;er.toolMessageFromJSON=J3r;var Ti=z3r(me()),gxt=Oe(),yxt=ce(),ite=$k();er.ToolMessageRole={Tool:"tool"};er.ToolMessageContent$inboundSchema=Ti.union([Ti.string(),Ti.array(ite.ContentChunk$inboundSchema)]);er.ToolMessageContent$outboundSchema=Ti.union([Ti.string(),Ti.array(ite.ContentChunk$outboundSchema)]);var pxt;(function(e){e.inboundSchema=er.ToolMessageContent$inboundSchema,e.outboundSchema=er.ToolMessageContent$outboundSchema})(pxt||(er.ToolMessageContent$=pxt={}));function H3r(e){return JSON.stringify(er.ToolMessageContent$outboundSchema.parse(e))}function V3r(e){return(0,yxt.safeParse)(e,t=>er.ToolMessageContent$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ToolMessageContent' from JSON")}er.ToolMessageRole$inboundSchema=Ti.nativeEnum(er.ToolMessageRole);er.ToolMessageRole$outboundSchema=er.ToolMessageRole$inboundSchema;var hxt;(function(e){e.inboundSchema=er.ToolMessageRole$inboundSchema,e.outboundSchema=er.ToolMessageRole$outboundSchema})(hxt||(er.ToolMessageRole$=hxt={}));er.ToolMessage$inboundSchema=Ti.object({content:Ti.nullable(Ti.union([Ti.string(),Ti.array(ite.ContentChunk$inboundSchema)])),tool_call_id:Ti.nullable(Ti.string()).optional(),name:Ti.nullable(Ti.string()).optional(),role:er.ToolMessageRole$inboundSchema.default("tool")}).transform(e=>(0,gxt.remap)(e,{tool_call_id:"toolCallId"}));er.ToolMessage$outboundSchema=Ti.object({content:Ti.nullable(Ti.union([Ti.string(),Ti.array(ite.ContentChunk$outboundSchema)])),toolCallId:Ti.nullable(Ti.string()).optional(),name:Ti.nullable(Ti.string()).optional(),role:er.ToolMessageRole$outboundSchema.default("tool")}).transform(e=>(0,gxt.remap)(e,{toolCallId:"tool_call_id"}));var mxt;(function(e){e.inboundSchema=er.ToolMessage$inboundSchema,e.outboundSchema=er.ToolMessage$outboundSchema})(mxt||(er.ToolMessage$=mxt={}));function W3r(e){return JSON.stringify(er.ToolMessage$outboundSchema.parse(e))}function J3r(e){return(0,yxt.safeParse)(e,t=>er.ToolMessage$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ToolMessage' from JSON")}});var g1=b(tr=>{"use strict";var G3r=tr&&tr.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),K3r=tr&&tr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Y3r=tr&&tr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&G3r(t,e,r);return K3r(t,e),t};Object.defineProperty(tr,"__esModule",{value:!0});tr.UserMessage$=tr.UserMessage$outboundSchema=tr.UserMessage$inboundSchema=tr.UserMessageRole$=tr.UserMessageRole$outboundSchema=tr.UserMessageRole$inboundSchema=tr.UserMessageContent$=tr.UserMessageContent$outboundSchema=tr.UserMessageContent$inboundSchema=tr.UserMessageRole=void 0;tr.userMessageContentToJSON=Z3r;tr.userMessageContentFromJSON=X3r;tr.userMessageToJSON=Q3r;tr.userMessageFromJSON=e8r;var uc=Y3r(me()),wxt=ce(),ate=$k();tr.UserMessageRole={User:"user"};tr.UserMessageContent$inboundSchema=uc.union([uc.string(),uc.array(ate.ContentChunk$inboundSchema)]);tr.UserMessageContent$outboundSchema=uc.union([uc.string(),uc.array(ate.ContentChunk$outboundSchema)]);var bxt;(function(e){e.inboundSchema=tr.UserMessageContent$inboundSchema,e.outboundSchema=tr.UserMessageContent$outboundSchema})(bxt||(tr.UserMessageContent$=bxt={}));function Z3r(e){return JSON.stringify(tr.UserMessageContent$outboundSchema.parse(e))}function X3r(e){return(0,wxt.safeParse)(e,t=>tr.UserMessageContent$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'UserMessageContent' from JSON")}tr.UserMessageRole$inboundSchema=uc.nativeEnum(tr.UserMessageRole);tr.UserMessageRole$outboundSchema=tr.UserMessageRole$inboundSchema;var _xt;(function(e){e.inboundSchema=tr.UserMessageRole$inboundSchema,e.outboundSchema=tr.UserMessageRole$outboundSchema})(_xt||(tr.UserMessageRole$=_xt={}));tr.UserMessage$inboundSchema=uc.object({content:uc.nullable(uc.union([uc.string(),uc.array(ate.ContentChunk$inboundSchema)])),role:tr.UserMessageRole$inboundSchema.default("user")});tr.UserMessage$outboundSchema=uc.object({content:uc.nullable(uc.union([uc.string(),uc.array(ate.ContentChunk$outboundSchema)])),role:tr.UserMessageRole$outboundSchema.default("user")});var vxt;(function(e){e.inboundSchema=tr.UserMessage$inboundSchema,e.outboundSchema=tr.UserMessage$outboundSchema})(vxt||(tr.UserMessage$=vxt={}));function Q3r(e){return JSON.stringify(tr.UserMessage$outboundSchema.parse(e))}function e8r(e){return(0,wxt.safeParse)(e,t=>tr.UserMessage$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'UserMessage' from JSON")}});var Ixt=b(Ot=>{"use strict";var t8r=Ot&&Ot.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),r8r=Ot&&Ot.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n8r=Ot&&Ot.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&t8r(t,e,r);return r8r(t,e),t};Object.defineProperty(Ot,"__esModule",{value:!0});Ot.AgentsCompletionRequest$=Ot.AgentsCompletionRequest$outboundSchema=Ot.AgentsCompletionRequest$inboundSchema=Ot.AgentsCompletionRequestToolChoice$=Ot.AgentsCompletionRequestToolChoice$outboundSchema=Ot.AgentsCompletionRequestToolChoice$inboundSchema=Ot.AgentsCompletionRequestMessages$=Ot.AgentsCompletionRequestMessages$outboundSchema=Ot.AgentsCompletionRequestMessages$inboundSchema=Ot.AgentsCompletionRequestStop$=Ot.AgentsCompletionRequestStop$outboundSchema=Ot.AgentsCompletionRequestStop$inboundSchema=void 0;Ot.agentsCompletionRequestStopToJSON=o8r;Ot.agentsCompletionRequestStopFromJSON=i8r;Ot.agentsCompletionRequestMessagesToJSON=a8r;Ot.agentsCompletionRequestMessagesFromJSON=s8r;Ot.agentsCompletionRequestToolChoiceToJSON=u8r;Ot.agentsCompletionRequestToolChoiceFromJSON=l8r;Ot.agentsCompletionRequestToJSON=c8r;Ot.agentsCompletionRequestFromJSON=d8r;var Le=n8r(me()),Ext=Oe(),ste=ce(),ute=tT(),Pxt=Uk(),Txt=zk(),lte=h1(),Mxt=Hk(),cte=Vk(),dte=Wk(),fte=m1(),pte=g1();Ot.AgentsCompletionRequestStop$inboundSchema=Le.union([Le.string(),Le.array(Le.string())]);Ot.AgentsCompletionRequestStop$outboundSchema=Le.union([Le.string(),Le.array(Le.string())]);var Sxt;(function(e){e.inboundSchema=Ot.AgentsCompletionRequestStop$inboundSchema,e.outboundSchema=Ot.AgentsCompletionRequestStop$outboundSchema})(Sxt||(Ot.AgentsCompletionRequestStop$=Sxt={}));function o8r(e){return JSON.stringify(Ot.AgentsCompletionRequestStop$outboundSchema.parse(e))}function i8r(e){return(0,ste.safeParse)(e,t=>Ot.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}Ot.AgentsCompletionRequestMessages$inboundSchema=Le.union([lte.SystemMessage$inboundSchema.and(Le.object({role:Le.literal("system")}).transform(e=>({role:e.role}))),pte.UserMessage$inboundSchema.and(Le.object({role:Le.literal("user")}).transform(e=>({role:e.role}))),ute.AssistantMessage$inboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(e=>({role:e.role}))),fte.ToolMessage$inboundSchema.and(Le.object({role:Le.literal("tool")}).transform(e=>({role:e.role})))]);Ot.AgentsCompletionRequestMessages$outboundSchema=Le.union([lte.SystemMessage$outboundSchema.and(Le.object({role:Le.literal("system")}).transform(e=>({role:e.role}))),pte.UserMessage$outboundSchema.and(Le.object({role:Le.literal("user")}).transform(e=>({role:e.role}))),ute.AssistantMessage$outboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(e=>({role:e.role}))),fte.ToolMessage$outboundSchema.and(Le.object({role:Le.literal("tool")}).transform(e=>({role:e.role})))]);var xxt;(function(e){e.inboundSchema=Ot.AgentsCompletionRequestMessages$inboundSchema,e.outboundSchema=Ot.AgentsCompletionRequestMessages$outboundSchema})(xxt||(Ot.AgentsCompletionRequestMessages$=xxt={}));function a8r(e){return JSON.stringify(Ot.AgentsCompletionRequestMessages$outboundSchema.parse(e))}function s8r(e){return(0,ste.safeParse)(e,t=>Ot.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}Ot.AgentsCompletionRequestToolChoice$inboundSchema=Le.union([cte.ToolChoice$inboundSchema,dte.ToolChoiceEnum$inboundSchema]);Ot.AgentsCompletionRequestToolChoice$outboundSchema=Le.union([cte.ToolChoice$outboundSchema,dte.ToolChoiceEnum$outboundSchema]);var Cxt;(function(e){e.inboundSchema=Ot.AgentsCompletionRequestToolChoice$inboundSchema,e.outboundSchema=Ot.AgentsCompletionRequestToolChoice$outboundSchema})(Cxt||(Ot.AgentsCompletionRequestToolChoice$=Cxt={}));function u8r(e){return JSON.stringify(Ot.AgentsCompletionRequestToolChoice$outboundSchema.parse(e))}function l8r(e){return(0,ste.safeParse)(e,t=>Ot.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}Ot.AgentsCompletionRequest$inboundSchema=Le.object({max_tokens:Le.nullable(Le.number().int()).optional(),stream:Le.boolean().default(!1),stop:Le.union([Le.string(),Le.array(Le.string())]).optional(),random_seed:Le.nullable(Le.number().int()).optional(),messages:Le.array(Le.union([lte.SystemMessage$inboundSchema.and(Le.object({role:Le.literal("system")}).transform(e=>({role:e.role}))),pte.UserMessage$inboundSchema.and(Le.object({role:Le.literal("user")}).transform(e=>({role:e.role}))),ute.AssistantMessage$inboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(e=>({role:e.role}))),fte.ToolMessage$inboundSchema.and(Le.object({role:Le.literal("tool")}).transform(e=>({role:e.role})))])),response_format:Txt.ResponseFormat$inboundSchema.optional(),tools:Le.nullable(Le.array(Mxt.Tool$inboundSchema)).optional(),tool_choice:Le.union([cte.ToolChoice$inboundSchema,dte.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Le.number().optional(),frequency_penalty:Le.number().optional(),n:Le.nullable(Le.number().int()).optional(),prediction:Pxt.Prediction$inboundSchema.optional(),agent_id:Le.string()}).transform(e=>(0,Ext.remap)(e,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));Ot.AgentsCompletionRequest$outboundSchema=Le.object({maxTokens:Le.nullable(Le.number().int()).optional(),stream:Le.boolean().default(!1),stop:Le.union([Le.string(),Le.array(Le.string())]).optional(),randomSeed:Le.nullable(Le.number().int()).optional(),messages:Le.array(Le.union([lte.SystemMessage$outboundSchema.and(Le.object({role:Le.literal("system")}).transform(e=>({role:e.role}))),pte.UserMessage$outboundSchema.and(Le.object({role:Le.literal("user")}).transform(e=>({role:e.role}))),ute.AssistantMessage$outboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(e=>({role:e.role}))),fte.ToolMessage$outboundSchema.and(Le.object({role:Le.literal("tool")}).transform(e=>({role:e.role})))])),responseFormat:Txt.ResponseFormat$outboundSchema.optional(),tools:Le.nullable(Le.array(Mxt.Tool$outboundSchema)).optional(),toolChoice:Le.union([cte.ToolChoice$outboundSchema,dte.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Le.number().optional(),frequencyPenalty:Le.number().optional(),n:Le.nullable(Le.number().int()).optional(),prediction:Pxt.Prediction$outboundSchema.optional(),agentId:Le.string()}).transform(e=>(0,Ext.remap)(e,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var Oxt;(function(e){e.inboundSchema=Ot.AgentsCompletionRequest$inboundSchema,e.outboundSchema=Ot.AgentsCompletionRequest$outboundSchema})(Oxt||(Ot.AgentsCompletionRequest$=Oxt={}));function c8r(e){return JSON.stringify(Ot.AgentsCompletionRequest$outboundSchema.parse(e))}function d8r(e){return(0,ste.safeParse)(e,t=>Ot.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var Bxt=b(Et=>{"use strict";var f8r=Et&&Et.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),p8r=Et&&Et.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),h8r=Et&&Et.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&f8r(t,e,r);return p8r(t,e),t};Object.defineProperty(Et,"__esModule",{value:!0});Et.AgentsCompletionStreamRequest$=Et.AgentsCompletionStreamRequest$outboundSchema=Et.AgentsCompletionStreamRequest$inboundSchema=Et.AgentsCompletionStreamRequestToolChoice$=Et.AgentsCompletionStreamRequestToolChoice$outboundSchema=Et.AgentsCompletionStreamRequestToolChoice$inboundSchema=Et.AgentsCompletionStreamRequestMessages$=Et.AgentsCompletionStreamRequestMessages$outboundSchema=Et.AgentsCompletionStreamRequestMessages$inboundSchema=Et.AgentsCompletionStreamRequestStop$=Et.AgentsCompletionStreamRequestStop$outboundSchema=Et.AgentsCompletionStreamRequestStop$inboundSchema=void 0;Et.agentsCompletionStreamRequestStopToJSON=m8r;Et.agentsCompletionStreamRequestStopFromJSON=g8r;Et.agentsCompletionStreamRequestMessagesToJSON=y8r;Et.agentsCompletionStreamRequestMessagesFromJSON=b8r;Et.agentsCompletionStreamRequestToolChoiceToJSON=_8r;Et.agentsCompletionStreamRequestToolChoiceFromJSON=v8r;Et.agentsCompletionStreamRequestToJSON=w8r;Et.agentsCompletionStreamRequestFromJSON=S8r;var Fe=h8r(me()),Nxt=Oe(),hte=ce(),mte=tT(),Lxt=Uk(),Fxt=zk(),gte=h1(),kxt=Hk(),yte=Vk(),bte=Wk(),_te=m1(),vte=g1();Et.AgentsCompletionStreamRequestStop$inboundSchema=Fe.union([Fe.string(),Fe.array(Fe.string())]);Et.AgentsCompletionStreamRequestStop$outboundSchema=Fe.union([Fe.string(),Fe.array(Fe.string())]);var Axt;(function(e){e.inboundSchema=Et.AgentsCompletionStreamRequestStop$inboundSchema,e.outboundSchema=Et.AgentsCompletionStreamRequestStop$outboundSchema})(Axt||(Et.AgentsCompletionStreamRequestStop$=Axt={}));function m8r(e){return JSON.stringify(Et.AgentsCompletionStreamRequestStop$outboundSchema.parse(e))}function g8r(e){return(0,hte.safeParse)(e,t=>Et.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}Et.AgentsCompletionStreamRequestMessages$inboundSchema=Fe.union([gte.SystemMessage$inboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(e=>({role:e.role}))),vte.UserMessage$inboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(e=>({role:e.role}))),mte.AssistantMessage$inboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(e=>({role:e.role}))),_te.ToolMessage$inboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(e=>({role:e.role})))]);Et.AgentsCompletionStreamRequestMessages$outboundSchema=Fe.union([gte.SystemMessage$outboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(e=>({role:e.role}))),vte.UserMessage$outboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(e=>({role:e.role}))),mte.AssistantMessage$outboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(e=>({role:e.role}))),_te.ToolMessage$outboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(e=>({role:e.role})))]);var Rxt;(function(e){e.inboundSchema=Et.AgentsCompletionStreamRequestMessages$inboundSchema,e.outboundSchema=Et.AgentsCompletionStreamRequestMessages$outboundSchema})(Rxt||(Et.AgentsCompletionStreamRequestMessages$=Rxt={}));function y8r(e){return JSON.stringify(Et.AgentsCompletionStreamRequestMessages$outboundSchema.parse(e))}function b8r(e){return(0,hte.safeParse)(e,t=>Et.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}Et.AgentsCompletionStreamRequestToolChoice$inboundSchema=Fe.union([yte.ToolChoice$inboundSchema,bte.ToolChoiceEnum$inboundSchema]);Et.AgentsCompletionStreamRequestToolChoice$outboundSchema=Fe.union([yte.ToolChoice$outboundSchema,bte.ToolChoiceEnum$outboundSchema]);var Dxt;(function(e){e.inboundSchema=Et.AgentsCompletionStreamRequestToolChoice$inboundSchema,e.outboundSchema=Et.AgentsCompletionStreamRequestToolChoice$outboundSchema})(Dxt||(Et.AgentsCompletionStreamRequestToolChoice$=Dxt={}));function _8r(e){return JSON.stringify(Et.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(e))}function v8r(e){return(0,hte.safeParse)(e,t=>Et.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}Et.AgentsCompletionStreamRequest$inboundSchema=Fe.object({max_tokens:Fe.nullable(Fe.number().int()).optional(),stream:Fe.boolean().default(!0),stop:Fe.union([Fe.string(),Fe.array(Fe.string())]).optional(),random_seed:Fe.nullable(Fe.number().int()).optional(),messages:Fe.array(Fe.union([gte.SystemMessage$inboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(e=>({role:e.role}))),vte.UserMessage$inboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(e=>({role:e.role}))),mte.AssistantMessage$inboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(e=>({role:e.role}))),_te.ToolMessage$inboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(e=>({role:e.role})))])),response_format:Fxt.ResponseFormat$inboundSchema.optional(),tools:Fe.nullable(Fe.array(kxt.Tool$inboundSchema)).optional(),tool_choice:Fe.union([yte.ToolChoice$inboundSchema,bte.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Fe.number().optional(),frequency_penalty:Fe.number().optional(),n:Fe.nullable(Fe.number().int()).optional(),prediction:Lxt.Prediction$inboundSchema.optional(),agent_id:Fe.string()}).transform(e=>(0,Nxt.remap)(e,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));Et.AgentsCompletionStreamRequest$outboundSchema=Fe.object({maxTokens:Fe.nullable(Fe.number().int()).optional(),stream:Fe.boolean().default(!0),stop:Fe.union([Fe.string(),Fe.array(Fe.string())]).optional(),randomSeed:Fe.nullable(Fe.number().int()).optional(),messages:Fe.array(Fe.union([gte.SystemMessage$outboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(e=>({role:e.role}))),vte.UserMessage$outboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(e=>({role:e.role}))),mte.AssistantMessage$outboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(e=>({role:e.role}))),_te.ToolMessage$outboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(e=>({role:e.role})))])),responseFormat:Fxt.ResponseFormat$outboundSchema.optional(),tools:Fe.nullable(Fe.array(kxt.Tool$outboundSchema)).optional(),toolChoice:Fe.union([yte.ToolChoice$outboundSchema,bte.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Fe.number().optional(),frequencyPenalty:Fe.number().optional(),n:Fe.nullable(Fe.number().int()).optional(),prediction:Lxt.Prediction$outboundSchema.optional(),agentId:Fe.string()}).transform(e=>(0,Nxt.remap)(e,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var jxt;(function(e){e.inboundSchema=Et.AgentsCompletionStreamRequest$inboundSchema,e.outboundSchema=Et.AgentsCompletionStreamRequest$outboundSchema})(jxt||(Et.AgentsCompletionStreamRequest$=jxt={}));function w8r(e){return JSON.stringify(Et.AgentsCompletionStreamRequest$outboundSchema.parse(e))}function S8r(e){return(0,hte.safeParse)(e,t=>Et.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var hEe=b(Is=>{"use strict";var x8r=Is&&Is.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),C8r=Is&&Is.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),O8r=Is&&Is.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&x8r(t,e,r);return C8r(t,e),t};Object.defineProperty(Is,"__esModule",{value:!0});Is.ApiEndpoint$=Is.ApiEndpoint$outboundSchema=Is.ApiEndpoint$inboundSchema=Is.ApiEndpoint=void 0;var y1=O8r(me()),E8r=eT();Is.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations"};Is.ApiEndpoint$inboundSchema=y1.union([y1.nativeEnum(Is.ApiEndpoint),y1.string().transform(E8r.catchUnrecognizedEnum)]);Is.ApiEndpoint$outboundSchema=y1.union([y1.nativeEnum(Is.ApiEndpoint),y1.string().and(y1.custom())]);var $xt;(function(e){e.inboundSchema=Is.ApiEndpoint$inboundSchema,e.outboundSchema=Is.ApiEndpoint$outboundSchema})($xt||(Is.ApiEndpoint$=$xt={}))});var zxt=b(Jn=>{"use strict";var P8r=Jn&&Jn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),T8r=Jn&&Jn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),M8r=Jn&&Jn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&P8r(t,e,r);return T8r(t,e),t};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.ArchiveFTModelOut$=Jn.ArchiveFTModelOut$outboundSchema=Jn.ArchiveFTModelOut$inboundSchema=Jn.ArchiveFTModelOutObject$=Jn.ArchiveFTModelOutObject$outboundSchema=Jn.ArchiveFTModelOutObject$inboundSchema=Jn.ArchiveFTModelOutObject=void 0;Jn.archiveFTModelOutToJSON=A8r;Jn.archiveFTModelOutFromJSON=R8r;var oC=M8r(me()),I8r=ce();Jn.ArchiveFTModelOutObject={Model:"model"};Jn.ArchiveFTModelOutObject$inboundSchema=oC.nativeEnum(Jn.ArchiveFTModelOutObject);Jn.ArchiveFTModelOutObject$outboundSchema=Jn.ArchiveFTModelOutObject$inboundSchema;var qxt;(function(e){e.inboundSchema=Jn.ArchiveFTModelOutObject$inboundSchema,e.outboundSchema=Jn.ArchiveFTModelOutObject$outboundSchema})(qxt||(Jn.ArchiveFTModelOutObject$=qxt={}));Jn.ArchiveFTModelOut$inboundSchema=oC.object({id:oC.string(),object:oC.literal("model").default("model"),archived:oC.boolean().default(!0)});Jn.ArchiveFTModelOut$outboundSchema=oC.object({id:oC.string(),object:oC.literal("model").default("model"),archived:oC.boolean().default(!0)});var Uxt;(function(e){e.inboundSchema=Jn.ArchiveFTModelOut$inboundSchema,e.outboundSchema=Jn.ArchiveFTModelOut$outboundSchema})(Uxt||(Jn.ArchiveFTModelOut$=Uxt={}));function A8r(e){return JSON.stringify(Jn.ArchiveFTModelOut$outboundSchema.parse(e))}function R8r(e){return(0,I8r.safeParse)(e,t=>Jn.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var wte=b(As=>{"use strict";var D8r=As&&As.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),j8r=As&&As.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),N8r=As&&As.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&D8r(t,e,r);return j8r(t,e),t};Object.defineProperty(As,"__esModule",{value:!0});As.ModelCapabilities$=As.ModelCapabilities$outboundSchema=As.ModelCapabilities$inboundSchema=void 0;As.modelCapabilitiesToJSON=F8r;As.modelCapabilitiesFromJSON=k8r;var Qh=N8r(me()),Vxt=Oe(),L8r=ce();As.ModelCapabilities$inboundSchema=Qh.object({completion_chat:Qh.boolean().default(!0),completion_fim:Qh.boolean().default(!1),function_calling:Qh.boolean().default(!0),fine_tuning:Qh.boolean().default(!1),vision:Qh.boolean().default(!1)}).transform(e=>(0,Vxt.remap)(e,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));As.ModelCapabilities$outboundSchema=Qh.object({completionChat:Qh.boolean().default(!0),completionFim:Qh.boolean().default(!1),functionCalling:Qh.boolean().default(!0),fineTuning:Qh.boolean().default(!1),vision:Qh.boolean().default(!1)}).transform(e=>(0,Vxt.remap)(e,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var Hxt;(function(e){e.inboundSchema=As.ModelCapabilities$inboundSchema,e.outboundSchema=As.ModelCapabilities$outboundSchema})(Hxt||(As.ModelCapabilities$=Hxt={}));function F8r(e){return JSON.stringify(As.ModelCapabilities$outboundSchema.parse(e))}function k8r(e){return(0,L8r.safeParse)(e,t=>As.ModelCapabilities$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ModelCapabilities' from JSON")}});var mEe=b(Gn=>{"use strict";var B8r=Gn&&Gn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),$8r=Gn&&Gn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),q8r=Gn&&Gn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&B8r(t,e,r);return $8r(t,e),t};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.BaseModelCard$=Gn.BaseModelCard$outboundSchema=Gn.BaseModelCard$inboundSchema=Gn.Type$=Gn.Type$outboundSchema=Gn.Type$inboundSchema=Gn.Type=void 0;Gn.baseModelCardToJSON=z8r;Gn.baseModelCardFromJSON=H8r;var vn=q8r(me()),Gxt=Oe(),U8r=ce(),Kxt=wte();Gn.Type={Base:"base"};Gn.Type$inboundSchema=vn.nativeEnum(Gn.Type);Gn.Type$outboundSchema=Gn.Type$inboundSchema;var Wxt;(function(e){e.inboundSchema=Gn.Type$inboundSchema,e.outboundSchema=Gn.Type$outboundSchema})(Wxt||(Gn.Type$=Wxt={}));Gn.BaseModelCard$inboundSchema=vn.object({id:vn.string(),object:vn.string().default("model"),created:vn.number().int().optional(),owned_by:vn.string().default("mistralai"),capabilities:Kxt.ModelCapabilities$inboundSchema,name:vn.nullable(vn.string()).optional(),description:vn.nullable(vn.string()).optional(),max_context_length:vn.number().int().default(32768),aliases:vn.array(vn.string()).optional(),deprecation:vn.nullable(vn.string().datetime({offset:!0}).transform(e=>new Date(e))).optional(),default_model_temperature:vn.nullable(vn.number()).optional(),type:vn.literal("base").default("base")}).transform(e=>(0,Gxt.remap)(e,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Gn.BaseModelCard$outboundSchema=vn.object({id:vn.string(),object:vn.string().default("model"),created:vn.number().int().optional(),ownedBy:vn.string().default("mistralai"),capabilities:Kxt.ModelCapabilities$outboundSchema,name:vn.nullable(vn.string()).optional(),description:vn.nullable(vn.string()).optional(),maxContextLength:vn.number().int().default(32768),aliases:vn.array(vn.string()).optional(),deprecation:vn.nullable(vn.date().transform(e=>e.toISOString())).optional(),defaultModelTemperature:vn.nullable(vn.number()).optional(),type:vn.literal("base").default("base")}).transform(e=>(0,Gxt.remap)(e,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var Jxt;(function(e){e.inboundSchema=Gn.BaseModelCard$inboundSchema,e.outboundSchema=Gn.BaseModelCard$outboundSchema})(Jxt||(Gn.BaseModelCard$=Jxt={}));function z8r(e){return JSON.stringify(Gn.BaseModelCard$outboundSchema.parse(e))}function H8r(e){return(0,U8r.safeParse)(e,t=>Gn.BaseModelCard$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'BaseModelCard' from JSON")}});var gEe=b(Rs=>{"use strict";var V8r=Rs&&Rs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),W8r=Rs&&Rs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),J8r=Rs&&Rs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&V8r(t,e,r);return W8r(t,e),t};Object.defineProperty(Rs,"__esModule",{value:!0});Rs.BatchError$=Rs.BatchError$outboundSchema=Rs.BatchError$inboundSchema=void 0;Rs.batchErrorToJSON=K8r;Rs.batchErrorFromJSON=Y8r;var Jk=J8r(me()),G8r=ce();Rs.BatchError$inboundSchema=Jk.object({message:Jk.string(),count:Jk.number().int().default(1)});Rs.BatchError$outboundSchema=Jk.object({message:Jk.string(),count:Jk.number().int().default(1)});var Yxt;(function(e){e.inboundSchema=Rs.BatchError$inboundSchema,e.outboundSchema=Rs.BatchError$outboundSchema})(Yxt||(Rs.BatchError$=Yxt={}));function K8r(e){return JSON.stringify(Rs.BatchError$outboundSchema.parse(e))}function Y8r(e){return(0,G8r.safeParse)(e,t=>Rs.BatchError$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'BatchError' from JSON")}});var eCt=b(Ds=>{"use strict";var Z8r=Ds&&Ds.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),X8r=Ds&&Ds.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Q8r=Ds&&Ds.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Z8r(t,e,r);return X8r(t,e),t};Object.defineProperty(Ds,"__esModule",{value:!0});Ds.BatchJobIn$=Ds.BatchJobIn$outboundSchema=Ds.BatchJobIn$inboundSchema=void 0;Ds.batchJobInToJSON=tHr;Ds.batchJobInFromJSON=rHr;var nd=Q8r(me()),Xxt=Oe(),eHr=ce(),Qxt=hEe();Ds.BatchJobIn$inboundSchema=nd.object({input_files:nd.array(nd.string()),endpoint:Qxt.ApiEndpoint$inboundSchema,model:nd.string(),metadata:nd.nullable(nd.record(nd.string())).optional(),timeout_hours:nd.number().int().default(24)}).transform(e=>(0,Xxt.remap)(e,{input_files:"inputFiles",timeout_hours:"timeoutHours"}));Ds.BatchJobIn$outboundSchema=nd.object({inputFiles:nd.array(nd.string()),endpoint:Qxt.ApiEndpoint$outboundSchema,model:nd.string(),metadata:nd.nullable(nd.record(nd.string())).optional(),timeoutHours:nd.number().int().default(24)}).transform(e=>(0,Xxt.remap)(e,{inputFiles:"input_files",timeoutHours:"timeout_hours"}));var Zxt;(function(e){e.inboundSchema=Ds.BatchJobIn$inboundSchema,e.outboundSchema=Ds.BatchJobIn$outboundSchema})(Zxt||(Ds.BatchJobIn$=Zxt={}));function tHr(e){return JSON.stringify(Ds.BatchJobIn$outboundSchema.parse(e))}function rHr(e){return(0,eHr.safeParse)(e,t=>Ds.BatchJobIn$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'BatchJobIn' from JSON")}});var yEe=b(js=>{"use strict";var nHr=js&&js.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),oHr=js&&js.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),iHr=js&&js.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&nHr(t,e,r);return oHr(t,e),t};Object.defineProperty(js,"__esModule",{value:!0});js.BatchJobStatus$=js.BatchJobStatus$outboundSchema=js.BatchJobStatus$inboundSchema=js.BatchJobStatus=void 0;var aHr=iHr(me());js.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};js.BatchJobStatus$inboundSchema=aHr.nativeEnum(js.BatchJobStatus);js.BatchJobStatus$outboundSchema=js.BatchJobStatus$inboundSchema;var tCt;(function(e){e.inboundSchema=js.BatchJobStatus$inboundSchema,e.outboundSchema=js.BatchJobStatus$outboundSchema})(tCt||(js.BatchJobStatus$=tCt={}))});var bEe=b(Kn=>{"use strict";var sHr=Kn&&Kn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),uHr=Kn&&Kn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),lHr=Kn&&Kn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&sHr(t,e,r);return uHr(t,e),t};Object.defineProperty(Kn,"__esModule",{value:!0});Kn.BatchJobOut$=Kn.BatchJobOut$outboundSchema=Kn.BatchJobOut$inboundSchema=Kn.BatchJobOutObject$=Kn.BatchJobOutObject$outboundSchema=Kn.BatchJobOutObject$inboundSchema=Kn.BatchJobOutObject=void 0;Kn.batchJobOutToJSON=dHr;Kn.batchJobOutFromJSON=fHr;var qt=lHr(me()),oCt=Oe(),cHr=ce(),iCt=gEe(),aCt=yEe();Kn.BatchJobOutObject={Batch:"batch"};Kn.BatchJobOutObject$inboundSchema=qt.nativeEnum(Kn.BatchJobOutObject);Kn.BatchJobOutObject$outboundSchema=Kn.BatchJobOutObject$inboundSchema;var rCt;(function(e){e.inboundSchema=Kn.BatchJobOutObject$inboundSchema,e.outboundSchema=Kn.BatchJobOutObject$outboundSchema})(rCt||(Kn.BatchJobOutObject$=rCt={}));Kn.BatchJobOut$inboundSchema=qt.object({id:qt.string(),object:qt.literal("batch").default("batch"),input_files:qt.array(qt.string()),metadata:qt.nullable(qt.record(qt.any())).optional(),endpoint:qt.string(),model:qt.string(),output_file:qt.nullable(qt.string()).optional(),error_file:qt.nullable(qt.string()).optional(),errors:qt.array(iCt.BatchError$inboundSchema),status:aCt.BatchJobStatus$inboundSchema,created_at:qt.number().int(),total_requests:qt.number().int(),completed_requests:qt.number().int(),succeeded_requests:qt.number().int(),failed_requests:qt.number().int(),started_at:qt.nullable(qt.number().int()).optional(),completed_at:qt.nullable(qt.number().int()).optional()}).transform(e=>(0,oCt.remap)(e,{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"}));Kn.BatchJobOut$outboundSchema=qt.object({id:qt.string(),object:qt.literal("batch").default("batch"),inputFiles:qt.array(qt.string()),metadata:qt.nullable(qt.record(qt.any())).optional(),endpoint:qt.string(),model:qt.string(),outputFile:qt.nullable(qt.string()).optional(),errorFile:qt.nullable(qt.string()).optional(),errors:qt.array(iCt.BatchError$outboundSchema),status:aCt.BatchJobStatus$outboundSchema,createdAt:qt.number().int(),totalRequests:qt.number().int(),completedRequests:qt.number().int(),succeededRequests:qt.number().int(),failedRequests:qt.number().int(),startedAt:qt.nullable(qt.number().int()).optional(),completedAt:qt.nullable(qt.number().int()).optional()}).transform(e=>(0,oCt.remap)(e,{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 nCt;(function(e){e.inboundSchema=Kn.BatchJobOut$inboundSchema,e.outboundSchema=Kn.BatchJobOut$outboundSchema})(nCt||(Kn.BatchJobOut$=nCt={}));function dHr(e){return JSON.stringify(Kn.BatchJobOut$outboundSchema.parse(e))}function fHr(e){return(0,cHr.safeParse)(e,t=>Kn.BatchJobOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'BatchJobOut' from JSON")}});var cCt=b(Yn=>{"use strict";var pHr=Yn&&Yn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hHr=Yn&&Yn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),mHr=Yn&&Yn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&pHr(t,e,r);return hHr(t,e),t};Object.defineProperty(Yn,"__esModule",{value:!0});Yn.BatchJobsOut$=Yn.BatchJobsOut$outboundSchema=Yn.BatchJobsOut$inboundSchema=Yn.BatchJobsOutObject$=Yn.BatchJobsOutObject$outboundSchema=Yn.BatchJobsOutObject$inboundSchema=Yn.BatchJobsOutObject=void 0;Yn.batchJobsOutToJSON=yHr;Yn.batchJobsOutFromJSON=bHr;var iC=mHr(me()),gHr=ce(),lCt=bEe();Yn.BatchJobsOutObject={List:"list"};Yn.BatchJobsOutObject$inboundSchema=iC.nativeEnum(Yn.BatchJobsOutObject);Yn.BatchJobsOutObject$outboundSchema=Yn.BatchJobsOutObject$inboundSchema;var sCt;(function(e){e.inboundSchema=Yn.BatchJobsOutObject$inboundSchema,e.outboundSchema=Yn.BatchJobsOutObject$outboundSchema})(sCt||(Yn.BatchJobsOutObject$=sCt={}));Yn.BatchJobsOut$inboundSchema=iC.object({data:iC.array(lCt.BatchJobOut$inboundSchema).optional(),object:iC.literal("list").default("list"),total:iC.number().int()});Yn.BatchJobsOut$outboundSchema=iC.object({data:iC.array(lCt.BatchJobOut$outboundSchema).optional(),object:iC.literal("list").default("list"),total:iC.number().int()});var uCt;(function(e){e.inboundSchema=Yn.BatchJobsOut$inboundSchema,e.outboundSchema=Yn.BatchJobsOut$outboundSchema})(uCt||(Yn.BatchJobsOut$=uCt={}));function yHr(e){return JSON.stringify(Yn.BatchJobsOut$outboundSchema.parse(e))}function bHr(e){return(0,gHr.safeParse)(e,t=>Yn.BatchJobsOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'BatchJobsOut' from JSON")}});var gCt=b(Pt=>{"use strict";var _Hr=Pt&&Pt.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),vHr=Pt&&Pt.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),wHr=Pt&&Pt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_Hr(t,e,r);return vHr(t,e),t};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.ChatClassificationRequest$=Pt.ChatClassificationRequest$outboundSchema=Pt.ChatClassificationRequest$inboundSchema=Pt.ChatClassificationRequestInputs$=Pt.ChatClassificationRequestInputs$outboundSchema=Pt.ChatClassificationRequestInputs$inboundSchema=Pt.One$=Pt.One$outboundSchema=Pt.One$inboundSchema=Pt.Two$=Pt.Two$outboundSchema=Pt.Two$inboundSchema=void 0;Pt.twoToJSON=SHr;Pt.twoFromJSON=xHr;Pt.oneToJSON=CHr;Pt.oneFromJSON=OHr;Pt.chatClassificationRequestInputsToJSON=EHr;Pt.chatClassificationRequestInputsFromJSON=PHr;Pt.chatClassificationRequestToJSON=THr;Pt.chatClassificationRequestFromJSON=MHr;var ue=wHr(me()),mCt=Oe(),Ste=ce(),em=tT(),tm=h1(),rm=m1(),nm=g1();Pt.Two$inboundSchema=ue.union([tm.SystemMessage$inboundSchema.and(ue.object({role:ue.literal("system")}).transform(e=>({role:e.role}))),nm.UserMessage$inboundSchema.and(ue.object({role:ue.literal("user")}).transform(e=>({role:e.role}))),em.AssistantMessage$inboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(e=>({role:e.role}))),rm.ToolMessage$inboundSchema.and(ue.object({role:ue.literal("tool")}).transform(e=>({role:e.role})))]);Pt.Two$outboundSchema=ue.union([tm.SystemMessage$outboundSchema.and(ue.object({role:ue.literal("system")}).transform(e=>({role:e.role}))),nm.UserMessage$outboundSchema.and(ue.object({role:ue.literal("user")}).transform(e=>({role:e.role}))),em.AssistantMessage$outboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(e=>({role:e.role}))),rm.ToolMessage$outboundSchema.and(ue.object({role:ue.literal("tool")}).transform(e=>({role:e.role})))]);var dCt;(function(e){e.inboundSchema=Pt.Two$inboundSchema,e.outboundSchema=Pt.Two$outboundSchema})(dCt||(Pt.Two$=dCt={}));function SHr(e){return JSON.stringify(Pt.Two$outboundSchema.parse(e))}function xHr(e){return(0,Ste.safeParse)(e,t=>Pt.Two$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Two' from JSON")}Pt.One$inboundSchema=ue.union([tm.SystemMessage$inboundSchema.and(ue.object({role:ue.literal("system")}).transform(e=>({role:e.role}))),nm.UserMessage$inboundSchema.and(ue.object({role:ue.literal("user")}).transform(e=>({role:e.role}))),em.AssistantMessage$inboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(e=>({role:e.role}))),rm.ToolMessage$inboundSchema.and(ue.object({role:ue.literal("tool")}).transform(e=>({role:e.role})))]);Pt.One$outboundSchema=ue.union([tm.SystemMessage$outboundSchema.and(ue.object({role:ue.literal("system")}).transform(e=>({role:e.role}))),nm.UserMessage$outboundSchema.and(ue.object({role:ue.literal("user")}).transform(e=>({role:e.role}))),em.AssistantMessage$outboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(e=>({role:e.role}))),rm.ToolMessage$outboundSchema.and(ue.object({role:ue.literal("tool")}).transform(e=>({role:e.role})))]);var fCt;(function(e){e.inboundSchema=Pt.One$inboundSchema,e.outboundSchema=Pt.One$outboundSchema})(fCt||(Pt.One$=fCt={}));function CHr(e){return JSON.stringify(Pt.One$outboundSchema.parse(e))}function OHr(e){return(0,Ste.safeParse)(e,t=>Pt.One$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'One' from JSON")}Pt.ChatClassificationRequestInputs$inboundSchema=ue.union([ue.array(ue.union([tm.SystemMessage$inboundSchema.and(ue.object({role:ue.literal("system")}).transform(e=>({role:e.role}))),nm.UserMessage$inboundSchema.and(ue.object({role:ue.literal("user")}).transform(e=>({role:e.role}))),em.AssistantMessage$inboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(e=>({role:e.role}))),rm.ToolMessage$inboundSchema.and(ue.object({role:ue.literal("tool")}).transform(e=>({role:e.role})))])),ue.array(ue.array(ue.union([tm.SystemMessage$inboundSchema.and(ue.object({role:ue.literal("system")}).transform(e=>({role:e.role}))),nm.UserMessage$inboundSchema.and(ue.object({role:ue.literal("user")}).transform(e=>({role:e.role}))),em.AssistantMessage$inboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(e=>({role:e.role}))),rm.ToolMessage$inboundSchema.and(ue.object({role:ue.literal("tool")}).transform(e=>({role:e.role})))])))]);Pt.ChatClassificationRequestInputs$outboundSchema=ue.union([ue.array(ue.union([tm.SystemMessage$outboundSchema.and(ue.object({role:ue.literal("system")}).transform(e=>({role:e.role}))),nm.UserMessage$outboundSchema.and(ue.object({role:ue.literal("user")}).transform(e=>({role:e.role}))),em.AssistantMessage$outboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(e=>({role:e.role}))),rm.ToolMessage$outboundSchema.and(ue.object({role:ue.literal("tool")}).transform(e=>({role:e.role})))])),ue.array(ue.array(ue.union([tm.SystemMessage$outboundSchema.and(ue.object({role:ue.literal("system")}).transform(e=>({role:e.role}))),nm.UserMessage$outboundSchema.and(ue.object({role:ue.literal("user")}).transform(e=>({role:e.role}))),em.AssistantMessage$outboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(e=>({role:e.role}))),rm.ToolMessage$outboundSchema.and(ue.object({role:ue.literal("tool")}).transform(e=>({role:e.role})))])))]);var pCt;(function(e){e.inboundSchema=Pt.ChatClassificationRequestInputs$inboundSchema,e.outboundSchema=Pt.ChatClassificationRequestInputs$outboundSchema})(pCt||(Pt.ChatClassificationRequestInputs$=pCt={}));function EHr(e){return JSON.stringify(Pt.ChatClassificationRequestInputs$outboundSchema.parse(e))}function PHr(e){return(0,Ste.safeParse)(e,t=>Pt.ChatClassificationRequestInputs$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ChatClassificationRequestInputs' from JSON")}Pt.ChatClassificationRequest$inboundSchema=ue.object({input:ue.union([ue.array(ue.union([tm.SystemMessage$inboundSchema.and(ue.object({role:ue.literal("system")}).transform(e=>({role:e.role}))),nm.UserMessage$inboundSchema.and(ue.object({role:ue.literal("user")}).transform(e=>({role:e.role}))),em.AssistantMessage$inboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(e=>({role:e.role}))),rm.ToolMessage$inboundSchema.and(ue.object({role:ue.literal("tool")}).transform(e=>({role:e.role})))])),ue.array(ue.array(ue.union([tm.SystemMessage$inboundSchema.and(ue.object({role:ue.literal("system")}).transform(e=>({role:e.role}))),nm.UserMessage$inboundSchema.and(ue.object({role:ue.literal("user")}).transform(e=>({role:e.role}))),em.AssistantMessage$inboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(e=>({role:e.role}))),rm.ToolMessage$inboundSchema.and(ue.object({role:ue.literal("tool")}).transform(e=>({role:e.role})))])))]),model:ue.nullable(ue.string())}).transform(e=>(0,mCt.remap)(e,{input:"inputs"}));Pt.ChatClassificationRequest$outboundSchema=ue.object({inputs:ue.union([ue.array(ue.union([tm.SystemMessage$outboundSchema.and(ue.object({role:ue.literal("system")}).transform(e=>({role:e.role}))),nm.UserMessage$outboundSchema.and(ue.object({role:ue.literal("user")}).transform(e=>({role:e.role}))),em.AssistantMessage$outboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(e=>({role:e.role}))),rm.ToolMessage$outboundSchema.and(ue.object({role:ue.literal("tool")}).transform(e=>({role:e.role})))])),ue.array(ue.array(ue.union([tm.SystemMessage$outboundSchema.and(ue.object({role:ue.literal("system")}).transform(e=>({role:e.role}))),nm.UserMessage$outboundSchema.and(ue.object({role:ue.literal("user")}).transform(e=>({role:e.role}))),em.AssistantMessage$outboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(e=>({role:e.role}))),rm.ToolMessage$outboundSchema.and(ue.object({role:ue.literal("tool")}).transform(e=>({role:e.role})))])))]),model:ue.nullable(ue.string())}).transform(e=>(0,mCt.remap)(e,{inputs:"input"}));var hCt;(function(e){e.inboundSchema=Pt.ChatClassificationRequest$inboundSchema,e.outboundSchema=Pt.ChatClassificationRequest$outboundSchema})(hCt||(Pt.ChatClassificationRequest$=hCt={}));function THr(e){return JSON.stringify(Pt.ChatClassificationRequest$outboundSchema.parse(e))}function MHr(e){return(0,Ste.safeParse)(e,t=>Pt.ChatClassificationRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var xte=b(Mn=>{"use strict";var IHr=Mn&&Mn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),AHr=Mn&&Mn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),RHr=Mn&&Mn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&IHr(t,e,r);return AHr(t,e),t};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.ChatCompletionChoice$=Mn.ChatCompletionChoice$outboundSchema=Mn.ChatCompletionChoice$inboundSchema=Mn.FinishReason$=Mn.FinishReason$outboundSchema=Mn.FinishReason$inboundSchema=Mn.FinishReason=void 0;Mn.chatCompletionChoiceToJSON=NHr;Mn.chatCompletionChoiceFromJSON=LHr;var Ag=RHr(me()),_Ct=Oe(),DHr=ce(),jHr=eT(),vCt=tT();Mn.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};Mn.FinishReason$inboundSchema=Ag.union([Ag.nativeEnum(Mn.FinishReason),Ag.string().transform(jHr.catchUnrecognizedEnum)]);Mn.FinishReason$outboundSchema=Ag.union([Ag.nativeEnum(Mn.FinishReason),Ag.string().and(Ag.custom())]);var yCt;(function(e){e.inboundSchema=Mn.FinishReason$inboundSchema,e.outboundSchema=Mn.FinishReason$outboundSchema})(yCt||(Mn.FinishReason$=yCt={}));Mn.ChatCompletionChoice$inboundSchema=Ag.object({index:Ag.number().int(),message:vCt.AssistantMessage$inboundSchema,finish_reason:Mn.FinishReason$inboundSchema}).transform(e=>(0,_Ct.remap)(e,{finish_reason:"finishReason"}));Mn.ChatCompletionChoice$outboundSchema=Ag.object({index:Ag.number().int(),message:vCt.AssistantMessage$outboundSchema,finishReason:Mn.FinishReason$outboundSchema}).transform(e=>(0,_Ct.remap)(e,{finishReason:"finish_reason"}));var bCt;(function(e){e.inboundSchema=Mn.ChatCompletionChoice$inboundSchema,e.outboundSchema=Mn.ChatCompletionChoice$outboundSchema})(bCt||(Mn.ChatCompletionChoice$=bCt={}));function NHr(e){return JSON.stringify(Mn.ChatCompletionChoice$outboundSchema.parse(e))}function LHr(e){return(0,DHr.safeParse)(e,t=>Mn.ChatCompletionChoice$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var MCt=b(Tt=>{"use strict";var FHr=Tt&&Tt.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),kHr=Tt&&Tt.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),BHr=Tt&&Tt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&FHr(t,e,r);return kHr(t,e),t};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.ChatCompletionRequest$=Tt.ChatCompletionRequest$outboundSchema=Tt.ChatCompletionRequest$inboundSchema=Tt.ChatCompletionRequestToolChoice$=Tt.ChatCompletionRequestToolChoice$outboundSchema=Tt.ChatCompletionRequestToolChoice$inboundSchema=Tt.Messages$=Tt.Messages$outboundSchema=Tt.Messages$inboundSchema=Tt.Stop$=Tt.Stop$outboundSchema=Tt.Stop$inboundSchema=void 0;Tt.stopToJSON=$Hr;Tt.stopFromJSON=qHr;Tt.messagesToJSON=UHr;Tt.messagesFromJSON=zHr;Tt.chatCompletionRequestToolChoiceToJSON=HHr;Tt.chatCompletionRequestToolChoiceFromJSON=VHr;Tt.chatCompletionRequestToJSON=WHr;Tt.chatCompletionRequestFromJSON=JHr;var Se=BHr(me()),OCt=Oe(),Cte=ce(),Ote=tT(),ECt=Uk(),PCt=zk(),Ete=h1(),TCt=Hk(),Pte=Vk(),Tte=Wk(),Mte=m1(),Ite=g1();Tt.Stop$inboundSchema=Se.union([Se.string(),Se.array(Se.string())]);Tt.Stop$outboundSchema=Se.union([Se.string(),Se.array(Se.string())]);var wCt;(function(e){e.inboundSchema=Tt.Stop$inboundSchema,e.outboundSchema=Tt.Stop$outboundSchema})(wCt||(Tt.Stop$=wCt={}));function $Hr(e){return JSON.stringify(Tt.Stop$outboundSchema.parse(e))}function qHr(e){return(0,Cte.safeParse)(e,t=>Tt.Stop$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Stop' from JSON")}Tt.Messages$inboundSchema=Se.union([Ete.SystemMessage$inboundSchema.and(Se.object({role:Se.literal("system")}).transform(e=>({role:e.role}))),Ite.UserMessage$inboundSchema.and(Se.object({role:Se.literal("user")}).transform(e=>({role:e.role}))),Ote.AssistantMessage$inboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(e=>({role:e.role}))),Mte.ToolMessage$inboundSchema.and(Se.object({role:Se.literal("tool")}).transform(e=>({role:e.role})))]);Tt.Messages$outboundSchema=Se.union([Ete.SystemMessage$outboundSchema.and(Se.object({role:Se.literal("system")}).transform(e=>({role:e.role}))),Ite.UserMessage$outboundSchema.and(Se.object({role:Se.literal("user")}).transform(e=>({role:e.role}))),Ote.AssistantMessage$outboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(e=>({role:e.role}))),Mte.ToolMessage$outboundSchema.and(Se.object({role:Se.literal("tool")}).transform(e=>({role:e.role})))]);var SCt;(function(e){e.inboundSchema=Tt.Messages$inboundSchema,e.outboundSchema=Tt.Messages$outboundSchema})(SCt||(Tt.Messages$=SCt={}));function UHr(e){return JSON.stringify(Tt.Messages$outboundSchema.parse(e))}function zHr(e){return(0,Cte.safeParse)(e,t=>Tt.Messages$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Messages' from JSON")}Tt.ChatCompletionRequestToolChoice$inboundSchema=Se.union([Pte.ToolChoice$inboundSchema,Tte.ToolChoiceEnum$inboundSchema]);Tt.ChatCompletionRequestToolChoice$outboundSchema=Se.union([Pte.ToolChoice$outboundSchema,Tte.ToolChoiceEnum$outboundSchema]);var xCt;(function(e){e.inboundSchema=Tt.ChatCompletionRequestToolChoice$inboundSchema,e.outboundSchema=Tt.ChatCompletionRequestToolChoice$outboundSchema})(xCt||(Tt.ChatCompletionRequestToolChoice$=xCt={}));function HHr(e){return JSON.stringify(Tt.ChatCompletionRequestToolChoice$outboundSchema.parse(e))}function VHr(e){return(0,Cte.safeParse)(e,t=>Tt.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}Tt.ChatCompletionRequest$inboundSchema=Se.object({model:Se.nullable(Se.string()),temperature:Se.nullable(Se.number()).optional(),top_p:Se.number().optional(),max_tokens:Se.nullable(Se.number().int()).optional(),stream:Se.boolean().default(!1),stop:Se.union([Se.string(),Se.array(Se.string())]).optional(),random_seed:Se.nullable(Se.number().int()).optional(),messages:Se.array(Se.union([Ete.SystemMessage$inboundSchema.and(Se.object({role:Se.literal("system")}).transform(e=>({role:e.role}))),Ite.UserMessage$inboundSchema.and(Se.object({role:Se.literal("user")}).transform(e=>({role:e.role}))),Ote.AssistantMessage$inboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(e=>({role:e.role}))),Mte.ToolMessage$inboundSchema.and(Se.object({role:Se.literal("tool")}).transform(e=>({role:e.role})))])),response_format:PCt.ResponseFormat$inboundSchema.optional(),tools:Se.nullable(Se.array(TCt.Tool$inboundSchema)).optional(),tool_choice:Se.union([Pte.ToolChoice$inboundSchema,Tte.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Se.number().optional(),frequency_penalty:Se.number().optional(),n:Se.nullable(Se.number().int()).optional(),prediction:ECt.Prediction$inboundSchema.optional(),safe_prompt:Se.boolean().optional()}).transform(e=>(0,OCt.remap)(e,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",safe_prompt:"safePrompt"}));Tt.ChatCompletionRequest$outboundSchema=Se.object({model:Se.nullable(Se.string()),temperature:Se.nullable(Se.number()).optional(),topP:Se.number().optional(),maxTokens:Se.nullable(Se.number().int()).optional(),stream:Se.boolean().default(!1),stop:Se.union([Se.string(),Se.array(Se.string())]).optional(),randomSeed:Se.nullable(Se.number().int()).optional(),messages:Se.array(Se.union([Ete.SystemMessage$outboundSchema.and(Se.object({role:Se.literal("system")}).transform(e=>({role:e.role}))),Ite.UserMessage$outboundSchema.and(Se.object({role:Se.literal("user")}).transform(e=>({role:e.role}))),Ote.AssistantMessage$outboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(e=>({role:e.role}))),Mte.ToolMessage$outboundSchema.and(Se.object({role:Se.literal("tool")}).transform(e=>({role:e.role})))])),responseFormat:PCt.ResponseFormat$outboundSchema.optional(),tools:Se.nullable(Se.array(TCt.Tool$outboundSchema)).optional(),toolChoice:Se.union([Pte.ToolChoice$outboundSchema,Tte.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Se.number().optional(),frequencyPenalty:Se.number().optional(),n:Se.nullable(Se.number().int()).optional(),prediction:ECt.Prediction$outboundSchema.optional(),safePrompt:Se.boolean().optional()}).transform(e=>(0,OCt.remap)(e,{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 CCt;(function(e){e.inboundSchema=Tt.ChatCompletionRequest$inboundSchema,e.outboundSchema=Tt.ChatCompletionRequest$outboundSchema})(CCt||(Tt.ChatCompletionRequest$=CCt={}));function WHr(e){return JSON.stringify(Tt.ChatCompletionRequest$outboundSchema.parse(e))}function JHr(e){return(0,Cte.safeParse)(e,t=>Tt.ChatCompletionRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var Gk=b(Ns=>{"use strict";var GHr=Ns&&Ns.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),KHr=Ns&&Ns.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),YHr=Ns&&Ns.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&GHr(t,e,r);return KHr(t,e),t};Object.defineProperty(Ns,"__esModule",{value:!0});Ns.UsageInfo$=Ns.UsageInfo$outboundSchema=Ns.UsageInfo$inboundSchema=void 0;Ns.usageInfoToJSON=XHr;Ns.usageInfoFromJSON=QHr;var rT=YHr(me()),ACt=Oe(),ZHr=ce();Ns.UsageInfo$inboundSchema=rT.object({prompt_tokens:rT.number().int(),completion_tokens:rT.number().int(),total_tokens:rT.number().int()}).transform(e=>(0,ACt.remap)(e,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens"}));Ns.UsageInfo$outboundSchema=rT.object({promptTokens:rT.number().int(),completionTokens:rT.number().int(),totalTokens:rT.number().int()}).transform(e=>(0,ACt.remap)(e,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens"}));var ICt;(function(e){e.inboundSchema=Ns.UsageInfo$inboundSchema,e.outboundSchema=Ns.UsageInfo$outboundSchema})(ICt||(Ns.UsageInfo$=ICt={}));function XHr(e){return JSON.stringify(Ns.UsageInfo$outboundSchema.parse(e))}function QHr(e){return(0,ZHr.safeParse)(e,t=>Ns.UsageInfo$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'UsageInfo' from JSON")}});var NCt=b(Ls=>{"use strict";var e6r=Ls&&Ls.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),t6r=Ls&&Ls.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r6r=Ls&&Ls.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&e6r(t,e,r);return t6r(t,e),t};Object.defineProperty(Ls,"__esModule",{value:!0});Ls.ChatCompletionResponse$=Ls.ChatCompletionResponse$outboundSchema=Ls.ChatCompletionResponse$inboundSchema=void 0;Ls.chatCompletionResponseToJSON=o6r;Ls.chatCompletionResponseFromJSON=i6r;var om=r6r(me()),n6r=ce(),DCt=xte(),jCt=Gk();Ls.ChatCompletionResponse$inboundSchema=om.object({id:om.string(),object:om.string(),model:om.string(),usage:jCt.UsageInfo$inboundSchema,created:om.number().int().optional(),choices:om.array(DCt.ChatCompletionChoice$inboundSchema).optional()});Ls.ChatCompletionResponse$outboundSchema=om.object({id:om.string(),object:om.string(),model:om.string(),usage:jCt.UsageInfo$outboundSchema,created:om.number().int().optional(),choices:om.array(DCt.ChatCompletionChoice$outboundSchema).optional()});var RCt;(function(e){e.inboundSchema=Ls.ChatCompletionResponse$inboundSchema,e.outboundSchema=Ls.ChatCompletionResponse$outboundSchema})(RCt||(Ls.ChatCompletionResponse$=RCt={}));function o6r(e){return JSON.stringify(Ls.ChatCompletionResponse$outboundSchema.parse(e))}function i6r(e){return(0,n6r.safeParse)(e,t=>Ls.ChatCompletionResponse$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var HCt=b(Mt=>{"use strict";var a6r=Mt&&Mt.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),s6r=Mt&&Mt.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),u6r=Mt&&Mt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&a6r(t,e,r);return s6r(t,e),t};Object.defineProperty(Mt,"__esModule",{value:!0});Mt.ChatCompletionStreamRequest$=Mt.ChatCompletionStreamRequest$outboundSchema=Mt.ChatCompletionStreamRequest$inboundSchema=Mt.ChatCompletionStreamRequestToolChoice$=Mt.ChatCompletionStreamRequestToolChoice$outboundSchema=Mt.ChatCompletionStreamRequestToolChoice$inboundSchema=Mt.ChatCompletionStreamRequestMessages$=Mt.ChatCompletionStreamRequestMessages$outboundSchema=Mt.ChatCompletionStreamRequestMessages$inboundSchema=Mt.ChatCompletionStreamRequestStop$=Mt.ChatCompletionStreamRequestStop$outboundSchema=Mt.ChatCompletionStreamRequestStop$inboundSchema=void 0;Mt.chatCompletionStreamRequestStopToJSON=l6r;Mt.chatCompletionStreamRequestStopFromJSON=c6r;Mt.chatCompletionStreamRequestMessagesToJSON=d6r;Mt.chatCompletionStreamRequestMessagesFromJSON=f6r;Mt.chatCompletionStreamRequestToolChoiceToJSON=p6r;Mt.chatCompletionStreamRequestToolChoiceFromJSON=h6r;Mt.chatCompletionStreamRequestToJSON=m6r;Mt.chatCompletionStreamRequestFromJSON=g6r;var xe=u6r(me()),$Ct=Oe(),Ate=ce(),Rte=tT(),qCt=Uk(),UCt=zk(),Dte=h1(),zCt=Hk(),jte=Vk(),Nte=Wk(),Lte=m1(),Fte=g1();Mt.ChatCompletionStreamRequestStop$inboundSchema=xe.union([xe.string(),xe.array(xe.string())]);Mt.ChatCompletionStreamRequestStop$outboundSchema=xe.union([xe.string(),xe.array(xe.string())]);var LCt;(function(e){e.inboundSchema=Mt.ChatCompletionStreamRequestStop$inboundSchema,e.outboundSchema=Mt.ChatCompletionStreamRequestStop$outboundSchema})(LCt||(Mt.ChatCompletionStreamRequestStop$=LCt={}));function l6r(e){return JSON.stringify(Mt.ChatCompletionStreamRequestStop$outboundSchema.parse(e))}function c6r(e){return(0,Ate.safeParse)(e,t=>Mt.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}Mt.ChatCompletionStreamRequestMessages$inboundSchema=xe.union([Dte.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(e=>({role:e.role}))),Fte.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(e=>({role:e.role}))),Rte.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(e=>({role:e.role}))),Lte.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(e=>({role:e.role})))]);Mt.ChatCompletionStreamRequestMessages$outboundSchema=xe.union([Dte.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(e=>({role:e.role}))),Fte.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(e=>({role:e.role}))),Rte.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(e=>({role:e.role}))),Lte.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(e=>({role:e.role})))]);var FCt;(function(e){e.inboundSchema=Mt.ChatCompletionStreamRequestMessages$inboundSchema,e.outboundSchema=Mt.ChatCompletionStreamRequestMessages$outboundSchema})(FCt||(Mt.ChatCompletionStreamRequestMessages$=FCt={}));function d6r(e){return JSON.stringify(Mt.ChatCompletionStreamRequestMessages$outboundSchema.parse(e))}function f6r(e){return(0,Ate.safeParse)(e,t=>Mt.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}Mt.ChatCompletionStreamRequestToolChoice$inboundSchema=xe.union([jte.ToolChoice$inboundSchema,Nte.ToolChoiceEnum$inboundSchema]);Mt.ChatCompletionStreamRequestToolChoice$outboundSchema=xe.union([jte.ToolChoice$outboundSchema,Nte.ToolChoiceEnum$outboundSchema]);var kCt;(function(e){e.inboundSchema=Mt.ChatCompletionStreamRequestToolChoice$inboundSchema,e.outboundSchema=Mt.ChatCompletionStreamRequestToolChoice$outboundSchema})(kCt||(Mt.ChatCompletionStreamRequestToolChoice$=kCt={}));function p6r(e){return JSON.stringify(Mt.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(e))}function h6r(e){return(0,Ate.safeParse)(e,t=>Mt.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}Mt.ChatCompletionStreamRequest$inboundSchema=xe.object({model:xe.nullable(xe.string()),temperature:xe.nullable(xe.number()).optional(),top_p:xe.number().optional(),max_tokens:xe.nullable(xe.number().int()).optional(),stream:xe.boolean().default(!0),stop:xe.union([xe.string(),xe.array(xe.string())]).optional(),random_seed:xe.nullable(xe.number().int()).optional(),messages:xe.array(xe.union([Dte.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(e=>({role:e.role}))),Fte.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(e=>({role:e.role}))),Rte.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(e=>({role:e.role}))),Lte.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(e=>({role:e.role})))])),response_format:UCt.ResponseFormat$inboundSchema.optional(),tools:xe.nullable(xe.array(zCt.Tool$inboundSchema)).optional(),tool_choice:xe.union([jte.ToolChoice$inboundSchema,Nte.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:xe.number().optional(),frequency_penalty:xe.number().optional(),n:xe.nullable(xe.number().int()).optional(),prediction:qCt.Prediction$inboundSchema.optional(),safe_prompt:xe.boolean().optional()}).transform(e=>(0,$Ct.remap)(e,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",safe_prompt:"safePrompt"}));Mt.ChatCompletionStreamRequest$outboundSchema=xe.object({model:xe.nullable(xe.string()),temperature:xe.nullable(xe.number()).optional(),topP:xe.number().optional(),maxTokens:xe.nullable(xe.number().int()).optional(),stream:xe.boolean().default(!0),stop:xe.union([xe.string(),xe.array(xe.string())]).optional(),randomSeed:xe.nullable(xe.number().int()).optional(),messages:xe.array(xe.union([Dte.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(e=>({role:e.role}))),Fte.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(e=>({role:e.role}))),Rte.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(e=>({role:e.role}))),Lte.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(e=>({role:e.role})))])),responseFormat:UCt.ResponseFormat$outboundSchema.optional(),tools:xe.nullable(xe.array(zCt.Tool$outboundSchema)).optional(),toolChoice:xe.union([jte.ToolChoice$outboundSchema,Nte.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:xe.number().optional(),frequencyPenalty:xe.number().optional(),n:xe.nullable(xe.number().int()).optional(),prediction:qCt.Prediction$outboundSchema.optional(),safePrompt:xe.boolean().optional()}).transform(e=>(0,$Ct.remap)(e,{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 BCt;(function(e){e.inboundSchema=Mt.ChatCompletionStreamRequest$inboundSchema,e.outboundSchema=Mt.ChatCompletionStreamRequest$outboundSchema})(BCt||(Mt.ChatCompletionStreamRequest$=BCt={}));function m6r(e){return JSON.stringify(Mt.ChatCompletionStreamRequest$outboundSchema.parse(e))}function g6r(e){return(0,Ate.safeParse)(e,t=>Mt.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var _Ee=b(Fs=>{"use strict";var y6r=Fs&&Fs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),b6r=Fs&&Fs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_6r=Fs&&Fs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&y6r(t,e,r);return b6r(t,e),t};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.MetricOut$=Fs.MetricOut$outboundSchema=Fs.MetricOut$inboundSchema=void 0;Fs.metricOutToJSON=w6r;Fs.metricOutFromJSON=S6r;var qf=_6r(me()),WCt=Oe(),v6r=ce();Fs.MetricOut$inboundSchema=qf.object({train_loss:qf.nullable(qf.number()).optional(),valid_loss:qf.nullable(qf.number()).optional(),valid_mean_token_accuracy:qf.nullable(qf.number()).optional()}).transform(e=>(0,WCt.remap)(e,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));Fs.MetricOut$outboundSchema=qf.object({trainLoss:qf.nullable(qf.number()).optional(),validLoss:qf.nullable(qf.number()).optional(),validMeanTokenAccuracy:qf.nullable(qf.number()).optional()}).transform(e=>(0,WCt.remap)(e,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var VCt;(function(e){e.inboundSchema=Fs.MetricOut$inboundSchema,e.outboundSchema=Fs.MetricOut$outboundSchema})(VCt||(Fs.MetricOut$=VCt={}));function w6r(e){return JSON.stringify(Fs.MetricOut$outboundSchema.parse(e))}function S6r(e){return(0,v6r.safeParse)(e,t=>Fs.MetricOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'MetricOut' from JSON")}});var vEe=b(ks=>{"use strict";var x6r=ks&&ks.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),C6r=ks&&ks.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),O6r=ks&&ks.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&x6r(t,e,r);return C6r(t,e),t};Object.defineProperty(ks,"__esModule",{value:!0});ks.CheckpointOut$=ks.CheckpointOut$outboundSchema=ks.CheckpointOut$inboundSchema=void 0;ks.checkpointOutToJSON=P6r;ks.checkpointOutFromJSON=T6r;var Kk=O6r(me()),GCt=Oe(),E6r=ce(),KCt=_Ee();ks.CheckpointOut$inboundSchema=Kk.object({metrics:KCt.MetricOut$inboundSchema,step_number:Kk.number().int(),created_at:Kk.number().int()}).transform(e=>(0,GCt.remap)(e,{step_number:"stepNumber",created_at:"createdAt"}));ks.CheckpointOut$outboundSchema=Kk.object({metrics:KCt.MetricOut$outboundSchema,stepNumber:Kk.number().int(),createdAt:Kk.number().int()}).transform(e=>(0,GCt.remap)(e,{stepNumber:"step_number",createdAt:"created_at"}));var JCt;(function(e){e.inboundSchema=ks.CheckpointOut$inboundSchema,e.outboundSchema=ks.CheckpointOut$outboundSchema})(JCt||(ks.CheckpointOut$=JCt={}));function P6r(e){return JSON.stringify(ks.CheckpointOut$outboundSchema.parse(e))}function T6r(e){return(0,E6r.safeParse)(e,t=>ks.CheckpointOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'CheckpointOut' from JSON")}});var wEe=b(Bs=>{"use strict";var M6r=Bs&&Bs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),I6r=Bs&&Bs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),A6r=Bs&&Bs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&M6r(t,e,r);return I6r(t,e),t};Object.defineProperty(Bs,"__esModule",{value:!0});Bs.ClassificationObject$=Bs.ClassificationObject$outboundSchema=Bs.ClassificationObject$inboundSchema=void 0;Bs.classificationObjectToJSON=D6r;Bs.classificationObjectFromJSON=j6r;var Uw=A6r(me()),ZCt=Oe(),R6r=ce();Bs.ClassificationObject$inboundSchema=Uw.object({categories:Uw.record(Uw.boolean()).optional(),category_scores:Uw.record(Uw.number()).optional()}).transform(e=>(0,ZCt.remap)(e,{category_scores:"categoryScores"}));Bs.ClassificationObject$outboundSchema=Uw.object({categories:Uw.record(Uw.boolean()).optional(),categoryScores:Uw.record(Uw.number()).optional()}).transform(e=>(0,ZCt.remap)(e,{categoryScores:"category_scores"}));var YCt;(function(e){e.inboundSchema=Bs.ClassificationObject$inboundSchema,e.outboundSchema=Bs.ClassificationObject$outboundSchema})(YCt||(Bs.ClassificationObject$=YCt={}));function D6r(e){return JSON.stringify(Bs.ClassificationObject$outboundSchema.parse(e))}function j6r(e){return(0,R6r.safeParse)(e,t=>Bs.ClassificationObject$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ClassificationObject' from JSON")}});var rOt=b(Zn=>{"use strict";var N6r=Zn&&Zn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),L6r=Zn&&Zn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),F6r=Zn&&Zn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&N6r(t,e,r);return L6r(t,e),t};Object.defineProperty(Zn,"__esModule",{value:!0});Zn.ClassificationRequest$=Zn.ClassificationRequest$outboundSchema=Zn.ClassificationRequest$inboundSchema=Zn.ClassificationRequestInputs$=Zn.ClassificationRequestInputs$outboundSchema=Zn.ClassificationRequestInputs$inboundSchema=void 0;Zn.classificationRequestInputsToJSON=k6r;Zn.classificationRequestInputsFromJSON=B6r;Zn.classificationRequestToJSON=$6r;Zn.classificationRequestFromJSON=q6r;var Na=F6r(me()),eOt=Oe(),tOt=ce();Zn.ClassificationRequestInputs$inboundSchema=Na.union([Na.string(),Na.array(Na.string())]);Zn.ClassificationRequestInputs$outboundSchema=Na.union([Na.string(),Na.array(Na.string())]);var XCt;(function(e){e.inboundSchema=Zn.ClassificationRequestInputs$inboundSchema,e.outboundSchema=Zn.ClassificationRequestInputs$outboundSchema})(XCt||(Zn.ClassificationRequestInputs$=XCt={}));function k6r(e){return JSON.stringify(Zn.ClassificationRequestInputs$outboundSchema.parse(e))}function B6r(e){return(0,tOt.safeParse)(e,t=>Zn.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ClassificationRequestInputs' from JSON")}Zn.ClassificationRequest$inboundSchema=Na.object({input:Na.union([Na.string(),Na.array(Na.string())]),model:Na.nullable(Na.string()).optional()}).transform(e=>(0,eOt.remap)(e,{input:"inputs"}));Zn.ClassificationRequest$outboundSchema=Na.object({inputs:Na.union([Na.string(),Na.array(Na.string())]),model:Na.nullable(Na.string()).optional()}).transform(e=>(0,eOt.remap)(e,{inputs:"input"}));var QCt;(function(e){e.inboundSchema=Zn.ClassificationRequest$inboundSchema,e.outboundSchema=Zn.ClassificationRequest$outboundSchema})(QCt||(Zn.ClassificationRequest$=QCt={}));function $6r(e){return JSON.stringify(Zn.ClassificationRequest$outboundSchema.parse(e))}function q6r(e){return(0,tOt.safeParse)(e,t=>Zn.ClassificationRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ClassificationRequest' from JSON")}});var iOt=b($s=>{"use strict";var U6r=$s&&$s.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),z6r=$s&&$s.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),H6r=$s&&$s.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&U6r(t,e,r);return z6r(t,e),t};Object.defineProperty($s,"__esModule",{value:!0});$s.ClassificationResponse$=$s.ClassificationResponse$outboundSchema=$s.ClassificationResponse$inboundSchema=void 0;$s.classificationResponseToJSON=W6r;$s.classificationResponseFromJSON=J6r;var nT=H6r(me()),V6r=ce(),oOt=wEe();$s.ClassificationResponse$inboundSchema=nT.object({id:nT.string().optional(),model:nT.string().optional(),results:nT.array(oOt.ClassificationObject$inboundSchema).optional()});$s.ClassificationResponse$outboundSchema=nT.object({id:nT.string().optional(),model:nT.string().optional(),results:nT.array(oOt.ClassificationObject$outboundSchema).optional()});var nOt;(function(e){e.inboundSchema=$s.ClassificationResponse$inboundSchema,e.outboundSchema=$s.ClassificationResponse$outboundSchema})(nOt||($s.ClassificationResponse$=nOt={}));function W6r(e){return JSON.stringify($s.ClassificationResponse$outboundSchema.parse(e))}function J6r(e){return(0,V6r.safeParse)(e,t=>$s.ClassificationResponse$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ClassificationResponse' from JSON")}});var SEe=b(Xn=>{"use strict";var G6r=Xn&&Xn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),K6r=Xn&&Xn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Y6r=Xn&&Xn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&G6r(t,e,r);return K6r(t,e),t};Object.defineProperty(Xn,"__esModule",{value:!0});Xn.DeltaMessage$=Xn.DeltaMessage$outboundSchema=Xn.DeltaMessage$inboundSchema=Xn.Content$=Xn.Content$outboundSchema=Xn.Content$inboundSchema=void 0;Xn.contentToJSON=Z6r;Xn.contentFromJSON=X6r;Xn.deltaMessageToJSON=Q6r;Xn.deltaMessageFromJSON=eVr;var Wi=Y6r(me()),uOt=Oe(),lOt=ce(),kte=$k(),cOt=ete();Xn.Content$inboundSchema=Wi.union([Wi.string(),Wi.array(kte.ContentChunk$inboundSchema)]);Xn.Content$outboundSchema=Wi.union([Wi.string(),Wi.array(kte.ContentChunk$outboundSchema)]);var aOt;(function(e){e.inboundSchema=Xn.Content$inboundSchema,e.outboundSchema=Xn.Content$outboundSchema})(aOt||(Xn.Content$=aOt={}));function Z6r(e){return JSON.stringify(Xn.Content$outboundSchema.parse(e))}function X6r(e){return(0,lOt.safeParse)(e,t=>Xn.Content$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Content' from JSON")}Xn.DeltaMessage$inboundSchema=Wi.object({role:Wi.nullable(Wi.string()).optional(),content:Wi.nullable(Wi.union([Wi.string(),Wi.array(kte.ContentChunk$inboundSchema)])).optional(),tool_calls:Wi.nullable(Wi.array(cOt.ToolCall$inboundSchema)).optional()}).transform(e=>(0,uOt.remap)(e,{tool_calls:"toolCalls"}));Xn.DeltaMessage$outboundSchema=Wi.object({role:Wi.nullable(Wi.string()).optional(),content:Wi.nullable(Wi.union([Wi.string(),Wi.array(kte.ContentChunk$outboundSchema)])).optional(),toolCalls:Wi.nullable(Wi.array(cOt.ToolCall$outboundSchema)).optional()}).transform(e=>(0,uOt.remap)(e,{toolCalls:"tool_calls"}));var sOt;(function(e){e.inboundSchema=Xn.DeltaMessage$inboundSchema,e.outboundSchema=Xn.DeltaMessage$outboundSchema})(sOt||(Xn.DeltaMessage$=sOt={}));function Q6r(e){return JSON.stringify(Xn.DeltaMessage$outboundSchema.parse(e))}function eVr(e){return(0,lOt.safeParse)(e,t=>Xn.DeltaMessage$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'DeltaMessage' from JSON")}});var xEe=b(In=>{"use strict";var tVr=In&&In.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),rVr=In&&In.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),nVr=In&&In.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&tVr(t,e,r);return rVr(t,e),t};Object.defineProperty(In,"__esModule",{value:!0});In.CompletionResponseStreamChoice$=In.CompletionResponseStreamChoice$outboundSchema=In.CompletionResponseStreamChoice$inboundSchema=In.CompletionResponseStreamChoiceFinishReason$=In.CompletionResponseStreamChoiceFinishReason$outboundSchema=In.CompletionResponseStreamChoiceFinishReason$inboundSchema=In.CompletionResponseStreamChoiceFinishReason=void 0;In.completionResponseStreamChoiceToJSON=aVr;In.completionResponseStreamChoiceFromJSON=sVr;var Rp=nVr(me()),pOt=Oe(),oVr=ce(),iVr=eT(),hOt=SEe();In.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};In.CompletionResponseStreamChoiceFinishReason$inboundSchema=Rp.union([Rp.nativeEnum(In.CompletionResponseStreamChoiceFinishReason),Rp.string().transform(iVr.catchUnrecognizedEnum)]);In.CompletionResponseStreamChoiceFinishReason$outboundSchema=Rp.union([Rp.nativeEnum(In.CompletionResponseStreamChoiceFinishReason),Rp.string().and(Rp.custom())]);var dOt;(function(e){e.inboundSchema=In.CompletionResponseStreamChoiceFinishReason$inboundSchema,e.outboundSchema=In.CompletionResponseStreamChoiceFinishReason$outboundSchema})(dOt||(In.CompletionResponseStreamChoiceFinishReason$=dOt={}));In.CompletionResponseStreamChoice$inboundSchema=Rp.object({index:Rp.number().int(),delta:hOt.DeltaMessage$inboundSchema,finish_reason:Rp.nullable(In.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(e=>(0,pOt.remap)(e,{finish_reason:"finishReason"}));In.CompletionResponseStreamChoice$outboundSchema=Rp.object({index:Rp.number().int(),delta:hOt.DeltaMessage$outboundSchema,finishReason:Rp.nullable(In.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(e=>(0,pOt.remap)(e,{finishReason:"finish_reason"}));var fOt;(function(e){e.inboundSchema=In.CompletionResponseStreamChoice$inboundSchema,e.outboundSchema=In.CompletionResponseStreamChoice$outboundSchema})(fOt||(In.CompletionResponseStreamChoice$=fOt={}));function aVr(e){return JSON.stringify(In.CompletionResponseStreamChoice$outboundSchema.parse(e))}function sVr(e){return(0,oVr.safeParse)(e,t=>In.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var CEe=b(qs=>{"use strict";var uVr=qs&&qs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),lVr=qs&&qs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),cVr=qs&&qs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&uVr(t,e,r);return lVr(t,e),t};Object.defineProperty(qs,"__esModule",{value:!0});qs.CompletionChunk$=qs.CompletionChunk$outboundSchema=qs.CompletionChunk$inboundSchema=void 0;qs.completionChunkToJSON=fVr;qs.completionChunkFromJSON=pVr;var im=cVr(me()),dVr=ce(),gOt=xEe(),yOt=Gk();qs.CompletionChunk$inboundSchema=im.object({id:im.string(),object:im.string().optional(),created:im.number().int().optional(),model:im.string(),usage:yOt.UsageInfo$inboundSchema.optional(),choices:im.array(gOt.CompletionResponseStreamChoice$inboundSchema)});qs.CompletionChunk$outboundSchema=im.object({id:im.string(),object:im.string().optional(),created:im.number().int().optional(),model:im.string(),usage:yOt.UsageInfo$outboundSchema.optional(),choices:im.array(gOt.CompletionResponseStreamChoice$outboundSchema)});var mOt;(function(e){e.inboundSchema=qs.CompletionChunk$inboundSchema,e.outboundSchema=qs.CompletionChunk$outboundSchema})(mOt||(qs.CompletionChunk$=mOt={}));function fVr(e){return JSON.stringify(qs.CompletionChunk$outboundSchema.parse(e))}function pVr(e){return(0,dVr.safeParse)(e,t=>qs.CompletionChunk$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'CompletionChunk' from JSON")}});var vOt=b(Us=>{"use strict";var hVr=Us&&Us.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),mVr=Us&&Us.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),gVr=Us&&Us.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&hVr(t,e,r);return mVr(t,e),t};Object.defineProperty(Us,"__esModule",{value:!0});Us.CompletionEvent$=Us.CompletionEvent$outboundSchema=Us.CompletionEvent$inboundSchema=void 0;Us.completionEventToJSON=bVr;Us.completionEventFromJSON=_Vr;var O3=gVr(me()),yVr=ce(),_Ot=CEe();Us.CompletionEvent$inboundSchema=O3.object({data:O3.string().transform((e,t)=>{try{return JSON.parse(e)}catch(r){return t.addIssue({code:O3.ZodIssueCode.custom,message:`malformed json: ${r}`}),O3.NEVER}}).pipe(_Ot.CompletionChunk$inboundSchema)});Us.CompletionEvent$outboundSchema=O3.object({data:_Ot.CompletionChunk$outboundSchema});var bOt;(function(e){e.inboundSchema=Us.CompletionEvent$inboundSchema,e.outboundSchema=Us.CompletionEvent$outboundSchema})(bOt||(Us.CompletionEvent$=bOt={}));function bVr(e){return JSON.stringify(Us.CompletionEvent$outboundSchema.parse(e))}function _Vr(e){return(0,yVr.safeParse)(e,t=>Us.CompletionEvent$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'CompletionEvent' from JSON")}});var SOt=b(zs=>{"use strict";var vVr=zs&&zs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),wVr=zs&&zs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),SVr=zs&&zs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&vVr(t,e,r);return wVr(t,e),t};Object.defineProperty(zs,"__esModule",{value:!0});zs.DeleteFileOut$=zs.DeleteFileOut$outboundSchema=zs.DeleteFileOut$inboundSchema=void 0;zs.deleteFileOutToJSON=CVr;zs.deleteFileOutFromJSON=OVr;var oT=SVr(me()),xVr=ce();zs.DeleteFileOut$inboundSchema=oT.object({id:oT.string(),object:oT.string(),deleted:oT.boolean()});zs.DeleteFileOut$outboundSchema=oT.object({id:oT.string(),object:oT.string(),deleted:oT.boolean()});var wOt;(function(e){e.inboundSchema=zs.DeleteFileOut$inboundSchema,e.outboundSchema=zs.DeleteFileOut$outboundSchema})(wOt||(zs.DeleteFileOut$=wOt={}));function CVr(e){return JSON.stringify(zs.DeleteFileOut$outboundSchema.parse(e))}function OVr(e){return(0,xVr.safeParse)(e,t=>zs.DeleteFileOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'DeleteFileOut' from JSON")}});var COt=b(Hs=>{"use strict";var EVr=Hs&&Hs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),PVr=Hs&&Hs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),TVr=Hs&&Hs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&EVr(t,e,r);return PVr(t,e),t};Object.defineProperty(Hs,"__esModule",{value:!0});Hs.DeleteModelOut$=Hs.DeleteModelOut$outboundSchema=Hs.DeleteModelOut$inboundSchema=void 0;Hs.deleteModelOutToJSON=IVr;Hs.deleteModelOutFromJSON=AVr;var iT=TVr(me()),MVr=ce();Hs.DeleteModelOut$inboundSchema=iT.object({id:iT.string(),object:iT.string().default("model"),deleted:iT.boolean().default(!0)});Hs.DeleteModelOut$outboundSchema=iT.object({id:iT.string(),object:iT.string().default("model"),deleted:iT.boolean().default(!0)});var xOt;(function(e){e.inboundSchema=Hs.DeleteModelOut$inboundSchema,e.outboundSchema=Hs.DeleteModelOut$outboundSchema})(xOt||(Hs.DeleteModelOut$=xOt={}));function IVr(e){return JSON.stringify(Hs.DeleteModelOut$outboundSchema.parse(e))}function AVr(e){return(0,MVr.safeParse)(e,t=>Hs.DeleteModelOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'DeleteModelOut' from JSON")}});var OEe=b(Vs=>{"use strict";var RVr=Vs&&Vs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),DVr=Vs&&Vs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),jVr=Vs&&Vs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&RVr(t,e,r);return DVr(t,e),t};Object.defineProperty(Vs,"__esModule",{value:!0});Vs.EventOut$=Vs.EventOut$outboundSchema=Vs.EventOut$inboundSchema=void 0;Vs.eventOutToJSON=LVr;Vs.eventOutFromJSON=FVr;var am=jVr(me()),EOt=Oe(),NVr=ce();Vs.EventOut$inboundSchema=am.object({name:am.string(),data:am.nullable(am.record(am.any())).optional(),created_at:am.number().int()}).transform(e=>(0,EOt.remap)(e,{created_at:"createdAt"}));Vs.EventOut$outboundSchema=am.object({name:am.string(),data:am.nullable(am.record(am.any())).optional(),createdAt:am.number().int()}).transform(e=>(0,EOt.remap)(e,{createdAt:"created_at"}));var OOt;(function(e){e.inboundSchema=Vs.EventOut$inboundSchema,e.outboundSchema=Vs.EventOut$outboundSchema})(OOt||(Vs.EventOut$=OOt={}));function LVr(e){return JSON.stringify(Vs.EventOut$outboundSchema.parse(e))}function FVr(e){return(0,NVr.safeParse)(e,t=>Vs.EventOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'EventOut' from JSON")}});var Bte=b(Qn=>{"use strict";var kVr=Qn&&Qn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),BVr=Qn&&Qn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$Vr=Qn&&Qn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&kVr(t,e,r);return BVr(t,e),t};Object.defineProperty(Qn,"__esModule",{value:!0});Qn.GithubRepositoryOut$=Qn.GithubRepositoryOut$outboundSchema=Qn.GithubRepositoryOut$inboundSchema=Qn.GithubRepositoryOutType$=Qn.GithubRepositoryOutType$outboundSchema=Qn.GithubRepositoryOutType$inboundSchema=Qn.GithubRepositoryOutType=void 0;Qn.githubRepositoryOutToJSON=UVr;Qn.githubRepositoryOutFromJSON=zVr;var lc=$Vr(me()),MOt=Oe(),qVr=ce();Qn.GithubRepositoryOutType={Github:"github"};Qn.GithubRepositoryOutType$inboundSchema=lc.nativeEnum(Qn.GithubRepositoryOutType);Qn.GithubRepositoryOutType$outboundSchema=Qn.GithubRepositoryOutType$inboundSchema;var POt;(function(e){e.inboundSchema=Qn.GithubRepositoryOutType$inboundSchema,e.outboundSchema=Qn.GithubRepositoryOutType$outboundSchema})(POt||(Qn.GithubRepositoryOutType$=POt={}));Qn.GithubRepositoryOut$inboundSchema=lc.object({type:lc.literal("github").default("github"),name:lc.string(),owner:lc.string(),ref:lc.nullable(lc.string()).optional(),weight:lc.number().default(1),commit_id:lc.string()}).transform(e=>(0,MOt.remap)(e,{commit_id:"commitId"}));Qn.GithubRepositoryOut$outboundSchema=lc.object({type:lc.literal("github").default("github"),name:lc.string(),owner:lc.string(),ref:lc.nullable(lc.string()).optional(),weight:lc.number().default(1),commitId:lc.string()}).transform(e=>(0,MOt.remap)(e,{commitId:"commit_id"}));var TOt;(function(e){e.inboundSchema=Qn.GithubRepositoryOut$inboundSchema,e.outboundSchema=Qn.GithubRepositoryOut$outboundSchema})(TOt||(Qn.GithubRepositoryOut$=TOt={}));function UVr(e){return JSON.stringify(Qn.GithubRepositoryOut$outboundSchema.parse(e))}function zVr(e){return(0,qVr.safeParse)(e,t=>Qn.GithubRepositoryOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var $te=b(Ws=>{"use strict";var HVr=Ws&&Ws.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),VVr=Ws&&Ws.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),WVr=Ws&&Ws.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&HVr(t,e,r);return VVr(t,e),t};Object.defineProperty(Ws,"__esModule",{value:!0});Ws.JobMetadataOut$=Ws.JobMetadataOut$outboundSchema=Ws.JobMetadataOut$inboundSchema=void 0;Ws.jobMetadataOutToJSON=GVr;Ws.jobMetadataOutFromJSON=KVr;var Io=WVr(me()),AOt=Oe(),JVr=ce();Ws.JobMetadataOut$inboundSchema=Io.object({expected_duration_seconds:Io.nullable(Io.number().int()).optional(),cost:Io.nullable(Io.number()).optional(),cost_currency:Io.nullable(Io.string()).optional(),train_tokens_per_step:Io.nullable(Io.number().int()).optional(),train_tokens:Io.nullable(Io.number().int()).optional(),data_tokens:Io.nullable(Io.number().int()).optional(),estimated_start_time:Io.nullable(Io.number().int()).optional()}).transform(e=>(0,AOt.remap)(e,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));Ws.JobMetadataOut$outboundSchema=Io.object({expectedDurationSeconds:Io.nullable(Io.number().int()).optional(),cost:Io.nullable(Io.number()).optional(),costCurrency:Io.nullable(Io.string()).optional(),trainTokensPerStep:Io.nullable(Io.number().int()).optional(),trainTokens:Io.nullable(Io.number().int()).optional(),dataTokens:Io.nullable(Io.number().int()).optional(),estimatedStartTime:Io.nullable(Io.number().int()).optional()}).transform(e=>(0,AOt.remap)(e,{expectedDurationSeconds:"expected_duration_seconds",costCurrency:"cost_currency",trainTokensPerStep:"train_tokens_per_step",trainTokens:"train_tokens",dataTokens:"data_tokens",estimatedStartTime:"estimated_start_time"}));var IOt;(function(e){e.inboundSchema=Ws.JobMetadataOut$inboundSchema,e.outboundSchema=Ws.JobMetadataOut$outboundSchema})(IOt||(Ws.JobMetadataOut$=IOt={}));function GVr(e){return JSON.stringify(Ws.JobMetadataOut$outboundSchema.parse(e))}function KVr(e){return(0,JVr.safeParse)(e,t=>Ws.JobMetadataOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobMetadataOut' from JSON")}});var qte=b(Js=>{"use strict";var YVr=Js&&Js.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ZVr=Js&&Js.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),XVr=Js&&Js.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&YVr(t,e,r);return ZVr(t,e),t};Object.defineProperty(Js,"__esModule",{value:!0});Js.TrainingParameters$=Js.TrainingParameters$outboundSchema=Js.TrainingParameters$inboundSchema=void 0;Js.trainingParametersToJSON=e5r;Js.trainingParametersFromJSON=t5r;var Go=XVr(me()),DOt=Oe(),QVr=ce();Js.TrainingParameters$inboundSchema=Go.object({training_steps:Go.nullable(Go.number().int()).optional(),learning_rate:Go.number().default(1e-4),weight_decay:Go.nullable(Go.number()).optional(),warmup_fraction:Go.nullable(Go.number()).optional(),epochs:Go.nullable(Go.number()).optional(),fim_ratio:Go.nullable(Go.number()).optional(),seq_len:Go.nullable(Go.number().int()).optional()}).transform(e=>(0,DOt.remap)(e,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));Js.TrainingParameters$outboundSchema=Go.object({trainingSteps:Go.nullable(Go.number().int()).optional(),learningRate:Go.number().default(1e-4),weightDecay:Go.nullable(Go.number()).optional(),warmupFraction:Go.nullable(Go.number()).optional(),epochs:Go.nullable(Go.number()).optional(),fimRatio:Go.nullable(Go.number()).optional(),seqLen:Go.nullable(Go.number().int()).optional()}).transform(e=>(0,DOt.remap)(e,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var ROt;(function(e){e.inboundSchema=Js.TrainingParameters$inboundSchema,e.outboundSchema=Js.TrainingParameters$outboundSchema})(ROt||(Js.TrainingParameters$=ROt={}));function e5r(e){return JSON.stringify(Js.TrainingParameters$outboundSchema.parse(e))}function t5r(e){return(0,QVr.safeParse)(e,t=>Js.TrainingParameters$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'TrainingParameters' from JSON")}});var Ute=b(eo=>{"use strict";var r5r=eo&&eo.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),n5r=eo&&eo.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o5r=eo&&eo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&r5r(t,e,r);return n5r(t,e),t};Object.defineProperty(eo,"__esModule",{value:!0});eo.WandbIntegrationOut$=eo.WandbIntegrationOut$outboundSchema=eo.WandbIntegrationOut$inboundSchema=eo.WandbIntegrationOutType$=eo.WandbIntegrationOutType$outboundSchema=eo.WandbIntegrationOutType$inboundSchema=eo.WandbIntegrationOutType=void 0;eo.wandbIntegrationOutToJSON=a5r;eo.wandbIntegrationOutFromJSON=s5r;var qd=o5r(me()),LOt=Oe(),i5r=ce();eo.WandbIntegrationOutType={Wandb:"wandb"};eo.WandbIntegrationOutType$inboundSchema=qd.nativeEnum(eo.WandbIntegrationOutType);eo.WandbIntegrationOutType$outboundSchema=eo.WandbIntegrationOutType$inboundSchema;var jOt;(function(e){e.inboundSchema=eo.WandbIntegrationOutType$inboundSchema,e.outboundSchema=eo.WandbIntegrationOutType$outboundSchema})(jOt||(eo.WandbIntegrationOutType$=jOt={}));eo.WandbIntegrationOut$inboundSchema=qd.object({type:qd.literal("wandb").default("wandb"),project:qd.string(),name:qd.nullable(qd.string()).optional(),run_name:qd.nullable(qd.string()).optional()}).transform(e=>(0,LOt.remap)(e,{run_name:"runName"}));eo.WandbIntegrationOut$outboundSchema=qd.object({type:qd.literal("wandb").default("wandb"),project:qd.string(),name:qd.nullable(qd.string()).optional(),runName:qd.nullable(qd.string()).optional()}).transform(e=>(0,LOt.remap)(e,{runName:"run_name"}));var NOt;(function(e){e.inboundSchema=eo.WandbIntegrationOut$inboundSchema,e.outboundSchema=eo.WandbIntegrationOut$outboundSchema})(NOt||(eo.WandbIntegrationOut$=NOt={}));function a5r(e){return JSON.stringify(eo.WandbIntegrationOut$outboundSchema.parse(e))}function s5r(e){return(0,i5r.safeParse)(e,t=>eo.WandbIntegrationOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var JOt=b(Ke=>{"use strict";var u5r=Ke&&Ke.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),l5r=Ke&&Ke.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c5r=Ke&&Ke.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&u5r(t,e,r);return l5r(t,e),t};Object.defineProperty(Ke,"__esModule",{value:!0});Ke.DetailedJobOut$=Ke.DetailedJobOut$outboundSchema=Ke.DetailedJobOut$inboundSchema=Ke.DetailedJobOutRepositories$=Ke.DetailedJobOutRepositories$outboundSchema=Ke.DetailedJobOutRepositories$inboundSchema=Ke.DetailedJobOutIntegrations$=Ke.DetailedJobOutIntegrations$outboundSchema=Ke.DetailedJobOutIntegrations$inboundSchema=Ke.DetailedJobOutObject$=Ke.DetailedJobOutObject$outboundSchema=Ke.DetailedJobOutObject$inboundSchema=Ke.DetailedJobOutStatus$=Ke.DetailedJobOutStatus$outboundSchema=Ke.DetailedJobOutStatus$inboundSchema=Ke.DetailedJobOutObject=Ke.DetailedJobOutStatus=void 0;Ke.detailedJobOutIntegrationsToJSON=d5r;Ke.detailedJobOutIntegrationsFromJSON=f5r;Ke.detailedJobOutRepositoriesToJSON=p5r;Ke.detailedJobOutRepositoriesFromJSON=h5r;Ke.detailedJobOutToJSON=m5r;Ke.detailedJobOutFromJSON=g5r;var Ft=c5r(me()),UOt=Oe(),EEe=ce(),zOt=vEe(),HOt=OEe(),zte=Bte(),VOt=$te(),WOt=qte(),Hte=Ute();Ke.DetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Ke.DetailedJobOutObject={Job:"job"};Ke.DetailedJobOutStatus$inboundSchema=Ft.nativeEnum(Ke.DetailedJobOutStatus);Ke.DetailedJobOutStatus$outboundSchema=Ke.DetailedJobOutStatus$inboundSchema;var FOt;(function(e){e.inboundSchema=Ke.DetailedJobOutStatus$inboundSchema,e.outboundSchema=Ke.DetailedJobOutStatus$outboundSchema})(FOt||(Ke.DetailedJobOutStatus$=FOt={}));Ke.DetailedJobOutObject$inboundSchema=Ft.nativeEnum(Ke.DetailedJobOutObject);Ke.DetailedJobOutObject$outboundSchema=Ke.DetailedJobOutObject$inboundSchema;var kOt;(function(e){e.inboundSchema=Ke.DetailedJobOutObject$inboundSchema,e.outboundSchema=Ke.DetailedJobOutObject$outboundSchema})(kOt||(Ke.DetailedJobOutObject$=kOt={}));Ke.DetailedJobOutIntegrations$inboundSchema=Hte.WandbIntegrationOut$inboundSchema;Ke.DetailedJobOutIntegrations$outboundSchema=Hte.WandbIntegrationOut$outboundSchema;var BOt;(function(e){e.inboundSchema=Ke.DetailedJobOutIntegrations$inboundSchema,e.outboundSchema=Ke.DetailedJobOutIntegrations$outboundSchema})(BOt||(Ke.DetailedJobOutIntegrations$=BOt={}));function d5r(e){return JSON.stringify(Ke.DetailedJobOutIntegrations$outboundSchema.parse(e))}function f5r(e){return(0,EEe.safeParse)(e,t=>Ke.DetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'DetailedJobOutIntegrations' from JSON")}Ke.DetailedJobOutRepositories$inboundSchema=zte.GithubRepositoryOut$inboundSchema;Ke.DetailedJobOutRepositories$outboundSchema=zte.GithubRepositoryOut$outboundSchema;var $Ot;(function(e){e.inboundSchema=Ke.DetailedJobOutRepositories$inboundSchema,e.outboundSchema=Ke.DetailedJobOutRepositories$outboundSchema})($Ot||(Ke.DetailedJobOutRepositories$=$Ot={}));function p5r(e){return JSON.stringify(Ke.DetailedJobOutRepositories$outboundSchema.parse(e))}function h5r(e){return(0,EEe.safeParse)(e,t=>Ke.DetailedJobOutRepositories$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'DetailedJobOutRepositories' from JSON")}Ke.DetailedJobOut$inboundSchema=Ft.object({id:Ft.string(),auto_start:Ft.boolean(),hyperparameters:WOt.TrainingParameters$inboundSchema,model:Ft.string(),status:Ke.DetailedJobOutStatus$inboundSchema,job_type:Ft.string(),created_at:Ft.number().int(),modified_at:Ft.number().int(),training_files:Ft.array(Ft.string()),validation_files:Ft.nullable(Ft.array(Ft.string())).optional(),object:Ft.literal("job").default("job"),fine_tuned_model:Ft.nullable(Ft.string()).optional(),suffix:Ft.nullable(Ft.string()).optional(),integrations:Ft.nullable(Ft.array(Hte.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Ft.nullable(Ft.number().int()).optional(),repositories:Ft.array(zte.GithubRepositoryOut$inboundSchema).optional(),metadata:Ft.nullable(VOt.JobMetadataOut$inboundSchema).optional(),events:Ft.array(HOt.EventOut$inboundSchema).optional(),checkpoints:Ft.array(zOt.CheckpointOut$inboundSchema).optional()}).transform(e=>(0,UOt.remap)(e,{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"}));Ke.DetailedJobOut$outboundSchema=Ft.object({id:Ft.string(),autoStart:Ft.boolean(),hyperparameters:WOt.TrainingParameters$outboundSchema,model:Ft.string(),status:Ke.DetailedJobOutStatus$outboundSchema,jobType:Ft.string(),createdAt:Ft.number().int(),modifiedAt:Ft.number().int(),trainingFiles:Ft.array(Ft.string()),validationFiles:Ft.nullable(Ft.array(Ft.string())).optional(),object:Ft.literal("job").default("job"),fineTunedModel:Ft.nullable(Ft.string()).optional(),suffix:Ft.nullable(Ft.string()).optional(),integrations:Ft.nullable(Ft.array(Hte.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Ft.nullable(Ft.number().int()).optional(),repositories:Ft.array(zte.GithubRepositoryOut$outboundSchema).optional(),metadata:Ft.nullable(VOt.JobMetadataOut$outboundSchema).optional(),events:Ft.array(HOt.EventOut$outboundSchema).optional(),checkpoints:Ft.array(zOt.CheckpointOut$outboundSchema).optional()}).transform(e=>(0,UOt.remap)(e,{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 qOt;(function(e){e.inboundSchema=Ke.DetailedJobOut$inboundSchema,e.outboundSchema=Ke.DetailedJobOut$outboundSchema})(qOt||(Ke.DetailedJobOut$=qOt={}));function m5r(e){return JSON.stringify(Ke.DetailedJobOut$outboundSchema.parse(e))}function g5r(e){return(0,EEe.safeParse)(e,t=>Ke.DetailedJobOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'DetailedJobOut' from JSON")}});var XOt=b(to=>{"use strict";var y5r=to&&to.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),b5r=to&&to.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_5r=to&&to.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&y5r(t,e,r);return b5r(t,e),t};Object.defineProperty(to,"__esModule",{value:!0});to.EmbeddingRequest$=to.EmbeddingRequest$outboundSchema=to.EmbeddingRequest$inboundSchema=to.Inputs$=to.Inputs$outboundSchema=to.Inputs$inboundSchema=void 0;to.inputsToJSON=v5r;to.inputsFromJSON=w5r;to.embeddingRequestToJSON=S5r;to.embeddingRequestFromJSON=x5r;var Ji=_5r(me()),YOt=Oe(),ZOt=ce();to.Inputs$inboundSchema=Ji.union([Ji.string(),Ji.array(Ji.string())]);to.Inputs$outboundSchema=Ji.union([Ji.string(),Ji.array(Ji.string())]);var GOt;(function(e){e.inboundSchema=to.Inputs$inboundSchema,e.outboundSchema=to.Inputs$outboundSchema})(GOt||(to.Inputs$=GOt={}));function v5r(e){return JSON.stringify(to.Inputs$outboundSchema.parse(e))}function w5r(e){return(0,ZOt.safeParse)(e,t=>to.Inputs$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Inputs' from JSON")}to.EmbeddingRequest$inboundSchema=Ji.object({input:Ji.union([Ji.string(),Ji.array(Ji.string())]),model:Ji.string().default("mistral-embed"),encoding_format:Ji.nullable(Ji.string()).optional()}).transform(e=>(0,YOt.remap)(e,{input:"inputs",encoding_format:"encodingFormat"}));to.EmbeddingRequest$outboundSchema=Ji.object({inputs:Ji.union([Ji.string(),Ji.array(Ji.string())]),model:Ji.string().default("mistral-embed"),encodingFormat:Ji.nullable(Ji.string()).optional()}).transform(e=>(0,YOt.remap)(e,{inputs:"input",encodingFormat:"encoding_format"}));var KOt;(function(e){e.inboundSchema=to.EmbeddingRequest$inboundSchema,e.outboundSchema=to.EmbeddingRequest$outboundSchema})(KOt||(to.EmbeddingRequest$=KOt={}));function S5r(e){return JSON.stringify(to.EmbeddingRequest$outboundSchema.parse(e))}function x5r(e){return(0,ZOt.safeParse)(e,t=>to.EmbeddingRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'EmbeddingRequest' from JSON")}});var PEe=b(Gs=>{"use strict";var C5r=Gs&&Gs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),O5r=Gs&&Gs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),E5r=Gs&&Gs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&C5r(t,e,r);return O5r(t,e),t};Object.defineProperty(Gs,"__esModule",{value:!0});Gs.EmbeddingResponseData$=Gs.EmbeddingResponseData$outboundSchema=Gs.EmbeddingResponseData$inboundSchema=void 0;Gs.embeddingResponseDataToJSON=T5r;Gs.embeddingResponseDataFromJSON=M5r;var zw=E5r(me()),P5r=ce();Gs.EmbeddingResponseData$inboundSchema=zw.object({object:zw.string().optional(),embedding:zw.array(zw.number()).optional(),index:zw.number().int().optional()});Gs.EmbeddingResponseData$outboundSchema=zw.object({object:zw.string().optional(),embedding:zw.array(zw.number()).optional(),index:zw.number().int().optional()});var QOt;(function(e){e.inboundSchema=Gs.EmbeddingResponseData$inboundSchema,e.outboundSchema=Gs.EmbeddingResponseData$outboundSchema})(QOt||(Gs.EmbeddingResponseData$=QOt={}));function T5r(e){return JSON.stringify(Gs.EmbeddingResponseData$outboundSchema.parse(e))}function M5r(e){return(0,P5r.safeParse)(e,t=>Gs.EmbeddingResponseData$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var nEt=b(Ks=>{"use strict";var I5r=Ks&&Ks.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),A5r=Ks&&Ks.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),R5r=Ks&&Ks.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&I5r(t,e,r);return A5r(t,e),t};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.EmbeddingResponse$=Ks.EmbeddingResponse$outboundSchema=Ks.EmbeddingResponse$inboundSchema=void 0;Ks.embeddingResponseToJSON=j5r;Ks.embeddingResponseFromJSON=N5r;var Hw=R5r(me()),D5r=ce(),tEt=PEe(),rEt=Gk();Ks.EmbeddingResponse$inboundSchema=Hw.object({id:Hw.string(),object:Hw.string(),model:Hw.string(),usage:rEt.UsageInfo$inboundSchema,data:Hw.array(tEt.EmbeddingResponseData$inboundSchema)});Ks.EmbeddingResponse$outboundSchema=Hw.object({id:Hw.string(),object:Hw.string(),model:Hw.string(),usage:rEt.UsageInfo$outboundSchema,data:Hw.array(tEt.EmbeddingResponseData$outboundSchema)});var eEt;(function(e){e.inboundSchema=Ks.EmbeddingResponse$inboundSchema,e.outboundSchema=Ks.EmbeddingResponse$outboundSchema})(eEt||(Ks.EmbeddingResponse$=eEt={}));function j5r(e){return JSON.stringify(Ks.EmbeddingResponse$outboundSchema.parse(e))}function N5r(e){return(0,D5r.safeParse)(e,t=>Ks.EmbeddingResponse$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'EmbeddingResponse' from JSON")}});var E3=b(Ys=>{"use strict";var L5r=Ys&&Ys.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),F5r=Ys&&Ys.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),k5r=Ys&&Ys.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&L5r(t,e,r);return F5r(t,e),t};Object.defineProperty(Ys,"__esModule",{value:!0});Ys.FilePurpose$=Ys.FilePurpose$outboundSchema=Ys.FilePurpose$inboundSchema=Ys.FilePurpose=void 0;var b1=k5r(me()),B5r=eT();Ys.FilePurpose={FineTune:"fine-tune",Batch:"batch"};Ys.FilePurpose$inboundSchema=b1.union([b1.nativeEnum(Ys.FilePurpose),b1.string().transform(B5r.catchUnrecognizedEnum)]);Ys.FilePurpose$outboundSchema=b1.union([b1.nativeEnum(Ys.FilePurpose),b1.string().and(b1.custom())]);var oEt;(function(e){e.inboundSchema=Ys.FilePurpose$inboundSchema,e.outboundSchema=Ys.FilePurpose$outboundSchema})(oEt||(Ys.FilePurpose$=oEt={}))});var P3=b(Zs=>{"use strict";var $5r=Zs&&Zs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),q5r=Zs&&Zs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),U5r=Zs&&Zs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$5r(t,e,r);return q5r(t,e),t};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.SampleType$=Zs.SampleType$outboundSchema=Zs.SampleType$inboundSchema=Zs.SampleType=void 0;var _1=U5r(me()),z5r=eT();Zs.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};Zs.SampleType$inboundSchema=_1.union([_1.nativeEnum(Zs.SampleType),_1.string().transform(z5r.catchUnrecognizedEnum)]);Zs.SampleType$outboundSchema=_1.union([_1.nativeEnum(Zs.SampleType),_1.string().and(_1.custom())]);var iEt;(function(e){e.inboundSchema=Zs.SampleType$inboundSchema,e.outboundSchema=Zs.SampleType$outboundSchema})(iEt||(Zs.SampleType$=iEt={}))});var T3=b(Xs=>{"use strict";var H5r=Xs&&Xs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),V5r=Xs&&Xs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),W5r=Xs&&Xs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&H5r(t,e,r);return V5r(t,e),t};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.Source$=Xs.Source$outboundSchema=Xs.Source$inboundSchema=Xs.Source=void 0;var v1=W5r(me()),J5r=eT();Xs.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};Xs.Source$inboundSchema=v1.union([v1.nativeEnum(Xs.Source),v1.string().transform(J5r.catchUnrecognizedEnum)]);Xs.Source$outboundSchema=v1.union([v1.nativeEnum(Xs.Source),v1.string().and(v1.custom())]);var aEt;(function(e){e.inboundSchema=Xs.Source$inboundSchema,e.outboundSchema=Xs.Source$outboundSchema})(aEt||(Xs.Source$=aEt={}))});var TEe=b(Qs=>{"use strict";var G5r=Qs&&Qs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),K5r=Qs&&Qs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Y5r=Qs&&Qs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&G5r(t,e,r);return K5r(t,e),t};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.FileSchema$=Qs.FileSchema$outboundSchema=Qs.FileSchema$inboundSchema=void 0;Qs.fileSchemaToJSON=X5r;Qs.fileSchemaFromJSON=Q5r;var od=Y5r(me()),uEt=Oe(),Z5r=ce(),lEt=E3(),cEt=P3(),dEt=T3();Qs.FileSchema$inboundSchema=od.object({id:od.string(),object:od.string(),bytes:od.number().int(),created_at:od.number().int(),filename:od.string(),purpose:lEt.FilePurpose$inboundSchema,sample_type:cEt.SampleType$inboundSchema,num_lines:od.nullable(od.number().int()).optional(),source:dEt.Source$inboundSchema}).transform(e=>(0,uEt.remap)(e,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Qs.FileSchema$outboundSchema=od.object({id:od.string(),object:od.string(),sizeBytes:od.number().int(),createdAt:od.number().int(),filename:od.string(),purpose:lEt.FilePurpose$outboundSchema,sampleType:cEt.SampleType$outboundSchema,numLines:od.nullable(od.number().int()).optional(),source:dEt.Source$outboundSchema}).transform(e=>(0,uEt.remap)(e,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var sEt;(function(e){e.inboundSchema=Qs.FileSchema$inboundSchema,e.outboundSchema=Qs.FileSchema$outboundSchema})(sEt||(Qs.FileSchema$=sEt={}));function X5r(e){return JSON.stringify(Qs.FileSchema$outboundSchema.parse(e))}function Q5r(e){return(0,Z5r.safeParse)(e,t=>Qs.FileSchema$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FileSchema' from JSON")}});var pEt=b(eu=>{"use strict";var e9r=eu&&eu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),t9r=eu&&eu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r9r=eu&&eu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&e9r(t,e,r);return t9r(t,e),t};Object.defineProperty(eu,"__esModule",{value:!0});eu.FileSignedURL$=eu.FileSignedURL$outboundSchema=eu.FileSignedURL$inboundSchema=void 0;eu.fileSignedURLToJSON=o9r;eu.fileSignedURLFromJSON=i9r;var Vte=r9r(me()),n9r=ce();eu.FileSignedURL$inboundSchema=Vte.object({url:Vte.string()});eu.FileSignedURL$outboundSchema=Vte.object({url:Vte.string()});var fEt;(function(e){e.inboundSchema=eu.FileSignedURL$inboundSchema,e.outboundSchema=eu.FileSignedURL$outboundSchema})(fEt||(eu.FileSignedURL$=fEt={}));function o9r(e){return JSON.stringify(eu.FileSignedURL$outboundSchema.parse(e))}function i9r(e){return(0,n9r.safeParse)(e,t=>eu.FileSignedURL$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FileSignedURL' from JSON")}});var bEt=b(ro=>{"use strict";var a9r=ro&&ro.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),s9r=ro&&ro.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),u9r=ro&&ro.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&a9r(t,e,r);return s9r(t,e),t};Object.defineProperty(ro,"__esModule",{value:!0});ro.FIMCompletionRequest$=ro.FIMCompletionRequest$outboundSchema=ro.FIMCompletionRequest$inboundSchema=ro.FIMCompletionRequestStop$=ro.FIMCompletionRequestStop$outboundSchema=ro.FIMCompletionRequestStop$inboundSchema=void 0;ro.fimCompletionRequestStopToJSON=l9r;ro.fimCompletionRequestStopFromJSON=c9r;ro.fimCompletionRequestToJSON=d9r;ro.fimCompletionRequestFromJSON=f9r;var Vt=u9r(me()),gEt=Oe(),yEt=ce();ro.FIMCompletionRequestStop$inboundSchema=Vt.union([Vt.string(),Vt.array(Vt.string())]);ro.FIMCompletionRequestStop$outboundSchema=Vt.union([Vt.string(),Vt.array(Vt.string())]);var hEt;(function(e){e.inboundSchema=ro.FIMCompletionRequestStop$inboundSchema,e.outboundSchema=ro.FIMCompletionRequestStop$outboundSchema})(hEt||(ro.FIMCompletionRequestStop$=hEt={}));function l9r(e){return JSON.stringify(ro.FIMCompletionRequestStop$outboundSchema.parse(e))}function c9r(e){return(0,yEt.safeParse)(e,t=>ro.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}ro.FIMCompletionRequest$inboundSchema=Vt.object({model:Vt.nullable(Vt.string()),temperature:Vt.nullable(Vt.number()).optional(),top_p:Vt.number().default(1),max_tokens:Vt.nullable(Vt.number().int()).optional(),stream:Vt.boolean().default(!1),stop:Vt.union([Vt.string(),Vt.array(Vt.string())]).optional(),random_seed:Vt.nullable(Vt.number().int()).optional(),prompt:Vt.string(),suffix:Vt.nullable(Vt.string()).optional(),min_tokens:Vt.nullable(Vt.number().int()).optional()}).transform(e=>(0,gEt.remap)(e,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));ro.FIMCompletionRequest$outboundSchema=Vt.object({model:Vt.nullable(Vt.string()),temperature:Vt.nullable(Vt.number()).optional(),topP:Vt.number().default(1),maxTokens:Vt.nullable(Vt.number().int()).optional(),stream:Vt.boolean().default(!1),stop:Vt.union([Vt.string(),Vt.array(Vt.string())]).optional(),randomSeed:Vt.nullable(Vt.number().int()).optional(),prompt:Vt.string(),suffix:Vt.nullable(Vt.string()).optional(),minTokens:Vt.nullable(Vt.number().int()).optional()}).transform(e=>(0,gEt.remap)(e,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var mEt;(function(e){e.inboundSchema=ro.FIMCompletionRequest$inboundSchema,e.outboundSchema=ro.FIMCompletionRequest$outboundSchema})(mEt||(ro.FIMCompletionRequest$=mEt={}));function d9r(e){return JSON.stringify(ro.FIMCompletionRequest$outboundSchema.parse(e))}function f9r(e){return(0,yEt.safeParse)(e,t=>ro.FIMCompletionRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var SEt=b(tu=>{"use strict";var p9r=tu&&tu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),h9r=tu&&tu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),m9r=tu&&tu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&p9r(t,e,r);return h9r(t,e),t};Object.defineProperty(tu,"__esModule",{value:!0});tu.FIMCompletionResponse$=tu.FIMCompletionResponse$outboundSchema=tu.FIMCompletionResponse$inboundSchema=void 0;tu.fimCompletionResponseToJSON=y9r;tu.fimCompletionResponseFromJSON=b9r;var sm=m9r(me()),g9r=ce(),vEt=xte(),wEt=Gk();tu.FIMCompletionResponse$inboundSchema=sm.object({id:sm.string(),object:sm.string(),model:sm.string(),usage:wEt.UsageInfo$inboundSchema,created:sm.number().int().optional(),choices:sm.array(vEt.ChatCompletionChoice$inboundSchema).optional()});tu.FIMCompletionResponse$outboundSchema=sm.object({id:sm.string(),object:sm.string(),model:sm.string(),usage:wEt.UsageInfo$outboundSchema,created:sm.number().int().optional(),choices:sm.array(vEt.ChatCompletionChoice$outboundSchema).optional()});var _Et;(function(e){e.inboundSchema=tu.FIMCompletionResponse$inboundSchema,e.outboundSchema=tu.FIMCompletionResponse$outboundSchema})(_Et||(tu.FIMCompletionResponse$=_Et={}));function y9r(e){return JSON.stringify(tu.FIMCompletionResponse$outboundSchema.parse(e))}function b9r(e){return(0,g9r.safeParse)(e,t=>tu.FIMCompletionResponse$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var PEt=b(no=>{"use strict";var _9r=no&&no.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),v9r=no&&no.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),w9r=no&&no.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_9r(t,e,r);return v9r(t,e),t};Object.defineProperty(no,"__esModule",{value:!0});no.FIMCompletionStreamRequest$=no.FIMCompletionStreamRequest$outboundSchema=no.FIMCompletionStreamRequest$inboundSchema=no.FIMCompletionStreamRequestStop$=no.FIMCompletionStreamRequestStop$outboundSchema=no.FIMCompletionStreamRequestStop$inboundSchema=void 0;no.fimCompletionStreamRequestStopToJSON=S9r;no.fimCompletionStreamRequestStopFromJSON=x9r;no.fimCompletionStreamRequestToJSON=C9r;no.fimCompletionStreamRequestFromJSON=O9r;var Wt=w9r(me()),OEt=Oe(),EEt=ce();no.FIMCompletionStreamRequestStop$inboundSchema=Wt.union([Wt.string(),Wt.array(Wt.string())]);no.FIMCompletionStreamRequestStop$outboundSchema=Wt.union([Wt.string(),Wt.array(Wt.string())]);var xEt;(function(e){e.inboundSchema=no.FIMCompletionStreamRequestStop$inboundSchema,e.outboundSchema=no.FIMCompletionStreamRequestStop$outboundSchema})(xEt||(no.FIMCompletionStreamRequestStop$=xEt={}));function S9r(e){return JSON.stringify(no.FIMCompletionStreamRequestStop$outboundSchema.parse(e))}function x9r(e){return(0,EEt.safeParse)(e,t=>no.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}no.FIMCompletionStreamRequest$inboundSchema=Wt.object({model:Wt.nullable(Wt.string()),temperature:Wt.nullable(Wt.number()).optional(),top_p:Wt.number().default(1),max_tokens:Wt.nullable(Wt.number().int()).optional(),stream:Wt.boolean().default(!0),stop:Wt.union([Wt.string(),Wt.array(Wt.string())]).optional(),random_seed:Wt.nullable(Wt.number().int()).optional(),prompt:Wt.string(),suffix:Wt.nullable(Wt.string()).optional(),min_tokens:Wt.nullable(Wt.number().int()).optional()}).transform(e=>(0,OEt.remap)(e,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));no.FIMCompletionStreamRequest$outboundSchema=Wt.object({model:Wt.nullable(Wt.string()),temperature:Wt.nullable(Wt.number()).optional(),topP:Wt.number().default(1),maxTokens:Wt.nullable(Wt.number().int()).optional(),stream:Wt.boolean().default(!0),stop:Wt.union([Wt.string(),Wt.array(Wt.string())]).optional(),randomSeed:Wt.nullable(Wt.number().int()).optional(),prompt:Wt.string(),suffix:Wt.nullable(Wt.string()).optional(),minTokens:Wt.nullable(Wt.number().int()).optional()}).transform(e=>(0,OEt.remap)(e,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var CEt;(function(e){e.inboundSchema=no.FIMCompletionStreamRequest$inboundSchema,e.outboundSchema=no.FIMCompletionStreamRequest$outboundSchema})(CEt||(no.FIMCompletionStreamRequest$=CEt={}));function C9r(e){return JSON.stringify(no.FIMCompletionStreamRequest$outboundSchema.parse(e))}function O9r(e){return(0,EEt.safeParse)(e,t=>no.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var MEe=b(ru=>{"use strict";var E9r=ru&&ru.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),P9r=ru&&ru.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),T9r=ru&&ru.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&E9r(t,e,r);return P9r(t,e),t};Object.defineProperty(ru,"__esModule",{value:!0});ru.FTModelCapabilitiesOut$=ru.FTModelCapabilitiesOut$outboundSchema=ru.FTModelCapabilitiesOut$inboundSchema=void 0;ru.ftModelCapabilitiesOutToJSON=I9r;ru.ftModelCapabilitiesOutFromJSON=A9r;var Vw=T9r(me()),MEt=Oe(),M9r=ce();ru.FTModelCapabilitiesOut$inboundSchema=Vw.object({completion_chat:Vw.boolean().default(!0),completion_fim:Vw.boolean().default(!1),function_calling:Vw.boolean().default(!1),fine_tuning:Vw.boolean().default(!1)}).transform(e=>(0,MEt.remap)(e,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));ru.FTModelCapabilitiesOut$outboundSchema=Vw.object({completionChat:Vw.boolean().default(!0),completionFim:Vw.boolean().default(!1),functionCalling:Vw.boolean().default(!1),fineTuning:Vw.boolean().default(!1)}).transform(e=>(0,MEt.remap)(e,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var TEt;(function(e){e.inboundSchema=ru.FTModelCapabilitiesOut$inboundSchema,e.outboundSchema=ru.FTModelCapabilitiesOut$outboundSchema})(TEt||(ru.FTModelCapabilitiesOut$=TEt={}));function I9r(e){return JSON.stringify(ru.FTModelCapabilitiesOut$outboundSchema.parse(e))}function A9r(e){return(0,M9r.safeParse)(e,t=>ru.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var IEe=b(oo=>{"use strict";var R9r=oo&&oo.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),D9r=oo&&oo.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),j9r=oo&&oo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&R9r(t,e,r);return D9r(t,e),t};Object.defineProperty(oo,"__esModule",{value:!0});oo.FTModelCard$=oo.FTModelCard$outboundSchema=oo.FTModelCard$inboundSchema=oo.FTModelCardType$=oo.FTModelCardType$outboundSchema=oo.FTModelCardType$inboundSchema=oo.FTModelCardType=void 0;oo.ftModelCardToJSON=L9r;oo.ftModelCardFromJSON=F9r;var Rr=j9r(me()),REt=Oe(),N9r=ce(),DEt=wte();oo.FTModelCardType={FineTuned:"fine-tuned"};oo.FTModelCardType$inboundSchema=Rr.nativeEnum(oo.FTModelCardType);oo.FTModelCardType$outboundSchema=oo.FTModelCardType$inboundSchema;var IEt;(function(e){e.inboundSchema=oo.FTModelCardType$inboundSchema,e.outboundSchema=oo.FTModelCardType$outboundSchema})(IEt||(oo.FTModelCardType$=IEt={}));oo.FTModelCard$inboundSchema=Rr.object({id:Rr.string(),object:Rr.string().default("model"),created:Rr.number().int().optional(),owned_by:Rr.string().default("mistralai"),capabilities:DEt.ModelCapabilities$inboundSchema,name:Rr.nullable(Rr.string()).optional(),description:Rr.nullable(Rr.string()).optional(),max_context_length:Rr.number().int().default(32768),aliases:Rr.array(Rr.string()).optional(),deprecation:Rr.nullable(Rr.string().datetime({offset:!0}).transform(e=>new Date(e))).optional(),default_model_temperature:Rr.nullable(Rr.number()).optional(),type:Rr.literal("fine-tuned").default("fine-tuned"),job:Rr.string(),root:Rr.string(),archived:Rr.boolean().default(!1)}).transform(e=>(0,REt.remap)(e,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));oo.FTModelCard$outboundSchema=Rr.object({id:Rr.string(),object:Rr.string().default("model"),created:Rr.number().int().optional(),ownedBy:Rr.string().default("mistralai"),capabilities:DEt.ModelCapabilities$outboundSchema,name:Rr.nullable(Rr.string()).optional(),description:Rr.nullable(Rr.string()).optional(),maxContextLength:Rr.number().int().default(32768),aliases:Rr.array(Rr.string()).optional(),deprecation:Rr.nullable(Rr.date().transform(e=>e.toISOString())).optional(),defaultModelTemperature:Rr.nullable(Rr.number()).optional(),type:Rr.literal("fine-tuned").default("fine-tuned"),job:Rr.string(),root:Rr.string(),archived:Rr.boolean().default(!1)}).transform(e=>(0,REt.remap)(e,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var AEt;(function(e){e.inboundSchema=oo.FTModelCard$inboundSchema,e.outboundSchema=oo.FTModelCard$outboundSchema})(AEt||(oo.FTModelCard$=AEt={}));function L9r(e){return JSON.stringify(oo.FTModelCard$outboundSchema.parse(e))}function F9r(e){return(0,N9r.safeParse)(e,t=>oo.FTModelCard$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FTModelCard' from JSON")}});var kEt=b(io=>{"use strict";var k9r=io&&io.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),B9r=io&&io.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$9r=io&&io.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&k9r(t,e,r);return B9r(t,e),t};Object.defineProperty(io,"__esModule",{value:!0});io.FTModelOut$=io.FTModelOut$outboundSchema=io.FTModelOut$inboundSchema=io.FTModelOutObject$=io.FTModelOutObject$outboundSchema=io.FTModelOutObject$inboundSchema=io.FTModelOutObject=void 0;io.ftModelOutToJSON=U9r;io.ftModelOutFromJSON=z9r;var xo=$9r(me()),LEt=Oe(),q9r=ce(),FEt=MEe();io.FTModelOutObject={Model:"model"};io.FTModelOutObject$inboundSchema=xo.nativeEnum(io.FTModelOutObject);io.FTModelOutObject$outboundSchema=io.FTModelOutObject$inboundSchema;var jEt;(function(e){e.inboundSchema=io.FTModelOutObject$inboundSchema,e.outboundSchema=io.FTModelOutObject$outboundSchema})(jEt||(io.FTModelOutObject$=jEt={}));io.FTModelOut$inboundSchema=xo.object({id:xo.string(),object:xo.literal("model").default("model"),created:xo.number().int(),owned_by:xo.string(),root:xo.string(),archived:xo.boolean(),name:xo.nullable(xo.string()).optional(),description:xo.nullable(xo.string()).optional(),capabilities:FEt.FTModelCapabilitiesOut$inboundSchema,max_context_length:xo.number().int().default(32768),aliases:xo.array(xo.string()).optional(),job:xo.string()}).transform(e=>(0,LEt.remap)(e,{owned_by:"ownedBy",max_context_length:"maxContextLength"}));io.FTModelOut$outboundSchema=xo.object({id:xo.string(),object:xo.literal("model").default("model"),created:xo.number().int(),ownedBy:xo.string(),root:xo.string(),archived:xo.boolean(),name:xo.nullable(xo.string()).optional(),description:xo.nullable(xo.string()).optional(),capabilities:FEt.FTModelCapabilitiesOut$outboundSchema,maxContextLength:xo.number().int().default(32768),aliases:xo.array(xo.string()).optional(),job:xo.string()}).transform(e=>(0,LEt.remap)(e,{ownedBy:"owned_by",maxContextLength:"max_context_length"}));var NEt;(function(e){e.inboundSchema=io.FTModelOut$inboundSchema,e.outboundSchema=io.FTModelOut$outboundSchema})(NEt||(io.FTModelOut$=NEt={}));function U9r(e){return JSON.stringify(io.FTModelOut$outboundSchema.parse(e))}function z9r(e){return(0,q9r.safeParse)(e,t=>io.FTModelOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FTModelOut' from JSON")}});var AEe=b(ao=>{"use strict";var H9r=ao&&ao.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),V9r=ao&&ao.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),W9r=ao&&ao.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&H9r(t,e,r);return V9r(t,e),t};Object.defineProperty(ao,"__esModule",{value:!0});ao.GithubRepositoryIn$=ao.GithubRepositoryIn$outboundSchema=ao.GithubRepositoryIn$inboundSchema=ao.GithubRepositoryInType$=ao.GithubRepositoryInType$outboundSchema=ao.GithubRepositoryInType$inboundSchema=ao.GithubRepositoryInType=void 0;ao.githubRepositoryInToJSON=G9r;ao.githubRepositoryInFromJSON=K9r;var cc=W9r(me()),J9r=ce();ao.GithubRepositoryInType={Github:"github"};ao.GithubRepositoryInType$inboundSchema=cc.nativeEnum(ao.GithubRepositoryInType);ao.GithubRepositoryInType$outboundSchema=ao.GithubRepositoryInType$inboundSchema;var BEt;(function(e){e.inboundSchema=ao.GithubRepositoryInType$inboundSchema,e.outboundSchema=ao.GithubRepositoryInType$outboundSchema})(BEt||(ao.GithubRepositoryInType$=BEt={}));ao.GithubRepositoryIn$inboundSchema=cc.object({type:cc.literal("github").default("github"),name:cc.string(),owner:cc.string(),ref:cc.nullable(cc.string()).optional(),weight:cc.number().default(1),token:cc.string()});ao.GithubRepositoryIn$outboundSchema=cc.object({type:cc.literal("github").default("github"),name:cc.string(),owner:cc.string(),ref:cc.nullable(cc.string()).optional(),weight:cc.number().default(1),token:cc.string()});var $Et;(function(e){e.inboundSchema=ao.GithubRepositoryIn$inboundSchema,e.outboundSchema=ao.GithubRepositoryIn$outboundSchema})($Et||(ao.GithubRepositoryIn$=$Et={}));function G9r(e){return JSON.stringify(ao.GithubRepositoryIn$outboundSchema.parse(e))}function K9r(e){return(0,J9r.safeParse)(e,t=>ao.GithubRepositoryIn$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var REe=b(nu=>{"use strict";var Y9r=nu&&nu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Z9r=nu&&nu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),X9r=nu&&nu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Y9r(t,e,r);return Z9r(t,e),t};Object.defineProperty(nu,"__esModule",{value:!0});nu.TrainingFile$=nu.TrainingFile$outboundSchema=nu.TrainingFile$inboundSchema=void 0;nu.trainingFileToJSON=eWr;nu.trainingFileFromJSON=tWr;var Yk=X9r(me()),UEt=Oe(),Q9r=ce();nu.TrainingFile$inboundSchema=Yk.object({file_id:Yk.string(),weight:Yk.number().default(1)}).transform(e=>(0,UEt.remap)(e,{file_id:"fileId"}));nu.TrainingFile$outboundSchema=Yk.object({fileId:Yk.string(),weight:Yk.number().default(1)}).transform(e=>(0,UEt.remap)(e,{fileId:"file_id"}));var qEt;(function(e){e.inboundSchema=nu.TrainingFile$inboundSchema,e.outboundSchema=nu.TrainingFile$outboundSchema})(qEt||(nu.TrainingFile$=qEt={}));function eWr(e){return JSON.stringify(nu.TrainingFile$outboundSchema.parse(e))}function tWr(e){return(0,Q9r.safeParse)(e,t=>nu.TrainingFile$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'TrainingFile' from JSON")}});var DEe=b(ou=>{"use strict";var rWr=ou&&ou.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),nWr=ou&&ou.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),oWr=ou&&ou.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&rWr(t,e,r);return nWr(t,e),t};Object.defineProperty(ou,"__esModule",{value:!0});ou.TrainingParametersIn$=ou.TrainingParametersIn$outboundSchema=ou.TrainingParametersIn$inboundSchema=void 0;ou.trainingParametersInToJSON=aWr;ou.trainingParametersInFromJSON=sWr;var Ko=oWr(me()),HEt=Oe(),iWr=ce();ou.TrainingParametersIn$inboundSchema=Ko.object({training_steps:Ko.nullable(Ko.number().int()).optional(),learning_rate:Ko.number().default(1e-4),weight_decay:Ko.nullable(Ko.number()).optional(),warmup_fraction:Ko.nullable(Ko.number()).optional(),epochs:Ko.nullable(Ko.number()).optional(),fim_ratio:Ko.nullable(Ko.number()).optional(),seq_len:Ko.nullable(Ko.number().int()).optional()}).transform(e=>(0,HEt.remap)(e,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));ou.TrainingParametersIn$outboundSchema=Ko.object({trainingSteps:Ko.nullable(Ko.number().int()).optional(),learningRate:Ko.number().default(1e-4),weightDecay:Ko.nullable(Ko.number()).optional(),warmupFraction:Ko.nullable(Ko.number()).optional(),epochs:Ko.nullable(Ko.number()).optional(),fimRatio:Ko.nullable(Ko.number()).optional(),seqLen:Ko.nullable(Ko.number().int()).optional()}).transform(e=>(0,HEt.remap)(e,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var zEt;(function(e){e.inboundSchema=ou.TrainingParametersIn$inboundSchema,e.outboundSchema=ou.TrainingParametersIn$outboundSchema})(zEt||(ou.TrainingParametersIn$=zEt={}));function aWr(e){return JSON.stringify(ou.TrainingParametersIn$outboundSchema.parse(e))}function sWr(e){return(0,iWr.safeParse)(e,t=>ou.TrainingParametersIn$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'TrainingParametersIn' from JSON")}});var jEe=b(so=>{"use strict";var uWr=so&&so.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),lWr=so&&so.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),cWr=so&&so.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&uWr(t,e,r);return lWr(t,e),t};Object.defineProperty(so,"__esModule",{value:!0});so.WandbIntegration$=so.WandbIntegration$outboundSchema=so.WandbIntegration$inboundSchema=so.WandbIntegrationType$=so.WandbIntegrationType$outboundSchema=so.WandbIntegrationType$inboundSchema=so.WandbIntegrationType=void 0;so.wandbIntegrationToJSON=fWr;so.wandbIntegrationFromJSON=pWr;var dc=cWr(me()),JEt=Oe(),dWr=ce();so.WandbIntegrationType={Wandb:"wandb"};so.WandbIntegrationType$inboundSchema=dc.nativeEnum(so.WandbIntegrationType);so.WandbIntegrationType$outboundSchema=so.WandbIntegrationType$inboundSchema;var VEt;(function(e){e.inboundSchema=so.WandbIntegrationType$inboundSchema,e.outboundSchema=so.WandbIntegrationType$outboundSchema})(VEt||(so.WandbIntegrationType$=VEt={}));so.WandbIntegration$inboundSchema=dc.object({type:dc.literal("wandb").default("wandb"),project:dc.string(),name:dc.nullable(dc.string()).optional(),api_key:dc.string(),run_name:dc.nullable(dc.string()).optional()}).transform(e=>(0,JEt.remap)(e,{api_key:"apiKey",run_name:"runName"}));so.WandbIntegration$outboundSchema=dc.object({type:dc.literal("wandb").default("wandb"),project:dc.string(),name:dc.nullable(dc.string()).optional(),apiKey:dc.string(),runName:dc.nullable(dc.string()).optional()}).transform(e=>(0,JEt.remap)(e,{apiKey:"api_key",runName:"run_name"}));var WEt;(function(e){e.inboundSchema=so.WandbIntegration$inboundSchema,e.outboundSchema=so.WandbIntegration$outboundSchema})(WEt||(so.WandbIntegration$=WEt={}));function fWr(e){return JSON.stringify(so.WandbIntegration$outboundSchema.parse(e))}function pWr(e){return(0,dWr.safeParse)(e,t=>so.WandbIntegration$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'WandbIntegration' from JSON")}});var ePt=b(lr=>{"use strict";var hWr=lr&&lr.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),mWr=lr&&lr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),gWr=lr&&lr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&hWr(t,e,r);return mWr(t,e),t};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=yWr;lr.jobInIntegrationsFromJSON=bWr;lr.jobInRepositoriesToJSON=_Wr;lr.jobInRepositoriesFromJSON=vWr;lr.jobInToJSON=wWr;lr.jobInFromJSON=SWr;var Gi=gWr(me()),ZEt=Oe(),NEe=ce(),Wte=AEe(),XEt=REe(),QEt=DEe(),Jte=jEe();lr.JobInIntegrations$inboundSchema=Jte.WandbIntegration$inboundSchema;lr.JobInIntegrations$outboundSchema=Jte.WandbIntegration$outboundSchema;var GEt;(function(e){e.inboundSchema=lr.JobInIntegrations$inboundSchema,e.outboundSchema=lr.JobInIntegrations$outboundSchema})(GEt||(lr.JobInIntegrations$=GEt={}));function yWr(e){return JSON.stringify(lr.JobInIntegrations$outboundSchema.parse(e))}function bWr(e){return(0,NEe.safeParse)(e,t=>lr.JobInIntegrations$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobInIntegrations' from JSON")}lr.JobInRepositories$inboundSchema=Wte.GithubRepositoryIn$inboundSchema;lr.JobInRepositories$outboundSchema=Wte.GithubRepositoryIn$outboundSchema;var KEt;(function(e){e.inboundSchema=lr.JobInRepositories$inboundSchema,e.outboundSchema=lr.JobInRepositories$outboundSchema})(KEt||(lr.JobInRepositories$=KEt={}));function _Wr(e){return JSON.stringify(lr.JobInRepositories$outboundSchema.parse(e))}function vWr(e){return(0,NEe.safeParse)(e,t=>lr.JobInRepositories$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobInRepositories' from JSON")}lr.JobIn$inboundSchema=Gi.object({model:Gi.string(),training_files:Gi.array(XEt.TrainingFile$inboundSchema).optional(),validation_files:Gi.nullable(Gi.array(Gi.string())).optional(),hyperparameters:QEt.TrainingParametersIn$inboundSchema,suffix:Gi.nullable(Gi.string()).optional(),integrations:Gi.nullable(Gi.array(Jte.WandbIntegration$inboundSchema)).optional(),repositories:Gi.array(Wte.GithubRepositoryIn$inboundSchema).optional(),auto_start:Gi.boolean().optional()}).transform(e=>(0,ZEt.remap)(e,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart"}));lr.JobIn$outboundSchema=Gi.object({model:Gi.string(),trainingFiles:Gi.array(XEt.TrainingFile$outboundSchema).optional(),validationFiles:Gi.nullable(Gi.array(Gi.string())).optional(),hyperparameters:QEt.TrainingParametersIn$outboundSchema,suffix:Gi.nullable(Gi.string()).optional(),integrations:Gi.nullable(Gi.array(Jte.WandbIntegration$outboundSchema)).optional(),repositories:Gi.array(Wte.GithubRepositoryIn$outboundSchema).optional(),autoStart:Gi.boolean().optional()}).transform(e=>(0,ZEt.remap)(e,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start"}));var YEt;(function(e){e.inboundSchema=lr.JobIn$inboundSchema,e.outboundSchema=lr.JobIn$outboundSchema})(YEt||(lr.JobIn$=YEt={}));function wWr(e){return JSON.stringify(lr.JobIn$outboundSchema.parse(e))}function SWr(e){return(0,NEe.safeParse)(e,t=>lr.JobIn$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobIn' from JSON")}});var FEe=b(Ye=>{"use strict";var xWr=Ye&&Ye.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),CWr=Ye&&Ye.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),OWr=Ye&&Ye.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&xWr(t,e,r);return CWr(t,e),t};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.JobOut$=Ye.JobOut$outboundSchema=Ye.JobOut$inboundSchema=Ye.Repositories$=Ye.Repositories$outboundSchema=Ye.Repositories$inboundSchema=Ye.Integrations$=Ye.Integrations$outboundSchema=Ye.Integrations$inboundSchema=Ye.ObjectT$=Ye.ObjectT$outboundSchema=Ye.ObjectT$inboundSchema=Ye.Status$=Ye.Status$outboundSchema=Ye.Status$inboundSchema=Ye.ObjectT=Ye.Status=void 0;Ye.integrationsToJSON=EWr;Ye.integrationsFromJSON=PWr;Ye.repositoriesToJSON=TWr;Ye.repositoriesFromJSON=MWr;Ye.jobOutToJSON=IWr;Ye.jobOutFromJSON=AWr;var Jt=OWr(me()),aPt=Oe(),LEe=ce(),Gte=Bte(),sPt=$te(),uPt=qte(),Kte=Ute();Ye.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Ye.ObjectT={Job:"job"};Ye.Status$inboundSchema=Jt.nativeEnum(Ye.Status);Ye.Status$outboundSchema=Ye.Status$inboundSchema;var tPt;(function(e){e.inboundSchema=Ye.Status$inboundSchema,e.outboundSchema=Ye.Status$outboundSchema})(tPt||(Ye.Status$=tPt={}));Ye.ObjectT$inboundSchema=Jt.nativeEnum(Ye.ObjectT);Ye.ObjectT$outboundSchema=Ye.ObjectT$inboundSchema;var rPt;(function(e){e.inboundSchema=Ye.ObjectT$inboundSchema,e.outboundSchema=Ye.ObjectT$outboundSchema})(rPt||(Ye.ObjectT$=rPt={}));Ye.Integrations$inboundSchema=Kte.WandbIntegrationOut$inboundSchema;Ye.Integrations$outboundSchema=Kte.WandbIntegrationOut$outboundSchema;var nPt;(function(e){e.inboundSchema=Ye.Integrations$inboundSchema,e.outboundSchema=Ye.Integrations$outboundSchema})(nPt||(Ye.Integrations$=nPt={}));function EWr(e){return JSON.stringify(Ye.Integrations$outboundSchema.parse(e))}function PWr(e){return(0,LEe.safeParse)(e,t=>Ye.Integrations$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Integrations' from JSON")}Ye.Repositories$inboundSchema=Gte.GithubRepositoryOut$inboundSchema;Ye.Repositories$outboundSchema=Gte.GithubRepositoryOut$outboundSchema;var oPt;(function(e){e.inboundSchema=Ye.Repositories$inboundSchema,e.outboundSchema=Ye.Repositories$outboundSchema})(oPt||(Ye.Repositories$=oPt={}));function TWr(e){return JSON.stringify(Ye.Repositories$outboundSchema.parse(e))}function MWr(e){return(0,LEe.safeParse)(e,t=>Ye.Repositories$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Repositories' from JSON")}Ye.JobOut$inboundSchema=Jt.object({id:Jt.string(),auto_start:Jt.boolean(),hyperparameters:uPt.TrainingParameters$inboundSchema,model:Jt.string(),status:Ye.Status$inboundSchema,job_type:Jt.string(),created_at:Jt.number().int(),modified_at:Jt.number().int(),training_files:Jt.array(Jt.string()),validation_files:Jt.nullable(Jt.array(Jt.string())).optional(),object:Jt.literal("job").default("job"),fine_tuned_model:Jt.nullable(Jt.string()).optional(),suffix:Jt.nullable(Jt.string()).optional(),integrations:Jt.nullable(Jt.array(Kte.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Jt.nullable(Jt.number().int()).optional(),repositories:Jt.array(Gte.GithubRepositoryOut$inboundSchema).optional(),metadata:Jt.nullable(sPt.JobMetadataOut$inboundSchema).optional()}).transform(e=>(0,aPt.remap)(e,{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"}));Ye.JobOut$outboundSchema=Jt.object({id:Jt.string(),autoStart:Jt.boolean(),hyperparameters:uPt.TrainingParameters$outboundSchema,model:Jt.string(),status:Ye.Status$outboundSchema,jobType:Jt.string(),createdAt:Jt.number().int(),modifiedAt:Jt.number().int(),trainingFiles:Jt.array(Jt.string()),validationFiles:Jt.nullable(Jt.array(Jt.string())).optional(),object:Jt.literal("job").default("job"),fineTunedModel:Jt.nullable(Jt.string()).optional(),suffix:Jt.nullable(Jt.string()).optional(),integrations:Jt.nullable(Jt.array(Kte.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Jt.nullable(Jt.number().int()).optional(),repositories:Jt.array(Gte.GithubRepositoryOut$outboundSchema).optional(),metadata:Jt.nullable(sPt.JobMetadataOut$outboundSchema).optional()}).transform(e=>(0,aPt.remap)(e,{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 iPt;(function(e){e.inboundSchema=Ye.JobOut$inboundSchema,e.outboundSchema=Ye.JobOut$outboundSchema})(iPt||(Ye.JobOut$=iPt={}));function IWr(e){return JSON.stringify(Ye.JobOut$outboundSchema.parse(e))}function AWr(e){return(0,LEe.safeParse)(e,t=>Ye.JobOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobOut' from JSON")}});var fPt=b(uo=>{"use strict";var RWr=uo&&uo.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),DWr=uo&&uo.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),jWr=uo&&uo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&RWr(t,e,r);return DWr(t,e),t};Object.defineProperty(uo,"__esModule",{value:!0});uo.JobsOut$=uo.JobsOut$outboundSchema=uo.JobsOut$inboundSchema=uo.JobsOutObject$=uo.JobsOutObject$outboundSchema=uo.JobsOutObject$inboundSchema=uo.JobsOutObject=void 0;uo.jobsOutToJSON=LWr;uo.jobsOutFromJSON=FWr;var aC=jWr(me()),NWr=ce(),dPt=FEe();uo.JobsOutObject={List:"list"};uo.JobsOutObject$inboundSchema=aC.nativeEnum(uo.JobsOutObject);uo.JobsOutObject$outboundSchema=uo.JobsOutObject$inboundSchema;var lPt;(function(e){e.inboundSchema=uo.JobsOutObject$inboundSchema,e.outboundSchema=uo.JobsOutObject$outboundSchema})(lPt||(uo.JobsOutObject$=lPt={}));uo.JobsOut$inboundSchema=aC.object({data:aC.array(dPt.JobOut$inboundSchema).optional(),object:aC.literal("list").default("list"),total:aC.number().int()});uo.JobsOut$outboundSchema=aC.object({data:aC.array(dPt.JobOut$outboundSchema).optional(),object:aC.literal("list").default("list"),total:aC.number().int()});var cPt;(function(e){e.inboundSchema=uo.JobsOut$inboundSchema,e.outboundSchema=uo.JobsOut$outboundSchema})(cPt||(uo.JobsOut$=cPt={}));function LWr(e){return JSON.stringify(uo.JobsOut$outboundSchema.parse(e))}function FWr(e){return(0,NWr.safeParse)(e,t=>uo.JobsOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobsOut' from JSON")}});var gPt=b(lo=>{"use strict";var kWr=lo&&lo.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),BWr=lo&&lo.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$Wr=lo&&lo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&kWr(t,e,r);return BWr(t,e),t};Object.defineProperty(lo,"__esModule",{value:!0});lo.LegacyJobMetadataOut$=lo.LegacyJobMetadataOut$outboundSchema=lo.LegacyJobMetadataOut$inboundSchema=lo.LegacyJobMetadataOutObject$=lo.LegacyJobMetadataOutObject$outboundSchema=lo.LegacyJobMetadataOutObject$inboundSchema=lo.LegacyJobMetadataOutObject=void 0;lo.legacyJobMetadataOutToJSON=UWr;lo.legacyJobMetadataOutFromJSON=zWr;var ar=$Wr(me()),mPt=Oe(),qWr=ce();lo.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};lo.LegacyJobMetadataOutObject$inboundSchema=ar.nativeEnum(lo.LegacyJobMetadataOutObject);lo.LegacyJobMetadataOutObject$outboundSchema=lo.LegacyJobMetadataOutObject$inboundSchema;var pPt;(function(e){e.inboundSchema=lo.LegacyJobMetadataOutObject$inboundSchema,e.outboundSchema=lo.LegacyJobMetadataOutObject$outboundSchema})(pPt||(lo.LegacyJobMetadataOutObject$=pPt={}));lo.LegacyJobMetadataOut$inboundSchema=ar.object({expected_duration_seconds:ar.nullable(ar.number().int()).optional(),cost:ar.nullable(ar.number()).optional(),cost_currency:ar.nullable(ar.string()).optional(),train_tokens_per_step:ar.nullable(ar.number().int()).optional(),train_tokens:ar.nullable(ar.number().int()).optional(),data_tokens:ar.nullable(ar.number().int()).optional(),estimated_start_time:ar.nullable(ar.number().int()).optional(),deprecated:ar.boolean().default(!0),details:ar.string(),epochs:ar.nullable(ar.number()).optional(),training_steps:ar.nullable(ar.number().int()).optional(),object:ar.literal("job.metadata").default("job.metadata")}).transform(e=>(0,mPt.remap)(e,{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"}));lo.LegacyJobMetadataOut$outboundSchema=ar.object({expectedDurationSeconds:ar.nullable(ar.number().int()).optional(),cost:ar.nullable(ar.number()).optional(),costCurrency:ar.nullable(ar.string()).optional(),trainTokensPerStep:ar.nullable(ar.number().int()).optional(),trainTokens:ar.nullable(ar.number().int()).optional(),dataTokens:ar.nullable(ar.number().int()).optional(),estimatedStartTime:ar.nullable(ar.number().int()).optional(),deprecated:ar.boolean().default(!0),details:ar.string(),epochs:ar.nullable(ar.number()).optional(),trainingSteps:ar.nullable(ar.number().int()).optional(),object:ar.literal("job.metadata").default("job.metadata")}).transform(e=>(0,mPt.remap)(e,{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 hPt;(function(e){e.inboundSchema=lo.LegacyJobMetadataOut$inboundSchema,e.outboundSchema=lo.LegacyJobMetadataOut$outboundSchema})(hPt||(lo.LegacyJobMetadataOut$=hPt={}));function UWr(e){return JSON.stringify(lo.LegacyJobMetadataOut$outboundSchema.parse(e))}function zWr(e){return(0,qWr.safeParse)(e,t=>lo.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var _Pt=b(iu=>{"use strict";var HWr=iu&&iu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),VWr=iu&&iu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),WWr=iu&&iu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&HWr(t,e,r);return VWr(t,e),t};Object.defineProperty(iu,"__esModule",{value:!0});iu.ListFilesOut$=iu.ListFilesOut$outboundSchema=iu.ListFilesOut$inboundSchema=void 0;iu.listFilesOutToJSON=GWr;iu.listFilesOutFromJSON=KWr;var aT=WWr(me()),JWr=ce(),bPt=TEe();iu.ListFilesOut$inboundSchema=aT.object({data:aT.array(bPt.FileSchema$inboundSchema),object:aT.string(),total:aT.number().int()});iu.ListFilesOut$outboundSchema=aT.object({data:aT.array(bPt.FileSchema$outboundSchema),object:aT.string(),total:aT.number().int()});var yPt;(function(e){e.inboundSchema=iu.ListFilesOut$inboundSchema,e.outboundSchema=iu.ListFilesOut$outboundSchema})(yPt||(iu.ListFilesOut$=yPt={}));function GWr(e){return JSON.stringify(iu.ListFilesOut$outboundSchema.parse(e))}function KWr(e){return(0,JWr.safeParse)(e,t=>iu.ListFilesOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ListFilesOut' from JSON")}});var xPt=b(co=>{"use strict";var YWr=co&&co.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ZWr=co&&co.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),XWr=co&&co.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&YWr(t,e,r);return ZWr(t,e),t};Object.defineProperty(co,"__esModule",{value:!0});co.ModelList$=co.ModelList$outboundSchema=co.ModelList$inboundSchema=co.Data$=co.Data$outboundSchema=co.Data$inboundSchema=void 0;co.dataToJSON=QWr;co.dataFromJSON=eJr;co.modelListToJSON=tJr;co.modelListFromJSON=rJr;var di=XWr(me()),SPt=ce(),Yte=mEe(),Zte=IEe();co.Data$inboundSchema=di.union([Yte.BaseModelCard$inboundSchema.and(di.object({type:di.literal("base")}).transform(e=>({type:e.type}))),Zte.FTModelCard$inboundSchema.and(di.object({type:di.literal("fine-tuned")}).transform(e=>({type:e.type})))]);co.Data$outboundSchema=di.union([Yte.BaseModelCard$outboundSchema.and(di.object({type:di.literal("base")}).transform(e=>({type:e.type}))),Zte.FTModelCard$outboundSchema.and(di.object({type:di.literal("fine-tuned")}).transform(e=>({type:e.type})))]);var vPt;(function(e){e.inboundSchema=co.Data$inboundSchema,e.outboundSchema=co.Data$outboundSchema})(vPt||(co.Data$=vPt={}));function QWr(e){return JSON.stringify(co.Data$outboundSchema.parse(e))}function eJr(e){return(0,SPt.safeParse)(e,t=>co.Data$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Data' from JSON")}co.ModelList$inboundSchema=di.object({object:di.string().default("list"),data:di.array(di.union([Yte.BaseModelCard$inboundSchema.and(di.object({type:di.literal("base")}).transform(e=>({type:e.type}))),Zte.FTModelCard$inboundSchema.and(di.object({type:di.literal("fine-tuned")}).transform(e=>({type:e.type})))])).optional()});co.ModelList$outboundSchema=di.object({object:di.string().default("list"),data:di.array(di.union([Yte.BaseModelCard$outboundSchema.and(di.object({type:di.literal("base")}).transform(e=>({type:e.type}))),Zte.FTModelCard$outboundSchema.and(di.object({type:di.literal("fine-tuned")}).transform(e=>({type:e.type})))])).optional()});var wPt;(function(e){e.inboundSchema=co.ModelList$inboundSchema,e.outboundSchema=co.ModelList$outboundSchema})(wPt||(co.ModelList$=wPt={}));function tJr(e){return JSON.stringify(co.ModelList$outboundSchema.parse(e))}function rJr(e){return(0,SPt.safeParse)(e,t=>co.ModelList$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ModelList' from JSON")}});var MPt=b(au=>{"use strict";var nJr=au&&au.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),oJr=au&&au.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),iJr=au&&au.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&nJr(t,e,r);return oJr(t,e),t};Object.defineProperty(au,"__esModule",{value:!0});au.RetrieveFileOut$=au.RetrieveFileOut$outboundSchema=au.RetrieveFileOut$inboundSchema=void 0;au.retrieveFileOutToJSON=sJr;au.retrieveFileOutFromJSON=uJr;var El=iJr(me()),OPt=Oe(),aJr=ce(),EPt=E3(),PPt=P3(),TPt=T3();au.RetrieveFileOut$inboundSchema=El.object({id:El.string(),object:El.string(),bytes:El.number().int(),created_at:El.number().int(),filename:El.string(),purpose:EPt.FilePurpose$inboundSchema,sample_type:PPt.SampleType$inboundSchema,num_lines:El.nullable(El.number().int()).optional(),source:TPt.Source$inboundSchema,deleted:El.boolean()}).transform(e=>(0,OPt.remap)(e,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));au.RetrieveFileOut$outboundSchema=El.object({id:El.string(),object:El.string(),sizeBytes:El.number().int(),createdAt:El.number().int(),filename:El.string(),purpose:EPt.FilePurpose$outboundSchema,sampleType:PPt.SampleType$outboundSchema,numLines:El.nullable(El.number().int()).optional(),source:TPt.Source$outboundSchema,deleted:El.boolean()}).transform(e=>(0,OPt.remap)(e,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var CPt;(function(e){e.inboundSchema=au.RetrieveFileOut$inboundSchema,e.outboundSchema=au.RetrieveFileOut$outboundSchema})(CPt||(au.RetrieveFileOut$=CPt={}));function sJr(e){return JSON.stringify(au.RetrieveFileOut$outboundSchema.parse(e))}function uJr(e){return(0,aJr.safeParse)(e,t=>au.RetrieveFileOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'RetrieveFileOut' from JSON")}});var RPt=b(su=>{"use strict";var lJr=su&&su.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),cJr=su&&su.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),dJr=su&&su.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&lJr(t,e,r);return cJr(t,e),t};Object.defineProperty(su,"__esModule",{value:!0});su.Security$=su.Security$outboundSchema=su.Security$inboundSchema=void 0;su.securityToJSON=pJr;su.securityFromJSON=hJr;var Xte=dJr(me()),APt=Oe(),fJr=ce();su.Security$inboundSchema=Xte.object({ApiKey:Xte.string().optional()}).transform(e=>(0,APt.remap)(e,{ApiKey:"apiKey"}));su.Security$outboundSchema=Xte.object({apiKey:Xte.string().optional()}).transform(e=>(0,APt.remap)(e,{apiKey:"ApiKey"}));var IPt;(function(e){e.inboundSchema=su.Security$inboundSchema,e.outboundSchema=su.Security$outboundSchema})(IPt||(su.Security$=IPt={}));function pJr(e){return JSON.stringify(su.Security$outboundSchema.parse(e))}function hJr(e){return(0,fJr.safeParse)(e,t=>su.Security$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Security' from JSON")}});var NPt=b(fo=>{"use strict";var mJr=fo&&fo.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),gJr=fo&&fo.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),yJr=fo&&fo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&mJr(t,e,r);return gJr(t,e),t};Object.defineProperty(fo,"__esModule",{value:!0});fo.UnarchiveFTModelOut$=fo.UnarchiveFTModelOut$outboundSchema=fo.UnarchiveFTModelOut$inboundSchema=fo.UnarchiveFTModelOutObject$=fo.UnarchiveFTModelOutObject$outboundSchema=fo.UnarchiveFTModelOutObject$inboundSchema=fo.UnarchiveFTModelOutObject=void 0;fo.unarchiveFTModelOutToJSON=_Jr;fo.unarchiveFTModelOutFromJSON=vJr;var sC=yJr(me()),bJr=ce();fo.UnarchiveFTModelOutObject={Model:"model"};fo.UnarchiveFTModelOutObject$inboundSchema=sC.nativeEnum(fo.UnarchiveFTModelOutObject);fo.UnarchiveFTModelOutObject$outboundSchema=fo.UnarchiveFTModelOutObject$inboundSchema;var DPt;(function(e){e.inboundSchema=fo.UnarchiveFTModelOutObject$inboundSchema,e.outboundSchema=fo.UnarchiveFTModelOutObject$outboundSchema})(DPt||(fo.UnarchiveFTModelOutObject$=DPt={}));fo.UnarchiveFTModelOut$inboundSchema=sC.object({id:sC.string(),object:sC.literal("model").default("model"),archived:sC.boolean().default(!1)});fo.UnarchiveFTModelOut$outboundSchema=sC.object({id:sC.string(),object:sC.literal("model").default("model"),archived:sC.boolean().default(!1)});var jPt;(function(e){e.inboundSchema=fo.UnarchiveFTModelOut$inboundSchema,e.outboundSchema=fo.UnarchiveFTModelOut$outboundSchema})(jPt||(fo.UnarchiveFTModelOut$=jPt={}));function _Jr(e){return JSON.stringify(fo.UnarchiveFTModelOut$outboundSchema.parse(e))}function vJr(e){return(0,bJr.safeParse)(e,t=>fo.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var FPt=b(uu=>{"use strict";var wJr=uu&&uu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),SJr=uu&&uu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),xJr=uu&&uu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&wJr(t,e,r);return SJr(t,e),t};Object.defineProperty(uu,"__esModule",{value:!0});uu.UpdateFTModelIn$=uu.UpdateFTModelIn$outboundSchema=uu.UpdateFTModelIn$inboundSchema=void 0;uu.updateFTModelInToJSON=OJr;uu.updateFTModelInFromJSON=EJr;var Ww=xJr(me()),CJr=ce();uu.UpdateFTModelIn$inboundSchema=Ww.object({name:Ww.nullable(Ww.string()).optional(),description:Ww.nullable(Ww.string()).optional()});uu.UpdateFTModelIn$outboundSchema=Ww.object({name:Ww.nullable(Ww.string()).optional(),description:Ww.nullable(Ww.string()).optional()});var LPt;(function(e){e.inboundSchema=uu.UpdateFTModelIn$inboundSchema,e.outboundSchema=uu.UpdateFTModelIn$outboundSchema})(LPt||(uu.UpdateFTModelIn$=LPt={}));function OJr(e){return JSON.stringify(uu.UpdateFTModelIn$outboundSchema.parse(e))}function EJr(e){return(0,CJr.safeParse)(e,t=>uu.UpdateFTModelIn$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var zPt=b(lu=>{"use strict";var PJr=lu&&lu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),TJr=lu&&lu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),MJr=lu&&lu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&PJr(t,e,r);return TJr(t,e),t};Object.defineProperty(lu,"__esModule",{value:!0});lu.UploadFileOut$=lu.UploadFileOut$outboundSchema=lu.UploadFileOut$inboundSchema=void 0;lu.uploadFileOutToJSON=AJr;lu.uploadFileOutFromJSON=RJr;var id=MJr(me()),BPt=Oe(),IJr=ce(),$Pt=E3(),qPt=P3(),UPt=T3();lu.UploadFileOut$inboundSchema=id.object({id:id.string(),object:id.string(),bytes:id.number().int(),created_at:id.number().int(),filename:id.string(),purpose:$Pt.FilePurpose$inboundSchema,sample_type:qPt.SampleType$inboundSchema,num_lines:id.nullable(id.number().int()).optional(),source:UPt.Source$inboundSchema}).transform(e=>(0,BPt.remap)(e,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));lu.UploadFileOut$outboundSchema=id.object({id:id.string(),object:id.string(),sizeBytes:id.number().int(),createdAt:id.number().int(),filename:id.string(),purpose:$Pt.FilePurpose$outboundSchema,sampleType:qPt.SampleType$outboundSchema,numLines:id.nullable(id.number().int()).optional(),source:UPt.Source$outboundSchema}).transform(e=>(0,BPt.remap)(e,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var kPt;(function(e){e.inboundSchema=lu.UploadFileOut$inboundSchema,e.outboundSchema=lu.UploadFileOut$outboundSchema})(kPt||(lu.UploadFileOut$=kPt={}));function AJr(e){return JSON.stringify(lu.UploadFileOut$outboundSchema.parse(e))}function RJr(e){return(0,IJr.safeParse)(e,t=>lu.UploadFileOut$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'UploadFileOut' from JSON")}});var JPt=b(po=>{"use strict";var DJr=po&&po.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),jJr=po&&po.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),NJr=po&&po.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&DJr(t,e,r);return jJr(t,e),t};Object.defineProperty(po,"__esModule",{value:!0});po.ValidationError$=po.ValidationError$outboundSchema=po.ValidationError$inboundSchema=po.Loc$=po.Loc$outboundSchema=po.Loc$inboundSchema=void 0;po.locToJSON=LJr;po.locFromJSON=FJr;po.validationErrorToJSON=kJr;po.validationErrorFromJSON=BJr;var cu=NJr(me()),WPt=ce();po.Loc$inboundSchema=cu.union([cu.string(),cu.number().int()]);po.Loc$outboundSchema=cu.union([cu.string(),cu.number().int()]);var HPt;(function(e){e.inboundSchema=po.Loc$inboundSchema,e.outboundSchema=po.Loc$outboundSchema})(HPt||(po.Loc$=HPt={}));function LJr(e){return JSON.stringify(po.Loc$outboundSchema.parse(e))}function FJr(e){return(0,WPt.safeParse)(e,t=>po.Loc$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'Loc' from JSON")}po.ValidationError$inboundSchema=cu.object({loc:cu.array(cu.union([cu.string(),cu.number().int()])),msg:cu.string(),type:cu.string()});po.ValidationError$outboundSchema=cu.object({loc:cu.array(cu.union([cu.string(),cu.number().int()])),msg:cu.string(),type:cu.string()});var VPt;(function(e){e.inboundSchema=po.ValidationError$inboundSchema,e.outboundSchema=po.ValidationError$outboundSchema})(VPt||(po.ValidationError$=VPt={}));function kJr(e){return JSON.stringify(po.ValidationError$outboundSchema.parse(e))}function BJr(e){return(0,WPt.safeParse)(e,t=>po.ValidationError$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'ValidationError' from JSON")}});var fn=b(Te=>{"use strict";var $Jr=Te&&Te.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Ne=Te&&Te.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&$Jr(t,e,r)};Object.defineProperty(Te,"__esModule",{value:!0});Ne(Ixt(),Te);Ne(Bxt(),Te);Ne(hEe(),Te);Ne(zxt(),Te);Ne(tT(),Te);Ne(mEe(),Te);Ne(gEe(),Te);Ne(eCt(),Te);Ne(bEe(),Te);Ne(cCt(),Te);Ne(yEe(),Te);Ne(gCt(),Te);Ne(xte(),Te);Ne(MCt(),Te);Ne(NCt(),Te);Ne(HCt(),Te);Ne(vEe(),Te);Ne(wEe(),Te);Ne(rOt(),Te);Ne(iOt(),Te);Ne(CEe(),Te);Ne(vOt(),Te);Ne(xEe(),Te);Ne($k(),Te);Ne(SOt(),Te);Ne(COt(),Te);Ne(SEe(),Te);Ne(JOt(),Te);Ne(XOt(),Te);Ne(nEt(),Te);Ne(PEe(),Te);Ne(OEe(),Te);Ne(E3(),Te);Ne(TEe(),Te);Ne(pEt(),Te);Ne(bEt(),Te);Ne(SEt(),Te);Ne(PEt(),Te);Ne(MEe(),Te);Ne(IEe(),Te);Ne(kEt(),Te);Ne(fEe(),Te);Ne(uEe(),Te);Ne(pEe(),Te);Ne(AEe(),Te);Ne(Bte(),Te);Ne(iEe(),Te);Ne(aEe(),Te);Ne(ePt(),Te);Ne($te(),Te);Ne(FEe(),Te);Ne(fPt(),Te);Ne(cEe(),Te);Ne(gPt(),Te);Ne(_Pt(),Te);Ne(_Ee(),Te);Ne(wte(),Te);Ne(xPt(),Te);Ne(Uk(),Te);Ne(sEe(),Te);Ne(zk(),Te);Ne(dEe(),Te);Ne(MPt(),Te);Ne(P3(),Te);Ne(RPt(),Te);Ne(T3(),Te);Ne(h1(),Te);Ne(Qee(),Te);Ne(Hk(),Te);Ne(ete(),Te);Ne(Vk(),Te);Ne(Wk(),Te);Ne(m1(),Te);Ne(C3(),Te);Ne(REe(),Te);Ne(qte(),Te);Ne(DEe(),Te);Ne(NPt(),Te);Ne(FPt(),Te);Ne(zPt(),Te);Ne(Gk(),Te);Ne(g1(),Te);Ne(JPt(),Te);Ne(jEe(),Te);Ne(Ute(),Te)});var ZPt=b(Pl=>{"use strict";var qJr=Pl&&Pl.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),UJr=Pl&&Pl.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),KPt=Pl&&Pl.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&qJr(t,e,r);return UJr(t,e),t};Object.defineProperty(Pl,"__esModule",{value:!0});Pl.HTTPValidationError$=Pl.HTTPValidationError$outboundSchema=Pl.HTTPValidationError$inboundSchema=Pl.HTTPValidationError=void 0;var M3=KPt(me()),YPt=KPt(fn()),I3=class extends Error{constructor(t){let r="message"in t&&typeof t.message=="string"?t.message:`API error occurred: ${JSON.stringify(t)}`;super(r),this.data$=t,t.detail!=null&&(this.detail=t.detail),this.name="HTTPValidationError"}};Pl.HTTPValidationError=I3;Pl.HTTPValidationError$inboundSchema=M3.object({detail:M3.array(YPt.ValidationError$inboundSchema).optional()}).transform(e=>new I3(e));Pl.HTTPValidationError$outboundSchema=M3.instanceof(I3).transform(e=>e.data$).pipe(M3.object({detail:M3.array(YPt.ValidationError$outboundSchema).optional()}));var GPt;(function(e){e.inboundSchema=Pl.HTTPValidationError$inboundSchema,e.outboundSchema=Pl.HTTPValidationError$outboundSchema})(GPt||(Pl.HTTPValidationError$=GPt={}))});var Dp=b(Jw=>{"use strict";var zJr=Jw&&Jw.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Qte=Jw&&Jw.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&zJr(t,e,r)};Object.defineProperty(Jw,"__esModule",{value:!0});Qte(IOe(),Jw);Qte(ZPt(),Jw);Qte(XOe(),Jw);Qte(nEe(),Jw)});var eTt=b(uC=>{"use strict";var HJr=uC&&uC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),VJr=uC&&uC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),kEe=uC&&uC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&HJr(t,e,r);return VJr(t,e),t};Object.defineProperty(uC,"__esModule",{value:!0});uC.agentsComplete=ZJr;var WJr=vo(),A3=kEe(wo()),JJr=Oe(),GJr=ce(),XPt=So(),KJr=Hn(),QPt=kEe(fn()),YJr=kEe(Dp());async function ZJr(e,t,r){let n=(0,GJr.safeParse)(t,v=>QPt.AgentsCompletionRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,WJr.encodeJSON)("body",o,{explode:!0}),a=(0,KJr.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,JJr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,XPt.extractSecurity)(e._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,XPt.resolveGlobalSecurity)(l),d={operationID:"agents_completion_v1_agents_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=e._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await e._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,_={HttpMeta:{Response:m,Request:p}},[g]=await A3.match(A3.json(200,QPt.ChatCompletionResponse$inboundSchema),A3.jsonErr(422,YJr.HTTPValidationError$inboundSchema),A3.fail("4XX"),A3.fail("5XX"))(m,{extraFields:_});return g.ok,g}});var nTt=b(lC=>{"use strict";var XJr=lC&&lC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),QJr=lC&&lC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ere=lC&&lC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&XJr(t,e,r);return QJr(t,e),t};Object.defineProperty(lC,"__esModule",{value:!0});lC.agentsStream=sGr;var eGr=ere(me()),tGr=vo(),rGr=w3(),R3=ere(wo()),nGr=Oe(),oGr=ce(),tTt=So(),iGr=Hn(),rTt=ere(fn()),aGr=ere(Dp());async function sGr(e,t,r){let n=(0,oGr.safeParse)(t,v=>rTt.AgentsCompletionStreamRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,tGr.encodeJSON)("body",o,{explode:!0}),a=(0,iGr.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,nGr.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,tTt.extractSecurity)(e._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,tTt.resolveGlobalSecurity)(l),d={operationID:"stream_agents",oAuth2Scopes:[],resolvedSecurity:c,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=e._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await e._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,_={HttpMeta:{Response:m,Request:p}},[g]=await R3.match(R3.sse(200,eGr.instanceof(ReadableStream).transform(v=>new rGr.EventStream({stream:v,decoder(S){return rTt.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),R3.jsonErr(422,aGr.HTTPValidationError$inboundSchema),R3.fail("4XX"),R3.fail("5XX"))(m,{extraFields:_});return g.ok,g}});var iTt=b(tre=>{"use strict";Object.defineProperty(tre,"__esModule",{value:!0});tre.Agents=void 0;var uGr=eTt(),lGr=nTt(),cGr=Ap(),oTt=Jh(),BEe=class extends cGr.ClientSDK{async complete(t,r){return(0,oTt.unwrapAsync)((0,uGr.agentsComplete)(this,t,r))}async stream(t,r){return(0,oTt.unwrapAsync)((0,lGr.agentsStream)(this,t,r))}};tre.Agents=BEe});var uTt=b(du=>{"use strict";var dGr=du&&du.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),fGr=du&&du.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),pGr=du&&du.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&dGr(t,e,r);return fGr(t,e),t};Object.defineProperty(du,"__esModule",{value:!0});du.DeleteModelV1ModelsModelIdDeleteRequest$=du.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=du.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;du.deleteModelV1ModelsModelIdDeleteRequestToJSON=mGr;du.deleteModelV1ModelsModelIdDeleteRequestFromJSON=gGr;var rre=pGr(me()),sTt=Oe(),hGr=ce();du.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=rre.object({model_id:rre.string()}).transform(e=>(0,sTt.remap)(e,{model_id:"modelId"}));du.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=rre.object({modelId:rre.string()}).transform(e=>(0,sTt.remap)(e,{modelId:"model_id"}));var aTt;(function(e){e.inboundSchema=du.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,e.outboundSchema=du.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(aTt||(du.DeleteModelV1ModelsModelIdDeleteRequest$=aTt={}));function mGr(e){return JSON.stringify(du.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(e))}function gGr(e){return(0,hGr.safeParse)(e,t=>du.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var dTt=b(fu=>{"use strict";var yGr=fu&&fu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),bGr=fu&&fu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_Gr=fu&&fu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&yGr(t,e,r);return bGr(t,e),t};Object.defineProperty(fu,"__esModule",{value:!0});fu.FilesApiRoutesDeleteFileRequest$=fu.FilesApiRoutesDeleteFileRequest$outboundSchema=fu.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;fu.filesApiRoutesDeleteFileRequestToJSON=wGr;fu.filesApiRoutesDeleteFileRequestFromJSON=SGr;var nre=_Gr(me()),cTt=Oe(),vGr=ce();fu.FilesApiRoutesDeleteFileRequest$inboundSchema=nre.object({file_id:nre.string()}).transform(e=>(0,cTt.remap)(e,{file_id:"fileId"}));fu.FilesApiRoutesDeleteFileRequest$outboundSchema=nre.object({fileId:nre.string()}).transform(e=>(0,cTt.remap)(e,{fileId:"file_id"}));var lTt;(function(e){e.inboundSchema=fu.FilesApiRoutesDeleteFileRequest$inboundSchema,e.outboundSchema=fu.FilesApiRoutesDeleteFileRequest$outboundSchema})(lTt||(fu.FilesApiRoutesDeleteFileRequest$=lTt={}));function wGr(e){return JSON.stringify(fu.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(e))}function SGr(e){return(0,vGr.safeParse)(e,t=>fu.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var hTt=b(pu=>{"use strict";var xGr=pu&&pu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),CGr=pu&&pu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),OGr=pu&&pu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&xGr(t,e,r);return CGr(t,e),t};Object.defineProperty(pu,"__esModule",{value:!0});pu.FilesApiRoutesDownloadFileRequest$=pu.FilesApiRoutesDownloadFileRequest$outboundSchema=pu.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;pu.filesApiRoutesDownloadFileRequestToJSON=PGr;pu.filesApiRoutesDownloadFileRequestFromJSON=TGr;var ore=OGr(me()),pTt=Oe(),EGr=ce();pu.FilesApiRoutesDownloadFileRequest$inboundSchema=ore.object({file_id:ore.string()}).transform(e=>(0,pTt.remap)(e,{file_id:"fileId"}));pu.FilesApiRoutesDownloadFileRequest$outboundSchema=ore.object({fileId:ore.string()}).transform(e=>(0,pTt.remap)(e,{fileId:"file_id"}));var fTt;(function(e){e.inboundSchema=pu.FilesApiRoutesDownloadFileRequest$inboundSchema,e.outboundSchema=pu.FilesApiRoutesDownloadFileRequest$outboundSchema})(fTt||(pu.FilesApiRoutesDownloadFileRequest$=fTt={}));function PGr(e){return JSON.stringify(pu.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(e))}function TGr(e){return(0,EGr.safeParse)(e,t=>pu.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var yTt=b(hu=>{"use strict";var MGr=hu&&hu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),IGr=hu&&hu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),AGr=hu&&hu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&MGr(t,e,r);return IGr(t,e),t};Object.defineProperty(hu,"__esModule",{value:!0});hu.FilesApiRoutesGetSignedUrlRequest$=hu.FilesApiRoutesGetSignedUrlRequest$outboundSchema=hu.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;hu.filesApiRoutesGetSignedUrlRequestToJSON=DGr;hu.filesApiRoutesGetSignedUrlRequestFromJSON=jGr;var Zk=AGr(me()),gTt=Oe(),RGr=ce();hu.FilesApiRoutesGetSignedUrlRequest$inboundSchema=Zk.object({file_id:Zk.string(),expiry:Zk.number().int().default(24)}).transform(e=>(0,gTt.remap)(e,{file_id:"fileId"}));hu.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Zk.object({fileId:Zk.string(),expiry:Zk.number().int().default(24)}).transform(e=>(0,gTt.remap)(e,{fileId:"file_id"}));var mTt;(function(e){e.inboundSchema=hu.FilesApiRoutesGetSignedUrlRequest$inboundSchema,e.outboundSchema=hu.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(mTt||(hu.FilesApiRoutesGetSignedUrlRequest$=mTt={}));function DGr(e){return JSON.stringify(hu.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(e))}function jGr(e){return(0,RGr.safeParse)(e,t=>hu.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var wTt=b(gu=>{"use strict";var NGr=gu&&gu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),LGr=gu&&gu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_Tt=gu&&gu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&NGr(t,e,r);return LGr(t,e),t};Object.defineProperty(gu,"__esModule",{value:!0});gu.FilesApiRoutesListFilesRequest$=gu.FilesApiRoutesListFilesRequest$outboundSchema=gu.FilesApiRoutesListFilesRequest$inboundSchema=void 0;gu.filesApiRoutesListFilesRequestToJSON=kGr;gu.filesApiRoutesListFilesRequestFromJSON=BGr;var mu=_Tt(me()),vTt=Oe(),FGr=ce(),Xk=_Tt(fn());gu.FilesApiRoutesListFilesRequest$inboundSchema=mu.object({page:mu.number().int().default(0),page_size:mu.number().int().default(100),sample_type:mu.nullable(mu.array(Xk.SampleType$inboundSchema)).optional(),source:mu.nullable(mu.array(Xk.Source$inboundSchema)).optional(),search:mu.nullable(mu.string()).optional(),purpose:mu.nullable(Xk.FilePurpose$inboundSchema).optional()}).transform(e=>(0,vTt.remap)(e,{page_size:"pageSize",sample_type:"sampleType"}));gu.FilesApiRoutesListFilesRequest$outboundSchema=mu.object({page:mu.number().int().default(0),pageSize:mu.number().int().default(100),sampleType:mu.nullable(mu.array(Xk.SampleType$outboundSchema)).optional(),source:mu.nullable(mu.array(Xk.Source$outboundSchema)).optional(),search:mu.nullable(mu.string()).optional(),purpose:mu.nullable(Xk.FilePurpose$outboundSchema).optional()}).transform(e=>(0,vTt.remap)(e,{pageSize:"page_size",sampleType:"sample_type"}));var bTt;(function(e){e.inboundSchema=gu.FilesApiRoutesListFilesRequest$inboundSchema,e.outboundSchema=gu.FilesApiRoutesListFilesRequest$outboundSchema})(bTt||(gu.FilesApiRoutesListFilesRequest$=bTt={}));function kGr(e){return JSON.stringify(gu.FilesApiRoutesListFilesRequest$outboundSchema.parse(e))}function BGr(e){return(0,FGr.safeParse)(e,t=>gu.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var CTt=b(yu=>{"use strict";var $Gr=yu&&yu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),qGr=yu&&yu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),UGr=yu&&yu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$Gr(t,e,r);return qGr(t,e),t};Object.defineProperty(yu,"__esModule",{value:!0});yu.FilesApiRoutesRetrieveFileRequest$=yu.FilesApiRoutesRetrieveFileRequest$outboundSchema=yu.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;yu.filesApiRoutesRetrieveFileRequestToJSON=HGr;yu.filesApiRoutesRetrieveFileRequestFromJSON=VGr;var ire=UGr(me()),xTt=Oe(),zGr=ce();yu.FilesApiRoutesRetrieveFileRequest$inboundSchema=ire.object({file_id:ire.string()}).transform(e=>(0,xTt.remap)(e,{file_id:"fileId"}));yu.FilesApiRoutesRetrieveFileRequest$outboundSchema=ire.object({fileId:ire.string()}).transform(e=>(0,xTt.remap)(e,{fileId:"file_id"}));var STt;(function(e){e.inboundSchema=yu.FilesApiRoutesRetrieveFileRequest$inboundSchema,e.outboundSchema=yu.FilesApiRoutesRetrieveFileRequest$outboundSchema})(STt||(yu.FilesApiRoutesRetrieveFileRequest$=STt={}));function HGr(e){return JSON.stringify(yu.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(e))}function VGr(e){return(0,zGr.safeParse)(e,t=>yu.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var $Ee=b(Rg=>{"use strict";var WGr=Rg&&Rg.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),JGr=Rg&&Rg.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),GGr=Rg&&Rg.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&WGr(t,e,r);return JGr(t,e),t};Object.defineProperty(Rg,"__esModule",{value:!0});Rg.blobLikeSchema=void 0;Rg.isBlobLike=OTt;var KGr=GGr(me());Rg.blobLikeSchema=KGr.custom(OTt,{message:"expected a Blob, File or Blob-like object",fatal:!0});function OTt(e){if(e instanceof Blob)return!0;if(typeof e!="object"||e==null||!(Symbol.toStringTag in e))return!1;let t=e[Symbol.toStringTag];return typeof t!="string"||t!=="Blob"&&t!=="File"?!1:"stream"in e&&typeof e.stream=="function"}});var ATt=b(An=>{"use strict";var YGr=An&&An.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ZGr=An&&An.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),TTt=An&&An.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&YGr(t,e,r);return ZGr(t,e),t};Object.defineProperty(An,"__esModule",{value:!0});An.FilesApiRoutesUploadFileMultiPartBodyParams$=An.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=An.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=An.FileT$=An.FileT$outboundSchema=An.FileT$inboundSchema=void 0;An.fileToJSON=QGr;An.fileFromJSON=eKr;An.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=tKr;An.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=rKr;var Tl=TTt(me()),MTt=ce(),XGr=$Ee(),ITt=TTt(fn());An.FileT$inboundSchema=Tl.object({fileName:Tl.string(),content:Tl.union([Tl.instanceof(ReadableStream),Tl.instanceof(Blob),Tl.instanceof(ArrayBuffer),Tl.instanceof(Uint8Array)])});An.FileT$outboundSchema=Tl.object({fileName:Tl.string(),content:Tl.union([Tl.instanceof(ReadableStream),Tl.instanceof(Blob),Tl.instanceof(ArrayBuffer),Tl.instanceof(Uint8Array)])});var ETt;(function(e){e.inboundSchema=An.FileT$inboundSchema,e.outboundSchema=An.FileT$outboundSchema})(ETt||(An.FileT$=ETt={}));function QGr(e){return JSON.stringify(An.FileT$outboundSchema.parse(e))}function eKr(e){return(0,MTt.safeParse)(e,t=>An.FileT$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FileT' from JSON")}An.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=Tl.object({file:Tl.lazy(()=>An.FileT$inboundSchema),purpose:ITt.FilePurpose$inboundSchema.optional()});An.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=Tl.object({file:Tl.lazy(()=>An.FileT$outboundSchema).or(XGr.blobLikeSchema),purpose:ITt.FilePurpose$outboundSchema.optional()});var PTt;(function(e){e.inboundSchema=An.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,e.outboundSchema=An.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(PTt||(An.FilesApiRoutesUploadFileMultiPartBodyParams$=PTt={}));function tKr(e){return JSON.stringify(An.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(e))}function rKr(e){return(0,MTt.safeParse)(e,t=>An.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var jTt=b(bu=>{"use strict";var nKr=bu&&bu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),oKr=bu&&bu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),iKr=bu&&bu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&nKr(t,e,r);return oKr(t,e),t};Object.defineProperty(bu,"__esModule",{value:!0});bu.JobsApiRoutesBatchCancelBatchJobRequest$=bu.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=bu.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;bu.jobsApiRoutesBatchCancelBatchJobRequestToJSON=sKr;bu.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=uKr;var are=iKr(me()),DTt=Oe(),aKr=ce();bu.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=are.object({job_id:are.string()}).transform(e=>(0,DTt.remap)(e,{job_id:"jobId"}));bu.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=are.object({jobId:are.string()}).transform(e=>(0,DTt.remap)(e,{jobId:"job_id"}));var RTt;(function(e){e.inboundSchema=bu.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,e.outboundSchema=bu.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(RTt||(bu.JobsApiRoutesBatchCancelBatchJobRequest$=RTt={}));function sKr(e){return JSON.stringify(bu.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(e))}function uKr(e){return(0,aKr.safeParse)(e,t=>bu.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var FTt=b(_u=>{"use strict";var lKr=_u&&_u.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),cKr=_u&&_u.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),dKr=_u&&_u.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&lKr(t,e,r);return cKr(t,e),t};Object.defineProperty(_u,"__esModule",{value:!0});_u.JobsApiRoutesBatchGetBatchJobRequest$=_u.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=_u.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;_u.jobsApiRoutesBatchGetBatchJobRequestToJSON=pKr;_u.jobsApiRoutesBatchGetBatchJobRequestFromJSON=hKr;var sre=dKr(me()),LTt=Oe(),fKr=ce();_u.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=sre.object({job_id:sre.string()}).transform(e=>(0,LTt.remap)(e,{job_id:"jobId"}));_u.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=sre.object({jobId:sre.string()}).transform(e=>(0,LTt.remap)(e,{jobId:"job_id"}));var NTt;(function(e){e.inboundSchema=_u.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,e.outboundSchema=_u.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(NTt||(_u.JobsApiRoutesBatchGetBatchJobRequest$=NTt={}));function pKr(e){return JSON.stringify(_u.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(e))}function hKr(e){return(0,fKr.safeParse)(e,t=>_u.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var UTt=b(vu=>{"use strict";var mKr=vu&&vu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),gKr=vu&&vu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),BTt=vu&&vu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&mKr(t,e,r);return gKr(t,e),t};Object.defineProperty(vu,"__esModule",{value:!0});vu.JobsApiRoutesBatchGetBatchJobsRequest$=vu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=vu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;vu.jobsApiRoutesBatchGetBatchJobsRequestToJSON=bKr;vu.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=_Kr;var Ki=BTt(me()),$Tt=Oe(),yKr=ce(),qTt=BTt(fn());vu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=Ki.object({page:Ki.number().int().default(0),page_size:Ki.number().int().default(100),model:Ki.nullable(Ki.string()).optional(),metadata:Ki.nullable(Ki.record(Ki.any())).optional(),created_after:Ki.nullable(Ki.string().datetime({offset:!0}).transform(e=>new Date(e))).optional(),created_by_me:Ki.boolean().default(!1),status:Ki.nullable(qTt.BatchJobStatus$inboundSchema).optional()}).transform(e=>(0,$Tt.remap)(e,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe"}));vu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Ki.object({page:Ki.number().int().default(0),pageSize:Ki.number().int().default(100),model:Ki.nullable(Ki.string()).optional(),metadata:Ki.nullable(Ki.record(Ki.any())).optional(),createdAfter:Ki.nullable(Ki.date().transform(e=>e.toISOString())).optional(),createdByMe:Ki.boolean().default(!1),status:Ki.nullable(qTt.BatchJobStatus$outboundSchema).optional()}).transform(e=>(0,$Tt.remap)(e,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me"}));var kTt;(function(e){e.inboundSchema=vu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,e.outboundSchema=vu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(kTt||(vu.JobsApiRoutesBatchGetBatchJobsRequest$=kTt={}));function bKr(e){return JSON.stringify(vu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(e))}function _Kr(e){return(0,yKr.safeParse)(e,t=>vu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var VTt=b(wu=>{"use strict";var vKr=wu&&wu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),wKr=wu&&wu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),SKr=wu&&wu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&vKr(t,e,r);return wKr(t,e),t};Object.defineProperty(wu,"__esModule",{value:!0});wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;wu.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=CKr;wu.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=OKr;var ure=SKr(me()),HTt=Oe(),xKr=ce();wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=ure.object({model_id:ure.string()}).transform(e=>(0,HTt.remap)(e,{model_id:"modelId"}));wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=ure.object({modelId:ure.string()}).transform(e=>(0,HTt.remap)(e,{modelId:"model_id"}));var zTt;(function(e){e.inboundSchema=wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,e.outboundSchema=wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(zTt||(wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=zTt={}));function CKr(e){return JSON.stringify(wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(e))}function OKr(e){return(0,xKr.safeParse)(e,t=>wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var GTt=b(Su=>{"use strict";var EKr=Su&&Su.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),PKr=Su&&Su.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),TKr=Su&&Su.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&EKr(t,e,r);return PKr(t,e),t};Object.defineProperty(Su,"__esModule",{value:!0});Su.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=Su.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=Su.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;Su.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=IKr;Su.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=AKr;var lre=TKr(me()),JTt=Oe(),MKr=ce();Su.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=lre.object({job_id:lre.string()}).transform(e=>(0,JTt.remap)(e,{job_id:"jobId"}));Su.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=lre.object({jobId:lre.string()}).transform(e=>(0,JTt.remap)(e,{jobId:"job_id"}));var WTt;(function(e){e.inboundSchema=Su.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,e.outboundSchema=Su.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(WTt||(Su.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=WTt={}));function IKr(e){return JSON.stringify(Su.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(e))}function AKr(e){return(0,MKr.safeParse)(e,t=>Su.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}});var XTt=b(xu=>{"use strict";var RKr=xu&&xu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),DKr=xu&&xu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),YTt=xu&&xu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&RKr(t,e,r);return DKr(t,e),t};Object.defineProperty(xu,"__esModule",{value:!0});xu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=xu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=xu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=void 0;xu.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=NKr;xu.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=LKr;var ZTt=YTt(me()),jKr=ce(),cre=YTt(fn());xu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=ZTt.union([cre.LegacyJobMetadataOut$inboundSchema,cre.JobOut$inboundSchema]);xu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=ZTt.union([cre.LegacyJobMetadataOut$outboundSchema,cre.JobOut$outboundSchema]);var KTt;(function(e){e.inboundSchema=xu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,e.outboundSchema=xu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(KTt||(xu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=KTt={}));function NKr(e){return JSON.stringify(xu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(e))}function LKr(e){return(0,jKr.safeParse)(e,t=>xu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var tMt=b(Cu=>{"use strict";var FKr=Cu&&Cu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),kKr=Cu&&Cu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),BKr=Cu&&Cu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&FKr(t,e,r);return kKr(t,e),t};Object.defineProperty(Cu,"__esModule",{value:!0});Cu.JobsApiRoutesFineTuningGetFineTuningJobRequest$=Cu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=Cu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;Cu.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=qKr;Cu.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=UKr;var dre=BKr(me()),eMt=Oe(),$Kr=ce();Cu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=dre.object({job_id:dre.string()}).transform(e=>(0,eMt.remap)(e,{job_id:"jobId"}));Cu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=dre.object({jobId:dre.string()}).transform(e=>(0,eMt.remap)(e,{jobId:"job_id"}));var QTt;(function(e){e.inboundSchema=Cu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,e.outboundSchema=Cu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(QTt||(Cu.JobsApiRoutesFineTuningGetFineTuningJobRequest$=QTt={}));function qKr(e){return JSON.stringify(Cu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(e))}function UKr(e){return(0,$Kr.safeParse)(e,t=>Cu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}});var iMt=b(Rn=>{"use strict";var zKr=Rn&&Rn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),HKr=Rn&&Rn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),VKr=Rn&&Rn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&zKr(t,e,r);return HKr(t,e),t};Object.defineProperty(Rn,"__esModule",{value:!0});Rn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=Rn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Rn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Rn.Status$=Rn.Status$outboundSchema=Rn.Status$inboundSchema=Rn.Status=void 0;Rn.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=JKr;Rn.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=GKr;var Co=VKr(me()),oMt=Oe(),WKr=ce();Rn.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Rn.Status$inboundSchema=Co.nativeEnum(Rn.Status);Rn.Status$outboundSchema=Rn.Status$inboundSchema;var rMt;(function(e){e.inboundSchema=Rn.Status$inboundSchema,e.outboundSchema=Rn.Status$outboundSchema})(rMt||(Rn.Status$=rMt={}));Rn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Co.object({page:Co.number().int().default(0),page_size:Co.number().int().default(100),model:Co.nullable(Co.string()).optional(),created_after:Co.nullable(Co.string().datetime({offset:!0}).transform(e=>new Date(e))).optional(),created_by_me:Co.boolean().default(!1),status:Co.nullable(Rn.Status$inboundSchema).optional(),wandb_project:Co.nullable(Co.string()).optional(),wandb_name:Co.nullable(Co.string()).optional(),suffix:Co.nullable(Co.string()).optional()}).transform(e=>(0,oMt.remap)(e,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));Rn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Co.object({page:Co.number().int().default(0),pageSize:Co.number().int().default(100),model:Co.nullable(Co.string()).optional(),createdAfter:Co.nullable(Co.date().transform(e=>e.toISOString())).optional(),createdByMe:Co.boolean().default(!1),status:Co.nullable(Rn.Status$outboundSchema).optional(),wandbProject:Co.nullable(Co.string()).optional(),wandbName:Co.nullable(Co.string()).optional(),suffix:Co.nullable(Co.string()).optional()}).transform(e=>(0,oMt.remap)(e,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var nMt;(function(e){e.inboundSchema=Rn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,e.outboundSchema=Rn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(nMt||(Rn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=nMt={}));function JKr(e){return JSON.stringify(Rn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(e))}function GKr(e){return(0,WKr.safeParse)(e,t=>Rn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var uMt=b(Ou=>{"use strict";var KKr=Ou&&Ou.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),YKr=Ou&&Ou.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ZKr=Ou&&Ou.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&KKr(t,e,r);return YKr(t,e),t};Object.defineProperty(Ou,"__esModule",{value:!0});Ou.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Ou.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=Ou.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;Ou.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=QKr;Ou.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=e7r;var fre=ZKr(me()),sMt=Oe(),XKr=ce();Ou.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=fre.object({job_id:fre.string()}).transform(e=>(0,sMt.remap)(e,{job_id:"jobId"}));Ou.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=fre.object({jobId:fre.string()}).transform(e=>(0,sMt.remap)(e,{jobId:"job_id"}));var aMt;(function(e){e.inboundSchema=Ou.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,e.outboundSchema=Ou.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(aMt||(Ou.JobsApiRoutesFineTuningStartFineTuningJobRequest$=aMt={}));function QKr(e){return JSON.stringify(Ou.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(e))}function e7r(e){return(0,XKr.safeParse)(e,t=>Ou.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}});var dMt=b(Eu=>{"use strict";var t7r=Eu&&Eu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),r7r=Eu&&Eu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n7r=Eu&&Eu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&t7r(t,e,r);return r7r(t,e),t};Object.defineProperty(Eu,"__esModule",{value:!0});Eu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=Eu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=Eu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;Eu.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=i7r;Eu.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=a7r;var pre=n7r(me()),cMt=Oe(),o7r=ce();Eu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=pre.object({model_id:pre.string()}).transform(e=>(0,cMt.remap)(e,{model_id:"modelId"}));Eu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=pre.object({modelId:pre.string()}).transform(e=>(0,cMt.remap)(e,{modelId:"model_id"}));var lMt;(function(e){e.inboundSchema=Eu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,e.outboundSchema=Eu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(lMt||(Eu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=lMt={}));function i7r(e){return JSON.stringify(Eu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(e))}function a7r(e){return(0,o7r.safeParse)(e,t=>Eu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var gMt=b(Pu=>{"use strict";var s7r=Pu&&Pu.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),u7r=Pu&&Pu.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),pMt=Pu&&Pu.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&s7r(t,e,r);return u7r(t,e),t};Object.defineProperty(Pu,"__esModule",{value:!0});Pu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=Pu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Pu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;Pu.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=c7r;Pu.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=d7r;var hre=pMt(me()),hMt=Oe(),l7r=ce(),mMt=pMt(fn());Pu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=hre.object({model_id:hre.string(),UpdateFTModelIn:mMt.UpdateFTModelIn$inboundSchema}).transform(e=>(0,hMt.remap)(e,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));Pu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=hre.object({modelId:hre.string(),updateFTModelIn:mMt.UpdateFTModelIn$outboundSchema}).transform(e=>(0,hMt.remap)(e,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var fMt;(function(e){e.inboundSchema=Pu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,e.outboundSchema=Pu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(fMt||(Pu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=fMt={}));function c7r(e){return JSON.stringify(Pu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(e))}function d7r(e){return(0,l7r.safeParse)(e,t=>Pu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}});var SMt=b(ho=>{"use strict";var f7r=ho&&ho.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),p7r=ho&&ho.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_Mt=ho&&ho.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&f7r(t,e,r);return p7r(t,e),t};Object.defineProperty(ho,"__esModule",{value:!0});ho.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=ho.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=ho.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=ho.RetrieveModelV1ModelsModelIdGetRequest$=ho.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=ho.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;ho.retrieveModelV1ModelsModelIdGetRequestToJSON=h7r;ho.retrieveModelV1ModelsModelIdGetRequestFromJSON=m7r;ho.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=g7r;ho.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=y7r;var Uf=_Mt(me()),vMt=Oe(),wMt=ce(),mre=_Mt(fn());ho.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=Uf.object({model_id:Uf.string()}).transform(e=>(0,vMt.remap)(e,{model_id:"modelId"}));ho.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=Uf.object({modelId:Uf.string()}).transform(e=>(0,vMt.remap)(e,{modelId:"model_id"}));var yMt;(function(e){e.inboundSchema=ho.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,e.outboundSchema=ho.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(yMt||(ho.RetrieveModelV1ModelsModelIdGetRequest$=yMt={}));function h7r(e){return JSON.stringify(ho.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(e))}function m7r(e){return(0,wMt.safeParse)(e,t=>ho.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}ho.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=Uf.union([mre.BaseModelCard$inboundSchema.and(Uf.object({type:Uf.literal("base")}).transform(e=>({type:e.type}))),mre.FTModelCard$inboundSchema.and(Uf.object({type:Uf.literal("fine-tuned")}).transform(e=>({type:e.type})))]);ho.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=Uf.union([mre.BaseModelCard$outboundSchema.and(Uf.object({type:Uf.literal("base")}).transform(e=>({type:e.type}))),mre.FTModelCard$outboundSchema.and(Uf.object({type:Uf.literal("fine-tuned")}).transform(e=>({type:e.type})))]);var bMt;(function(e){e.inboundSchema=ho.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,e.outboundSchema=ho.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(bMt||(ho.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=bMt={}));function g7r(e){return JSON.stringify(ho.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(e))}function y7r(e){return(0,wMt.safeParse)(e,t=>ho.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(t)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var Tu=b(Mi=>{"use strict";var b7r=Mi&&Mi.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),el=Mi&&Mi.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&b7r(t,e,r)};Object.defineProperty(Mi,"__esModule",{value:!0});el(uTt(),Mi);el(dTt(),Mi);el(hTt(),Mi);el(yTt(),Mi);el(wTt(),Mi);el(CTt(),Mi);el(ATt(),Mi);el(jTt(),Mi);el(FTt(),Mi);el(UTt(),Mi);el(VTt(),Mi);el(GTt(),Mi);el(XTt(),Mi);el(tMt(),Mi);el(iMt(),Mi);el(uMt(),Mi);el(dMt(),Mi);el(gMt(),Mi);el(SMt(),Mi)});var CMt=b(cC=>{"use strict";var _7r=cC&&cC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),v7r=cC&&cC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),qEe=cC&&cC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_7r(t,e,r);return v7r(t,e),t};Object.defineProperty(cC,"__esModule",{value:!0});cC.batchJobsCancel=P7r;var w7r=vo(),gre=qEe(wo()),S7r=Oe(),x7r=ce(),xMt=So(),C7r=Hn(),O7r=qEe(fn()),E7r=qEe(Tu());async function P7r(e,t,r){let n=(0,x7r.safeParse)(t,v=>E7r.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,w7r.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,C7r.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,S7r.compactMap)({Accept:"application/json"})),l=await(0,xMt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,xMt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_cancel_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await gre.match(gre.json(200,O7r.BatchJobOut$inboundSchema),gre.fail("4XX"),gre.fail("5XX"))(_);return g.ok,g}});var TMt=b(dC=>{"use strict";var T7r=dC&&dC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),M7r=dC&&dC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),PMt=dC&&dC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&T7r(t,e,r);return M7r(t,e),t};Object.defineProperty(dC,"__esModule",{value:!0});dC.batchJobsCreate=j7r;var I7r=vo(),yre=PMt(wo()),A7r=Oe(),R7r=ce(),OMt=So(),D7r=Hn(),EMt=PMt(fn());async function j7r(e,t,r){let n=(0,R7r.safeParse)(t,g=>EMt.BatchJobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,I7r.encodeJSON)("body",o,{explode:!0}),a=(0,D7r.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,A7r.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,OMt.extractSecurity)(e._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,OMt.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_batch_create_batch_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=e._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await e._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,[_]=await yre.match(yre.json(200,EMt.BatchJobOut$inboundSchema),yre.fail("4XX"),yre.fail("5XX"))(m);return _.ok,_}});var IMt=b(fC=>{"use strict";var N7r=fC&&fC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),L7r=fC&&fC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),UEe=fC&&fC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&N7r(t,e,r);return L7r(t,e),t};Object.defineProperty(fC,"__esModule",{value:!0});fC.batchJobsGet=z7r;var F7r=vo(),bre=UEe(wo()),k7r=Oe(),B7r=ce(),MMt=So(),$7r=Hn(),q7r=UEe(fn()),U7r=UEe(Tu());async function z7r(e,t,r){let n=(0,B7r.safeParse)(t,v=>U7r.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,F7r.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,$7r.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,k7r.compactMap)({Accept:"application/json"})),l=await(0,MMt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,MMt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await bre.match(bre.json(200,q7r.BatchJobOut$inboundSchema),bre.fail("4XX"),bre.fail("5XX"))(_);return g.ok,g}});var RMt=b(pC=>{"use strict";var H7r=pC&&pC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),V7r=pC&&pC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),zEe=pC&&pC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&H7r(t,e,r);return V7r(t,e),t};Object.defineProperty(pC,"__esModule",{value:!0});pC.batchJobsList=X7r;var W7r=vo(),_re=zEe(wo()),J7r=Oe(),G7r=ce(),AMt=So(),K7r=Hn(),Y7r=zEe(fn()),Z7r=zEe(Tu());async function X7r(e,t,r){let n=(0,G7r.safeParse)(t,v=>Z7r.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,K7r.pathToFunc)("/v1/batch/jobs")(),s=(0,W7r.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,J7r.compactMap)({Accept:"application/json"})),l=await(0,AMt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,AMt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await _re.match(_re.json(200,Y7r.BatchJobsOut$inboundSchema),_re.fail("4XX"),_re.fail("5XX"))(_);return g.ok,g}});var DMt=b(wre=>{"use strict";Object.defineProperty(wre,"__esModule",{value:!0});wre.MistralJobs=void 0;var Q7r=CMt(),eYr=TMt(),tYr=IMt(),rYr=RMt(),nYr=Ap(),vre=Jh(),HEe=class extends nYr.ClientSDK{async list(t,r){return(0,vre.unwrapAsync)((0,rYr.batchJobsList)(this,t,r))}async create(t,r){return(0,vre.unwrapAsync)((0,eYr.batchJobsCreate)(this,t,r))}async get(t,r){return(0,vre.unwrapAsync)((0,tYr.batchJobsGet)(this,t,r))}async cancel(t,r){return(0,vre.unwrapAsync)((0,Q7r.batchJobsCancel)(this,t,r))}};wre.MistralJobs=HEe});var jMt=b(Sre=>{"use strict";Object.defineProperty(Sre,"__esModule",{value:!0});Sre.Batch=void 0;var oYr=Ap(),iYr=DMt(),VEe=class extends oYr.ClientSDK{get jobs(){return this._jobs??(this._jobs=new iYr.MistralJobs(this._options))}};Sre.Batch=VEe});var FMt=b(hC=>{"use strict";var aYr=hC&&hC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),sYr=hC&&hC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),WEe=hC&&hC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&aYr(t,e,r);return sYr(t,e),t};Object.defineProperty(hC,"__esModule",{value:!0});hC.chatComplete=pYr;var uYr=vo(),D3=WEe(wo()),lYr=Oe(),cYr=ce(),NMt=So(),dYr=Hn(),LMt=WEe(fn()),fYr=WEe(Dp());async function pYr(e,t,r){let n=(0,cYr.safeParse)(t,v=>LMt.ChatCompletionRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,uYr.encodeJSON)("body",o,{explode:!0}),a=(0,dYr.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,lYr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,NMt.extractSecurity)(e._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,NMt.resolveGlobalSecurity)(l),d={operationID:"chat_completion_v1_chat_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=e._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await e._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,_={HttpMeta:{Response:m,Request:p}},[g]=await D3.match(D3.json(200,LMt.ChatCompletionResponse$inboundSchema),D3.jsonErr(422,fYr.HTTPValidationError$inboundSchema),D3.fail("4XX"),D3.fail("5XX"))(m,{extraFields:_});return g.ok,g}});var $Mt=b(mC=>{"use strict";var hYr=mC&&mC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),mYr=mC&&mC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),xre=mC&&mC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&hYr(t,e,r);return mYr(t,e),t};Object.defineProperty(mC,"__esModule",{value:!0});mC.chatStream=xYr;var gYr=xre(me()),yYr=vo(),bYr=w3(),j3=xre(wo()),_Yr=Oe(),vYr=ce(),kMt=So(),wYr=Hn(),BMt=xre(fn()),SYr=xre(Dp());async function xYr(e,t,r){let n=(0,vYr.safeParse)(t,v=>BMt.ChatCompletionStreamRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,yYr.encodeJSON)("body",o,{explode:!0}),a=(0,wYr.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,_Yr.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,kMt.extractSecurity)(e._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,kMt.resolveGlobalSecurity)(l),d={operationID:"stream_chat",oAuth2Scopes:[],resolvedSecurity:c,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=e._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await e._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,_={HttpMeta:{Response:m,Request:p}},[g]=await j3.match(j3.sse(200,gYr.instanceof(ReadableStream).transform(v=>new bYr.EventStream({stream:v,decoder(S){return BMt.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),j3.jsonErr(422,SYr.HTTPValidationError$inboundSchema),j3.fail("4XX"),j3.fail("5XX"))(m,{extraFields:_});return g.ok,g}});var Cre=b(Gw=>{"use strict";Object.defineProperty(Gw,"__esModule",{value:!0});Gw.getDefaultOptions=Gw.defaultOptions=Gw.ignoreOverride=void 0;Gw.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");Gw.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 CYr=e=>typeof e=="string"?{...Gw.defaultOptions,name:e}:{...Gw.defaultOptions,...e};Gw.getDefaultOptions=CYr});var JEe=b(Ore=>{"use strict";Object.defineProperty(Ore,"__esModule",{value:!0});Ore.getRefs=void 0;var OYr=Cre(),EYr=e=>{let t=(0,OYr.getDefaultOptions)(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};Ore.getRefs=EYr});var sT=b(Qk=>{"use strict";Object.defineProperty(Qk,"__esModule",{value:!0});Qk.setResponseValueAndErrors=Qk.addErrorMessage=void 0;function qMt(e,t,r,n){n?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}Qk.addErrorMessage=qMt;function PYr(e,t,r,n,o){e[t]=r,qMt(e,t,n,o)}Qk.setResponseValueAndErrors=PYr});var GEe=b(Ere=>{"use strict";Object.defineProperty(Ere,"__esModule",{value:!0});Ere.parseAnyDef=void 0;function TYr(){return{}}Ere.parseAnyDef=TYr});var KEe=b(Tre=>{"use strict";Object.defineProperty(Tre,"__esModule",{value:!0});Tre.parseArrayDef=void 0;var MYr=me(),Pre=sT(),IYr=Mu();function AYr(e,t){let r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==MYr.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,IYr.parseDef)(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(0,Pre.setResponseValueAndErrors)(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&(0,Pre.setResponseValueAndErrors)(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&((0,Pre.setResponseValueAndErrors)(r,"minItems",e.exactLength.value,e.exactLength.message,t),(0,Pre.setResponseValueAndErrors)(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}Tre.parseArrayDef=AYr});var YEe=b(Mre=>{"use strict";Object.defineProperty(Mre,"__esModule",{value:!0});Mre.parseBigintDef=void 0;var w1=sT();function RYr(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":t.target==="jsonSchema7"?n.inclusive?(0,w1.setResponseValueAndErrors)(r,"minimum",n.value,n.message,t):(0,w1.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),(0,w1.setResponseValueAndErrors)(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?(0,w1.setResponseValueAndErrors)(r,"maximum",n.value,n.message,t):(0,w1.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),(0,w1.setResponseValueAndErrors)(r,"maximum",n.value,n.message,t));break;case"multipleOf":(0,w1.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,t);break}return r}Mre.parseBigintDef=RYr});var ZEe=b(Ire=>{"use strict";Object.defineProperty(Ire,"__esModule",{value:!0});Ire.parseBooleanDef=void 0;function DYr(){return{type:"boolean"}}Ire.parseBooleanDef=DYr});var Rre=b(Are=>{"use strict";Object.defineProperty(Are,"__esModule",{value:!0});Are.parseBrandedDef=void 0;var jYr=Mu();function NYr(e,t){return(0,jYr.parseDef)(e.type._def,t)}Are.parseBrandedDef=NYr});var XEe=b(Dre=>{"use strict";Object.defineProperty(Dre,"__esModule",{value:!0});Dre.parseCatchDef=void 0;var LYr=Mu(),FYr=(e,t)=>(0,LYr.parseDef)(e.innerType._def,t);Dre.parseCatchDef=FYr});var QEe=b(jre=>{"use strict";Object.defineProperty(jre,"__esModule",{value:!0});jre.parseDateDef=void 0;var UMt=sT();function zMt(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>zMt(e,t,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 kYr(e,t)}}jre.parseDateDef=zMt;var kYr=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":(0,UMt.setResponseValueAndErrors)(r,"minimum",n.value,n.message,t);break;case"max":(0,UMt.setResponseValueAndErrors)(r,"maximum",n.value,n.message,t);break}return r}});var ePe=b(Nre=>{"use strict";Object.defineProperty(Nre,"__esModule",{value:!0});Nre.parseDefaultDef=void 0;var BYr=Mu();function $Yr(e,t){return{...(0,BYr.parseDef)(e.innerType._def,t),default:e.defaultValue()}}Nre.parseDefaultDef=$Yr});var tPe=b(Lre=>{"use strict";Object.defineProperty(Lre,"__esModule",{value:!0});Lre.parseEffectsDef=void 0;var qYr=Mu();function UYr(e,t){return t.effectStrategy==="input"?(0,qYr.parseDef)(e.schema._def,t):{}}Lre.parseEffectsDef=UYr});var rPe=b(Fre=>{"use strict";Object.defineProperty(Fre,"__esModule",{value:!0});Fre.parseEnumDef=void 0;function zYr(e){return{type:"string",enum:Array.from(e.values)}}Fre.parseEnumDef=zYr});var nPe=b(kre=>{"use strict";Object.defineProperty(kre,"__esModule",{value:!0});kre.parseIntersectionDef=void 0;var HMt=Mu(),HYr=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function VYr(e,t){let r=[(0,HMt.parseDef)(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),(0,HMt.parseDef)(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(HYr(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}kre.parseIntersectionDef=VYr});var oPe=b(Bre=>{"use strict";Object.defineProperty(Bre,"__esModule",{value:!0});Bre.parseLiteralDef=void 0;function WYr(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}Bre.parseLiteralDef=WYr});var $re=b(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.parseStringDef=fc.zodPatterns=void 0;var S1=sT(),iPe;fc.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:()=>(iPe===void 0&&(iPe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),iPe),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 JYr(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":(0,S1.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":(0,S1.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Dg(r,"email",n.message,t);break;case"format:idn-email":Dg(r,"idn-email",n.message,t);break;case"pattern:zod":Ud(r,fc.zodPatterns.email,n.message,t);break}break;case"url":Dg(r,"uri",n.message,t);break;case"uuid":Dg(r,"uuid",n.message,t);break;case"regex":Ud(r,n.regex,n.message,t);break;case"cuid":Ud(r,fc.zodPatterns.cuid,n.message,t);break;case"cuid2":Ud(r,fc.zodPatterns.cuid2,n.message,t);break;case"startsWith":Ud(r,RegExp(`^${aPe(n.value,t)}`),n.message,t);break;case"endsWith":Ud(r,RegExp(`${aPe(n.value,t)}$`),n.message,t);break;case"datetime":Dg(r,"date-time",n.message,t);break;case"date":Dg(r,"date",n.message,t);break;case"time":Dg(r,"time",n.message,t);break;case"duration":Dg(r,"duration",n.message,t);break;case"length":(0,S1.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t),(0,S1.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":{Ud(r,RegExp(aPe(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&Dg(r,"ipv4",n.message,t),n.version!=="v4"&&Dg(r,"ipv6",n.message,t);break}case"base64url":Ud(r,fc.zodPatterns.base64url,n.message,t);break;case"jwt":Ud(r,fc.zodPatterns.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&Ud(r,fc.zodPatterns.ipv4Cidr,n.message,t),n.version!=="v4"&&Ud(r,fc.zodPatterns.ipv6Cidr,n.message,t);break}case"emoji":Ud(r,fc.zodPatterns.emoji(),n.message,t);break;case"ulid":{Ud(r,fc.zodPatterns.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Dg(r,"binary",n.message,t);break}case"contentEncoding:base64":{(0,S1.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{Ud(r,fc.zodPatterns.base64,n.message,t);break}}break}case"nanoid":Ud(r,fc.zodPatterns.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}fc.parseStringDef=JYr;function aPe(e,t){return t.patternStrategy==="escape"?KYr(e):e}var GYr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function KYr(e){let t="";for(let r=0;r<e.length;r++)GYr.has(e[r])||(t+="\\"),t+=e[r];return t}function Dg(e,t,r,n){e.format||e.anyOf?.some(o=>o.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):(0,S1.setResponseValueAndErrors)(e,"format",t,r,n)}function Ud(e,t,r,n){e.pattern||e.allOf?.some(o=>o.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:VMt(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,S1.setResponseValueAndErrors)(e,"pattern",VMt(t,n),r,n)}function VMt(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,o="",i=!1,a=!1,s=!1;for(let u=0;u<n.length;u++){if(i){o+=n[u],i=!1;continue}if(r.i){if(a){if(n[u].match(/[a-z]/)){s?(o+=n[u],o+=`${n[u-2]}-${n[u]}`.toUpperCase(),s=!1):n[u+1]==="-"&&n[u+2]?.match(/[a-z]/)?(o+=n[u],s=!0):o+=`${n[u]}${n[u].toUpperCase()}`;continue}}else if(n[u].match(/[a-z]/)){o+=`[${n[u]}${n[u].toUpperCase()}]`;continue}}if(r.m){if(n[u]==="^"){o+=`(^|(?<=[\r
]))`;continue}else if(n[u]==="$"){o+=`($|(?=[\r
]))`;continue}}if(r.s&&n[u]==="."){o+=a?`${n[u]}\r
`:`[${n[u]}\r
]`;continue}o+=n[u],n[u]==="\\"?i=!0:a&&n[u]==="]"?a=!1:!a&&n[u]==="["&&(a=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}});var Ure=b(qre=>{"use strict";Object.defineProperty(qre,"__esModule",{value:!0});qre.parseRecordDef=void 0;var N3=me(),WMt=Mu(),YYr=$re(),ZYr=Rre();function XYr(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===N3.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,WMt.parseDef)(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,WMt.parseDef)(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??{}};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===N3.ZodFirstPartyTypeKind.ZodString&&e.keyType._def.checks?.length){let{type:n,...o}=(0,YYr.parseStringDef)(e.keyType._def,t);return{...r,propertyNames:o}}else{if(e.keyType?._def.typeName===N3.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===N3.ZodFirstPartyTypeKind.ZodBranded&&e.keyType._def.type._def.typeName===N3.ZodFirstPartyTypeKind.ZodString&&e.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,ZYr.parseBrandedDef)(e.keyType._def,t);return{...r,propertyNames:o}}}return r}qre.parseRecordDef=XYr});var sPe=b(zre=>{"use strict";Object.defineProperty(zre,"__esModule",{value:!0});zre.parseMapDef=void 0;var JMt=Mu(),QYr=Ure();function eZr(e,t){if(t.mapStrategy==="record")return(0,QYr.parseRecordDef)(e,t);let r=(0,JMt.parseDef)(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},n=(0,JMt.parseDef)(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}zre.parseMapDef=eZr});var uPe=b(Hre=>{"use strict";Object.defineProperty(Hre,"__esModule",{value:!0});Hre.parseNativeEnumDef=void 0;function tZr(e){let t=e.values,n=Object.keys(e.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[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}}Hre.parseNativeEnumDef=tZr});var lPe=b(Vre=>{"use strict";Object.defineProperty(Vre,"__esModule",{value:!0});Vre.parseNeverDef=void 0;function rZr(){return{not:{}}}Vre.parseNeverDef=rZr});var cPe=b(Wre=>{"use strict";Object.defineProperty(Wre,"__esModule",{value:!0});Wre.parseNullDef=void 0;function nZr(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}Wre.parseNullDef=nZr});var Jre=b(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});uT.parseUnionDef=uT.primitiveMappings=void 0;var oZr=Mu();uT.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function iZr(e,t){if(t.target==="openApi3")return GMt(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in uT.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=uT.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 GMt(e,t)}uT.parseUnionDef=iZr;var GMt=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>(0,oZr.parseDef)(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});var dPe=b(Gre=>{"use strict";Object.defineProperty(Gre,"__esModule",{value:!0});Gre.parseNullableDef=void 0;var KMt=Mu(),YMt=Jre();function aZr(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:YMt.primitiveMappings[e.innerType._def.typeName],nullable:!0}:{type:[YMt.primitiveMappings[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let n=(0,KMt.parseDef)(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,KMt.parseDef)(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}Gre.parseNullableDef=aZr});var fPe=b(Kre=>{"use strict";Object.defineProperty(Kre,"__esModule",{value:!0});Kre.parseNumberDef=void 0;var lT=sT();function sZr(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",(0,lT.addErrorMessage)(r,"type",n.message,t);break;case"min":t.target==="jsonSchema7"?n.inclusive?(0,lT.setResponseValueAndErrors)(r,"minimum",n.value,n.message,t):(0,lT.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),(0,lT.setResponseValueAndErrors)(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?(0,lT.setResponseValueAndErrors)(r,"maximum",n.value,n.message,t):(0,lT.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),(0,lT.setResponseValueAndErrors)(r,"maximum",n.value,n.message,t));break;case"multipleOf":(0,lT.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,t);break}return r}Kre.parseNumberDef=sZr});var hPe=b(Yre=>{"use strict";Object.defineProperty(Yre,"__esModule",{value:!0});Yre.parseObjectDef=void 0;var uZr=me(),pPe=Mu();function lZr(e,t){return t.removeAdditionalStrategy==="strict"?e.catchall._def.typeName==="ZodNever"?e.unknownKeys!=="strict":(0,pPe.parseDef)(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??!0:e.catchall._def.typeName==="ZodNever"?e.unknownKeys==="passthrough":(0,pPe.parseDef)(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??!0}function cZr(e,t){let r=t.target==="openAi",n={type:"object",...Object.entries(e.shape()).reduce((o,[i,a])=>{if(a===void 0||a._def===void 0)return o;let s=a.isOptional();s&&r&&(a instanceof uZr.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,pPe.parseDef)(a._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});return u===void 0?o:{properties:{...o.properties,[i]:u},required:s?o.required:[...o.required,i]}},{properties:{},required:[]}),additionalProperties:lZr(e,t)};return n.required.length||delete n.required,n}Yre.parseObjectDef=cZr});var mPe=b(Zre=>{"use strict";Object.defineProperty(Zre,"__esModule",{value:!0});Zre.parseOptionalDef=void 0;var ZMt=Mu(),dZr=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return(0,ZMt.parseDef)(e.innerType._def,t);let r=(0,ZMt.parseDef)(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};Zre.parseOptionalDef=dZr});var gPe=b(Qre=>{"use strict";Object.defineProperty(Qre,"__esModule",{value:!0});Qre.parsePipelineDef=void 0;var Xre=Mu(),fZr=(e,t)=>{if(t.pipeStrategy==="input")return(0,Xre.parseDef)(e.in._def,t);if(t.pipeStrategy==="output")return(0,Xre.parseDef)(e.out._def,t);let r=(0,Xre.parseDef)(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=(0,Xre.parseDef)(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};Qre.parsePipelineDef=fZr});var yPe=b(ene=>{"use strict";Object.defineProperty(ene,"__esModule",{value:!0});ene.parsePromiseDef=void 0;var pZr=Mu();function hZr(e,t){return(0,pZr.parseDef)(e.type._def,t)}ene.parsePromiseDef=hZr});var bPe=b(tne=>{"use strict";Object.defineProperty(tne,"__esModule",{value:!0});tne.parseSetDef=void 0;var XMt=sT(),mZr=Mu();function gZr(e,t){let n={type:"array",uniqueItems:!0,items:(0,mZr.parseDef)(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(0,XMt.setResponseValueAndErrors)(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&(0,XMt.setResponseValueAndErrors)(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}tne.parseSetDef=gZr});var vPe=b(rne=>{"use strict";Object.defineProperty(rne,"__esModule",{value:!0});rne.parseTupleDef=void 0;var _Pe=Mu();function yZr(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>(0,_Pe.parseDef)(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,_Pe.parseDef)(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>(0,_Pe.parseDef)(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}rne.parseTupleDef=yZr});var wPe=b(nne=>{"use strict";Object.defineProperty(nne,"__esModule",{value:!0});nne.parseUndefinedDef=void 0;function bZr(){return{not:{}}}nne.parseUndefinedDef=bZr});var SPe=b(one=>{"use strict";Object.defineProperty(one,"__esModule",{value:!0});one.parseUnknownDef=void 0;function _Zr(){return{}}one.parseUnknownDef=_Zr});var xPe=b(ine=>{"use strict";Object.defineProperty(ine,"__esModule",{value:!0});ine.parseReadonlyDef=void 0;var vZr=Mu(),wZr=(e,t)=>(0,vZr.parseDef)(e.innerType._def,t);ine.parseReadonlyDef=wZr});var Mu=b(ane=>{"use strict";Object.defineProperty(ane,"__esModule",{value:!0});ane.parseDef=void 0;var pn=me(),SZr=GEe(),xZr=KEe(),CZr=YEe(),OZr=ZEe(),EZr=Rre(),PZr=XEe(),TZr=QEe(),MZr=ePe(),IZr=tPe(),AZr=rPe(),RZr=nPe(),DZr=oPe(),jZr=sPe(),NZr=uPe(),LZr=lPe(),FZr=cPe(),kZr=dPe(),BZr=fPe(),$Zr=hPe(),qZr=mPe(),UZr=gPe(),zZr=yPe(),HZr=Ure(),VZr=bPe(),WZr=$re(),JZr=vPe(),GZr=wPe(),KZr=Jre(),YZr=SPe(),ZZr=xPe(),XZr=Cre();function QMt(e,t,r=!1){let n=t.seen.get(e);if(t.override){let a=t.override?.(e,t,n,r);if(a!==XZr.ignoreOverride)return a}if(n&&!r){let a=QZr(n,t);if(a!==void 0)return a}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let i=tXr(e,e.typeName,t);return i&&rXr(e,t,i),o.jsonSchema=i,i}ane.parseDef=QMt;var QZr=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:eXr(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{}):t.$refStrategy==="seen"?{}:void 0}},eXr=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")},tXr=(e,t,r)=>{switch(t){case pn.ZodFirstPartyTypeKind.ZodString:return(0,WZr.parseStringDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodNumber:return(0,BZr.parseNumberDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodObject:return(0,$Zr.parseObjectDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodBigInt:return(0,CZr.parseBigintDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodBoolean:return(0,OZr.parseBooleanDef)();case pn.ZodFirstPartyTypeKind.ZodDate:return(0,TZr.parseDateDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodUndefined:return(0,GZr.parseUndefinedDef)();case pn.ZodFirstPartyTypeKind.ZodNull:return(0,FZr.parseNullDef)(r);case pn.ZodFirstPartyTypeKind.ZodArray:return(0,xZr.parseArrayDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodUnion:case pn.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,KZr.parseUnionDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodIntersection:return(0,RZr.parseIntersectionDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodTuple:return(0,JZr.parseTupleDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodRecord:return(0,HZr.parseRecordDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodLiteral:return(0,DZr.parseLiteralDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodEnum:return(0,AZr.parseEnumDef)(e);case pn.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,NZr.parseNativeEnumDef)(e);case pn.ZodFirstPartyTypeKind.ZodNullable:return(0,kZr.parseNullableDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodOptional:return(0,qZr.parseOptionalDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodMap:return(0,jZr.parseMapDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodSet:return(0,VZr.parseSetDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodLazy:return QMt(e.getter()._def,r);case pn.ZodFirstPartyTypeKind.ZodPromise:return(0,zZr.parsePromiseDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodNaN:case pn.ZodFirstPartyTypeKind.ZodNever:return(0,LZr.parseNeverDef)();case pn.ZodFirstPartyTypeKind.ZodEffects:return(0,IZr.parseEffectsDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodAny:return(0,SZr.parseAnyDef)();case pn.ZodFirstPartyTypeKind.ZodUnknown:return(0,YZr.parseUnknownDef)();case pn.ZodFirstPartyTypeKind.ZodDefault:return(0,MZr.parseDefaultDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodBranded:return(0,EZr.parseBrandedDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodReadonly:return(0,ZZr.parseReadonlyDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodCatch:return(0,PZr.parseCatchDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodPipeline:return(0,UZr.parsePipelineDef)(e,r);case pn.ZodFirstPartyTypeKind.ZodFunction:case pn.ZodFirstPartyTypeKind.ZodVoid:case pn.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(t)}},rXr=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r)});var CPe=b(sne=>{"use strict";Object.defineProperty(sne,"__esModule",{value:!0});sne.zodToJsonSchema=void 0;var eIt=Mu(),nXr=JEe(),oXr=(e,t)=>{let r=(0,nXr.getRefs)(t),n=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[l,c])=>({...u,[l]:(0,eIt.parseDef)(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??{}}),{}):void 0,o=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(0,eIt.parseDef)(e._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??{},a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.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};sne.zodToJsonSchema=oXr});var tIt=b(Cr=>{"use strict";var iXr=Cr&&Cr.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),wn=Cr&&Cr.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&iXr(t,e,r)};Object.defineProperty(Cr,"__esModule",{value:!0});wn(Cre(),Cr);wn(JEe(),Cr);wn(sT(),Cr);wn(Mu(),Cr);wn(GEe(),Cr);wn(KEe(),Cr);wn(YEe(),Cr);wn(ZEe(),Cr);wn(Rre(),Cr);wn(XEe(),Cr);wn(QEe(),Cr);wn(ePe(),Cr);wn(tPe(),Cr);wn(rPe(),Cr);wn(nPe(),Cr);wn(oPe(),Cr);wn(sPe(),Cr);wn(uPe(),Cr);wn(lPe(),Cr);wn(cPe(),Cr);wn(dPe(),Cr);wn(fPe(),Cr);wn(hPe(),Cr);wn(mPe(),Cr);wn(gPe(),Cr);wn(yPe(),Cr);wn(xPe(),Cr);wn(Ure(),Cr);wn(bPe(),Cr);wn($re(),Cr);wn(vPe(),Cr);wn(wPe(),Cr);wn(Jre(),Cr);wn(SPe(),Cr);wn(CPe(),Cr);var aXr=CPe();Cr.default=aXr.zodToJsonSchema});var nIt=b(L3=>{"use strict";Object.defineProperty(L3,"__esModule",{value:!0});L3.transformToChatCompletionRequest=uXr;L3.convertToParsedChatCompletionResponse=lXr;L3.responseFormatFromZodObject=rIt;var sXr=tIt();function uXr(e){let{responseFormat:t,...r}=e,n=rIt(t);return{...r,responseFormat:n}}function lXr(e,t){if(e.choices===void 0||e.choices.length===0)return{...e,choices:e.choices===void 0?void 0:[]};let r=[];for(let n of e.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:t.safeParse(JSON.parse(n.message.content)).data}});return{...e,choices:r}}function rIt(e){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,sXr.zodToJsonSchema)(e),strict:!0}}}});var aIt=b(lne=>{"use strict";Object.defineProperty(lne,"__esModule",{value:!0});lne.Chat=void 0;var oIt=FMt(),iIt=$Mt(),cXr=Ap(),une=Jh(),OPe=nIt(),EPe=class extends cXr.ClientSDK{async parse(t,r){let n=(0,OPe.transformToChatCompletionRequest)(t),o=await(0,une.unwrapAsync)((0,oIt.chatComplete)(this,n,r));return(0,OPe.convertToParsedChatCompletionResponse)(o,t.responseFormat)}async parseStream(t,r){let n=(0,OPe.transformToChatCompletionRequest)(t);return(0,une.unwrapAsync)((0,iIt.chatStream)(this,n,r))}async complete(t,r){return(0,une.unwrapAsync)((0,oIt.chatComplete)(this,t,r))}async stream(t,r){return(0,une.unwrapAsync)((0,iIt.chatStream)(this,t,r))}};lne.Chat=EPe});var lIt=b(gC=>{"use strict";var dXr=gC&&gC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),fXr=gC&&gC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),PPe=gC&&gC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&dXr(t,e,r);return fXr(t,e),t};Object.defineProperty(gC,"__esModule",{value:!0});gC.classifiersModerate=bXr;var pXr=vo(),F3=PPe(wo()),hXr=Oe(),mXr=ce(),sIt=So(),gXr=Hn(),uIt=PPe(fn()),yXr=PPe(Dp());async function bXr(e,t,r){let n=(0,mXr.safeParse)(t,v=>uIt.ClassificationRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,pXr.encodeJSON)("body",o,{explode:!0}),a=(0,gXr.pathToFunc)("/v1/moderations")(),s=new Headers((0,hXr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,sIt.extractSecurity)(e._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,sIt.resolveGlobalSecurity)(l),d={operationID:"moderations_v1_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=e._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await e._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,_={HttpMeta:{Response:m,Request:p}},[g]=await F3.match(F3.json(200,uIt.ClassificationResponse$inboundSchema),F3.jsonErr(422,yXr.HTTPValidationError$inboundSchema),F3.fail("4XX"),F3.fail("5XX"))(m,{extraFields:_});return g.ok,g}});var fIt=b(yC=>{"use strict";var _Xr=yC&&yC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),vXr=yC&&yC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),TPe=yC&&yC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_Xr(t,e,r);return vXr(t,e),t};Object.defineProperty(yC,"__esModule",{value:!0});yC.classifiersModerateChat=EXr;var wXr=vo(),k3=TPe(wo()),SXr=Oe(),xXr=ce(),cIt=So(),CXr=Hn(),dIt=TPe(fn()),OXr=TPe(Dp());async function EXr(e,t,r){let n=(0,xXr.safeParse)(t,v=>dIt.ChatClassificationRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,wXr.encodeJSON)("body",o,{explode:!0}),a=(0,CXr.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,SXr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,cIt.extractSecurity)(e._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,cIt.resolveGlobalSecurity)(l),d={operationID:"moderations_chat_v1_chat_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=e._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await e._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,_={HttpMeta:{Response:m,Request:p}},[g]=await k3.match(k3.json(200,dIt.ClassificationResponse$inboundSchema),k3.jsonErr(422,OXr.HTTPValidationError$inboundSchema),k3.fail("4XX"),k3.fail("5XX"))(m,{extraFields:_});return g.ok,g}});var hIt=b(cne=>{"use strict";Object.defineProperty(cne,"__esModule",{value:!0});cne.Classifiers=void 0;var PXr=lIt(),TXr=fIt(),MXr=Ap(),pIt=Jh(),MPe=class extends MXr.ClientSDK{async moderate(t,r){return(0,pIt.unwrapAsync)((0,PXr.classifiersModerate)(this,t,r))}async moderateChat(t,r){return(0,pIt.unwrapAsync)((0,TXr.classifiersModerateChat)(this,t,r))}};cne.Classifiers=MPe});var yIt=b(bC=>{"use strict";var IXr=bC&&bC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),AXr=bC&&bC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),IPe=bC&&bC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&IXr(t,e,r);return AXr(t,e),t};Object.defineProperty(bC,"__esModule",{value:!0});bC.embeddingsCreate=FXr;var RXr=vo(),B3=IPe(wo()),DXr=Oe(),jXr=ce(),mIt=So(),NXr=Hn(),gIt=IPe(fn()),LXr=IPe(Dp());async function FXr(e,t,r){let n=(0,jXr.safeParse)(t,v=>gIt.EmbeddingRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,RXr.encodeJSON)("body",o,{explode:!0}),a=(0,NXr.pathToFunc)("/v1/embeddings")(),s=new Headers((0,DXr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,mIt.extractSecurity)(e._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,mIt.resolveGlobalSecurity)(l),d={operationID:"embeddings_v1_embeddings_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=e._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await e._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,_={HttpMeta:{Response:m,Request:p}},[g]=await B3.match(B3.json(200,gIt.EmbeddingResponse$inboundSchema),B3.jsonErr(422,LXr.HTTPValidationError$inboundSchema),B3.fail("4XX"),B3.fail("5XX"))(m,{extraFields:_});return g.ok,g}});var bIt=b(dne=>{"use strict";Object.defineProperty(dne,"__esModule",{value:!0});dne.Embeddings=void 0;var kXr=yIt(),BXr=Ap(),$Xr=Jh(),APe=class extends BXr.ClientSDK{async create(t,r){return(0,$Xr.unwrapAsync)((0,kXr.embeddingsCreate)(this,t,r))}};dne.Embeddings=APe});var vIt=b(_C=>{"use strict";var qXr=_C&&_C.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),UXr=_C&&_C.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),RPe=_C&&_C.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&qXr(t,e,r);return UXr(t,e),t};Object.defineProperty(_C,"__esModule",{value:!0});_C.filesDelete=KXr;var zXr=vo(),fne=RPe(wo()),HXr=Oe(),VXr=ce(),_It=So(),WXr=Hn(),JXr=RPe(fn()),GXr=RPe(Tu());async function KXr(e,t,r){let n=(0,VXr.safeParse)(t,v=>GXr.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,zXr.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,WXr.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,HXr.compactMap)({Accept:"application/json"})),l=await(0,_It.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,_It.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_delete_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await fne.match(fne.json(200,JXr.DeleteFileOut$inboundSchema),fne.fail("4XX"),fne.fail("5XX"))(_);return g.ok,g}});var SIt=b(vC=>{"use strict";var YXr=vC&&vC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ZXr=vC&&vC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),DPe=vC&&vC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&YXr(t,e,r);return ZXr(t,e),t};Object.defineProperty(vC,"__esModule",{value:!0});vC.filesDownload=oQr;var XXr=DPe(me()),QXr=vo(),pne=DPe(wo()),eQr=Oe(),tQr=ce(),wIt=So(),rQr=Hn(),nQr=DPe(Tu());async function oQr(e,t,r){let n=(0,tQr.safeParse)(t,v=>nQr.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,QXr.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,rQr.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,eQr.compactMap)({Accept:"application/octet-stream"})),l=await(0,wIt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,wIt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_download_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await pne.match(pne.stream(200,XXr.instanceof(ReadableStream)),pne.fail("4XX"),pne.fail("5XX"))(_);return g.ok,g}});var OIt=b(wC=>{"use strict";var iQr=wC&&wC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),aQr=wC&&wC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),jPe=wC&&wC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&iQr(t,e,r);return aQr(t,e),t};Object.defineProperty(wC,"__esModule",{value:!0});wC.filesGetSignedUrl=fQr;var xIt=vo(),hne=jPe(wo()),sQr=Oe(),uQr=ce(),CIt=So(),lQr=Hn(),cQr=jPe(fn()),dQr=jPe(Tu());async function fQr(e,t,r){let n=(0,uQr.safeParse)(t,S=>dQr.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,xIt.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,lQr.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,xIt.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,sQr.compactMap)({Accept:"application/json"})),c=await(0,CIt.extractSecurity)(e._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,CIt.resolveGlobalSecurity)(d),p={operationID:"files_api_routes_get_signed_url",oAuth2Scopes:[],resolvedSecurity:f,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},h=e._createRequest(p,{security:f,method:"GET",baseURL:r?.serverURL,path:s,headers:l,query:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!h.ok)return h;let m=h.value,_=await e._do(m,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!_.ok)return _;let g=_.value,[v]=await hne.match(hne.json(200,cQr.FileSignedURL$inboundSchema),hne.fail("4XX"),hne.fail("5XX"))(g);return v.ok,v}});var PIt=b(SC=>{"use strict";var pQr=SC&&SC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hQr=SC&&SC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),NPe=SC&&SC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&pQr(t,e,r);return hQr(t,e),t};Object.defineProperty(SC,"__esModule",{value:!0});SC.filesList=wQr;var mQr=vo(),mne=NPe(wo()),gQr=Oe(),yQr=ce(),EIt=So(),bQr=Hn(),_Qr=NPe(fn()),vQr=NPe(Tu());async function wQr(e,t,r){let n=(0,yQr.safeParse)(t,v=>vQr.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,bQr.pathToFunc)("/v1/files")(),s=(0,mQr.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,gQr.compactMap)({Accept:"application/json"})),l=await(0,EIt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,EIt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_list_files",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await mne.match(mne.json(200,_Qr.ListFilesOut$inboundSchema),mne.fail("4XX"),mne.fail("5XX"))(_);return g.ok,g}});var MIt=b(xC=>{"use strict";var SQr=xC&&xC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),xQr=xC&&xC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),LPe=xC&&xC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&SQr(t,e,r);return xQr(t,e),t};Object.defineProperty(xC,"__esModule",{value:!0});xC.filesRetrieve=IQr;var CQr=vo(),gne=LPe(wo()),OQr=Oe(),EQr=ce(),TIt=So(),PQr=Hn(),TQr=LPe(fn()),MQr=LPe(Tu());async function IQr(e,t,r){let n=(0,EQr.safeParse)(t,v=>MQr.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,CQr.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,PQr.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,OQr.compactMap)({Accept:"application/json"})),l=await(0,TIt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,TIt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_retrieve_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await gne.match(gne.json(200,TQr.RetrieveFileOut$inboundSchema),gne.fail("4XX"),gne.fail("5XX"))(_);return g.ok,g}});var IIt=b(FPe=>{"use strict";Object.defineProperty(FPe,"__esModule",{value:!0});FPe.isReadableStream=AQr;function AQr(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.getReader=="function"&&typeof t.cancel=="function"&&typeof t.tee=="function"}});var RIt=b(CC=>{"use strict";var RQr=CC&&CC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),DQr=CC&&CC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),kPe=CC&&CC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&RQr(t,e,r);return DQr(t,e),t};Object.defineProperty(CC,"__esModule",{value:!0});CC.filesUpload=UQr;var yne=vo(),jQr=vOe(),bne=kPe(wo()),NQr=Oe(),LQr=ce(),AIt=So(),FQr=Hn(),kQr=kPe(fn()),BQr=kPe(Tu()),$Qr=$Ee(),qQr=IIt();async function UQr(e,t,r){let n=(0,LQr.safeParse)(t,g=>BQr.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=new FormData;if((0,$Qr.isBlobLike)(o.file))(0,yne.appendForm)(i,"file",o.file);else if((0,qQr.isReadableStream)(o.file.content)){let g=await(0,jQr.readableStreamToArrayBuffer)(o.file.content),v=new Blob([g],{type:"application/octet-stream"});(0,yne.appendForm)(i,"file",v)}else(0,yne.appendForm)(i,"file",new Blob([o.file.content],{type:"application/octet-stream"}),o.file.fileName);o.purpose!==void 0&&(0,yne.appendForm)(i,"purpose",o.purpose);let a=(0,FQr.pathToFunc)("/v1/files")(),s=new Headers((0,NQr.compactMap)({Accept:"application/json"})),u=await(0,AIt.extractSecurity)(e._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,AIt.resolveGlobalSecurity)(l),d={operationID:"files_api_routes_upload_file",oAuth2Scopes:[],resolvedSecurity:c,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=e._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await e._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,[_]=await bne.match(bne.json(200,kQr.UploadFileOut$inboundSchema),bne.fail("4XX"),bne.fail("5XX"))(m);return _.ok,_}});var DIt=b(_ne=>{"use strict";Object.defineProperty(_ne,"__esModule",{value:!0});_ne.Files=void 0;var zQr=vIt(),HQr=SIt(),VQr=OIt(),WQr=PIt(),JQr=MIt(),GQr=RIt(),KQr=Ap(),eB=Jh(),BPe=class extends KQr.ClientSDK{async upload(t,r){return(0,eB.unwrapAsync)((0,GQr.filesUpload)(this,t,r))}async list(t,r){return(0,eB.unwrapAsync)((0,WQr.filesList)(this,t,r))}async retrieve(t,r){return(0,eB.unwrapAsync)((0,JQr.filesRetrieve)(this,t,r))}async delete(t,r){return(0,eB.unwrapAsync)((0,zQr.filesDelete)(this,t,r))}async download(t,r){return(0,eB.unwrapAsync)((0,HQr.filesDownload)(this,t,r))}async getSignedUrl(t,r){return(0,eB.unwrapAsync)((0,VQr.filesGetSignedUrl)(this,t,r))}};_ne.Files=BPe});var LIt=b(OC=>{"use strict";var YQr=OC&&OC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ZQr=OC&&OC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$Pe=OC&&OC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&YQr(t,e,r);return ZQr(t,e),t};Object.defineProperty(OC,"__esModule",{value:!0});OC.fimComplete=nen;var XQr=vo(),$3=$Pe(wo()),QQr=Oe(),een=ce(),jIt=So(),ten=Hn(),NIt=$Pe(fn()),ren=$Pe(Dp());async function nen(e,t,r){let n=(0,een.safeParse)(t,v=>NIt.FIMCompletionRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,XQr.encodeJSON)("body",o,{explode:!0}),a=(0,ten.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,QQr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,jIt.extractSecurity)(e._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,jIt.resolveGlobalSecurity)(l),d={operationID:"fim_completion_v1_fim_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=e._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await e._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,_={HttpMeta:{Response:m,Request:p}},[g]=await $3.match($3.json(200,NIt.FIMCompletionResponse$inboundSchema),$3.jsonErr(422,ren.HTTPValidationError$inboundSchema),$3.fail("4XX"),$3.fail("5XX"))(m,{extraFields:_});return g.ok,g}});var BIt=b(EC=>{"use strict";var oen=EC&&EC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ien=EC&&EC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vne=EC&&EC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&oen(t,e,r);return ien(t,e),t};Object.defineProperty(EC,"__esModule",{value:!0});EC.fimStream=pen;var aen=vne(me()),sen=vo(),uen=w3(),q3=vne(wo()),len=Oe(),cen=ce(),FIt=So(),den=Hn(),kIt=vne(fn()),fen=vne(Dp());async function pen(e,t,r){let n=(0,cen.safeParse)(t,v=>kIt.FIMCompletionStreamRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,sen.encodeJSON)("body",o,{explode:!0}),a=(0,den.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,len.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,FIt.extractSecurity)(e._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,FIt.resolveGlobalSecurity)(l),d={operationID:"stream_fim",oAuth2Scopes:[],resolvedSecurity:c,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=e._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await e._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,_={HttpMeta:{Response:m,Request:p}},[g]=await q3.match(q3.sse(200,aen.instanceof(ReadableStream).transform(v=>new uen.EventStream({stream:v,decoder(S){return kIt.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),q3.jsonErr(422,fen.HTTPValidationError$inboundSchema),q3.fail("4XX"),q3.fail("5XX"))(m,{extraFields:_});return g.ok,g}});var qIt=b(wne=>{"use strict";Object.defineProperty(wne,"__esModule",{value:!0});wne.Fim=void 0;var hen=LIt(),men=BIt(),gen=Ap(),$It=Jh(),qPe=class extends gen.ClientSDK{async complete(t,r){return(0,$It.unwrapAsync)((0,hen.fimComplete)(this,t,r))}async stream(t,r){return(0,$It.unwrapAsync)((0,men.fimStream)(this,t,r))}};wne.Fim=qPe});var zIt=b(PC=>{"use strict";var yen=PC&&PC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ben=PC&&PC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),UPe=PC&&PC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&yen(t,e,r);return ben(t,e),t};Object.defineProperty(PC,"__esModule",{value:!0});PC.fineTuningJobsCancel=Oen;var _en=vo(),Sne=UPe(wo()),ven=Oe(),wen=ce(),UIt=So(),Sen=Hn(),xen=UPe(fn()),Cen=UPe(Tu());async function Oen(e,t,r){let n=(0,wen.safeParse)(t,v=>Cen.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,_en.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Sen.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,ven.compactMap)({Accept:"application/json"})),l=await(0,UIt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,UIt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_cancel_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await Sne.match(Sne.json(200,xen.DetailedJobOut$inboundSchema),Sne.fail("4XX"),Sne.fail("5XX"))(_);return g.ok,g}});var VIt=b(TC=>{"use strict";var Een=TC&&TC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Pen=TC&&TC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),zPe=TC&&TC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Een(t,e,r);return Pen(t,e),t};Object.defineProperty(TC,"__esModule",{value:!0});TC.fineTuningJobsCreate=jen;var Ten=vo(),xne=zPe(wo()),Men=Oe(),Ien=ce(),HIt=So(),Aen=Hn(),Ren=zPe(fn()),Den=zPe(Tu());async function jen(e,t,r){let n=(0,Ien.safeParse)(t,g=>Ren.JobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Ten.encodeJSON)("body",o,{explode:!0}),a=(0,Aen.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,Men.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,HIt.extractSecurity)(e._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,HIt.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_fine_tuning_create_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=e._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await e._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,[_]=await xne.match(xne.json(200,Den.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),xne.fail("4XX"),xne.fail("5XX"))(m);return _.ok,_}});var JIt=b(MC=>{"use strict";var Nen=MC&&MC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Len=MC&&MC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),HPe=MC&&MC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Nen(t,e,r);return Len(t,e),t};Object.defineProperty(MC,"__esModule",{value:!0});MC.fineTuningJobsGet=zen;var Fen=vo(),Cne=HPe(wo()),ken=Oe(),Ben=ce(),WIt=So(),$en=Hn(),qen=HPe(fn()),Uen=HPe(Tu());async function zen(e,t,r){let n=(0,Ben.safeParse)(t,v=>Uen.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,Fen.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,$en.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,ken.compactMap)({Accept:"application/json"})),l=await(0,WIt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,WIt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await Cne.match(Cne.json(200,qen.DetailedJobOut$inboundSchema),Cne.fail("4XX"),Cne.fail("5XX"))(_);return g.ok,g}});var KIt=b(IC=>{"use strict";var Hen=IC&&IC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Ven=IC&&IC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),VPe=IC&&IC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Hen(t,e,r);return Ven(t,e),t};Object.defineProperty(IC,"__esModule",{value:!0});IC.fineTuningJobsList=Xen;var Wen=vo(),One=VPe(wo()),Jen=Oe(),Gen=ce(),GIt=So(),Ken=Hn(),Yen=VPe(fn()),Zen=VPe(Tu());async function Xen(e,t,r){let n=(0,Gen.safeParse)(t,v=>Zen.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,Ken.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,Wen.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,Jen.compactMap)({Accept:"application/json"})),l=await(0,GIt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,GIt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await One.match(One.json(200,Yen.JobsOut$inboundSchema),One.fail("4XX"),One.fail("5XX"))(_);return g.ok,g}});var ZIt=b(AC=>{"use strict";var Qen=AC&&AC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),etn=AC&&AC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),WPe=AC&&AC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Qen(t,e,r);return etn(t,e),t};Object.defineProperty(AC,"__esModule",{value:!0});AC.fineTuningJobsStart=stn;var ttn=vo(),Ene=WPe(wo()),rtn=Oe(),ntn=ce(),YIt=So(),otn=Hn(),itn=WPe(fn()),atn=WPe(Tu());async function stn(e,t,r){let n=(0,ntn.safeParse)(t,v=>atn.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,ttn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,otn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,rtn.compactMap)({Accept:"application/json"})),l=await(0,YIt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,YIt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_start_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await Ene.match(Ene.json(200,itn.DetailedJobOut$inboundSchema),Ene.fail("4XX"),Ene.fail("5XX"))(_);return g.ok,g}});var XIt=b(Pne=>{"use strict";Object.defineProperty(Pne,"__esModule",{value:!0});Pne.Jobs=void 0;var utn=zIt(),ltn=VIt(),ctn=JIt(),dtn=KIt(),ftn=ZIt(),ptn=Ap(),U3=Jh(),JPe=class extends ptn.ClientSDK{async list(t,r){return(0,U3.unwrapAsync)((0,dtn.fineTuningJobsList)(this,t,r))}async create(t,r){return(0,U3.unwrapAsync)((0,ltn.fineTuningJobsCreate)(this,t,r))}async get(t,r){return(0,U3.unwrapAsync)((0,ctn.fineTuningJobsGet)(this,t,r))}async cancel(t,r){return(0,U3.unwrapAsync)((0,utn.fineTuningJobsCancel)(this,t,r))}async start(t,r){return(0,U3.unwrapAsync)((0,ftn.fineTuningJobsStart)(this,t,r))}};Pne.Jobs=JPe});var QIt=b(Tne=>{"use strict";Object.defineProperty(Tne,"__esModule",{value:!0});Tne.FineTuning=void 0;var htn=Ap(),mtn=XIt(),GPe=class extends htn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new mtn.Jobs(this._options))}};Tne.FineTuning=GPe});var tAt=b(RC=>{"use strict";var gtn=RC&&RC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ytn=RC&&RC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),KPe=RC&&RC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&gtn(t,e,r);return ytn(t,e),t};Object.defineProperty(RC,"__esModule",{value:!0});RC.modelsArchive=Ctn;var btn=vo(),Mne=KPe(wo()),_tn=Oe(),vtn=ce(),eAt=So(),wtn=Hn(),Stn=KPe(fn()),xtn=KPe(Tu());async function Ctn(e,t,r){let n=(0,vtn.safeParse)(t,v=>xtn.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,btn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,wtn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,_tn.compactMap)({Accept:"application/json"})),l=await(0,eAt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,eAt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_archive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await Mne.match(Mne.json(200,Stn.ArchiveFTModelOut$inboundSchema),Mne.fail("4XX"),Mne.fail("5XX"))(_);return g.ok,g}});var nAt=b(DC=>{"use strict";var Otn=DC&&DC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Etn=DC&&DC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ine=DC&&DC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Otn(t,e,r);return Etn(t,e),t};Object.defineProperty(DC,"__esModule",{value:!0});DC.modelsDelete=jtn;var Ptn=vo(),z3=Ine(wo()),Ttn=Oe(),Mtn=ce(),rAt=So(),Itn=Hn(),Atn=Ine(fn()),Rtn=Ine(Dp()),Dtn=Ine(Tu());async function jtn(e,t,r){let n=(0,Mtn.safeParse)(t,S=>Dtn.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Ptn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Itn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Ttn.compactMap)({Accept:"application/json"})),l=await(0,rAt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,rAt.resolveGlobalSecurity)(c),f={operationID:"delete_model_v1_models__model_id__delete",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,g={HttpMeta:{Response:_,Request:h}},[v]=await z3.match(z3.json(200,Atn.DeleteModelOut$inboundSchema),z3.jsonErr(422,Rtn.HTTPValidationError$inboundSchema),z3.fail("4XX"),z3.fail("5XX"))(_,{extraFields:g});return v.ok,v}});var iAt=b(jC=>{"use strict";var Ntn=jC&&jC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Ltn=jC&&jC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),YPe=jC&&jC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ntn(t,e,r);return Ltn(t,e),t};Object.defineProperty(jC,"__esModule",{value:!0});jC.modelsList=qtn;var H3=YPe(wo()),Ftn=Oe(),oAt=So(),ktn=Hn(),Btn=YPe(fn()),$tn=YPe(Dp());async function qtn(e,t){let r=(0,ktn.pathToFunc)("/v1/models")(),n=new Headers((0,Ftn.compactMap)({Accept:"application/json"})),o=await(0,oAt.extractSecurity)(e._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,oAt.resolveGlobalSecurity)(i),s={operationID:"list_models_v1_models_get",oAuth2Scopes:[],resolvedSecurity:a,securitySource:e._options.apiKey,retryConfig:t?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:t?.retryCodes||["429","500","502","503","504"]},u=e._createRequest(s,{security:a,method:"GET",baseURL:t?.serverURL,path:r,headers:n,timeoutMs:t?.timeoutMs||e._options.timeoutMs||-1},t);if(!u.ok)return u;let l=u.value,c=await e._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 H3.match(H3.json(200,Btn.ModelList$inboundSchema),H3.jsonErr(422,$tn.HTTPValidationError$inboundSchema),H3.fail("4XX"),H3.fail("5XX"))(d,{extraFields:f});return p.ok,p}});var uAt=b(NC=>{"use strict";var Utn=NC&&NC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ztn=NC&&NC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ZPe=NC&&NC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Utn(t,e,r);return ztn(t,e),t};Object.defineProperty(NC,"__esModule",{value:!0});NC.modelsRetrieve=Ktn;var Htn=vo(),V3=ZPe(wo()),Vtn=Oe(),Wtn=ce(),aAt=So(),Jtn=Hn(),Gtn=ZPe(Dp()),sAt=ZPe(Tu());async function Ktn(e,t,r){let n=(0,Wtn.safeParse)(t,S=>sAt.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Htn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Jtn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Vtn.compactMap)({Accept:"application/json"})),l=await(0,aAt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,aAt.resolveGlobalSecurity)(c),f={operationID:"retrieve_model_v1_models__model_id__get",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,g={HttpMeta:{Response:_,Request:h}},[v]=await V3.match(V3.json(200,sAt.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),V3.jsonErr(422,Gtn.HTTPValidationError$inboundSchema),V3.fail("4XX"),V3.fail("5XX"))(_,{extraFields:g});return v.ok,v}});var cAt=b(LC=>{"use strict";var Ytn=LC&&LC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Ztn=LC&&LC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),XPe=LC&&LC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ytn(t,e,r);return Ztn(t,e),t};Object.defineProperty(LC,"__esModule",{value:!0});LC.modelsUnarchive=orn;var Xtn=vo(),Ane=XPe(wo()),Qtn=Oe(),ern=ce(),lAt=So(),trn=Hn(),rrn=XPe(fn()),nrn=XPe(Tu());async function orn(e,t,r){let n=(0,ern.safeParse)(t,v=>nrn.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Xtn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,trn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,Qtn.compactMap)({Accept:"application/json"})),l=await(0,lAt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,lAt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_unarchive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await Ane.match(Ane.json(200,rrn.UnarchiveFTModelOut$inboundSchema),Ane.fail("4XX"),Ane.fail("5XX"))(_);return g.ok,g}});var pAt=b(FC=>{"use strict";var irn=FC&&FC.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),arn=FC&&FC.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),QPe=FC&&FC.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&irn(t,e,r);return arn(t,e),t};Object.defineProperty(FC,"__esModule",{value:!0});FC.modelsUpdate=frn;var dAt=vo(),Rne=QPe(wo()),srn=Oe(),urn=ce(),fAt=So(),lrn=Hn(),crn=QPe(fn()),drn=QPe(Tu());async function frn(e,t,r){let n=(0,urn.safeParse)(t,v=>drn.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(v),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,dAt.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,dAt.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,lrn.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,srn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,fAt.extractSecurity)(e._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,fAt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_update_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:e._options.apiKey,retryConfig:r?.retries||e._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=e._createRequest(f,{security:d,method:"PATCH",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||e._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await e._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let _=m.value,[g]=await Rne.match(Rne.json(200,crn.FTModelOut$inboundSchema),Rne.fail("4XX"),Rne.fail("5XX"))(_);return g.ok,g}});var hAt=b(Dne=>{"use strict";Object.defineProperty(Dne,"__esModule",{value:!0});Dne.Models=void 0;var prn=tAt(),hrn=nAt(),mrn=iAt(),grn=uAt(),yrn=cAt(),brn=pAt(),_rn=Ap(),tB=Jh(),eTe=class extends _rn.ClientSDK{async list(t){return(0,tB.unwrapAsync)((0,mrn.modelsList)(this,t))}async retrieve(t,r){return(0,tB.unwrapAsync)((0,grn.modelsRetrieve)(this,t,r))}async delete(t,r){return(0,tB.unwrapAsync)((0,hrn.modelsDelete)(this,t,r))}async update(t,r){return(0,tB.unwrapAsync)((0,brn.modelsUpdate)(this,t,r))}async archive(t,r){return(0,tB.unwrapAsync)((0,prn.modelsArchive)(this,t,r))}async unarchive(t,r){return(0,tB.unwrapAsync)((0,yrn.modelsUnarchive)(this,t,r))}};Dne.Models=eTe});var mAt=b(jne=>{"use strict";Object.defineProperty(jne,"__esModule",{value:!0});jne.Mistral=void 0;var vrn=Ap(),wrn=iTt(),Srn=jMt(),xrn=aIt(),Crn=hIt(),Orn=bIt(),Ern=DIt(),Prn=qIt(),Trn=QIt(),Mrn=hAt(),tTe=class extends vrn.ClientSDK{get models(){return this._models??(this._models=new Mrn.Models(this._options))}get files(){return this._files??(this._files=new Ern.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new Trn.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new Srn.Batch(this._options))}get chat(){return this._chat??(this._chat=new xrn.Chat(this._options))}get fim(){return this._fim??(this._fim=new Prn.Fim(this._options))}get agents(){return this._agents??(this._agents=new wrn.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new Orn.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new Crn.Classifiers(this._options))}};jne.Mistral=tTe});var bAt=b(zf=>{"use strict";var gAt=zf&&zf.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Irn=zf&&zf.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),yAt=zf&&zf.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&gAt(t,e,r)},Arn=zf&&zf.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&gAt(t,e,r);return Irn(t,e),t};Object.defineProperty(zf,"__esModule",{value:!0});zf.files=void 0;yAt(Iee(),zf);zf.files=Arn(vOe());yAt(mAt(),zf)});var EAt=b((sTe,uTe)=>{(function(e,t){typeof sTe=="object"&&typeof uTe<"u"?uTe.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_quarterOfYear=t()})(sTe,function(){"use strict";var e="month",t="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)===t?this.add(3*s,e):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)===t){var d=this.quarter()-1;return c?this.month(3*d).startOf(e).startOf("day"):this.month(3*d+2).endOf(e).endOf("day")}return a.bind(this)(s,u)}}})});var dT=b((lTe,cTe)=>{(function(e,t){typeof lTe=="object"&&typeof cTe<"u"?cTe.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(lTe,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",l="month",c="quarter",d="year",f="date",p="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,_={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(F){var k=["th","st","nd","rd"],L=F%100;return"["+F+(k[(L-20)%10]||k[L]||k[0])+"]"}},g=function(F,k,L){var q=String(F);return!q||q.length>=k?F:""+Array(k+1-q.length).join(L)+F},v={s:g,z:function(F){var k=-F.utcOffset(),L=Math.abs(k),q=Math.floor(L/60),U=L%60;return(k<=0?"+":"-")+g(q,2,"0")+":"+g(U,2,"0")},m:function F(k,L){if(k.date()<L.date())return-F(L,k);var q=12*(L.year()-k.year())+(L.month()-k.month()),U=k.clone().add(q,l),G=L-U<0,V=k.clone().add(q+(G?-1:1),l);return+(-(q+(L-U)/(G?U-V:V-U))||0)},a:function(F){return F<0?Math.ceil(F)||0:Math.floor(F)},p:function(F){return{M:l,y:d,w:u,d:s,D:f,h:a,m:i,s:o,ms:n,Q:c}[F]||String(F||"").toLowerCase().replace(/s$/,"")},u:function(F){return F===void 0}},S="en",x={};x[S]=_;var O="$isDayjsObject",T=function(F){return F instanceof j||!(!F||!F[O])},E=function F(k,L,q){var U;if(!k)return S;if(typeof k=="string"){var G=k.toLowerCase();x[G]&&(U=G),L&&(x[G]=L,U=G);var V=k.split("-");if(!U&&V.length>1)return F(V[0])}else{var D=k.name;x[D]=k,U=D}return!q&&U&&(S=U),U||!q&&S},M=function(F,k){if(T(F))return F.clone();var L=typeof k=="object"?k:{};return L.date=F,L.args=arguments,new j(L)},A=v;A.l=E,A.i=T,A.w=function(F,k){return M(F,{locale:k.$L,utc:k.$u,x:k.$x,$offset:k.$offset})};var j=function(){function F(L){this.$L=E(L.locale,null,!0),this.parse(L),this.$x=this.$x||L.x||{},this[O]=!0}var k=F.prototype;return k.parse=function(L){this.$d=function(q){var U=q.date,G=q.utc;if(U===null)return new Date(NaN);if(A.u(U))return new Date;if(U instanceof Date)return new Date(U);if(typeof U=="string"&&!/Z$/i.test(U)){var V=U.match(h);if(V){var D=V[2]-1||0,z=(V[7]||"0").substring(0,3);return G?new Date(Date.UTC(V[1],D,V[3]||1,V[4]||0,V[5]||0,V[6]||0,z)):new Date(V[1],D,V[3]||1,V[4]||0,V[5]||0,V[6]||0,z)}}return new Date(U)}(L),this.init()},k.init=function(){var L=this.$d;this.$y=L.getFullYear(),this.$M=L.getMonth(),this.$D=L.getDate(),this.$W=L.getDay(),this.$H=L.getHours(),this.$m=L.getMinutes(),this.$s=L.getSeconds(),this.$ms=L.getMilliseconds()},k.$utils=function(){return A},k.isValid=function(){return this.$d.toString()!==p},k.isSame=function(L,q){var U=M(L);return this.startOf(q)<=U&&U<=this.endOf(q)},k.isAfter=function(L,q){return M(L)<this.startOf(q)},k.isBefore=function(L,q){return this.endOf(q)<M(L)},k.$g=function(L,q,U){return A.u(L)?this[q]:this.set(U,L)},k.unix=function(){return Math.floor(this.valueOf()/1e3)},k.valueOf=function(){return this.$d.getTime()},k.startOf=function(L,q){var U=this,G=!!A.u(q)||q,V=A.p(L),D=function(ne,Pe){var ht=A.w(U.$u?Date.UTC(U.$y,Pe,ne):new Date(U.$y,Pe,ne),U);return G?ht:ht.endOf(s)},z=function(ne,Pe){return A.w(U.toDate()[ne].apply(U.toDate("s"),(G?[0,0,0,0]:[23,59,59,999]).slice(Pe)),U)},W=this.$W,J=this.$M,te=this.$D,Ie="set"+(this.$u?"UTC":"");switch(V){case d:return G?D(1,0):D(31,11);case l:return G?D(1,J):D(0,J+1);case u:var Z=this.$locale().weekStart||0,X=(W<Z?W+7:W)-Z;return D(G?te-X:te+(6-X),J);case s:case f:return z(Ie+"Hours",0);case a:return z(Ie+"Minutes",1);case i:return z(Ie+"Seconds",2);case o:return z(Ie+"Milliseconds",3);default:return this.clone()}},k.endOf=function(L){return this.startOf(L,!1)},k.$set=function(L,q){var U,G=A.p(L),V="set"+(this.$u?"UTC":""),D=(U={},U[s]=V+"Date",U[f]=V+"Date",U[l]=V+"Month",U[d]=V+"FullYear",U[a]=V+"Hours",U[i]=V+"Minutes",U[o]=V+"Seconds",U[n]=V+"Milliseconds",U)[G],z=G===s?this.$D+(q-this.$W):q;if(G===l||G===d){var W=this.clone().set(f,1);W.$d[D](z),W.init(),this.$d=W.set(f,Math.min(this.$D,W.daysInMonth())).$d}else D&&this.$d[D](z);return this.init(),this},k.set=function(L,q){return this.clone().$set(L,q)},k.get=function(L){return this[A.p(L)]()},k.add=function(L,q){var U,G=this;L=Number(L);var V=A.p(q),D=function(J){var te=M(G);return A.w(te.date(te.date()+Math.round(J*L)),G)};if(V===l)return this.set(l,this.$M+L);if(V===d)return this.set(d,this.$y+L);if(V===s)return D(1);if(V===u)return D(7);var z=(U={},U[i]=t,U[a]=r,U[o]=e,U)[V]||1,W=this.$d.getTime()+L*z;return A.w(W,this)},k.subtract=function(L,q){return this.add(-1*L,q)},k.format=function(L){var q=this,U=this.$locale();if(!this.isValid())return U.invalidDate||p;var G=L||"YYYY-MM-DDTHH:mm:ssZ",V=A.z(this),D=this.$H,z=this.$m,W=this.$M,J=U.weekdays,te=U.months,Ie=U.meridiem,Z=function(Pe,ht,we,ae){return Pe&&(Pe[ht]||Pe(q,G))||we[ht].slice(0,ae)},X=function(Pe){return A.s(D%12||12,Pe,"0")},ne=Ie||function(Pe,ht,we){var ae=Pe<12?"AM":"PM";return we?ae.toLowerCase():ae};return G.replace(m,function(Pe,ht){return ht||function(we){switch(we){case"YY":return String(q.$y).slice(-2);case"YYYY":return A.s(q.$y,4,"0");case"M":return W+1;case"MM":return A.s(W+1,2,"0");case"MMM":return Z(U.monthsShort,W,te,3);case"MMMM":return Z(te,W);case"D":return q.$D;case"DD":return A.s(q.$D,2,"0");case"d":return String(q.$W);case"dd":return Z(U.weekdaysMin,q.$W,J,2);case"ddd":return Z(U.weekdaysShort,q.$W,J,3);case"dddd":return J[q.$W];case"H":return String(D);case"HH":return A.s(D,2,"0");case"h":return X(1);case"hh":return X(2);case"a":return ne(D,z,!0);case"A":return ne(D,z,!1);case"m":return String(z);case"mm":return A.s(z,2,"0");case"s":return String(q.$s);case"ss":return A.s(q.$s,2,"0");case"SSS":return A.s(q.$ms,3,"0");case"Z":return V}return null}(Pe)||V.replace(":","")})},k.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},k.diff=function(L,q,U){var G,V=this,D=A.p(q),z=M(L),W=(z.utcOffset()-this.utcOffset())*t,J=this-z,te=function(){return A.m(V,z)};switch(D){case d:G=te()/12;break;case l:G=te();break;case c:G=te()/3;break;case u:G=(J-W)/6048e5;break;case s:G=(J-W)/864e5;break;case a:G=J/r;break;case i:G=J/t;break;case o:G=J/e;break;default:G=J}return U?G:A.a(G)},k.daysInMonth=function(){return this.endOf(l).$D},k.$locale=function(){return x[this.$L]},k.locale=function(L,q){if(!L)return this.$L;var U=this.clone(),G=E(L,q,!0);return G&&(U.$L=G),U},k.clone=function(){return A.w(this.$d,this)},k.toDate=function(){return new Date(this.valueOf())},k.toJSON=function(){return this.isValid()?this.toISOString():null},k.toISOString=function(){return this.$d.toISOString()},k.toString=function(){return this.$d.toUTCString()},F}(),N=j.prototype;return M.prototype=N,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",l],["$y",d],["$D",f]].forEach(function(F){N[F[1]]=function(k){return this.$g(k,F[0],F[1])}}),M.extend=function(F,k){return F.$i||(F(k,j,M),F.$i=!0),M},M.locale=E,M.isDayjs=T,M.unix=function(F){return M(1e3*F)},M.en=x[S],M.Ls=x,M.p={},M})});var L1t=C(()=>{wO()});var F1t=C(()=>{kh();L1t();jS();Lx()});var k1t=C(()=>{OO()});var pMe=C(()=>{Lx();tI();jS();F1t();k1t()});var aFt=b((g3o,iFt)=>{"use strict";var Lln="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";iFt.exports=Lln});var cFt=b((y3o,lFt)=>{"use strict";var Fln=aFt();function sFt(){}function uFt(){}uFt.resetWarningCache=sFt;lFt.exports=function(){function e(n,o,i,a,s,u){if(u!==Fln){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}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:uFt,resetWarningCache:sFt};return r.PropTypes=r,r}});var fFt=b((v3o,dFt)=>{dFt.exports=cFt()();var b3o,_3o});var bFt=b(JIe=>{"use strict";JIe.__esModule=!0;JIe.default=function(e,t){if(e&&t){var r=Array.isArray(t)?t:t.split(",");if(r.length===0)return!0;var n=e.name||"",o=(e.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 egn={};Yd(egn,{default:()=>yae});module.exports=sl(egn);var Zd="{copilot-selection}",Nae=50,wD=[{name:"Fix grammar and spelling",prompt:`<instruction>Fix the grammar and spelling of the text below. Preserve all formatting, line breaks, and special characters. Do not add or remove any content. Return only the corrected text.</instruction>
<text>${Zd}</text>`,showInContextMenu:!0},{name:"Translate to Chinese",prompt:`<instruction>Translate the text below into Chinese:
1. Preserve the meaning and tone
2. Maintain appropriate cultural context
3. Keep formatting and structure
Return only the translated text.</instruction>
<text>${Zd}</text>`,showInContextMenu:!0},{name:"Summarize",prompt:`<instruction>Create a bullet-point summary of the text below. Each bullet point should capture a key point. Return only the bullet-point summary.</instruction>
<text>${Zd}</text>`,showInContextMenu:!0},{name:"Simplify",prompt:`<instruction>Simplify the text below to a 6th-grade reading level (ages 11-12). Use simple sentences, common words, and clear explanations. Maintain the original key concepts. Return only the simplified text.</instruction>
<text>{copilot-selection}</text>`,showInContextMenu:!0},{name:"Emojify",prompt:`<instruction>Add relevant emojis to enhance the text below. Follow these rules:
1. Insert emojis at natural breaks in the text
2. Never place two emojis next to each other
3. Keep all original text unchanged
4. Choose emojis that match the context and tone
Return only the emojified text.</instruction>
<text>{copilot-selection}</text>`,showInContextMenu:!0},{name:"Make shorter",prompt:`<instruction>Reduce the text below to half its length while preserving these elements:
1. Main ideas and key points
2. Essential details
3. Original tone and style
Return only the shortened text.</instruction>
<text>${Zd}</text>`,showInContextMenu:!0},{name:"Make longer",prompt:`<instruction>Expand the text below to twice its length by:
1. Adding relevant details and examples
2. Elaborating on key points
3. Maintaining the original tone and style
Return only the expanded text.</instruction>
<text>${Zd}</text>`,showInContextMenu:!0},{name:"Generate table of contents",prompt:`<instruction>Generate a hierarchical table of contents for the text below. Use appropriate heading levels (H1, H2, H3, etc.). Include page numbers if present. Return only the table of contents.</instruction>
<text>${Zd}</text>`,showInContextMenu:!1},{name:"Generate glossary",prompt:`<instruction>Create a glossary of important terms, concepts, and phrases from the text below. Format each entry as "Term: Definition". Sort entries alphabetically. Return only the glossary.</instruction>
<text>{copilot-selection}</text>`,showInContextMenu:!1},{name:"Remove URLs",prompt:`<instruction>Remove all URLs from the text below. Preserve all other content and formatting. URLs may be in various formats (http, https, www). Return only the text with URLs removed.</instruction>
<text>${Zd}</text>`,showInContextMenu:!1},{name:"Rewrite as tweet",prompt:`<instruction>Rewrite the text below as a single tweet with these requirements:
1. Maximum 280 characters
2. Use concise, impactful language
3. Maintain the core message
Return only the tweet text.</instruction>
<text>${Zd}</text>`,showInContextMenu:!1},{name:"Rewrite as tweet thread",prompt:`<instruction>Convert the text below into a Twitter thread following these rules:
1. Each tweet must be under 240 characters
2. Start with "THREAD START" on its own line
3. Separate tweets with "
---
"
4. End with "THREAD END" on its own line
5. Make content engaging and clear
Return only the formatted thread.</instruction>
<text>${Zd}</text>`,showInContextMenu:!1},{name:"Explain like I am 5",prompt:`<instruction>Explain the text below in simple terms that a 5-year-old would understand:
1. Use basic vocabulary
2. Include simple analogies
3. Break down complex concepts
Return only the simplified explanation.</instruction>
<text>${Zd}</text>`,showInContextMenu:!1},{name:"Rewrite as press release",prompt:`<instruction>Transform the text below into a professional press release:
1. Use formal, journalistic style
2. Include headline and dateline
3. Follow inverted pyramid structure
Return only the press release format.</instruction>
<text>${Zd}</text>`,showInContextMenu:!1}];OO();tI();jS();var ule=e=>e.map(t=>t.pageContent).join(`
`);var ki={},fJt=0;function rI(e,t){let r=`atom${++fJt}`,n={toString(){return(ki.env?ki.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof e=="function"?n.read=e:(n.init=e,n.read=pJt,n.write=hJt),t&&(n.write=t),n}function pJt(e){return e(this)}function hJt(e,t,r){return t(this,typeof r=="function"?r(e(this)):r)}var dke=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,lle=e=>"init"in e,cle=e=>!!e.write,o5=new WeakMap,fle=e=>{var t;return ple(e)&&!((t=o5.get(e))!=null&&t[1])},mJt=(e,t)=>{let r=o5.get(e);if(r)r[1]=!0,r[0].forEach(n=>n(t));else if((ki.env?ki.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},gJt=e=>{if(o5.has(e))return;let t=[new Set,!1];o5.set(e,t);let r=()=>{t[1]=!0};e.then(r,r),e.onCancel=n=>{t[0].add(n)}},ple=e=>typeof e?.then=="function",fke=e=>"v"in e||"e"in e,n5=e=>{if("e"in e)throw e.e;if((ki.env?ki.env.MODE:void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v},mke=(e,t,r)=>{r.p.has(e)||(r.p.add(e),t.then(()=>{r.p.delete(e)},()=>{r.p.delete(e)}))},pke=(e,t,r,n,o)=>{var i;if((ki.env?ki.env.MODE:void 0)!=="production"&&n===t)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),fle(r.v)&&mke(t,r.v,o),(i=o.m)==null||i.t.add(t),e&&yJt(e,n,t)},rj=()=>[new Map,new Map,new Set],dle=(e,t,r)=>{e[0].has(t)||e[0].set(t,new Set),e[1].set(t,r)},yJt=(e,t,r)=>{let n=e[0].get(t);n&&n.add(r)},bJt=(e,t)=>e[0].get(t),hke=(e,t)=>{e[2].add(t)},TO=e=>{let t,r=!1,n=o=>{try{o()}catch(i){r||(t=i,r=!0)}};for(;e[1].size||e[2].size;){e[0].clear();let o=new Set(e[1].values());e[1].clear();let i=new Set(e[2]);e[2].clear(),o.forEach(a=>{var s;return(s=a.m)==null?void 0:s.l.forEach(n)}),i.forEach(n)}if(r)throw t},gke=(...[e,t,r,n])=>{let o;(ki.env?ki.env.MODE:void 0)!=="production"&&(o=new Set);let i=(S,x,O)=>{let T="v"in x,E=x.v,M=fle(x.v)?x.v:null;if(ple(O)){gJt(O);for(let A of x.d.keys())mke(S,O,e(A));x.v=O,delete x.e}else x.v=O,delete x.e;(!T||!Object.is(E,x.v))&&(++x.n,M&&mJt(M,O))},a=(S,x,O)=>{var T;let E=e(x);if(fke(E)&&(E.m&&!O?.has(x)||Array.from(E.d).every(([k,L])=>a(S,k,O).n===L)))return E;E.d.clear();let M=!0,A=k=>{if(dke(x,k)){let q=e(k);if(!fke(q))if(lle(k))i(k,q,k.init);else throw new Error("no atom init");return n5(q)}let L=a(S,k,O);try{return n5(L)}finally{if(M)pke(S,x,E,k,L);else{let q=rj();pke(q,x,E,k,L),p(q,x,E),TO(q)}}},j,N,F={get signal(){return j||(j=new AbortController),j.signal},get setSelf(){return(ki.env?ki.env.MODE:void 0)!=="production"&&!cle(x)&&console.warn("setSelf function cannot be used with read-only atom"),!N&&cle(x)&&(N=(...k)=>{if((ki.env?ki.env.MODE:void 0)!=="production"&&M&&console.warn("setSelf function cannot be called in sync"),!M)return f(x,...k)}),N}};try{let k=t(x,A,F);if(i(x,E,k),ple(k)){(T=k.onCancel)==null||T.call(k,()=>j?.abort());let L=()=>{if(E.m){let q=rj();p(q,x,E),TO(q)}};k.then(L,L)}return E}catch(k){return delete E.v,E.e=k,++E.n,E}finally{M=!1}},s=S=>n5(a(void 0,S)),u=(S,x,O)=>{var T,E;let M=new Map;for(let A of((T=O.m)==null?void 0:T.t)||[])M.set(A,e(A));for(let A of O.p)M.set(A,e(A));return(E=bJt(S,x))==null||E.forEach(A=>{M.set(A,e(A))}),M};function l(S,x,O){let T=[],E=new Set,M=new Set,A=[[x,O]];for(;A.length>0;){let[j,N]=A[A.length-1];if(M.has(j)){A.pop();continue}if(E.has(j)){T.push([j,N,N.n]),M.add(j),A.pop();continue}E.add(j);for(let[F,k]of u(S,j,N))j!==F&&!E.has(F)&&A.push([F,k])}return[T,M]}let c=(S,x,O)=>{let[T,E]=l(S,x,O),M=new Set([x]);for(let A=T.length-1;A>=0;--A){let[j,N,F]=T[A],k=!1;for(let L of N.d.keys())if(L!==j&&M.has(L)){k=!0;break}k&&(a(S,j,E),p(S,j,N),F!==N.n&&(dle(S,j,N),M.add(j))),E.delete(j)}},d=(S,x,...O)=>{let T=!0,E=A=>n5(a(S,A)),M=(A,...j)=>{let N=e(A);try{if(dke(x,A)){if(!lle(A))throw new Error("atom not writable");let F=N.n,k=j[0];i(A,N,k),p(S,A,N),F!==N.n&&(dle(S,A,N),c(S,A,N));return}else return d(S,A,...j)}finally{T||TO(S)}};try{return r(x,E,M,...O)}finally{T=!1}},f=(S,...x)=>{let O=rj();try{return d(O,S,...x)}finally{TO(O)}},p=(S,x,O)=>{if(O.m&&!fle(O.v)){for(let T of O.d.keys())O.m.d.has(T)||(h(S,T,e(T)).t.add(x),O.m.d.add(T));for(let T of O.m.d||[])if(!O.d.has(T)){O.m.d.delete(T);let E=m(S,T,e(T));E?.t.delete(x)}}},h=(S,x,O)=>{if(!O.m){a(S,x);for(let T of O.d.keys())h(S,T,e(T)).t.add(x);if(O.m={l:new Set,d:new Set(O.d.keys()),t:new Set},(ki.env?ki.env.MODE:void 0)!=="production"&&o.add(x),cle(x)){let T=O.m,E,M=(A,j)=>{let N=!0;E=(...F)=>{try{return d(A,x,...F)}finally{N||TO(A)}};try{return j()}finally{N=!1}};hke(S,()=>{let A=M(S,()=>n(x,(...j)=>E(...j)));A&&(T.u=j=>M(j,A))})}}return O.m},m=(S,x,O)=>{if(O.m&&!O.m.l.size&&!Array.from(O.m.t).some(T=>{var E;return(E=e(T).m)==null?void 0:E.d.has(x)})){let T=O.m.u;T&&hke(S,()=>T(S)),delete O.m,(ki.env?ki.env.MODE:void 0)!=="production"&&o.delete(x);for(let E of O.d.keys()){let M=m(S,E,e(E));M?.t.delete(x)}return}return O.m},v={get:s,set:f,sub:(S,x)=>{let O=rj(),T=e(S),M=h(O,S,T).l;return M.add(x),TO(O),()=>{M.delete(x);let A=rj();m(A,S,T),TO(A)}},unstable_derive:S=>gke(...S(e,t,r,n))};return(ki.env?ki.env.MODE:void 0)!=="production"&&Object.assign(v,{dev4_get_internal_weak_map:()=>({get:x=>{let O=e(x);if(O.n!==0)return O}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:x=>{let O=rj();for(let[T,E]of x)if(lle(T)){let M=e(T),A=M.n;i(T,M,E),p(O,T,M),A!==M.n&&(dle(O,T,M),c(O,T,M))}TO(O)}}),v},i5=()=>{let e=new WeakMap;return gke(r=>{if((ki.env?ki.env.MODE:void 0)!=="production"&&!r)throw new Error("Atom is undefined or null");let n=e.get(r);return n||(n={d:new Map,p:new Set,n:0},e.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)})},wq,yke=()=>(wq||(wq=i5(),(ki.env?ki.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=wq),globalThis.__JOTAI_DEFAULT_STORE__!==wq&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),wq);var Lc=B(Y(),1);var l5={},jJt=(0,Lc.createContext)(void 0),Ake=e=>{let t=(0,Lc.useContext)(jJt);return e?.store||t||yke()};var vle=e=>typeof e?.then=="function",Rke=e=>{e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t})},NJt=Lc.default.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(Rke(e),e)}),_le=new WeakMap,Ike=e=>{let t=_le.get(e);return t||(t=new Promise((r,n)=>{let o=e,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((l5.env?l5.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");vle(l)?(_le.set(l,t),o=l,l.then(i(l),a(l)),s(l)):r(l)})};e.then(i(e),a(e)),s(e)}),_le.set(e,t)),t};function wle(e,t){let r=Ake(t),[[n,o,i],a]=(0,Lc.useReducer)(l=>{let c=r.get(e);return Object.is(l[0],c)&&l[1]===r&&l[2]===e?l:[c,r,e]},void 0,()=>[r.get(e),r,e]),s=n;(o!==r||i!==e)&&(a(),s=r.get(e));let u=t?.delay;if((0,Lc.useEffect)(()=>{let l=r.sub(e,()=>{if(typeof u=="number"){let c=r.get(e);vle(c)&&Rke(Ike(c)),setTimeout(a,u);return}a()});return a(),l},[r,e,u]),(0,Lc.useDebugValue)(s),vle(s)){let l=Ike(s);return NJt(l)}return s}function LJt(e,t){let r=Ake(t);return(0,Lc.useCallback)((...o)=>{if((l5.env?l5.env.MODE:void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return r.set(e,...o)},[r,e])}function Sle(e,t){return[wle(e,t),LJt(e,t)]}var op=i5(),nI=rI(NS);function MO(e){let t=FJt({...pe(),...e});op.set(nI,t)}function xt(e,t){let r=pe();MO({...r,[e]:t})}function pe(){return op.get(nI)}function jke(){let e={...NS,activeModels:IO.map(t=>({...t,enabled:!0})),activeEmbeddingModels:xq.map(t=>({...t,enabled:!0}))};MO(e)}function ll(e){let t=pe();return op.sub(nI,()=>{let r=pe();e(t,r),t=r})}function Uo(){return wle(nI,{store:op})}function Nke(e){let t=e||NS;t.activeEmbeddingModels?t.activeEmbeddingModels=t.activeEmbeddingModels.map(u=>({...u,provider:u.provider==="azure_openai"?"azure openai":u.provider})):t.activeEmbeddingModels=xq.map(u=>({...u,enabled:!0}));let r={...t},n=Number(t.temperature);r.temperature=isNaN(n)?NS.temperature:n;let o=Number(t.maxTokens);r.maxTokens=isNaN(o)?NS.maxTokens:o;let i=Number(t.contextTurns);r.contextTurns=isNaN(i)?NS.contextTurns:i;let a=Number(t.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?NS.embeddingRequestsPerMin:a;let s=Number(t.embeddingBatchSize);return r.embeddingBatchSize=isNaN(s)?NS.embeddingBatchSize:s,r}function oI(){let e=pe().userSystemPrompt;return e?`${xle}
${e}`:xle}function FJt(e){return e.activeModels=Dke(e.activeModels,IO),e.activeEmbeddingModels=Dke(e.activeEmbeddingModels,xq),e}function Nr(e){return`${e.name}|${e.provider}`}function Dke(e,t){let r=new Map;return t.filter(n=>n.core).forEach(n=>{r.set(Nr(n),{...n})}),e.forEach(n=>{let o=Nr(n),i=r.get(o);if(i){let a=t.find(s=>s.name===n.name&&s.provider===n.provider);a?r.set(o,{...a,...n,isBuiltIn:!0,believerExclusive:a.believerExclusive}):r.set(o,{...n,isBuiltIn:i.isBuiltIn})}else r.set(o,n)}),Array.from(r.values())}function Mr(...e){pe().debug&&console.log(...e)}function gt(...e){pe().debug&&console.error(...e)}var p5=B(Td()),kle=B(tBe()),Md=require("obsidian"),Lle={INVALID_LICENSE_KEY_USER:"Invalid Copilot Plus license key. Please check your license key in settings.",UNKNOWN_ERROR:"An unknown error occurred",REQUEST_FAILED:e=>`Request failed, status ${e}`};function rBe(e){let t=e?.detail||{};return{status:t.status,message:t.message||e?.message,reason:t.reason}}function gGt(e){let t=rBe(e);return t.reason==="Invalid license key"||e?.message==="Invalid license key"||e?.message?.includes("status 403")||t.status===403}function nBe(e){let t=rBe(e);return gGt(e)?Lle.INVALID_LICENSE_KEY_USER:t.message||(t.reason?`Error: ${t.reason}`:Lle.UNKNOWN_ERROR)}var Ble=(e,t)=>{let r=e.getMarkdownFiles();if(t==="/")return r;let n=t.toLowerCase().replace(/^\/|\/$/g,"");return r.filter(o=>{let a=o.path.toLowerCase().split("/"),s=n.split("/"),u=0;for(let l of s){for(;u<a.length&&a[u]!==l;)u++;if(u>=a.length)return!1}return!0})};function lj(e){return e.replace(/^#/,"").trim().toLowerCase()}function Oq(e,t=!0){let r=app.metadataCache.getFileCache(e),n=r?.frontmatter?.tags,o=new Set;if(!t){let i=r?.tags?.map(a=>a.tag);i&&i.forEach(a=>o.add(lj(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(lj(i))}):typeof n=="string"&&o.add(lj(n))),Array.from(o)}function oBe(e,t,r){if(t.length===0)return[];t=t.map(i=>lj(i));let n=r&&r.length>0?r:Ble(e,"/"),o=[];for(let i of n){let a=Oq(i);t.some(s=>a.includes(s))&&o.push(i)}return o}var yGt=e=>e.last.bound.modelName||e.last.bound.model,bGt=e=>e.last.bound.retriever!==void 0,iBe=e=>yGt(e)||bGt(e);var dl=(e,t="local")=>{let r=(0,kle.default)(e);return t==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};function $le(e){let t=(0,kle.default)(e,"YYYY/MM/DD HH:mm:ss");return t.isValid()?{fileName:t.format("YYYYMMDD_HHmmss"),display:t.format("YYYY/MM/DD HH:mm:ss"),epoch:t.valueOf()}:dl(new Date)}async function cj(e,t){return e.extension!="md"?null:await t.cachedRead(e)}function h5(e){return e.basename}function aBe(e,t){return!e||!t?!1:e.includes(Fle)&&t.includes(Fle)||e==="small"&&t==="cohereai"||e==="cohereai"&&t==="small"?!0:e===t}function dj(e){let t=[],{history:r}=e;for(let n=0;n<r.length;n+=2){let o=r[n]?.content||"",i=r[n+1]?.content||"";t.push([o,i])}return t}function py(e,t){let r=/\[\[(.*?)\]\]/g,n=e.match(r),o=new Map;return n&&n.forEach(i=>{let a=i.slice(2,-2),s=t.getAbstractFileByPath(a);if(s instanceof Md.TFile)o.set(s.path,s);else{let l=t.getMarkdownFiles().filter(c=>c.basename===a);l.length>0&&(qle(a,t)?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 qle(e,t){return t.getMarkdownFiles().filter(n=>n.basename===e).length===1}function sBe(e){return e=e.trim(),e.startsWith("[[")&&e.endsWith("]]")?`${e.slice(2,-2).trim()}.md`:e}function uBe(e){let t=new Set;return e.forEach(r=>{r.metadata?.title&&t.add(r.metadata?.title)}),Array.from(t)}var lBe=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/;function cBe(e){return lBe.test(e)}function Eq(e){let t=e.match(lBe);return t?t[0]:null}var qm=class{static async isImageUrl(t,r){try{if(this.IMAGE_EXTENSIONS.some(s=>t.toLowerCase().endsWith(s))){let s=r.getAbstractFileByPath(t);return!s||!(s instanceof Md.TFile)?(gt("File not found in vault"),!1):s.stat.size>this.MAX_IMAGE_SIZE?(gt("File too large:",s.stat.size,"bytes"),!1):!0}let n=new URL(t);if(this.IMAGE_EXTENSIONS.some(s=>n.pathname.toLowerCase().endsWith(s)))return!0;try{if((await Bl(t,{method:"HEAD",headers:{}})).headers.get("content-type")?.startsWith("image/"))return!0}catch(s){gt("Error checking content-type:",s)}let o=n.searchParams;return[o.has("w")||o.has("width"),o.has("h")||o.has("height"),o.has("format"),o.has("fit"),o.has("q")||o.has("quality"),n.pathname.includes("/image/"),n.pathname.includes("/images/"),n.pathname.includes("/img/"),o.has("auto"),o.has("crop")].filter(Boolean).length>=2}catch{return this.IMAGE_EXTENSIONS.some(n=>t.toLowerCase().endsWith(n))}}static async handleVaultImage(t,r){try{if(t.stat.size>this.MAX_IMAGE_SIZE)return gt(`Image too large: ${t.stat.size} bytes, skipping: ${t.path}`),null;let n=await r.readBinary(t),o=await this.getMimeType(n,t.extension);if(!o.startsWith("image/"))return gt(`Invalid MIME type: ${o}, skipping: ${t.path}`),null;let a=p5.Buffer.from(n).toString("base64");return`data:${o};base64,${a}`}catch(n){return gt("Error in handleVaultImage:",n),null}}static async handleWebImage(t){try{let r=await Bl(t,{method:"GET",headers:{}});if(!r.ok)return gt(`Failed to fetch image: ${r.statusText}, skipping: ${t}`),null;let n=r.headers.get("content-type");if(!n?.startsWith("image/"))return gt(`Invalid content type: ${n}, skipping: ${t}`),null;let o=await r.arrayBuffer();if(o.byteLength>this.MAX_IMAGE_SIZE)return gt(`Image too large: ${o.byteLength} bytes, skipping: ${t}`),null;let a=p5.Buffer.from(o).toString("base64");return`data:${n};base64,${a}`}catch(r){return gt("Error converting image to base64:",r),null}}static async handleLocalImage(t,r){try{let n=decodeURIComponent(t.replace("app://","")),o=r.getAbstractFileByPath(n);if(!o||!(o instanceof Md.TFile))return gt(`Local image not found: ${n}`),null;if(o.stat.size>this.MAX_IMAGE_SIZE)return gt(`Image too large: ${o.stat.size} bytes, skipping: ${n}`),null;let i=await r.readBinary(o),a=await this.getMimeType(i,o.extension);if(!a.startsWith("image/"))return gt(`Invalid MIME type: ${a}, skipping: ${n}`),null;let u=p5.Buffer.from(i).toString("base64");return`data:${a};base64,${u}`}catch(n){return gt("Error in handleLocalImage:",n),null}}static async imageToBase64(t,r){if(t.startsWith("data:"))return t;if(t.startsWith("app://"))return await this.handleLocalImage(t,r);let n=r.getAbstractFileByPath(t);return n instanceof Md.TFile?await this.handleVaultImage(n,r):await this.handleWebImage(t)}static async convertToBase64(t,r){let n=await this.imageToBase64(t,r);return n?{type:"image_url",image_url:{url:n}}:null}static async getMimeType(t,r){let n=new Uint8Array(t.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)return"image/svg+xml";let o=this.MIME_TYPES[r.toLowerCase()];if(!o)throw new Error(`Unsupported image extension: ${r}`);return o}};qm.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp",".svg"],qm.MAX_IMAGE_SIZE=3*1024*1024,qm.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp",".svg":"image/svg+xml"};async function Bl(e,t={}){let r=t.headers?{...t.headers}:{};if(delete r["content-length"],typeof t.body=="string"){let a=JSON.parse(t.body??{});delete a.frequency_penalty,t.body=JSON.stringify(a)}Mr("==== safeFetch method request ====");let n=t.method?.toUpperCase()||"POST",i=await(0,Md.requestUrl)({url:e,contentType:"application/json",headers:r,method:n,...["POST","PUT","PATCH"].includes(n)&&{body:t.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(Lle.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:e,type:"basic",redirected:!1,bytes:()=>Promise.resolve(new Uint8Array(0)),body:_Gt(i.text),bodyUsed:!0,json:()=>i.json,text:async()=>i.text,arrayBuffer:async()=>{if(i.arrayBuffer)return i.arrayBuffer;let a=i.text.replace(/^data:.*;base64,/,""),s=atob(a),u=new Uint8Array(s.length);for(let l=0;l<s.length;l++)u[l]=s.charCodeAt(l);return u.buffer},blob:()=>{throw new Error("not implemented")},formData:()=>{throw new Error("not implemented")},clone:()=>{throw new Error("not implemented")}}}function _Gt(e){return new ReadableStream({start(t){let n=new TextEncoder().encode(e);t.enqueue(n),t.close()}})}function bi(e,t=!1){return e instanceof Error?e.message+`
${e?.cause?"more message: "+e.cause.message:""}
${t?e.stack:""}`:JSON.stringify(e)}function Ule(e,t){let r={...e};return t.forEach(n=>{delete r[n]}),r}function m5(e,t){let[r,n]=e.split("|"),o=t.find(i=>i.name===r&&i.provider===n);if(!o)throw new Error(`No model configuration found for: ${e}`);return o}function sI(e){let t=pj[e];return{...t,label:t.label||e}}function uh(e,t){let r=pj[e]?.label||e;return r+(t?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}async function Pq(e,t=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new Md.Notice("No active leaf found.");return}if(r.view instanceof Md.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof Md.MarkdownView)){new Md.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to");t?n.replaceRange(e,o,i):n.replaceRange(e,i),new Md.Notice("Message inserted into the active note.")}function dBe(e,t){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>e(...n),t)}}function fBe(e,t){let r=e.split(".").map(Number),n=t.split(".").map(Number);for(let o=0;o<3;o++){if(r[o]>n[o])return!0;if(r[o]<n[o])return!1}return!1}async function pBe(){try{return{version:(await(0,Md.requestUrl)({url:"https://api.github.com/repos/logancyang/obsidian-copilot/releases/latest",method:"GET"})).json.tag_name.replace("v",""),error:null}}catch(e){return{version:null,error:e instanceof Error?e.message:"Failed to check for updates"}}}function uI(e){if(typeof e=="string")return e.startsWith("o1")||e.startsWith("o3");let t=e.modelName||e.model||"";return t.startsWith("o1")||t.startsWith("o3")}function hBe(e,t="system"){return uI(e)?"human":t}function zle(){let e=["3rd party (openai-format)","ollama","lm-studio","azure openai","copilot-plus","copilot-plus-jina"];return Object.entries(pj).filter(([t])=>!e.includes(t)).map(([t])=>t)}function g5(e,t){let r=!!zle().find(i=>i===e.provider),n=DO[e.provider],o=!e.apiKey&&!t[n];return r&&o?{hasApiKey:!1,errorNotice:`Please configure API Key for ${e.name} in settings first.
Path: Settings > copilot plugin > Basic Tab > Set Keys`}:{hasApiKey:!0}}function fj(e){return e.replace(/<think>[\s\S]*?<\/think>/g,"").trim()}var hj=class hj{static createNewLLMChain(t){let{llm:r,memory:n,prompt:o,abortController:i}=t,a=r.bind({signal:i?.signal}),s=Ha.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return hj.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(t){let r=hj.instances.get("llm_chain");return r||(r=hj.createNewLLMChain(t)),r}static createConversationalRetrievalChain(t,r,n){let{llm:o,retriever:i,systemMessage:a}=t,u=Ed.fromTemplate(`Given the following conversation and a follow up question,
summarize the conversation as context and keep the follow up question unchanged, in its original language.
If the follow up question is unrelated to its preceding messages, return this follow up question directly.
If it is related, then combine the summary and the follow up question to construct a standalone question.
Make sure to keep any [[]] wrapped note titles in the question unchanged.
Chat History:
{chat_history}
Follow Up Input: {question}
Standalone question:`),c=Ed.fromTemplate(`{system_message}
Answer the question with as detailed as possible based only on the following context:
{context}
Question: {question}
`),d=_=>_.map(v=>`Human: ${v[0]}
Assistant: ${v[1]}`).join(`
`),f=Ha.from([{question:_=>(n&&console.log("Input Question: ",_.question),_.question),chat_history:_=>{let g=d(_.chat_history);return n&&console.log("Formatted Chat History: ",g),g}},u,o,new QV,_=>{let g=fj(_);return n&&console.log("Standalone Question: ",g),g}]),p=async _=>(r(_),ule(_)),h=Ha.from([{context:i.pipe(p),question:new Fi,system_message:()=>a},c,o]);return f.pipe(h)}};hj.instances=new Map;var Hle=hj,y5=Hle;var cI="https://api.brevilabs.com/v1",fl="copilot-chat-view",zo="user",hy="ai",xle=`You are Obsidian Copilot, a helpful assistant that integrates AI to Obsidian note-taking.
1. Never mention that you do not have access to something. Always rely on the user provided context.
2. Always answer to the best of your knowledge. If you are unsure about something, say so and ask the user to provide more context.
3. If the user mentions "note", it most likely means an Obsidian note in the vault, not the generic meaning of a note.
4. If the user mentions "@vault", it means the user wants you to search the Obsidian vault for information relevant to the query. The search results will be provided to you in the context along with the user query, read it carefully and answer the question based on the information provided. If there's no relevant information in the vault, just say so.
5. If the user mentions any other tool with the @ symbol, check the context for their results. If nothing is found, just ignore the @ symbol in the query.
6. Always use $'s instead of \\[ etc. for LaTeX equations.
7. When showing note titles, use [[title]] format and do not wrap them in \` \`.
8. When showing **Obsidian internal** image links, use ![[link]] format and do not wrap them in \` \`.
9. When showing **web** image links, use ![link](url) format and do not wrap them in \` \`.
10. When generating a table, use compact formatting without excessive whitespace.
11. Always respond in the language of the user's query.
12. Do NOT mention the additional context provided such as getCurrentTime and getTimeRangeMs if it's irrelevant to the user message.`,b5=`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.`,mBe=6e3,Vle=.4,gBe=.4,Wle=15,Jle=448e3,FS={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree"},jO={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"};var lI=(p=>(p.OPENAI="openai",p.OPENAI_FORMAT="3rd party (openai-format)",p.AZURE_OPENAI="azure openai",p.ANTHROPIC="anthropic",p.COHEREAI="cohereai",p.GOOGLE="google",p.OPENROUTERAI="openrouterai",p.GROQ="groq",p.OLLAMA="ollama",p.LM_STUDIO="lm-studio",p.COPILOT_PLUS="copilot-plus",p.MISTRAL="mistralai",p.DEEPSEEK="deepseek",p))(lI||{});var NO={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},IO=[{name:"copilot-plus-flash",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,core:!0,plusExclusive:!0,capabilities:["vision"]},{name:"gpt-4o",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-4o-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"o1-mini",provider:"openai",enabled:!0,isBuiltIn:!0,capabilities:["reasoning"]},{name:"o3-mini",provider:"openai",enabled:!0,isBuiltIn:!0,capabilities:["reasoning"]},{name:"claude-3-5-sonnet-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"claude-3-5-haiku-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0},{name:"command-r",provider:"cohereai",enabled:!0,isBuiltIn:!0},{name:"command-r-plus",provider:"cohereai",enabled:!0,isBuiltIn:!0},{name:"gemini-2.0-pro-exp",provider:"google",enabled:!0,isBuiltIn:!0,capabilities:["vision"]},{name:"gemini-2.0-flash",provider:"google",enabled:!0,isBuiltIn:!0,capabilities:["vision"]},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0},{name:"deepseek-chat",provider:"deepseek",enabled:!0,isBuiltIn:!0},{name:"deepseek-reasoner",provider:"deepseek",enabled:!0,isBuiltIn:!0,capabilities:["reasoning"]}],AO=(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))(AO||{});var xq=[{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}],Fle="nomic-embed-text",pj={openai:{label:"OpenAI",host:"https://api.openai.com",keyManagementURL:"https://platform.openai.com/api-keys",testModel:"gpt-4o"},"azure openai":{label:"Azure OpenAI",host:"",keyManagementURL:"",testModel:"azure-openai"},anthropic:{label:"Anthropic",host:"https://api.anthropic.com/",keyManagementURL:"https://console.anthropic.com/settings/keys",testModel:"claude-3-5-sonnet-latest"},cohereai:{label:"Cohere",host:"https://api.cohere.com",keyManagementURL:"https://dashboard.cohere.ai/api-keys",testModel:"command-r"},google:{label:"Gemini",host:"https://generativelanguage.googleapis.com",keyManagementURL:"https://makersuite.google.com/app/apikey",testModel:"gemini-2.0-flash"},openrouterai:{label:"OpenRouter",host:"https://openrouter.ai/api/v1/",keyManagementURL:"https://openrouter.ai/keys",testModel:"openai/chatgpt-4o-latest"},groq:{label:"Groq",host:"https://api.groq.com/openai",keyManagementURL:"https://console.groq.com/keys",testModel:"llama3-8b-8192"},ollama:{label:"Ollama",host:"http://localhost:11434/v1/",keyManagementURL:""},"lm-studio":{label:"LM Studio",host:"http://localhost:1234/v1",keyManagementURL:""},"3rd party (openai-format)":{label:"OpenAI Format",host:"https://api.example.com/v1",keyManagementURL:""},mistralai:{label:"Mistral",host:"https://api.mistral.ai/v1",keyManagementURL:"https://console.mistral.ai/api-keys",testModel:"mistral-tiny-latest"},deepseek:{label:"DeepSeek",host:"https://api.deepseek.com/",keyManagementURL:"https://platform.deepseek.com/api-keys",testModel:"deepseek-chat"},"copilot-plus":{label:"Copilot Plus",host:"https://api.brevilabs.com/v1",keyManagementURL:""},"copilot-plus-jina":{label:"Copilot Plus",host:"https://api.brevilabs.com/v1",keyManagementURL:""}},DO={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey",deepseek:"deepseekApiKey"};var yBe=["NEVER","ON STARTUP","ON MODE SWITCH"];var nr={ADD_CUSTOM_PROMPT:"add-custom-prompt",APPLY_ADHOC_PROMPT:"apply-adhoc-prompt",APPLY_CUSTOM_PROMPT:"apply-custom-prompt",CLEAR_LOCAL_COPILOT_INDEX:"clear-local-copilot-index",CLEAR_COPILOT_CACHE:"clear-copilot-cache",COUNT_WORD_AND_TOKENS_SELECTION:"count-word-and-tokens-selection",COUNT_TOTAL_VAULT_TOKENS:"count-total-vault-tokens",DELETE_CUSTOM_PROMPT:"delete-custom-prompt",EDIT_CUSTOM_PROMPT:"edit-custom-prompt",FIND_RELEVANT_NOTES:"find-relevant-notes",FORCE_REINDEX_VAULT_TO_COPILOT_INDEX:"force-reindex-vault-to-copilot-index",GARBAGE_COLLECT_COPILOT_INDEX:"garbage-collect-copilot-index",INDEX_VAULT_TO_COPILOT_INDEX:"index-vault-to-copilot-index",INSPECT_COPILOT_INDEX_BY_NOTE_PATHS:"copilot-inspect-index-by-note-paths",LIST_INDEXED_FILES:"copilot-list-indexed-files",LOAD_COPILOT_CHAT_CONVERSATION:"load-copilot-chat-conversation",OPEN_COPILOT_CHAT_WINDOW:"chat-open-window",REMOVE_FILES_FROM_COPILOT_INDEX:"remove-files-from-copilot-index",SEARCH_ORAMA_DB:"copilot-search-orama-db",TOGGLE_COPILOT_CHAT_WINDOW:"chat-toggle-window"},_5={[nr.ADD_CUSTOM_PROMPT]:"Add custom prompt",[nr.APPLY_ADHOC_PROMPT]:"Apply ad-hoc custom prompt",[nr.APPLY_CUSTOM_PROMPT]:"Apply custom prompt",[nr.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[nr.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[nr.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[nr.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[nr.DELETE_CUSTOM_PROMPT]:"Delete custom prompt",[nr.EDIT_CUSTOM_PROMPT]:"Edit custom prompt",[nr.FIND_RELEVANT_NOTES]:"Find relevant notes",[nr.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[nr.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[nr.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[nr.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[nr.LIST_INDEXED_FILES]:"List all indexed files (debug)",[nr.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[nr.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[nr.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[nr.SEARCH_ORAMA_DB]:"Search OramaDB (debug)",[nr.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window"},NS={isPlusUser:!1,plusLicenseKey:"",openAIApiKey:"",openAIOrgId:"",huggingfaceApiKey:"",cohereApiKey:"",anthropicApiKey:"",azureOpenAIApiKey:"",azureOpenAIApiInstanceName:"",azureOpenAIApiDeploymentName:"",azureOpenAIApiVersion:"",azureOpenAIApiEmbeddingDeploymentName:"",googleApiKey:"",openRouterAiApiKey:"",mistralApiKey:"",deepseekApiKey:"",defaultChainType:"llm_chain",defaultModelKey:"gpt-4o|openai",embeddingModelKey:"text-embedding-3-small|openai",temperature:.1,maxTokens:1e3,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:"copilot-conversations",defaultConversationTag:"copilot-conversation",autosaveChat:!1,defaultOpenArea:"view",customPromptsFolder:"copilot-custom-prompts",indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:"",qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:3,groqApiKey:"",activeModels:IO,activeEmbeddingModels:xq,embeddingRequestsPerMin:90,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,promptUsageTimestamps:{},defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:wD},kS={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change"};var Kle=B(Td()),_Be=require("obsidian"),v5=null;function Tq(){return _Be.Platform.isDesktop&&v5||(v5=require("electron")?.remote?.safeStorage),v5}var Yle="enc_desk_",Zle="enc_web_",Qle="enc_",S5="dec_",vGt=new TextEncoder().encode("obsidian-copilot-v1"),w5={name:"AES-GCM",iv:new Uint8Array(12)};async function Xle(){return await crypto.subtle.importKey("raw",vGt,w5.name,!1,["encrypt","decrypt"])}async function vBe(e){if(!e.enableEncryption)return e;let t={...e},r=Object.keys(e).filter(n=>n.toLowerCase().includes("apikey")||n==="plusLicenseKey");for(let n of r){let o=e[n];t[n]=await Gle(o)}return Array.isArray(e.activeModels)&&(t.activeModels=await Promise.all(e.activeModels.map(async n=>({...n,apiKey:await Gle(n.apiKey||"")})))),Array.isArray(e.activeEmbeddingModels)&&(t.activeEmbeddingModels=await Promise.all(e.activeEmbeddingModels.map(async n=>({...n,apiKey:await Gle(n.apiKey||"")})))),t}async function Gle(e){if(!e||e.startsWith(Qle))return e;wBe(e)&&(e=e.replace(S5,""));try{if(Tq()?.isEncryptionAvailable()){let o=Tq().encryptString(e);return Yle+o.toString("base64")}let t=await Xle(),r=new TextEncoder().encode(e),n=await crypto.subtle.encrypt(w5,t,r);return Zle+SGt(n)}catch(t){return console.error("Encryption failed:",t),e}}async function Ho(e){if(!e||wGt(e))return e;if(wBe(e))return e.replace(S5,"");if(e.startsWith(Yle)){let r=e.replace(Yle,""),n=Kle.Buffer.from(r,"base64");return Tq().decryptString(n)}if(e.startsWith(Zle)){let r=e.replace(Zle,""),n=await Xle(),o=bBe(r),i=await crypto.subtle.decrypt(w5,n,o);return new TextDecoder().decode(i)}let t=e.replace(Qle,"");try{if(Tq()?.isEncryptionAvailable())try{let i=Kle.Buffer.from(t,"base64");return Tq().decryptString(i)}catch{}let r=await Xle(),n=bBe(t),o=await crypto.subtle.decrypt(w5,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function wGt(e){return!e.startsWith(Qle)&&!e.startsWith(S5)}function wBe(e){return e.startsWith(S5)}function SGt(e){let t=new Uint8Array(e),r="";for(let n=0;n<t.byteLength;n++)r+=String.fromCharCode(t[n]);return window.btoa(r)}function bBe(e){let t=window.atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r.buffer}var SBe=rI(null),x5=rI(e=>{let t=e(SBe);return t!==null?t:e(nI).defaultModelKey},(e,t,r)=>{t(SBe,r)}),xBe=rI(null),C5=rI(e=>{let t=e(xBe);return t!==null?t:e(nI).defaultChainType},(e,t,r)=>{t(xBe,r)});function O5(e){op.set(x5,e)}function E5(){return op.get(x5)}function CBe(e){return op.sub(x5,e)}function mj(){return Sle(x5,{store:op})}function zm(){return op.get(C5)}function gj(e){op.set(C5,e)}function OBe(e){return op.sub(C5,e)}function my(){return Sle(C5,{store:op})}var Cy=B(Y()),pze=require("obsidian"),hze=B(gh());var G9=B(Y());var zl=B(Y(),1);var JUe=B(Y(),1);function C7t(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function hfe(...e){return t=>e.forEach(r=>C7t(r,t))}function Vo(...e){return JUe.useCallback(hfe(...e),e)}var Wj=B(lt(),1),Sy=zl.forwardRef((e,t)=>{let{children:r,...n}=e,o=zl.Children.toArray(r),i=o.find(R7t);if(i){let a=i.props.children,s=o.map(u=>u===i?zl.Children.count(a)>1?zl.Children.only(null):zl.isValidElement(a)?a.props.children:null:u);return(0,Wj.jsx)(mfe,{...n,ref:t,children:zl.isValidElement(a)?zl.cloneElement(a,void 0,s):null})}return(0,Wj.jsx)(mfe,{...n,ref:t,children:r})});Sy.displayName="Slot";var mfe=zl.forwardRef((e,t)=>{let{children:r,...n}=e;if(zl.isValidElement(r)){let o=j7t(r);return zl.cloneElement(r,{...D7t(n,r.props),ref:t?hfe(t,o):o})}return zl.Children.count(r)>1?zl.Children.only(null):null});mfe.displayName="SlotClone";var A7t=({children:e})=>(0,Wj.jsx)(Wj.Fragment,{children:e});function R7t(e){return zl.isValidElement(e)&&e.type===A7t}function D7t(e,t){let r={...t};for(let n in t){let o=e[n],i=t[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{...e,...r}}function j7t(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function ZUe(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=ZUe(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function J9(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=ZUe(e))&&(n&&(n+=" "),n+=t);return n}var XUe=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,QUe=J9,Jj=(e,t)=>r=>{var n;if(t?.variants==null)return QUe(e,r?.class,r?.className);let{variants:o,defaultVariants:i}=t,a=Object.keys(o).map(l=>{let c=r?.[l],d=i?.[l];if(c===null)return null;let f=XUe(c)||XUe(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=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((l,c)=>{let{class:d,className:f,...p}=c;return Object.entries(p).every(h=>{let[m,_]=h;return Array.isArray(_)?_.includes({...i,...s}[m]):{...i,...s}[m]===_})?[...l,d,f]:l},[]);return QUe(e,a,u,r?.class,r?.className)};var bfe="-",N7t=e=>{let t=F7t(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{let s=a.split(bfe);return s[0]===""&&s.length!==1&&s.shift(),oze(s,t)||L7t(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},oze=(e,t)=>{if(e.length===0)return t.classGroupId;let r=e[0],n=t.nextPart.get(r),o=n?oze(e.slice(1),n):void 0;if(o)return o;if(t.validators.length===0)return;let i=e.join(bfe);return t.validators.find(({validator:a})=>a(i))?.classGroupId},eze=/^\[(.+)\]$/,L7t=e=>{if(eze.test(e)){let t=eze.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},F7t=e=>{let{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return B7t(Object.entries(e.classGroups),r).forEach(([i,a])=>{yfe(a,n,i,t)}),n},yfe=(e,t,r,n)=>{e.forEach(o=>{if(typeof o=="string"){let i=o===""?t:tze(t,o);i.classGroupId=r;return}if(typeof o=="function"){if(k7t(o)){yfe(o(n),t,r,n);return}t.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{yfe(a,tze(t,i),r,n)})})},tze=(e,t)=>{let r=e;return t.split(bfe).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},k7t=e=>e.isThemeGetter,B7t=(e,t)=>t?e.map(([r,n])=>{let o=n.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,s])=>[t+a,s])):i);return[r,o]}):e,$7t=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map,o=(i,a)=>{r.set(i,a),t++,t>e&&(t=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)}}},ize="!",q7t=e=>{let{separator:t,experimentalParseClassName:r}=e,n=t.length===1,o=t[0],i=t.length,a=s=>{let u=[],l=0,c=0,d;for(let _=0;_<s.length;_++){let g=s[_];if(l===0){if(g===o&&(n||s.slice(_,_+i)===t)){u.push(s.slice(c,_)),c=_+i;continue}if(g==="/"){d=_;continue}}g==="["?l++:g==="]"&&l--}let f=u.length===0?s:s.substring(c),p=f.startsWith(ize),h=p?f.substring(1):f,m=d&&d>c?d-c:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:m}};return r?s=>r({className:s,parseClassName:a}):a},U7t=e=>{if(e.length<=1)return e;let t=[],r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},z7t=e=>({cache:$7t(e.cacheSize),parseClassName:q7t(e),...N7t(e)}),H7t=/\s+/,V7t=(e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=t,i=[],a=e.trim().split(H7t),s="";for(let u=a.length-1;u>=0;u-=1){let l=a[u],{modifiers:c,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=r(l),h=!!p,m=n(h?f.substring(0,p):f);if(!m){if(!h){s=l+(s.length>0?" "+s:s);continue}if(m=n(f),!m){s=l+(s.length>0?" "+s:s);continue}h=!1}let _=U7t(c).join(":"),g=d?_+ize:_,v=g+m;if(i.includes(v))continue;i.push(v);let S=o(m,h);for(let x=0;x<S.length;++x){let O=S[x];i.push(g+O)}s=l+(s.length>0?" "+s:s)}return s};function W7t(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=aze(t))&&(n&&(n+=" "),n+=r);return n}var aze=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=aze(e[n]))&&(r&&(r+=" "),r+=t);return r};function rze(e,...t){let r,n,o,i=a;function a(u){let l=t.reduce((c,d)=>d(c),e());return r=z7t(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=V7t(u,r);return o(u,c),c}return function(){return i(W7t.apply(null,arguments))}}var wi=e=>{let t=r=>r[e]||[];return t.isThemeGetter=!0,t},sze=/^\[(?:([a-z-]+):)?(.+)\]$/i,J7t=/^\d+\/\d+$/,G7t=new Set(["px","full","screen"]),K7t=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Y7t=/\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$/,Z7t=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,X7t=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Q7t=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,KS=e=>Gj(e)||G7t.has(e)||J7t.test(e),nE=e=>Kj(e,"length",sYt),Gj=e=>!!e&&!Number.isNaN(Number(e)),gfe=e=>Kj(e,"number",Gj),vU=e=>!!e&&Number.isInteger(Number(e)),eYt=e=>e.endsWith("%")&&Gj(e.slice(0,-1)),Ir=e=>sze.test(e),oE=e=>K7t.test(e),tYt=new Set(["length","size","percentage"]),rYt=e=>Kj(e,tYt,uze),nYt=e=>Kj(e,"position",uze),oYt=new Set(["image","url"]),iYt=e=>Kj(e,oYt,lYt),aYt=e=>Kj(e,"",uYt),wU=()=>!0,Kj=(e,t,r)=>{let n=sze.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},sYt=e=>Y7t.test(e)&&!Z7t.test(e),uze=()=>!1,uYt=e=>X7t.test(e),lYt=e=>Q7t.test(e);var nze=()=>{let e=wi("colors"),t=wi("spacing"),r=wi("blur"),n=wi("brightness"),o=wi("borderColor"),i=wi("borderRadius"),a=wi("borderSpacing"),s=wi("borderWidth"),u=wi("contrast"),l=wi("grayscale"),c=wi("hueRotate"),d=wi("invert"),f=wi("gap"),p=wi("gradientColorStops"),h=wi("gradientColorStopPositions"),m=wi("inset"),_=wi("margin"),g=wi("opacity"),v=wi("padding"),S=wi("saturate"),x=wi("scale"),O=wi("sepia"),T=wi("skew"),E=wi("space"),M=wi("translate"),A=()=>["auto","contain","none"],j=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",Ir,t],F=()=>[Ir,t],k=()=>["",KS,nE],L=()=>["auto",Gj,Ir],q=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",Ir],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[Gj,Ir];return{cacheSize:500,separator:":",theme:{colors:[wU],spacing:[KS,nE],blur:["none","",oE,Ir],brightness:W(),borderColor:[e],borderRadius:["none","","full",oE,Ir],borderSpacing:F(),borderWidth:k(),contrast:W(),grayscale:D(),hueRotate:W(),invert:D(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[eYt,nE],inset:N(),margin:N(),opacity:W(),padding:F(),saturate:W(),scale:W(),sepia:D(),skew:W(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",Ir]}],container:["container"],columns:[{columns:[oE]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...q(),Ir]}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",vU,Ir]}],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",Ir]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",vU,Ir]}],"grid-cols":[{"grid-cols":[wU]}],"col-start-end":[{col:["auto",{span:["full",vU,Ir]},Ir]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[wU]}],"row-start-end":[{row:["auto",{span:[vU,Ir]},Ir]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ir]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ir]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...V()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...V(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...V(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[_]}],mx:[{mx:[_]}],my:[{my:[_]}],ms:[{ms:[_]}],me:[{me:[_]}],mt:[{mt:[_]}],mr:[{mr:[_]}],mb:[{mb:[_]}],ml:[{ml:[_]}],"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",Ir,t]}],"min-w":[{"min-w":[Ir,t,"min","max","fit"]}],"max-w":[{"max-w":[Ir,t,"none","full","min","max","fit","prose",{screen:[oE]},oE]}],h:[{h:[Ir,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ir,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ir,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ir,t,"auto","min","max","fit"]}],"font-size":[{text:["base",oE,nE]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",gfe]}],"font-family":[{font:[wU]}],"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",Ir]}],"line-clamp":[{"line-clamp":["none",Gj,gfe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",KS,Ir]}],"list-image":[{"list-image":["none",Ir]}],"list-style-type":[{list:["none","disc","decimal",Ir]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",KS,nE]}],"underline-offset":[{"underline-offset":["auto",KS,Ir]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ir]}],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",Ir]}],"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:[...q(),nYt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",rYt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},iYt]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:U()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[KS,Ir]}],"outline-w":[{outline:[KS,nE]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:k()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[KS,nE]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",oE,aYt]}],"shadow-color":[{shadow:[wU]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",oE,Ir]}],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",Ir]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",Ir]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ir]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[vU,Ir]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ir]}],accent:[{accent:["auto",e]}],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",Ir]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"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",Ir]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[KS,nE,gfe]}],stroke:[{stroke:[e,"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"]}}},cYt=(e,{cacheSize:t,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{SU(e,"cacheSize",t),SU(e,"prefix",r),SU(e,"separator",n),SU(e,"experimentalParseClassName",o);for(let s in a)dYt(e[s],a[s]);for(let s in i)fYt(e[s],i[s]);return e},SU=(e,t,r)=>{r!==void 0&&(e[t]=r)},dYt=(e,t)=>{if(t)for(let r in t)SU(e,r,t[r])},fYt=(e,t)=>{if(t)for(let r in t){let n=t[r];n!==void 0&&(e[r]=(e[r]||[]).concat(n))}},lze=(e,...t)=>typeof e=="function"?rze(nze,e,...t):rze(()=>cYt(nze(),e),...t);var pYt=lze({extend:{classGroups:{"text-color":["text-muted","text-success","text-warning","text-error","text-accent"],"font-size":["text-smallest","text-smaller","text-small","text-ui-smaller","text-ui-small","text-ui-medium","text-ui-larger"]}}});function _e(...e){return pYt(J9(e))}var hYt=Jj("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0",{variants:{variant:{default:"mod-cta bg-interactive-accent text-on-accent shadow hover:bg-interactive-accent-hover",destructive:"bg-modifier-error text-normal shadow-sm hover:bg-modifier-error/90",secondary:"bg-secondary text-normal shadow-sm hover:bg-interactive-hover",ghost:"clickable-icon bg-transparent hover:bg-interactive-accent hover:text-on-accent",link:"text-accent underline-offset-4 hover:underline",ghost2:"text-faint clickable-icon bg-transparent hover:bg-opacity-100 hover:text-normal hover:bg-transparent outline-none focus-visible:outline-none focus-visible:text-normal focus-visible:ring-0"},size:{default:"h-9 px-4 py-2",sm:"h-6 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"size-7",fit:"px-1 text-xs gap-1"}},defaultVariants:{variant:"default",size:"default"}}),qe=G9.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},i)=>G9.createElement(n?Sy:"button",{className:_e(hYt({variant:t,size:r,className:e})),ref:i,...o}));qe.displayName="Button";var Y9=B(Y());var cze=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K9=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();var xU=B(Y());var dze={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 fze=(0,xU.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,xU.createElement)("svg",{ref:u,...dze,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:K9("lucide",o),...s},[...a.map(([l,c])=>(0,xU.createElement)(l,c)),...Array.isArray(i)?i:[i]]));var be=(e,t)=>{let r=(0,Y9.forwardRef)(({className:n,...o},i)=>(0,Y9.createElement)(fze,{ref:i,iconNode:t,className:K9(`lucide-${cze(e)}`,n),...o}));return r.displayName=`${e}`,r};var Yj=be("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]]);var CU=be("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var EI=be("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 Xm=be("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var us=be("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var YS=be("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var PI=be("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var Hl=be("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 Qm=be("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var iE=be("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);var OU=be("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var EU=be("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 TI=be("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 ZS=be("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 MI=be("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);var PU=be("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 TU=be("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 MU=be("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 aE=be("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 sE=be("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 II=be("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 IU=be("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 XS=be("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 AU=be("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 RU=be("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 AI=be("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 DU=be("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 jU=be("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 RI=be("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 uE=be("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 NU=be("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 LU=be("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 FU=be("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 kU=be("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 QS=be("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 Uc=be("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);var BU=be("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 lE=be("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 Zj=be("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 Xj=be("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 ex=be("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var $U=be("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 qU=be("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 UU=be("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 xy=be("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 cE=be("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 yf=be("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 zU=be("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 HU=be("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 eg=be("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 yh=be("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 VU=be("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 DI=be("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 bh=be("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function mYt({onCancel:e}){let t=pe(),r=_fe(t.defaultModelKey)&&_fe(t.embeddingModelKey);return Cy.default.createElement("div",{className:"flex flex-col gap-4"},Cy.default.createElement("div",{className:"flex flex-col gap-2"},Cy.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&Cy.default.createElement("div",{className:"text-sm text-warning"},"The Copilot Plus exclusive models will stop working. You can switch to the default models in the Settings.")),Cy.default.createElement("div",{className:"flex gap-2 justify-end w-full"},Cy.default.createElement(qe,{variant:"ghost",onClick:e},"Close"),Cy.default.createElement(qe,{variant:"default",onClick:()=>{Qj(jO.EXPIRED_MODAL)}},"Renew Now ",Cy.default.createElement(II,{className:"size-4"}))))}var Z9=class extends pze.Modal{constructor(t){super(t),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:t}=this;this.root=(0,hze.createRoot)(t);let r=()=>{this.close()};this.root.render(Cy.default.createElement(mYt,{onCancel:r}))}onClose(){this.root.unmount()}};var or=class e extends Error{constructor(t,r){super(t),this.code=r,Object.setPrototypeOf(this,e.prototype)}};var Lgt=B(h4(),1);oh();KM();Lx();oh();lf();function Rf(e){return typeof e?.parse=="function"}function VZ(e,t){let r=typeof t=="number"?void 0:t;return{name:e.name,description:e.description,parameters:Li(e.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function sF(e,t){let r=typeof t=="number"?void 0:t,n;return yg(e)?n={type:"function",function:VZ(e)}:n=e,r?.strict!==void 0&&(n.function.strict=r.strict),n}function RNr(e){return e!==void 0&&Array.isArray(e.lc_namespace)}function DNr(e){return e!==void 0&&on.isRunnable(e)&&"lc_name"in e.constructor&&typeof e.constructor.lc_name=="function"&&e.constructor.lc_name()==="RunnableToolLike"}function jNr(e){return!!e&&typeof e=="object"&&"name"in e&&"schema"in e&&Rf(e.schema)}function yg(e){return jNr(e)||DNr(e)||RNr(e)}oh();KM();zD();m4();wO();lf();ly();YV();G$();var Qc=class e extends aF{constructor(t){super(t),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(t){let[r,n]=super._separateRunnableConfigFromCallOptions(t);return n.signal=r.signal,[r,n]}async invoke(t,r){let n=e._convertInputToPromptValue(t);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(t,r,n){throw new Error("Not implemented.")}async*_streamIterator(t,r){if(this._streamResponseChunks===e.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(t,r);else{let o=e._convertInputToPromptValue(t).toChatMessages(),[i,a]=this._separateRunnableConfigFromCallOptionsCompat(r),s={...i.metadata,...this.getLsParams(a)},u=await os.configure(i.callbacks,this.callbacks,i.tags,this.tags,s,this.metadata,{verbose:this.verbose}),l={options:a,invocation_params:this?.invocationParams(a),batch_size:1},c=await u?.handleChatModelStart(this.toJSON(),[o],i.runId,void 0,l,void 0,void 0,i.runName),d,f;try{for await(let p of this._streamResponseChunks(o,a,c?.[0])){if(p.message.id==null){let h=c?.at(0)?.runId;h!=null&&p.message._updateId(`run-${h}`)}p.message.response_metadata={...p.generationInfo,...p.message.response_metadata},yield p.message,d?d=d.concat(p):d=p,Vse(p.message)&&p.message.usage_metadata!==void 0&&(f={tokenUsage:{promptTokens:p.message.usage_metadata.input_tokens,completionTokens:p.message.usage_metadata.output_tokens,totalTokens:p.message.usage_metadata.total_tokens}})}}catch(p){throw await Promise.all((c??[]).map(h=>h?.handleLLMError(p))),p}await Promise.all((c??[]).map(p=>p?.handleLLMEnd({generations:[[d]],llmOutput:f})))}}getLsParams(t){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:t.stop,ls_provider:r}}async _generateUncached(t,r,n,o){let i=t.map(d=>d.map(Lm)),a;if(o!==void 0&&o.length===i.length)a=o;else{let d={...n.metadata,...this.getLsParams(r)},f=await os.configure(n.callbacks,this.callbacks,n.tags,this.tags,d,this.metadata,{verbose:this.verbose}),p={options:r,invocation_params:this?.invocationParams(r),batch_size:1};a=await f?.handleChatModelStart(this.toJSON(),i,n.runId,void 0,p,void 0,void 0,n.runName)}let s=[],u=[];if(!!a?.[0].handlers.find(Bse)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==e.prototype._streamResponseChunks)try{let d=await this._streamResponseChunks(i[0],r,a?.[0]),f,p;for await(let h of d){if(h.message.id==null){let m=a?.at(0)?.runId;m!=null&&h.message._updateId(`run-${m}`)}f===void 0?f=h:f=ul(f,h),Vse(h.message)&&h.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:h.message.usage_metadata.input_tokens,completionTokens:h.message.usage_metadata.output_tokens,totalTokens:h.message.usage_metadata.total_tokens}})}if(f===void 0)throw new Error("Received empty response from chat model call.");s.push([f]),await a?.[0].handleLLMEnd({generations:s,llmOutput:p})}catch(d){throw await a?.[0].handleLLMError(d),d}else{let d=await Promise.allSettled(i.map((f,p)=>this._generate(f,{...r,promptIndex:p},a?.[p])));await Promise.all(d.map(async(f,p)=>{if(f.status==="fulfilled"){let h=f.value;for(let m of h.generations){if(m.message.id==null){let _=a?.at(0)?.runId;_!=null&&m.message._updateId(`run-${_}`)}m.message.response_metadata={...m.generationInfo,...m.message.response_metadata}}return h.generations.length===1&&(h.generations[0].message.response_metadata={...h.llmOutput,...h.generations[0].message.response_metadata}),s[p]=h.generations,u[p]=h.llmOutput,a?.[p]?.handleLLMEnd({generations:[h.generations],llmOutput:h.llmOutput})}else return await a?.[p]?.handleLLMError(f.reason),Promise.reject(f.reason)}))}let c={generations:s,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(c,oq,{value:a?{runIds:a?.map(d=>d.runId)}:void 0,configurable:!0}),c}async _generateCached({messages:t,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i}){let a=t.map(_=>_.map(Lm)),s={...i.metadata,...this.getLsParams(o)},u=await os.configure(i.callbacks,this.callbacks,i.tags,this.tags,s,this.metadata,{verbose:this.verbose}),l={options:o,invocation_params:this?.invocationParams(o),batch_size:1},c=await u?.handleChatModelStart(this.toJSON(),a,i.runId,void 0,l,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(a.map(async(_,g)=>{let v=e._convertInputToPromptValue(_).toString(),S=await r.lookup(v,n);return S==null&&d.push(g),S}))).map((_,g)=>({result:_,runManager:c?.[g]})).filter(({result:_})=>_.status==="fulfilled"&&_.value!=null||_.status==="rejected"),h=[];await Promise.all(p.map(async({result:_,runManager:g},v)=>{if(_.status==="fulfilled"){let S=_.value;return h[v]=S.map(x=>("message"in x&&th(x.message)&&Bu(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(_.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(_.reason)}));let m={generations:h,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(m,oq,{value:c?{runIds:c?.map(_=>_.runId)}:void 0,configurable:!0}),m}async generate(t,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=t.map(h=>h.map(Lm)),[a,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(a.callbacks=a.callbacks??n,!this.cache)return this._generateUncached(i,s,a);let{cache:u}=this,l=this._getSerializedCacheKeyParametersForCall(s),{generations:c,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:u,llmStringKey:l,parsedOptions:s,handledOptions:a}),p={};if(d.length>0){let h=await this._generateUncached(d.map(m=>i[m]),s,a,f!==void 0?d.map(m=>f?.[m]):void 0);await Promise.all(h.generations.map(async(m,_)=>{let g=d[_];c[g]=m;let v=e._convertInputToPromptValue(i[g]).toString();return u.update(v,l,m)})),p=h.llmOutput??{}}return{generations:c,llmOutput:p}}invocationParams(t){return{}}_modelType(){return"base_chat_model"}serialize(){return{...this.invocationParams(),_type:this._llmType(),_model:this._modelType()}}async generatePrompt(t,r,n){let o=t.map(i=>i.toChatMessages());return this.generate(o,r,n)}async call(t,r,n){return(await this.generate([t.map(Lm)],r,n)).generations[0][0].message}async callPrompt(t,r,n){let o=t.toChatMessages();return this.call(o,r,n)}async predictMessages(t,r,n){return this.call(t,r,n)}async predict(t,r,n){let o=new Ua(t),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(t,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=t,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;Rf(n)?l=[{type:"function",function:{name:u,description:i,parameters:Li(n)}}]:("name"in n&&(u=n.name),l=[{type:"function",function:{name:u,description:i,parameters:n}}]);let c=this.bindTools(l),d=IS.from(m=>{if(!m.tool_calls||m.tool_calls.length===0)throw new Error("No tool calls found in the response.");let _=m.tool_calls.find(g=>g.name===u);if(!_)throw new Error(`No tool call found with name ${u}.`);return _.args});if(!s)return c.pipe(d).withConfig({runName:"StructuredOutput"});let f=Fi.assign({parsed:(m,_)=>d.invoke(m.raw,_)}),p=Fi.assign({parsed:()=>null}),h=f.withFallbacks({fallbacks:[p]});return Ha.from([{raw:c},h]).withConfig({runName:"StructuredOutputRunnable"})}};kh();zM();var rc=[];for(WZ=0;WZ<256;++WZ)rc.push((WZ+256).toString(16).slice(1));var WZ;function Rgt(e,t=0){return(rc[e[t+0]]+rc[e[t+1]]+rc[e[t+2]]+rc[e[t+3]]+"-"+rc[e[t+4]]+rc[e[t+5]]+"-"+rc[e[t+6]]+rc[e[t+7]]+"-"+rc[e[t+8]]+rc[e[t+9]]+"-"+rc[e[t+10]]+rc[e[t+11]]+rc[e[t+12]]+rc[e[t+13]]+rc[e[t+14]]+rc[e[t+15]]).toLowerCase()}var JZ,NNr=new Uint8Array(16);function LSe(){if(!JZ&&(JZ=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!JZ))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return JZ(NNr)}var LNr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),FSe={randomUUID:LNr};function FNr(e,t,r){if(FSe.randomUUID&&!t&&!e)return FSe.randomUUID();e=e||{};var n=e.random||(e.rng||LSe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=n[o];return t}return Rgt(n)}var kSe=FNr;function Dgt(e){let t=[],r=[];typeof e=="string"?r=[{output:e}]:e instanceof Map||typeof e=="object"&&e!==null&&!Array.isArray(e)?r=[e]:Array.isArray(e)||(r=[{output:e}]);for(let n of r)!(n instanceof Map)&&(typeof n!="object"||n===null)&&(n={output:n}),t.push(n);return t}function GZ(e,t){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=>Bu(i)&&i.tool_calls?i.tool_calls.map(a=>({name:a.name,parameters:a.args})):[];if(e._getType().toLowerCase()==="ai")return{role:r(e._getType()),message:n(e.content),toolCalls:o(e)};if(e._getType().toLowerCase()==="tool")return{role:r(e._getType()),message:n(e.content),toolResults:t};if(e._getType().toLowerCase()==="human"||e._getType().toLowerCase()==="system")return{role:r(e._getType()),message:n(e.content)};throw new Error("Got unknown message type. Supported types are AIMessage, ToolMessage, HumanMessage, and SystemMessage")}function BNr(e){return"name"in e&&"description"in e&&"parameterDefinitions"in e}function jgt(e){return e._getType()==="tool"}function Ngt(e){let t="properties"in e?e.properties:{},r="required"in e?e.required:[],n={};return Object.keys(t).forEach(o=>{n[o]=t[o],r===void 0&&(r=[]),n[o].required=r.includes(o)}),n}function $Nr(e){if(e){if(e.every(BNr))return e;if(e.every(vw))return e.map(t=>({name:t.function.name,description:t.function.description??"",parameterDefinitions:Ngt(t.function.parameters)}));if(e.every(yg))return e.map(t=>{let r=Li(t.schema);return{name:t.name,description:t.description??"",parameterDefinitions:Ngt(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var KZ=class extends Qc{static lc_name(){return"ChatCohere"}constructor(t){super(t??{}),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=t?.apiKey??At("COHERE_API_KEY");if(!r)throw new Error("No API key provided for ChatCohere.");this.client=new Lgt.CohereClient({token:r}),this.model=t?.model??this.model,this.temperature=t?.temperature??this.temperature,this.streaming=t?.streaming??this.streaming,this.streamUsage=t?.streamUsage??this.streamUsage}getLsParams(t){let r=this.invocationParams(t);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(t){if(t.tool_choice)throw new Error("'tool_choice' call option is not supported by ChatCohere.");let r={model:this.model,preamble:t.preamble,conversationId:t.conversationId,promptTruncation:t.promptTruncation,connectors:t.connectors,searchQueriesOnly:t.searchQueriesOnly,documents:t.documents,temperature:t.temperature??this.temperature,forceSingleStep:t.forceSingleStep,tools:t.tools};return Object.fromEntries(Object.entries(r).filter(([,n])=>n!==void 0))}bindTools(t,r){return this.bind({tools:$Nr(t),...r})}_getChatRequest(t,r){let n=this.invocationParams(r),o=this._messagesToCohereToolResultsCurrChatTurn(t),i=[],a="",s=[];if(n.forceSingleStep){a="";for(let l=0;l<t.length-1;l+=1){let c=t[l];if(!(Bu(c)&&c.tool_calls))if(c._getType().toLowerCase()==="tool"){if(s=s.concat(this._messageToCohereToolResults(t,l)),l===t.length-1||t[l+1]._getType().toLowerCase()!=="tool"){let d=GZ(c,s);i.push(d),s=[]}}else i.push(GZ(c,[]))}for(let l=t.length-1;l>=0;l-=1){let c=t[l];if(c._getType().toLowerCase()==="human"&&c.content){a=c.content.toString();break}}}else{for(let l=0;l<t.length-1;l+=1){let c=t[l];if(c._getType().toLowerCase()==="tool"){if(s=s.concat(this._messageToCohereToolResults(t,l)),l===t.length-1||t[l+1]._getType().toLowerCase()!=="tool"){let d=GZ(c,s);i.push(d),s=[]}}else i.push(GZ(c,[]))}a=o.length>0?"":t[t.length-1].content.toString()}return{message:a,chatHistory:i,toolResults:o.length>0?o:void 0,...n}}_getCurrChatTurnMessages(t){let r=[];for(let n=t.length-1;n>=0;n-=1){let o=t[n];if(r.push(o),o._getType().toLowerCase()==="human")break}return r.reverse()}_messagesToCohereToolResultsCurrChatTurn(t){let r=[],n=this._getCurrChatTurnMessages(t);for(let o of n)if(jgt(o)){let i=o,a=n.filter(s=>Bu(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:Dgt(i.content)})))}}return r}_messageToCohereToolResults(t,r){let n=[],o=t[r];if(!jgt(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=t.slice(0,r).filter(s=>Bu(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:Dgt(o.content)}))),n}_formatCohereToolCalls(t=null){if(!t)return[];let r=[];for(let n of t)r.push({id:kSe().substring(0,32),function:{name:n.name,arguments:n.parameters},type:"function"});return r}_convertCohereToolCallToLangchain(t){return t.map(r=>({name:r.function.name,args:r.function.arguments,id:r.id,type:"tool_call"}))}async _generate(t,r,n){let o={},i=this._getChatRequest(t,r);if(this.streaming){let c=this._streamResponseChunks(t,r,n),d={};for await(let p of c){let h=p.generationInfo?.completion??0;d[h]===void 0?d[h]=p:d[h]=d[h].concat(p)}return{generations:Object.entries(d).sort(([p],[h])=>parseInt(p,10)-parseInt(h,10)).map(([p,h])=>h),llmOutput:{estimatedTokenUsage:o}}}let a=await this.caller.callWithOptions({signal:r.signal},async()=>{let c;try{c=await this.client.chat(i)}catch(d){throw d.status=d.status??d.statusCode,d}return c});if(a.meta?.tokens){let{inputTokens:c,outputTokens:d}=a.meta.tokens;d&&(o.completionTokens=(o.completionTokens??0)+d),c&&(o.promptTokens=(o.promptTokens??0)+c),o.totalTokens=(o.totalTokens??0)+(o.promptTokens??0)+(o.completionTokens??0)}let s={...a};delete s.text,a.toolCalls&&a.toolCalls.length>0&&(s.toolCalls=this._formatCohereToolCalls(a.toolCalls));let u=[];return"toolCalls"in s&&(u=this._convertCohereToolCallToLangchain(s.toolCalls)),{generations:[{text:a.text,message:new Po({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(t,r,n){let o=this._getChatRequest(t,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 ii({text:a.text,message:new Gr({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new ii({text:"",message:new Gr({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 ii({text:"",message:new Gr({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(...t){return t.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 qNr=B(h4(),1);KM();zD();wO();m4();ly();G$();var kgt=B(h4(),1);HD();var Cp=class{constructor(t){Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.caller=new rp(t??{})}};var bg=(e,t)=>e.reduce((r,n,o)=>{let i=Math.floor(o/t),a=r[i]||[];return r[i]=a.concat([n]),r},[]);var YZ=class extends Cp{constructor(t){let r={maxConcurrency:2,...t};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||At("COHERE_API_KEY");if(!n)throw new Error("Cohere API key not found");if(this.client=new kgt.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(t){let r=bg(t,this.batchSize),n=r.map(a=>this.embeddingWithRetry({model:this.model,texts:a,inputType:"search_document",embeddingTypes:this.embeddingTypes})),o=await Promise.all(n),i=[];for(let a=0;a<o.length;a+=1){let s=r[a],{embeddings:u}=o[a];for(let l=0;l<s.length;l+=1)"float"in u&&u.float?i.push(u.float[l]):Array.isArray(u)&&i.push(u[l])}return i}async embedQuery(t){let{embeddings:r}=await this.embeddingWithRetry({model:this.model,texts:[t],inputType:"search_query",embeddingTypes:this.embeddingTypes});if("float"in r&&r.float)return r.float[0];if(Array.isArray(r))return r[0];throw new Error(`Invalid response from Cohere API. Received: ${JSON.stringify(r,null,2)}`)}async embed(t){let{embeddings:r}=await this.embeddingWithRetry(t);if("float"in r&&r.float)return r.float[0];if(Array.isArray(r))return r[0];throw new Error(`Invalid response from Cohere API. Received: ${JSON.stringify(r,null,2)}`)}async embeddingWithRetry(t){return this.caller.call(async()=>{let r;try{r=await this.client.embed(t)}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 UNr=B(h4(),1);var Bgt;(function(e){e.STRING="string",e.NUMBER="number",e.INTEGER="integer",e.BOOLEAN="boolean",e.ARRAY="array",e.OBJECT="object"})(Bgt||(Bgt={}));var $gt;(function(e){e.LANGUAGE_UNSPECIFIED="language_unspecified",e.PYTHON="python"})($gt||($gt={}));var qgt;(function(e){e.OUTCOME_UNSPECIFIED="outcome_unspecified",e.OUTCOME_OK="outcome_ok",e.OUTCOME_FAILED="outcome_failed",e.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(qgt||(qgt={}));var Ugt=["user","model","function","system"],QA;(function(e){e.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",e.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",e.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",e.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",e.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT"})(QA||(QA={}));var eR;(function(e){e.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",e.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",e.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",e.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",e.BLOCK_NONE="BLOCK_NONE"})(eR||(eR={}));var zgt;(function(e){e.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",e.NEGLIGIBLE="NEGLIGIBLE",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(zgt||(zgt={}));var Hgt;(function(e){e.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",e.SAFETY="SAFETY",e.OTHER="OTHER"})(Hgt||(Hgt={}));var g4;(function(e){e.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",e.STOP="STOP",e.MAX_TOKENS="MAX_TOKENS",e.SAFETY="SAFETY",e.RECITATION="RECITATION",e.LANGUAGE="LANGUAGE",e.OTHER="OTHER"})(g4||(g4={}));var Vgt;(function(e){e.TASK_TYPE_UNSPECIFIED="TASK_TYPE_UNSPECIFIED",e.RETRIEVAL_QUERY="RETRIEVAL_QUERY",e.RETRIEVAL_DOCUMENT="RETRIEVAL_DOCUMENT",e.SEMANTIC_SIMILARITY="SEMANTIC_SIMILARITY",e.CLASSIFICATION="CLASSIFICATION",e.CLUSTERING="CLUSTERING"})(Vgt||(Vgt={}));var tR;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.AUTO="AUTO",e.ANY="ANY",e.NONE="NONE"})(tR||(tR={}));var Wgt;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.MODE_DYNAMIC="MODE_DYNAMIC"})(Wgt||(Wgt={}));var ed=class extends Error{constructor(t){super(`[GoogleGenerativeAI Error]: ${t}`)}},yP=class extends ed{constructor(t,r){super(t),this.response=r}},XZ=class extends ed{constructor(t,r,n,o){super(t),this.status=r,this.statusText=n,this.errorDetails=o}},ww=class extends ed{};var zNr="https://generativelanguage.googleapis.com",HNr="v1beta",VNr="0.21.0",WNr="genai-js",rR;(function(e){e.GENERATE_CONTENT="generateContent",e.STREAM_GENERATE_CONTENT="streamGenerateContent",e.COUNT_TOKENS="countTokens",e.EMBED_CONTENT="embedContent",e.BATCH_EMBED_CONTENTS="batchEmbedContents"})(rR||(rR={}));var BSe=class{constructor(t,r,n,o,i){this.model=t,this.task=r,this.apiKey=n,this.stream=o,this.requestOptions=i}toString(){var t,r;let n=((t=this.requestOptions)===null||t===void 0?void 0:t.apiVersion)||HNr,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||zNr}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};function JNr(e){let t=[];return e?.apiClient&&t.push(e.apiClient),t.push(`${WNr}/${VNr}`),t.join(" ")}async function GNr(e){var t;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",JNr(e.requestOptions)),r.append("x-goog-api-key",e.apiKey);let n=(t=e.requestOptions)===null||t===void 0?void 0:t.customHeaders;if(n){if(!(n instanceof Headers))try{n=new Headers(n)}catch(o){throw new ww(`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 ww(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new ww(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function KNr(e,t,r,n,o,i){let a=new BSe(e,t,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},QNr(i)),{method:"POST",headers:await GNr(a),body:o})}}async function _4(e,t,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await KNr(e,t,r,n,o,i);return YNr(s,u,a)}async function YNr(e,t,r=fetch){let n;try{n=await r(e,t)}catch(o){ZNr(o,e)}return n.ok||await XNr(n,e),n}function ZNr(e,t){let r=e;throw e instanceof XZ||e instanceof ww||(r=new ed(`Error fetching from ${t.toString()}: ${e.message}`),r.stack=e.stack),r}async function XNr(e,t){let r="",n;try{let o=await e.json();r=o.error.message,o.error.details&&(r+=` ${JSON.stringify(o.error.details)}`,n=o.error.details)}catch{}throw new XZ(`Error fetching from ${t.toString()}: [${e.status} ${e.statusText}] ${r}`,e.status,e.statusText,n)}function QNr(e){let t={};if(e?.signal!==void 0||e?.timeout>=0){let r=new AbortController;e?.timeout>=0&&setTimeout(()=>r.abort(),e.timeout),e?.signal&&e.signal.addEventListener("abort",()=>{r.abort()}),t.signal=r.signal}return t}function qSe(e){return e.text=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),ZZ(e.candidates[0]))throw new yP(`${bP(e)}`,e);return eLr(e)}else if(e.promptFeedback)throw new yP(`Text not available. ${bP(e)}`,e);return""},e.functionCall=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),ZZ(e.candidates[0]))throw new yP(`${bP(e)}`,e);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),Jgt(e)[0]}else if(e.promptFeedback)throw new yP(`Function call not available. ${bP(e)}`,e)},e.functionCalls=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),ZZ(e.candidates[0]))throw new yP(`${bP(e)}`,e);return Jgt(e)}else if(e.promptFeedback)throw new yP(`Function call not available. ${bP(e)}`,e)},e}function eLr(e){var t,r,n,o;let i=[];if(!((r=(t=e.candidates)===null||t===void 0?void 0:t[0].content)===null||r===void 0)&&r.parts)for(let a of(o=(n=e.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 Jgt(e){var t,r,n,o;let i=[];if(!((r=(t=e.candidates)===null||t===void 0?void 0:t[0].content)===null||r===void 0)&&r.parts)for(let a of(o=(n=e.candidates)===null||n===void 0?void 0:n[0].content)===null||o===void 0?void 0:o.parts)a.functionCall&&i.push(a.functionCall);if(i.length>0)return i}var tLr=[g4.RECITATION,g4.SAFETY,g4.LANGUAGE];function ZZ(e){return!!e.finishReason&&tLr.includes(e.finishReason)}function bP(e){var t,r,n;let o="";if((!e.candidates||e.candidates.length===0)&&e.promptFeedback)o+="Response was blocked",!((t=e.promptFeedback)===null||t===void 0)&&t.blockReason&&(o+=` due to ${e.promptFeedback.blockReason}`),!((r=e.promptFeedback)===null||r===void 0)&&r.blockReasonMessage&&(o+=`: ${e.promptFeedback.blockReasonMessage}`);else if(!((n=e.candidates)===null||n===void 0)&&n[0]){let i=e.candidates[0];ZZ(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function y4(e){return this instanceof y4?(this.v=e,this):new y4(e)}function rLr(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof y4?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){s("next",f)}function c(f){s("throw",f)}function d(f,p){f(p),i.shift(),i.length&&s(i[0][0],i[0][1])}}var Ggt=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;function nLr(e){let t=e.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=aLr(t),[n,o]=r.tee();return{stream:iLr(n),response:oLr(o)}}async function oLr(e){let t=[],r=e.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return qSe(sLr(t));t.push(o)}}function iLr(e){return rLr(this,arguments,function*(){let r=e.getReader();for(;;){let{value:n,done:o}=yield y4(r.read());if(o)break;yield yield y4(qSe(n))}})}function aLr(e){let t=e.getReader();return new ReadableStream({start(n){let o="";return i();function i(){return t.read().then(({value:a,done:s})=>{if(s){if(o.trim()){n.error(new ed("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(Ggt),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new ed(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(Ggt)}return i()})}}})}function sLr(e){let t=e[e.length-1],r={promptFeedback:t?.promptFeedback};for(let n of e){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 Xgt(e,t,r,n){let o=await _4(t,rR.STREAM_GENERATE_CONTENT,e,!0,JSON.stringify(r),n);return nLr(o)}async function Qgt(e,t,r,n){let i=await(await _4(t,rR.GENERATE_CONTENT,e,!1,JSON.stringify(r),n)).json();return{response:qSe(i)}}function eyt(e){if(e!=null){if(typeof e=="string")return{role:"system",parts:[{text:e}]};if(e.text)return{role:"system",parts:[e]};if(e.parts)return e.role?e:{role:"system",parts:e.parts}}}function b4(e){let t=[];if(typeof e=="string")t=[{text:e}];else for(let r of e)typeof r=="string"?t.push({text:r}):t.push(r);return uLr(t)}function uLr(e){let t={role:"user",parts:[]},r={role:"function",parts:[]},n=!1,o=!1;for(let i of e)"functionResponse"in i?(r.parts.push(i),o=!0):(t.parts.push(i),n=!0);if(n&&o)throw new ed("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 ed("No content is provided for sending chat message.");return n?t:r}function lLr(e,t){var r;let n={model:t?.model,generationConfig:t?.generationConfig,safetySettings:t?.safetySettings,tools:t?.tools,toolConfig:t?.toolConfig,systemInstruction:t?.systemInstruction,cachedContent:(r=t?.cachedContent)===null||r===void 0?void 0:r.name,contents:[]},o=e.generateContentRequest!=null;if(e.contents){if(o)throw new ww("CountTokensRequest must have one of contents or generateContentRequest, not both.");n.contents=e.contents}else if(o)n=Object.assign(Object.assign({},n),e.generateContentRequest);else{let i=b4(e);n.contents=[i]}return{generateContentRequest:n}}function Kgt(e){let t;return e.contents?t=e:t={contents:[b4(e)]},e.systemInstruction&&(t.systemInstruction=eyt(e.systemInstruction)),t}function cLr(e){return typeof e=="string"||Array.isArray(e)?{content:b4(e)}:e}var Ygt=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],dLr={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};function fLr(e){let t=!1;for(let r of e){let{role:n,parts:o}=r;if(!t&&n!=="user")throw new ed(`First content should be with role 'user', got ${n}`);if(!Ugt.includes(n))throw new ed(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(Ugt)}`);if(!Array.isArray(o))throw new ed("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new ed("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 Ygt)u in s&&(i[u]+=1);let a=dLr[n];for(let s of Ygt)if(!a.includes(s)&&i[s]>0)throw new ed(`Content with role '${n}' can't contain '${s}' part`);t=!0}}var Zgt="SILENT_ERROR",$Se=class{constructor(t,r,n,o={}){this.model=r,this.params=n,this._requestOptions=o,this._history=[],this._sendPromise=Promise.resolve(),this._apiKey=t,n?.history&&(fLr(n.history),this._history=n.history)}async getHistory(){return await this._sendPromise,this._history}async sendMessage(t,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=b4(t),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(()=>Qgt(this._apiKey,this.model,c,d)).then(p=>{var h;if(p.response.candidates&&p.response.candidates.length>0){this._history.push(l);let m=Object.assign({parts:[],role:"model"},(h=p.response.candidates)===null||h===void 0?void 0:h[0].content);this._history.push(m)}else{let m=bP(p.response);m&&console.warn(`sendMessage() was unsuccessful. ${m}. Inspect response object for details.`)}f=p}),await this._sendPromise,f}async sendMessageStream(t,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=b4(t),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=Xgt(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(Zgt)}).then(p=>p.response).then(p=>{if(p.candidates&&p.candidates.length>0){this._history.push(l);let h=Object.assign({},p.candidates[0].content);h.role||(h.role="model"),this._history.push(h)}else{let h=bP(p);h&&console.warn(`sendMessageStream() was unsuccessful. ${h}. Inspect response object for details.`)}}).catch(p=>{p.message!==Zgt&&console.error(p)}),f}};async function pLr(e,t,r,n){return(await _4(t,rR.COUNT_TOKENS,e,!1,JSON.stringify(r),n)).json()}async function hLr(e,t,r,n){return(await _4(t,rR.EMBED_CONTENT,e,!1,JSON.stringify(r),n)).json()}async function mLr(e,t,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:t}));return(await _4(t,rR.BATCH_EMBED_CONTENTS,e,!1,JSON.stringify({requests:o}),n)).json()}var QZ=class{constructor(t,r,n={}){this.apiKey=t,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=eyt(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(t,r={}){var n;let o=Kgt(t),i=Object.assign(Object.assign({},this._requestOptions),r);return Qgt(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(t,r={}){var n;let o=Kgt(t),i=Object.assign(Object.assign({},this._requestOptions),r);return Xgt(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(t){var r;return new $Se(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},t),this._requestOptions)}async countTokens(t,r={}){let n=lLr(t,{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 pLr(this.apiKey,this.model,n,o)}async embedContent(t,r={}){let n=cLr(t),o=Object.assign(Object.assign({},this._requestOptions),r);return hLr(this.apiKey,this.model,n,o)}async batchEmbedContents(t,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return mLr(this.apiKey,this.model,t,n)}};var nR=class{constructor(t){this.apiKey=t}getGenerativeModel(t,r){if(!t.model)throw new ed("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new QZ(this.apiKey,t,r)}getGenerativeModelFromCachedContent(t,r,n){if(!t.name)throw new ww("Cached content must contain a `name` field.");if(!t.model)throw new ww("Cached content must contain a `model` field.");let o=["model","systemInstruction"];for(let a of o)if(r?.[a]&&t[a]&&r?.[a]!==t[a]){if(a==="model"){let s=r.model.startsWith("models/")?r.model.replace("models/",""):r.model,u=t.model.startsWith("models/")?t.model.replace("models/",""):t.model;if(s===u)continue}throw new ww(`Different value for "${a}" specified in modelParams (${r[a]}) and cachedContent (${t[a]})`)}let i=Object.assign(Object.assign({},r),{model:t.model,tools:t.tools,toolConfig:t.toolConfig,systemInstruction:t.systemInstruction,cachedContent:t});return new QZ(this.apiKey,i,n)}};jS();oh();function uF(e){if(typeof e=="object"&&e!==null){let t={...e};"additionalProperties"in t&&delete t.additionalProperties,"$schema"in t&&delete t.$schema;for(let r in t)r in t&&(Array.isArray(t[r])?t[r]=t[r].map(uF):typeof t[r]=="object"&&t[r]!==null&&(t[r]=uF(t[r])));return t}return e}function eX(e){let t=uF(Li(e)),{$schema:r,...n}=t;return n}function tyt(e){let t=uF(e),{$schema:r,...n}=t;return n}kh();Lx();function gLr(e){let t=e._getType();return xd.isInstance(e)?e.role:t==="tool"?t:e.name??t}function yLr(e){switch(e){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: ${e}`)}}function bLr(e){if("mimeType"in e&&"data"in e)return{inlineData:{mimeType:e.mimeType,data:e.data}};throw new Error("Invalid media content")}function _Lr(e,t){if(typeof e.content=="string"&&e.content!=="")return[{text:e.content}];let r=[],n=[],o=[];return"tool_calls"in e&&Array.isArray(e.tool_calls)&&e.tool_calls.length>0?r=e.tool_calls.map(i=>({functionCall:{name:i.name,args:i.args}})):e.getType()==="tool"&&e.name&&e.content?n=[{functionResponse:{name:e.name,response:e.content}}]:Array.isArray(e.content)&&(o=e.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(!t)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 bLr(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 USe(e,t,r=!1){return e.reduce((n,o,i)=>{if(!th(o))throw new Error("Unsupported message input");let a=gLr(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=yLr(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=_Lr(o,t);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 ryt(e,t){if(!e.candidates||e.candidates.length===0||!e.candidates[0])return{generations:[],llmOutput:{filters:e.promptFeedback}};let r=e.functionCalls(),[n]=e.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 Po({content:a,tool_calls:r?.map(l=>({...l,type:"tool_call"})),additional_kwargs:{...i},usage_metadata:t?.usageMetadata}),generationInfo:i}]}}function nyt(e,t){if(!e.candidates||e.candidates.length===0)return null;let r=e.functionCalls(),[n]=e.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:t.index,type:"tool_call_chunk"}))),new ii({text:s,message:new Gr({content:a||"",name:o?o.role:void 0,tool_call_chunks:u,additional_kwargs:{},usage_metadata:t.usageMetadata}),generationInfo:i})}function oyt(e){return e.every(t=>"functionDeclarations"in t&&Array.isArray(t.functionDeclarations))?e:[{functionDeclarations:e.map(t=>{if(yg(t)){let r=eX(t.schema);return{name:t.name,description:t.description,parameters:r}}return vw(t)?{name:t.function.name,description:t.function.description??"A function available to call.",parameters:tyt(t.function.parameters)}:t})}]}OO();var v4=class extends YM{static lc_name(){return"GoogleGenerativeAIToolsOutputParser"}constructor(t){super(t),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=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){if(this.zodSchema===void 0)return t;let r=await this.zodSchema.safeParseAsync(t);if(r.success)return r.data;throw new np(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(r.error.errors)}`,JSON.stringify(t,null,2))}async parseResult(t){let r=t.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)}};Lx();function zSe(e,t){let r=vLr(e),n=SLr(r,t);return{tools:r,toolConfig:n}}function vLr(e){let t=[],r=[];return e.forEach(o=>{if(yg(o)){let[i]=oyt([o]);i.functionDeclarations&&t.push(...i.functionDeclarations)}else if(vw(o)){let{functionDeclarations:i}=wLr(o);if(i)t.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(t?.length>0&&"functionDeclarations"in o){let i={functionDeclarations:[...o.functionDeclarations||[],...t]};return t=[],i}return o}):[...r,...t.length>0?[{functionDeclarations:t}]:[]]}function wLr(e){return{functionDeclarations:[{name:e.function.name,description:e.function.description,parameters:uF(e.function.parameters)}]}}function SLr(e,t){if(!e.length||!t)return;let{toolChoice:r,allowedFunctionNames:n}=t,o={any:tR.ANY,auto:tR.AUTO,none:tR.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:tR.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var tX=class extends Qc{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(t){if(super(t??{}),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=t?.model?.replace(/^models\//,"")??t?.modelName?.replace(/^models\//,"")??this.model,this.model=this.modelName,this.maxOutputTokens=t?.maxOutputTokens??this.maxOutputTokens,this.maxOutputTokens&&this.maxOutputTokens<0)throw new Error("`maxOutputTokens` must be a positive integer");if(this.temperature=t?.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=t?.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=t?.topK??this.topK,this.topK&&this.topK<0)throw new Error("`topK` must be a positive integer");if(this.stopSequences=t?.stopSequences??this.stopSequences,this.apiKey=t?.apiKey??At("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=t?.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=t?.streaming??this.streaming,this.client=new nR(this.apiKey).getGenerativeModel({model:this.model,safetySettings:this.safetySettings,generationConfig:{candidateCount:1,stopSequences:this.stopSequences,maxOutputTokens:this.maxOutputTokens,temperature:this.temperature,topP:this.topP,topK:this.topK,...t?.json?{responseMimeType:"application/json"}:{}}},{apiVersion:t?.apiVersion,baseUrl:t?.baseUrl}),this.streamUsage=t?.streamUsage??this.streamUsage}useCachedContent(t,r,n){this.apiKey&&(this.client=new nR(this.apiKey).getGenerativeModelFromCachedContent(t,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(t){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:t.stop}}_combineLLMOutput(){return[]}_llmType(){return"googlegenerativeai"}bindTools(t,r){return this.bind({tools:zSe(t)?.tools,...r})}invocationParams(t){let r=t?.tools?.length?zSe(t.tools,{toolChoice:t.tool_choice,allowedFunctionNames:t.allowedFunctionNames}):void 0;return{...r?.tools?{tools:r.tools}:{},...r?.toolConfig?{toolConfig:r.toolConfig}:{}}}async _generate(t,r,n){let o=USe(t,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(t,r,n),f={};for await(let h of d){let m=h.generationInfo?.completion??0;f[m]===void 0?f[m]=h:f[m]=f[m].concat(h)}return{generations:Object.entries(f).sort(([h],[m])=>parseInt(h,10)-parseInt(m,10)).map(([h,m])=>m),llmOutput:{estimatedTokenUsage:c}}}let s=await this.completionWithRetry({...a,contents:i}),u;if("usageMetadata"in s.response){let c=s.response.usageMetadata;u={input_tokens:c.promptTokenCount??0,output_tokens:c.candidatesTokenCount??0,total_tokens:c.totalTokenCount??0}}let l=ryt(s.response,{usageMetadata:u});return await n?.handleLLMNewToken(l.generations[0].text??""),l}async*_streamResponseChunks(t,r,n){let o=USe(t,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[d]=o;this.client.systemInstruction=d,i=o.slice(1)}let s={...this.invocationParams(r),contents:i},u=await this.caller.callWithOptions({signal:r?.signal},async()=>{let{stream:d}=await this.client.generateContentStream(s);return d}),l,c=0;for await(let d of u){if("usageMetadata"in d&&this.streamUsage!==!1&&r.streamUsage!==!1){let p=d.usageMetadata;if(!l)l={input_tokens:p.promptTokenCount,output_tokens:p.candidatesTokenCount,total_tokens:p.totalTokenCount};else{let h=p.candidatesTokenCount-l.output_tokens;l={input_tokens:0,output_tokens:h,total_tokens:h}}}let f=nyt(d,{usageMetadata:l,index:c});c+=1,f&&(yield f,await n?.handleLLMNewToken(f.text??""))}}async completionWithRetry(t,r){return this.caller.callWithOptions({signal:r?.signal},async()=>{try{return await this.client.generateContent(t)}catch(n){throw n.message?.includes("400 Bad Request")&&(n.status=400),n}})}withStructuredOutput(t,r){let n=t,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(Rf(n)){let h=eX(n);l=[{functionDeclarations:[{name:s,description:h.description??"A function available to call.",parameters:h}]}],u=new v4({returnSingle:!0,keyName:s,zodSchema:n})}else{let h;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(h=n,s=n.name):h={name:s,description:n.description??"",parameters:n},l=[{functionDeclarations:[h]}],u=new v4({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:s});if(!a)return c.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let d=Fi.assign({parsed:(h,m)=>u.invoke(h.raw,m)}),f=Fi.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return Ha.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}};var rX=class extends Cp{constructor(t){if(super(t??{}),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=t?.model?.replace(/^models\//,"")??t?.modelName?.replace(/^models\//,"")??this.modelName,this.model=this.modelName,this.taskType=t?.taskType??this.taskType,this.title=t?.title??this.title,this.title&&this.taskType!=="RETRIEVAL_DOCUMENT")throw new Error("title can only be sepcified with TaskType.RETRIEVAL_DOCUMENT");if(this.apiKey=t?.apiKey??At("GOOGLE_API_KEY"),!this.apiKey)throw new Error("Please set an API key for Google GenerativeAI in the environmentb variable GOOGLE_API_KEY or in the `apiKey` field of the GoogleGenerativeAIEmbeddings constructor");this.client=new nR(this.apiKey).getGenerativeModel({model:this.model})}_convertToContent(t){return{content:{role:"user",parts:[{text:this.stripNewLines?t.replace(/\n/g," "):t}]},taskType:this.taskType,title:this.title}}async _embedQueryContent(t){let r=this._convertToContent(t);return(await this.client.embedContent(r)).embedding.values??[]}async _embedDocumentsContent(t){let r=bg(t,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(t){return this.caller.call(this._embedQueryContent.bind(this),t)}embedDocuments(t){return this.caller.call(this._embedDocumentsContent.bind(this),t)}};var nc=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},Bd={searchParams:"URLSearchParams"in nc,iterable:"Symbol"in nc&&"iterator"in Symbol,blob:"FileReader"in nc&&"Blob"in nc&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in nc,arrayBuffer:"ArrayBuffer"in nc};function xLr(e){return e&&DataView.prototype.isPrototypeOf(e)}Bd.arrayBuffer&&(iyt=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],syt=ArrayBuffer.isView||function(e){return e&&iyt.indexOf(Object.prototype.toString.call(e))>-1});var iyt,syt;function lF(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function VSe(e){return typeof e!="string"&&(e=String(e)),e}function WSe(e){var t={next:function(){var r=e.shift();return{done:r===void 0,value:r}}};return Bd.iterable&&(t[Symbol.iterator]=function(){return t}),t}function Gu(e){this.map={},e instanceof Gu?e.forEach(function(t,r){this.append(r,t)},this):Array.isArray(e)?e.forEach(function(t){if(t.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}Gu.prototype.append=function(e,t){e=lF(e),t=VSe(t);var r=this.map[e];this.map[e]=r?r+", "+t:t};Gu.prototype.delete=function(e){delete this.map[lF(e)]};Gu.prototype.get=function(e){return e=lF(e),this.has(e)?this.map[e]:null};Gu.prototype.has=function(e){return this.map.hasOwnProperty(lF(e))};Gu.prototype.set=function(e,t){this.map[lF(e)]=VSe(t)};Gu.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)};Gu.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),WSe(e)};Gu.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),WSe(e)};Gu.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),WSe(e)};Bd.iterable&&(Gu.prototype[Symbol.iterator]=Gu.prototype.entries);function HSe(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}}function uyt(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function CLr(e){var t=new FileReader,r=uyt(t);return t.readAsArrayBuffer(e),r}function OLr(e){var t=new FileReader,r=uyt(t),n=/charset=([A-Za-z0-9_-]+)/.exec(e.type),o=n?n[1]:"utf-8";return t.readAsText(e,o),r}function ELr(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}function ayt(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function lyt(){return this.bodyUsed=!1,this._initBody=function(e){this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:Bd.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:Bd.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:Bd.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():Bd.arrayBuffer&&Bd.blob&&xLr(e)?(this._bodyArrayBuffer=ayt(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Bd.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||syt(e))?this._bodyArrayBuffer=ayt(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):Bd.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Bd.blob&&(this.blob=function(){var e=HSe(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=HSe(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(Bd.blob)return this.blob().then(CLr);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var e=HSe(this);if(e)return e;if(this._bodyBlob)return OLr(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(ELr(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Bd.formData&&(this.formData=function(){return this.text().then(MLr)}),this.json=function(){return this.text().then(JSON.parse)},this}var PLr=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function TLr(e){var t=e.toUpperCase();return PLr.indexOf(t)>-1?t:e}function iR(e,t){if(!(this instanceof iR))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var r=t.body;if(e instanceof iR){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new Gu(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!r&&e._bodyInit!=null&&(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new Gu(t.headers)),this.method=TLr(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in nc){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")&&(t.cache==="no-store"||t.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()}}}iR.prototype.clone=function(){return new iR(this,{body:this._bodyInit})};function MLr(e){var t=new FormData;return e.trim().split("&").forEach(function(r){if(r){var n=r.split("="),o=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(o),decodeURIComponent(i))}}),t}function ILr(e){var t=new Gu,r=e.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{t.append(i,a)}catch(s){console.warn("Response "+s.message)}}}),t}lyt.call(iR.prototype);function Sw(e,t){if(!(this instanceof Sw))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=t.status===void 0?200:t.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=t.statusText===void 0?"":""+t.statusText,this.headers=new Gu(t.headers),this.url=t.url||"",this._initBody(e)}lyt.call(Sw.prototype);Sw.prototype.clone=function(){return new Sw(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Gu(this.headers),url:this.url})};Sw.error=function(){var e=new Sw(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var ALr=[301,302,303,307,308];Sw.redirect=function(e,t){if(ALr.indexOf(t)===-1)throw new RangeError("Invalid status code");return new Sw(null,{status:t,headers:{location:e}})};var oR=nc.DOMException;try{new oR}catch{oR=function(t,r){this.message=t,this.name=r;var n=Error(t);this.stack=n.stack},oR.prototype=Object.create(Error.prototype),oR.prototype.constructor=oR}function cyt(e,t){return new Promise(function(r,n){var o=new iR(e,t);if(o.signal&&o.signal.aborted)return n(new oR("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:ILr(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 Sw(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 oR("Aborted","AbortError"))},0)};function s(l){try{return l===""&&nc.location.href?nc.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&&(Bd.blob?i.responseType="blob":Bd.arrayBuffer&&(i.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof Gu||nc.Headers&&t.headers instanceof nc.Headers)){var u=[];Object.getOwnPropertyNames(t.headers).forEach(function(l){u.push(lF(l)),i.setRequestHeader(l,VSe(t.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)})}cyt.polyfill=!0;nc.fetch||(nc.fetch=cyt,nc.Headers=Gu,nc.Request=iR,nc.Response=Sw);var RLr="0.5.9",DLr=Object.defineProperty,jLr=(e,t,r)=>t in e?DLr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,JSe=(e,t,r)=>(jLr(e,typeof t!="symbol"?t+"":t,r),r),KSe=class e extends Error{constructor(t,r){super(t),this.error=t,this.status_code=r,this.name="ResponseError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}},YSe=class{constructor(t,r,n){JSe(this,"abortController"),JSe(this,"itr"),JSe(this,"doneCallback"),this.abortController=t,this.itr=r,this.doneCallback=n}abort(){this.abortController.abort()}async*[Symbol.asyncIterator](){for await(let t of this.itr){if("error"in t)throw new Error(t.error);if(yield t,t.done||t.status==="success"){this.doneCallback();return}}throw new Error("Did not receive done or success response in stream.")}},ZSe=async e=>{if(e.ok)return;let t=`Error ${e.status}: ${e.statusText}`,r=null;if(e.headers.get("content-type")?.includes("application/json"))try{r=await e.json(),t=r.error||t}catch{console.log("Failed to parse error response as JSON")}else try{console.log("Getting text from response"),t=await e.text()||t}catch{console.log("Failed to get text from error response")}throw new KSe(t,e.status)};function NLr(){return typeof window<"u"&&window.navigator?`${window.navigator.platform.toLowerCase()} Browser/${navigator.userAgent};`:typeof process<"u"?`${process.arch} ${process.platform} Node.js/${process.version}`:""}var XSe=async(e,t,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${RLr} (${NLr()})`};return r.headers||(r.headers={}),r.headers={...n,...r.headers},e(t,r)},dyt=async(e,t)=>{let r=await XSe(e,t);return await ZSe(r),r};var cF=async(e,t,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await XSe(e,t,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await ZSe(a),a},LLr=async(e,t,r)=>{let n=await XSe(e,t,{method:"DELETE",body:JSON.stringify(r)});return await ZSe(n),n},FLr=async function*(e){let t=new TextDecoder("utf-8"),r="",n=e.getReader();for(;;){let{done:o,value:i}=await n.read();if(o)break;r+=t.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)}},kLr=e=>{if(!e)return"http://127.0.0.1:11434";let t=e.includes("://");e.startsWith(":")&&(e=`http://127.0.0.1${e}`,t=!0),t||(e=`http://${e}`);let r=new URL(e),n=r.port;n||(t?n=r.protocol==="https:"?"443":"80":n="11434");let o=`${r.protocol}//${r.hostname}:${n}${r.pathname}`;return o.endsWith("/")&&(o=o.slice(0,-1)),o},BLr=Object.defineProperty,$Lr=(e,t,r)=>t in e?BLr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,GSe=(e,t,r)=>($Lr(e,typeof t!="symbol"?t+"":t,r),r),aR=class{constructor(t){GSe(this,"config"),GSe(this,"fetch"),GSe(this,"ongoingStreamedRequests",[]),this.config={host:""},t?.proxy||(this.config.host=kLr(t?.host??"http://127.0.0.1:11434")),this.fetch=fetch,t?.fetch!=null&&(this.fetch=t.fetch)}abort(){for(let t of this.ongoingStreamedRequests)t.abort();this.ongoingStreamedRequests.length=0}async processStreamableRequest(t,r){r.stream=r.stream??!1;let n=`${this.config.host}/api/${t}`;if(r.stream){let i=new AbortController,a=await cF(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=FLr(a.body),u=new YSe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await cF(this.fetch,n,r,{headers:this.config.headers})).json()}async encodeImage(t){if(typeof t!="string"){let r=new Uint8Array(t),n="",o=r.byteLength;for(let i=0;i<o;i++)n+=String.fromCharCode(r[i]);return btoa(n)}return t}async generate(t){return t.images&&(t.images=await Promise.all(t.images.map(this.encodeImage.bind(this)))),this.processStreamableRequest("generate",t)}async chat(t){if(t.messages)for(let r of t.messages)r.images&&(r.images=await Promise.all(r.images.map(this.encodeImage.bind(this))));return this.processStreamableRequest("chat",t)}async create(t){return this.processStreamableRequest("create",{name:t.model,stream:t.stream,modelfile:t.modelfile,quantize:t.quantize})}async pull(t){return this.processStreamableRequest("pull",{name:t.model,stream:t.stream,insecure:t.insecure})}async push(t){return this.processStreamableRequest("push",{name:t.model,stream:t.stream,insecure:t.insecure})}async delete(t){return await LLr(this.fetch,`${this.config.host}/api/delete`,{name:t.model}),{status:"success"}}async copy(t){return await cF(this.fetch,`${this.config.host}/api/copy`,{...t}),{status:"success"}}async list(){return await(await dyt(this.fetch,`${this.config.host}/api/tags`)).json()}async show(t){return await(await cF(this.fetch,`${this.config.host}/api/show`,{...t})).json()}async embed(t){return await(await cF(this.fetch,`${this.config.host}/api/embed`,{...t})).json()}async embeddings(t){return await(await cF(this.fetch,`${this.config.host}/api/embeddings`,{...t})).json()}async ps(){return await(await dyt(this.fetch,`${this.config.host}/api/ps`)).json()}},qLr=new aR;kh();ly();var oc=[];for(nX=0;nX<256;++nX)oc.push((nX+256).toString(16).slice(1));var nX;function fyt(e,t=0){return(oc[e[t+0]]+oc[e[t+1]]+oc[e[t+2]]+oc[e[t+3]]+"-"+oc[e[t+4]]+oc[e[t+5]]+"-"+oc[e[t+6]]+oc[e[t+7]]+"-"+oc[e[t+8]]+oc[e[t+9]]+"-"+oc[e[t+10]]+oc[e[t+11]]+oc[e[t+12]]+oc[e[t+13]]+oc[e[t+14]]+oc[e[t+15]]).toLowerCase()}var oX,ULr=new Uint8Array(16);function QSe(){if(!oX&&(oX=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!oX))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oX(ULr)}var zLr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),exe={randomUUID:zLr};function HLr(e,t,r){if(exe.randomUUID&&!t&&!e)return exe.randomUUID();e=e||{};var n=e.random||(e.rng||QSe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=n[o];return t}return fyt(n)}var txe=HLr;function rxe(e,t){return new Gr({content:e.content??"",tool_call_chunks:e.tool_calls?.map(r=>({name:r.function.name,args:JSON.stringify(r.function.arguments),type:"tool_call_chunk",index:0,id:txe()})),response_metadata:t?.responseMetadata,usage_metadata:t?.usageMetadata})}function pyt(e){let t=e.match(/^data:.*?;base64,(.*)$/);return t?t[1]:""}function VLr(e){if(typeof e.content=="string")return[{role:"assistant",content:e.content}];let r=e.content.filter(o=>o.type==="text"&&typeof o.text=="string").map(o=>({role:"assistant",content:o.text})),n;if(e.content.find(o=>o.type==="tool_use")&&e.tool_calls?.length){let o=e.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(e.content.find(o=>o.type==="tool_use")&&!e.tool_calls?.length)throw new Error("'tool_use' content type is not supported without tool calls.");return[...r,...n?[n]:[]]}function WLr(e){return typeof e.content=="string"?[{role:"user",content:e.content}]:e.content.map(t=>{if(t.type==="text")return{role:"user",content:t.text};if(t.type==="image_url"){if(typeof t.image_url=="string")return{role:"user",content:"",images:[pyt(t.image_url)]};if(t.image_url.url&&typeof t.image_url.url=="string")return{role:"user",content:"",images:[pyt(t.image_url.url)]}}throw new Error(`Unsupported content type: ${t.type}`)})}function JLr(e){if(typeof e.content=="string")return[{role:"system",content:e.content}];if(e.content.every(t=>t.type==="text"&&typeof t.text=="string"))return e.content.map(t=>({role:"system",content:t.text}));throw new Error(`Unsupported content type(s): ${e.content.map(t=>t.type).join(", ")}`)}function GLr(e){if(typeof e.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:e.content}]}function hyt(e){return e.flatMap(t=>{if(["human","generic"].includes(t._getType()))return WLr(t);if(t._getType()==="ai")return VLr(t);if(t._getType()==="system")return JLr(t);if(t._getType()==="tool")return GLr(t);throw new Error(`Unsupported message type: ${t._getType()}`)})}var iX=class extends Qc{static lc_name(){return"ChatOllama"}constructor(t){super(t??{}),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:"5m"}),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 aR({host:t?.baseUrl,headers:t?.headers}),this.baseUrl=t?.baseUrl??this.baseUrl,this.model=t?.model??this.model,this.numa=t?.numa,this.numCtx=t?.numCtx,this.numBatch=t?.numBatch,this.numGpu=t?.numGpu,this.mainGpu=t?.mainGpu,this.lowVram=t?.lowVram,this.f16Kv=t?.f16Kv,this.logitsAll=t?.logitsAll,this.vocabOnly=t?.vocabOnly,this.useMmap=t?.useMmap,this.useMlock=t?.useMlock,this.embeddingOnly=t?.embeddingOnly,this.numThread=t?.numThread,this.numKeep=t?.numKeep,this.seed=t?.seed,this.numPredict=t?.numPredict,this.topK=t?.topK,this.topP=t?.topP,this.tfsZ=t?.tfsZ,this.typicalP=t?.typicalP,this.repeatLastN=t?.repeatLastN,this.temperature=t?.temperature,this.repeatPenalty=t?.repeatPenalty,this.presencePenalty=t?.presencePenalty,this.frequencyPenalty=t?.frequencyPenalty,this.mirostat=t?.mirostat,this.mirostatTau=t?.mirostatTau,this.mirostatEta=t?.mirostatEta,this.penalizeNewline=t?.penalizeNewline,this.streaming=t?.streaming,this.format=t?.format,this.keepAlive=t?.keepAlive??this.keepAlive,this.checkOrPullModel=t?.checkOrPullModel??this.checkOrPullModel}_llmType(){return"ollama"}async pull(t,r){let{stream:n,insecure:o,logProgress:i}={stream:!0,...r};if(n)for await(let a of await this.client.pull({model:t,insecure:o,stream:n}))i&&console.log(a);else{let a=await this.client.pull({model:t,insecure:o});i&&console.log(a)}}bindTools(t,r){return this.bind({tools:t.map(n=>sF(n)),...r})}getLsParams(t){let r=this.invocationParams(t);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:t.stop}}invocationParams(t){if(t?.tool_choice)throw new Error("Tool choice is not supported for ChatOllama.");return{model:this.model,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:t?.stop},tools:t?.tools?.length?t.tools.map(r=>sF(r)):void 0}}async checkModelExistsOnMachine(t){let{models:r}=await this.client.list();return!!r.find(n=>n.name===t||n.name===`${t}:latest`)}async _generate(t,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(t,r,n))o?o=ul(o,a.message):o=a.message;let i=new Po({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(t,r,n){this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o=this.invocationParams(r),i=hyt(t),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 ii({text:c.content,message:rxe(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 ii({text:c.content??"",message:rxe(c)}),await n?.handleLLMNewToken(c.content??"")}yield new ii({text:"",message:new Gr({content:"",response_metadata:u,usage_metadata:a})})}};var aX=class extends Cp{constructor(t){super({maxConcurrency:1,...t}),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:"5m"}),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 aR({host:t?.baseUrl,headers:t?.headers}),this.baseUrl=t?.baseUrl??this.baseUrl,this.model=t?.model??this.model,this.keepAlive=t?.keepAlive??this.keepAlive,this.truncate=t?.truncate??this.truncate,this.requestOptions=t?.requestOptions?this._convertOptions(t?.requestOptions):void 0}_convertOptions(t){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(t)){let a=n[o];a&&(r[a]=i)}return r}async embedDocuments(t){return this.embeddingWithRetry(t)}async embedQuery(t){return(await this.embeddingWithRetry([t]))[0]}async embeddingWithRetry(t){return(await this.caller.call(()=>this.client.embed({model:this.model,input:t,keep_alive:this.keepAlive,options:this.requestOptions,truncate:this.truncate}))).embeddings}};kh();var sX="RFC3986",uX={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},myt="RFC1738";var KLr=Array.isArray,xw=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();var nxe=1024,gyt=(e,t,r,n,o)=>{if(e.length===0)return e;let i=e;if(typeof e=="symbol"?i=Symbol.prototype.toString.call(e):typeof e!="string"&&(i=String(e)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(s){return"%26%23"+parseInt(s.slice(2),16)+"%3B"});let a="";for(let s=0;s<i.length;s+=nxe){let u=i.length>=nxe?i.slice(s,s+nxe):i,l=[];for(let c=0;c<u.length;++c){let d=u.charCodeAt(c);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===myt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=xw[d];continue}if(d<2048){l[l.length]=xw[192|d>>6]+xw[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=xw[224|d>>12]+xw[128|d>>6&63]+xw[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=xw[240|d>>18]+xw[128|d>>12&63]+xw[128|d>>6&63]+xw[128|d&63]}a+=l.join("")}return a};function yyt(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function oxe(e,t){if(KLr(e)){let r=[];for(let n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)}var YLr=Object.prototype.hasOwnProperty,byt={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},Cw=Array.isArray,ZLr=Array.prototype.push,_yt=function(e,t){ZLr.apply(e,Cw(t)?t:[t])},XLr=Date.prototype.toISOString,Ku={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:gyt,encodeValuesOnly:!1,format:sX,formatter:uX[sX],indices:!1,serializeDate(e){return XLr.call(e)},skipNulls:!1,strictNullHandling:!1};function QLr(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var ixe={};function vyt(e,t,r,n,o,i,a,s,u,l,c,d,f,p,h,m,_,g){let v=e,S=g,x=0,O=!1;for(;(S=S.get(ixe))!==void 0&&!O;){let j=S.get(e);if(x+=1,typeof j<"u"){if(j===x)throw new RangeError("Cyclic object value");O=!0}typeof S.get(ixe)>"u"&&(x=0)}if(typeof l=="function"?v=l(t,v):v instanceof Date?v=f?.(v):r==="comma"&&Cw(v)&&(v=oxe(v,function(j){return j instanceof Date?f?.(j):j})),v===null){if(i)return u&&!m?u(t,Ku.encoder,_,"key",p):t;v=""}if(QLr(v)||yyt(v)){if(u){let j=m?t:u(t,Ku.encoder,_,"key",p);return[h?.(j)+"="+h?.(u(v,Ku.encoder,_,"value",p))]}return[h?.(t)+"="+h?.(String(v))]}let T=[];if(typeof v>"u")return T;let E;if(r==="comma"&&Cw(v))m&&u&&(v=oxe(v,u)),E=[{value:v.length>0?v.join(",")||null:void 0}];else if(Cw(l))E=l;else{let j=Object.keys(v);E=c?j.sort(c):j}let M=s?String(t).replace(/\./g,"%2E"):String(t),A=n&&Cw(v)&&v.length===1?M+"[]":M;if(o&&Cw(v)&&v.length===0)return A+"[]";for(let j=0;j<E.length;++j){let N=E[j],F=typeof N=="object"&&typeof N.value<"u"?N.value:v[N];if(a&&F===null)continue;let k=d&&s?N.replace(/\./g,"%2E"):N,L=Cw(v)?typeof r=="function"?r(A,k):A:A+(d?"."+k:"["+k+"]");g.set(e,x);let q=new WeakMap;q.set(ixe,g),_yt(T,vyt(F,L,r,n,o,i,a,s,r==="comma"&&m&&Cw(v)?null:u,l,c,d,f,p,h,m,_,q))}return T}function eFr(e=Ku){if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");let t=e.charset||Ku.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=sX;if(typeof e.format<"u"){if(!YLr.call(uX,e.format))throw new TypeError("Unknown format option provided.");r=e.format}let n=uX[r],o=Ku.filter;(typeof e.filter=="function"||Cw(e.filter))&&(o=e.filter);let i;if(e.arrayFormat&&e.arrayFormat in byt?i=e.arrayFormat:"indices"in e?i=e.indices?"indices":"repeat":i=Ku.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof e.allowDots>"u"?e.encodeDotInKeys?!0:Ku.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Ku.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Ku.allowEmptyArrays,arrayFormat:i,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ku.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?Ku.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Ku.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:Ku.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:Ku.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Ku.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Ku.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Ku.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ku.strictNullHandling}}function axe(e,t={}){let r=e,n=eFr(t),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Cw(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=byt[n.arrayFormat],u=s==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);let l=new WeakMap;for(let f=0;f<o.length;++f){let p=o[f];n.skipNulls&&r[p]===null||_yt(a,vyt(r[p],p,s,u,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}let c=a.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),c.length>0?d+c:""}var sR="4.83.0";var wyt=!1,uR,sxe,rFr,nFr,oFr,uxe,iFr,lX,lxe,cxe,dxe,cX,fxe;function Syt(e,t={auto:!1}){if(wyt)throw new Error(`you must \`import 'openai/shims/${e.kind}'\` before importing anything else from openai`);if(uR)throw new Error(`can't \`import 'openai/shims/${e.kind}'\` after \`import 'openai/shims/${uR}'\``);wyt=t.auto,uR=e.kind,sxe=e.fetch,rFr=e.Request,nFr=e.Response,oFr=e.Headers,uxe=e.FormData,iFr=e.Blob,lX=e.File,lxe=e.ReadableStream,cxe=e.getMultipartRequestOptions,dxe=e.getDefaultAgent,cX=e.fileFromPath,fxe=e.isFsReadStream}var dX=class{constructor(t){this.body=t}get[Symbol.toStringTag](){return"MultipartBody"}};function xyt({manuallyImported:e}={}){let t=e?"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}. ${t}`)}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. ${t}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${t}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${t}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${t}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new dX(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}}uR||Syt(xyt(),{auto:!0});var Dt=class extends Error{},ps=class e extends Dt{constructor(t,r,n,o){super(`${e.makeMessage(t,r,n)}`),this.status=t,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(t,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return t&&o?`${t} ${o}`:t?`${t} status code (no body)`:o||"(no status code or body)"}static generate(t,r,n,o){if(!t||!o)return new Fx({message:n,cause:fX(r)});let i=r?.error;return t===400?new dF(t,i,n,o):t===401?new fF(t,i,n,o):t===403?new pF(t,i,n,o):t===404?new hF(t,i,n,o):t===409?new mF(t,i,n,o):t===422?new gF(t,i,n,o):t===429?new yF(t,i,n,o):t>=500?new bF(t,i,n,o):new e(t,i,n,o)}},Xa=class extends ps{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}},Fx=class extends ps{constructor({message:t,cause:r}){super(void 0,void 0,t||"Connection error.",void 0),r&&(this.cause=r)}},_g=class extends Fx{constructor({message:t}={}){super({message:t??"Request timed out."})}},dF=class extends ps{},fF=class extends ps{},pF=class extends ps{},hF=class extends ps{},mF=class extends ps{},gF=class extends ps{},yF=class extends ps{},bF=class extends ps{},_F=class extends Dt{constructor(){super("Could not parse response content as the length limit was reached")}},vF=class extends Dt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}};var lR=class e{constructor(){this.buffer=[],this.trailingCR=!1}decode(t){let r=this.decodeText(t);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=e.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(e.NEWLINE_REGEXP);return n&&o.pop(),o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof Buffer<"u"){if(t instanceof Buffer)return t.toString();if(t instanceof Uint8Array)return Buffer.from(t).toString();throw new Dt(`Unexpected: received non-Uint8Array (${t.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(t instanceof Uint8Array||t instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(t);throw new Dt(`Unexpected: received non-Uint8Array/ArrayBuffer (${t.constructor.name}) in a web platform. Please report this error.`)}throw new Dt("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let t=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,t}};lR.NEWLINE_CHARS=new Set([`
`,"\r"]);lR.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function pxe(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let r=await t.read();return r?.done&&t.releaseLock(),r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var Ow=class e{constructor(t,r){this.iterator=t,this.controller=r}static fromSSEResponse(t,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 uFr(t,r))if(!i){if(a.data.startsWith("[DONE]")){i=!0;continue}if(a.event===null){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 ps(void 0,s.error,void 0,void 0);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 ps(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 e(o,r)}static fromReadableStream(t,r){let n=!1;async function*o(){let a=new lR,s=pxe(t);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 e(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let t=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();t.push(a),r.push(a)}return i.shift()}});return[new e(()=>o(t),this.controller),new e(()=>o(r),this.controller)]}toReadableStream(){let t=this,r,n=new TextEncoder;return new lxe({async start(){r=t[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*uFr(e,t){if(!e.body)throw t.abort(),new Dt("Attempted to iterate over a response with no body");let r=new hxe,n=new lR,o=pxe(e.body);for await(let i of lFr(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*lFr(e){let t=new Uint8Array;for await(let r of e){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?new TextEncoder().encode(r):r,o=new Uint8Array(t.length+n.length);o.set(t),o.set(n,t.length),t=o;let i;for(;(i=cFr(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}function cFr(e){for(let n=0;n<e.length-2;n++){if(e[n]===10&&e[n+1]===10||e[n]===13&&e[n+1]===13)return n+2;if(e[n]===13&&e[n+1]===10&&n+3<e.length&&e[n+2]===13&&e[n+3]===10)return n+4}return-1}var hxe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;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(t),t.startsWith(":"))return null;let[r,n,o]=dFr(t,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function dFr(e,t){let r=e.indexOf(t);return r!==-1?[e.substring(0,r),t,e.substring(r+t.length)]:[e,"",""]}var Cyt=e=>e!=null&&typeof e=="object"&&typeof e.url=="string"&&typeof e.blob=="function",Oyt=e=>e!=null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.lastModified=="number"&&w4(e),w4=e=>e!=null&&typeof e=="object"&&typeof e.size=="number"&&typeof e.type=="string"&&typeof e.text=="function"&&typeof e.slice=="function"&&typeof e.arrayBuffer=="function",fFr=e=>Oyt(e)||Cyt(e)||fxe(e);async function yxe(e,t,r){if(e=await e,Oyt(e))return e;if(Cyt(e)){let o=await e.blob();t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=w4(o)?[await o.arrayBuffer()]:[o];return new lX(i,t,r)}let n=await pFr(e);if(t||(t=mFr(e)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new lX(n,t,r)}async function pFr(e){let t=[];if(typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(w4(e))t.push(await e.arrayBuffer());else if(gFr(e))for await(let r of e)t.push(r);else throw new Error(`Unexpected data type: ${typeof e}; constructor: ${e?.constructor?.name}; props: ${hFr(e)}`);return t}function hFr(e){return`[${Object.getOwnPropertyNames(e).map(r=>`"${r}"`).join(", ")}]`}function mFr(e){return mxe(e.name)||mxe(e.filename)||mxe(e.path)?.split(/[\\/]/).pop()}var mxe=e=>{if(typeof e=="string")return e;if(typeof Buffer<"u"&&e instanceof Buffer)return String(e)},gFr=e=>e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function",bxe=e=>e&&typeof e=="object"&&e.body&&e[Symbol.toStringTag]==="MultipartBody";var Bh=async e=>{let t=await Eyt(e.body);return cxe(t,e)},Eyt=async e=>{let t=new uxe;return await Promise.all(Object.entries(e||{}).map(([r,n])=>gxe(t,r,n))),t};var gxe=async(e,t,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")e.append(t,String(r));else if(fFr(r)){let n=await yxe(r);e.append(t,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>gxe(e,t+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>gxe(e,`${t}[${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 bFr=function(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},_Fr=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},pX;async function Ryt(e){let{response:t}=e;if(e.options.stream)return wF("response",t.status,t.url,t.headers,t.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(t,e.controller):Ow.fromSSEResponse(t,e.controller);if(t.status===204)return null;if(e.options.__binaryResponse)return t;let r=t.headers.get("content-type");if(r?.includes("application/json")||r?.includes("application/vnd.api+json")){let i=await t.json();return wF("response",t.status,t.url,t.headers,i),Dyt(i,t)}let o=await t.text();return wF("response",t.status,t.url,t.headers,o),o}function Dyt(e,t){return!e||typeof e!="object"||Array.isArray(e)?e:Object.defineProperty(e,"_request_id",{value:t.headers.get("x-request-id"),enumerable:!1})}var mX=class e extends Promise{constructor(t,r=Ryt){super(n=>{n(null)}),this.responsePromise=t,this.parseResponse=r}_thenUnwrap(t){return new e(this.responsePromise,async r=>Dyt(t(await this.parseResponse(r),r),r.response))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){let[t,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(t,r){return this.parse().then(t,r)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}},gX=class{constructor({baseURL:t,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=t,this.maxRetries=_xe("maxRetries",r),this.timeout=_xe("timeout",n),this.httpAgent=o,this.fetch=i??sxe}authHeaders(t){return{}}defaultHeaders(t){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...CFr(),...this.authHeaders(t)}}validateHeaders(t,r){}defaultIdempotencyKey(){return`stainless-node-retry-${TFr()}`}get(t,r){return this.methodRequest("get",t,r)}post(t,r){return this.methodRequest("post",t,r)}patch(t,r){return this.methodRequest("patch",t,r)}put(t,r){return this.methodRequest("put",t,r)}delete(t,r){return this.methodRequest("delete",t,r)}methodRequest(t,r,n){return this.request(Promise.resolve(n).then(async o=>{let i=o&&w4(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:t,path:r,...o,body:i}}))}getAPIList(t,r,n){return this.requestAPIList(r,{method:"get",path:t,...n})}calculateContentLength(t){if(typeof t=="string"){if(typeof Buffer<"u")return Buffer.byteLength(t,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(t).length.toString()}else if(ArrayBuffer.isView(t))return t.byteLength.toString();return null}buildRequest(t,{retryCount:r=0}={}){t={...t};let{method:n,path:o,query:i,headers:a={}}=t,s=ArrayBuffer.isView(t.body)||t.__binaryRequest&&typeof t.body=="string"?t.body:bxe(t.body)?t.body.body:t.body?JSON.stringify(t.body,null,2):null,u=this.calculateContentLength(s),l=this.buildURL(o,i);"timeout"in t&&_xe("timeout",t.timeout),t.timeout=t.timeout??this.timeout;let c=t.httpAgent??this.httpAgent??dxe(l),d=t.timeout+1e3;typeof c?.options?.timeout=="number"&&d>(c.options.timeout??0)&&(c.options.timeout=d),this.idempotencyHeader&&n!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),a[this.idempotencyHeader]=t.idempotencyKey);let f=this.buildHeaders({options:t,headers:a,contentLength:u,retryCount:r});return{req:{method:n,...s&&{body:s},headers:f,...c&&{agent:c},signal:t.signal??null},url:l,timeout:t.timeout}}buildHeaders({options:t,headers:r,contentLength:n,retryCount:o}){let i={};n&&(i["content-length"]=n);let a=this.defaultHeaders(t);return Iyt(i,a),Iyt(i,r),bxe(t.body)&&uR!=="node"&&delete i["content-type"],hX(a,"x-stainless-retry-count")===void 0&&hX(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),hX(a,"x-stainless-timeout")===void 0&&hX(r,"x-stainless-timeout")===void 0&&t.timeout&&(i["x-stainless-timeout"]=String(t.timeout)),this.validateHeaders(i,r),i}async prepareOptions(t){}async prepareRequest(t,{url:r,options:n}){}parseHeaders(t){return t?Symbol.iterator in t?Object.fromEntries(Array.from(t).map(r=>[...r])):{...t}:{}}makeStatusError(t,r,n,o){return ps.generate(t,r,n,o)}request(t,r=null){return new mX(this.makeRequest(t,r))}async makeRequest(t,r){let n=await t,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}),wF("request",a,n,i.headers),n.signal?.aborted)throw new Xa;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(fX);if(l instanceof Error){if(n.signal?.aborted)throw new Xa;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new _g:new Fx({cause:l})}let c=vFr(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let _=`retrying, ${r} attempts remaining`;return wF(`response (error; ${_})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(_=>fX(_).message),f=OFr(d),p=f?void 0:d;throw wF(`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(t,r){let n=this.makeRequest(r,null);return new vxe(this,n,t)}buildURL(t,r){let n=PFr(t)?new URL(t):new URL(this.baseURL+(this.baseURL.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),o=this.defaultQuery();return jyt(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(n.search=this.stringifyQuery(r)),n.toString()}stringifyQuery(t){return Object.entries(t).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 Dt(`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(t,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,t,u).finally(()=>{clearTimeout(s)})}shouldRetry(t){let r=t.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,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=t.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await kx(o),this.makeRequest(t,r-1)}calculateDefaultRetryTimeoutMillis(t,r){let i=r-t,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}getUserAgent(){return`${this.constructor.name}/JS ${sR}`}},S4=class{constructor(t,r,n,o){pX.set(this,void 0),bFr(this,pX,t,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let t=this.nextPageInfo();if(!t)throw new Dt("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let r={...this.options};if("params"in t&&typeof r.query=="object")r.query={...r.query,...t.params};else if("url"in t){let n=[...Object.entries(r.query||{}),...t.url.searchParams.entries()];for(let[o,i]of n)t.url.searchParams.set(o,i);r.query=void 0,r.path=t.url.toString()}return await _Fr(this,pX,"f").requestAPIList(this.constructor,r)}async*iterPages(){let t=this;for(yield t;t.hasNextPage();)t=await t.getNextPage(),yield t}async*[(pX=new WeakMap,Symbol.asyncIterator)](){for await(let t of this.iterPages())for(let r of t.getPaginatedItems())yield r}},vxe=class extends mX{constructor(t,r,n){super(r,async o=>new n(t,o.response,await Ryt(o),o.options))}async*[Symbol.asyncIterator](){let t=await this;for await(let r of t)yield r}},vFr=e=>new Proxy(Object.fromEntries(e.entries()),{get(t,r){let n=r.toString();return t[n.toLowerCase()]||t[n]}}),wFr={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},li=e=>typeof e=="object"&&e!==null&&!jyt(e)&&Object.keys(e).every(t=>Nyt(wFr,t)),SFr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":sR,"X-Stainless-OS":Tyt(Deno.build.os),"X-Stainless-Arch":Pyt(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":sR,"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":sR,"X-Stainless-OS":Tyt(process.platform),"X-Stainless-Arch":Pyt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let e=xFr();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":sR,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":sR,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function xFr(){if(typeof navigator>"u"||!navigator)return null;let e=[{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:t,pattern:r}of e){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:t,version:`${o}.${i}.${a}`}}}return null}var Pyt=e=>e==="x32"?"x32":e==="x86_64"||e==="x64"?"x64":e==="arm"?"arm":e==="aarch64"||e==="arm64"?"arm64":e?`other:${e}`:"unknown",Tyt=e=>(e=e.toLowerCase(),e.includes("ios")?"iOS":e==="android"?"Android":e==="darwin"?"MacOS":e==="win32"?"Windows":e==="freebsd"?"FreeBSD":e==="openbsd"?"OpenBSD":e==="linux"?"Linux":e?`Other:${e}`:"Unknown"),Myt,CFr=()=>Myt??(Myt=SFr()),OFr=e=>{try{return JSON.parse(e)}catch{return}},EFr=/^[a-z][a-z0-9+.-]*:/i,PFr=e=>EFr.test(e),kx=e=>new Promise(t=>setTimeout(t,e)),_xe=(e,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new Dt(`${e} must be an integer`);if(t<0)throw new Dt(`${e} must be a positive integer`);return t},fX=e=>{if(e instanceof Error)return e;if(typeof e=="object"&&e!==null)try{return new Error(JSON.stringify(e))}catch{}return new Error(e)};var _P=e=>{if(typeof process<"u")return process.env?.[e]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(e)?.trim()};function jyt(e){if(!e)return!0;for(let t in e)return!1;return!0}function Nyt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Iyt(e,t){for(let r in t){if(!Nyt(t,r))continue;let n=r.toLowerCase();if(!n)continue;let o=t[r];o===null?delete e[n]:o!==void 0&&(e[n]=o)}}var Ayt=new Set(["authorization","api-key"]);function wF(e,...t){if(typeof process<"u"&&process?.env?.DEBUG==="true"){let r=t.map(n=>{if(!n)return n;if(n.headers){let i={...n,headers:{...n.headers}};for(let a in n.headers)Ayt.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)Ayt.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${e}`,...r)}}var TFr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Lyt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",MFr=e=>typeof e?.get=="function";var hX=(e,t)=>{let r=t.toLowerCase();if(MFr(e)){let n=t[0]?.toUpperCase()+t.substring(1).replace(/([^\w])(\w)/g,(o,i,a)=>i+a.toUpperCase());for(let o of[t,r,t.toUpperCase(),n]){let i=e.get(o);if(i)return i}}for(let[n,o]of Object.entries(e))if(n.toLowerCase()===r)return Array.isArray(o)?(o.length<=1||console.warn(`Received ${o.length} entries for the ${t} header, using the first entry.`),o[0]):o};function SF(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}var yX=class extends S4{constructor(t,r,n,o){super(t,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageParams(){return null}nextPageInfo(){return null}},pa=class extends S4{constructor(t,r,n,o){super(t,r,n,o),this.data=n.data||[]}getPaginatedItems(){return this.data??[]}nextPageParams(){let t=this.nextPageInfo();if(!t)return null;if("params"in t)return t.params;let r=Object.fromEntries(t.url.searchParams);return Object.keys(r).length?r:null}nextPageInfo(){let t=this.getPaginatedItems();if(!t.length)return null;let r=t[t.length-1]?.id;return r?{params:{after:r}}:null}};var ut=class{constructor(t){this._client=t}};var xF=class extends ut{create(t,r){return this._client.post("/chat/completions",{body:t,...r,stream:t.stream??!1})}};var vP=class extends ut{constructor(){super(...arguments),this.completions=new xF(this._client)}};vP.Completions=xF;var CF=class extends ut{create(t,r){return this._client.post("/audio/speech",{body:t,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}};var OF=class extends ut{create(t,r){return this._client.post("/audio/transcriptions",Bh({body:t,...r,__metadata:{model:t.model}}))}};var EF=class extends ut{create(t,r){return this._client.post("/audio/translations",Bh({body:t,...r,__metadata:{model:t.model}}))}};var Ew=class extends ut{constructor(){super(...arguments),this.transcriptions=new OF(this._client),this.translations=new EF(this._client),this.speech=new CF(this._client)}};Ew.Transcriptions=OF;Ew.Translations=EF;Ew.Speech=CF;var wP=class extends ut{create(t,r){return this._client.post("/batches",{body:t,...r})}retrieve(t,r){return this._client.get(`/batches/${t}`,r)}list(t={},r){return li(t)?this.list({},t):this._client.getAPIList("/batches",dR,{query:t,...r})}cancel(t,r){return this._client.post(`/batches/${t}/cancel`,r)}},dR=class extends pa{};wP.BatchesPage=dR;var fR=class extends ut{create(t,r){return this._client.post("/assistants",{body:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(t,r){return this._client.get(`/assistants/${t}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(t,r,n){return this._client.post(`/assistants/${t}`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}list(t={},r){return li(t)?this.list({},t):this._client.getAPIList("/assistants",PF,{query:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}del(t,r){return this._client.delete(`/assistants/${t}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}},PF=class extends pa{};fR.AssistantsPage=PF;function wxe(e){return typeof e.parse=="function"}var SP=e=>e?.role==="assistant",Sxe=e=>e?.role==="function",xxe=e=>e?.role==="tool";var vg=function(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},ha=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},Cxe,bX,_X,x4,C4,vX,O4,Bx,E4,wX,SX,TF,Fyt,MF=class{constructor(){Cxe.add(this),this.controller=new AbortController,bX.set(this,void 0),_X.set(this,()=>{}),x4.set(this,()=>{}),C4.set(this,void 0),vX.set(this,()=>{}),O4.set(this,()=>{}),Bx.set(this,{}),E4.set(this,!1),wX.set(this,!1),SX.set(this,!1),TF.set(this,!1),vg(this,bX,new Promise((t,r)=>{vg(this,_X,t,"f"),vg(this,x4,r,"f")}),"f"),vg(this,C4,new Promise((t,r)=>{vg(this,vX,t,"f"),vg(this,O4,r,"f")}),"f"),ha(this,bX,"f").catch(()=>{}),ha(this,C4,"f").catch(()=>{})}_run(t){setTimeout(()=>{t().then(()=>{this._emitFinal(),this._emit("end")},ha(this,Cxe,"m",Fyt).bind(this))},0)}_connected(){this.ended||(ha(this,_X,"f").call(this),this._emit("connect"))}get ended(){return ha(this,E4,"f")}get errored(){return ha(this,wX,"f")}get aborted(){return ha(this,SX,"f")}abort(){this.controller.abort()}on(t,r){return(ha(this,Bx,"f")[t]||(ha(this,Bx,"f")[t]=[])).push({listener:r}),this}off(t,r){let n=ha(this,Bx,"f")[t];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(t,r){return(ha(this,Bx,"f")[t]||(ha(this,Bx,"f")[t]=[])).push({listener:r,once:!0}),this}emitted(t){return new Promise((r,n)=>{vg(this,TF,!0,"f"),t!=="error"&&this.once("error",n),this.once(t,r)})}async done(){vg(this,TF,!0,"f"),await ha(this,C4,"f")}_emit(t,...r){if(ha(this,E4,"f"))return;t==="end"&&(vg(this,E4,!0,"f"),ha(this,vX,"f").call(this));let n=ha(this,Bx,"f")[t];if(n&&(ha(this,Bx,"f")[t]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),t==="abort"){let o=r[0];!ha(this,TF,"f")&&!n?.length&&Promise.reject(o),ha(this,x4,"f").call(this,o),ha(this,O4,"f").call(this,o),this._emit("end");return}if(t==="error"){let o=r[0];!ha(this,TF,"f")&&!n?.length&&Promise.reject(o),ha(this,x4,"f").call(this,o),ha(this,O4,"f").call(this,o),this._emit("end")}}_emitFinal(){}};bX=new WeakMap,_X=new WeakMap,x4=new WeakMap,C4=new WeakMap,vX=new WeakMap,O4=new WeakMap,Bx=new WeakMap,E4=new WeakMap,wX=new WeakMap,SX=new WeakMap,TF=new WeakMap,Cxe=new WeakSet,Fyt=function(t){if(vg(this,wX,!0,"f"),t instanceof Error&&t.name==="AbortError"&&(t=new Xa),t instanceof Xa)return vg(this,SX,!0,"f"),this._emit("abort",t);if(t instanceof Dt)return this._emit("error",t);if(t instanceof Error){let r=new Dt(t.message);return r.cause=t,this._emit("error",r)}return this._emit("error",new Dt(String(t)))};function kyt(e,t){let r={...e};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:t,enumerable:!1}}),r}function Oxe(e){return e?.$brand==="auto-parseable-response-format"}function Byt(e,{parser:t,callback:r}){let n={...e};return Object.defineProperties(n,{$brand:{value:"auto-parseable-tool",enumerable:!1},$parseRaw:{value:t,enumerable:!1},$callback:{value:r,enumerable:!1}}),n}function pR(e){return e?.$brand==="auto-parseable-tool"}function $yt(e,t){return!t||!Exe(t)?{...e,choices:e.choices.map(r=>({...r,message:{...r.message,parsed:null,tool_calls:r.message.tool_calls??[]}}))}:P4(e,t)}function P4(e,t){let r=e.choices.map(n=>{if(n.finish_reason==="length")throw new _F;if(n.finish_reason==="content_filter")throw new vF;return{...n,message:{...n.message,tool_calls:n.message.tool_calls?.map(o=>LFr(t,o))??[],parsed:n.message.content&&!n.message.refusal?NFr(t,n.message.content):null}}});return{...e,choices:r}}function NFr(e,t){return e.response_format?.type!=="json_schema"?null:e.response_format?.type==="json_schema"?"$parseRaw"in e.response_format?e.response_format.$parseRaw(t):JSON.parse(t):null}function LFr(e,t){let r=e.tools?.find(n=>n.function?.name===t.function.name);return{...t,function:{...t.function,parsed_arguments:pR(r)?r.$parseRaw(t.function.arguments):r?.function.strict?JSON.parse(t.function.arguments):null}}}function qyt(e,t){if(!e)return!1;let r=e.tools?.find(n=>n.function?.name===t.function.name);return pR(r)||r?.function.strict||!1}function Exe(e){return Oxe(e.response_format)?!0:e.tools?.some(t=>pR(t)||t.type==="function"&&t.function.strict===!0)??!1}function Uyt(e){for(let t of e??[]){if(t.type!=="function")throw new Dt(`Currently only \`function\` tool types support auto-parsing; Received \`${t.type}\``);if(t.function.strict!==!0)throw new Dt(`The \`${t.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Df=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},td,Pxe,xX,Txe,Mxe,Ixe,Hyt,Axe,zyt=10,IF=class extends MF{constructor(){super(...arguments),td.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(t){this._chatCompletions.push(t),this._emit("chatCompletion",t);let r=t.choices[0]?.message;return r&&this._addMessage(r),t}_addMessage(t,r=!0){if("content"in t||(t.content=null),this.messages.push(t),r){if(this._emit("message",t),(Sxe(t)||xxe(t))&&t.content)this._emit("functionCallResult",t.content);else if(SP(t)&&t.function_call)this._emit("functionCall",t.function_call);else if(SP(t)&&t.tool_calls)for(let n of t.tool_calls)n.type==="function"&&this._emit("functionCall",n.function)}}async finalChatCompletion(){await this.done();let t=this._chatCompletions[this._chatCompletions.length-1];if(!t)throw new Dt("stream ended without producing a ChatCompletion");return t}async finalContent(){return await this.done(),Df(this,td,"m",Pxe).call(this)}async finalMessage(){return await this.done(),Df(this,td,"m",xX).call(this)}async finalFunctionCall(){return await this.done(),Df(this,td,"m",Txe).call(this)}async finalFunctionCallResult(){return await this.done(),Df(this,td,"m",Mxe).call(this)}async totalUsage(){return await this.done(),Df(this,td,"m",Ixe).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let t=this._chatCompletions[this._chatCompletions.length-1];t&&this._emit("finalChatCompletion",t);let r=Df(this,td,"m",xX).call(this);r&&this._emit("finalMessage",r);let n=Df(this,td,"m",Pxe).call(this);n&&this._emit("finalContent",n);let o=Df(this,td,"m",Txe).call(this);o&&this._emit("finalFunctionCall",o);let i=Df(this,td,"m",Mxe).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",Df(this,td,"m",Ixe).call(this))}async _createChatCompletion(t,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Df(this,td,"m",Hyt).call(this,r);let i=await t.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(P4(i,r))}async _runChatCompletion(t,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(t,r,n)}async _runFunctions(t,r,n){let o="function",{function_call:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i?.name,{maxChatCompletions:l=zyt}=n||{},c={};for(let f of r.functions)c[f.name||f.function.name]=f;let d=r.functions.map(f=>({name:f.name||f.function.name,parameters:f.parameters,description:f.description}));for(let f of r.messages)this._addMessage(f,!1);for(let f=0;f<l;++f){let h=(await this._createChatCompletion(t,{...s,function_call:i,functions:d,messages:[...this.messages]},n)).choices[0]?.message;if(!h)throw new Dt("missing message in ChatCompletion response");if(!h.function_call)return;let{name:m,arguments:_}=h.function_call,g=c[m];if(g){if(u&&u!==m){let O=`Invalid function_call: ${JSON.stringify(m)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,name:m,content:O});continue}}else{let O=`Invalid function_call: ${JSON.stringify(m)}. Available options are: ${d.map(T=>JSON.stringify(T.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:m,content:O});continue}let v;try{v=wxe(g)?await g.parse(_):_}catch(O){this._addMessage({role:o,name:m,content:O instanceof Error?O.message:String(O)});continue}let S=await g.function(v,this),x=Df(this,td,"m",Axe).call(this,S);if(this._addMessage({role:o,name:m,content:x}),u)return}}async _runTools(t,r,n){let o="tool",{tool_choice:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i?.function?.name,{maxChatCompletions:l=zyt}=n||{},c=r.tools.map(p=>{if(pR(p)){if(!p.$callback)throw new Dt("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of c)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?c.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;p<l;++p){let m=(await this._createChatCompletion(t,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!m)throw new Dt("missing message in ChatCompletion response");if(!m.tool_calls?.length)return;for(let _ of m.tool_calls){if(_.type!=="function")continue;let g=_.id,{name:v,arguments:S}=_.function,x=d[v];if(x){if(u&&u!==v){let M=`Invalid tool_call: ${JSON.stringify(v)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:M});continue}}else{let M=`Invalid tool_call: ${JSON.stringify(v)}. Available options are: ${Object.keys(d).map(A=>JSON.stringify(A)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:M});continue}let O;try{O=wxe(x)?await x.parse(S):S}catch(M){let A=M instanceof Error?M.message:String(M);this._addMessage({role:o,tool_call_id:g,content:A});continue}let T=await x.function(O,this),E=Df(this,td,"m",Axe).call(this,T);if(this._addMessage({role:o,tool_call_id:g,content:E}),u)return}}}};td=new WeakSet,Pxe=function(){return Df(this,td,"m",xX).call(this).content??null},xX=function(){let t=this.messages.length;for(;t-- >0;){let r=this.messages[t];if(SP(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 Dt("stream ended without producing a ChatCompletionMessage with role=assistant")},Txe=function(){for(let t=this.messages.length-1;t>=0;t--){let r=this.messages[t];if(SP(r)&&r?.function_call)return r.function_call;if(SP(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},Mxe=function(){for(let t=this.messages.length-1;t>=0;t--){let r=this.messages[t];if(Sxe(r)&&r.content!=null||xxe(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}},Ixe=function(){let t={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(t.completion_tokens+=r.completion_tokens,t.prompt_tokens+=r.prompt_tokens,t.total_tokens+=r.total_tokens);return t},Hyt=function(t){if(t.n!=null&&t.n>1)throw new Dt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},Axe=function(t){return typeof t=="string"?t:t===void 0?"undefined":JSON.stringify(t)};var T4=class e extends IF{static runFunctions(t,r,n){let o=new e,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return o._run(()=>o._runFunctions(t,r,i)),o}static runTools(t,r,n){let o=new e,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(t,r,i)),o}_addMessage(t,r=!0){super._addMessage(t,r),SP(t)&&t.content&&this._emit("content",t.content)}};var vl={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},Rxe=class extends Error{},Dxe=class extends Error{};function FFr(e,t=vl.ALL){if(typeof e!="string")throw new TypeError(`expecting str, got ${typeof e}`);if(!e.trim())throw new Error(`${e} is empty`);return kFr(e.trim(),t)}var kFr=(e,t)=>{let r=e.length,n=0,o=f=>{throw new Rxe(`${f} at position ${n}`)},i=f=>{throw new Dxe(`${f} at position ${n}`)},a=()=>(d(),n>=r&&o("Unexpected end of input"),e[n]==='"'?s():e[n]==="{"?u():e[n]==="["?l():e.substring(n,n+4)==="null"||vl.NULL&t&&r-n<4&&"null".startsWith(e.substring(n))?(n+=4,null):e.substring(n,n+4)==="true"||vl.BOOL&t&&r-n<4&&"true".startsWith(e.substring(n))?(n+=4,!0):e.substring(n,n+5)==="false"||vl.BOOL&t&&r-n<5&&"false".startsWith(e.substring(n))?(n+=5,!1):e.substring(n,n+8)==="Infinity"||vl.INFINITY&t&&r-n<8&&"Infinity".startsWith(e.substring(n))?(n+=8,1/0):e.substring(n,n+9)==="-Infinity"||vl.MINUS_INFINITY&t&&1<r-n&&r-n<9&&"-Infinity".startsWith(e.substring(n))?(n+=9,-1/0):e.substring(n,n+3)==="NaN"||vl.NAN&t&&r-n<3&&"NaN".startsWith(e.substring(n))?(n+=3,NaN):c()),s=()=>{let f=n,p=!1;for(n++;n<r&&(e[n]!=='"'||p&&e[n-1]==="\\");)p=e[n]==="\\"?!p:!1,n++;if(e.charAt(n)=='"')try{return JSON.parse(e.substring(f,++n-Number(p)))}catch(h){i(String(h))}else if(vl.STR&t)try{return JSON.parse(e.substring(f,n-Number(p))+'"')}catch{return JSON.parse(e.substring(f,e.lastIndexOf("\\"))+'"')}o("Unterminated string literal")},u=()=>{n++,d();let f={};try{for(;e[n]!=="}";){if(d(),n>=r&&vl.OBJ&t)return f;let p=s();d(),n++;try{let h=a();Object.defineProperty(f,p,{value:h,writable:!0,enumerable:!0,configurable:!0})}catch(h){if(vl.OBJ&t)return f;throw h}d(),e[n]===","&&n++}}catch{if(vl.OBJ&t)return f;o("Expected '}' at end of object")}return n++,f},l=()=>{n++;let f=[];try{for(;e[n]!=="]";)f.push(a()),d(),e[n]===","&&n++}catch{if(vl.ARR&t)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){e==="-"&&vl.NUM&t&&o("Not sure what '-' is");try{return JSON.parse(e)}catch(p){if(vl.NUM&t)try{return e[e.length-1]==="."?JSON.parse(e.substring(0,e.lastIndexOf("."))):JSON.parse(e.substring(0,e.lastIndexOf("e")))}catch{}i(String(p))}}let f=n;for(e[n]==="-"&&n++;e[n]&&!",]}".includes(e[n]);)n++;n==r&&!(vl.NUM&t)&&o("Unterminated number literal");try{return JSON.parse(e.substring(f,n))}catch{e.substring(f,n)==="-"&&vl.NUM&t&&o("Not sure what '-' is");try{return JSON.parse(e.substring(f,e.lastIndexOf("e")))}catch(h){i(String(h))}}},d=()=>{for(;n<r&&`
\r `.includes(e[n]);)n++};return a()},jxe=e=>FFr(e,vl.ALL^vl.NUM);var AF=function(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},Jo=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},Yu,$x,RF,xP,Nxe,CX,Lxe,Fxe,kxe,OX,Bxe,Vyt,DF=class e extends IF{constructor(t){super(),Yu.add(this),$x.set(this,void 0),RF.set(this,void 0),xP.set(this,void 0),AF(this,$x,t,"f"),AF(this,RF,[],"f")}get currentChatCompletionSnapshot(){return Jo(this,xP,"f")}static fromReadableStream(t){let r=new e(null);return r._run(()=>r._fromReadableStream(t)),r}static createChatCompletion(t,r,n){let o=new e(r);return o._run(()=>o._runChatCompletion(t,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(t,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Jo(this,Yu,"m",Nxe).call(this);let i=await t.chat.completions.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)Jo(this,Yu,"m",Lxe).call(this,a);if(i.controller.signal?.aborted)throw new Xa;return this._addChatCompletion(Jo(this,Yu,"m",OX).call(this))}async _fromReadableStream(t,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Jo(this,Yu,"m",Nxe).call(this),this._connected();let o=Ow.fromReadableStream(t,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(Jo(this,Yu,"m",OX).call(this)),Jo(this,Yu,"m",Lxe).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Xa;return this._addChatCompletion(Jo(this,Yu,"m",OX).call(this))}[($x=new WeakMap,RF=new WeakMap,xP=new WeakMap,Yu=new WeakSet,Nxe=function(){this.ended||AF(this,xP,void 0,"f")},CX=function(r){let n=Jo(this,RF,"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},Jo(this,RF,"f")[r.index]=n,n)},Lxe=function(r){if(this.ended)return;let n=Jo(this,Yu,"m",Vyt).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=Jo(this,Yu,"m",CX).call(this,i);i.finish_reason&&(Jo(this,Yu,"m",kxe).call(this,i),a.current_tool_call_index!=null&&Jo(this,Yu,"m",Fxe).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(Jo(this,Yu,"m",kxe).call(this,i),a.current_tool_call_index!=null&&Jo(this,Yu,"m",Fxe).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))}}},Fxe=function(r,n){if(Jo(this,Yu,"m",CX).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=Jo(this,$x,"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:pR(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},kxe=function(r){let n=Jo(this,Yu,"m",CX).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=Jo(this,Yu,"m",Bxe).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}))},OX=function(){if(this.ended)throw new Dt("stream has ended, this shouldn't happen");let r=Jo(this,xP,"f");if(!r)throw new Dt("request ended without sending any chunks");return AF(this,xP,void 0,"f"),AF(this,RF,[],"f"),BFr(r,Jo(this,$x,"f"))},Bxe=function(){let r=Jo(this,$x,"f")?.response_format;return Oxe(r)?r:null},Vyt=function(r){var n,o,i,a;let s=Jo(this,xP,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=AF(this,xP,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...h}of r.choices){let m=s.choices[f];if(m||(m=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...h}),p)if(!m.logprobs)m.logprobs=Object.assign({},p);else{let{content:T,refusal:E,...M}=p;Object.assign(m.logprobs,M),T&&((n=m.logprobs).content??(n.content=[]),m.logprobs.content.push(...T)),E&&((o=m.logprobs).refusal??(o.refusal=[]),m.logprobs.refusal.push(...E))}if(d&&(m.finish_reason=d,Jo(this,$x,"f")&&Exe(Jo(this,$x,"f")))){if(d==="length")throw new _F;if(d==="content_filter")throw new vF}if(Object.assign(m,h),!c)continue;let{content:_,refusal:g,function_call:v,role:S,tool_calls:x,...O}=c;if(Object.assign(m.message,O),g&&(m.message.refusal=(m.message.refusal||"")+g),S&&(m.message.role=S),v&&(m.message.function_call?(v.name&&(m.message.function_call.name=v.name),v.arguments&&((i=m.message.function_call).arguments??(i.arguments=""),m.message.function_call.arguments+=v.arguments)):m.message.function_call=v),_&&(m.message.content=(m.message.content||"")+_,!m.message.refusal&&Jo(this,Yu,"m",Bxe).call(this)&&(m.message.parsed=jxe(m.message.content))),x){m.message.tool_calls||(m.message.tool_calls=[]);for(let{index:T,id:E,type:M,function:A,...j}of x){let N=(a=m.message.tool_calls)[T]??(a[T]={});Object.assign(N,j),E&&(N.id=E),M&&(N.type=M),A&&(N.function??(N.function={name:A.name??"",arguments:""})),A?.name&&(N.function.name=A.name),A?.arguments&&(N.function.arguments+=A.arguments,qyt(Jo(this,$x,"f"),N)&&(N.function.parsed_arguments=jxe(N.function.arguments)))}}}return s},Symbol.asyncIterator)](){let t=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):t.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()=>t.length?{value:t.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 Ow(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function BFr(e,t){let{id:r,choices:n,created:o,model:i,system_fingerprint:a,...s}=e,u={...s,id:r,choices:n.map(({message:l,finish_reason:c,index:d,logprobs:f,...p})=>{if(!c)throw new Dt(`missing finish_reason for choice ${d}`);let{content:h=null,function_call:m,tool_calls:_,...g}=l,v=l.role;if(!v)throw new Dt(`missing role for choice ${d}`);if(m){let{arguments:S,name:x}=m;if(S==null)throw new Dt(`missing function_call.arguments for choice ${d}`);if(!x)throw new Dt(`missing function_call.name for choice ${d}`);return{...p,message:{content:h,function_call:{arguments:S,name:x},role:v,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return _?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:v,content:h,refusal:l.refusal??null,tool_calls:_.map((S,x)=>{let{function:O,type:T,id:E,...M}=S,{arguments:A,name:j,...N}=O||{};if(E==null)throw new Dt(`missing choices[${d}].tool_calls[${x}].id
${EX(e)}`);if(T==null)throw new Dt(`missing choices[${d}].tool_calls[${x}].type
${EX(e)}`);if(j==null)throw new Dt(`missing choices[${d}].tool_calls[${x}].function.name
${EX(e)}`);if(A==null)throw new Dt(`missing choices[${d}].tool_calls[${x}].function.arguments
${EX(e)}`);return{...M,id:E,type:T,function:{...N,name:j,arguments:A}}})}}:{...p,message:{...g,content:h,role:v,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return $yt(u,t)}function EX(e){return JSON.stringify(e)}var M4=class e extends DF{static fromReadableStream(t){let r=new e(null);return r._run(()=>r._fromReadableStream(t)),r}static runFunctions(t,r,n){let o=new e(null),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return o._run(()=>o._runFunctions(t,r,i)),o}static runTools(t,r,n){let o=new e(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(t,r,i)),o}};var I4=class extends ut{parse(t,r){return Uyt(t.tools),this._client.chat.completions.create(t,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>P4(n,t))}runFunctions(t,r){return t.stream?M4.runFunctions(this._client,t,r):T4.runFunctions(this._client,t,r)}runTools(t,r){return t.stream?M4.runTools(this._client,t,r):T4.runTools(this._client,t,r)}stream(t,r){return DF.createChatCompletion(this._client,t,r)}};var jF=class extends ut{constructor(){super(...arguments),this.completions=new I4(this._client)}};(function(e){e.Completions=I4})(jF||(jF={}));var NF=class extends ut{create(t,r){return this._client.post("/realtime/sessions",{body:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}};var hR=class extends ut{constructor(){super(...arguments),this.sessions=new NF(this._client)}};hR.Sessions=NF;var Ct=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},Op=function(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},ic,$xe,Pw,PX,wg,gR,LF,mR,IX,Ep,TX,MX,D4,A4,R4,Wyt,Jyt,Gyt,Kyt,Yyt,Zyt,Xyt,Tw=class e extends MF{constructor(){super(...arguments),ic.add(this),$xe.set(this,[]),Pw.set(this,{}),PX.set(this,{}),wg.set(this,void 0),gR.set(this,void 0),LF.set(this,void 0),mR.set(this,void 0),IX.set(this,void 0),Ep.set(this,void 0),TX.set(this,void 0),MX.set(this,void 0),D4.set(this,void 0)}[($xe=new WeakMap,Pw=new WeakMap,PX=new WeakMap,wg=new WeakMap,gR=new WeakMap,LF=new WeakMap,mR=new WeakMap,IX=new WeakMap,Ep=new WeakMap,TX=new WeakMap,MX=new WeakMap,D4=new WeakMap,ic=new WeakSet,Symbol.asyncIterator)](){let t=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):t.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()=>t.length?{value:t.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(t){let r=new e;return r._run(()=>r._fromReadableStream(t)),r}async _fromReadableStream(t,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=Ow.fromReadableStream(t,this.controller);for await(let i of o)Ct(this,ic,"m",A4).call(this,i);if(o.controller.signal?.aborted)throw new Xa;return this._addRun(Ct(this,ic,"m",R4).call(this))}toReadableStream(){return new Ow(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(t,r,n,o,i){let a=new e;return a._run(()=>a._runToolAssistantStream(t,r,n,o,{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),a}async _createToolAssistantStream(t,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 t.submitToolOutputs(r,n,s,{...i,signal:this.controller.signal});this._connected();for await(let l of u)Ct(this,ic,"m",A4).call(this,l);if(u.controller.signal?.aborted)throw new Xa;return this._addRun(Ct(this,ic,"m",R4).call(this))}static createThreadAssistantStream(t,r,n){let o=new e;return o._run(()=>o._threadAssistantStream(t,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(t,r,n,o){let i=new e;return i._run(()=>i._runAssistantStream(t,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return Ct(this,TX,"f")}currentRun(){return Ct(this,MX,"f")}currentMessageSnapshot(){return Ct(this,wg,"f")}currentRunStepSnapshot(){return Ct(this,D4,"f")}async finalRunSteps(){return await this.done(),Object.values(Ct(this,Pw,"f"))}async finalMessages(){return await this.done(),Object.values(Ct(this,PX,"f"))}async finalRun(){if(await this.done(),!Ct(this,gR,"f"))throw Error("Final run was not received.");return Ct(this,gR,"f")}async _createThreadAssistantStream(t,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 t.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let s of a)Ct(this,ic,"m",A4).call(this,s);if(a.controller.signal?.aborted)throw new Xa;return this._addRun(Ct(this,ic,"m",R4).call(this))}async _createAssistantStream(t,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 t.create(r,a,{...o,signal:this.controller.signal});this._connected();for await(let u of s)Ct(this,ic,"m",A4).call(this,u);if(s.controller.signal?.aborted)throw new Xa;return this._addRun(Ct(this,ic,"m",R4).call(this))}static accumulateDelta(t,r){for(let[n,o]of Object.entries(r)){if(!t.hasOwnProperty(n)){t[n]=o;continue}let i=t[n];if(i==null){t[n]=o;continue}if(n==="index"||n==="type"){t[n]=o;continue}if(typeof i=="string"&&typeof o=="string")i+=o;else if(typeof i=="number"&&typeof o=="number")i+=o;else if(SF(i)&&SF(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(!SF(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}`);t[n]=i}return t}_addRun(t){return t}async _threadAssistantStream(t,r,n){return await this._createThreadAssistantStream(r,t,n)}async _runAssistantStream(t,r,n,o){return await this._createAssistantStream(r,t,n,o)}async _runToolAssistantStream(t,r,n,o,i){return await this._createToolAssistantStream(n,t,r,o,i)}};A4=function(t){if(!this.ended)switch(Op(this,TX,t,"f"),Ct(this,ic,"m",Gyt).call(this,t),t.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.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":Ct(this,ic,"m",Xyt).call(this,t);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":Ct(this,ic,"m",Jyt).call(this,t);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":Ct(this,ic,"m",Wyt).call(this,t);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier")}},R4=function(){if(this.ended)throw new Dt("stream has ended, this shouldn't happen");if(!Ct(this,gR,"f"))throw Error("Final run has not been received");return Ct(this,gR,"f")},Wyt=function(t){let[r,n]=Ct(this,ic,"m",Yyt).call(this,t,Ct(this,wg,"f"));Op(this,wg,r,"f"),Ct(this,PX,"f")[r.id]=r;for(let o of n){let i=r.content[o.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(t.event){case"thread.message.created":this._emit("messageCreated",t.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",t.data.delta,r),t.data.delta.content)for(let o of t.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!=Ct(this,LF,"f")){if(Ct(this,mR,"f"))switch(Ct(this,mR,"f").type){case"text":this._emit("textDone",Ct(this,mR,"f").text,Ct(this,wg,"f"));break;case"image_file":this._emit("imageFileDone",Ct(this,mR,"f").image_file,Ct(this,wg,"f"));break}Op(this,LF,o.index,"f")}Op(this,mR,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(Ct(this,LF,"f")!==void 0){let o=t.data.content[Ct(this,LF,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,Ct(this,wg,"f"));break;case"text":this._emit("textDone",o.text,Ct(this,wg,"f"));break}}Ct(this,wg,"f")&&this._emit("messageDone",t.data),Op(this,wg,void 0,"f")}},Jyt=function(t){let r=Ct(this,ic,"m",Kyt).call(this,t);switch(Op(this,D4,r,"f"),t.event){case"thread.run.step.created":this._emit("runStepCreated",t.data);break;case"thread.run.step.delta":let n=t.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==Ct(this,IX,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(Ct(this,Ep,"f")&&this._emit("toolCallDone",Ct(this,Ep,"f")),Op(this,IX,i.index,"f"),Op(this,Ep,r.step_details.tool_calls[i.index],"f"),Ct(this,Ep,"f")&&this._emit("toolCallCreated",Ct(this,Ep,"f")));this._emit("runStepDelta",t.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":Op(this,D4,void 0,"f"),t.data.step_details.type=="tool_calls"&&Ct(this,Ep,"f")&&(this._emit("toolCallDone",Ct(this,Ep,"f")),Op(this,Ep,void 0,"f")),this._emit("runStepDone",t.data,r);break;case"thread.run.step.in_progress":break}},Gyt=function(t){Ct(this,$xe,"f").push(t),this._emit("event",t)},Kyt=function(t){switch(t.event){case"thread.run.step.created":return Ct(this,Pw,"f")[t.data.id]=t.data,t.data;case"thread.run.step.delta":let r=Ct(this,Pw,"f")[t.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let n=t.data;if(n.delta){let o=Tw.accumulateDelta(r,n.delta);Ct(this,Pw,"f")[t.data.id]=o}return Ct(this,Pw,"f")[t.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":Ct(this,Pw,"f")[t.data.id]=t.data;break}if(Ct(this,Pw,"f")[t.data.id])return Ct(this,Pw,"f")[t.data.id];throw new Error("No snapshot available")},Yyt=function(t,r){let n=[];switch(t.event){case"thread.message.created":return[t.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=t.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]=Ct(this,ic,"m",Zyt).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")},Zyt=function(t,r){return Tw.accumulateDelta(r,t)},Xyt=function(t){switch(Op(this,MX,t.data,"f"),t.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":Op(this,gR,t.data,"f"),Ct(this,Ep,"f")&&(this._emit("toolCallDone",Ct(this,Ep,"f")),Op(this,Ep,void 0,"f"));break;case"thread.run.cancelling":break}};var yR=class extends ut{create(t,r,n){return this._client.post(`/threads/${t}/messages`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(t,r,n){return this._client.get(`/threads/${t}/messages/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}update(t,r,n,o){return this._client.post(`/threads/${t}/messages/${r}`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}list(t,r={},n){return li(r)?this.list(t,{},r):this._client.getAPIList(`/threads/${t}/messages`,FF,{query:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}del(t,r,n){return this._client.delete(`/threads/${t}/messages/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},FF=class extends pa{};yR.MessagesPage=FF;var bR=class extends ut{retrieve(t,r,n,o={},i){return li(o)?this.retrieve(t,r,n,{},o):this._client.get(`/threads/${t}/runs/${r}/steps/${n}`,{query:o,...i,headers:{"OpenAI-Beta":"assistants=v2",...i?.headers}})}list(t,r,n={},o){return li(n)?this.list(t,r,{},n):this._client.getAPIList(`/threads/${t}/runs/${r}/steps`,kF,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},kF=class extends pa{};bR.RunStepsPage=kF;var qx=class extends ut{constructor(){super(...arguments),this.steps=new bR(this._client)}create(t,r,n){let{include:o,...i}=r;return this._client.post(`/threads/${t}/runs`,{query:{include:o},body:i,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers},stream:r.stream??!1})}retrieve(t,r,n){return this._client.get(`/threads/${t}/runs/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}update(t,r,n,o){return this._client.post(`/threads/${t}/runs/${r}`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}list(t,r={},n){return li(r)?this.list(t,{},r):this._client.getAPIList(`/threads/${t}/runs`,BF,{query:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}cancel(t,r,n){return this._client.post(`/threads/${t}/runs/${r}/cancel`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}async createAndPoll(t,r,n){let o=await this.create(t,r,n);return await this.poll(t,o.id,n)}createAndStream(t,r,n){return Tw.createAssistantStream(t,this._client.beta.threads.runs,r,n)}async poll(t,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(t,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 kx(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(t,r,n){return Tw.createAssistantStream(t,this._client.beta.threads.runs,r,n)}submitToolOutputs(t,r,n,o){return this._client.post(`/threads/${t}/runs/${r}/submit_tool_outputs`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers},stream:n.stream??!1})}async submitToolOutputsAndPoll(t,r,n,o){let i=await this.submitToolOutputs(t,r,n,o);return await this.poll(t,i.id,o)}submitToolOutputsStream(t,r,n,o){return Tw.createToolAssistantStream(t,r,this._client.beta.threads.runs,n,o)}},BF=class extends pa{};qx.RunsPage=BF;qx.Steps=bR;qx.RunStepsPage=kF;var Mw=class extends ut{constructor(){super(...arguments),this.runs=new qx(this._client),this.messages=new yR(this._client)}create(t={},r){return li(t)?this.create({},t):this._client.post("/threads",{body:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(t,r){return this._client.get(`/threads/${t}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(t,r,n){return this._client.post(`/threads/${t}`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}del(t,r){return this._client.delete(`/threads/${t}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}createAndRun(t,r){return this._client.post("/threads/runs",{body:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers},stream:t.stream??!1})}async createAndRunPoll(t,r){let n=await this.createAndRun(t,r);return await this.runs.poll(n.thread_id,n.id,r)}createAndRunStream(t,r){return Tw.createThreadAssistantStream(t,this._client.beta.threads,r)}};Mw.Runs=qx;Mw.RunsPage=BF;Mw.Messages=yR;Mw.MessagesPage=FF;var Qyt=async e=>{let t=await Promise.allSettled(e),r=t.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 t)o.status==="fulfilled"&&n.push(o.value);return n};var _R=class extends ut{create(t,r,n){return this._client.post(`/vector_stores/${t}/files`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(t,r,n){return this._client.get(`/vector_stores/${t}/files/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}list(t,r={},n){return li(r)?this.list(t,{},r):this._client.getAPIList(`/vector_stores/${t}/files`,CP,{query:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}del(t,r,n){return this._client.delete(`/vector_stores/${t}/files/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}async createAndPoll(t,r,n){let o=await this.create(t,r,n);return await this.poll(t,o.id,n)}async poll(t,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(t,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 kx(s);break;case"failed":case"completed":return a}}}async upload(t,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(t,{file_id:o.id},n)}async uploadAndPoll(t,r,n){let o=await this.upload(t,r,n);return await this.poll(t,o.id,n)}},CP=class extends pa{};_R.VectorStoreFilesPage=CP;var $F=class extends ut{create(t,r,n){return this._client.post(`/vector_stores/${t}/file_batches`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(t,r,n){return this._client.get(`/vector_stores/${t}/file_batches/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}cancel(t,r,n){return this._client.post(`/vector_stores/${t}/file_batches/${r}/cancel`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}async createAndPoll(t,r,n){let o=await this.create(t,r);return await this.poll(t,o.id,n)}listFiles(t,r,n={},o){return li(n)?this.listFiles(t,r,{},n):this._client.getAPIList(`/vector_stores/${t}/file_batches/${r}/files`,CP,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}async poll(t,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(t,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 kx(s);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(t,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,a=Math.min(i,r.length),s=this._client,u=r.values(),l=[...n];async function c(f){for(let p of f){let h=await s.files.create({file:p,purpose:"assistants"},o);l.push(h.id)}}let d=Array(a).fill(u).map(c);return await Qyt(d),await this.createAndPoll(t,{file_ids:l})}};var Iw=class extends ut{constructor(){super(...arguments),this.files=new _R(this._client),this.fileBatches=new $F(this._client)}create(t,r){return this._client.post("/vector_stores",{body:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(t,r){return this._client.get(`/vector_stores/${t}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(t,r,n){return this._client.post(`/vector_stores/${t}`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}list(t={},r){return li(t)?this.list({},t):this._client.getAPIList("/vector_stores",qF,{query:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}del(t,r){return this._client.delete(`/vector_stores/${t}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}},qF=class extends pa{};Iw.VectorStoresPage=qF;Iw.Files=_R;Iw.VectorStoreFilesPage=CP;Iw.FileBatches=$F;var Pp=class extends ut{constructor(){super(...arguments),this.realtime=new hR(this._client),this.vectorStores=new Iw(this._client),this.chat=new jF(this._client),this.assistants=new fR(this._client),this.threads=new Mw(this._client)}};Pp.Realtime=hR;Pp.VectorStores=Iw;Pp.VectorStoresPage=qF;Pp.Assistants=fR;Pp.AssistantsPage=PF;Pp.Threads=Mw;var vR=class extends ut{create(t,r){return this._client.post("/completions",{body:t,...r,stream:t.stream??!1})}};var wR=class extends ut{create(t,r){return this._client.post("/embeddings",{body:t,...r})}};var OP=class extends ut{create(t,r){return this._client.post("/files",Bh({body:t,...r}))}retrieve(t,r){return this._client.get(`/files/${t}`,r)}list(t={},r){return li(t)?this.list({},t):this._client.getAPIList("/files",SR,{query:t,...r})}del(t,r){return this._client.delete(`/files/${t}`,r)}content(t,r){return this._client.get(`/files/${t}/content`,{...r,headers:{Accept:"application/binary",...r?.headers},__binaryResponse:!0})}retrieveContent(t,r){return this._client.get(`/files/${t}/content`,r)}async waitForProcessing(t,{pollInterval:r=5e3,maxWait:n=30*60*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),a=await this.retrieve(t);for(;!a.status||!o.has(a.status);)if(await kx(r),a=await this.retrieve(t),Date.now()-i>n)throw new _g({message:`Giving up on waiting for file ${t} to finish processing after ${n} milliseconds.`});return a}},SR=class extends pa{};OP.FileObjectsPage=SR;var xR=class extends ut{list(t,r={},n){return li(r)?this.list(t,{},r):this._client.getAPIList(`/fine_tuning/jobs/${t}/checkpoints`,UF,{query:r,...n})}},UF=class extends pa{};xR.FineTuningJobCheckpointsPage=UF;var Aw=class extends ut{constructor(){super(...arguments),this.checkpoints=new xR(this._client)}create(t,r){return this._client.post("/fine_tuning/jobs",{body:t,...r})}retrieve(t,r){return this._client.get(`/fine_tuning/jobs/${t}`,r)}list(t={},r){return li(t)?this.list({},t):this._client.getAPIList("/fine_tuning/jobs",zF,{query:t,...r})}cancel(t,r){return this._client.post(`/fine_tuning/jobs/${t}/cancel`,r)}listEvents(t,r={},n){return li(r)?this.listEvents(t,{},r):this._client.getAPIList(`/fine_tuning/jobs/${t}/events`,HF,{query:r,...n})}},zF=class extends pa{},HF=class extends pa{};Aw.FineTuningJobsPage=zF;Aw.FineTuningJobEventsPage=HF;Aw.Checkpoints=xR;Aw.FineTuningJobCheckpointsPage=UF;var Rw=class extends ut{constructor(){super(...arguments),this.jobs=new Aw(this._client)}};Rw.Jobs=Aw;Rw.FineTuningJobsPage=zF;Rw.FineTuningJobEventsPage=HF;var CR=class extends ut{createVariation(t,r){return this._client.post("/images/variations",Bh({body:t,...r}))}edit(t,r){return this._client.post("/images/edits",Bh({body:t,...r}))}generate(t,r){return this._client.post("/images/generations",{body:t,...r})}};var EP=class extends ut{retrieve(t,r){return this._client.get(`/models/${t}`,r)}list(t){return this._client.getAPIList("/models",OR,t)}del(t,r){return this._client.delete(`/models/${t}`,r)}},OR=class extends yX{};EP.ModelsPage=OR;var ER=class extends ut{create(t,r){return this._client.post("/moderations",{body:t,...r})}};var VF=class extends ut{create(t,r,n){return this._client.post(`/uploads/${t}/parts`,Bh({body:r,...n}))}};var PP=class extends ut{constructor(){super(...arguments),this.parts=new VF(this._client)}create(t,r){return this._client.post("/uploads",{body:t,...r})}cancel(t,r){return this._client.post(`/uploads/${t}/cancel`,r)}complete(t,r,n){return this._client.post(`/uploads/${t}/complete`,{body:r,...n})}};PP.Parts=VF;var tbt,wr=class extends gX{constructor({baseURL:t=_P("OPENAI_BASE_URL"),apiKey:r=_P("OPENAI_API_KEY"),organization:n=_P("OPENAI_ORG_ID")??null,project:o=_P("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new Dt("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:t||"https://api.openai.com/v1"};if(!a.dangerouslyAllowBrowser&&Lyt())throw new Dt(`It looks like you're running in a browser-like environment.
This is disabled by default, as it risks exposing your secret API credentials to attackers.
If you understand the risks and have appropriate mitigations in place,
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
`);super({baseURL:a.baseURL,timeout:a.timeout??6e5,httpAgent:a.httpAgent,maxRetries:a.maxRetries,fetch:a.fetch}),this.completions=new vR(this),this.chat=new vP(this),this.embeddings=new wR(this),this.files=new OP(this),this.images=new CR(this),this.audio=new Ew(this),this.moderations=new ER(this),this.models=new EP(this),this.fineTuning=new Rw(this),this.beta=new Pp(this),this.batches=new wP(this),this.uploads=new PP(this),this._options=a,this.apiKey=r,this.organization=n,this.project=o}defaultQuery(){return this._options.defaultQuery}defaultHeaders(t){return{...super.defaultHeaders(t),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project,...this._options.defaultHeaders}}authHeaders(t){return{Authorization:`Bearer ${this.apiKey}`}}stringifyQuery(t){return axe(t,{arrayFormat:"brackets"})}};tbt=wr;wr.OpenAI=tbt;wr.DEFAULT_TIMEOUT=6e5;wr.OpenAIError=Dt;wr.APIError=ps;wr.APIConnectionError=Fx;wr.APIConnectionTimeoutError=_g;wr.APIUserAbortError=Xa;wr.NotFoundError=hF;wr.ConflictError=mF;wr.RateLimitError=yF;wr.BadRequestError=dF;wr.AuthenticationError=fF;wr.InternalServerError=bF;wr.PermissionDeniedError=pF;wr.UnprocessableEntityError=gF;wr.toFile=yxe;wr.fileFromPath=cX;wr.Completions=vR;wr.Chat=vP;wr.Embeddings=wR;wr.Files=OP;wr.FileObjectsPage=SR;wr.Images=CR;wr.Audio=Ew;wr.Moderations=ER;wr.Models=EP;wr.ModelsPage=OR;wr.FineTuning=Rw;wr.Beta=Pp;wr.Batches=wP;wr.BatchesPage=dR;wr.Uploads=PP;var AX=class extends wr{constructor({baseURL:t=_P("OPENAI_BASE_URL"),apiKey:r=_P("AZURE_OPENAI_API_KEY"),apiVersion:n=_P("OPENAI_API_VERSION"),endpoint:o,deployment:i,azureADTokenProvider:a,dangerouslyAllowBrowser:s,...u}={}){if(!n)throw new Dt("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 Dt("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(a&&r)throw new Dt("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(r??(r=ebt),u.defaultQuery={...u.defaultQuery,"api-version":n},t){if(o)throw new Dt("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new Dt("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");t=`${o}/openai`}super({apiKey:r,baseURL:t,...u,...s!==void 0?{dangerouslyAllowBrowser:s}:{}}),this.apiVersion="",this._azureADTokenProvider=a,this.apiVersion=n,this.deploymentName=i}buildRequest(t,r={}){if(tkr.has(t.path)&&t.method==="post"&&t.body!==void 0){if(!SF(t.body))throw new Error("Expected request body to be an object");let n=this.deploymentName||t.body.model||t.__metadata?.model;n!==void 0&&!this.baseURL.includes("/deployments")&&(t.path=`/deployments/${n}${t.path}`)}return super.buildRequest(t,r)}async _getAzureADToken(){if(typeof this._azureADTokenProvider=="function"){let t=await this._azureADTokenProvider();if(!t||typeof t!="string")throw new Dt(`Expected 'azureADTokenProvider' argument to return a string but it returned ${t}`);return t}}authHeaders(t){return{}}async prepareOptions(t){if(t.headers?.["api-key"])return super.prepareOptions(t);let r=await this._getAzureADToken();if(t.headers??(t.headers={}),r)t.headers.Authorization=`Bearer ${r}`;else if(this.apiKey!==ebt)t.headers["api-key"]=this.apiKey;else throw new Dt("Unable to handle auth");return super.prepareOptions(t)}},tkr=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations"]),ebt="<Missing Key>";kh();Lx();jS();OO();WD();Yue();CO();WM();function PR(e,t){if(e.function===void 0)return;let r;if(t?.partial)try{r=kD(e.function.arguments??"{}")}catch{return}else try{r=JSON.parse(e.function.arguments)}catch(o){throw new np([`Function "${e.function.name}" arguments:`,"",e.function.arguments,"","are not valid JSON.",`Error: ${o.message}`].join(`
`))}let n={name:e.function.name,args:r,type:"tool_call"};return t?.returnId&&(n.id=e.id),n}function WF(e){if(e.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:e.id,type:"function",function:{name:e.name,arguments:JSON.stringify(e.args)}}}function JF(e,t){return{name:e.function?.name,args:e.function?.arguments,id:e.id,error:t,type:"invalid_tool_call"}}var qxe=class extends QM{static lc_name(){return"JsonOutputToolsParser"}constructor(t){super(t),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=t?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(t){return await this.parsePartialResult(t,!1)}async parsePartialResult(t,r=!0){let n=t[0].message,o;if(Bu(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=>PR(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}},Sg=class extends qxe{static lc_name(){return"JsonOutputKeyToolsParser"}constructor(t){super(t),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=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){if(this.zodSchema===void 0)return t;let r=await this.zodSchema.safeParseAsync(t);if(r.success)return r.data;throw new np(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(r.error.errors)}`,JSON.stringify(t,null,2))}async parsePartialResult(t){let n=(await super.parsePartialResult(t)).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(t){let n=(await super.parsePartialResult(t,!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}};oh();var nbt=Symbol("Let zodToJsonSchema decide on which parser to use"),rbt={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"},obt=e=>typeof e=="string"?{...rbt,basePath:["#"],definitions:{},name:e}:{...rbt,basePath:["#"],definitions:{},...e};var j4=e=>"_def"in e?e._def:e;function ibt(e){if(!e)return!0;for(let t in e)return!1;return!0}var abt=e=>{let t=obt(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seenRefs:new Set,seen:new Map(Object.entries(t.definitions).map(([n,o])=>[j4(o),{def:j4(o),path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function Uxe(e,t,r,n){n?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function _n(e,t,r,n,o){e[t]=r,Uxe(e,t,n,o)}bd();function sbt(){return{}}bd();function ubt(e,t){let r={type:"array"};return e.type?._def?.typeName!==re.ZodAny&&(r.items=$t(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&_n(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&_n(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(_n(r,"minItems",e.exactLength.value,e.exactLength.message,t),_n(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function lbt(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":t.target==="jsonSchema7"?n.inclusive?_n(r,"minimum",n.value,n.message,t):_n(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),_n(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?_n(r,"maximum",n.value,n.message,t):_n(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),_n(r,"maximum",n.value,n.message,t));break;case"multipleOf":_n(r,"multipleOf",n.value,n.message,t);break}return r}function cbt(){return{type:"boolean"}}function dbt(e,t){return $t(e.type._def,t)}var fbt=(e,t)=>$t(e.innerType._def,t);function zxe(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>zxe(e,t,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 rkr(e,t)}}var rkr=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":_n(r,"minimum",n.value,n.message,t);break;case"max":_n(r,"maximum",n.value,n.message,t);break}return r};function pbt(e,t){return{...$t(e.innerType._def,t),default:e.defaultValue()}}function hbt(e,t,r){return t.effectStrategy==="input"?$t(e.schema._def,t,r):{}}function mbt(e){return{type:"string",enum:[...e.values]}}var nkr=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function gbt(e,t){let r=[$t(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),$t(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(nkr(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:s,...u}=i;a=u}else n=void 0;o.push(a)}}),o.length?{allOf:o,...n}:void 0}function ybt(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}bd();var Hxe,TR={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:()=>(Hxe===void 0&&(Hxe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Hxe),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/};function RX(e,t){let r={type:"string"};function n(o){return t.patternStrategy==="escape"?okr(o):o}if(e.checks)for(let o of e.checks)switch(o.kind){case"min":_n(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,t);break;case"max":_n(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"email":switch(t.emailStrategy){case"format:email":xg(r,"email",o.message,t);break;case"format:idn-email":xg(r,"idn-email",o.message,t);break;case"pattern:zod":Cg(r,TR.email,o.message,t);break}break;case"url":xg(r,"uri",o.message,t);break;case"uuid":xg(r,"uuid",o.message,t);break;case"regex":Cg(r,o.regex,o.message,t);break;case"cuid":Cg(r,TR.cuid,o.message,t);break;case"cuid2":Cg(r,TR.cuid2,o.message,t);break;case"startsWith":Cg(r,RegExp(`^${n(o.value)}`),o.message,t);break;case"endsWith":Cg(r,RegExp(`${n(o.value)}$`),o.message,t);break;case"datetime":xg(r,"date-time",o.message,t);break;case"date":xg(r,"date",o.message,t);break;case"time":xg(r,"time",o.message,t);break;case"duration":xg(r,"duration",o.message,t);break;case"length":_n(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,t),_n(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"includes":{Cg(r,RegExp(n(o.value)),o.message,t);break}case"ip":{o.version!=="v6"&&xg(r,"ipv4",o.message,t),o.version!=="v4"&&xg(r,"ipv6",o.message,t);break}case"emoji":Cg(r,TR.emoji,o.message,t);break;case"ulid":{Cg(r,TR.ulid,o.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{xg(r,"binary",o.message,t);break}case"contentEncoding:base64":{_n(r,"contentEncoding","base64",o.message,t);break}case"pattern:zod":{Cg(r,TR.base64,o.message,t);break}}break}case"nanoid":Cg(r,TR.nanoid,o.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var okr=e=>Array.from(e).map(t=>/[a-zA-Z0-9]/.test(t)?t:`\\${t}`).join(""),xg=(e,t,r,n)=>{e.format||e.anyOf?.some(o=>o.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):_n(e,"format",t,r,n)},Cg=(e,t,r,n)=>{e.pattern||e.allOf?.some(o=>o.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:bbt(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):_n(e,"pattern",bbt(t,n),r,n)},bbt=(e,t)=>{let r=typeof e=="function"?e():e;if(!t.applyRegexFlags||!r.flags)return r.source;let n={i:r.flags.includes("i"),m:r.flags.includes("m"),s:r.flags.includes("s")},o=n.i?r.source.toLowerCase():r.source,i="",a=!1,s=!1,u=!1;for(let l=0;l<o.length;l++){if(a){i+=o[l],a=!1;continue}if(n.i){if(s){if(o[l].match(/[a-z]/)){u?(i+=o[l],i+=`${o[l-2]}-${o[l]}`.toUpperCase(),u=!1):o[l+1]==="-"&&o[l+2]?.match(/[a-z]/)?(i+=o[l],u=!0):i+=`${o[l]}${o[l].toUpperCase()}`;continue}}else if(o[l].match(/[a-z]/)){i+=`[${o[l]}${o[l].toUpperCase()}]`;continue}}if(n.m){if(o[l]==="^"){i+=`(^|(?<=[\r
]))`;continue}else if(o[l]==="$"){i+=`($|(?=[\r
]))`;continue}}if(n.s&&o[l]==="."){i+=s?`${o[l]}\r
`:`[${o[l]}\r
]`;continue}i+=o[l],o[l]==="\\"?a=!0:s&&o[l]==="]"?s=!1:!s&&o[l]==="["&&(s=!0)}try{let l=new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),r.source}return i};function DX(e,t){if(t.target==="openApi3"&&e.keyType?._def.typeName===re.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,o)=>({...n,[o]:$t(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:$t(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??{}};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===re.ZodString&&e.keyType._def.checks?.length){let n=Object.entries(RX(e.keyType._def,t)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(e.keyType?._def.typeName===re.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};return r}function _bt(e,t){if(t.mapStrategy==="record")return DX(e,t);let r=$t(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},n=$t(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function vbt(e){let t=e.values,n=Object.keys(e.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function wbt(){return{not:{}}}function Sbt(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var N4={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Cbt(e,t){if(t.target==="openApi3")return xbt(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in N4&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=N4[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 xbt(e,t)}var xbt=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>$t(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Obt(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"||t.nullableStrategy==="property"?{type:N4[e.innerType._def.typeName],nullable:!0}:{type:[N4[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let n=$t(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=$t(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Ebt(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",Uxe(r,"type",n.message,t);break;case"min":t.target==="jsonSchema7"?n.inclusive?_n(r,"minimum",n.value,n.message,t):_n(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),_n(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?_n(r,"maximum",n.value,n.message,t):_n(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),_n(r,"maximum",n.value,n.message,t));break;case"multipleOf":_n(r,"multipleOf",n.value,n.message,t);break}return r}function ikr(e,t){return t.removeAdditionalStrategy==="strict"?e.catchall._def.typeName==="ZodNever"?e.unknownKeys!=="strict":$t(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??!0:e.catchall._def.typeName==="ZodNever"?e.unknownKeys==="passthrough":$t(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??!0}function Pbt(e,t){let r={type:"object",...Object.entries(e.shape()).reduce((n,[o,i])=>{if(i===void 0||i._def===void 0)return n;let a=$t(i._def,{...t,currentPath:[...t.currentPath,"properties",o],propertyPath:[...t.currentPath,"properties",o]});return a===void 0?n:{properties:{...n.properties,[o]:a},required:i.isOptional()&&!t.openaiStrictMode?n.required:[...n.required,o]}},{properties:{},required:[]}),additionalProperties:ikr(e,t)};return r.required.length||delete r.required,r}var Tbt=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return $t(e.innerType._def,t);let r=$t(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};var Mbt=(e,t)=>{if(t.pipeStrategy==="input")return $t(e.in._def,t);if(t.pipeStrategy==="output")return $t(e.out._def,t);let r=$t(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=$t(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function Ibt(e,t){return $t(e.type._def,t)}function Abt(e,t){let n={type:"array",uniqueItems:!0,items:$t(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&_n(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&_n(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}function Rbt(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>$t(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:$t(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>$t(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Dbt(){return{not:{}}}function jbt(){return{}}var Nbt=(e,t)=>$t(e.innerType._def,t);function $t(e,t,r=!1){let n=t.seen.get(e);if(t.override){let a=t.override?.(e,t,n,r);if(a!==nbt)return a}if(n&&!r){let a=akr(n,t);if(a!==void 0)return"$ref"in a&&t.seenRefs.add(a.$ref),a}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let i=ukr(e,e.typeName,t,r);return i&&lkr(e,t,i),o.jsonSchema=i,i}var akr=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"extract-to-root":let r=e.path.slice(t.basePath.length+1).join("_");return r!==t.name&&t.nameStrategy==="duplicate-ref"&&(t.definitions[r]=e.def),{$ref:[...t.basePath,t.definitionPath,r].join("/")};case"relative":return{$ref:skr(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,o)=>t.currentPath[o]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{}):t.$refStrategy==="seen"?{}:void 0}},skr=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")},ukr=(e,t,r,n)=>{switch(t){case re.ZodString:return RX(e,r);case re.ZodNumber:return Ebt(e,r);case re.ZodObject:return Pbt(e,r);case re.ZodBigInt:return lbt(e,r);case re.ZodBoolean:return cbt();case re.ZodDate:return zxe(e,r);case re.ZodUndefined:return Dbt();case re.ZodNull:return Sbt(r);case re.ZodArray:return ubt(e,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return Cbt(e,r);case re.ZodIntersection:return gbt(e,r);case re.ZodTuple:return Rbt(e,r);case re.ZodRecord:return DX(e,r);case re.ZodLiteral:return ybt(e,r);case re.ZodEnum:return mbt(e);case re.ZodNativeEnum:return vbt(e);case re.ZodNullable:return Obt(e,r);case re.ZodOptional:return Tbt(e,r);case re.ZodMap:return _bt(e,r);case re.ZodSet:return Abt(e,r);case re.ZodLazy:return $t(e.getter()._def,r);case re.ZodPromise:return Ibt(e,r);case re.ZodNaN:case re.ZodNever:return wbt();case re.ZodEffects:return hbt(e,r,n);case re.ZodAny:return sbt();case re.ZodUnknown:return jbt();case re.ZodDefault:return pbt(e,r);case re.ZodBranded:return dbt(e,r);case re.ZodReadonly:return Nbt(e,r);case re.ZodCatch:return fbt(e,r);case re.ZodPipeline:return Mbt(e,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(o=>{})(t)}},lkr=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);var Lbt=(e,t)=>{let r=abt(t),n=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=$t(e._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??{},i=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;i!==void 0&&(o.title=i);let a=(()=>{if(ibt(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]=$t(j4(p),{...r,currentPath:[...r.basePath,r.definitionPath,f]},!0)??{},l.add(f)}return u})(),s=n===void 0?a?{...o,[r.definitionPath]:a}:o:r.nameStrategy==="duplicate-ref"?{...o,...a||r.seenRefs.size?{[r.definitionPath]:{...a,...r.seenRefs.size?{[n]:o}:void 0}}:void 0}:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...a,[n]:o}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),s};function Fbt(e,t){return Lbt(e,{openaiStrictMode:!0,name:t.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function kbt(e,t,r){return kyt({type:"json_schema",json_schema:{...r,name:t,strict:!0,schema:Fbt(e,{name:t})}},n=>e.parse(JSON.parse(n)))}function Bbt(e){return Byt({type:"function",function:{name:e.name,parameters:Fbt(e.parameters,{name:e.name}),strict:!0,...e.description?{description:e.description}:void 0}},{callback:e.function,parser:t=>e.parameters.parse(JSON.parse(t))})}function Ux(e){let{azureOpenAIApiDeploymentName:t,azureOpenAIApiInstanceName:r,azureOpenAIApiKey:n,azureOpenAIBasePath:o,baseURL:i,azureADTokenProvider:a,azureOpenAIEndpoint:s}=e;if((n||a)&&o&&t)return`${o}/${t}`;if((n||a)&&s&&t)return`${s}/openai/deployments/${t}`;if(n||a){if(!r)throw new Error("azureOpenAIApiInstanceName is required when using azureOpenAIApiKey");if(!t)throw new Error("azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey");return`https://${r}.openai.azure.com/openai/deployments/${t}`}return i}oh();function L4(e,t){return e.lc_error_code=t,e.message=`${e.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${t}/
`,e}function TP(e){let t;return e.constructor.name===_g.name?(t=new Error(e.message),t.name="TimeoutError"):e.constructor.name===Xa.name?(t=new Error(e.message),t.name="AbortError"):e.status===400&&e.message.includes("tool_calls")?t=L4(e,"INVALID_TOOL_RESULTS"):e.status===401?t=L4(e,"MODEL_AUTHENTICATION"):e.status===429?t=L4(e,"MODEL_RATE_LIMIT"):e.status===404?t=L4(e,"MODEL_NOT_FOUND"):t=e,t}function $bt(e){if(e)return e==="any"||e==="required"?"required":e==="auto"?"auto":e==="none"?"none":typeof e=="string"?{type:"function",function:{name:e}}:e}function ckr(e){return e.anyOf!==void 0&&Array.isArray(e.anyOf)}function qbt(e){let t=["namespace functions {",""];for(let r of e)r.description&&t.push(`// ${r.description}`),Object.keys(r.parameters.properties??{}).length>0?(t.push(`type ${r.name} = (_: {`),t.push(Ubt(r.parameters,0)),t.push("}) => any;")):t.push(`type ${r.name} = () => any;`),t.push("");return t.push("} // namespace functions"),t.join(`
`)}function Ubt(e,t){let r=[];for(let[n,o]of Object.entries(e.properties??{}))o.description&&t<2&&r.push(`// ${o.description}`),e.required?.includes(n)?r.push(`${n}: ${jX(o,t)},`):r.push(`${n}?: ${jX(o,t)},`);return r.map(n=>" ".repeat(t)+n).join(`
`)}function jX(e,t){if(ckr(e))return e.anyOf.map(r=>jX(r,t)).join(" | ");switch(e.type){case"string":return e.enum?e.enum.map(r=>`"${r}"`).join(" | "):"string";case"number":return e.enum?e.enum.map(r=>`${r}`).join(" | "):"number";case"integer":return e.enum?e.enum.map(r=>`${r}`).join(" | "):"number";case"boolean":return"boolean";case"null":return"null";case"object":return["{",Ubt(e,t+2),"}"].join(`
`);case"array":return e.items?`${jX(e.items,t)}[]`:"any[]";default:return""}}function zbt(e,t){let r;if(yg(e)){let n=Bbt({name:e.name,parameters:e.schema,description:e.description});n.function.parameters?r={type:n.type,function:{name:n.function.name,description:n.function.description,parameters:n.function.parameters,...t?.strict!==void 0?{strict:t.strict}:{}}}:r={type:"function",function:VZ(e,t)}}else r=e;return t?.strict!==void 0&&(r.function.strict=t.strict),r}function dkr(e){return e.role!=="system"&&e.role!=="developer"&&e.role!=="assistant"&&e.role!=="user"&&e.role!=="function"&&e.role!=="tool"&&console.warn(`Unknown message role: ${e.role}`),e.role}function Vbt(e){let t=e._getType();switch(t){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":{if(!xd.isInstance(e))throw new Error("Invalid generic chat message");return dkr(e)}default:throw new Error(`Unknown message type: ${t}`)}}function Vxe(e,t){return e.flatMap(r=>{let n=Vbt(r);n==="system"&&t?.startsWith("o1")&&(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=null),Bu(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(WF),o.content=null):(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 Hbt(e,t){return vw(e)?t?.strict!==void 0?{...e,function:{...e.function,strict:t.strict}}:e:zbt(e,t)}var $h=class extends Qc{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"}}constructor(t){super(t??{}),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}),this.openAIApiKey=t?.apiKey??t?.openAIApiKey??t?.configuration?.apiKey??At("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=t?.configuration?.organization??At("OPENAI_ORGANIZATION"),this.model=t?.model??t?.modelName??this.model,this.modelName=this.model,this.modelKwargs=t?.modelKwargs??{},this.timeout=t?.timeout,this.temperature=t?.temperature??this.temperature,this.topP=t?.topP??this.topP,this.frequencyPenalty=t?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=t?.presencePenalty??this.presencePenalty,this.maxTokens=t?.maxTokens,this.logprobs=t?.logprobs,this.topLogprobs=t?.topLogprobs,this.n=t?.n??this.n,this.logitBias=t?.logitBias,this.stop=t?.stopSequences??t?.stop,this.stopSequences=this?.stop,this.user=t?.user,this.__includeRawResponse=t?.__includeRawResponse,this.audio=t?.audio,this.modalities=t?.modalities,this.reasoningEffort=t?.reasoningEffort,this.model==="o1"&&(this.disableStreaming=!0),this.streaming=t?.streaming??!1,this.streamUsage=t?.streamUsage??this.streamUsage,this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...t?.configuration},t?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=t.supportsStrictToolCalling)}getLsParams(t){let r=this.invocationParams(t);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:t.stop}}bindTools(t,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.bind({tools:t.map(o=>Hbt(o,{strict:n})),...r})}createResponseFormat(t){return t&&t.type==="json_schema"&&t.json_schema.schema&&NX(t.json_schema.schema)?kbt(t.json_schema.schema,t.json_schema.name,{description:t.json_schema.description}):t}invocationParams(t,r){let n;t?.strict!==void 0?n=t.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling);let o={};t?.stream_options!==void 0?o={stream_options:t.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,max_tokens:this.maxTokens===-1?void 0:this.maxTokens,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:t?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:t?.functions,function_call:t?.function_call,tools:t?.tools?.length?t.tools.map(s=>Hbt(s,{strict:n})):void 0,tool_choice:$bt(t?.tool_choice),response_format:this.createResponseFormat(t?.response_format),seed:t?.seed,...o,parallel_tool_calls:t?.parallel_tool_calls,...this.audio||t?.audio?{audio:this.audio||t?.audio}:{},...this.modalities||t?.modalities?{modalities:this.modalities||t?.modalities}:{},...this.modelKwargs};t?.prediction!==void 0&&(i.prediction=t.prediction);let a=t?.reasoning_effort??this.reasoningEffort;return a!==void 0&&(i.reasoning_effort=a),i}_convertOpenAIChatCompletionMessageToBaseMessage(t,r){let n=t.tool_calls;switch(t.role){case"assistant":{let o=[],i=[];for(let u of n??[])try{o.push(PR(u,{returnId:!0}))}catch(l){i.push(JF(u,l.message))}let a={function_call:t.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 t.audio&&(a.audio=t.audio),new Po({content:t.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new xd(t.content||"",t.role??"unknown")}}_convertOpenAIDeltaToBaseMessageChunk(t,r,n){let o=t.role??n,i=t.content??"",a;t.function_call?a={function_call:t.function_call}:t.tool_calls?a={tool_calls:t.tool_calls}:a={},this.__includeRawResponse&&(a.__raw_response=r),t.audio&&(a.audio={...t.audio,index:r.choices[0].index});let s={usage:{...r.usage}};if(o==="user")return new Nm({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(t.tool_calls))for(let l of t.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new Gr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new ay({content:i,response_metadata:s}):o==="developer"?new ay({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new OS({content:i,additional_kwargs:a,name:t.name,response_metadata:s}):o==="tool"?new bO({content:i,additional_kwargs:a,tool_call_id:t.tool_call_id,response_metadata:s}):new jm({content:i,role:o,response_metadata:s})}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}async*_streamResponseChunks(t,r,n){let o=Vxe(t,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let h={...p};c.finish_reason!=null&&(h.finish_reason=c.finish_reason,h.system_fingerprint=l.system_fingerprint,h.model_name=l.model),this.logprobs&&(h.logprobs=c.logprobs);let m=new ii({message:f,text:f.content,generationInfo:h});yield m,await n?.handleLLMNewToken(m.text??"",p,void 0,void 0,void 0,{chunk:m})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new ii({message:new Gr({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 _generate(t,r,n){let o={},i=this.invocationParams(r),a=Vxe(t,this.model);if(i.stream){let s=this._streamResponseChunks(t,r,n),u={};for await(let h of s){h.message.response_metadata={...h.generationInfo,...h.message.response_metadata};let m=h.generationInfo?.completion??0;u[m]===void 0?u[m]=h:u[m]=u[m].concat(h)}let l=Object.entries(u).sort(([h],[m])=>parseInt(h,10)-parseInt(m,10)).map(([h,m])=>m),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(t,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let h of s?.choices??[]){let _={text:h.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(h.message??{role:"assistant"},s)};_.generationInfo={...h.finish_reason?{finish_reason:h.finish_reason}:{},...h.logprobs?{logprobs:h.logprobs}:{}},Bu(_.message)&&(_.message.usage_metadata=o),_.message=new Po(Object.fromEntries(Object.entries(_.message).filter(([g])=>!g.startsWith("lc_")))),p.push(_)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async getEstimatedTokenCountFromPrompt(t,r,n){let o=(await this.getNumTokensFromMessages(t)).totalCount;if(r&&n!=="auto"){let i=qbt(r);o+=await this.getNumTokens(i),o+=9}return r&&t.find(i=>i._getType()==="system")&&(o-=4),n==="none"?o+=1:typeof n=="object"&&(o+=await this.getNumTokens(n.name)+4),o}async getNumTokensFromGenerations(t){return(await Promise.all(t.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(t){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(t.map(async a=>{let s=await this.getNumTokens(a.content),u=await this.getNumTokens(Vbt(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(t,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.chat.completions.create(t,n)}catch(o){throw TP(o)}})}async betaParsedCompletionWithRetry(t,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.beta.chat.completions.parse(t,n)}catch(o){throw TP(o)}})}_getClientOptions(t){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=Ux(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new wr(i)}return{...this.clientConfig,...t}}_llmType(){return"openai"}_combineLLMOutput(...t){return t.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(t,r){let n,o,i,a;fkr(t)?(n=t.schema,o=t.name,i=t.method,a=t.includeRaw):(n=t,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"}}),NX(n)?u=AS.fromZodSchema(n):u=new RS;else if(i==="jsonSchema")s=this.bind({response_format:{type:"json_schema",json_schema:{name:o??"extract",description:n.description,schema:n,strict:r?.strict}}}),NX(n)?u=AS.fromZodSchema(n):u=new RS;else{let f=o??"extract";if(NX(n)){let p=Li(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 Sg({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 Sg({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Fi.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Fi.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Ha.from([{raw:s},d])}};function NX(e){return typeof e?.parse=="function"}function fkr(e){return e!==void 0&&typeof e.schema=="object"}Lx();kh();var zx=class extends Cp{constructor(t){let r={maxConcurrency:2,...t};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??At("OPENAI_API_KEY");this.organization=r?.configuration?.organization??At("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,...t?.configuration}}async embedDocuments(t){let r=bg(this.stripNewLines?t.map(a=>a.replace(/\n/g," ")):t,this.batchSize),n=r.map(a=>{let s={model:this.model,input:a};return this.dimensions&&(s.dimensions=this.dimensions),this.embeddingWithRetry(s)}),o=await Promise.all(n),i=[];for(let a=0;a<o.length;a+=1){let s=r[a],{data:u}=o[a];for(let l=0;l<s.length;l+=1)i.push(u[l].embedding)}return i}async embedQuery(t){let r={model:this.model,input:this.stripNewLines?t.replace(/\n/g," "):t};this.dimensions&&(r.dimensions=this.dimensions);let{data:n}=await this.embeddingWithRetry(r);return n[0].embedding}async embeddingWithRetry(t){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=Ux(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new wr(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(t,r)}catch(n){throw TP(n)}})}};var LX=class extends zx{constructor(t){super(t),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=t?.batchSize??1,this.azureOpenAIApiKey=t?.azureOpenAIApiKey??t?.apiKey??At("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=t?.azureOpenAIApiVersion??t?.openAIApiVersion??At("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=t?.azureOpenAIBasePath??At("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=t?.azureOpenAIApiInstanceName??At("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(t?.azureOpenAIApiEmbeddingsDeploymentName||t?.azureOpenAIApiDeploymentName)??(At("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||At("AZURE_OPENAI_API_DEPLOYMENT_NAME")),this.azureADTokenProvider=t?.azureADTokenProvider}async embeddingWithRetry(t){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=Ux(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 AX({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(t,r)}catch(n){throw TP(n)}})}};bd();wO();m4();sy();BD();UD();xV();var FX=class extends iF{get lc_namespace(){return["langchain","tools"]}constructor(t){super(t??{}),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=t?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=t?.responseFormat??this.responseFormat}async invoke(t,r){let n,o,i=jr(r);return FD(t)?(n=t.id,o=t.args,i={...i,toolCall:t,configurable:{...i.configurable,tool_call_id:n}}):o=t,this.call(o,i)}async call(t,r,n){let o;try{o=await this.schema.parseAsync(t)}catch(p){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
Details: ${p.message}`),new LD(h,JSON.stringify(t))}let i=GM(r),s=await os.configure(i.callbacks,this.callbacks,i.tags||n,this.tags,i.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof o=="string"?o:JSON.stringify(o),i.runId,void 0,void 0,void 0,i.runName);delete i.runId;let u;try{u=await this._call(o,s,i)}catch(p){throw await s?.handleToolError(p),p}let l,c;if(this.responseFormat==="content_and_artifact")if(Array.isArray(u)&&u.length===2)[l,c]=u;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.
Result: ${JSON.stringify(u)}`);else l=u;let d;i&&"configurable"in i&&(d=i.configurable.tool_call_id);let f=pkr({content:l,artifact:c,toolCallId:d,name:this.name});return await s?.handleToolEnd(f),f}},F4=class extends FX{constructor(t){super(t),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:Tr.object({input:Tr.string().optional()}).transform(r=>r.input)})}call(t,r){return super.call(typeof t=="string"||!t?{input:t}:t,r)}},Wxe=class extends F4{static lc_name(){return"DynamicTool"}constructor(t){super(t),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=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect}async call(t,r){let n=GM(r);return n.runName===void 0&&(n.runName=this.name),super.call(t,n)}async _call(t,r,n){return this.func(t,r,n)}},Jxe=class extends FX{static lc_name(){return"DynamicStructuredTool"}constructor(t){super(t),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=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect,this.schema=Rf(t.schema)?t.schema:Tr.object({}).passthrough()}async call(t,r,n){let o=GM(r);return o.runName===void 0&&(o.runName=this.name),super.call(t,o,n)}_call(t,r,n){return this.func(t,r,n)}};function Tp(e,t){if(!t.schema||Rf(t.schema)&&(!("shape"in t.schema)||!t.schema.shape))return new Wxe({...t,description:t.description??t.schema?.description??`${t.name} tool`,func:async(n,o,i)=>new Promise((a,s)=>{let u=Ta(i,{callbacks:o?.getChild()});jc.runWithConfig(tp(u),async()=>{try{a(e(n,u))}catch(l){s(l)}})})});let r=t.description??t.schema.description??`${t.name} tool`;return new Jxe({...t,description:r,schema:t.schema,func:async(n,o,i)=>new Promise((a,s)=>{let u=Ta(i,{callbacks:o?.getChild()});jc.runWithConfig(tp(u),async()=>{try{a(e(n,u))}catch(l){s(l)}})})})}function pkr(e){let{content:t,artifact:r,toolCallId:n}=e;return n&&!ELe(t)?typeof t=="string"||Array.isArray(t)&&t.every(o=>typeof o=="object")?new CS({content:t,artifact:r,tool_call_id:n,name:e.name}):new CS({content:hkr(t),artifact:r,tool_call_id:n,name:e.name}):t}function hkr(e){try{return JSON.stringify(e,null,2)}catch{return`${e}`}}var Gxe=class extends F4{static lc_name(){return"DallEAPIWrapper"}constructor(t){t?.responseFormat!==void 0&&["url","b64_json"].includes(t.responseFormat)&&(t.dallEResponseFormat=t.responseFormat,t.responseFormat="content"),super(t),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=t?.apiKey??t?.openAIApiKey??At("OPENAI_API_KEY"),n=t?.organization??At("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:t?.baseUrl};this.client=new wr(o),this.model=t?.model??t?.modelName??this.model,this.style=t?.style??this.style,this.quality=t?.quality??this.quality,this.n=t?.n??this.n,this.size=t?.size??this.size,this.dallEResponseFormat=t?.dallEResponseFormat??this.dallEResponseFormat,this.user=t?.user}processMultipleGeneratedUrls(t){return this.dallEResponseFormat==="url"?t.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)):t.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(t){let r={model:this.model,prompt:t,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(Gxe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var $X=require("obsidian");var kX=class extends Cp{constructor(t){let r={maxConcurrency:2,...t};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||At("JINA_API_KEY")||At("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(t){return this.stripNewLines?t.map(r=>typeof r=="string"?r.replace(/\n/g," "):r.text?{text:r.text.replace(/\n/g," ")}:r):t}async embedDocuments(t){let r=bg(this.doStripNewLines(t),this.batchSize),n=r.map(a=>{let s=this.getParams(a);return this.embeddingWithRetry(s)}),o=await Promise.all(n),i=[];for(let a=0;a<o.length;a+=1){let s=r[a],u=o[a]||[];for(let l=0;l<s.length;l+=1)i.push(u[l])}return i}async embedQuery(t){let r=this.getParams(this.doStripNewLines([t]),!0);return(await this.embeddingWithRetry(r)||[[]])[0]}getParams(t,r){return{model:this.model,input:t,dimensions:this.dimensions,task:r?"retrieval.query":"retrieval.passage",normalized:this.normalized}}async embeddingWithRetry(t){let n=await(await fetch(this.baseUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify(t)})).json();if("detail"in n&&n.detail)throw new Error(`${n.detail}`);return n.data.map(({embedding:o})=>o)}};var BX=class extends kX{constructor(t){super(t),t?.baseUrl&&(this.baseUrl=t.baseUrl)}};var mkr={"copilot-plus":zx,"copilot-plus-jina":BX,openai:zx,cohereai:YZ,google:rX,"azure openai":LX,ollama:aX,"lm-studio":zx,"3rd party (openai-format)":zx},hs=class e{constructor(){this.providerApiKeyMap={"copilot-plus":()=>pe().plusLicenseKey,"copilot-plus-jina":()=>pe().plusLicenseKey,openai:()=>pe().openAIApiKey,cohereai:()=>pe().cohereApiKey,google:()=>pe().googleApiKey,"azure openai":()=>pe().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>""};this.initialize(),ll(()=>this.initialize())}initialize(){let t=pe().activeEmbeddingModels;this.activeEmbeddingModels=t,this.buildModelMap(t)}static getInstance(){return e.instance||(e.instance=new e),e.instance}getProviderConstructor(t){let r=mkr[t.provider];if(!r)throw console.warn(`Unknown provider: ${t.provider} for model: ${t.name}`),new Error(`Unknown provider: ${t.provider} for model: ${t.name}`);return r}buildModelMap(t){e.modelMap={};let r=e.modelMap;t.forEach(n=>{if(n.enabled){if(!Object.values(AO).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=Nr(n);r[a]={hasApiKey:!!i,EmbeddingConstructor:o,vendor:n.provider}}})}static getModelName(t){let r=t;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: ${t}`)}getCustomModel(t){return this.activeEmbeddingModels.filter(r=>{let n=Nr(r);return t===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:t}=pe();if(!e.modelMap.hasOwnProperty(t))throw new or(`No embedding model found for: ${t}`);let r=this.getCustomModel(t);if(r.plusExclusive&&!pe().isPlusUser)throw new $X.Notice("Plus-only model, please consider upgrading to Plus to access it."),new or("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await ms.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new $X.Notice("Believer-only model, please consider upgrading to Believer to access it."),new or("Believer-only model selected but user is not on Believer plan")}let n=e.modelMap[t];if(!n.hasApiKey)throw new or(`API key is not provided for the embedding model: ${t}`);let o=await this.getEmbeddingConfig(r);try{return e.embeddingModel=new n.EmbeddingConstructor(o),e.embeddingModel}catch(i){throw new or(`Error creating embedding model: ${t}. ${i.message}`)}}async getEmbeddingConfig(t){let r=pe(),n=t.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await Ho(r.plusLicenseKey),timeout:1e4,batchSize:pe().embeddingBatchSize,configuration:{baseURL:cI,fetch:t.enableCors?Bl:void 0}},"copilot-plus-jina":{model:n,apiKey:await Ho(r.plusLicenseKey),timeout:1e4,batchSize:pe().embeddingBatchSize,dimensions:t.dimensions,baseUrl:cI+"/embeddings",configuration:{fetch:t.enableCors?Bl:void 0}},openai:{modelName:n,apiKey:await Ho(t.apiKey||r.openAIApiKey),timeout:1e4,batchSize:pe().embeddingBatchSize,configuration:{baseURL:t.baseUrl,fetch:t.enableCors?Bl:void 0}},cohereai:{model:n,apiKey:await Ho(t.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await Ho(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await Ho(t.apiKey||r.azureOpenAIApiKey),azureOpenAIApiInstanceName:t.azureOpenAIApiInstanceName||r.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:t.azureOpenAIApiEmbeddingDeploymentName||r.azureOpenAIApiEmbeddingDeploymentName,azureOpenAIApiVersion:t.azureOpenAIApiVersion||r.azureOpenAIApiVersion},ollama:{baseUrl:t.baseUrl||"http://localhost:11434",model:n,truncate:!0},"lm-studio":{modelName:n,openAIApiKey:await Ho(t.apiKey||"default-key"),configuration:{baseURL:t.baseUrl||"http://localhost:1234/v1",fetch:t.enableCors?Bl:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await Ho(t.apiKey||""),batchSize:pe().embeddingBatchSize,configuration:{baseURL:t.baseUrl,fetch:t.enableCors?Bl:void 0,dangerouslyAllowBrowser:!0}}}[t.provider]||{};return{...o,...a}}async ping(t){let r=async n=>{let o={...t,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 $X.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: `+bi(n)+`
with CORS Error: `+bi(o);throw new Error(i)}}}};var J4=require("obsidian");var Wbt={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"},Jbt={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},k4=Object.keys(Wbt);function Gbt(e){return e!==void 0&&k4.includes(e)?Wbt[e]:void 0}var gkr=Date.now().toString().slice(5),ykr=0;var Kbt=BigInt(1e3),Ybt=BigInt(1e6),Zbt=BigInt(1e9);var Kxe=65535;function ei(e,t){if(t.length<Kxe)Array.prototype.push.apply(e,t);else{let r=t.length;for(let n=0;n<r;n+=Kxe)Array.prototype.push.apply(e,t.slice(n,n+Kxe))}}function Qbt(e,...t){return e.replace(/%(?:(?<position>\d+)\$)?(?<width>-?\d*\.?\d*)(?<type>[dfs])/g,function(...r){let n=r[r.length-1],{width:o,type:i,position:a}=n,s=a?t[Number.parseInt(a)-1]:t.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 bkr(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function _kr(){return typeof process<"u"&&process.release&&process.release.name==="node"}function Xbt(){return BigInt(Math.floor(performance.now()*1e6))}function MR(e){return typeof e=="number"&&(e=BigInt(e)),e<Kbt?`${e}ns`:e<Ybt?`${e/Kbt}\u03BCs`:e<Zbt?`${e/Ybt}ms`:`${e/Zbt}s`}function Og(){return bkr()?Xbt():_kr()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?Xbt():BigInt(0)}function B4(){return`${gkr}-${ykr++}`}function GF(e,t){return Object.hasOwn===void 0?Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0:Object.hasOwn(e,t)?e[t]:void 0}function e_t(e,t){return t[1]===e[1]?e[0]-t[0]:t[1]-e[1]}function KF(e){if(e.length===0)return[];if(e.length===1)return e[0];for(let r=1;r<e.length;r++)if(e[r].length<e[0].length){let n=e[0];e[0]=e[r],e[r]=n}let t=new Map;for(let r of e[0])t.set(r,1);for(let r=1;r<e.length;r++){let n=0;for(let o of e[r]){let i=t.get(o);i===r&&(t.set(o,i+1),n++)}if(n===0)return[]}return e[0].filter(r=>{let n=t.get(r);return n!==void 0&&t.set(r,0),n===e.length})}function qX(e,t){let r={},n=t.length;for(let o=0;o<n;o++){let i=t[o],a=i.split("."),s=e,u=a.length;for(let l=0;l<u;l++)if(s=s[a[l]],typeof s=="object"){if(s!==null&&"lat"in s&&"lon"in s&&typeof s.lat=="number"&&typeof s.lon=="number"){s=r[i]=s;break}else if(!Array.isArray(s)&&s!==null&&l===u-1){s=void 0;break}}else if((s===null||typeof s!="object")&&l<u-1){s=void 0;break}typeof s<"u"&&(r[i]=s)}return r}function YF(e,t){return qX(e,[t])[t]}var vkr={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344};function Yxe(e,t){let r=vkr[t];if(r===void 0)throw new Error(_t("INVALID_DISTANCE_SUFFIX",e).message);return e*r}function UX(e,t){e.hits=e.hits.map(r=>({...r,document:{...r.document,...t.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 gs(e){return e?.constructor?.name==="AsyncFunction"}var wkr=k4.join(`
- `),Skr={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:
- ${wkr}`,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 _t(e,...t){let r=new Error(Qbt(Skr[e]??`Unsupported Orama Error code: ${e}`,...t));return r.code=e,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}function t_t(e){return{raw:Number(e),formatted:MR(e)}}function r_t(e){if(e.id){if(typeof e.id!="string")throw _t("DOCUMENT_ID_MUST_BE_STRING",typeof e.id);return e.id}return B4()}function Zxe(e,t){for(let[r,n]of Object.entries(t)){let o=e[r];if(!(typeof o>"u")&&!(n==="geopoint"&&typeof o=="object"&&typeof o.lon=="number"&&typeof o.lat=="number")&&!(n==="enum"&&(typeof o=="string"||typeof o=="number"))){if(n==="enum[]"&&Array.isArray(o)){let i=o.length;for(let a=0;a<i;a++)if(typeof o[a]!="string"&&typeof o[a]!="number")return r+"."+a;continue}if(Hx(n)){let i=Qxe(n);if(!Array.isArray(o)||o.length!==i)throw _t("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(ZF(n)){if(!Array.isArray(o))return r;let i=Xxe(n),a=o.length;for(let s=0;s<a;s++)if(typeof o[s]!==i)return r+"."+s;continue}if(typeof n=="object"){if(!o||typeof o!="object")return r;let i=Zxe(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}var xkr={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},Ckr={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"};function n_t(e){return e==="geopoint"}function Hx(e){return typeof e=="string"&&/^vector\[\d+\]$/.test(e)}function ZF(e){return typeof e=="string"&&xkr[e]}function Xxe(e){return Ckr[e]}function Qxe(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw _t("INVALID_VECTOR_VALUE",e);case t<=0:throw _t("INVALID_VECTOR_SIZE",e);default:return t}}function o_t(){return{idToInternalId:new Map,internalIdToId:[],save:Okr,load:Ekr}}function Okr(e){return{internalIdToId:e.internalIdToId}}function Ekr(e,t){let{internalIdToId:r}=t;e.internalDocumentIDStore.idToInternalId.clear(),e.internalDocumentIDStore.internalIdToId=[];let n=r.length;for(let o=0;o<n;o++){let i=r[o];e.internalDocumentIDStore.idToInternalId.set(i,o+1),e.internalDocumentIDStore.internalIdToId.push(i)}}function ko(e,t){if(typeof t=="string"){let r=e.idToInternalId.get(t);if(r)return r;let n=e.idToInternalId.size+1;return e.idToInternalId.set(t,n),e.internalIdToId.push(t),n}return t>e.internalIdToId.length?ko(e,t.toString()):t}function qh(e,t){if(e.internalIdToId.length<t)throw new Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function Tkr(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function Mkr(e,t){let r=ko(e.sharedInternalDocumentStore,t);return e.docs[r]}function Ikr(e,t){let r=t.length,n=Array.from({length:r});for(let o=0;o<r;o++){let i=ko(e.sharedInternalDocumentStore,t[o]);n[o]=e.docs[i]}return n}function Akr(e){return e.docs}function Rkr(e,t,r){let n=ko(e.sharedInternalDocumentStore,t);return typeof e.docs[n]<"u"?!1:(e.docs[n]=r,e.count++,!0)}function Dkr(e,t){let r=ko(e.sharedInternalDocumentStore,t);return typeof e.docs[r]>"u"?!1:(delete e.docs[r],e.count--,!0)}function jkr(e){return e.count}function Nkr(e,t){let r=t;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:e}}function Lkr(e){return{docs:e.docs,count:e.count}}function i_t(){return{create:Tkr,get:Mkr,getMultiple:Ikr,getAll:Akr,store:Rkr,remove:Dkr,count:jkr,load:Nkr,save:Lkr}}var a_t=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"];function s_t(e,t){let r=[],n=e.plugins?.length;if(!n)return r;for(let o=0;o<n;o++)try{let i=e.plugins[o];typeof i[t]=="function"&&r.push(i[t])}catch(i){throw console.error("Caught error in getAllPluginsByHook:",i),_t("PLUGIN_CRASHED")}return r}var u_t=["tokenizer","index","documentsStore","sorter"],eCe=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"];function Eg(e,t,r,n){if(e.some(gs))return(async()=>{for(let i of e)await i(t,r,n)})();for(let i of e)i(t,r,n)}function IR(e,t,r){if(e.some(gs))return(async()=>{for(let o of e)await o(t,r)})();for(let o of e)o(t,r)}function XF(e,t,r,n,o){if(e.some(gs))return(async()=>{for(let a of e)await a(t,r,n,o)})();for(let a of e)a(t,r,n,o)}function QF(e,t,r,n){if(e.some(gs))return(async()=>{for(let i of e)await i(t,r,n)})();for(let i of e)i(t,r,n)}function l_t(e,t){if(e.some(gs))return(async()=>{for(let n of e)await n(t)})();for(let n of e)n(t)}function tCe(e){let t=e.r;return e.r=t.l,t.l=e,e.h=Math.max(Uh(e.l),Uh(e.r))+1,t.h=Math.max(Uh(t.l),Uh(t.r))+1,t}function rCe(e){let t=e.l;return e.l=t.r,t.r=e,e.h=Math.max(Uh(e.l),Uh(e.r))+1,t.h=Math.max(Uh(t.l),Uh(t.r))+1,t}function d_t(e,t,r){let n=[];function o(i){i!==null&&(t<i.k&&o(i.l),i.k>=t&&i.k<=r&&ei(n,i.v),r>i.k&&o(i.r))}return o(e.root),n}function nCe(e,t,r=!1){let n=[];if(e===null)return n;let o=[e.root];for(;o.length>0;){let i=o.pop();i&&(r&&i.k>=t&&ei(n,i.v),!r&&i.k>t&&ei(n,i.v),o.push(i.r),o.push(i.l))}return n}function oCe(e,t,r=!1){let n=[];if(e===null)return n;let o=[e.root];for(;o.length>0;){let i=o.pop();i&&(r&&i.k<=t&&ei(n,i.v),!r&&i.k<t&&ei(n,i.v),o.push(i.r),o.push(i.l))}return n}function f_t(e,t){for(;e!==null;)if(t<e.k)e=e.l;else if(t>e.k)e=e.r;else return e;return null}function p_t(e,t){return{root:{k:e,v:t,l:null,r:null,h:0}}}var c_t=0;function h_t(e,t,r,n=500){function o(i,a,s){if(i===null)return c_t++,{k:a,v:s,l:null,r:null,h:0};if(a<i.k)i.l=o(i.l,a,s);else if(a>i.k)i.r=o(i.r,a,s);else return i.v.push(...s),i;return c_t%n===0?kkr(i,a):i}e.root=o(e.root,t,r)}function kkr(e,t){e.h=1+Math.max(Uh(e.l),Uh(e.r));let r=Uh(e.l)-Uh(e.r);return r>1&&t<e.l.k?rCe(e):r<-1&&t>e.r.k?tCe(e):r>1&&t>e.l.k?(e.l=tCe(e.l),rCe(e)):r<-1&&t<e.r.k?(e.r=rCe(e.r),tCe(e)):e}function Uh(e){return e!==null?e.h:-1}function m_t(e,t){let r=f_t(e.root,t);return r===null?null:r.v}function Bkr(e,t){if(e===null||e.root===null)return;let r=e.root,n=null;for(;r!=null&&r.k!==t;)n=r,t<r.k?r=r.l:r=r.r;if(r===null)return;(()=>{if(r.l===null&&r.r===null)n===null?e.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?e.root=i:n.l===r?n.l=i:n.r=i}})()}function g_t(e,t,r){let n=f_t(e.root,r);if(n){if(n.v.length===1){Bkr(e,r);return}n.v.splice(n.v.indexOf(t),1)}}function y_t(){return{numberToDocumentId:new Map}}function b_t(e,t,r){return e.numberToDocumentId.has(t)?(e.numberToDocumentId.get(t).push(r),e):(e.numberToDocumentId.set(t,[r]),e)}function __t(e,t,r){e?.numberToDocumentId.set(r,e?.numberToDocumentId.get(r)?.filter(n=>n!==t)??[]),e?.numberToDocumentId.get(r)?.length===0&&e?.numberToDocumentId.delete(r)}function v_t(e,t){let r=Object.keys(t);if(r.length!==1)throw new Error("Invalid operation");let n=r[0];switch(n){case"eq":{let o=t[n];return e.numberToDocumentId.get(o)??[]}case"in":{let o=t[n],i=[];for(let a of o){let s=e.numberToDocumentId.get(a);s!=null&&ei(i,s)}return i}case"nin":{let o=t[n],i=[],a=e.numberToDocumentId.keys();for(let s of a){if(o.includes(s))continue;let u=e.numberToDocumentId.get(s);u!=null&&ei(i,u)}return i}}throw new Error("Invalid operation")}function w_t(e,t){let r=Object.keys(t);if(r.length!==1)throw new Error("Invalid operation");let n=r[0];switch(n){case"containsAll":{let i=t[n].map(a=>e.numberToDocumentId.get(a)??[]);return KF(i)}}throw new Error("Invalid operation")}function $kr(e,t,r){if(r<0)return-1;if(e===t)return 0;let n=e.length,o=t.length;if(n===0)return o<=r?o:-1;if(o===0)return n<=r?n:-1;if(e=e.toLowerCase(),t=t.toLowerCase(),t.startsWith(e)||e.startsWith(t))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++)e[a-1]===t[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 iCe(e,t,r){let n=$kr(e,t,r);return{distance:n,isBounded:n>=0}}var aCe=class{constructor(t,r,n){Ll(this,"k");Ll(this,"s");Ll(this,"c",{});Ll(this,"d",[]);Ll(this,"e");Ll(this,"w","");this.k=t,this.s=r,this.e=n}toJSON(){return{w:this.w,s:this.s,c:this.c,d:this.d,e:this.e}}};function ek(e,t){e.w=t.w+e.s}function zX(e,t){e.d.push(t)}function qkr(e,t){let r=e.d.indexOf(t);return r===-1?!1:(e.d.splice(r,1),!0)}function sCe(e,t,r,n,o){if(e.e){let{w:i,d:a}=e;if(n&&i!==r)return{};if(GF(t,i)==null&&(o?Math.abs(r.length-i.length)<=o&&iCe(r,i,o).isBounded&&(t[i]=[]):t[i]=[]),GF(t,i)!=null&&a.length>0){let s=new Set(t[i]),u=a.length;for(let l=0;l<u;l++)s.add(a[l]);t[i]=Array.from(s)}}for(let i of Object.keys(e.c))sCe(e.c[i],t,r,n,o);return t}function S_t(e,t){let r="",n=Math.min(e.length,t.length);for(let o=0;o<n;o++){if(e[o]!==t[o])return r;r+=e[o]}return r}function AR(e=!1,t="",r=""){return new aCe(r,t,e)}function x_t(e,t,r){let n=t.length;for(let o=0;o<n;o++){let i=t[o],a=t.substring(o),s=e.c[i];if(s){let u=s.s,l=u.length,c=S_t(u,a),d=c.length;if(u===a){zX(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=AR(!0,a,i);p.c[f]=s;let h=p.c[f];h.s=u.substring(d),h.k=f,e.c[i]=p,ek(p,e),ek(h,p),zX(p,r);return}if(d<l&&d<a.length){let p=AR(!1,c,i);p.c[f]=s,e.c[i]=p;let h=p.c[f];h.s=u.substring(d),h.k=f;let m=a[d],_=AR(!0,t.substring(o+d),m);zX(_,r),p.c[m]=_,ek(p,e),ek(_,p),ek(h,p);return}o+=l-1,e=s}else{let u=AR(!0,a,i);zX(u,r),e.c[i]=u,ek(u,e);return}}}function $4(e,t,r,n,o,i){if(!(n<0)){if(e.w.startsWith(t)){sCe(e,i,t,!1,0);return}if(e.e){let{w:a,d:s}=e;if(a&&(iCe(t,a,o).isBounded&&(i[a]=[]),GF(i,a)!=null&&s.length>0)){let u=new Set(i[a]),l=s.length;for(let c=0;c<l;c++)u.add(s[c]);i[a]=Array.from(u)}}if(!(r>=t.length)){t[r]in e.c&&$4(e.c[t[r]],t,r+1,n,o,i),$4(e,t,r+1,n-1,o,i);for(let a in e.c)$4(e.c[a],t,r,n-1,o,i);for(let a in e.c)a!==t[r]&&$4(e.c[a],t,r+1,n-1,o,i)}}}function uCe(e,{term:t,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,$4(e,t,0,n||0,n,o),o}else{let o=t.length;for(let a=0;a<o;a++){let s=t[a];if(s in e.c){let u=e.c[s],l=u.s,c=t.substring(a),f=S_t(l,c).length;if(f!==l.length&&f!==c.length){if(n)break;return{}}a+=u.s.length-1,e=u}else return{}}let i={};return sCe(e,i,t,r,n),i}}function C_t(e,t,r,n=!0){if(!t)return!0;let o=t.length;for(let i=0;i<o;i++){let a=t[i];if(a in e.c){let s=e.c[a];i+=s.s.length-1,e=s,n&&e.w!==t||qkr(e,r)}else return!1}return!0}function O_t(){return{root:null}}function E_t(e,t,r){let n={point:t,docIDs:r};if(e.root==null){e.root=n;return}let o=e.root,i=0;for(;o!==null;){if(o.point.lon===t.lon&&o.point.lat===t.lat){let s=o.docIDs??[];o.docIDs=Array.from(new Set([...s,...r||[]]));return}if(i%2===0)if(t.lon<o.point.lon){if(o.left==null){o.left=n;return}o=o.left}else{if(o.right==null){o.right=n;return}o=o.right}else if(t.lat<o.point.lat){if(o.left==null){o.left=n;return}o=o.left}else{if(o.right==null){o.right=n;return}o=o.right}i++}}function P_t(e,t,r){let n=e.root,o=0,i=null,a=null;for(;n!==null;){if(n?.point.lon===t.lon&&n.point.lat===t.lat){let u=n.docIDs?.indexOf(r);if(u!==void 0&&u>-1){n.docIDs?.splice(u,1),(n.docIDs==null||n.docIDs.length===0)&&(i!=null?a==="left"?i.left=n.left!==null?n.left:n.right:a==="right"&&(i.right=n.right!==null?n.right:n.left):e.root=n.left!==null?n.left:n.right);return}}let s=o%2;i=n,s===0?t.lon<n.point.lon?(n=n?.left,a="left"):(n=n?.right,a="right"):t.lat<n.point.lat?(n=n?.left,a="left"):(n=n?.right,a="right"),o++}}function T_t(e,t,r,n=!0,o="asc",i=!1){let a=i?A_t:I_t,s=[{node:e,depth:0}],u=[];for(;s.length>0;){let{node:l,depth:c}=s.pop();if(l===null)continue;let d=a(t,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(t,l.point),f=a(t,c.point);return o.toLowerCase()==="asc"?d-f:f-d}),u}function M_t(e,t,r=!0,n=null,o=!1){let i=[{node:e,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=zkr(t,l.point);f&&r?a.push({point:l.point,docIDs:l.docIDs??[]}):!f&&!r&&a.push({point:l.point,docIDs:l.docIDs??[]})}let s=Ukr(t);if(n){let u=o?A_t:I_t;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 Ukr(e){let t=0,r=0,n=0,o=e.length;for(let a=0,s=o-1;a<o;s=a++){let u=e[a].lon,l=e[a].lat,c=e[s].lon,d=e[s].lat,f=u*d-c*l;t+=f,r+=(u+c)*f,n+=(l+d)*f}t/=2;let i=6*t;return r/=i,n/=i,{lon:r,lat:n}}function zkr(e,t){let r=!1,n=t.lon,o=t.lat,i=e.length;for(let a=0,s=i-1;a<i;s=a++){let u=e[a].lon,l=e[a].lat,c=e[s].lon,d=e[s].lat;l>o!=d>o&&n<(c-u)*(o-l)/(d-l)+u&&(r=!r)}return r}function I_t(e,t){let r=Math.PI/180,n=e.lat*r,o=t.lat*r,i=(t.lat-e.lat)*r,a=(t.lon-e.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 A_t(e,t){let n=.0033528106647474805,o=(1-n)*6378137,i=Math.PI/180,a=e.lat*i,s=t.lat*i,u=(t.lon-e.lon)*i,l=Math.atan((1-n)*Math.tan(a)),c=Math.atan((1-n)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(c),h=Math.cos(c),m=u,_,g=1e3,v,S,x,O,T;do{let F=Math.sin(m),k=Math.cos(m);x=Math.sqrt(h*F*(h*F)+(f*p-d*h*k)*(f*p-d*h*k)),O=d*p+f*h*k,T=Math.atan2(x,O),v=f*h*F/x,S=1-v*v;let L=O-2*d*p/S,q=n/16*S*(4+n*(4-3*S));_=m,m=u+(1-q)*n*v*(T+q*x*(L+q*O*(-1+2*L*L)))}while(Math.abs(m-_)>1e-12&&--g>0);let E=S*(6378137*6378137-o*o)/(o*o),M=1+E/16384*(4096+E*(-768+E*(320-175*E))),A=E/1024*(256+E*(-128+E*(74-47*E))),j=A*x*(O-2*d*p/S+A/4*(O*(-1+2*x*x)-A/6*T*(-3+4*x*x)*(-3+4*T*T)));return o*M*(T-j)}function HX(e,t,r=0,n){if(t===0)throw _t("INVALID_BOOST_VALUE");let o=new Map,i=e.length;for(let m=0;m<i;m++){let _=e[m],g=_.length;for(let v=0;v<g;v++){let[S,x]=_[v],O=x*t,T=o.get(S)?.[0];T!==void 0?o.set(S,[T*1.5+O,(o?.get(S)?.[1]||0)+1]):o.set(S,[O,1])}}let a=[];for(let m of o.entries())a.push([m[0],m[1][0]]);let s=a.sort((m,_)=>_[1]-m[1]);if(r===1)return s;let u=s.length,l=[];for(let m of o.entries())l.push([m[0],m[1][0],m[1][1]]);let c=l.sort((m,_)=>m[2]>_[2]?-1:m[2]<_[2]?1:m[1]>_[1]?-1:m[1]<_[1]?1:0),d;for(let m=0;m<u&&c[m][2]===n;m++)d=m;if(typeof d>"u"){if(r===0)return[];d=0}let f=c.length,p=new Array(f);for(let m=0;m<f;m++)p[m]=[c[m][0],c[m][1]];if(r===0)return p.slice(0,d+1);let h=d+Math.ceil(r*100*(u-d)/100);return p.slice(0,u+h)}function lCe(e,t,r,n,o,{k:i,b:a,d:s}){return Math.log(1+(r-t+.5)/(t+.5))*(s+e*(i+1))/(e+i*(1-a+a*n/o))}function cCe(e,t){let r=0;for(let n=0;n<t;n++)r+=e[n]*e[n];return Math.sqrt(r)}function VX(e,t,r,n=.8){let o=cCe(e,r),i=[];for(let[a,[s,u]]of Object.entries(t)){let l=0;for(let d=0;d<r;d++)l+=e[d]*u[d];let c=l/(o*s);c>=n&&i.push([a,c])}return i.sort((a,s)=>s[1]-a[1])}function Hkr(e,t,r,n,o){let i=ko(e.sharedInternalDocumentStore,r);e.avgFieldLength[t]=((e.avgFieldLength[t]??0)*(o-1)+n.length)/o,e.fieldLengths[t][i]=n.length,e.frequencies[t][i]={}}function Vkr(e,t,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=ko(e.sharedInternalDocumentStore,r),s=i/n.length;e.frequencies[t][a][o]=s,o in e.tokenOccurrences[t]||(e.tokenOccurrences[t][o]=0),e.tokenOccurrences[t][o]=(e.tokenOccurrences[t][o]??0)+1}function Wkr(e,t,r,n){let o=ko(e.sharedInternalDocumentStore,r);n>1?e.avgFieldLength[t]=(e.avgFieldLength[t]*n-e.fieldLengths[t][o])/(n-1):e.avgFieldLength[t]=void 0,e.fieldLengths[t][o]=void 0,e.frequencies[t][o]=void 0}function Jkr(e,t,r){e.tokenOccurrences[t][r]--}function Gkr(e,t,r,n,o){let i=Array.from(o),a=t.avgFieldLength[r],s=t.fieldLengths[r],u=t.tokenOccurrences[r],l=t.frequencies[r],c=typeof u[n]=="number"?u[n]??0:0,d=[],f=i.length;for(let p=0;p<f;p++){let h=ko(t.sharedInternalDocumentStore,i[p]),m=l?.[h]?.[n]??0,_=lCe(m,c,e.docsCount,s[h],a,e.params.relevance);d.push([h,_])}return d}function D_t(e,t,r,n,o=""){n||(n={sharedInternalDocumentStore:t,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}});for(let[i,a]of Object.entries(r)){let s=`${o}${o?".":""}${i}`;if(typeof a=="object"&&!Array.isArray(a)){D_t(e,t,a,n,s);continue}if(Hx(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:Qxe(a),vectors:{}};else{let u=/\[/.test(a);switch(a){case"boolean":case"boolean[]":n.indexes[s]={type:"Bool",node:{true:[],false:[]},isArray:u};break;case"number":case"number[]":n.indexes[s]={type:"AVL",node:p_t(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:AR(),isArray:u},n.avgFieldLength[s]=0,n.frequencies[s]={},n.tokenOccurrences[s]={},n.fieldLengths[s]={};break;case"enum":case"enum[]":n.indexes[s]={type:"Flat",node:y_t(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:O_t(),isArray:u};break;default:throw _t("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function Kkr(e,t,r,n,o,i,a,s){return u=>{let l=ko(t.sharedInternalDocumentStore,n),{type:c,node:d}=t.indexes[r];switch(c){case"Bool":{d[u?"true":"false"].push(l);break}case"AVL":{let f=s?.avlRebalanceThreshold??1;h_t(d,u,[l],f);break}case"Radix":{let f=i.tokenize(u,o,r);e.insertDocumentScoreParameters(t,r,l,f,a);for(let p of f)e.insertTokenScoreParameters(t,r,l,f,p),x_t(d,p,l);break}case"Flat":{b_t(d,u,l);break}case"BKD":{E_t(d,u,[l]);break}}}}function Ykr(e,t,r,n,o,i,a,s,u,l){if(Hx(i))return Zkr(t,r,o,n);let c=Kkr(e,t,r,n,a,s,u,l);if(!ZF(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function Zkr(e,t,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=e.vectorIndexes[t].size,i=cCe(r,o);e.vectorIndexes[t].vectors[n]=[i,r]}function R_t(e,t,r,n,o,i,a,s,u){let l=ko(t.sharedInternalDocumentStore,n);if(Hx(i))return delete t.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=t.indexes[r];switch(c){case"AVL":return g_t(d,l,o),!0;case"Bool":{let p=d[o?"true":"false"].indexOf(l);return d[o?"true":"false"].splice(p,1),!0}case"Radix":{let f=s.tokenize(o,a,r);e.removeDocumentScoreParameters(t,r,n,u);for(let p of f)e.removeTokenScoreParameters(t,r,p),C_t(d,p,l);return!0}case"Flat":return __t(d,l,o),!0;case"BKD":return P_t(d,o,l),!1}}function Xkr(e,t,r,n,o,i,a,s,u){if(!ZF(i))return R_t(e,t,r,n,o,i,a,s,u);let l=Xxe(i),c=o,d=c.length;for(let f=0;f<d;f++)R_t(e,t,r,n,c[f],l,a,s,u);return!0}function Qkr(e,t,r,n){if(!(r in t.tokenOccurrences))return[];let{node:o,type:i}=t.indexes[r];if(i!=="Radix")throw _t("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=e.params,u=uCe(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(GF(u,c))for(let f of u[c])l.add(f);return e.index.calculateResultScores(e,t,r,n,Array.from(l))}function eBr(e,t,r){let n=Object.keys(r),o=n.reduce((i,a)=>({[a]:[],...i}),{});for(let i of n){let a=r[i];if(typeof t.indexes[i]>"u")throw _t("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=t.indexes[i];if(u==="Bool"){let f=s[a.toString()];ei(o[i],f);continue}if(u==="BKD"){let d;if("radius"in a)d="radius";else if("polygon"in a)d="polygon";else throw new Error(`Invalid operation ${a}`);if(d==="radius"){let{value:f,coordinates:p,unit:h="m",inside:m=!0,highPrecision:_=!1}=a[d],g=Yxe(f,h),v=T_t(s.root,p,g,m,void 0,_);ei(o[i],v.flatMap(({docIDs:S})=>S))}else{let{coordinates:f,inside:p=!0,highPrecision:h=!1}=a[d],m=M_t(s.root,f,p,void 0,h);ei(o[i],m.flatMap(({docIDs:_})=>_))}continue}if(u==="Radix"&&(typeof a=="string"||Array.isArray(a))){for(let d of[a].flat()){let f=e.tokenizer.tokenize(d,e.language,i);for(let p of f){let h=uCe(s,{term:p,exact:!0});ei(o[i],Object.values(h).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw _t("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?w_t:v_t;ei(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=nCe(s,f,!1);break}case"gte":{p=nCe(s,f,!0);break}case"lt":{p=oCe(s,f,!1);break}case"lte":{p=oCe(s,f,!0);break}case"eq":{p=m_t(s,f)??[];break}case"between":{let[h,m]=f;p=d_t(s,h,m);break}}ei(o[i],p)}}return KF(Object.values(o))}function tBr(e){return e.searchableProperties}function rBr(e){return e.searchablePropertiesWithTypes}function j_t(e){let t=AR(e.e,e.s,e.k);t.d=e.d,t.w=e.w;for(let r of Object.keys(e.c))t.c[r]=j_t(e.c[r]);return t}function nBr(e){return{numberToDocumentId:new Map(e)}}function oBr(e){return Array.from(e.numberToDocumentId.entries())}function iBr(e,t){let{indexes:r,vectorIndexes:n,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}=t,c={},d={};for(let f of Object.keys(r)){let{node:p,type:h,isArray:m}=r[f];switch(h){case"Radix":c[f]={type:"Radix",node:j_t(p),isArray:m};break;case"Flat":c[f]={type:"Flat",node:nBr(p),isArray:m};break;default:c[f]=r[f]}}for(let f of Object.keys(n)){let p=n[f].vectors;for(let h in p)p[h]=[p[h][0],new Float32Array(p[h][1])];d[f]={size:n[f].size,vectors:p}}return{sharedInternalDocumentStore:e,indexes:c,vectorIndexes:d,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}}function aBr(e){let{indexes:t,vectorIndexes:r,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}=e,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(t)){let{type:f,node:p,isArray:h}=t[d];if(f!=="Flat"){c[d]=t[d];continue}c[d]={type:"Flat",node:oBr(p),isArray:h}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function N_t(){return{create:D_t,insert:Ykr,remove:Xkr,insertDocumentScoreParameters:Hkr,insertTokenScoreParameters:Vkr,removeDocumentScoreParameters:Wkr,removeTokenScoreParameters:Jkr,calculateResultScores:Gkr,search:Qkr,searchByWhereClause:eBr,getSearchableProperties:tBr,getSearchablePropertiesWithTypes:rBr,load:iBr,save:aBr}}function L_t(e,t,r,n,o){let i={language:e.tokenizer.language,sharedInternalDocumentStore:t,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=L_t(e,t,s,n,u);ei(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!Hx(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 _t("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function uBr(e,t,r,n){return n?.enabled!==!1?L_t(e,t,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function lBr(e,t,r,n){if(!e.enabled)return;e.isSorted=!1;let o=ko(e.sharedInternalDocumentStore,r),i=e.sorts[t];i.orderedDocsToRemove.has(o)&&dCe(e,t),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function F_t(e){if(e.isSorted||!e.enabled)return;let t=Object.keys(e.sorts);for(let r of t)pBr(e,r);e.isSorted=!0}function cBr(e,t,r){return t[1].localeCompare(r[1],Gbt(e))}function dBr(e,t){return e[1]-t[1]}function fBr(e,t){return t[1]?-1:1}function pBr(e,t){let r=e.sorts[t],n;switch(r.type){case"string":n=cBr.bind(null,e.language);break;case"number":n=dBr.bind(null);break;case"boolean":n=fBr.bind(null);break}r.orderedDocs.sort(n);let o=r.orderedDocs.length;for(let i=0;i<o;i++){let a=r.orderedDocs[i][0];r.docs.set(a,i)}}function hBr(e){let t=Object.keys(e.sorts);for(let r of t)dCe(e,r)}function dCe(e,t){let r=e.sorts[t];r.orderedDocsToRemove.size&&(r.orderedDocs=r.orderedDocs.filter(n=>!r.orderedDocsToRemove.has(n[0])),r.orderedDocsToRemove.clear())}function mBr(e,t,r){if(!e.enabled)return;let n=e.sorts[t],o=ko(e.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function gBr(e,t,r){if(!e.enabled)throw _t("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=e.sorts[n];if(!i)throw _t("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,e.sortableProperties.join(", "));return dCe(e,n),F_t(e),t.sort((a,s)=>{let u=i.docs.get(ko(e.sharedInternalDocumentStore,a[0])),l=i.docs.get(ko(e.sharedInternalDocumentStore,s[0])),c=typeof u<"u",d=typeof l<"u";return!c&&!d?0:c?d?o?l-u:u-l:-1:1}),t}function yBr(e){return e.enabled?e.sortableProperties:[]}function bBr(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function _Br(e,t){let r=t;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:e,language:r.language,sortableProperties:r.sortableProperties,sortablePropertiesWithTypes:r.sortablePropertiesWithTypes,sorts:n,enabled:!0,isSorted:r.isSorted}}function vBr(e){if(!e.enabled)return{enabled:!1};hBr(e),F_t(e);let t=Object.keys(e.sorts).reduce((r,n)=>{let{docs:o,orderedDocs:i,type:a}=e.sorts[n];return r[n]={docs:Object.fromEntries(o.entries()),orderedDocs:i,type:a},r},{});return{language:e.language,sortableProperties:e.sortableProperties,sortablePropertiesWithTypes:e.sortablePropertiesWithTypes,sorts:t,enabled:e.enabled,isSorted:e.isSorted}}function k_t(){return{create:uBr,insert:lBr,remove:mBr,save:vBr,load:_Br,sortBy:gBr,getSortableProperties:yBr,getSortablePropertiesWithTypes:bBr}}var SBr=[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 xBr(e){return e<192||e>383?e:SBr[e-192]||e}function B_t(e){let t=[];for(let r=0;r<e.length;r++)t[r]=xBr(e.charCodeAt(r));return String.fromCharCode(...t)}var CBr={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"},OBr={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},EBr="[^aeiou]",JX="[aeiouy]",Dw=EBr+"[^aeiouy]*",q4=JX+"[aeiou]*",fCe="^("+Dw+")?"+q4+Dw,PBr="^("+Dw+")?"+q4+Dw+"("+q4+")?$",WX="^("+Dw+")?"+q4+Dw+q4+Dw,$_t="^("+Dw+")?"+JX;function q_t(e){let t,r,n,o,i,a;if(e.length<3)return e;let s=e.substring(0,1);if(s=="y"&&(e=s.toUpperCase()+e.substring(1)),n=/^(.+?)(ss|i)es$/,o=/^(.+?)([^s])s$/,n.test(e)?e=e.replace(n,"$1$2"):o.test(e)&&(e=e.replace(o,"$1$2")),n=/^(.+?)eed$/,o=/^(.+?)(ed|ing)$/,n.test(e)){let u=n.exec(e);n=new RegExp(fCe),n.test(u[1])&&(n=/.$/,e=e.replace(n,""))}else o.test(e)&&(t=o.exec(e)[1],o=new RegExp($_t),o.test(t)&&(e=t,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+Dw+JX+"[^aeiouwxy]$"),o.test(e)?e=e+"e":i.test(e)?(n=/.$/,e=e.replace(n,"")):a.test(e)&&(e=e+"e")));if(n=/^(.+?)y$/,n.test(e)&&(t=n.exec(e)?.[1],n=new RegExp($_t),t&&n.test(t)&&(e=t+"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(e)){let u=n.exec(e);t=u?.[1],r=u?.[2],n=new RegExp(fCe),t&&n.test(t)&&(e=t+CBr[r])}if(n=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,n.test(e)){let u=n.exec(e);t=u?.[1],r=u?.[2],n=new RegExp(fCe),t&&n.test(t)&&(e=t+OBr[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(e))t=n.exec(e)?.[1],n=new RegExp(WX),t&&n.test(t)&&(e=t);else if(o.test(e)){let u=o.exec(e);t=u?.[1]??""+u?.[2]??"",o=new RegExp(WX),o.test(t)&&(e=t)}return n=/^(.+?)e$/,n.test(e)&&(t=n.exec(e)?.[1],n=new RegExp(WX),o=new RegExp(PBr),i=new RegExp("^"+Dw+JX+"[^aeiouwxy]$"),t&&(n.test(t)||o.test(t)&&!i.test(t))&&(e=t)),n=/ll$/,o=new RegExp(WX),n.test(e)&&o.test(e)&&(n=/.$/,e=e.replace(n,"")),s=="y"&&(e=s.toLowerCase()+e.substring(1)),e}function pCe(e,t){let r=`${this.language}:${e}:${t}`;return this.normalizationCache.has(r)?this.normalizationCache.get(r):this.stopWords?.includes(t)?(this.normalizationCache.set(r,""),""):(this.stemmer&&!this.stemmerSkipProperties.has(e)&&(t=this.stemmer(t)),t=B_t(t),this.normalizationCache.set(r,t),t)}function TBr(e){for(;e[e.length-1]==="";)e.pop();for(;e[0]==="";)e.shift();return e}function U_t(e,t,r){if(t&&t!==this.language)throw _t("LANGUAGE_NOT_SUPPORTED",t);if(typeof e!="string")return[e];let n;if(r&&this.tokenizeSkipProperties.has(r))n=[this.normalizeToken.bind(this,r??"")(e)];else{let i=Jbt[this.language];n=e.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=TBr(n);return this.allowDuplicates?o:Array.from(new Set(o))}function hCe(e={}){if(!e.language)e.language="english";else if(!k4.includes(e.language))throw _t("LANGUAGE_NOT_SUPPORTED",e.language);let t;if(e.stemming||e.stemmer&&!("stemming"in e))if(e.stemmer){if(typeof e.stemmer!="function")throw _t("INVALID_STEMMER_FUNCTION_TYPE");t=e.stemmer}else if(e.language==="english")t=q_t;else throw _t("MISSING_STEMMER",e.language);let r;if(e.stopWords!==!1){if(r=[],Array.isArray(e.stopWords))r=e.stopWords;else if(typeof e.stopWords=="function")r=e.stopWords(r);else if(e.stopWords)throw _t("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw _t("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw _t("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:U_t,language:e.language,stemmer:t,stemmerSkipProperties:new Set(e.stemmerSkipProperties?[e.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(e.tokenizeSkipProperties?[e.tokenizeSkipProperties].flat():[]),stopWords:r,allowDuplicates:!!e.allowDuplicates,normalizeToken:pCe,normalizationCache:new Map};return n.tokenize=U_t.bind(n),n.normalizeToken=pCe,n}function IBr(e){let t={formatElapsedTime:t_t,getDocumentIndexId:r_t,getDocumentProperties:qX,validateSchema:Zxe};for(let r of eCe){let n=r;if(e[n]){if(typeof e[n]!="function")throw _t("COMPONENT_MUST_BE_FUNCTION",n)}else e[n]=t[n]}for(let r of Object.keys(e))if(!u_t.includes(r)&&!eCe.includes(r))throw _t("UNSUPPORTED_COMPONENT",r)}function tk({schema:e,sort:t,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=B4());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=hCe(a):a=hCe({language:r??"english"}),n.tokenizer&&r)throw _t("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=o_t();s||(s=N_t()),l||(l=k_t()),u||(u=i_t()),IBr(n);let{getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,formatElapsedTime:h}=n,m={data:{},caches:{},schema:e,tokenizer:a,index:s,sorter:l,documentsStore:u,internalDocumentIDStore:c,getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],afterUpdateMultiple:[],beforeUpdateMultiple:[],afterCreate:[],formatElapsedTime:h,id:o,plugins:i,version:ABr()};m.data={index:m.index.create(m,c,e),docs:m.documentsStore.create(m,c),sorting:m.sorter.create(m,c,e,t)};for(let g of a_t)m[g]=(m[g]??[]).concat(s_t(m,g));let _=m.afterCreate;return _&&l_t(_,m),m}function ABr(){return"{{VERSION}}"}var GX="fulltext",mCe="hybrid",gCe="vector";var MP=Symbol("orama.insertions"),IP=Symbol("orama.removals");var z_t=globalThis.process?.emitWarning??function(t,r){console.warn(`[WARNING] [${r.code}] ${t}`)};function yCe(e){typeof e[MP]!="number"&&(queueMicrotask(()=>{e[MP]=void 0}),e[MP]=0),e[MP]>1e3?(z_t("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"}),e[MP]=-1):e[MP]>=0&&e[MP]++}function bCe(e){typeof e[IP]!="number"&&(queueMicrotask(()=>{e[IP]=void 0}),e[IP]=0),e[IP]>1e3?(z_t("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"}),e[IP]=-1):e[IP]>=0&&e[IP]++}function U4(e,t,r,n,o){let i=e.validateSchema(t,e.schema);if(i)throw _t("SCHEMA_VALIDATION_FAILURE",i);return gs(e.index.beforeInsert)||gs(e.index.insert)||gs(e.index.afterInsert)?NBr(e,t,r,n,o):LBr(e,t,r,n,o)}var DBr=new Set(["enum","enum[]"]),jBr=new Set(["string","number"]);async function NBr(e,t,r,n,o){let{index:i,docs:a}=e.data,s=e.getDocumentIndexId(t);if(typeof s!="string")throw _t("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!e.documentsStore.store(a,s,t))throw _t("DOCUMENT_ALREADY_EXISTS",s);let u=e.documentsStore.count(a);n||await Eg(e.beforeInsert,e,s,t);let l=e.index.getSearchableProperties(i),c=e.index.getSearchablePropertiesWithTypes(i),d=e.getDocumentProperties(t,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let h=typeof p,m=c[f];H_t(h,m,f,p)}return await FBr(e,s,l,d,u,r,t,o),n||await Eg(e.afterInsert,e,s,t),yCe(e),s}function LBr(e,t,r,n,o){let{index:i,docs:a}=e.data,s=e.getDocumentIndexId(t);if(typeof s!="string")throw _t("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!e.documentsStore.store(a,s,t))throw _t("DOCUMENT_ALREADY_EXISTS",s);let u=e.documentsStore.count(a);n||Eg(e.beforeInsert,e,s,t);let l=e.index.getSearchableProperties(i),c=e.index.getSearchablePropertiesWithTypes(i),d=e.getDocumentProperties(t,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let h=typeof p,m=c[f];H_t(h,m,f,p)}return kBr(e,s,l,d,u,r,t,o),n||Eg(e.afterInsert,e,s,t),yCe(e),s}function H_t(e,t,r,n){if(!(n_t(t)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(Hx(t)&&Array.isArray(n))&&!(ZF(t)&&Array.isArray(n))&&!(DBr.has(t)&&jBr.has(e))&&e!==t)throw _t("INVALID_DOCUMENT_PROPERTY",r,t,e)}async function FBr(e,t,r,n,o,i,a,s){for(let c of r){let d=n[c];if(typeof d>"u")continue;let f=e.index.getSearchablePropertiesWithTypes(e.data.index)[c];await e.index.beforeInsert?.(e.data.index,c,t,d,f,i,e.tokenizer,o),await e.index.insert(e.index,e.data.index,c,t,d,f,i,e.tokenizer,o,s),await e.index.afterInsert?.(e.data.index,c,t,d,f,i,e.tokenizer,o)}let u=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(a,u);for(let c of u){let d=l[c];if(typeof d>"u")continue;let f=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[c];e.sorter.insert(e.data.sorting,c,t,d,f,i)}}function kBr(e,t,r,n,o,i,a,s){for(let c of r){let d=n[c];if(typeof d>"u")continue;let f=e.index.getSearchablePropertiesWithTypes(e.data.index)[c];e.index.beforeInsert?.(e.data.index,c,t,d,f,i,e.tokenizer,o),e.index.insert(e.index,e.data.index,c,t,d,f,i,e.tokenizer,o,s),e.index.afterInsert?.(e.data.index,c,t,d,f,i,e.tokenizer,o)}let u=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(a,u);for(let c of u){let d=l[c];if(typeof d>"u")continue;let f=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[c];e.sorter.insert(e.data.sorting,c,t,d,f,i)}}function RR(e,t,r,n){return gs(e.index.beforeRemove)||gs(e.index.remove)||gs(e.index.afterRemove)?BBr(e,t,r,n):$Br(e,t,r,n)}async function BBr(e,t,r,n){let o=!0,{index:i,docs:a}=e.data,s=e.documentsStore.get(a,t);if(!s)return!1;let u=qh(e.internalDocumentIDStore,ko(e.internalDocumentIDStore,t)),l=e.documentsStore.count(a);n||await Eg(e.beforeRemove,e,u);let c=e.index.getSearchableProperties(i),d=e.index.getSearchablePropertiesWithTypes(i),f=e.getDocumentProperties(s,c);for(let m of c){let _=f[m];if(typeof _>"u")continue;let g=d[m];await e.index.beforeRemove?.(e.data.index,m,u,_,g,r,e.tokenizer,l),await e.index.remove(e.index,e.data.index,m,t,_,g,r,e.tokenizer,l)||(o=!1),await e.index.afterRemove?.(e.data.index,m,u,_,g,r,e.tokenizer,l)}let p=await e.sorter.getSortableProperties(e.data.sorting),h=await e.getDocumentProperties(s,p);for(let m of p)typeof h[m]>"u"||e.sorter.remove(e.data.sorting,m,t);return n||await Eg(e.afterRemove,e,u),e.documentsStore.remove(e.data.docs,t),bCe(e),o}function $Br(e,t,r,n){let o=!0,{index:i,docs:a}=e.data,s=e.documentsStore.get(a,t);if(!s)return!1;let u=qh(e.internalDocumentIDStore,ko(e.internalDocumentIDStore,t)),l=e.documentsStore.count(a);n||Eg(e.beforeRemove,e,u);let c=e.index.getSearchableProperties(i),d=e.index.getSearchablePropertiesWithTypes(i),f=e.getDocumentProperties(s,c);for(let m of c){let _=f[m];if(typeof _>"u")continue;let g=d[m];e.index.beforeRemove?.(e.data.index,m,u,_,g,r,e.tokenizer,l),e.index.remove(e.index,e.data.index,m,t,_,g,r,e.tokenizer,l)||(o=!1),e.index.afterRemove?.(e.data.index,m,u,_,g,r,e.tokenizer,l)}let p=e.sorter.getSortableProperties(e.data.sorting),h=e.getDocumentProperties(s,p);for(let m of p)typeof h[m]>"u"||e.sorter.remove(e.data.sorting,m,t);return n||Eg(e.afterRemove,e,u),e.documentsStore.remove(e.data.docs,t),bCe(e),o}function z4(e,t,r,n,o){return gs(e.index.beforeRemove)||gs(e.index.remove)||gs(e.index.afterRemove)||gs(e.beforeRemoveMultiple)||gs(e.afterRemoveMultiple)?qBr(e,t,r,n,o):UBr(e,t,r,n,o)}async function qBr(e,t,r,n,o){let i=0;r||(r=1e3);let a=o?[]:t.map(s=>qh(e.internalDocumentIDStore,ko(e.internalDocumentIDStore,s)));return o||await IR(e.beforeRemoveMultiple,e,a),await new Promise((s,u)=>{let l=0;async function c(){let d=t.slice(l*r,++l*r);if(!d.length)return s();for(let f of d)try{await RR(e,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await IR(e.afterRemoveMultiple,e,a),i}function UBr(e,t,r,n,o){let i=0;r||(r=1e3);let a=o?[]:t.map(l=>qh(e.internalDocumentIDStore,ko(e.internalDocumentIDStore,l)));o||IR(e.beforeRemoveMultiple,e,a);let s=0;function u(){let l=t.slice(s*r,++s*r);if(l.length){for(let c of l)RR(e,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||IR(e.afterRemoveMultiple,e,a),i}function zBr(e,t){return e[1]-t[1]}function HBr(e,t){return t[1]-e[1]}function VBr(e="desc"){return e.toLowerCase()==="asc"?zBr:HBr}function rk(e,t,r){let n={},o=t.map(([l])=>l),i=e.documentsStore.getMultiple(e.data.docs,o),a=Object.keys(r),s=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let l of a){let c;if(s[l]==="number"){let{ranges:d}=r[l],f=d.length,p=Array.from({length:f});for(let h=0;h<f;h++){let m=d[h];p[h]=[`${m.from}-${m.to}`,0]}c=Object.fromEntries(p)}n[l]={count:0,values:c??{}}}let u=i.length;for(let l=0;l<u;l++){let c=i[l];for(let d of a){let f=d.includes(".")?YF(c,d):c[d],p=s[d],h=n[d].values;switch(p){case"number":{let m=r[d].ranges;V_t(m,h)(f);break}case"number[]":{let m=new Set,_=r[d].ranges,g=V_t(_,h,m);for(let v of f)g(v);break}case"boolean":case"enum":case"string":{W_t(h,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let g=W_t(h,p==="boolean[]"?"boolean":"string",new Set);for(let v of f)g(v);break}default:throw _t("FACET_NOT_SUPPORTED",p)}}}for(let l of a){let c=n[l];if(c.count=Object.keys(c.values).length,s[l]==="string"){let d=r[l],f=VBr(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function V_t(e,t,r){return n=>{for(let o of e){let i=`${o.from}-${o.to}`;r?.has(i)||n>=o.from&&n<=o.to&&(t[i]===void 0?t[i]=1:(t[i]++,r?.add(i)))}}}function W_t(e,t,r){let n=t==="boolean"?"false":"";return o=>{let i=o?.toString()??n;r?.has(i)||(e[i]=(e[i]??0)+1,r?.add(i))}}function nk(e,t){let r=new Map,n=[];for(let o of e)r.set(o,!0);for(let o of t){let[i]=o;r.has(i)&&(n.push(o),r.delete(i))}return n}var WBr={reducer:(e,t,r,n)=>(t[n]=r,t),getInitialValue:e=>Array.from({length:e})},J_t=["string","number","boolean"];function ok(e,t,r){let n=r.properties,o=n.length,i=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let g=0;g<o;g++){let v=n[g];if(typeof i[v]>"u")throw _t("UNKNOWN_GROUP_BY_PROPERTY",v);if(!J_t.includes(i[v]))throw _t("INVALID_GROUP_BY_PROPERTY",v,J_t.join(", "),i[v])}let a=t.map(([g])=>qh(e.internalDocumentIDStore,g)),s=e.documentsStore.getMultiple(e.data.docs,a),u=s.length,l=r.maxResult||Number.MAX_SAFE_INTEGER,c=[],d={};for(let g=0;g<o;g++){let v=n[g],S={property:v,perValue:{}},x=new Set;for(let O=0;O<u;O++){let T=s[O],E=YF(T,v);if(typeof E>"u")continue;let M=typeof E!="boolean"?E:""+E,A=S.perValue[M]??{indexes:[],count:0};A.count>=l||(A.indexes.push(O),A.count++,S.perValue[M]=A,x.add(E))}c.push(Array.from(x)),d[v]=S}let f=G_t(c),p=f.length,h=[];for(let g=0;g<p;g++){let v=f[g],S=v.length,x={values:[],indexes:[]},O=[];for(let T=0;T<S;T++){let E=v[T],M=n[T];O.push(d[M].perValue[typeof E!="boolean"?E:""+E].indexes),x.values.push(E)}x.indexes=KF(O).sort((T,E)=>T-E),x.indexes.length!==0&&h.push(x)}let m=h.length,_=Array.from({length:m});for(let g=0;g<m;g++){let v=h[g],S=r.reduce||WBr,x=v.indexes.map(M=>({id:a[M],score:t[M][1],document:s[M]})),O=S.reducer.bind(null,v.values),T=S.getInitialValue(v.indexes.length),E=x.reduce(O,T);_[g]={values:v.values,result:E}}return _}function G_t(e,t=0){if(t+1===e.length)return e[t].map(i=>[i]);let r=e[t],n=G_t(e,t+1),o=[];for(let i of r)for(let a of n){let s=[i];ei(s,a),o.push(s)}return o}function K_t(e,t,r){let n=Og(),o=e.beforeSearch?.length||e.afterSearch?.length;function i(){t.relevance=Object.assign(KX,t.relevance??{});let s=Object.keys(e.data.index.vectorIndexes),u=t.facets&&Object.keys(t.facets).length>0,{limit:l=10,offset:c=0,term:d,properties:f,threshold:p=0,distinctOn:h,includeVectors:m=!1}=t,_=t.preflight===!0,{index:g,docs:v}=e.data,S=e.tokenizer.tokenize(d??"",r),x=e.caches.propertiesToSearch;if(!x){let F=e.index.getSearchablePropertiesWithTypes(g);x=e.index.getSearchableProperties(g),x=x.filter(k=>F[k].startsWith("string")),e.caches.propertiesToSearch=x}if(f&&f!=="*"){for(let F of f)if(!x.includes(F))throw _t("UNKNOWN_INDEX",F,x.join(", "));x=x.filter(F=>f.includes(F))}let O=DR(e.tokenizer,e.index,e.documentsStore,r,t,x,S,e.documentsStore.count(v),n),T=Object.keys(t.where??{}).length>0,E=[];T&&(E=e.index.searchByWhereClause(O,g,t.where));let M=S.length;if(M||f?.length){let F=x.length;for(let k=0;k<F;k++){let L=x[k],q=O.indexMap[L];if(M!==0)for(let D=0;D<M;D++){let z=S[D],W=e.index.search(O,g,L,z);ei(q[z],W)}else{q[""]=[];let D=e.index.search(O,g,L,"");ei(q[""],D)}let U=Object.values(q);O.docsIntersection[L]=HX(U,t?.boost?.[L]??1,p,M);let G=O.docsIntersection[L],V=G.length;for(let D=0;D<V;D++){let[z,W]=G[D],J=O.uniqueDocsIDs[z];J?O.uniqueDocsIDs[z]=J+W+.5:O.uniqueDocsIDs[z]=W}}}else S.length===0&&d?O.uniqueDocsIDs={}:O.uniqueDocsIDs=Object.fromEntries(Object.keys(e.documentsStore.getAll(e.data.docs)).map(F=>[F,0]));let A=Object.entries(O.uniqueDocsIDs).map(([F,k])=>[+F,k]);if(T&&(A=nk(E,A)),t.sortBy)if(typeof t.sortBy=="function"){let F=A.map(([q])=>q),L=e.documentsStore.getMultiple(e.data.docs,F).map((q,U)=>[A[U][0],A[U][1],q]);L.sort(t.sortBy),A=L.map(([q,U])=>[q,U])}else A=e.sorter.sortBy(e.data.sorting,A,t.sortBy).map(([F,k])=>[ko(e.internalDocumentIDStore,F),k]);else A=A.sort(e_t);let j;_||(j=h?Y_t(e,A,c,l,h):YX(e,A,c,l));let N={elapsed:{formatted:"",raw:0},hits:[],count:A.length};if(typeof j<"u"&&(N.hits=j.filter(Boolean),m||UX(N,s)),u){let F=rk(e,A,t.facets);N.facets=F}return t.groupBy&&(N.groups=ok(e,A,t.groupBy)),N.elapsed=e.formatElapsedTime(Og()-O.timeStart),N}async function a(){e.beforeSearch&&await QF(e.beforeSearch,e,t,r);let s=i();return e.afterSearch&&await XF(e.afterSearch,e,t,r,s),s}return o?a():i()}function _Ce(e,t,r="english"){let n=Og(),o=e.beforeSearch?.length||e.afterSearch?.length;function i(){let{vector:s}=t;if(s&&(!("value"in s)||!("property"in s)))throw _t("INVALID_VECTOR_INPUT",Object.keys(s).join(", "));let{limit:u=10,offset:l=0,includeVectors:c=!1}=t,d=e.data.index.vectorIndexes[s.property],f=d.size,p=d.vectors,h=t.facets&&Object.keys(t.facets).length>0,m=Object.keys(t.where??{}).length>0,{index:_,docs:g}=e.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?_t("INVALID_INPUT_VECTOR","undefined",f,"undefined"):_t("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let v=VX(s.value,p,f,t.similarity).map(([F,k])=>[ko(e.internalDocumentIDStore,F),k]),S=e.caches.propertiesToSearch;if(!S){let F=e.index.getSearchablePropertiesWithTypes(_);S=e.index.getSearchableProperties(_),S=S.filter(k=>F[k].startsWith("string")),e.caches.propertiesToSearch=S}let x=[],O=DR(e.tokenizer,e.index,e.documentsStore,r,t,S,x,e.documentsStore.count(g),n),T=[];m&&(T=e.index.searchByWhereClause(O,_,t.where),v=nk(T,v));let E=[];h&&(E=rk(e,v,t.facets));let M=Array.from({length:u});for(let F=0;F<u;F++){let k=v[F+l];if(!k)break;let L=e.data.docs.docs[k[0]];if(L){c||(L[s.property]=null);let q={id:qh(e.internalDocumentIDStore,k[0]),score:k[1],document:L};M[F]=q}}let A=[];t.groupBy&&(A=ok(e,v,t.groupBy));let N=Og()-n;return{count:v.length,hits:M.filter(Boolean),elapsed:{raw:Number(N),formatted:MR(N)},...E?{facets:E}:{},...A?{groups:A}:{}}}async function a(){e.beforeSearch&&await QF(e.beforeSearch,e,t,r);let s=i();return e.afterSearch&&await XF(e.afterSearch,e,t,r,s),s}return o?a():i()}function X_t(e,t,r){let n=Og(),o=e.beforeSearch?.length||e.afterSearch?.length;function i(){let{offset:s=0,limit:u=10,includeVectors:l=!1}=t,c=t.facets&&Object.keys(t.facets).length>0,d=JBr(e,t,r),f=GBr(e,t),{index:p,docs:h}=e.data,m=t.hybridWeights,_=YBr(d,f,t.term??"",m),g=e.tokenizer.tokenize(t.term??"",r),v=e.caches.propertiesToSearch;if(!v){let N=e.index.getSearchablePropertiesWithTypes(p);v=e.index.getSearchableProperties(p),v=v.filter(F=>N[F].startsWith("string")),e.caches.propertiesToSearch=v}if(t.properties&&t.properties!=="*"){for(let N of t.properties)if(!v.includes(N))throw _t("UNKNOWN_INDEX",N,v.join(", "));v=v.filter(N=>t.properties.includes(N))}let S=DR(e.tokenizer,e.index,e.documentsStore,r,t,v,g,e.documentsStore.count(h),n),x=Object.keys(t.where??{}).length>0,O=[];x&&(O=e.index.searchByWhereClause(S,p,t.where),_=nk(O,_));let T;c&&(T=rk(e,_,t.facets));let E;t.groupBy&&(E=ok(e,_,t.groupBy));let M=YX(e,_,s,u).filter(Boolean),A=Og(),j={count:_.length,elapsed:{raw:Number(A-n),formatted:MR(A-n)},hits:M,...T?{facets:T}:{},...E?{groups:E}:{}};if(!l){let N=Object.keys(e.data.index.vectorIndexes);UX(j,N)}return j}async function a(){e.beforeSearch&&await QF(e.beforeSearch,e,t,r);let s=i();return e.afterSearch&&await XF(e.afterSearch,e,t,r,s),s}return o?a():i()}function JBr(e,t,r){let n=Og();t.relevance=Object.assign(KX,t.relevance??{});let{term:o="",properties:i,threshold:a=0}=t,{index:s,docs:u}=e.data,l=e.tokenizer.tokenize(o,r),c=e.caches.propertiesToSearch;if(!c){let h=e.index.getSearchablePropertiesWithTypes(s);c=e.index.getSearchableProperties(s),c=c.filter(m=>h[m].startsWith("string")),e.caches.propertiesToSearch=c}if(i&&i!=="*"){let h=new Set(c),m=new Set(i);for(let _ of i)if(!h.has(_))throw _t("UNKNOWN_INDEX",_,c.join(", "));c=c.filter(_=>m.has(_))}let d=DR(e.tokenizer,e.index,e.documentsStore,r,t,c,l,e.documentsStore.count(u),n),f=l.length;if(f||i&&i.length>0){let h=c.length;for(let m=0;m<h;m++){let _=c[m];if(f!==0)for(let O=0;O<f;O++){let T=l[O],E=e.index.search(d,s,_,T);ei(d.indexMap[_][T],E)}else{let O=[];d.indexMap[_][""]=O;let T=e.index.search(d,s,_,"");ei(O,T)}let g=d.indexMap[_],v=Object.values(g);d.docsIntersection[_]=HX(v,t?.boost?.[_]??1,a,f);let S=d.docsIntersection[_],x=S.length;for(let O=0;O<x;O++){let[T,E]=S[O],M=d.uniqueDocsIDs[T];d.uniqueDocsIDs[T]=M?M+E+.5:E}}}else l.length===0&&o?d.uniqueDocsIDs={}:d.uniqueDocsIDs=Object.fromEntries(Object.keys(e.documentsStore.getAll(e.data.docs)).map(h=>[h,0]));let p=Object.entries(d.uniqueDocsIDs).map(([h,m])=>[+h,m]).sort((h,m)=>m[1]-h[1]);return Q_t(p)}function GBr(e,t){let r=t.vector,n=e.data.index.vectorIndexes[r?.property],o=n.size,i=n.vectors;if(r&&(!r.value||!r.property))throw _t("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw _t("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=VX(r.value,i,o,t.similarity).map(([s,u])=>[ko(e.internalDocumentIDStore,s),u]);return Q_t(a)}function vCe([,e]){return e}function Q_t(e){let t=Math.max.apply(Math,e.map(vCe));return e.map(([r,n])=>[r,n/t])}function Z_t(e,t){return e/t}function KBr(e,t){return(r,n)=>r*e+n*t}function YBr(e,t,r,n){let o=Math.max.apply(Math,e.map(vCe)),i=Math.max.apply(Math,t.map(vCe)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:ZBr(r),l=new Map,c=e.length,d=KBr(s,u);for(let p=0;p<c;p++){let[h,m]=e[p],_=Z_t(m,o),g=d(_,0);l.set(h,g)}let f=t.length;for(let p=0;p<f;p++){let[h,m]=t[p],_=Z_t(m,i),g=l.get(h)??0;l.set(h,g+d(0,_))}return[...l].sort((p,h)=>h[1]-p[1])}function ZBr(e){return{text:.5,vector:.5}}var KX={k:1.2,b:.75,d:.5};function DR(e,t,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:e,index:t,documentsStore:r,language:n,params:o,docsCount:s,uniqueDocsIDs:{},indexMap:l,docsIntersection:c}}function ac(e,t,r){let n=t.mode??GX;if(n===GX)return K_t(e,t,r);if(n===gCe)return _Ce(e,t);if(n===mCe)return X_t(e,t);throw _t("INVALID_SEARCH_MODE",n)}function Y_t(e,t,r,n,o){let i=e.data.docs,a=new Map,s=[],u=new Set,l=t.length,c=0;for(let d=0;d<l;d++){let f=t[d];if(typeof f>"u")continue;let[p,h]=f;if(u.has(p))continue;let m=e.documentsStore.get(i,p),_=YF(m,o);if(!(typeof _>"u"||a.has(_))&&(a.set(_,!0),c++,!(c<=r)&&(s.push({id:qh(e.internalDocumentIDStore,p),score:h,document:m}),u.add(p),c>=r+n)))break}return s}function YX(e,t,r,n){let o=e.data.docs,i=Array.from({length:n}),a=new Set;for(let s=r;s<n+r;s++){let u=t[s];if(typeof u>"u")break;let[l,c]=u;if(!a.has(l)){let d=e.documentsStore.get(o,l);i[s]={id:qh(e.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}function ZX(e,t){e.internalDocumentIDStore.load(e,t.internalDocumentIDStore),e.data.index=e.index.load(e.internalDocumentIDStore,t.index),e.data.docs=e.documentsStore.load(e.internalDocumentIDStore,t.docs),e.data.sorting=e.sorter.load(e.internalDocumentIDStore,t.sorting),e.tokenizer.language=t.language}function wCe(e){return{internalDocumentIDStore:e.internalDocumentIDStore.save(e.internalDocumentIDStore),index:e.index.save(e.data.index),docs:e.documentsStore.save(e.data.docs),sorting:e.sorter.save(e.data.sorting),language:e.tokenizer.language}}var vSo=new Error("timeout while waiting for mutex to become available"),wSo=new Error("mutex already locked"),QBr=new Error("request for lock canceled"),e$r=function(e,t,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(e,t||[])).next())})},SCe=class{constructor(t,r=QBr){this._value=t,this._cancelError=r,this._queue=[],this._weightedWaiters=[]}acquire(t=1,r=0){if(t<=0)throw new Error(`invalid weight ${t}: must be positive`);return new Promise((n,o)=>{let i={resolve:n,reject:o,weight:t,priority:r},a=evt(this._queue,s=>r<=s.priority);a===-1&&t<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(t){return e$r(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(t=1,r=0){if(t<=0)throw new Error(`invalid weight ${t}: must be positive`);return this._couldLockImmediately(t,r)?Promise.resolve():new Promise(n=>{this._weightedWaiters[t-1]||(this._weightedWaiters[t-1]=[]),t$r(this._weightedWaiters[t-1],{resolve:n,priority:r})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(t){this._value=t,this._dispatchQueue()}release(t=1){if(t<=0)throw new Error(`invalid weight ${t}: must be positive`);this._value+=t,this._dispatchQueue()}cancel(){this._queue.forEach(t=>t.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(t){let r=this._value;this._value-=t.weight,t.resolve([r,this._newReleaser(t.weight)])}_newReleaser(t){let r=!1;return()=>{r||(r=!0,this.release(t))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let t=this._value;t>0;t--){let r=this._weightedWaiters[t-1];r&&(r.forEach(n=>n.resolve()),this._weightedWaiters[t-1]=[])}else{let t=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<=t);(o===-1?n:n.splice(0,o)).forEach(i=>i.resolve())}}}_couldLockImmediately(t,r){return(this._queue.length===0||this._queue[0].priority<r)&&t<=this._value}};function t$r(e,t){let r=evt(e,n=>t.priority<=n.priority);e.splice(r+1,0,t)}function evt(e,t){for(let r=e.length-1;r>=0;r--)if(t(e[r]))return r;return-1}var r$r=function(e,t,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(e,t||[])).next())})},XX=class{constructor(t){this._semaphore=new SCe(1,t)}acquire(){return r$r(this,arguments,void 0,function*(t=0){let[,r]=yield this._semaphore.acquire(1,t);return r})}runExclusive(t,r=0){return this._semaphore.runExclusive(()=>t(),1,r)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(t=0){return this._semaphore.waitForUnlock(1,t)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}};var p0t=B(FQ()),jw=require("obsidian");var OCe="copilot-index-chunk-",n$r=".json",kQ=class{constructor(t,r,n){this.app=t;this.baseDir=r;this.identifier=n}getChunkPath(t){return`${this.baseDir}/${OCe}${this.identifier}-${t}.json`}getMetadataPath(){return`${this.baseDir}/${OCe}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${n$r}`}assignDocumentToPartition(t,r){let o=Array.from(t).reduce((i,a)=>(i<<5)-i+a.charCodeAt(0),0);return Math.abs(o)%r}distributeDocumentsToPartitions(t,r){let n=new Map,o={};for(let a=0;a<r;a++)n.set(a,[]);pe().debug&&console.log(`Total documents to distribute: ${t.length}`);for(let a of t){let s=this.assignDocumentToPartition(a.id,r),u=n.get(s);if(!u)throw new Error(`Invalid partition index: ${s}`);u.push(a),o[a.id]=s}let i=0;return n.forEach((a,s)=>{i+=a.length,pe().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),pe().debug&&(console.log(`Total documents distributed: ${i}`),i!==t.length&&console.error(`Document count mismatch! Original: ${t.length}, Distributed: ${i}`)),n}async ensureDirectoryExists(t){let r=t.substring(0,t.lastIndexOf("/"));await this.app.vault.adapter.exists(r)||await this.app.vault.adapter.mkdir(r)}async saveDatabase(t){try{let r=await wCe(t),n=pe().numPartitions;if(n===1){let l=this.getLegacyPath();await this.ensureDirectoryExists(l),await this.app.vault.adapter.write(l,JSON.stringify({...r,schema:t.schema}));return}let o=r.docs?.docs,i=Array.isArray(o)?o:Object.values(o||{});if(pe().debug&&console.log(`Starting save with ${i.length??0} total documents`),!i||i.length===0){let l={numPartitions:n,vectorLength:t.schema.embedding.match(/\d+/)[0],schema:t.schema,lastModified:Date.now(),documentPartitions:{}},c=this.getMetadataPath();await this.ensureDirectoryExists(c),await this.app.vault.adapter.write(c,JSON.stringify(l)),pe().debug&&console.log("Saved empty database state");return}let a=this.distributeDocumentsToPartitions(i,n),s={numPartitions:n,vectorLength:t.schema.embedding.match(/\d+/)[0],schema:t.schema,lastModified:Date.now(),documentPartitions:Object.fromEntries(i.map(l=>[l.id,this.assignDocumentToPartition(l.id,n)]))};await this.saveMetadata(s);let u={...r,docs:{docs:{},count:0},index:{...r.index,vectorIndexes:void 0}};for(let[l,c]of a.entries()){let d={index:{vectorIndexes:{embedding:{size:r.index.vectorIndexes.embedding.size,vectors:Object.fromEntries(Object.entries(r.index.vectorIndexes.embedding.vectors).filter(([h])=>c.some(m=>m.id===h)))}}},docs:{docs:Object.fromEntries(c.map((h,m)=>[(m+1).toString(),h])),count:c.length}},f=l===0?{...u,docs:d.docs,index:{...u.index,vectorIndexes:d.index.vectorIndexes}}:d,p=this.getChunkPath(l);await this.ensureDirectoryExists(p),await this.app.vault.adapter.write(p,JSON.stringify(f)),pe().debug&&console.log(`Saved partition ${l+1}/${n}`)}pe().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new or(`Failed to save database: ${r.message}`)}}async loadDatabase(){try{let t=this.getLegacyPath();if(await this.app.vault.adapter.exists(t)){let u=JSON.parse(await this.app.vault.adapter.read(t));if(!u?.schema)throw new or("Invalid legacy database format");let l=await tk({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await ZX(l,u),l}let r=await this.loadMetadata(),n=await tk({schema:r.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}}),o=null,i=[];for(let u=0;u<r.numPartitions;u++){let l=this.getChunkPath(u);if(await this.app.vault.adapter.exists(l)){let c=JSON.parse(await this.app.vault.adapter.read(l));i.push(c),u===0&&(o=c)}}if(!o)throw new or("No data found in chunks");let a={},s=1;for(let u of o.internalDocumentIDStore.internalIdToId){let l=i.flatMap(c=>Object.values(c.docs.docs)).find(c=>c.id===u);l?(a[s.toString()]=l,s++):pe().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 ZX(n,o),n}catch(t){throw console.error("Error loading database:",t),new or(`Failed to load database: ${t.message}`)}}async clearStorage(){try{let t=this.getLegacyPath();await this.app.vault.adapter.exists(t)&&await this.app.vault.adapter.remove(t);let r=await this.app.vault.adapter.list(this.baseDir);for(let n of r.files)n.startsWith(`${this.baseDir}/${OCe}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(t){throw console.error("Error clearing storage:",t),new or(`Failed to clear storage: ${t.message}`)}}async exists(){let t=this.getLegacyPath();if(pe().numPartitions===1)return await this.app.vault.adapter.exists(t);let r=this.getMetadataPath();return await this.app.vault.adapter.exists(r)||await this.app.vault.adapter.exists(t)}async loadMetadata(){let t=this.getMetadataPath();if(!await this.app.vault.adapter.exists(t))throw new or("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(t));if(!r?.schema)throw new or("Invalid metadata file: missing schema");return r}async saveMetadata(t){let r=this.getMetadataPath();await this.ensureDirectoryExists(r),await this.app.vault.adapter.write(r,JSON.stringify(t))}};var ECe=require("obsidian");async function c0t(e){if(!e)throw new or("Embedding instance not found.");try{let r=await e.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new or("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${hs.getModelName(e)}`),r.length}catch(t){throw console.error("Error getting vector length:",t),new or("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function d0t(e){let t="",{inclusions:r,exclusions:n}=jR(),o=e.vault.getMarkdownFiles().filter(i=>jP(i,r,n));return await Promise.all(o.map(i=>e.vault.cachedRead(i))).then(i=>i.map(a=>t+=a+" ")),t}function DP(e){let t=[];return t.push(...e.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),t}function o$r(){return pe().qaExclusions?DP(pe().qaExclusions):[]}function i$r(){return pe().qaInclusions?DP(pe().qaInclusions):[]}function jR(){let e=i$r(),t=o$r();return{inclusions:e.length>0?V4(e):null,exclusions:t.length>0?V4(t):null}}function jP(e,t,r){return!(r&&l0t(e.path,r)||t&&!l0t(e.path,t))}function V4(e){let t=[],r=[],n=[],o=[],i=/^#[^\s#]+$/,a=/^\*\.([a-zA-Z0-9.]+)$/,s=/^\[\[(.*?)\]\]$/;return e.forEach(u=>{i.test(u)?t.push(u):a.test(u)?r.push(u):s.test(u)?o.push(u):n.push(u)}),{tagPatterns:t,extensionPatterns:r,folderPatterns:n,notePatterns:o}}function f0t({tagPatterns:e,extensionPatterns:t,folderPatterns:r,notePatterns:n}){return[...e??[],...t??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function a$r(e,t){if(t.length===0)return!1;let r=app.vault.getAbstractFileByPath(e);if(r instanceof ECe.TFile){let n=Oq(r);if(t.some(o=>n.includes(lj(o))))return!0}return!1}function s$r(e,t){if(t.length===0)return!1;let r=e.toLowerCase();return t.some(n=>{let o=n.slice(1).toLowerCase();return r.endsWith(o)})}function u$r(e,t){if(t.length===0)return!1;let r=e.replace(/\\/g,"/");return t.some(n=>{let o=n.replace(/\\/g,"/").replace(/\/$/,"");return r.startsWith(o)&&(r.length===o.length||r[o.length]==="/")})}function l$r(e,t){if(t.length===0)return!1;let r=app.vault.getAbstractFileByPath(e);return!!(r instanceof ECe.TFile&&t.some(n=>n.slice(2,-2)===r.basename))}function l0t(e,t){if(!t)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=t;return a$r(e,r??[])||s$r(e,n??[])||u$r(e,o??[])||l$r(e,i??[])}function BQ(e){let t=[];try{let r=e.vault.getConfig("userIgnoreFilters");r&&Array.isArray(r)&&r.forEach(n=>{typeof n=="string"&&t.push(n.endsWith("/")?n.slice(0,-1):n)})}catch(r){console.warn("Error getting userIgnoreFilters from Obsidian config",r)}return t}var Wx=class e{constructor(t){this.app=t;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new XX;ll(async()=>{let r=pe();jw.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):jw.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await hs.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(Mr("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await hs.getInstance().getEmbeddingsAPI()),Mr("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new or("Vault adapter not available. Please try again later.");let t=await this.getDbPath();this.chunkedStorage=new kQ(this.app,t,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(t){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),jw.Platform.isMobile&&pe().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new or("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),Mr("Loaded existing chunked Orama database from disk."),this.oramaDb}catch(n){gt("Failed to load existing database, creating new one:",n)}let r=await this.createNewDb(t);return this.oramaDb=r,r}catch(r){gt("Error initializing Orama database:",r),new jw.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(jw.Platform.isMobile&&pe().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await hs.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new or("Orama database not found.")}catch(t){throw gt("Failed to initialize database during save:",t),new or("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,pe().debug&&Mr("Orama database saved successfully at:",this.dbPath)}catch(t){throw gt("Error saving Orama database:",t),t}}}async clearIndex(t){try{this.oramaDb||await this.initializeDB(t),await this.chunkedStorage?.clearStorage(),await new Promise(r=>setTimeout(r,100)),this.oramaDb=await this.createNewDb(t),await this.saveDB(),new jw.Notice("Local Copilot index cleared successfully."),Mr("Local Copilot index cleared successfully, new instance created.")}catch(r){throw gt("Error clearing the local Copilot index:",r),new jw.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(t){if(!this.oramaDb)throw new or("Orama database not found.");try{let r=await ac(this.oramaDb,{term:t,properties:["path"]});r.hits.length>0&&(await z4(this.oramaDb,r.hits.map(n=>n.id),500),pe().debug&&Mr(`Deleted document from local Copilot index: ${t}`)),this.markUnsavedChanges()}catch(r){gt("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 t=this.app.vault.getRoot().path,r;if(pe().enableIndexSync)r=this.app.vault.configDir;else{let n=t==="/"?"":t;r=`${n===""||n.startsWith("/")?"":"/"}${n}/.copilot-index`,await this.app.vault.adapter.exists(r)||(await this.app.vault.adapter.mkdir(r),Mr("Created directory:",r))}return r}getVaultIdentifier(){let t=this.app.vault.getName();return(0,p0t.MD5)(t).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(t){if(!t)throw new or("Embedding instance not found.");let r=await c0t(t);if(!r||r===0)throw new or("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await tk({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return Mr(`Created new Orama database for ${this.dbPath}. Embedding model: ${hs.getModelName(t)} with vector length ${r}.`),this.isIndexLoaded=!0,o}static async getDocsByPath(t,r){if(!t)throw new Error("DB not initialized");return r?(await ac(t,{term:r,properties:["path"],exact:!0,includeVectors:!0})).hits:void 0}static async getDocsByEmbedding(t,r,n){return(await ac(t,{mode:"vector",vector:{value:r,property:"embedding"},limit:n.limit,similarity:n.similarity,includeVectors:!0})).hits}static async getLatestFileMtime(t){if(!t)throw new Error("DB not initialized");try{let r=await ac(t,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return gt("Error getting latest file mtime from VectorDB:",r),0}}createDynamicSchema(t){return{id:"string",title:"string",path:"string",content:"string",embedding:`vector[${t}]`,embeddingModel:"string",created_at:"number",ctime:"number",mtime:"number",tags:"string[]",extension:"string"}}async upsert(t){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(t.id,pe().numPartitions),o=await ac(r,{term:t.id,properties:["id"],limit:1});o.hits.length>0&&await RR(r,o.hits[0].id);try{return await U4(r,t),Mr(`${o.hits.length>0?"Updated":"Inserted"} document ${t.id} in partition ${n}`),this.markUnsavedChanges(),t}catch(i){if(gt(`Failed to ${o.hits.length>0?"update":"insert"} document ${t.id}:`,i),o.hits.length>0)try{await U4(r,o.hits[0].document)}catch(a){gt("Failed to restore previous document version:",a)}return}}catch(n){gt(`Error upserting document ${t.id}:`,n);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let t=await ac(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return t.hits.length>0?t.hits[0].document.mtime:0}catch(t){return gt("Error getting latest file mtime from VectorDB:",t),0}}async checkAndHandleEmbeddingModelChange(t){if(!this.oramaDb){Mr("Embedding model change detected. Orama database not found. Initializing new database...");try{return await this.initializeDB(t),!0}catch(o){throw gt("Failed to initialize database:",o),new or("Failed to initialize Orama database. Please check your embedding model settings.")}}let r=await ac(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=hs.getModelName(t);if(!aBe(n,o))return new jw.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),Mr("Detected change in embedding model. Rebuilding Copilot index from scratch."),this.oramaDb=await this.createNewDb(t),await this.saveDB(),!0}else Mr("No previous embedding model found in the database.");return!1}static async getAllDocuments(t){return(await ac(t,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){Mr("Orama database not found during garbage collection. Attempting to initialize...");try{let t=await hs.getInstance().getEmbeddingsAPI();if(!t)throw new or("No embedding model available.");if(await this.initializeDB(t),!this.oramaDb)throw new or("Failed to initialize database after attempt.")}catch(t){throw gt("Failed to initialize database during garbage collection:",t),new or("Failed to initialize database. Please check your embedding model settings.")}}try{let t=this.app.vault.getMarkdownFiles(),r=new Set(t.map(i=>i.path)),o=(await e.getAllDocuments(this.oramaDb)).filter(i=>!r.has(i.path));return o.length===0?0:(Mr("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(o.map(i=>i.path))).join(", ")),o.length===1?await RR(this.oramaDb,o[0].id):await z4(this.oramaDb,o.map(i=>i.id),500),await this.saveDB(),o.length)}catch(t){throw gt("Error garbage collecting the Copilot index:",t),new or("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new or("Orama database not found.");try{let t=await e.getAllDocuments(this.oramaDb),r=new Set;return t.forEach(n=>{r.add(n.path)}),Array.from(r).sort()}catch(t){throw gt("Error getting indexed files:",t),new or("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await ac(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(t){throw gt("Error checking if database is empty:",t),new or("Failed to check if database is empty.")}}async hasIndex(t){if(!this.oramaDb)return!1;let r=await e.getDocsByPath(this.oramaDb,t);return r!==void 0&&r.length>0}async hasEmbeddings(t){if(!this.oramaDb)return!1;let r=await e.getDocsByPath(this.oramaDb,t);return!r||r.length===0?!1:r.every(n=>n?.document?.embedding&&Array.isArray(n.document.embedding)&&n.document.embedding.length>0)}async getDocsJsonByPaths(t){if(!this.oramaDb)throw new or("Orama database not found.");let r={};for(let n of t){let o=await e.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(t){this.filesWithoutEmbeddings.add(t)}clearFilesMissingEmbeddings(){this.filesWithoutEmbeddings.clear()}getFilesMissingEmbeddings(){return Array.from(this.filesWithoutEmbeddings)}isFileMissingEmbeddings(t){return this.filesWithoutEmbeddings.has(t)}async checkIndexIntegrity(){if(!this.oramaDb)throw new or("Orama database not found.");try{let t=await this.getIndexedFiles();for(let n of t)await this.hasEmbeddings(n)||this.markFileMissingEmbeddings(n);let r=this.getFilesMissingEmbeddings();r.length>0?Mr("Files missing embeddings after integrity check:",r.join(", ")):Mr("Index integrity check completed. All documents have embeddings.")}catch(t){throw gt("Error checking index integrity:",t),new or("Failed to check index integrity.")}}};var ik=require("obsidian");var c$r=5e3,$Q=class{constructor(t,r,n){this.app=t;this.indexOps=r;this.dbOps=n;this.debounceTimer=null;this.lastActiveFile=null;this.lastActiveFileMtime=null;this.handleActiveLeafChange=async t=>{if(ik.Platform.isMobile&&pe().disableIndexOnMobile||zm()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=t?.view;if(this.lastActiveFile=i instanceof ik.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}=jR(),u=jP(n,a,s),l=o!==null&&n.stat.mtime>o;u&&l&&this.debouncedReindexFile(n)}};this.debouncedReindexFile=t=>{this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{pe().debug&&console.log("Copilot Plus: Triggering reindex for file ",t.path),this.indexOps.reindexFile(t),this.debounceTimer=null},c$r)};this.handleFileDelete=async t=>{t instanceof ik.TFile&&await this.dbOps.removeDocs(t.path)};this.initializeEventListeners()}initializeEventListeners(){pe().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 W4=class{constructor(t){this.lastRequestTime=0;this.requestsPerMin=t}setRequestsPerMin(t){this.requestsPerMin=t}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 m0t=B(FQ());h0t();lf();var qQ=class extends on{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","documents","transformers"]})}invoke(t,r){return this.transformDocuments(t)}};NSe();var PCe=class extends qQ{constructor(t){if(super(t),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=t?.chunkSize??this.chunkSize,this.chunkOverlap=t?.chunkOverlap??this.chunkOverlap,this.keepSeparator=t?.keepSeparator??this.keepSeparator,this.lengthFunction=t?.lengthFunction??(r=>r.length),this.chunkOverlap>=this.chunkSize)throw new Error("Cannot have chunkOverlap >= chunkSize")}async transformDocuments(t,r={}){return this.splitDocuments(t,r)}splitOnSeparator(t,r){let n;if(r)if(this.keepSeparator){let o=r.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&");n=t.split(new RegExp(`(?=${o})`))}else n=t.split(r);else n=t.split("");return n.filter(o=>o!=="")}async createDocuments(t,r=[],n={}){let o=r.length>0?r:[...Array(t.length)].map(()=>({})),{chunkHeader:i="",chunkOverlapHeader:a="(cont'd) ",appendChunkOverlapHeader:s=!1}=n,u=new Array;for(let l=0;l<t.length;l+=1){let c=t[l],d=1,f=null,p=-1;for(let h of await this.splitText(c)){let m=i,_=c.indexOf(h,p+1);if(f===null){let x=this.numberOfNewLines(c,0,_);d+=x}else{let x=p+await this.lengthFunction(f);if(x<_){let O=this.numberOfNewLines(c,x,_);d+=O}else if(x>_){let O=this.numberOfNewLines(c,_,x);d-=O}s&&(m+=a)}let g=this.numberOfNewLines(h),v=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};v.lines={from:d,to:d+g};let S={...o[l],loc:v};m+=h,u.push(new Jx({pageContent:m,metadata:S})),d+=g,f=h,p=_}}return u}numberOfNewLines(t,r,n){return(t.slice(r,n).match(/\n/g)||[]).length}async splitDocuments(t,r={}){let n=t.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(t,r){let n=t.join(r).trim();return n===""?null:n}async mergeSplits(t,r){let n=[],o=[],i=0;for(let s of t){let u=await this.lengthFunction(s);if(i+u+o.length*r.length>this.chunkSize&&(i>this.chunkSize&&console.warn(`Created a chunk of size ${i}, +
which is longer than the specified ${this.chunkSize}`),o.length>0)){let l=this.joinDocs(o,r);for(l!==null&&n.push(l);i>this.chunkOverlap||i+u+o.length*r.length>this.chunkSize&&i>0;)i-=await this.lengthFunction(o[0]),o.shift()}o.push(s),i+=u}let a=this.joinDocs(o,r);return a!==null&&n.push(a),n}};var UQ=class e extends PCe{static lc_name(){return"RecursiveCharacterTextSplitter"}constructor(t){super(t),Object.defineProperty(this,"separators",{enumerable:!0,configurable:!0,writable:!0,value:[`
`,`
`," ",""]}),this.separators=t?.separators??this.separators,this.keepSeparator=t?.keepSeparator??!0}async _splitText(t,r){let n=[],o=r[r.length-1],i;for(let l=0;l<r.length;l+=1){let c=r[l];if(c===""){o=c;break}if(t.includes(c)){o=c,i=r.slice(l+1);break}}let a=this.splitOnSeparator(t,o),s=[],u=this.keepSeparator?"":o;for(let l of a)if(await this.lengthFunction(l)<this.chunkSize)s.push(l);else{if(s.length){let c=await this.mergeSplits(s,u);n.push(...c),s=[]}if(!i)n.push(l);else{let c=await this._splitText(l,i);n.push(...c)}}if(s.length){let l=await this.mergeSplits(s,u);n.push(...l)}return n}async splitText(t){return this._splitText(t,this.separators)}static fromLanguage(t,r){return new e({...r,separators:e.getSeparatorsForLanguage(t)})}static getSeparatorsForLanguage(t){if(t==="cpp")return[`
class `,`
void `,`
int `,`
float `,`
double `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
`,`
`," ",""];if(t==="go")return[`
func `,`
var `,`
const `,`
type `,`
if `,`
for `,`
switch `,`
case `,`
`,`
`," ",""];if(t==="java")return[`
class `,`
public `,`
protected `,`
private `,`
static `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
`,`
`," ",""];if(t==="js")return[`
function `,`
const `,`
let `,`
var `,`
class `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
default `,`
`,`
`," ",""];if(t==="php")return[`
function `,`
class `,`
if `,`
foreach `,`
while `,`
do `,`
switch `,`
case `,`
`,`
`," ",""];if(t==="proto")return[`
message `,`
service `,`
enum `,`
option `,`
import `,`
syntax `,`
`,`
`," ",""];if(t==="python")return[`
class `,`
def `,`
def `,`
`,`
`," ",""];if(t==="rst")return[`
===
`,`
---
`,`
***
`,`
.. `,`
`,`
`," ",""];if(t==="ruby")return[`
def `,`
class `,`
if `,`
unless `,`
while `,`
for `,`
do `,`
begin `,`
rescue `,`
`,`
`," ",""];if(t==="rust")return[`
fn `,`
const `,`
let `,`
if `,`
while `,`
for `,`
loop `,`
match `,`
const `,`
`,`
`," ",""];if(t==="scala")return[`
class `,`
object `,`
def `,`
val `,`
var `,`
if `,`
for `,`
while `,`
match `,`
case `,`
`,`
`," ",""];if(t==="swift")return[`
func `,`
class `,`
struct `,`
enum `,`
if `,`
for `,`
while `,`
do `,`
switch `,`
case `,`
`,`
`," ",""];if(t==="markdown")return[`
## `,`
### `,`
#### `,`
##### `,`
###### `,"```\n\n",`
***
`,`
---
`,`
___
`,`
`,`
`," ",""];if(t==="latex")return[`
\\chapter{`,`
\\section{`,`
\\subsection{`,`
\\subsubsection{`,`
\\begin{enumerate}`,`
\\begin{itemize}`,`
\\begin{description}`,`
\\begin{list}`,`
\\begin{quote}`,`
\\begin{quotation}`,`
\\begin{verse}`,`
\\begin{verbatim}`,`
\\begin{align}`,"$$","$",`
`,`
`," ",""];if(t==="html")return["<body>","<div>","<p>","<br>","<li>","<h1>","<h2>","<h3>","<h4>","<h5>","<h6>","<span>","<table>","<tr>","<td>","<th>","<ul>","<ol>","<header>","<footer>","<nav>","<head>","<style>","<script>","<meta>","<title>"," ",""];if(t==="sol")return[`
pragma `,`
using `,`
contract `,`
interface `,`
library `,`
constructor `,`
type `,`
function `,`
event `,`
modifier `,`
error `,`
struct `,`
enum `,`
if `,`
for `,`
while `,`
do while `,`
assembly `,`
`,`
`," ",""];throw new Error(`Language ${t} is not supported.`)}};var Nw=require("obsidian");var zQ=class{constructor(t,r,n){this.app=t;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=pe();this.rateLimiter=new W4(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,ll(async()=>{let i=pe();this.rateLimiter=new W4(i.embeddingRequestsPerMin),this.embeddingBatchSize=i.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize})}async indexVaultToVectorStore(t){let r=[];try{let n=await this.embeddingsManager.getEmbeddingsAPI();if(!n)return console.error("Embedding instance not found."),0;await this.dbOps.checkAndHandleEmbeddingModelChange(n)&&(t=!0),t?(await this.dbOps.clearIndex(n),this.dbOps.clearFilesMissingEmbeddings()):await this.dbOps.garbageCollect();let i=await this.getFilesToIndex(t);if(i.length===0)return new Nw.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 Nw.Notice("No valid content to index."),0;for(let s=0;s<a.length&&!this.state.isIndexingCancelled;s+=this.embeddingBatchSize){await this.handlePause();let u=a.slice(s,s+this.embeddingBatchSize);try{await this.rateLimiter.wait();let l=await n.embedDocuments(u.map(f=>f.content));if(!l||l.length!==u.length)throw new Error(`Embedding model returned ${l?.length??0} embeddings for ${u.length} documents`);for(let f=0;f<u.length;f++){let p=u[f],h=l[f];if(!h||!Array.isArray(h)||h.length===0){gt(`Invalid embedding for document ${p.fileInfo.path}: ${h}`),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}try{await this.dbOps.upsert({...p.fileInfo,id:this.getDocHash(p.content),content:p.content,embedding:h,created_at:Date.now(),nchars:p.content.length}),this.state.processedFiles.add(p.fileInfo.path)}catch(m){this.handleError(m,{filePath:p.fileInfo.path,errors:r}),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}}this.state.indexedCount=this.state.processedFiles.size,this.updateIndexingNoticeMessage();let c=Math.floor((this.state.indexedCount-u.length)/this.checkpointInterval);Math.floor(this.state.indexedCount/this.checkpointInterval)>c&&(await this.dbOps.saveDB(),console.log("Copilot index checkpoint save completed."))}catch(l){if(this.handleError(l,{filePath:u?.[0]?.fileInfo?.path,errors:r,batch:u}),this.isRateLimitError(l))break}}return this.finalizeIndexing(r),await this.dbOps.saveDB(),console.log("Copilot index final save completed."),setTimeout(()=>{this.dbOps.checkIndexIntegrity().catch(s=>{gt("Background integrity check failed:",s)})},1e3),this.state.indexedCount}catch(n){return this.handleError(n),0}}async prepareAllChunks(t){let r=await this.embeddingsManager.getEmbeddingsAPI();if(!r)return console.error("Embedding instance not found."),[];let n=hs.getModelName(r),o=UQ.fromLanguage("markdown",{chunkSize:mBe}),i=[];for(let a of t){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:dl(new Date(a.stat.ctime)).display,modified:dl(new Date(a.stat.mtime)).display}};(await o.createDocuments([s],[],{chunkHeader:`
NOTE TITLE: [[${l.title}]]
METADATA:${JSON.stringify(l.metadata)}
NOTE BLOCK CONTENT:
`,appendChunkOverlapHeader:!0})).forEach(d=>{d.pageContent.trim()&&i.push({content:d.pageContent,fileInfo:l})})}return i}getDocHash(t){return(0,m0t.MD5)(t).toString()}async getFilesToIndex(t){let{inclusions:r,exclusions:n}=jR(),o=this.app.vault.getMarkdownFiles();if(t)return o.filter(c=>jP(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(!jP(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 Mr([`Files to index: ${u.size}`,`Previously indexed: ${i.size}`,`Empty files skipped: ${l.size}`,`Files missing embeddings: ${s.size}`].join(`
`)),Array.from(u)}initializeIndexingState(t){this.state={isIndexingPaused:!1,isIndexingCancelled:!1,indexedCount:0,totalFilesToIndex:t,processedFiles:new Set,currentIndexingNotice:null,indexNoticeMessage:null}}createIndexingNotice(){let t=document.createDocumentFragment(),r=t.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()}),t.appendChild(this.state.indexNoticeMessage),t.appendChild(n),this.state.currentIndexingNotice=new Nw.Notice(t,0),this.state.currentIndexingNotice}async handlePause(){if(this.state.isIndexingPaused){for(;this.state.isIndexingPaused&&!this.state.isIndexingCancelled;)await new Promise(t=>setTimeout(t,100));if(!this.state.isIndexingCancelled){let t=await this.getFilesToIndex();if(t.length===0){console.log("No files to index after filter change, stopping indexing"),this.cancelIndexing(),new Nw.Notice("No files to index with current filters");return}this.state.totalFilesToIndex=t.length,console.log("Total files to index:",this.state.totalFilesToIndex),console.log("Files to index:",t),this.updateIndexingNoticeMessage()}}}pauseIndexing(){this.state.isIndexingPaused=!0}resumeIndexing(){this.state.isIndexingPaused=!1}updateIndexingNoticeMessage(){if(this.state.indexNoticeMessage){let t=this.state.isIndexingPaused?" (Paused)":"",r=["Copilot is indexing your vault...",`${this.state.indexedCount}/${this.state.totalFilesToIndex} files processed${t}`],n=pe(),o=DP(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...BQ(this.app),...DP(n.qaExclusions)];a.length>0&&r.push(`Exclusions: ${a.join(", ")}`),this.state.indexNoticeMessage.textContent=r.join(`
`)}}isStringLengthError(t){if(!t)return!1;if(t instanceof RangeError&&t.message.toLowerCase().includes("string length"))return!0;let n=(t.message||t.toString()).toLowerCase();return n.includes("string length")||n.includes("rangeerror")}handleError(t,r){let n=r?.filePath;if(n?(r.batch?console.error("Batch processing error:",{error:t,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:t?.constructor?.name,errorMessage:t?.message}):console.error(`Error indexing file ${n}:`,t),r.errors?.push(n)):console.error("Fatal error during indexing:",t),this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide(),this.isStringLengthError(t)){new Nw.Notice("Vault is too large for 1 partition, please increase the number of partitions in your Copilot QA settings!",1e4);return}if(this.isRateLimitError(t))return;let o=n?`Error indexing file ${n}. Check console for details.`:"Fatal error during indexing. Check console for details.";new Nw.Notice(o)}isRateLimitError(t){return t?.message?.includes?.("rate limit")||!1}finalizeIndexing(t){if(this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide(),this.state.isIndexingCancelled){new Nw.Notice("Indexing cancelled");return}t.length>0?new Nw.Notice(`Indexing completed with ${t.length} errors. Check console for details.`):new Nw.Notice("Indexing completed successfully!")}async reindexFile(t){try{let r=await this.embeddingsManager.getEmbeddingsAPI();if(!r)return;if(await this.dbOps.removeDocs(t.path),await this.dbOps.checkAndHandleEmbeddingModelChange(r)){await this.indexVaultToVectorStore(!0);return}let o=await this.prepareAllChunks([t]);if(o.length===0)return;let i=await r.embedDocuments(o.map(a=>a.content));for(let a=0;a<o.length;a++){let s=o[a];await this.dbOps.upsert({...s.fileInfo,id:this.getDocHash(s.content),content:s.content,embedding:i[a],created_at:Date.now(),nchars:s.content.length})}this.dbOps.markUnsavedChanges(),pe().debug&&console.log(`Reindexed file: ${t.path}`)}catch(r){this.handleError(r,{filePath:t.path})}}async cancelIndexing(){console.log("Indexing cancelled by user"),this.state.isIndexingCancelled=!0,await new Promise(t=>setTimeout(t,100)),this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide()}};var ma=class e{constructor(){this.embeddingsManager=hs.getInstance(),this.dbOps=new Wx(app),this.indexOps=new zQ(app,this.dbOps,this.embeddingsManager),this.eventHandler=new $Q(app,this.indexOps,this.dbOps),this.initializationPromise=this.initialize(),this.setupSettingsSubscription()}static getInstance(){return e.instance||(e.instance=new e),e.instance}setupSettingsSubscription(){this.lastKnownSettings={...pe()};let t=async()=>{let r=pe(),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())}};ll(()=>{this.initializationPromise=t()})}async initialize(){try{let t=3;for(;t>0;)try{await this.dbOps.initializeDB(await this.embeddingsManager.getEmbeddingsAPI());break}catch(r){if(r instanceof or&&r.message.includes("Vault adapter not available")&&(t--,t>0)){await new Promise(n=>setTimeout(n,100));continue}new J4.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(t){console.error("Failed to initialize vector store:",t)}}async waitForInitialization(){await this.initializationPromise}async indexVaultToVectorStore(t){return await this.waitForInitialization(),J4.Platform.isMobile&&pe().disableIndexOnMobile?(new J4.Notice("Indexing is disabled on mobile devices"),0):this.indexOps.indexVaultToVectorStore(t)}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(t){return await this.waitForInitialization(),this.dbOps.hasIndex(t)}onunload(){this.eventHandler.cleanup(),this.dbOps.onunload()}async getDbOps(){return await this.waitForInitialization(),this.dbOps}async getDb(){await this.waitForInitialization();let t=this.dbOps.getDb();if(!t)throw new Error("Database is not loaded. Please restart the plugin.");return t}async reindexFile(t){await this.waitForInitialization(),await this.indexOps.reindexFile(t)}};var TCe="copilot-plus-flash",d$r=TCe+"|"+"copilot-plus",MCe="copilot-plus-small",ICe=MCe+"|"+"copilot-plus";function _fe(e){return e.split("|")[1]==="copilot-plus"}function HQ(){return Uo().isPlusUser}async function VQ(){return pe().plusLicenseKey?(await ms.getInstance().validateLicenseKey()).isValid:(RCe(),!1)}function g0t(){let e=d$r,t=ICe,r=pe().embeddingModelKey;O5(e),gj("copilot_plus"),MO({defaultModelKey:e,embeddingModelKey:t,defaultChainType:"copilot_plus"}),r!==t&&ma.getInstance().indexVaultToVectorStore()}function ACe(e){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${e}`}function Qj(e){window.open(ACe(e),"_blank")}function y0t(){xt("isPlusUser",!0)}function RCe(){let e=pe().isPlusUser;xt("isPlusUser",!1),e&&new Z9(app).open()}var b0t=B(Td()),_0t=require("obsidian"),ms=class e{constructor(){this.pluginVersion="Unknown"}static getInstance(){return e.instance||(e.instance=new e),e.instance}checkLicenseKey(){if(!pe().plusLicenseKey)throw new _0t.Notice("Copilot Plus license key not found. Please enter your license key in the settings."),new Error("License key not initialized")}setPluginVersion(t){this.pluginVersion=t}async makeRequest(t,r,n="POST",o=!1){this.checkLicenseKey();let i=new URL(`${cI}${t}`);n==="GET"&&Object.entries(r).forEach(([u,l])=>{i.searchParams.append(u,l)});let a=await fetch(i.toString(),{method:n,headers:{"Content-Type":"application/json",...!o&&{Authorization:`Bearer ${await Ho(pe().plusLicenseKey)}`},"X-Client-Version":this.pluginVersion},...n==="POST"&&{body:JSON.stringify(r)}}),s=await a.json();if(!a.ok)try{let u=s.detail,l=new Error(u.reason);return l.name=u.error,{data:null,error:l}}catch{return{data:null,error:new Error("Unknown error")}}return Mr(`==== ${t} request ====:`,s),{data:s}}async validateLicenseKey(){let{data:t,error:r}=await this.makeRequest("/license",{license_key:await Ho(pe().plusLicenseKey)},"POST",!0);return r?r.message==="Invalid license key"?(RCe(),{isValid:!1}):{isValid:void 0}:(y0t(),{isValid:!0,plan:t?.plan})}async broca(t){let{data:r,error:n}=await this.makeRequest("/broca",{message:t});if(n)throw n;if(!r)throw new Error("No data returned from broca");return r}async rerank(t,r){let{data:n,error:o}=await this.makeRequest("/rerank",{query:t,documents:r,model:"rerank-2"});if(o)throw o;if(!n)throw new Error("No data returned from rerank");return n}async url4llm(t){let{data:r,error:n}=await this.makeRequest("/url4llm",{url:t});if(n)throw n;if(!r)throw new Error("No data returned from url4llm");return r}async pdf4llm(t){let r=b0t.Buffer.from(t).toString("base64"),{data:n,error:o}=await this.makeRequest("/pdf4llm",{pdf:r});if(o)throw o;if(!n)throw new Error("No data returned from pdf4llm");return n}async webSearch(t){let{data:r,error:n}=await this.makeRequest("/websearch",{query:t});if(n)throw n;if(!r)throw new Error("No data returned from websearch");return r}async youtube4llm(t){let{data:r,error:n}=await this.makeRequest("/youtube4llm",{url:t});if(n)throw n;if(!r)throw new Error("No data returned from youtube4llm");return r}};var UCe={};Yd(UCe,{APIConnectionError:()=>Gx,APIConnectionTimeoutError:()=>FR,APIError:()=>Xu,APIUserAbortError:()=>wl,AnthropicError:()=>Hr,AuthenticationError:()=>lk,BadRequestError:()=>uk,ConflictError:()=>fk,InternalServerError:()=>mk,NotFoundError:()=>dk,PermissionDeniedError:()=>ck,RateLimitError:()=>hk,UnprocessableEntityError:()=>pk});var NR="0.27.3";var v0t=!1,LR,DCe,f$r,p$r,h$r,w0t,m$r,WQ,jCe,S0t,NCe,JQ,x0t;function C0t(e,t={auto:!1}){if(v0t)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${e.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(LR)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${e.kind}'\` after \`import '@anthropic-ai/sdk/shims/${LR}'\``);v0t=t.auto,LR=e.kind,DCe=e.fetch,f$r=e.Request,p$r=e.Response,h$r=e.Headers,w0t=e.FormData,m$r=e.Blob,WQ=e.File,jCe=e.ReadableStream,S0t=e.getMultipartRequestOptions,NCe=e.getDefaultAgent,JQ=e.fileFromPath,x0t=e.isFsReadStream}var GQ=class{constructor(t){this.body=t}get[Symbol.toStringTag](){return"MultipartBody"}};function O0t({manuallyImported:e}={}){let t=e?"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}. ${t}`)}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. ${t}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${t}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${t}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${t}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new GQ(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}}LR||C0t(O0t(),{auto:!0});var Lw=class e{constructor(t,r){this.iterator=t,this.controller=r}static fromSSEResponse(t,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 y$r(t,r)){if(a.event==="completion")try{yield JSON.parse(a.data)}catch(s){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),s}if(a.event==="message_start"||a.event==="message_delta"||a.event==="message_stop"||a.event==="content_block_start"||a.event==="content_block_delta"||a.event==="content_block_stop")try{yield JSON.parse(a.data)}catch(s){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),s}if(a.event!=="ping"&&a.event==="error")throw Xu.generate(void 0,`SSE Error: ${a.data}`,a.data,FCe(t.headers))}i=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{i||r.abort()}}return new e(o,r)}static fromReadableStream(t,r){let n=!1;async function*o(){let a=new ak,s=E0t(t);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 e(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let t=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();t.push(a),r.push(a)}return i.shift()}});return[new e(()=>o(t),this.controller),new e(()=>o(r),this.controller)]}toReadableStream(){let t=this,r,n=new TextEncoder;return new jCe({async start(){r=t[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*y$r(e,t){if(!e.body)throw t.abort(),new Hr("Attempted to iterate over a response with no body");let r=new LCe,n=new ak,o=E0t(e.body);for await(let i of b$r(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*b$r(e){let t=new Uint8Array;for await(let r of e){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?new TextEncoder().encode(r):r,o=new Uint8Array(t.length+n.length);o.set(t),o.set(n,t.length),t=o;let i;for(;(i=_$r(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}function _$r(e){for(let n=0;n<e.length-2;n++){if(e[n]===10&&e[n+1]===10||e[n]===13&&e[n+1]===13)return n+2;if(e[n]===13&&e[n+1]===10&&n+3<e.length&&e[n+2]===13&&e[n+3]===10)return n+4}return-1}var LCe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;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(t),t.startsWith(":"))return null;let[r,n,o]=v$r(t,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},ak=class e{constructor(){this.buffer=[],this.trailingCR=!1}decode(t){let r=this.decodeText(t);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=e.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(e.NEWLINE_REGEXP);return n&&o.pop(),o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof Buffer<"u"){if(t instanceof Buffer)return t.toString();if(t instanceof Uint8Array)return Buffer.from(t).toString();throw new Hr(`Unexpected: received non-Uint8Array (${t.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(t instanceof Uint8Array||t instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(t);throw new Hr(`Unexpected: received non-Uint8Array/ArrayBuffer (${t.constructor.name}) in a web platform. Please report this error.`)}throw new Hr("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let t=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,t}};ak.NEWLINE_CHARS=new Set([`
`,"\r"]);ak.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function v$r(e,t){let r=e.indexOf(t);return r!==-1?[e.substring(0,r),t,e.substring(r+t.length)]:[e,"",""]}function E0t(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let r=await t.read();return r?.done&&t.releaseLock(),r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var w$r=e=>e!=null&&typeof e=="object"&&typeof e.url=="string"&&typeof e.blob=="function",S$r=e=>e!=null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.lastModified=="number"&&G4(e),G4=e=>e!=null&&typeof e=="object"&&typeof e.size=="number"&&typeof e.type=="string"&&typeof e.text=="function"&&typeof e.slice=="function"&&typeof e.arrayBuffer=="function";async function P0t(e,t,r){if(e=await e,S$r(e))return e;if(w$r(e)){let o=await e.blob();t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=G4(o)?[await o.arrayBuffer()]:[o];return new WQ(i,t,r)}let n=await x$r(e);if(t||(t=O$r(e)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new WQ(n,t,r)}async function x$r(e){let t=[];if(typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(G4(e))t.push(await e.arrayBuffer());else if(E$r(e))for await(let r of e)t.push(r);else throw new Error(`Unexpected data type: ${typeof e}; constructor: ${e?.constructor?.name}; props: ${C$r(e)}`);return t}function C$r(e){return`[${Object.getOwnPropertyNames(e).map(r=>`"${r}"`).join(", ")}]`}function O$r(e){return kCe(e.name)||kCe(e.filename)||kCe(e.path)?.split(/[\\/]/).pop()}var kCe=e=>{if(typeof e=="string")return e;if(typeof Buffer<"u"&&e instanceof Buffer)return String(e)},E$r=e=>e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function",BCe=e=>e&&typeof e=="object"&&e.body&&e[Symbol.toStringTag]==="MultipartBody";var T$r=function(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},M$r=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},KQ;async function D0t(e){let{response:t}=e;if(e.options.stream)return sk("response",t.status,t.url,t.headers,t.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(t,e.controller):Lw.fromSSEResponse(t,e.controller);if(t.status===204)return null;if(e.options.__binaryResponse)return t;let r=t.headers.get("content-type");if(r?.includes("application/json")||r?.includes("application/vnd.api+json")){let i=await t.json();return sk("response",t.status,t.url,t.headers,i),i}let o=await t.text();return sk("response",t.status,t.url,t.headers,o),o}var YQ=class e extends Promise{constructor(t,r=D0t){super(n=>{n(null)}),this.responsePromise=t,this.parseResponse=r}_thenUnwrap(t){return new e(this.responsePromise,async r=>t(await this.parseResponse(r)))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){let[t,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(t,r){return this.parse().then(t,r)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}},ZQ=class{constructor({baseURL:t,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=t,this.maxRetries=$Ce("maxRetries",r),this.timeout=$Ce("timeout",n),this.httpAgent=o,this.fetch=i??DCe}authHeaders(t){return{}}defaultHeaders(t){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...R$r(),...this.authHeaders(t)}}validateHeaders(t,r){}defaultIdempotencyKey(){return`stainless-node-retry-${k$r()}`}get(t,r){return this.methodRequest("get",t,r)}post(t,r){return this.methodRequest("post",t,r)}patch(t,r){return this.methodRequest("patch",t,r)}put(t,r){return this.methodRequest("put",t,r)}delete(t,r){return this.methodRequest("delete",t,r)}methodRequest(t,r,n){return this.request(Promise.resolve(n).then(async o=>{let i=o&&G4(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:t,path:r,...o,body:i}}))}getAPIList(t,r,n){return this.requestAPIList(r,{method:"get",path:t,...n})}calculateContentLength(t){if(typeof t=="string"){if(typeof Buffer<"u")return Buffer.byteLength(t,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(t).length.toString()}else if(ArrayBuffer.isView(t))return t.byteLength.toString();return null}buildRequest(t){let{method:r,path:n,query:o,headers:i={}}=t,a=ArrayBuffer.isView(t.body)||t.__binaryRequest&&typeof t.body=="string"?t.body:BCe(t.body)?t.body.body:t.body?JSON.stringify(t.body,null,2):null,s=this.calculateContentLength(a),u=this.buildURL(n,o);"timeout"in t&&$Ce("timeout",t.timeout);let l=t.timeout??this.timeout,c=t.httpAgent??this.httpAgent??NCe(u),d=l+1e3;typeof c?.options?.timeout=="number"&&d>(c.options.timeout??0)&&(c.options.timeout=d),this.idempotencyHeader&&r!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=t.idempotencyKey);let f=this.buildHeaders({options:t,headers:i,contentLength:s});return{req:{method:r,...a&&{body:a},headers:f,...c&&{agent:c},signal:t.signal??null},url:u,timeout:l}}buildHeaders({options:t,headers:r,contentLength:n}){let o={};n&&(o["content-length"]=n);let i=this.defaultHeaders(t);return R0t(o,i),R0t(o,r),BCe(t.body)&&LR!=="node"&&delete o["content-type"],this.validateHeaders(o,r),o}async prepareOptions(t){}async prepareRequest(t,{url:r,options:n}){}parseHeaders(t){return t?Symbol.iterator in t?Object.fromEntries(Array.from(t).map(r=>[...r])):{...t}:{}}makeStatusError(t,r,n,o){return Xu.generate(t,r,n,o)}request(t,r=null){return new YQ(this.makeRequest(t,r))}async makeRequest(t,r){let n=await t;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}),sk("request",i,n,o.headers),n.signal?.aborted)throw new wl;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(XQ);if(u instanceof Error){if(n.signal?.aborted)throw new wl;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new FR:new Gx({cause:u})}let l=FCe(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let m=`retrying, ${r} attempts remaining`;return sk(`response (error; ${m})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(m=>XQ(m).message),d=D$r(c),f=d?void 0:c;throw sk(`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(t,r){let n=this.makeRequest(r,null);return new qCe(this,n,t)}buildURL(t,r){let n=N$r(t)?new URL(t):new URL(this.baseURL+(this.baseURL.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),o=this.defaultQuery();return eee(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(n.search=this.stringifyQuery(r)),n.toString()}stringifyQuery(t){return Object.entries(t).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new Hr(`Cannot stringify type ${typeof n}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(t,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,t,{signal:o.signal,...a}).finally(()=>{clearTimeout(s)})}getRequestClient(){return{fetch:this.fetch}}shouldRetry(t){let r=t.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,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=t.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await L$r(o),this.makeRequest(t,r-1)}calculateDefaultRetryTimeoutMillis(t,r){let i=r-t,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}getUserAgent(){return`${this.constructor.name}/JS ${NR}`}},T0t=class{constructor(t,r,n,o){KQ.set(this,void 0),T$r(this,KQ,t,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let t=this.nextPageInfo();if(!t)throw new Hr("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let r={...this.options};if("params"in t&&typeof r.query=="object")r.query={...r.query,...t.params};else if("url"in t){let n=[...Object.entries(r.query||{}),...t.url.searchParams.entries()];for(let[o,i]of n)t.url.searchParams.set(o,i);r.query=void 0,r.path=t.url.toString()}return await M$r(this,KQ,"f").requestAPIList(this.constructor,r)}async*iterPages(){let t=this;for(yield t;t.hasNextPage();)t=await t.getNextPage(),yield t}async*[(KQ=new WeakMap,Symbol.asyncIterator)](){for await(let t of this.iterPages())for(let r of t.getPaginatedItems())yield r}},qCe=class extends YQ{constructor(t,r,n){super(r,async o=>new n(t,o.response,await D0t(o),o.options))}async*[Symbol.asyncIterator](){let t=await this;for await(let r of t)yield r}},FCe=e=>new Proxy(Object.fromEntries(e.entries()),{get(t,r){let n=r.toString();return t[n.toLowerCase()]||t[n]}});var I$r=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":NR,"X-Stainless-OS":I0t(Deno.build.os),"X-Stainless-Arch":M0t(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":NR,"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":NR,"X-Stainless-OS":I0t(process.platform),"X-Stainless-Arch":M0t(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let e=A$r();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":NR,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":NR,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function A$r(){if(typeof navigator>"u"||!navigator)return null;let e=[{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:t,pattern:r}of e){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:t,version:`${o}.${i}.${a}`}}}return null}var M0t=e=>e==="x32"?"x32":e==="x86_64"||e==="x64"?"x64":e==="arm"?"arm":e==="aarch64"||e==="arm64"?"arm64":e?`other:${e}`:"unknown",I0t=e=>(e=e.toLowerCase(),e.includes("ios")?"iOS":e==="android"?"Android":e==="darwin"?"MacOS":e==="win32"?"Windows":e==="freebsd"?"FreeBSD":e==="openbsd"?"OpenBSD":e==="linux"?"Linux":e?`Other:${e}`:"Unknown"),A0t,R$r=()=>A0t??(A0t=I$r()),D$r=e=>{try{return JSON.parse(e)}catch{return}},j$r=new RegExp("^(?:[a-z]+:)?//","i"),N$r=e=>j$r.test(e),L$r=e=>new Promise(t=>setTimeout(t,e)),$Ce=(e,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new Hr(`${e} must be an integer`);if(t<0)throw new Hr(`${e} must be a positive integer`);return t},XQ=e=>e instanceof Error?e:new Error(e);var QQ=e=>{if(typeof process<"u")return process.env?.[e]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(e)?.trim()};function eee(e){if(!e)return!0;for(let t in e)return!1;return!0}function F$r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function R0t(e,t){for(let r in t){if(!F$r(t,r))continue;let n=r.toLowerCase();if(!n)continue;let o=t[r];o===null?delete e[n]:o!==void 0&&(e[n]=o)}}function sk(e,...t){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Anthropic:DEBUG:${e}`,...t)}var k$r=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),j0t=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";var Hr=class extends Error{},Xu=class e extends Hr{constructor(t,r,n,o){super(`${e.makeMessage(t,r,n)}`),this.status=t,this.headers=o,this.request_id=o?.["request-id"],this.error=r}static makeMessage(t,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return t&&o?`${t} ${o}`:t?`${t} status code (no body)`:o||"(no status code or body)"}static generate(t,r,n,o){if(!t)return new Gx({message:n,cause:XQ(r)});let i=r;return t===400?new uk(t,i,n,o):t===401?new lk(t,i,n,o):t===403?new ck(t,i,n,o):t===404?new dk(t,i,n,o):t===409?new fk(t,i,n,o):t===422?new pk(t,i,n,o):t===429?new hk(t,i,n,o):t>=500?new mk(t,i,n,o):new e(t,i,n,o)}},wl=class extends Xu{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0),this.status=void 0}},Gx=class extends Xu{constructor({message:t,cause:r}){super(void 0,void 0,t||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},FR=class extends Gx{constructor({message:t}={}){super({message:t??"Request timed out."})}},uk=class extends Xu{constructor(){super(...arguments),this.status=400}},lk=class extends Xu{constructor(){super(...arguments),this.status=401}},ck=class extends Xu{constructor(){super(...arguments),this.status=403}},dk=class extends Xu{constructor(){super(...arguments),this.status=404}},fk=class extends Xu{constructor(){super(...arguments),this.status=409}},pk=class extends Xu{constructor(){super(...arguments),this.status=422}},hk=class extends Xu{constructor(){super(...arguments),this.status=429}},mk=class extends Xu{};var zh=class{constructor(t){this._client=t}};var $$r=e=>{let t=0,r=[];for(;t<e.length;){let n=e[t];if(n==="\\"){t++;continue}if(n==="{"){r.push({type:"brace",value:"{"}),t++;continue}if(n==="}"){r.push({type:"brace",value:"}"}),t++;continue}if(n==="["){r.push({type:"paren",value:"["}),t++;continue}if(n==="]"){r.push({type:"paren",value:"]"}),t++;continue}if(n===":"){r.push({type:"separator",value:":"}),t++;continue}if(n===","){r.push({type:"delimiter",value:","}),t++;continue}if(n==='"'){let s="",u=!1;for(n=e[++t];n!=='"';){if(t===e.length){u=!0;break}if(n==="\\"){if(t++,t===e.length){u=!0;break}s+=n+e[t],n=e[++t]}else s+=n,n=e[++t]}n=e[++t],u||r.push({type:"string",value:s});continue}if(n&&/\s/.test(n)){t++;continue}let i=/[0-9]/;if(n&&i.test(n)||n==="-"||n==="."){let s="";for(n==="-"&&(s+=n,n=e[++t]);n&&i.test(n)||n===".";)s+=n,n=e[++t];r.push({type:"number",value:s});continue}let a=/[a-z]/i;if(n&&a.test(n)){let s="";for(;n&&a.test(n)&&t!==e.length;)s+=n,n=e[++t];if(s=="true"||s=="false"||s==="null")r.push({type:"name",value:s});else{t++;continue}continue}t++}return r},gk=e=>{if(e.length===0)return e;let t=e[e.length-1];switch(t.type){case"separator":return e=e.slice(0,e.length-1),gk(e);break;case"number":let r=t.value[t.value.length-1];if(r==="."||r==="-")return e=e.slice(0,e.length-1),gk(e);case"string":let n=e[e.length-2];if(n?.type==="delimiter")return e=e.slice(0,e.length-1),gk(e);if(n?.type==="brace"&&n.value==="{")return e=e.slice(0,e.length-1),gk(e);break;case"delimiter":return e=e.slice(0,e.length-1),gk(e);break}return e},q$r=e=>{let t=[];return e.map(r=>{r.type==="brace"&&(r.value==="{"?t.push("}"):t.splice(t.lastIndexOf("}"),1)),r.type==="paren"&&(r.value==="["?t.push("]"):t.splice(t.lastIndexOf("]"),1))}),t.length>0&&t.reverse().map(r=>{r==="}"?e.push({type:"brace",value:"}"}):r==="]"&&e.push({type:"paren",value:"]"})}),e},U$r=e=>{let t="";return e.map(r=>{switch(r.type){case"string":t+='"'+r.value+'"';break;default:t+=r.value;break}}),t},tee=e=>JSON.parse(U$r(q$r(gk($$r(e)))));var jf=function(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},cn=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},Hh,NP,ree,nee,K4,Y4,oee,Z4,Kx,X4,iee,aee,yk,zCe,N0t,HCe,VCe,WCe,JCe,L0t,F0t="__json_buf",see=class e{constructor(){Hh.add(this),this.messages=[],this.receivedMessages=[],NP.set(this,void 0),this.controller=new AbortController,ree.set(this,void 0),nee.set(this,()=>{}),K4.set(this,()=>{}),Y4.set(this,void 0),oee.set(this,()=>{}),Z4.set(this,()=>{}),Kx.set(this,{}),X4.set(this,!1),iee.set(this,!1),aee.set(this,!1),yk.set(this,!1),HCe.set(this,t=>{if(jf(this,iee,!0,"f"),t instanceof Error&&t.name==="AbortError"&&(t=new wl),t instanceof wl)return jf(this,aee,!0,"f"),this._emit("abort",t);if(t instanceof Hr)return this._emit("error",t);if(t instanceof Error){let r=new Hr(t.message);return r.cause=t,this._emit("error",r)}return this._emit("error",new Hr(String(t)))}),jf(this,ree,new Promise((t,r)=>{jf(this,nee,t,"f"),jf(this,K4,r,"f")}),"f"),jf(this,Y4,new Promise((t,r)=>{jf(this,oee,t,"f"),jf(this,Z4,r,"f")}),"f"),cn(this,ree,"f").catch(()=>{}),cn(this,Y4,"f").catch(()=>{})}static fromReadableStream(t){let r=new e;return r._run(()=>r._fromReadableStream(t)),r}static createMessage(t,r,n){let o=new e;for(let i of r.messages)o._addPromptCachingBetaMessageParam(i);return o._run(()=>o._createPromptCachingBetaMessage(t,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(t){t().then(()=>{this._emitFinal(),this._emit("end")},cn(this,HCe,"f"))}_addPromptCachingBetaMessageParam(t){this.messages.push(t)}_addPromptCachingBetaMessage(t,r=!0){this.receivedMessages.push(t),r&&this._emit("message",t)}async _createPromptCachingBetaMessage(t,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),cn(this,Hh,"m",VCe).call(this);let i=await t.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)cn(this,Hh,"m",WCe).call(this,a);if(i.controller.signal?.aborted)throw new wl;cn(this,Hh,"m",JCe).call(this)}_connected(){this.ended||(cn(this,nee,"f").call(this),this._emit("connect"))}get ended(){return cn(this,X4,"f")}get errored(){return cn(this,iee,"f")}get aborted(){return cn(this,aee,"f")}abort(){this.controller.abort()}on(t,r){return(cn(this,Kx,"f")[t]||(cn(this,Kx,"f")[t]=[])).push({listener:r}),this}off(t,r){let n=cn(this,Kx,"f")[t];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(t,r){return(cn(this,Kx,"f")[t]||(cn(this,Kx,"f")[t]=[])).push({listener:r,once:!0}),this}emitted(t){return new Promise((r,n)=>{jf(this,yk,!0,"f"),t!=="error"&&this.once("error",n),this.once(t,r)})}async done(){jf(this,yk,!0,"f"),await cn(this,Y4,"f")}get currentMessage(){return cn(this,NP,"f")}async finalMessage(){return await this.done(),cn(this,Hh,"m",zCe).call(this)}async finalText(){return await this.done(),cn(this,Hh,"m",N0t).call(this)}_emit(t,...r){if(cn(this,X4,"f"))return;t==="end"&&(jf(this,X4,!0,"f"),cn(this,oee,"f").call(this));let n=cn(this,Kx,"f")[t];if(n&&(cn(this,Kx,"f")[t]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),t==="abort"){let o=r[0];!cn(this,yk,"f")&&!n?.length&&Promise.reject(o),cn(this,K4,"f").call(this,o),cn(this,Z4,"f").call(this,o),this._emit("end");return}if(t==="error"){let o=r[0];!cn(this,yk,"f")&&!n?.length&&Promise.reject(o),cn(this,K4,"f").call(this,o),cn(this,Z4,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalPromptCachingBetaMessage",cn(this,Hh,"m",zCe).call(this))}async _fromReadableStream(t,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),cn(this,Hh,"m",VCe).call(this),this._connected();let o=Lw.fromReadableStream(t,this.controller);for await(let i of o)cn(this,Hh,"m",WCe).call(this,i);if(o.controller.signal?.aborted)throw new wl;cn(this,Hh,"m",JCe).call(this)}[(NP=new WeakMap,ree=new WeakMap,nee=new WeakMap,K4=new WeakMap,Y4=new WeakMap,oee=new WeakMap,Z4=new WeakMap,Kx=new WeakMap,X4=new WeakMap,iee=new WeakMap,aee=new WeakMap,yk=new WeakMap,HCe=new WeakMap,Hh=new WeakSet,zCe=function(){if(this.receivedMessages.length===0)throw new Hr("stream ended without producing a PromptCachingBetaMessage with role=assistant");return this.receivedMessages.at(-1)},N0t=function(){if(this.receivedMessages.length===0)throw new Hr("stream ended without producing a PromptCachingBetaMessage with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new Hr("stream ended without producing a content block with type=text");return r.join(" ")},VCe=function(){this.ended||jf(this,NP,void 0,"f")},WCe=function(r){if(this.ended)return;let n=cn(this,Hh,"m",L0t).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let o=n.content.at(-1);r.delta.type==="text_delta"&&o.type==="text"?this._emit("text",r.delta.text,o.text||""):r.delta.type==="input_json_delta"&&o.type==="tool_use"&&o.input&&this._emit("inputJson",r.delta.partial_json,o.input);break}case"message_stop":{this._addPromptCachingBetaMessageParam(n),this._addPromptCachingBetaMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{jf(this,NP,n,"f");break}case"content_block_start":case"message_delta":break}},JCe=function(){if(this.ended)throw new Hr("stream has ended, this shouldn't happen");let r=cn(this,NP,"f");if(!r)throw new Hr("request ended without sending any chunks");return jf(this,NP,void 0,"f"),r},L0t=function(r){let n=cn(this,NP,"f");if(r.type==="message_start"){if(n)throw new Hr(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Hr(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let o=n.content.at(r.index);if(o?.type==="text"&&r.delta.type==="text_delta")o.text+=r.delta.text;else if(o?.type==="tool_use"&&r.delta.type==="input_json_delta"){let i=o[F0t]||"";i+=r.delta.partial_json,Object.defineProperty(o,F0t,{value:i,enumerable:!1,writable:!0}),i&&(o.input=tee(i))}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let t=[],r=[],n=!1;return this.on("streamEvent",o=>{let i=r.shift();i?i.resolve(o):t.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()=>t.length?{value:t.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 Lw(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var kR=class extends zh{create(t,r){return this._client.post("/v1/messages?beta=prompt_caching",{body:t,timeout:this._client._options.timeout??6e5,...r,headers:{"anthropic-beta":"prompt-caching-2024-07-31",...r?.headers},stream:t.stream??!1})}stream(t,r){return see.createMessage(this,t,r)}};kR||(kR={});var BR=class extends zh{constructor(){super(...arguments),this.messages=new kR(this._client)}};(function(e){e.Messages=kR})(BR||(BR={}));var LP=class extends zh{constructor(){super(...arguments),this.promptCaching=new BR(this._client)}};(function(e){e.PromptCaching=BR})(LP||(LP={}));var FP=class extends zh{create(t,r){return this._client.post("/v1/complete",{body:t,timeout:this._client._options.timeout??6e5,...r,stream:t.stream??!1})}};FP||(FP={});var Nf=function(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},dn=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},Vh,kP,uee,lee,Q4,e3,cee,t3,Yx,r3,dee,fee,bk,GCe,k0t,KCe,YCe,ZCe,XCe,B0t,$0t="__json_buf",pee=class e{constructor(){Vh.add(this),this.messages=[],this.receivedMessages=[],kP.set(this,void 0),this.controller=new AbortController,uee.set(this,void 0),lee.set(this,()=>{}),Q4.set(this,()=>{}),e3.set(this,void 0),cee.set(this,()=>{}),t3.set(this,()=>{}),Yx.set(this,{}),r3.set(this,!1),dee.set(this,!1),fee.set(this,!1),bk.set(this,!1),KCe.set(this,t=>{if(Nf(this,dee,!0,"f"),t instanceof Error&&t.name==="AbortError"&&(t=new wl),t instanceof wl)return Nf(this,fee,!0,"f"),this._emit("abort",t);if(t instanceof Hr)return this._emit("error",t);if(t instanceof Error){let r=new Hr(t.message);return r.cause=t,this._emit("error",r)}return this._emit("error",new Hr(String(t)))}),Nf(this,uee,new Promise((t,r)=>{Nf(this,lee,t,"f"),Nf(this,Q4,r,"f")}),"f"),Nf(this,e3,new Promise((t,r)=>{Nf(this,cee,t,"f"),Nf(this,t3,r,"f")}),"f"),dn(this,uee,"f").catch(()=>{}),dn(this,e3,"f").catch(()=>{})}static fromReadableStream(t){let r=new e;return r._run(()=>r._fromReadableStream(t)),r}static createMessage(t,r,n){let o=new e;for(let i of r.messages)o._addMessageParam(i);return o._run(()=>o._createMessage(t,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(t){t().then(()=>{this._emitFinal(),this._emit("end")},dn(this,KCe,"f"))}_addMessageParam(t){this.messages.push(t)}_addMessage(t,r=!0){this.receivedMessages.push(t),r&&this._emit("message",t)}async _createMessage(t,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),dn(this,Vh,"m",YCe).call(this);let i=await t.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)dn(this,Vh,"m",ZCe).call(this,a);if(i.controller.signal?.aborted)throw new wl;dn(this,Vh,"m",XCe).call(this)}_connected(){this.ended||(dn(this,lee,"f").call(this),this._emit("connect"))}get ended(){return dn(this,r3,"f")}get errored(){return dn(this,dee,"f")}get aborted(){return dn(this,fee,"f")}abort(){this.controller.abort()}on(t,r){return(dn(this,Yx,"f")[t]||(dn(this,Yx,"f")[t]=[])).push({listener:r}),this}off(t,r){let n=dn(this,Yx,"f")[t];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(t,r){return(dn(this,Yx,"f")[t]||(dn(this,Yx,"f")[t]=[])).push({listener:r,once:!0}),this}emitted(t){return new Promise((r,n)=>{Nf(this,bk,!0,"f"),t!=="error"&&this.once("error",n),this.once(t,r)})}async done(){Nf(this,bk,!0,"f"),await dn(this,e3,"f")}get currentMessage(){return dn(this,kP,"f")}async finalMessage(){return await this.done(),dn(this,Vh,"m",GCe).call(this)}async finalText(){return await this.done(),dn(this,Vh,"m",k0t).call(this)}_emit(t,...r){if(dn(this,r3,"f"))return;t==="end"&&(Nf(this,r3,!0,"f"),dn(this,cee,"f").call(this));let n=dn(this,Yx,"f")[t];if(n&&(dn(this,Yx,"f")[t]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),t==="abort"){let o=r[0];!dn(this,bk,"f")&&!n?.length&&Promise.reject(o),dn(this,Q4,"f").call(this,o),dn(this,t3,"f").call(this,o),this._emit("end");return}if(t==="error"){let o=r[0];!dn(this,bk,"f")&&!n?.length&&Promise.reject(o),dn(this,Q4,"f").call(this,o),dn(this,t3,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",dn(this,Vh,"m",GCe).call(this))}async _fromReadableStream(t,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),dn(this,Vh,"m",YCe).call(this),this._connected();let o=Lw.fromReadableStream(t,this.controller);for await(let i of o)dn(this,Vh,"m",ZCe).call(this,i);if(o.controller.signal?.aborted)throw new wl;dn(this,Vh,"m",XCe).call(this)}[(kP=new WeakMap,uee=new WeakMap,lee=new WeakMap,Q4=new WeakMap,e3=new WeakMap,cee=new WeakMap,t3=new WeakMap,Yx=new WeakMap,r3=new WeakMap,dee=new WeakMap,fee=new WeakMap,bk=new WeakMap,KCe=new WeakMap,Vh=new WeakSet,GCe=function(){if(this.receivedMessages.length===0)throw new Hr("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},k0t=function(){if(this.receivedMessages.length===0)throw new Hr("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new Hr("stream ended without producing a content block with type=text");return r.join(" ")},YCe=function(){this.ended||Nf(this,kP,void 0,"f")},ZCe=function(r){if(this.ended)return;let n=dn(this,Vh,"m",B0t).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let o=n.content.at(-1);r.delta.type==="text_delta"&&o.type==="text"?this._emit("text",r.delta.text,o.text||""):r.delta.type==="input_json_delta"&&o.type==="tool_use"&&o.input&&this._emit("inputJson",r.delta.partial_json,o.input);break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{Nf(this,kP,n,"f");break}case"content_block_start":case"message_delta":break}},XCe=function(){if(this.ended)throw new Hr("stream has ended, this shouldn't happen");let r=dn(this,kP,"f");if(!r)throw new Hr("request ended without sending any chunks");return Nf(this,kP,void 0,"f"),r},B0t=function(r){let n=dn(this,kP,"f");if(r.type==="message_start"){if(n)throw new Hr(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Hr(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let o=n.content.at(r.index);if(o?.type==="text"&&r.delta.type==="text_delta")o.text+=r.delta.text;else if(o?.type==="tool_use"&&r.delta.type==="input_json_delta"){let i=o[$0t]||"";i+=r.delta.partial_json,Object.defineProperty(o,$0t,{value:i,enumerable:!1,writable:!0}),i&&(o.input=tee(i))}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let t=[],r=[],n=!1;return this.on("streamEvent",o=>{let i=r.shift();i?i.resolve(o):t.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()=>t.length?{value:t.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 Lw(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var BP=class extends zh{create(t,r){return t.model in q0t&&console.warn(`The model '${t.model}' is deprecated and will reach end-of-life on ${q0t[t.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:t,timeout:this._client._options.timeout??6e5,...r,stream:t.stream??!1})}stream(t,r){return pee.createMessage(this,t,r)}},q0t={"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"};BP||(BP={});var U0t,ti=class extends ZQ{constructor({baseURL:t=QQ("ANTHROPIC_BASE_URL"),apiKey:r=QQ("ANTHROPIC_API_KEY")??null,authToken:n=QQ("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){let i={apiKey:r,authToken:n,...o,baseURL:t||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&j0t())throw new Hr(`It looks like you're running in a browser-like environment.
This is disabled by default, as it risks exposing your secret API credentials to attackers.
If you understand the risks and have appropriate mitigations in place,
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
TODO: link!
`);super({baseURL:i.baseURL,timeout:i.timeout??6e5,httpAgent:i.httpAgent,maxRetries:i.maxRetries,fetch:i.fetch}),this.completions=new FP(this),this.messages=new BP(this),this.beta=new LP(this),this._options=i,this.apiKey=r,this.authToken=n}defaultQuery(){return this._options.defaultQuery}defaultHeaders(t){return{...super.defaultHeaders(t),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01",...this._options.defaultHeaders}}validateHeaders(t,r){if(!(this.apiKey&&t["x-api-key"])&&r["x-api-key"]!==null&&!(this.authToken&&t.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(t){let r=this.apiKeyAuth(t),n=this.bearerAuth(t);return r!=null&&!eee(r)?r:n!=null&&!eee(n)?n:{}}apiKeyAuth(t){return this.apiKey==null?{}:{"X-Api-Key":this.apiKey}}bearerAuth(t){return this.authToken==null?{}:{Authorization:`Bearer ${this.authToken}`}}};U0t=ti;ti.Anthropic=U0t;ti.HUMAN_PROMPT=`
Human:`;ti.AI_PROMPT=`
Assistant:`;ti.DEFAULT_TIMEOUT=6e5;ti.AnthropicError=Hr;ti.APIError=Xu;ti.APIConnectionError=Gx;ti.APIConnectionTimeoutError=FR;ti.APIUserAbortError=wl;ti.NotFoundError=dk;ti.ConflictError=fk;ti.RateLimitError=hk;ti.BadRequestError=uk;ti.AuthenticationError=lk;ti.InternalServerError=mk;ti.PermissionDeniedError=ck;ti.UnprocessableEntityError=pk;ti.toFile=P0t;ti.fileFromPath=JQ;var{HUMAN_PROMPT:eOo,AI_PROMPT:tOo}=ti,{AnthropicError:rOo,APIError:nOo,APIConnectionError:oOo,APIConnectionTimeoutError:iOo,APIUserAbortError:aOo,NotFoundError:sOo,ConflictError:uOo,RateLimitError:lOo,BadRequestError:cOo,AuthenticationError:dOo,InternalServerError:fOo,PermissionDeniedError:pOo,UnprocessableEntityError:hOo}=UCe;(function(e){e.Completions=FP,e.Messages=BP,e.Beta=LP})(ti||(ti={}));kh();Lx();oh();jS();OO();var n3=class extends YM{static lc_name(){return"AnthropicToolsOutputParser"}constructor(t){super(t),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=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){let r=t;if(typeof t=="string")try{r=JSON.parse(t)}catch(o){throw new np(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(o.message)}`,t)}else r=t;if(this.zodSchema===void 0)return r;let n=await this.zodSchema.safeParseAsync(r);if(n.success)return n.data;throw new np(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(n.error.errors)}`,JSON.stringify(r,null,2))}async parseResult(t){let r=t.flatMap(i=>{let{message:a}=i;return Array.isArray(a.content)?QCe(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 QCe(e){let t=[];for(let r of e)r.type==="tool_use"&&t.push({name:r.name,args:r.input,id:r.id,type:"tool_call"});return t}function z0t(e){if(e)return e==="any"?{type:"any"}:e==="auto"?{type:"auto"}:typeof e=="string"?{type:"tool",name:e}:e}function H0t(e){let t,r=Array.isArray(e.content)?e.content.find(o=>o.type==="tool_use"):void 0;r&&"index"in r&&"name"in r&&"id"in r&&(t={args:"",id:r.id,name:r.name,index:r.index,type:"tool_call_chunk"});let n=Array.isArray(e.content)?e.content.find(o=>o.type==="input_json_delta"):void 0;return n&&"index"in n&&"input"in n&&(typeof n.input=="string"?t={id:n.id,name:n.name,args:n.input,index:n.index,type:"tool_call_chunk"}:t={id:n.id,name:n.name,args:JSON.stringify(n.input,null,2),index:n.index,type:"tool_call_chunk"}),t}function V0t(e){let t=/^data:(image\/.+);base64,(.+)$/,r=e.match(t);if(r===null)throw new Error(["Anthropic only supports base64-encoded images currently.","Example: data:image/png;base64,/9j/4AAQSk..."].join(`
`));return{type:"base64",media_type:r[1]??"",data:r[2]??""}}function W$r(e){let t=[];for(let r of e)if(r._getType()==="tool")if(typeof r.content=="string"){let n=t[t.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}):t.push(new Ua({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else t.push(new Ua({content:r.content}));else{let n=t[t.length-1];if(n?._getType()==="human"&&r._getType()==="human"){let o;typeof n.content=="string"?o=[{type:"text",text:n.content}]:o=n.content,typeof r.content=="string"?o.push({type:"text",text:r.content}):o=o.concat(r.content),n.content=o}else t.push(r)}return t}function W0t(e){if(e.id===void 0)throw new Error('Anthropic requires all tool calls to have an "id".');return{type:"tool_use",id:e.id,name:e.name,input:e.args}}function J0t(e){let t=["tool_use","tool_result","input_json_delta"],r=["text","text_delta"];return typeof e=="string"?e:e.map(o=>{let i="cache_control"in o?o.cache_control:void 0;if(o.type==="image_url"){let a;return typeof o.image_url=="string"?a=V0t(o.image_url):a=V0t(o.image_url.url),{type:"image",source:a,...i?{cache_control:i}:{}}}else{if(r.find(a=>a===o.type)&&"text"in o)return{type:"text",text:o.text,...i?{cache_control:i}:{}};if(t.find(a=>a===o.type)){let a={...o};if("index"in a&&delete a.index,a.type==="input_json_delta"&&(a.type="tool_use"),"input"in a)try{a.input=JSON.parse(a.input)}catch{}return{...a,...i?{cache_control:i}:{}}}else throw new Error("Unsupported message content format")}})}function hee(e){let t=W$r(e),r;return t.length>0&&t[0]._getType()==="system"&&(r=e[0].content),{messages:(r!==void 0?t.slice(1):t).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(Bu(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(W0t)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(W0t)]};{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:J0t(i.content)}}}else return{role:a,content:J0t(i.content)}}),system:r}}function G0t(e,t){if(e.type==="message_start"){let{content:r,usage:n,...o}=e.message,i={};for(let[s,u]of Object.entries(o))u!=null&&(i[s]=u);let a={input_tokens:n.input_tokens,output_tokens:n.output_tokens,total_tokens:n.input_tokens+n.output_tokens};return{chunk:new Gr({content:t.coerceContentToString?"":[],additional_kwargs:i,usage_metadata:t.streamUsage?a:void 0,id:e.message.id})}}else if(e.type==="message_delta"){let r={input_tokens:0,output_tokens:e.usage.output_tokens,total_tokens:e.usage.output_tokens};return{chunk:new Gr({content:t.coerceContentToString?"":[],additional_kwargs:{...e.delta},usage_metadata:t.streamUsage?r:void 0})}}else{if(e.type==="content_block_start"&&e.content_block.type==="tool_use")return{chunk:new Gr({content:t.coerceContentToString?"":[{index:e.index,...e.content_block,input:""}],additional_kwargs:{}})};if(e.type==="content_block_delta"&&e.delta.type==="text_delta"){let r=e.delta?.text;if(r!==void 0)return{chunk:new Gr({content:t.coerceContentToString?r:[{index:e.index,...e.delta}],additional_kwargs:{}})}}else{if(e.type==="content_block_delta"&&e.delta.type==="input_json_delta")return{chunk:new Gr({content:t.coerceContentToString?"":[{index:e.index,input:e.delta.partial_json,type:e.delta.type}],additional_kwargs:{}})};if(e.type==="content_block_start"&&e.content_block.type==="text"){let r=e.content_block?.text;if(r!==void 0)return{chunk:new Gr({content:t.coerceContentToString?r:[{index:e.index,...e.content_block}],additional_kwargs:{}})}}}}return null}function K0t(e,t){let r=t.usage,n=r!=null?{input_tokens:r.input_tokens??0,output_tokens:r.output_tokens??0,total_tokens:(r.input_tokens??0)+(r.output_tokens??0)}:void 0;if(e.length===1&&e[0].type==="text")return[{text:e[0].text,message:new Po({content:e[0].text,additional_kwargs:t,usage_metadata:n,response_metadata:t,id:t.id})}];{let o=QCe(e);return[{text:"",message:new Po({content:e,additional_kwargs:t,tool_calls:o,usage_metadata:n,response_metadata:t,id:t.id})}]}}function J$r(e){return!!(e.tools&&e.tools.length>0)}function G$r(e){return"input_schema"in e}function K$r(e){if(typeof e.content=="string")return e.content;if(Array.isArray(e.content)&&e.content.length>=1&&"input"in e.content[0])return typeof e.content[0].input=="string"?e.content[0].input:JSON.stringify(e.content[0].input);if(Array.isArray(e.content)&&e.content.length>=1&&"text"in e.content[0])return e.content[0].text}var eOe=class extends Qc{static lc_name(){return"ChatAnthropic"}get lc_secrets(){return{anthropicApiKey:"ANTHROPIC_API_KEY",apiKey:"ANTHROPIC_API_KEY"}}get lc_aliases(){return{modelName:"model"}}constructor(t){if(super(t??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"anthropicApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"topK",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:2048}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"claude-2.1"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"claude-2.1"}),Object.defineProperty(this,"invocationKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clientOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streamingClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"createClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.anthropicApiKey=t?.apiKey??t?.anthropicApiKey??At("ANTHROPIC_API_KEY"),!this.anthropicApiKey&&!t?.createClient)throw new Error("Anthropic API key not found");this.clientOptions=t?.clientOptions??{},this.apiKey=this.anthropicApiKey,this.apiUrl=t?.anthropicApiUrl,this.modelName=t?.model??t?.modelName??this.model,this.model=this.modelName,this.invocationKwargs=t?.invocationKwargs??{},this.temperature=t?.temperature??this.temperature,this.topK=t?.topK??this.topK,this.topP=t?.topP??this.topP,this.maxTokens=t?.maxTokensToSample??t?.maxTokens??this.maxTokens,this.stopSequences=t?.stopSequences??this.stopSequences,this.streaming=t?.streaming??!1,this.streamUsage=t?.streamUsage??this.streamUsage,this.createClient=t?.createClient??(r=>new ti(r))}getLsParams(t){let r=this.invocationParams(t);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:t.stop}}formatStructuredToolToAnthropic(t){if(!(!t||!t.length))return t.map(r=>{if(G$r(r))return r;if(vw(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(yg(r))return{name:r.name,description:r.description,input_schema:Li(r.schema)};throw new Error(`Unknown tool type passed to ChatAnthropic: ${JSON.stringify(r,null,2)}`)})}bindTools(t,r){return this.bind({tools:this.formatStructuredToolToAnthropic(t),...r})}invocationParams(t){let r=z0t(t?.tool_choice);return{model:this.model,temperature:this.temperature,top_k:this.topK,top_p:this.topP,stop_sequences:t?.stop??this.stopSequences,stream:this.streaming,max_tokens:this.maxTokens,tools:this.formatStructuredToolToAnthropic(t?.tools),tool_choice:r,...this.invocationKwargs}}_identifyingParams(){return{model_name:this.model,...this.invocationParams()}}identifyingParams(){return{model_name:this.model,...this.invocationParams()}}async*_streamResponseChunks(t,r,n){let o=this.invocationParams(r),i=hee(t),a=!J$r({...o,...i,stream:!1}),s=await this.createStreamWithRetry({...o,...i,stream:!0},{headers:r.headers});for await(let u of s){if(r.signal?.aborted)throw s.controller.abort(),new Error("AbortError: User aborted the request.");let l=this.streamUsage??r.streamUsage,c=G0t(u,{streamUsage:l,coerceContentToString:a});if(!c)continue;let{chunk:d}=c,f=H0t(d),p=K$r(d);yield new ii({message:new Gr({content:d.content,additional_kwargs:d.additional_kwargs,tool_call_chunks:f?[f]:void 0,usage_metadata:l?d.usage_metadata:void 0,response_metadata:d.response_metadata,id:d.id}),text:p??""}),p&&await n?.handleLLMNewToken(p)}}async _generateNonStreaming(t,r,n){let o=await this.completionWithRetry({...r,stream:!1,...hee(t)},n),{content:i,...a}=o,s=K0t(i,a),{role:u,type:l,...c}=a;return{generations:s,llmOutput:c}}async _generate(t,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(t,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(t,o,{signal:r.signal,headers:r.headers})}async createStreamWithRetry(t,r){if(!this.streamingClient){let o=this.apiUrl?{baseURL:this.apiUrl}:void 0;this.streamingClient=this.createClient({dangerouslyAllowBrowser:!0,...this.clientOptions,...o,apiKey:this.apiKey,maxRetries:0})}let n=async()=>this.streamingClient.messages.create({...t,...this.invocationKwargs,stream:!0},r);return this.caller.call(n)}async completionWithRetry(t,r){if(!this.batchClient){let o=this.apiUrl?{baseURL:this.apiUrl}:void 0;this.batchClient=this.createClient({dangerouslyAllowBrowser:!0,...this.clientOptions,...o,apiKey:this.apiKey,maxRetries:0})}let n=async()=>this.batchClient.messages.create({...t,...this.invocationKwargs},r);return this.caller.callWithOptions({signal:r.signal??void 0},n)}_llmType(){return"anthropic"}withStructuredOutput(t,r){let n=t,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(Rf(n)){let h=Li(n);l=[{name:s,description:h.description??"A function available to call.",input_schema:h}],u=new n3({returnSingle:!0,keyName:s,zodSchema:n})}else{let h;typeof n.name=="string"&&typeof n.description=="string"&&typeof n.input_schema=="object"&&n.input_schema!=null?(h=n,s=n.name):h={name:s,description:n.description??"",input_schema:n},l=[h],u=new n3({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:{type:"tool",name:s}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=Fi.assign({parsed:(h,m)=>u.invoke(h.raw,m)}),f=Fi.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return Ha.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},mee=class extends eOe{};var gee=class extends $h{static lc_name(){return"ChatDeepSeek"}_llmType(){return"deepseek"}get lc_secrets(){return{apiKey:"DEEPSEEK_API_KEY"}}constructor(t){let r=t?.apiKey||At("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({...t,apiKey:r,configuration:{baseURL:"https://api.deepseek.com",...t?.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(t,r,n){let o=super._convertOpenAIDeltaToBaseMessageChunk(t,r,n);return o.additional_kwargs.reasoning_content=t.reasoning_content,o}_convertOpenAIChatCompletionMessageToBaseMessage(t,r){let n=super._convertOpenAIChatCompletionMessageToBaseMessage(t,r);return n.additional_kwargs.reasoning_content=t.reasoning_content,n}withStructuredOutput(t,r){let n={...r};return n?.method===void 0&&(n.method="functionCalling"),super.withStructuredOutput(t,n)}};oh();kh();var $R="0.5.0";var Y0t=!1,qR,tOe,Y$r,Z$r,X$r,rOe,Q$r,yee,nOe,oOe,iOe,bee,aOe;function Z0t(e,t={auto:!1}){if(Y0t)throw new Error(`you must \`import 'groq-sdk/shims/${e.kind}'\` before importing anything else from groq-sdk`);if(qR)throw new Error(`can't \`import 'groq-sdk/shims/${e.kind}'\` after \`import 'groq-sdk/shims/${qR}'\``);Y0t=t.auto,qR=e.kind,tOe=e.fetch,Y$r=e.Request,Z$r=e.Response,X$r=e.Headers,rOe=e.FormData,Q$r=e.Blob,yee=e.File,nOe=e.ReadableStream,oOe=e.getMultipartRequestOptions,iOe=e.getDefaultAgent,bee=e.fileFromPath,aOe=e.isFsReadStream}var _ee=class{constructor(t){this.body=t}get[Symbol.toStringTag](){return"MultipartBody"}};function X0t({manuallyImported:e}={}){let t=e?"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}. ${t}`)}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. ${t}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${t}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${t}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${t}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new _ee(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}}qR||Z0t(X0t(),{auto:!0});var sOe={};Yd(sOe,{APIConnectionError:()=>Zx,APIConnectionTimeoutError:()=>UR,APIError:()=>Qu,APIUserAbortError:()=>$P,AuthenticationError:()=>vk,BadRequestError:()=>_k,ConflictError:()=>xk,GroqError:()=>Sl,InternalServerError:()=>Ek,NotFoundError:()=>Sk,PermissionDeniedError:()=>wk,RateLimitError:()=>Ok,UnprocessableEntityError:()=>Ck});var Sl=class extends Error{},Qu=class e extends Sl{constructor(t,r,n,o){super(`${e.makeMessage(t,r,n)}`),this.status=t,this.headers=o,this.error=r}static makeMessage(t,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return t&&o?`${t} ${o}`:t?`${t} status code (no body)`:o||"(no status code or body)"}static generate(t,r,n,o){if(!t)return new Zx({cause:vee(r)});let i=r;return t===400?new _k(t,i,n,o):t===401?new vk(t,i,n,o):t===403?new wk(t,i,n,o):t===404?new Sk(t,i,n,o):t===409?new xk(t,i,n,o):t===422?new Ck(t,i,n,o):t===429?new Ok(t,i,n,o):t>=500?new Ek(t,i,n,o):new e(t,i,n,o)}},$P=class extends Qu{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0),this.status=void 0}},Zx=class extends Qu{constructor({message:t,cause:r}){super(void 0,void 0,t||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},UR=class extends Zx{constructor({message:t}={}){super({message:t??"Request timed out."})}},_k=class extends Qu{constructor(){super(...arguments),this.status=400}},vk=class extends Qu{constructor(){super(...arguments),this.status=401}},wk=class extends Qu{constructor(){super(...arguments),this.status=403}},Sk=class extends Qu{constructor(){super(...arguments),this.status=404}},xk=class extends Qu{constructor(){super(...arguments),this.status=409}},Ck=class extends Qu{constructor(){super(...arguments),this.status=422}},Ok=class extends Qu{constructor(){super(...arguments),this.status=429}},Ek=class extends Qu{};var wee=class e{constructor(t,r){this.iterator=t,this.controller=r}static fromSSEResponse(t,r){let n=!1,o=new uOe;async function*i(){if(!t.body)throw r.abort(),new Sl("Attempted to iterate over a response with no body");let s=new Pk,u=Q0t(t.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 Qu(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 e(a,r)}static fromReadableStream(t,r){let n=!1;async function*o(){let a=new Pk,s=Q0t(t);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 e(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let t=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();t.push(a),r.push(a)}return i.shift()}});return[new e(()=>o(t),this.controller),new e(()=>o(r),this.controller)]}toReadableStream(){let t=this,r,n=new TextEncoder;return new nOe({async start(){r=t[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?.()}})}},uOe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;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(t),t.startsWith(":"))return null;let[r,n,o]=tqr(t,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},Pk=class e{constructor(){this.buffer=[],this.trailingCR=!1}decode(t){let r=this.decodeText(t);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=e.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(e.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(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof Buffer<"u"){if(t instanceof Buffer)return t.toString();if(t instanceof Uint8Array)return Buffer.from(t).toString();throw new Sl(`Unexpected: received non-Uint8Array (${t.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(t instanceof Uint8Array||t instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(t);throw new Sl(`Unexpected: received non-Uint8Array/ArrayBuffer (${t.constructor.name}) in a web platform. Please report this error.`)}throw new Sl("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let t=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,t}};Pk.NEWLINE_CHARS=new Set([`
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);Pk.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;function tqr(e,t){let r=e.indexOf(t);return r!==-1?[e.substring(0,r),t,e.substring(r+t.length)]:[e,"",""]}function Q0t(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let r=await t.read();return r?.done&&t.releaseLock(),r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var ewt=e=>e!=null&&typeof e=="object"&&typeof e.url=="string"&&typeof e.blob=="function",twt=e=>e!=null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.lastModified=="number"&&See(e),See=e=>e!=null&&typeof e=="object"&&typeof e.size=="number"&&typeof e.type=="string"&&typeof e.text=="function"&&typeof e.slice=="function"&&typeof e.arrayBuffer=="function",rqr=e=>twt(e)||ewt(e)||aOe(e);async function dOe(e,t,r){if(e=await e,r??(r=twt(e)?{lastModified:e.lastModified,type:e.type}:{}),ewt(e)){let o=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new yee([o],t,r)}let n=await nqr(e);if(t||(t=iqr(e)??"unknown_file"),!r.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new yee(n,t,r)}async function nqr(e){let t=[];if(typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(See(e))t.push(await e.arrayBuffer());else if(aqr(e))for await(let r of e)t.push(r);else throw new Error(`Unexpected data type: ${typeof e}; constructor: ${e?.constructor?.name}; props: ${oqr(e)}`);return t}function oqr(e){return`[${Object.getOwnPropertyNames(e).map(r=>`"${r}"`).join(", ")}]`}function iqr(e){return lOe(e.name)||lOe(e.filename)||lOe(e.path)?.split(/[\\/]/).pop()}var lOe=e=>{if(typeof e=="string")return e;if(typeof Buffer<"u"&&e instanceof Buffer)return String(e)},aqr=e=>e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function",fOe=e=>e&&typeof e=="object"&&e.body&&e[Symbol.toStringTag]==="MultipartBody";var o3=async e=>{let t=await rwt(e.body);return oOe(t,e)},rwt=async e=>{let t=new rOe;return await Promise.all(Object.entries(e||{}).map(([r,n])=>cOe(t,r,n))),t};var cOe=async(e,t,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")e.append(t,String(r));else if(rqr(r)){let n=await dOe(r);e.append(t,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>cOe(e,t+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>cOe(e,`${t}[${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 uqr=function(e,t,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},lqr=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},xee;async function uwt(e){let{response:t}=e;if(e.options.stream)return Tk("response",t.status,t.url,t.headers,t.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(t,e.controller):wee.fromSSEResponse(t,e.controller);if(t.status===204)return null;if(e.options.__binaryResponse)return t;let r=t.headers.get("content-type");if(r?.includes("application/json")||r?.includes("application/vnd.api+json")){let i=await t.json();return Tk("response",t.status,t.url,t.headers,i),i}let o=await t.text();return Tk("response",t.status,t.url,t.headers,o),o}var Cee=class e extends Promise{constructor(t,r=uwt){super(n=>{n(null)}),this.responsePromise=t,this.parseResponse=r}_thenUnwrap(t){return new e(this.responsePromise,async r=>t(await this.parseResponse(r)))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){let[t,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(t,r){return this.parse().then(t,r)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}},Oee=class{constructor({baseURL:t,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=t,this.maxRetries=pOe("maxRetries",r),this.timeout=pOe("timeout",n),this.httpAgent=o,this.fetch=i??tOe}authHeaders(t){return{}}defaultHeaders(t){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...pqr(),...this.authHeaders(t)}}validateHeaders(t,r){}defaultIdempotencyKey(){return`stainless-node-retry-${vqr()}`}get(t,r){return this.methodRequest("get",t,r)}post(t,r){return this.methodRequest("post",t,r)}patch(t,r){return this.methodRequest("patch",t,r)}put(t,r){return this.methodRequest("put",t,r)}delete(t,r){return this.methodRequest("delete",t,r)}methodRequest(t,r,n){return this.request(Promise.resolve(n).then(async o=>{let i=o&&See(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:t,path:r,...o,body:i}}))}getAPIList(t,r,n){return this.requestAPIList(r,{method:"get",path:t,...n})}calculateContentLength(t){if(typeof t=="string"){if(typeof Buffer<"u")return Buffer.byteLength(t,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(t).length.toString()}else if(ArrayBuffer.isView(t))return t.byteLength.toString();return null}buildRequest(t){let{method:r,path:n,query:o,headers:i={}}=t,a=ArrayBuffer.isView(t.body)||t.__binaryRequest&&typeof t.body=="string"?t.body:fOe(t.body)?t.body.body:t.body?JSON.stringify(t.body,null,2):null,s=this.calculateContentLength(a),u=this.buildURL(n,o);"timeout"in t&&pOe("timeout",t.timeout);let l=t.timeout??this.timeout,c=t.httpAgent??this.httpAgent??iOe(u),d=l+1e3;typeof c?.options?.timeout=="number"&&d>(c.options.timeout??0)&&(c.options.timeout=d),this.idempotencyHeader&&r!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=t.idempotencyKey);let f=this.buildHeaders({options:t,headers:i,contentLength:s});return{req:{method:r,...a&&{body:a},headers:f,...c&&{agent:c},signal:t.signal??null},url:u,timeout:l}}buildHeaders({options:t,headers:r,contentLength:n}){let o={};n&&(o["content-length"]=n);let i=this.defaultHeaders(t);return swt(o,i),swt(o,r),fOe(t.body)&&qR!=="node"&&delete o["content-type"],this.validateHeaders(o,r),o}async prepareOptions(t){}async prepareRequest(t,{url:r,options:n}){}parseHeaders(t){return t?Symbol.iterator in t?Object.fromEntries(Array.from(t).map(r=>[...r])):{...t}:{}}makeStatusError(t,r,n,o){return Qu.generate(t,r,n,o)}request(t,r=null){return new Cee(this.makeRequest(t,r))}async makeRequest(t,r){let n=await t;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}),Tk("request",i,n,o.headers),n.signal?.aborted)throw new $P;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(vee);if(u instanceof Error){if(n.signal?.aborted)throw new $P;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new UR:new Zx({cause:u})}let l=cqr(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let m=`retrying, ${r} attempts remaining`;return Tk(`response (error; ${m})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(m=>vee(m).message),d=hqr(c),f=d?void 0:c;throw Tk(`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(t,r){let n=this.makeRequest(r,null);return new hOe(this,n,t)}buildURL(t,r){let n=gqr(t)?new URL(t):new URL(this.baseURL+(this.baseURL.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),o=this.defaultQuery();return bqr(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(n.search=this.stringifyQuery(r)),n.toString()}stringifyQuery(t){return Object.entries(t).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 Sl(`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(t,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,t,{signal:o.signal,...a}).finally(()=>{clearTimeout(s)})}getRequestClient(){return{fetch:this.fetch}}shouldRetry(t){let r=t.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,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=t.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await yqr(o),this.makeRequest(t,r-1)}calculateDefaultRetryTimeoutMillis(t,r){let i=r-t,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}getUserAgent(){return`${this.constructor.name}/JS ${$R}`}},nwt=class{constructor(t,r,n,o){xee.set(this,void 0),uqr(this,xee,t,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let t=this.nextPageInfo();if(!t)throw new Sl("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let r={...this.options};if("params"in t&&typeof r.query=="object")r.query={...r.query,...t.params};else if("url"in t){let n=[...Object.entries(r.query||{}),...t.url.searchParams.entries()];for(let[o,i]of n)t.url.searchParams.set(o,i);r.query=void 0,r.path=t.url.toString()}return await lqr(this,xee,"f").requestAPIList(this.constructor,r)}async*iterPages(){let t=this;for(yield t;t.hasNextPage();)t=await t.getNextPage(),yield t}async*[(xee=new WeakMap,Symbol.asyncIterator)](){for await(let t of this.iterPages())for(let r of t.getPaginatedItems())yield r}},hOe=class extends Cee{constructor(t,r,n){super(r,async o=>new n(t,o.response,await uwt(o),o.options))}async*[Symbol.asyncIterator](){let t=await this;for await(let r of t)yield r}},cqr=e=>new Proxy(Object.fromEntries(e.entries()),{get(t,r){let n=r.toString();return t[n.toLowerCase()]||t[n]}});var dqr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$R,"X-Stainless-OS":iwt(Deno.build.os),"X-Stainless-Arch":owt(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":$R,"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":$R,"X-Stainless-OS":iwt(process.platform),"X-Stainless-Arch":owt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let e=fqr();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$R,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$R,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function fqr(){if(typeof navigator>"u"||!navigator)return null;let e=[{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:t,pattern:r}of e){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:t,version:`${o}.${i}.${a}`}}}return null}var owt=e=>e==="x32"?"x32":e==="x86_64"||e==="x64"?"x64":e==="arm"?"arm":e==="aarch64"||e==="arm64"?"arm64":e?`other:${e}`:"unknown",iwt=e=>(e=e.toLowerCase(),e.includes("ios")?"iOS":e==="android"?"Android":e==="darwin"?"MacOS":e==="win32"?"Windows":e==="freebsd"?"FreeBSD":e==="openbsd"?"OpenBSD":e==="linux"?"Linux":e?`Other:${e}`:"Unknown"),awt,pqr=()=>awt??(awt=dqr()),hqr=e=>{try{return JSON.parse(e)}catch{return}},mqr=new RegExp("^(?:[a-z]+:)?//","i"),gqr=e=>mqr.test(e),yqr=e=>new Promise(t=>setTimeout(t,e)),pOe=(e,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new Sl(`${e} must be an integer`);if(t<0)throw new Sl(`${e} must be a positive integer`);return t},vee=e=>e instanceof Error?e:new Error(e);var mOe=e=>{if(typeof process<"u")return process.env?.[e]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(e)?.trim()};function bqr(e){if(!e)return!0;for(let t in e)return!1;return!0}function _qr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function swt(e,t){for(let r in t){if(!_qr(t,r))continue;let n=r.toLowerCase();if(!n)continue;let o=t[r];o===null?delete e[n]:o!==void 0&&(e[n]=o)}}function Tk(e,...t){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${e}`,...t)}var vqr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),lwt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";var xl=class{constructor(t){this._client=t}};var zR=class extends xl{create(t,r){return this._client.post("/openai/v1/audio/transcriptions",o3({body:t,...r}))}};zR||(zR={});var HR=class extends xl{create(t,r){return this._client.post("/openai/v1/audio/translations",o3({body:t,...r}))}};HR||(HR={});var qP=class extends xl{constructor(){super(...arguments),this.transcriptions=new zR(this._client),this.translations=new HR(this._client)}};(function(e){e.Transcriptions=zR,e.Translations=HR})(qP||(qP={}));var VR=class extends xl{create(t,r){return this._client.post("/openai/v1/chat/completions",{body:t,...r,stream:t.stream??!1})}};VR||(VR={});var UP=class extends xl{constructor(){super(...arguments),this.completions=new VR(this._client)}};(function(e){e.Completions=VR})(UP||(UP={}));var zP=class extends xl{};zP||(zP={});var HP=class extends xl{create(t,r){return this._client.post("/openai/v1/embeddings",{body:t,...r})}};HP||(HP={});var VP=class extends xl{retrieve(t,r){return this._client.get(`/openai/v1/models/${t}`,r)}list(t){return this._client.get("/openai/v1/models",t)}delete(t,r){return this._client.delete(`/openai/v1/models/${t}`,r)}};VP||(VP={});var cwt,ja=class extends Oee{constructor({baseURL:t=mOe("GROQ_BASE_URL"),apiKey:r=mOe("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new Sl("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:t||"https://api.groq.com"};if(!o.dangerouslyAllowBrowser&&lwt())throw new Sl(`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 zP(this),this.chat=new UP(this),this.embeddings=new HP(this),this.audio=new qP(this),this.models=new VP(this),this._options=o,this.apiKey=r}defaultQuery(){return this._options.defaultQuery}defaultHeaders(t){return{...super.defaultHeaders(t),...this._options.defaultHeaders}}authHeaders(t){return{Authorization:`Bearer ${this.apiKey}`}}};cwt=ja;ja.Groq=cwt;ja.GroqError=Sl;ja.APIError=Qu;ja.APIConnectionError=Zx;ja.APIConnectionTimeoutError=UR;ja.APIUserAbortError=$P;ja.NotFoundError=Sk;ja.ConflictError=xk;ja.RateLimitError=Ok;ja.BadRequestError=_k;ja.AuthenticationError=vk;ja.InternalServerError=Ek;ja.PermissionDeniedError=wk;ja.UnprocessableEntityError=Ck;ja.toFile=dOe;ja.fileFromPath=bee;var{GroqError:JEo,APIError:GEo,APIConnectionError:KEo,APIConnectionTimeoutError:YEo,APIUserAbortError:ZEo,NotFoundError:XEo,ConflictError:QEo,RateLimitError:ePo,BadRequestError:tPo,AuthenticationError:rPo,InternalServerError:nPo,PermissionDeniedError:oPo,UnprocessableEntityError:iPo}=sOe;(function(e){e.Completions=zP,e.Chat=UP,e.Embeddings=HP,e.Audio=qP,e.Models=VP})(ja||(ja={}));var dwt=ja;jS();OO();function Eqr(e){let t=e._getType();switch(t){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: ${t}`)}}function fwt(e){return e.map(t=>{if(typeof t.content!="string")throw new Error("Non string message content not supported");let r={role:Eqr(t),content:t.content,name:t.name,function_call:t.additional_kwargs.function_call,tool_calls:t.additional_kwargs.tool_calls,tool_call_id:t.tool_call_id};return Bu(t)&&t.tool_calls?.length?r.tool_calls=t.tool_calls.map(WF):(t.additional_kwargs.tool_calls!=null&&(r.tool_calls=t.additional_kwargs.tool_calls),t.tool_call_id!=null&&(r.tool_call_id=t.tool_call_id)),r})}function Pqr(e,t){let r=e.tool_calls;switch(e.role){case"assistant":{let n=[],o=[];for(let i of r??[])try{n.push(PR(i,{returnId:!0}))}catch(a){o.push(JF(i,a.message))}return new Po({content:e.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:t})}default:return new xd(e.content||"",e.role??"unknown")}}function Tqr(e,t){if(e?.length)return e.map(r=>({id:r.id,name:r.function?.name,args:r.function?.arguments,type:"tool_call_chunk",index:t}))}function Mqr(e,t,r){let{role:n}=e,o=e.content??"",i;e.function_call?i={function_call:e.function_call}:e.tool_calls?i={tool_calls:e.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 Nm({content:o})};if(n==="assistant"){let u=Tqr(e.tool_calls,t);return{message:new Gr({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??t,type:"tool_call_chunk"})):void 0}}else return n==="system"?{message:new ay({content:o})}:{message:new jm({content:o,role:n})}}var Eee=class extends Qc{static lc_name(){return"ChatGroq"}_llmType(){return"groq"}get lc_secrets(){return{apiKey:"GROQ_API_KEY"}}constructor(t){super(t??{}),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=t?.apiKey||At("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 dwt({apiKey:r,dangerouslyAllowBrowser:!0}),this.apiKey=r,this.temperature=t?.temperature??this.temperature,this.modelName=t?.model??t?.modelName??this.model,this.model=this.modelName,this.streaming=t?.streaming??this.streaming,this.stop=t?.stopSequences??(typeof t?.stop=="string"?[t.stop]:t?.stop)??[],this.stopSequences=this.stop,this.maxTokens=t?.maxTokens}getLsParams(t){let r=this.invocationParams(t);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:t.stop}}async completionWithRetry(t,r){return this.caller.call(async()=>this.client.chat.completions.create(t,r))}invocationParams(t){let r=super.invocationParams(t);return t.tool_choice!==void 0&&(r.tool_choice=t.tool_choice),t.tools!==void 0&&(r.tools=t.tools),t.response_format!==void 0&&(r.response_format=t.response_format),{...r,stop:t.stop??this.stopSequences,model:this.model,temperature:this.temperature,max_tokens:this.maxTokens}}bindTools(t,r){return this.bind({tools:t.map(n=>sF(n)),...r})}async*_streamResponseChunks(t,r,n){let o=this.invocationParams(r),i=fwt(t),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}=Mqr({...d.delta,role:s},d.index,c.x_groq);if(p){let m=p.filter(_=>u.every(g=>g.id!==_.id));u.push(...m),yield new ii({message:new Gr({content:"",tool_call_chunks:m}),text:""})}let h=new ii({message:f,text:d.delta.content??"",generationInfo:{finishReason:d.finish_reason}});yield h,n?.handleLLMNewToken(h.text??"")}if(l&&("choices"in l&&delete l.choices,yield new ii({message:new Gr({content:"",response_metadata:l}),text:""})),r.signal?.aborted)throw new Error("AbortError")}async _generate(t,r,n){if(this.streaming){let o={},i=this._streamResponseChunks(t,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(t,r,n)}async _generateNonStreaming(t,r,n){let o={},i=this.invocationParams(r),a=fwt(t),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:Pqr(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(t,r){let n=t,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"}}),Rf(n)?u=AS.fromZodSchema(n):u=new RS;else if(Rf(n)){let p=Li(n);l=this.bind({tools:[{type:"function",function:{name:s,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:s}}}),u=new Sg({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 Sg({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=Fi.assign({parsed:(p,h)=>u.invoke(p.raw,h)}),d=Fi.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return Ha.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}};var sc=[];for(Pee=0;Pee<256;++Pee)sc.push((Pee+256).toString(16).slice(1));var Pee;function pwt(e,t=0){return(sc[e[t+0]]+sc[e[t+1]]+sc[e[t+2]]+sc[e[t+3]]+"-"+sc[e[t+4]]+sc[e[t+5]]+"-"+sc[e[t+6]]+sc[e[t+7]]+"-"+sc[e[t+8]]+sc[e[t+9]]+"-"+sc[e[t+10]]+sc[e[t+11]]+sc[e[t+12]]+sc[e[t+13]]+sc[e[t+14]]+sc[e[t+15]]).toLowerCase()}var Tee,Iqr=new Uint8Array(16);function gOe(){if(!Tee&&(Tee=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Tee))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Tee(Iqr)}var Aqr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),yOe={randomUUID:Aqr};function Rqr(e,t,r){if(yOe.randomUUID&&!t&&!e)return yOe.randomUUID();e=e||{};var n=e.random||(e.rng||gOe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=n[o];return t}return pwt(n)}var Mee=Rqr;var SAt=B(bAt(),1),xAt=B(m3(),1);kh();HD();OO();jS();oh();var Rrn=/^[a-zA-Z0-9]{9}$/;function Drn(e){return Rrn.test(e)}function jrn(e){let t=e,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";if(t===0)return r[0];let n=[],o=r.length;for(;t;)n.push(r[t%o]),t=Math.floor(t/o);return n.reverse().join("")}function Nrn(e){let t=0;for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);t=(t<<5)-t+n,t&=t}return Math.abs(t)}function rTe(e){if(Drn(e))return e;{let t=Nrn(e),r=jrn(t);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function nTe(e){return e?typeof e=="string"?e:e.map(t=>{if(t.type==="image_url"){if(typeof t.imageUrl!="string"&&t.imageUrl?.detail){let{detail:r}=t.imageUrl;if(r!=="high"&&r!=="auto"&&r!=="low")return{type:t.type,image_url:{url:t.imageUrl.url}}}return{type:t.type,image_url:t.imageUrl}}return t}):""}function _At(e){let t=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=t(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(Bu(o)&&o.tool_calls?.length)return o.tool_calls.map(i=>({...i,id:rTe(i.id??"")})).map(WF)};return e.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:t(o.getType()),content:a,name:o.name,toolCallId:rTe(o.tool_call_id)}:Bu(o)?i===void 0?{role:t(o.getType()),content:a}:{role:t(o.getType()),toolCalls:i}:{role:t(o.getType()),content:a}})}function Lrn(e,t){let{message:r}=e;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=nTe(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=PR(s,{returnId:!0});i.push({...u,id:u.id??Mee().replace(/-/g,"")})}catch(u){a.push(JF(s,u.message))}return new Po({content:o,tool_calls:i,invalid_tool_calls:a,additional_kwargs:{},usage_metadata:t?{input_tokens:t.promptTokens,output_tokens:t.completionTokens,total_tokens:t.totalTokens}:void 0})}default:return new Ua({content:o})}}function Frn(e,t){if(!e.content&&!e.toolCalls)return t?new Gr({content:"",usage_metadata:t?{input_tokens:t.promptTokens,output_tokens:t.completionTokens,total_tokens:t.totalTokens}:void 0}):null;let r=e.toolCalls?.length?e.toolCalls?.map((s,u)=>({...s,index:u,id:s.id??Mee().replace(/-/g,""),type:"function"})):void 0,n="assistant";e.role&&(n=e.role);let o=nTe(e.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 Nm({content:o}):n==="assistant"?new Gr({content:o,tool_call_chunks:a,additional_kwargs:i,usage_metadata:t?{input_tokens:t.promptTokens,output_tokens:t.completionTokens,total_tokens:t.totalTokens}:void 0}):n==="tool"?new bO({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new OS({content:o,additional_kwargs:i}):new jm({content:o,role:n})}function vAt(e){return e.map(t=>{if("function"in t)return t;let r=t.description??`Tool: ${t.name}`;return{type:"function",function:{name:t.name,description:r,parameters:Li(t.schema)}}})}var Nne=class extends Qc{static lc_name(){return"ChatMistralAI"}constructor(t){super(t??{}),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=t?.apiKey??At("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=t?.streaming??this.streaming,this.serverURL=t?.serverURL??this.serverURL,this.temperature=t?.temperature??this.temperature,this.topP=t?.topP??this.topP,this.maxTokens=t?.maxTokens??this.maxTokens,this.safePrompt=t?.safePrompt??this.safePrompt,this.randomSeed=t?.seed??t?.randomSeed??this.seed,this.seed=this.randomSeed,this.maxRetries=t?.maxRetries,this.httpClient=t?.httpClient,this.model=t?.model??t?.modelName??this.model,this.streamUsage=t?.streamUsage??this.streamUsage,this.beforeRequestHooks=t?.beforeRequestHooks??this.beforeRequestHooks,this.requestErrorHooks=t?.requestErrorHooks??this.requestErrorHooks,this.responseHooks=t?.responseHooks??this.responseHooks,this.presencePenalty=t?.presencePenalty??this.presencePenalty,this.frequencyPenalty=t?.frequencyPenalty??this.frequencyPenalty,this.numCompletions=t?.numCompletions??this.numCompletions,this.addAllHooksToHttpClient()}get lc_secrets(){return{apiKey:"MISTRAL_API_KEY"}}get lc_aliases(){return{apiKey:"mistral_api_key"}}getLsParams(t){let r=this.invocationParams(t);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(t){let{response_format:r,tools:n,tool_choice:o}=t??{},i=n?.length?vAt(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(t,r){return this.bind({tools:vAt(t),...r})}async completionWithRetry(t,r){let n=new rp({maxRetries:this.maxRetries}),o=new SAt.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(t):i=await o.chat.complete(t),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(t,r,n){let o={},i=this.invocationParams(r),a=_At(t),s={...i,messages:a},u=r.signal??!!r.timeout;if(this.streaming||u){let h=this._streamResponseChunks(t,r,n),m={};for await(let g of h){let v=g.generationInfo?.completion??0;m[v]===void 0?m[v]=g:m[v]=m[v].concat(g)}return{generations:Object.entries(m).sort(([g],[v])=>parseInt(g,10)-parseInt(v,10)).map(([g,v])=>v),llmOutput:{estimatedTokenUsage:o}}}let l=await this.completionWithRetry(s,!1),{completionTokens:c,promptTokens:d,totalTokens:f}=l?.usage??{};c&&(o.completionTokens=(o.completionTokens??0)+c),d&&(o.promptTokens=(o.promptTokens??0)+d),f&&(o.totalTokens=(o.totalTokens??0)+f);let p=[];for(let h of l?.choices??[]){if("delta"in h)throw new Error("Delta not supported in non-streaming mode.");if(!("message"in h))throw new Error("No message found in the choice.");let m=h.message?.content??"";Array.isArray(m)&&(m=m[0].type==="text"?m[0].text:"");let _={text:m,message:Lrn(h,l?.usage)};h.finishReason&&(_.generationInfo={finishReason:h.finishReason}),p.push(_)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(t,r,n){let o=_At(t),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=Frn(c,f?u.usage:null);if(p===null)continue;let h=c.content??"";Array.isArray(h)&&(h=h[0].type==="text"?h[0].text:"");let m=new ii({message:p,text:h,generationInfo:d});yield m,n?.handleLLMNewToken(m.text??"",d,void 0,void 0,void 0,{chunk:m})}}addAllHooksToHttpClient(){try{if(this.removeAllHooksFromHttpClient(),[this.beforeRequestHooks,this.requestErrorHooks,this.responseHooks].some(r=>r&&r.length>0)&&!this.httpClient&&(this.httpClient=new xAt.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 t of this.beforeRequestHooks)this.httpClient?.removeHook("beforeRequest",t);if(this.requestErrorHooks)for(let t of this.requestErrorHooks)this.httpClient?.removeHook("requestError",t);if(this.responseHooks)for(let t of this.responseHooks)this.httpClient?.removeHook("response",t)}catch{throw new Error("Error in removing hooks")}}removeHookFromHttpClient(t){try{this.httpClient?.removeHook("beforeRequest",t),this.httpClient?.removeHook("requestError",t),this.httpClient?.removeHook("response",t)}catch{throw new Error("Error in removing hook")}}_combineLLMOutput(){return[]}withStructuredOutput(t,r){let n=t,o=r?.name,i=r?.method,a=r?.includeRaw,s,u;if(i==="jsonMode")s=this.bind({response_format:{type:"json_object"}}),wAt(n)?u=AS.fromZodSchema(n):u=new RS;else{let f=o??"extract";if(wAt(n)){let p=Li(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:"any"}),u=new Sg({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 Sg({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Fi.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Fi.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Ha.from([{raw:s},d])}};function wAt(e){return typeof e?.parse=="function"}kh();var Lne=require("obsidian"),krn={openai:$h,"azure openai":$h,anthropic:mee,cohereai:KZ,google:tX,openrouterai:$h,ollama:iX,"lm-studio":$h,groq:Eee,"3rd party (openai-format)":$h,"copilot-plus":$h,mistralai:Nne,deepseek:gee},zd=class e{constructor(){this.providerApiKeyMap={openai:()=>pe().openAIApiKey,google:()=>pe().googleApiKey,"azure openai":()=>pe().azureOpenAIApiKey,anthropic:()=>pe().anthropicApiKey,cohereai:()=>pe().cohereApiKey,openrouterai:()=>pe().openRouterAiApiKey,groq:()=>pe().groqApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>pe().plusLicenseKey,mistralai:()=>pe().mistralApiKey,deepseek:()=>pe().deepseekApiKey};this.buildModelMap(),ll(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return e.instance||(e.instance=new e),e.instance}async getModelConfig(t){let r=pe(),n=t.name,o=uI(n),i={modelName:n,temperature:t.temperature??r.temperature,streaming:t.stream??!0,maxRetries:3,maxConcurrency:3,enableCors:t.enableCors},s={openai:{modelName:n,openAIApiKey:await Ho(t.apiKey||r.openAIApiKey),configuration:{baseURL:t.baseUrl,fetch:t.enableCors?Bl:void 0,organization:await Ho(t.openAIOrgId||r.openAIOrgId)},...this.handleOpenAIExtraArgs(o,r.maxTokens,r.temperature)},anthropic:{anthropicApiKey:await Ho(t.apiKey||r.anthropicApiKey),modelName:n,anthropicApiUrl:t.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:t.enableCors?Bl:void 0}},"azure openai":{modelName:t.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,openAIApiKey:await Ho(t.apiKey||r.azureOpenAIApiKey),configuration:{baseURL:`https://${t.azureOpenAIApiInstanceName||r.azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${t.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName}`,defaultQuery:{"api-version":t.azureOpenAIApiVersion||r.azureOpenAIApiVersion},defaultHeaders:{"Content-Type":"application/json","api-key":await Ho(t.apiKey||r.azureOpenAIApiKey)},fetch:t.enableCors?Bl:void 0},...this.handleOpenAIExtraArgs(o,r.maxTokens,r.temperature)},cohereai:{apiKey:await Ho(t.apiKey||r.cohereApiKey),model:n},google:{apiKey:await Ho(t.apiKey||r.googleApiKey),modelName:n,safetySettings:[{category:QA.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:eR.BLOCK_NONE},{category:QA.HARM_CATEGORY_HATE_SPEECH,threshold:eR.BLOCK_NONE},{category:QA.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:eR.BLOCK_NONE},{category:QA.HARM_CATEGORY_HARASSMENT,threshold:eR.BLOCK_NONE}],baseUrl:t.baseUrl},openrouterai:{modelName:n,openAIApiKey:await Ho(t.apiKey||r.openRouterAiApiKey),configuration:{baseURL:t.baseUrl||"https://openrouter.ai/api/v1",fetch:t.enableCors?Bl:void 0}},groq:{apiKey:await Ho(t.apiKey||r.groqApiKey),modelName:n},ollama:{model:n,apiKey:t.apiKey||"default-key",baseUrl:t.baseUrl||"http://localhost:11434"},"lm-studio":{modelName:n,openAIApiKey:t.apiKey||"default-key",configuration:{baseURL:t.baseUrl||"http://localhost:1234/v1",fetch:t.enableCors?Bl:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await Ho(t.apiKey||r.openAIApiKey),configuration:{baseURL:t.baseUrl,fetch:t.enableCors?Bl:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.handleOpenAIExtraArgs(o,r.maxTokens,r.temperature)},"copilot-plus":{modelName:n,openAIApiKey:await Ho(r.plusLicenseKey),configuration:{baseURL:cI,fetch:t.enableCors?Bl:void 0}},mistralai:{model:n,apiKey:await Ho(t.apiKey||r.mistralApiKey),serverURL:t.baseUrl},deepseek:{modelName:n,apiKey:await Ho(t.apiKey||r.deepseekApiKey),configuration:{baseURL:t.baseUrl||pj.deepseek.host,fetch:t.enableCors?Bl:void 0}}}[t.provider]||{},u=this.handleOpenAIExtraArgs(o,t.maxTokens??r.maxTokens,t.temperature??r.temperature);return{...i,...s,...u}}handleOpenAIExtraArgs(t,r,n){return t?{maxCompletionTokens:r,temperature:1}:{maxTokens:r,temperature:n}}buildModelMap(){let t=pe().activeModels;e.modelMap={};let r=e.modelMap;(t??IO).forEach(o=>{if(o.enabled){if(!Object.values(lI).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=Nr(o);r[u]={hasApiKey:!!(o.apiKey||s),AIConstructor:i,vendor:o.provider}}})}getProviderConstructor(t){let r=krn[t.provider];if(!r)throw console.warn(`Unknown provider: ${t.provider} for model: ${t.name}`),new Error(`Unknown provider: ${t.provider} for model: ${t.name}`);return r}getChatModel(){if(!e.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return e.chatModel}async setChatModel(t){let r=Nr(t);O5(r);try{let n=await this.createModelInstance(t);e.chatModel=n}catch(n){gt(n),new Lne.Notice(`Error creating model: ${r}`)}}async createModelInstance(t){let r=Nr(t),n=e.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 Lne.Notice(a),new Error(a)}let o=await this.getModelConfig(t);return new n.AIConstructor({...o})}validateChatModel(t){return t!=null}async countTokens(t){return e.chatModel?.getNumTokens(t)??0}validateCurrentModel(){if(!e.chatModel)return;let t=E5();if(!t)return;e.modelMap[t]?.hasApiKey||(e.chatModel=null,console.log("Failed to reinitialize model due to missing API key"))}async ping(t){let r=async n=>{let o={...t,enableCors:n},i=await this.getModelConfig(o),{streaming:a,maxTokens:s,maxCompletionTokens:u,...l}=i,c=uI(o.name),d=this.handleOpenAIExtraArgs(c,10,i.temperature);await new(this.getProviderConstructor(o))({...l,...d}).invoke([{role:"user",content:"hello"}],{timeout:3e3})};try{return await r(!1),!0}catch(n){console.log("First ping attempt failed, trying with CORS...");try{return await r(!0),new Lne.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: `+bi(n)+`
with CORS Error: `+bi(o);throw new Error(i)}}}findModelByName(t){return pe().activeModels.find(n=>n.name===t)}};async function Fne(e,t){let r=`Given the following conversation and a follow up question,
summarize the conversation as context and keep the follow up question unchanged, in its original language.
If the follow up question is unrelated to its preceding messages, return this follow up question directly.
If it is related, then combine the summary and the follow up question to construct a standalone question.
Make sure to keep any [[]] wrapped note titles in the question unchanged.
If there's nothing in the chat history, just return the follow up question.
Chat History:
{chat_history}
Follow Up Input: {question}
Standalone question:`,n=t.map(([a,s])=>`Human: ${a}
Assistant: ${s}`).join(`
`),i=await zd.getInstance().getChatModel().bind({temperature:0}).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",e)}]);return fj(i.content)}var oTe=require("obsidian"),CAt=e=>{switch(e){case"@vault":return"Search through your vault for relevant information";case"@web":return"Search the web for information";case"@youtube":return"Get the transcript of a YouTube video. Example: @youtube <video_url>";case"@pomodoro":return"Start a pomodoro timer. Example: @pomodoro 25m";default:return""}},rB=class{static async callTool(t,r){try{if(!t)throw new Error("Tool is undefined");let n=await t.call(r);return n??(console.warn(`Tool ${t.name} returned null/undefined result`),null)}catch(n){return console.error("Error calling tool:",n),n instanceof Error?new oTe.Notice(n.message):new oTe.Notice("An error occurred while executing the tool. Check console for details."),null}}};var $1t=require("obsidian");tI();wO();lf();sy();var kne=class extends on{constructor(t){super(t),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=t?.callbacks,this.tags=t?.tags??[],this.metadata=t?.metadata??{},this.verbose=t?.verbose??!1}_getRelevantDocuments(t,r){throw new Error("Not implemented!")}async invoke(t,r){return this.getRelevantDocuments(t,jr(r))}async getRelevantDocuments(t,r){let n=jr(GM(r)),i=await(await os.configure(n.callbacks,this.callbacks,n.tags,this.tags,n.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),t,n.runId,void 0,void 0,void 0,n.runName);try{let a=await this._getRelevantDocuments(t,i);return await i?.handleRetrieverEnd(a),a}catch(a){throw await i?.handleRetrieverError(a),a}}};var cT=class extends kne{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=ah.fromTemplate(`Please write a passage to answer the question. If you don't know the answer, just make up a passage.
Question: {question}
Passage:`)}async getRelevantDocuments(r,n){let o=py(r,app.vault),i=o.map(m=>m.basename),a=[...new Set([...this.options.salientTerms,...i])],s=await this.getExplicitChunks(o),u=r;n?.runName!=="no_hyde"&&(u=await this.rewriteQuery(r));let l=await this.getOramaChunks(u,a,this.options.textWeight),c=this.filterAndFormatChunks(l,s),d=c;if(c.length===0)return pe().debug&&console.log("No chunks found for query:",r),d;let f=c.reduce((m,_)=>{let g=_.metadata.score;return typeof g=="number"&&!isNaN(g)?Math.max(m,g):m},0),p=c.every(m=>typeof m.metadata.score!="number"||isNaN(m.metadata.score)),h=this.options.useRerankerThreshold&&(f<this.options.useRerankerThreshold||p);return h&&(d=(await ms.getInstance().rerank(r,c.map(_=>_.pageContent.slice(0,3e3)))).response.data.map(_=>({...c[_.index],metadata:{...c[_.index].metadata,rerank_score:_.relevance_score}}))),pe().debug&&(console.log("*** HYBRID RETRIEVER DEBUG INFO: ***"),n?.runName!=="no_hyde"&&(console.log(`
Original Query: `,r),console.log("Rewritten Query: ",u)),console.log(`
Explicit Chunks: `,s),console.log("Orama Chunks: ",l),console.log("Combined Chunks: ",c),console.log("Max Orama Score: ",f),h?console.log("Reranked Chunks: ",d):console.log("No reranking applied.")),d}async rewriteQuery(r){try{let n=await this.queryRewritePrompt.format({question:r}),i=await zd.getInstance().getChatModel().bind({temperature:0}).invoke(n);return i&&"content"in i?fj(i.content):(console.warn("Unexpected rewrittenQuery format. Falling back to original query."),r)}catch(n){return console.error("Error in rewriteQuery:",n),r}}async getExplicitChunks(r){let n=[];for(let o of r){let i=await ma.getInstance().getDb(),a=await Wx.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new Jx({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&&(pe().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);Mr("==== Daily note date range: ====",d[0],d[d.length-1]);let f=py(d.join(", "),app.vault),h=(await this.getExplicitChunks(f)).map(S=>({...S,metadata:{...S.metadata,includeInContext:!0}}));Mr("==== Modified time range: ====",l,c),s.where={mtime:{between:[l,c]}};let _=(await ac(a,s)).hits.map(S=>new Jx({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=[...h,..._];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)}pe().debug&&console.log(`==== Orama Search Params: ====
`,s);let u=await ac(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 Jx({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 hs.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}}))}};bd();var iTe=Tp(async({timeRange:e,query:t,salientTerms:r})=>{if(await ma.getInstance().isIndexEmpty())throw new or(b5);let o=e!==void 0,i=pe().maxSourceChunks<Wle?Wle:pe().maxSourceChunks;pe().debug&&console.log("returnAll:",o);let u=(await new cT({minSimilarityScore:o?0:.1,maxK:o?1e3:i,salientTerms:r,timeRange:e?{startTime:e.startTime.epoch,endTime:e.endTime.epoch}:void 0,textWeight:gBe,returnAll:o,useRerankerThreshold:.5}).getRelevantDocuments(t)).map(l=>({title:l.metadata.title,content:l.pageContent,path:l.metadata.path,score:l.metadata.score,rerank_score:l.metadata.rerank_score,includeInContext:l.metadata.includeInContext}));return JSON.stringify(u)},{name:"localSearch",description:"Search for notes based on the time range and query",schema:Tr.object({timeRange:Tr.object({startTime:Tr.any(),endTime:Tr.any()}).optional(),query:Tr.string().describe("The search query"),salientTerms:Tr.array(Tr.string()).describe("List of salient terms extracted from the query")})}),OAt=Tp(async()=>{try{let e=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:e===0?"No new files to index.":`Indexed ${e} files in the vault.`})}catch(e){return console.error("Error indexing vault:",e),JSON.stringify({success:!1,message:"An error occurred while indexing the vault."})}},{name:"indexVault",description:"Index the vault to the Copilot index"}),aTe=Tp(async({query:e,chatHistory:t})=>{try{let r=await Fne(e,t),n=await ms.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 ${e}:`,r),""}},{name:"webSearch",description:"Search the web for information",schema:Tr.object({query:Tr.string().describe("The search query"),chatHistory:Tr.array(Tr.tuple([Tr.string(),Tr.string()])).describe("Previous conversation turns")})});var MAt=B(EAt(),1),W3=B(dT(),1);var Dn;(function(e){e[e.AM=0]="AM",e[e.PM=1]="PM"})(Dn||(Dn={}));var Iu;(function(e){e[e.SUNDAY=0]="SUNDAY",e[e.MONDAY=1]="MONDAY",e[e.TUESDAY=2]="TUESDAY",e[e.WEDNESDAY=3]="WEDNESDAY",e[e.THURSDAY=4]="THURSDAY",e[e.FRIDAY=5]="FRIDAY",e[e.SATURDAY=6]="SATURDAY"})(Iu||(Iu={}));var jp;(function(e){e[e.JANUARY=1]="JANUARY",e[e.FEBRUARY=2]="FEBRUARY",e[e.MARCH=3]="MARCH",e[e.APRIL=4]="APRIL",e[e.MAY=5]="MAY",e[e.JUNE=6]="JUNE",e[e.JULY=7]="JULY",e[e.AUGUST=8]="AUGUST",e[e.SEPTEMBER=9]="SEPTEMBER",e[e.OCTOBER=10]="OCTOBER",e[e.NOVEMBER=11]="NOVEMBER",e[e.DECEMBER=12]="DECEMBER"})(jp||(jp={}));function PAt(e,t){t=t.add(1,"day"),x1(e,t),nB(e,t)}function jg(e,t){e.assign("day",t.date()),e.assign("month",t.month()+1),e.assign("year",t.year())}function Bne(e,t){e.assign("hour",t.hour()),e.assign("minute",t.minute()),e.assign("second",t.second()),e.assign("millisecond",t.millisecond()),e.get("hour")<12?e.assign("meridiem",Dn.AM):e.assign("meridiem",Dn.PM)}function x1(e,t){e.imply("day",t.date()),e.imply("month",t.month()+1),e.imply("year",t.year())}function nB(e,t){e.imply("hour",t.hour()),e.imply("minute",t.minute()),e.imply("second",t.second()),e.imply("millisecond",t.millisecond())}var dTe=B(dT(),1);var Brn={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:e=>TAt(e,jp.MARCH,Iu.SUNDAY,2),dstEnd:e=>TAt(e,jp.OCTOBER,Iu.SUNDAY,3)},CHADT:825,CHAST:765,CKT:-600,CLST:-180,CLT:-240,COT:-300,CST:-360,CT:{timezoneOffsetDuringDst:-5*60,timezoneOffsetNonDst:-6*60,dstStart:e=>fT(e,jp.MARCH,Iu.SUNDAY,2,2),dstEnd:e=>fT(e,jp.NOVEMBER,Iu.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:e=>fT(e,jp.MARCH,Iu.SUNDAY,2,2),dstEnd:e=>fT(e,jp.NOVEMBER,Iu.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:e=>fT(e,jp.MARCH,Iu.SUNDAY,2,2),dstEnd:e=>fT(e,jp.NOVEMBER,Iu.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:e=>fT(e,jp.MARCH,Iu.SUNDAY,2,2),dstEnd:e=>fT(e,jp.NOVEMBER,Iu.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 fT(e,t,r,n,o=0){let i=0,a=0;for(;a<n;)i++,new Date(e,t-1,i).getDay()===r&&a++;return new Date(e,t-1,i,o)}function TAt(e,t,r,n=0){let o=r===0?7:r,i=new Date(e,t-1+1,1,12),a=i.getDay()===0?7:i.getDay(),s;return a===o?s=7:a<o?s=7+a-o:s=a-o,i.setDate(i.getDate()-s),new Date(e,t-1,i.getDate(),n)}function $ne(e,t,r={}){if(e==null)return null;if(typeof e=="number")return e;let n=r[e]??Brn[e];return n==null?null:typeof n=="number"?n:t==null?null:(0,dTe.default)(t).isAfter(n.dstStart(t.getFullYear()))&&!(0,dTe.default)(t).isAfter(n.dstEnd(t.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}W3.default.extend(MAt.default);var pT=class{constructor(t){t=t??new Date,t instanceof Date?this.instant=t:(this.instant=t.instant??new Date,this.timezoneOffset=$ne(t.timezone,this.instant))}getDateWithAdjustedTimezone(){return new Date(this.instant.getTime()+this.getSystemTimezoneAdjustmentMinute(this.instant)*6e4)}getSystemTimezoneAdjustmentMinute(t,r){(!t||t.getTime()<0)&&(t=new Date);let n=-t.getTimezoneOffset(),o=r??this.timezoneOffset??n;return n-o}},jn=class e{constructor(t,r){if(this._tags=new Set,this.reference=t,this.knownValues={},this.impliedValues={},r)for(let o in r)this.knownValues[o]=r[o];let n=(0,W3.default)(t.instant);this.imply("day",n.date()),this.imply("month",n.month()+1),this.imply("year",n.year()),this.imply("hour",12),this.imply("minute",0),this.imply("second",0),this.imply("millisecond",0)}get(t){return t in this.knownValues?this.knownValues[t]:t in this.impliedValues?this.impliedValues[t]:null}isCertain(t){return t in this.knownValues}getCertainComponents(){return Object.keys(this.knownValues)}imply(t,r){return t in this.knownValues?this:(this.impliedValues[t]=r,this)}assign(t,r){return this.knownValues[t]=r,delete this.impliedValues[t],this}delete(t){delete this.knownValues[t],delete this.impliedValues[t]}clone(){let t=new e(this.reference);t.knownValues={},t.impliedValues={};for(let r in this.knownValues)t.knownValues[r]=this.knownValues[r];for(let r in this.impliedValues)t.impliedValues[r]=this.impliedValues[r];return t}isOnlyDate(){return!this.isCertain("hour")&&!this.isCertain("minute")&&!this.isCertain("second")}isOnlyTime(){return!this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")&&!this.isCertain("year")}isOnlyWeekdayComponent(){return this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")}isDateWithUnknownYear(){return this.isCertain("month")&&!this.isCertain("year")}isValidDate(){let t=this.dateWithoutTimezoneAdjustment();return!(t.getFullYear()!==this.get("year")||t.getMonth()!==this.get("month")-1||t.getDate()!==this.get("day")||this.get("hour")!=null&&t.getHours()!=this.get("hour")||this.get("minute")!=null&&t.getMinutes()!=this.get("minute"))}toString(){return`[ParsingComponents {
tags: ${JSON.stringify(Array.from(this._tags).sort())},
knownValues: ${JSON.stringify(this.knownValues)},
impliedValues: ${JSON.stringify(this.impliedValues)}},
reference: ${JSON.stringify(this.reference)}]`}dayjs(){return(0,W3.default)(this.date())}date(){let t=this.dateWithoutTimezoneAdjustment(),r=this.reference.getSystemTimezoneAdjustmentMinute(t,this.get("timezoneOffset"));return new Date(t.getTime()+r*6e4)}addTag(t){return this._tags.add(t),this}addTags(t){for(let r of t)this._tags.add(r);return this}tags(){return new Set(this._tags)}dateWithoutTimezoneAdjustment(){let t=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 t.setFullYear(this.get("year")),t}static createRelativeFromReference(t,r){let n=(0,W3.default)(t.instant);for(let i in r)n=n.add(r[i],i);let o=new e(t);return r.hour||r.minute||r.second?(Bne(o,n),jg(o,n),t.timezoneOffset!==null&&o.assign("timezoneOffset",-t.instant.getTimezoneOffset())):(nB(o,n),t.timezoneOffset!==null&&o.imply("timezoneOffset",-t.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}},kC=class e{constructor(t,r,n,o,i){this.reference=t,this.refDate=t.instant,this.index=r,this.text=n,this.start=o||new jn(t),this.end=i}clone(){let t=new e(this.reference,this.index,this.text);return t.start=this.start?this.start.clone():null,t.end=this.end?this.end.clone():null,t}date(){return this.start.date()}tags(){let t=new Set(this.start.tags());if(this.end)for(let r of this.end.tags())t.add(r);return t}toString(){let t=Array.from(this.tags()).sort();return`[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(t)} ...}]`}};function fTe(e,t,r="\\s{0,5},?\\s{0,5}"){let n=t.replace(/\((?!\?)/g,"(?:");return`${e}${n}(?:${r}${n}){0,10}`}function $rn(e){let t;return e instanceof Array?t=[...e]:e instanceof Map?t=Array.from(e.keys()):t=Object.keys(e),t}function pc(e){return`(?:${$rn(e).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var IAt=B(dT(),1);function qne(e){return e<100&&(e>50?e=e+1900:e=e+2e3),e}function hT(e,t,r){let n=(0,IAt.default)(e),o=n;o=o.month(r-1),o=o.date(t),o=o.year(n.year());let i=o.add(1,"y"),a=o.add(-1,"y");return Math.abs(i.diff(n))<Math.abs(o.diff(n))?o=i:Math.abs(a.diff(n))<Math.abs(o.diff(n))&&(o=a),o.year()}var mTe={sunday:0,sun:0,"sun.":0,monday:1,mon:1,"mon.":1,tuesday:2,tue:2,"tue.":2,wednesday:3,wed:3,"wed.":3,thursday:4,thurs:4,"thurs.":4,thur:4,"thur.":4,thu:4,"thu.":4,friday:5,fri:5,"fri.":5,saturday:6,sat:6,"sat.":6},gTe={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},um={...gTe,jan:1,"jan.":1,feb:2,"feb.":2,mar:3,"mar.":3,apr:4,"apr.":4,jun:6,"jun.":6,jul:7,"jul.":7,aug:8,"aug.":8,sep:9,"sep.":9,sept:9,"sept.":9,oct:10,"oct.":10,nov:11,"nov.":11,dec:12,"dec.":12},pTe={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},hTe={first:1,second:2,third:3,fourth:4,fifth:5,sixth:6,seventh:7,eighth:8,ninth:9,tenth:10,eleventh:11,twelfth:12,thirteenth:13,fourteenth:14,fifteenth:15,sixteenth:16,seventeenth:17,eighteenth:18,nineteenth:19,twentieth:20,"twenty first":21,"twenty-first":21,"twenty second":22,"twenty-second":22,"twenty third":23,"twenty-third":23,"twenty fourth":24,"twenty-fourth":24,"twenty fifth":25,"twenty-fifth":25,"twenty sixth":26,"twenty-sixth":26,"twenty seventh":27,"twenty-seventh":27,"twenty eighth":28,"twenty-eighth":28,"twenty ninth":29,"twenty-ninth":29,thirtieth:30,"thirty first":31,"thirty-first":31},RAt={second:"second",seconds:"second",minute:"minute",minutes:"minute",hour:"hour",hours:"hour",day:"d",days:"d",week:"week",weeks:"week",month:"month",months:"month",quarter:"quarter",quarters:"quarter",year:"year",years:"year"},J3={s:"second",sec:"second",second:"second",seconds:"second",m:"minute",min:"minute",mins:"minute",minute:"minute",minutes:"minute",h:"hour",hr:"hour",hrs:"hour",hour:"hour",hours:"hour",d:"d",day:"d",days:"d",w:"w",week:"week",weeks:"week",mo:"month",mon:"month",mos:"month",month:"month",months:"month",qtr:"quarter",quarter:"quarter",quarters:"quarter",y:"year",yr:"year",year:"year",years:"year",...RAt},DAt=`(?:${pc(pTe)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|the|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;function qrn(e){let t=e.toLowerCase();return pTe[t]!==void 0?pTe[t]:t==="a"||t==="an"||t=="the"?1:t.match(/few/)?3:t.match(/half/)?.5:t.match(/couple/)?2:t.match(/several/)?7:parseFloat(t)}var oB=`(?:${pc(hTe)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function iB(e){let t=e.toLowerCase();return hTe[t]!==void 0?hTe[t]:(t=t.replace(/(?:st|nd|rd|th)$/i,""),parseInt(t))}var mT="(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9]|2[0-5])";function gT(e){if(/BE/i.test(e))return e=e.replace(/BE/i,""),parseInt(e)-543;if(/BCE?/i.test(e))return e=e.replace(/BCE?/i,""),-parseInt(e);if(/(AD|CE)/i.test(e))return e=e.replace(/(AD|CE)/i,""),parseInt(e);let t=parseInt(e);return qne(t)}var jAt=`(${DAt})\\s{0,3}(${pc(J3)})`,AAt=new RegExp(jAt,"i"),Urn=`(${DAt})\\s{0,3}(${pc(RAt)})`,NAt="\\s{0,5},?(?:\\s*and)?\\s{0,5}",BC=fTe("(?:(?:about|around)\\s{0,3})?",jAt,NAt),yT=fTe("(?:(?:about|around)\\s{0,3})?",Urn,NAt);function lm(e){let t={},r=e,n=AAt.exec(r);for(;n;)zrn(t,n),r=r.substring(n[0].length).trim(),n=AAt.exec(r);return Object.keys(t).length==0?null:t}function zrn(e,t){if(t[0].match(/^[a-zA-Z]+$/))return;let r=qrn(t[1]),n=J3[t[2].toLowerCase()];e[n]=r}var Ao=class{constructor(){this.cachedInnerPattern=null,this.cachedPattern=null}innerPatternHasChange(t,r){return this.innerPattern(t)!==r}patternLeftBoundary(){return"(\\W|^)"}pattern(t){return this.cachedInnerPattern&&!this.innerPatternHasChange(t,this.cachedInnerPattern)?this.cachedPattern:(this.cachedInnerPattern=this.innerPattern(t),this.cachedPattern=new RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`,this.cachedInnerPattern.flags),this.cachedPattern)}extract(t,r){let n=r[1]??"";r.index=r.index+n.length,r[0]=r[0].substring(n.length);for(let o=2;o<r.length;o++)r[o-1]=r[o];return this.innerExtract(t,r)}};var Hrn=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${BC})(?=\\W|$)`,"i"),Vrn=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${BC})(?=\\W|$)`,"i"),Wrn=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${yT})(?=\\W|$)`,"i"),G3=class extends Ao{constructor(t){super(),this.strictMode=t}innerPattern(t){return this.strictMode?Wrn:t.option.forwardDate?Hrn:Vrn}innerExtract(t,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=lm(r[1]);return n?jn.createRelativeFromReference(t.reference,n):null}};var Jrn=new RegExp(`(?:on\\s{0,3})?(${oB})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${oB}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${pc(um)})(?:(?:-|/|,?\\s{0,3})(${mT}(?!\\w)))?(?=\\W|$)`,"i"),LAt=1,FAt=2,Grn=3,kAt=4,K3=class extends Ao{innerPattern(){return Jrn}innerExtract(t,r){let n=t.createParsingResult(r.index,r[0]),o=um[r[Grn].toLowerCase()],i=iB(r[LAt]);if(i>31)return r.index=r.index+r[LAt].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[kAt]){let a=gT(r[kAt]);n.start.assign("year",a)}else{let a=hT(t.refDate,i,o);n.start.imply("year",a)}if(r[FAt]){let a=iB(r[FAt]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};var Krn=new RegExp(`(${pc(um)})(?:-|/|\\s*,?\\s*)(${oB})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${oB})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${mT}))?(?=\\W|$)(?!\\:\\d)`,"i"),Yrn=1,BAt=2,yTe=3,bTe=4,Y3=class extends Ao{constructor(t){super(),this.shouldSkipYearLikeDate=t}innerPattern(){return Krn}innerExtract(t,r){let n=um[r[Yrn].toLowerCase()],o=iB(r[BAt]);if(o>31||this.shouldSkipYearLikeDate&&!r[yTe]&&!r[bTe]&&r[BAt].match(/^2[0-5]$/))return null;let i=t.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[bTe]){let u=gT(r[bTe]);i.assign("year",u)}else{let u=hT(t.refDate,o,n);i.imply("year",u)}if(!r[yTe])return i;let a=iB(r[yTe]),s=t.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}};var Zrn=new RegExp(`((?:in)\\s*)?(${pc(um)})\\s*(?:[,-]?\\s*(${mT})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),Xrn=1,Qrn=2,$At=3,Z3=class extends Ao{innerPattern(){return Zrn}innerExtract(t,r){let n=r[Qrn].toLowerCase();if(r[0].length<=3&&!gTe[n])return null;let o=t.createParsingResult(r.index+(r[Xrn]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=um[n];if(o.start.assign("month",i),r[$At]){let a=gT(r[$At]);o.start.assign("year",a)}else{let a=hT(t.refDate,1,i);o.start.imply("year",a)}return o}};var enn=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${pc(um)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),tnn=1,rnn=2,qAt=3,nnn=4,X3=class extends Ao{constructor(t){super(),this.strictMonthDateOrder=t}innerPattern(){return enn}innerExtract(t,r){let n=parseInt(r[tnn]),o=parseInt(r[nnn]),i=r[qAt]?parseInt(r[qAt]):um[r[rnn].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 onn=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),inn=1,ann=2,Q3=class extends Ao{innerPattern(){return onn}innerExtract(t,r){let n=parseInt(r[ann]),o=parseInt(r[inn]);return t.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}};function snn(e,t,r,n){return new RegExp(`${e}${t}(\\d{1,4})(?:(?:\\.|:|\uFF1A)(\\d{1,2})(?:(?::|\uFF1A)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${r}`,n)}function unn(e,t){return new RegExp(`^(${e})(\\d{1,4})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${t}`,"i")}var UAt=2,aB=3,Une=4,zne=5,e8=6,Hne=class{constructor(t=!1){this.cachedPrimaryPrefix=null,this.cachedPrimarySuffix=null,this.cachedPrimaryTimePattern=null,this.cachedFollowingPhase=null,this.cachedFollowingSuffix=null,this.cachedFollowingTimePatten=null,this.strictMode=t}patternFlags(){return"i"}primaryPatternLeftBoundary(){return"(^|\\s|T|\\b)"}primarySuffix(){return"(?!/)(?=\\W|$)"}followingSuffix(){return"(?!/)(?=\\W|$)"}pattern(t){return this.getPrimaryTimePatternThroughCache()}extract(t,r){let n=this.extractPrimaryTimeComponents(t,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=t.createParsingResult(o,i,n);r.index+=r[0].length;let s=t.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(t,l,a),a.end&&(a.text+=l[0]),this.checkAndReturnWithFollowingPattern(a))}extractPrimaryTimeComponents(t,r,n=!1){let o=t.createParsingComponents(),i=0,a=null,s=parseInt(r[UAt]);if(s>100){if(this.strictMode||r[aB]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[aB]!=null){if(r[aB].length==1&&!r[e8])return null;i=parseInt(r[aB])}if(i>=60)return null;if(s>12&&(a=Dn.PM),r[e8]!=null){if(s>12)return null;let u=r[e8][0].toLowerCase();u=="a"&&(a=Dn.AM,s==12&&(s=0)),u=="p"&&(a=Dn.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",Dn.AM):o.imply("meridiem",Dn.PM),r[zne]!=null){let u=parseInt(r[zne].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[Une]!=null){let u=parseInt(r[Une]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(t,r,n){let o=t.createParsingComponents();if(r[zne]!=null){let u=parseInt(r[zne].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[Une]!=null){let u=parseInt(r[Une]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[UAt]),a=0,s=-1;if(r[aB]!=null?a=parseInt(r[aB]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=Dn.PM),r[e8]!=null){if(i>12)return null;let u=r[e8][0].toLowerCase();u=="a"&&(s=Dn.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=Dn.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==Dn.AM?(n.start.imply("meridiem",Dn.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",Dn.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",Dn.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",Dn.PM)):i>12?o.imply("meridiem",Dn.PM):i<=12&&o.imply("meridiem",Dn.AM),o.date().getTime()<n.start.date().getTime()&&o.imply("day",o.get("day")+1),o}checkAndReturnWithoutFollowingPattern(t){if(t.text.match(/^\d$/)||t.text.match(/^\d\d\d+$/)||t.text.match(/\d[apAP]$/))return null;let r=t.text.match(/[^\d:.](\d[\d.]+)$/);if(r){let n=r[1];if(this.strictMode||n.includes(".")&&!n.match(/\d(\.\d{2})+$/)||parseInt(n)>24)return null}return t}checkAndReturnWithFollowingPattern(t){if(t.text.match(/^\d+-\d+$/))return null;let r=t.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 t}getPrimaryTimePatternThroughCache(){let t=this.primaryPrefix(),r=this.primarySuffix();return this.cachedPrimaryPrefix===t&&this.cachedPrimarySuffix===r?this.cachedPrimaryTimePattern:(this.cachedPrimaryTimePattern=snn(this.primaryPatternLeftBoundary(),t,r,this.patternFlags()),this.cachedPrimaryPrefix=t,this.cachedPrimarySuffix=r,this.cachedPrimaryTimePattern)}getFollowingTimePatternThroughCache(){let t=this.followingPhase(),r=this.followingSuffix();return this.cachedFollowingPhase===t&&this.cachedFollowingSuffix===r?this.cachedFollowingTimePatten:(this.cachedFollowingTimePatten=unn(t,r),this.cachedFollowingPhase=t,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}};var t8=class extends Hne{constructor(t){super(t)}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(t,r){let n=super.extractPrimaryTimeComponents(t,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",Dn.PM)):o<6&&n.assign("meridiem",Dn.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",Dn.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",Dn.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}};function bT(e){let t={};for(let r in e)t[r]=-e[r];return t}function zAt(e,t){let r=e.clone(),n=e.dayjs();for(let o in t)n=n.add(t[o],o);return("day"in t||"d"in t||"week"in t||"month"in t||"year"in t)&&(r.imply("day",n.date()),r.imply("month",n.month()+1),r.imply("year",n.year())),("second"in t||"minute"in t||"hour"in t)&&(r.imply("second",n.second()),r.imply("minute",n.minute()),r.imply("hour",n.hour())),r}var lnn=new RegExp(`(${BC})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),cnn=new RegExp(`(${yT})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),r8=class extends Ao{constructor(t){super(),this.strictMode=t}innerPattern(){return this.strictMode?cnn:lnn}innerExtract(t,r){let n=lm(r[1]);if(!n)return null;let o=bT(n);return jn.createRelativeFromReference(t.reference,o)}};var dnn=new RegExp(`(${BC})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),fnn=new RegExp(`(${yT})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),pnn=1,n8=class extends Ao{constructor(t){super(),this.strictMode=t}innerPattern(){return this.strictMode?fnn:dnn}innerExtract(t,r){let n=lm(r[pnn]);return n?jn.createRelativeFromReference(t.reference,n):null}};var Vne=class{refine(t,r){return r.filter(n=>this.isValid(t,n))}},cm=class{refine(t,r){if(r.length<2)return r;let n=[],o=r[0],i=null;for(let a=1;a<r.length;a++){i=r[a];let s=t.text.substring(o.index+o.text.length,i.index);if(!this.shouldMergeResults(s,o,i,t))n.push(o),o=i;else{let u=o,l=i,c=this.mergeResults(s,u,l,t);t.debug(()=>{console.log(`${this.constructor.name} merged ${u} and ${l} into ${c}`)}),o=c}}return o!=null&&n.push(o),n}};var o8=class extends cm{shouldMergeResults(t,r,n){return!r.end&&!n.end&&t.match(this.patternBetween())!=null}mergeResults(t,r,n){if(!r.start.isOnlyWeekdayComponent()&&!n.start.isOnlyWeekdayComponent()&&(n.start.getCertainComponents().forEach(i=>{r.start.isCertain(i)||r.start.imply(i,n.start.get(i))}),r.start.getCertainComponents().forEach(i=>{n.start.isCertain(i)||n.start.imply(i,r.start.get(i))})),r.start.date().getTime()>n.start.date().getTime()){let i=r.start.dayjs(),a=n.start.dayjs();n.start.isOnlyWeekdayComponent()&&a.add(7,"days").isAfter(i)?(a=a.add(7,"days"),n.start.imply("day",a.date()),n.start.imply("month",a.month()+1),n.start.imply("year",a.year())):r.start.isOnlyWeekdayComponent()&&i.add(-7,"days").isBefore(a)?(i=i.add(-7,"days"),r.start.imply("day",i.date()),r.start.imply("month",i.month()+1),r.start.imply("year",i.year())):n.start.isDateWithUnknownYear()&&a.add(1,"years").isAfter(i)?(a=a.add(1,"years"),n.start.imply("year",a.year())):r.start.isDateWithUnknownYear()&&i.add(-1,"years").isBefore(a)?(i=i.add(-1,"years"),r.start.imply("year",i.year())):[n,r]=[r,n]}let o=r.clone();return o.start=r.start,o.end=n.start,o.index=Math.min(r.index,n.index),r.index<n.index?o.text=r.text+t+n.text:o.text=n.text+t+r.text,o}};var i8=class extends o8{patternBetween(){return/^\s*(to|-||until|through|till)\s*$/i}};function _Te(e,t){let r=e.clone(),n=e.start,o=t.start;if(r.start=HAt(n,o),e.end!=null||t.end!=null){let i=e.end==null?e.start:e.end,a=t.end==null?t.start:t.end,s=HAt(i,a);if(e.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?jg(s,u):x1(s,u)}r.end=s}return r}function HAt(e,t){let r=e.clone();return t.isCertain("hour")?(r.assign("hour",t.get("hour")),r.assign("minute",t.get("minute")),t.isCertain("second")?(r.assign("second",t.get("second")),t.isCertain("millisecond")?r.assign("millisecond",t.get("millisecond")):r.imply("millisecond",t.get("millisecond"))):(r.imply("second",t.get("second")),r.imply("millisecond",t.get("millisecond")))):(r.imply("hour",t.get("hour")),r.imply("minute",t.get("minute")),r.imply("second",t.get("second")),r.imply("millisecond",t.get("millisecond"))),t.isCertain("timezoneOffset")&&r.assign("timezoneOffset",t.get("timezoneOffset")),t.isCertain("meridiem")?r.assign("meridiem",t.get("meridiem")):t.get("meridiem")!=null&&r.get("meridiem")==null&&r.imply("meridiem",t.get("meridiem")),r.get("meridiem")==Dn.PM&&r.get("hour")<12&&(t.isCertain("hour")?r.assign("hour",r.get("hour")+12):r.imply("hour",r.get("hour")+12)),r.addTags(e.tags()),r.addTags(t.tags()),r}var a8=class extends cm{shouldMergeResults(t,r,n){return(r.start.isOnlyDate()&&n.start.isOnlyTime()||n.start.isOnlyDate()&&r.start.isOnlyTime())&&t.match(this.patternBetween())!=null}mergeResults(t,r,n){let o=r.start.isOnlyDate()?_Te(r,n):_Te(n,r);return o.index=r.index,o.text=r.text+t+n.text,o}};var sB=class extends a8{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}};var hnn=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),s8=class{constructor(t){this.timezoneOverrides=t}refine(t,r){let n=t.option.timezones??{};return r.forEach(o=>{let i=t.text.substring(o.index+o.text.length),a=hnn.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=$ne(s,u,l);if(c==null)return;t.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 mnn=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),gnn=1,ynn=2,bnn=3,u8=class{refine(t,r){return r.forEach(function(n){if(n.start.isCertain("timezoneOffset"))return;let o=t.text.substring(n.index+n.text.length),i=mnn.exec(o);if(!i)return;t.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[ynn]),s=parseInt(i[bnn]||"0"),u=a*60+s;u>14*60||(i[gnn]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}};var _T=class{refine(t,r){if(r.length<2)return r;let n=[],o=r[0];for(let i=1;i<r.length;i++){let a=r[i];if(a.index>=o.index+o.text.length){n.push(o),o=a;continue}let s=null,u=null;a.text.length>o.text.length?(s=a,u=o):(s=o,u=a),t.debug(()=>{console.log(`${this.constructor.name} remove ${u} by ${s}`)}),o=s}return o!=null&&n.push(o),n}};var VAt=B(dT(),1);var l8=class{refine(t,r){return t.option.forwardDate&&r.forEach(n=>{let o=(0,VAt.default)(t.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),x1(n.start,o),n.end&&n.end.isOnlyTime()&&(x1(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),x1(n.end,o))),t.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()),t.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()),t.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),t.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),t.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} month (${n.start})`)}))}),r}};var c8=class extends Vne{constructor(t){super(),this.strictMode=t}isValid(t,r){return r.text.replace(" ","").match(/^\d*(\.\d*)?$/)?(t.debug(()=>{console.log(`Removing unlikely result '${r.text}'`)}),!1):r.start.isValidDate()?r.end&&!r.end.isValidDate()?(t.debug(()=>{console.log(`Removing invalid result: ${r} (${r.end})`)}),!1):this.strictMode?this.isStrictModeValid(t,r):!0:(t.debug(()=>{console.log(`Removing invalid result: ${r} (${r.start})`)}),!1)}isStrictModeValid(t,r){return r.start.isOnlyWeekdayComponent()?(t.debug(()=>{console.log(`(Strict) Removing weekday only component: ${r} (${r.end})`)}),!1):r.start.isOnlyTime()&&(!r.start.isCertain("hour")||!r.start.isCertain("minute"))?(t.debug(()=>{console.log(`(Strict) Removing uncertain time component: ${r} (${r.end})`)}),!1):!0}};var _nn=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"),vnn=1,wnn=2,Snn=3,WAt=4,xnn=5,JAt=6,GAt=7,Cnn=8,KAt=9,YAt=10,d8=class extends Ao{innerPattern(){return _nn}innerExtract(t,r){let n=t.createParsingComponents({year:parseInt(r[vnn]),month:parseInt(r[wnn]),day:parseInt(r[Snn])});if(r[WAt]!=null&&(n.assign("hour",parseInt(r[WAt])),n.assign("minute",parseInt(r[xnn])),r[JAt]!=null&&n.assign("second",parseInt(r[JAt])),r[GAt]!=null&&n.assign("millisecond",parseInt(r[GAt])),r[Cnn]!=null)){let o=0;if(r[KAt]){let i=parseInt(r[KAt]),a=0;r[YAt]!=null&&(a=parseInt(r[YAt])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}};var f8=class extends cm{mergeResults(t,r,n){let o=n.clone();return o.index=r.index,o.text=r.text+t+o.text,o.start.assign("weekday",r.start.get("weekday")),o.end&&o.end.assign("weekday",r.start.get("weekday")),o}shouldMergeResults(t,r,n){return r.start.isOnlyWeekdayComponent()&&!r.start.isCertain("hour")&&n.start.isCertain("day")&&t.match(/^,?\s*$/)!=null}};function ZAt(e,t=!1){return e.parsers.unshift(new d8),e.refiners.unshift(new f8),e.refiners.unshift(new u8),e.refiners.unshift(new _T),e.refiners.push(new s8),e.refiners.push(new _T),e.refiners.push(new l8),e.refiners.push(new c8(t)),e}var cRt=B(dT(),1);var uB=B(dT(),1);function XAt(e){let t=(0,uB.default)(e.instant),r=new jn(e,{});return jg(r,t),Bne(r,t),e.timezoneOffset!==null&&r.assign("timezoneOffset",t.utcOffset()),r.addTag("casualReference/now"),r}function QAt(e){let t=(0,uB.default)(e.instant),r=new jn(e,{});return jg(r,t),nB(r,t),r.addTag("casualReference/today"),r}function eRt(e){return Onn(e,1).addTag("casualReference/yesterday")}function Onn(e,t){return rRt(e,-t)}function tRt(e){return rRt(e,1).addTag("casualReference/tomorrow")}function rRt(e,t){let r=(0,uB.default)(e.instant),n=new jn(e,{});return r=r.add(t,"day"),jg(n,r),nB(n,r),n}function nRt(e,t=22){let r=(0,uB.default)(e.instant),n=new jn(e,{});return jg(n,r),n.imply("hour",t),n.imply("meridiem",Dn.PM),n.addTag("casualReference/tonight"),n}function oRt(e,t=20){let r=new jn(e,{});return r.imply("meridiem",Dn.PM),r.imply("hour",t),r.addTag("casualReference/evening"),r}function iRt(e){let t=new jn(e,{}),r=(0,uB.default)(e.instant);return r.hour()>2&&PAt(t,r),t.assign("hour",0),t.imply("minute",0),t.imply("second",0),t.imply("millisecond",0),t.addTag("casualReference/midnight"),t}function aRt(e,t=6){let r=new jn(e,{});return r.imply("meridiem",Dn.AM),r.imply("hour",t),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function sRt(e,t=15){let r=new jn(e,{});return r.imply("meridiem",Dn.PM),r.imply("hour",t),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function uRt(e){let t=new jn(e,{});return t.imply("meridiem",Dn.AM),t.imply("hour",12),t.imply("minute",0),t.imply("second",0),t.imply("millisecond",0),t.addTag("casualReference/noon"),t}var Enn=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,p8=class extends Ao{innerPattern(t){return Enn}innerExtract(t,r){let n=(0,cRt.default)(t.refDate),o=r[0].toLowerCase(),i=t.createParsingComponents();switch(o){case"now":i=XAt(t.reference);break;case"today":i=QAt(t.reference);break;case"yesterday":i=eRt(t.reference);break;case"tomorrow":case"tmr":case"tmrw":i=tRt(t.reference);break;case"tonight":i=nRt(t.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),jg(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}};var Pnn=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,h8=class extends Ao{innerPattern(){return Pnn}innerExtract(t,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=sRt(t.reference);break;case"evening":case"night":n=oRt(t.reference);break;case"midnight":n=iRt(t.reference);break;case"morning":n=aRt(t.reference);break;case"noon":case"midday":n=uRt(t.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}};function dRt(e,t,r){let n=e.getDateWithAdjustedTimezone(),o=Tnn(n,t,r),i=new jn(e);return i=zAt(i,{day:o}),i.assign("weekday",t),i}function Tnn(e,t,r){let n=e.getDay();switch(r){case"this":return Wne(e,t);case"last":return fRt(e,t);case"next":return n==Iu.SUNDAY?t==Iu.SUNDAY?7:t:n==Iu.SATURDAY?t==Iu.SATURDAY?7:t==Iu.SUNDAY?8:1+t:t<n&&t!=Iu.SUNDAY?Wne(e,t):Wne(e,t)+7}return Mnn(e,t)}function Mnn(e,t){let r=fRt(e,t),n=Wne(e,t);return n<-r?n:r}function Wne(e,t){let r=e.getDay(),n=t-r;return n<0&&(n+=7),n}function fRt(e,t){let r=e.getDay(),n=t-r;return n>=0&&(n-=7),n}var Inn=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${pc(mTe)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),Ann=1,Rnn=2,Dnn=3,m8=class extends Ao{innerPattern(){return Inn}innerExtract(t,r){let n=r[Rnn].toLowerCase(),o=mTe[n],i=r[Ann],a=r[Dnn],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"),dRt(t.reference,o,u)}};var pRt=B(dT(),1);var jnn=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${pc(J3)})(?=\\s*)(?=\\W|$)`,"i"),Nnn=1,Lnn=2,g8=class extends Ao{innerPattern(){return jnn}innerExtract(t,r){let n=r[Nnn].toLowerCase(),o=r[Lnn].toLowerCase(),i=J3[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,jn.createRelativeFromReference(t.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,jn.createRelativeFromReference(t.reference,u)}let a=t.createParsingComponents(),s=(0,pRt.default)(t.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 Fnn=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"),knn=1,Bnn=5,hRt=2,mRt=3,vTe=4,y8=class{constructor(t){this.groupNumberMonth=t?mRt:hRt,this.groupNumberDay=t?hRt:mRt}pattern(){return Fnn}extract(t,r){let n=r.index+r[knn].length,o=r.index+r[0].length-r[Bnn].length;if(n>0&&t.text.substring(0,n).match("\\d/?$")||o<t.text.length&&t.text.substring(o).match("^/?\\d"))return;let i=t.text.substring(n,o);if(i.match(/^\d\.\d$/)||i.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)||!r[vTe]&&i.indexOf("/")<0)return;let a=t.createParsingResult(n,i),s=parseInt(r[this.groupNumberMonth]),u=parseInt(r[this.groupNumberDay]);if((s<1||s>12)&&s>12)if(u>=1&&u<=12&&s<=31)[u,s]=[s,u];else return null;if(u<1||u>31)return null;if(a.start.assign("day",u),a.start.assign("month",s),r[vTe]){let l=parseInt(r[vTe]),c=qne(l);a.start.assign("year",c)}else{let l=hT(t.refDate,u,s);a.start.imply("year",l)}return a}};var $nn=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${BC})(?=\\W|$)`,"i"),qnn=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${yT})(?=\\W|$)`,"i"),b8=class extends Ao{constructor(t=!0){super(),this.allowAbbreviations=t}innerPattern(){return this.allowAbbreviations?$nn:qnn}innerExtract(t,r){let n=r[1].toLowerCase(),o=lm(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=bT(o);break}return jn.createRelativeFromReference(t.reference,o)}};function Unn(e){return e.text.match(/^[+-]/i)!=null}function gRt(e){return e.text.match(/^-/i)!=null}var _8=class extends cm{shouldMergeResults(t,r,n){return t.match(/^\s*$/i)?Unn(n)||gRt(n):!1}mergeResults(t,r,n,o){let i=lm(n.text);gRt(n)&&(i=bT(i));let a=jn.createRelativeFromReference(new pT(r.start.date()),i);return new kC(r.reference,r.index,`${r.text}${t}${n.text}`,a)}};function yRt(e){return e.text.match(/\s+(before|from)$/i)!=null}function znn(e){return e.text.match(/\s+(after|since)$/i)!=null}var v8=class extends cm{patternBetween(){return/^\s*$/i}shouldMergeResults(t,r,n){return!t.match(this.patternBetween())||!yRt(r)&&!znn(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(t,r,n){let o=lm(r.text);yRt(r)&&(o=bT(o));let i=jn.createRelativeFromReference(new pT(n.start.date()),o);return new kC(n.reference,r.index,`${r.text}${t}${n.text}`,i)}};var Hnn=new RegExp(`^\\s*(${mT})`,"i"),Vnn=1,w8=class{refine(t,r){return r.forEach(function(n){if(!n.start.isDateWithUnknownYear())return;let o=t.text.substring(n.index+n.text.length),i=Hnn.exec(o);if(!i)return;t.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=gT(i[Vnn]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}};var C1=class{createCasualConfiguration(t=!1){let r=this.createConfiguration(!1,t);return r.parsers.push(new p8),r.parsers.push(new h8),r.parsers.push(new Z3),r.parsers.push(new g8),r.parsers.push(new b8),r}createConfiguration(t=!0,r=!1){let n=ZAt({parsers:[new y8(r),new G3(t),new K3,new Y3(r),new m8,new Q3,new t8(t),new r8(t),new n8(t)],refiners:[new sB]},t);return n.parsers.unshift(new X3(t)),n.refiners.unshift(new v8),n.refiners.unshift(new _8),n.refiners.unshift(new _T),n.refiners.push(new sB),n.refiners.push(new w8),n.refiners.push(new i8),n}};var lB=class e{constructor(t){this.defaultConfig=new C1,t=t||this.defaultConfig.createCasualConfiguration(),this.parsers=[...t.parsers],this.refiners=[...t.refiners]}clone(){return new e({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(t,r,n){let o=this.parse(t,r,n);return o.length>0?o[0].start.date():null}parse(t,r,n){let o=new wTe(t,r,n),i=[];return this.parsers.forEach(a=>{let s=e.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(t,r){let n=[],o=r.pattern(t),i=t.text,a=t.text,s=o.exec(a);for(;s;){let u=s.index+i.length-a.length;s.index=u;let l=r.extract(t,s);if(!l){a=i.substring(s.index+1),s=o.exec(a);continue}let c=null;l instanceof kC?c=l:l instanceof jn?(c=t.createParsingResult(s.index,s[0]),c.start=l):c=t.createParsingResult(s.index,s[0],l);let d=c.index,f=c.text;t.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}},wTe=class{constructor(t,r,n){this.text=t,this.reference=new pT(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(t){return t instanceof jn?t:new jn(this.reference,t)}createParsingResult(t,r,n,o){let i=typeof r=="string"?r:this.text.substring(t,r),a=n?this.createParsingComponents(n):null,s=o?this.createParsingComponents(o):null;return new kC(this.reference,t,i,a,s)}debug(t){this.option.debug&&(this.option.debug instanceof Function?this.option.debug(t):this.option.debug.debug(t))}};var STe=new C1,bRt=new lB(STe.createCasualConfiguration(!1)),Wnn=new lB(STe.createConfiguration(!0,!1)),hNo=new lB(STe.createCasualConfiguration(!0));var Gnn=bRt;function xTe(e,t,r){return Gnn.parse(e,t,r)}var $C=class extends Error{},Jne=class extends $C{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}},Gne=class extends $C{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}},Kne=class extends $C{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}},Ng=class extends $C{},cB=class extends $C{constructor(t){super(`Invalid unit ${t}`)}},La=class extends $C{},Lg=class extends $C{constructor(){super("Zone is an abstract class")}};var Ve="numeric",Fg="short",Np="long",vT={year:Ve,month:Ve,day:Ve},S8={year:Ve,month:Fg,day:Ve},CTe={year:Ve,month:Fg,day:Ve,weekday:Fg},x8={year:Ve,month:Np,day:Ve},C8={year:Ve,month:Np,day:Ve,weekday:Np},O8={hour:Ve,minute:Ve},E8={hour:Ve,minute:Ve,second:Ve},P8={hour:Ve,minute:Ve,second:Ve,timeZoneName:Fg},T8={hour:Ve,minute:Ve,second:Ve,timeZoneName:Np},M8={hour:Ve,minute:Ve,hourCycle:"h23"},I8={hour:Ve,minute:Ve,second:Ve,hourCycle:"h23"},A8={hour:Ve,minute:Ve,second:Ve,hourCycle:"h23",timeZoneName:Fg},R8={hour:Ve,minute:Ve,second:Ve,hourCycle:"h23",timeZoneName:Np},D8={year:Ve,month:Ve,day:Ve,hour:Ve,minute:Ve},j8={year:Ve,month:Ve,day:Ve,hour:Ve,minute:Ve,second:Ve},N8={year:Ve,month:Fg,day:Ve,hour:Ve,minute:Ve},L8={year:Ve,month:Fg,day:Ve,hour:Ve,minute:Ve,second:Ve},OTe={year:Ve,month:Fg,day:Ve,weekday:Fg,hour:Ve,minute:Ve},F8={year:Ve,month:Np,day:Ve,hour:Ve,minute:Ve,timeZoneName:Fg},k8={year:Ve,month:Np,day:Ve,hour:Ve,minute:Ve,second:Ve,timeZoneName:Fg},B8={year:Ve,month:Np,day:Ve,weekday:Np,hour:Ve,minute:Ve,timeZoneName:Np},$8={year:Ve,month:Np,day:Ve,weekday:Np,hour:Ve,minute:Ve,second:Ve,timeZoneName:Np};var Hf=class{get type(){throw new Lg}get name(){throw new Lg}get ianaName(){return this.name}get isUniversal(){throw new Lg}offsetName(t,r){throw new Lg}formatOffset(t,r){throw new Lg}offset(t){throw new Lg}equals(t){throw new Lg}get isValid(){throw new Lg}};var ETe=null,wT=class e extends Hf{static get instance(){return ETe===null&&(ETe=new e),ETe}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:r,locale:n}){return Zne(t,r,n)}formatOffset(t,r){return ST(this.offset(t),r)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isValid(){return!0}};var Qne={};function Ynn(e){return Qne[e]||(Qne[e]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),Qne[e]}var Znn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Xnn(e,t){let r=e.format(t).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 Qnn(e,t){let r=e.formatToParts(t),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=Znn[i];i==="era"?n[s]=a:Lt(s)||(n[s]=parseInt(a,10))}return n}var Xne={},ad=class e extends Hf{static create(t){return Xne[t]||(Xne[t]=new e(t)),Xne[t]}static resetCache(){Xne={},Qne={}}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=e.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:r,locale:n}){return Zne(t,r,n,this.name)}formatOffset(t,r){return ST(this.offset(t),r)}offset(t){let r=new Date(t);if(isNaN(r))return NaN;let n=Ynn(this.name),[o,i,a,s,u,l,c]=n.formatToParts?Qnn(n,r):Xnn(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=dB({year:o,month:i,day:a,hour:u===24?0:u,minute:l,second:c,millisecond:0}),p=+r,h=p%1e3;return p-=h>=0?h:1e3+h,(f-p)/(60*1e3)}equals(t){return t.type==="iana"&&t.name===this.name}get isValid(){return this.valid}};var _Rt={};function eon(e,t={}){let r=JSON.stringify([e,t]),n=_Rt[r];return n||(n=new Intl.ListFormat(e,t),_Rt[r]=n),n}var PTe={};function TTe(e,t={}){let r=JSON.stringify([e,t]),n=PTe[r];return n||(n=new Intl.DateTimeFormat(e,t),PTe[r]=n),n}var MTe={};function ton(e,t={}){let r=JSON.stringify([e,t]),n=MTe[r];return n||(n=new Intl.NumberFormat(e,t),MTe[r]=n),n}var ITe={};function ron(e,t={}){let{base:r,...n}=t,o=JSON.stringify([e,n]),i=ITe[o];return i||(i=new Intl.RelativeTimeFormat(e,t),ITe[o]=i),i}var q8=null;function non(){return q8||(q8=new Intl.DateTimeFormat().resolvedOptions().locale,q8)}var vRt={};function oon(e){let t=vRt[e];if(!t){let r=new Intl.Locale(e);t="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,vRt[e]=t}return t}function ion(e){let t=e.indexOf("-x-");t!==-1&&(e=e.substring(0,t));let r=e.indexOf("-u-");if(r===-1)return[e];{let n,o;try{n=TTe(e).resolvedOptions(),o=e}catch{let u=e.substring(0,r);n=TTe(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function aon(e,t,r){return(r||t)&&(e.includes("-u-")||(e+="-u"),r&&(e+=`-ca-${r}`),t&&(e+=`-nu-${t}`)),e}function son(e){let t=[];for(let r=1;r<=12;r++){let n=Or.utc(2009,r,1);t.push(e(n))}return t}function uon(e){let t=[];for(let r=1;r<=7;r++){let n=Or.utc(2016,11,13+r);t.push(e(n))}return t}function eoe(e,t,r,n){let o=e.listingMode();return o==="error"?null:o==="en"?r(t):n(t)}function lon(e){return e.numberingSystem&&e.numberingSystem!=="latn"?!1:e.numberingSystem==="latn"||!e.locale||e.locale.startsWith("en")||new Intl.DateTimeFormat(e.intl).resolvedOptions().numberingSystem==="latn"}var ATe=class{constructor(t,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=ton(t,s)}}format(t){if(this.inf){let r=this.floor?Math.floor(t):t;return this.inf.format(r)}else{let r=this.floor?Math.floor(t):fB(t,3);return ya(r,this.padTo)}}},RTe=class{constructor(t,r,n){this.opts=n,this.originalZone=void 0;let o;if(this.opts.timeZone)this.dt=t;else if(t.zone.type==="fixed"){let a=-1*(t.offset/60),s=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;t.offset!==0&&ad.create(s).valid?(o=s,this.dt=t):(o="UTC",this.dt=t.offset===0?t:t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone)}else t.zone.type==="system"?this.dt=t:t.zone.type==="iana"?(this.dt=t,o=t.zone.name):(o="UTC",this.dt=t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone);let i={...this.opts};i.timeZone=i.timeZone||o,this.dtf=TTe(r,i)}format(){return this.originalZone?this.formatToParts().map(({value:t})=>t).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let t=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?t.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}):t}resolvedOptions(){return this.dtf.resolvedOptions()}},DTe=class{constructor(t,r,n){this.opts={style:"long",...n},!r&&toe()&&(this.rtf=ron(t,n))}format(t,r){return this.rtf?this.rtf.format(t,r):wRt(r,t,this.opts.numeric,this.opts.style!=="long")}formatToParts(t,r){return this.rtf?this.rtf.formatToParts(t,r):[]}},con={firstDay:1,minimalDays:4,weekend:[6,7]},go=class e{static fromOpts(t){return e.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,r,n,o,i=!1){let a=t||mo.defaultLocale,s=a||(i?"en-US":non()),u=r||mo.defaultNumberingSystem,l=n||mo.defaultOutputCalendar,c=U8(o)||mo.defaultWeekSettings;return new e(s,u,l,c,a)}static resetCache(){q8=null,PTe={},MTe={},ITe={}}static fromObject({locale:t,numberingSystem:r,outputCalendar:n,weekSettings:o}={}){return e.create(t,r,n,o)}constructor(t,r,n,o,i){let[a,s,u]=ion(t);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=aon(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=lon(this)),this.fastNumbersCached}listingMode(){let t=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return t&&r?"en":"intl"}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:e.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,U8(t.weekSettings)||this.weekSettings,t.defaultToEN||!1)}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,r=!1){return eoe(this,t,jTe,()=>{let n=r?{month:t,day:"numeric"}:{month:t},o=r?"format":"standalone";return this.monthsCache[o][t]||(this.monthsCache[o][t]=son(i=>this.extract(i,n,"month"))),this.monthsCache[o][t]})}weekdays(t,r=!1){return eoe(this,t,NTe,()=>{let n=r?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},o=r?"format":"standalone";return this.weekdaysCache[o][t]||(this.weekdaysCache[o][t]=uon(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][t]})}meridiems(){return eoe(this,void 0,()=>LTe,()=>{if(!this.meridiemCache){let t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Or.utc(2016,11,13,9),Or.utc(2016,11,13,19)].map(r=>this.extract(r,t,"dayperiod"))}return this.meridiemCache})}eras(t){return eoe(this,t,FTe,()=>{let r={era:t};return this.eraCache[t]||(this.eraCache[t]=[Or.utc(-40,1,1),Or.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[t]})}extract(t,r,n){let o=this.dtFormatter(t,r),i=o.formatToParts(),a=i.find(s=>s.type.toLowerCase()===n);return a?a.value:null}numberFormatter(t={}){return new ATe(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,r={}){return new RTe(t,this.intl,r)}relFormatter(t={}){return new DTe(this.intl,this.isEnglish(),t)}listFormatter(t={}){return eon(this.intl,t)}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:roe()?oon(this.locale):con}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}};var BTe=null,Ml=class e extends Hf{static get utcInstance(){return BTe===null&&(BTe=new e(0)),BTe}static instance(t){return t===0?e.utcInstance:new e(t)}static parseSpecifier(t){if(t){let r=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new e(O1(r[1],r[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${ST(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${ST(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,r){return ST(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return t.type==="fixed"&&t.fixed===this.fixed}get isValid(){return!0}};var pB=class extends Hf{constructor(t){super(),this.zoneName=t}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 kg(e,t){let r;if(Lt(e)||e===null)return t;if(e instanceof Hf)return e;if(SRt(e)){let n=e.toLowerCase();return n==="default"?t:n==="local"||n==="system"?wT.instance:n==="utc"||n==="gmt"?Ml.utcInstance:Ml.parseSpecifier(n)||ad.create(e)}else return Bg(e)?Ml.instance(e):typeof e=="object"&&"offset"in e&&typeof e.offset=="function"?e:new pB(e)}var $Te={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"},xRt={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]},don=$Te.hanidec.replace(/[\[|\]]/g,"").split("");function CRt(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(e[r].search($Te.hanidec)!==-1)t+=don.indexOf(e[r]);else for(let o in xRt){let[i,a]=xRt[o];n>=i&&n<=a&&(t+=n-i)}}return parseInt(t,10)}else return t}var hB={};function ORt(){hB={}}function dm({numberingSystem:e},t=""){let r=e||"latn";return hB[r]||(hB[r]={}),hB[r][t]||(hB[r][t]=new RegExp(`${$Te[r]}${t}`)),hB[r][t]}var ERt=()=>Date.now(),PRt="system",TRt=null,MRt=null,IRt=null,ARt=60,RRt,DRt=null,mo=class{static get now(){return ERt}static set now(t){ERt=t}static set defaultZone(t){PRt=t}static get defaultZone(){return kg(PRt,wT.instance)}static get defaultLocale(){return TRt}static set defaultLocale(t){TRt=t}static get defaultNumberingSystem(){return MRt}static set defaultNumberingSystem(t){MRt=t}static get defaultOutputCalendar(){return IRt}static set defaultOutputCalendar(t){IRt=t}static get defaultWeekSettings(){return DRt}static set defaultWeekSettings(t){DRt=U8(t)}static get twoDigitCutoffYear(){return ARt}static set twoDigitCutoffYear(t){ARt=t%100}static get throwOnInvalid(){return RRt}static set throwOnInvalid(t){RRt=t}static resetCaches(){go.resetCache(),ad.resetCache(),Or.resetCache(),ORt()}};var Il=class{constructor(t,r){this.reason=t,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var jRt=[0,31,59,90,120,151,181,212,243,273,304,334],NRt=[0,31,60,91,121,152,182,213,244,274,305,335];function fm(e,t){return new Il("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function noe(e,t,r){let n=new Date(Date.UTC(e,t-1,r));e<100&&e>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let o=n.getUTCDay();return o===0?7:o}function LRt(e,t,r){return r+(P1(e)?NRt:jRt)[t-1]}function FRt(e,t){let r=P1(e)?NRt:jRt,n=r.findIndex(i=>i<t),o=t-r[n];return{month:n+1,day:o}}function ooe(e,t){return(e-t+7)%7+1}function z8(e,t=4,r=1){let{year:n,month:o,day:i}=e,a=LRt(n,o,i),s=ooe(noe(n,o,i),r),u=Math.floor((a-s+14-t)/7),l;return u<1?(l=n-1,u=E1(l,t,r)):u>E1(n,t,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...V8(e)}}function qTe(e,t=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=e,a=ooe(noe(n,1,t),r),s=xT(n),u=o*7+i-a-7+t,l;u<1?(l=n-1,u+=xT(l)):u>s?(l=n+1,u-=xT(n)):l=n;let{month:c,day:d}=FRt(l,u);return{year:l,month:c,day:d,...V8(e)}}function ioe(e){let{year:t,month:r,day:n}=e,o=LRt(t,r,n);return{year:t,ordinal:o,...V8(e)}}function UTe(e){let{year:t,ordinal:r}=e,{month:n,day:o}=FRt(t,r);return{year:t,month:n,day:o,...V8(e)}}function zTe(e,t){if(!Lt(e.localWeekday)||!Lt(e.localWeekNumber)||!Lt(e.localWeekYear)){if(!Lt(e.weekday)||!Lt(e.weekNumber)||!Lt(e.weekYear))throw new Ng("Cannot mix locale-based week fields with ISO-based week fields");return Lt(e.localWeekday)||(e.weekday=e.localWeekday),Lt(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),Lt(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function kRt(e,t=4,r=1){let n=H8(e.weekYear),o=Lp(e.weekNumber,1,E1(e.weekYear,t,r)),i=Lp(e.weekday,1,7);return n?o?i?!1:fm("weekday",e.weekday):fm("week",e.weekNumber):fm("weekYear",e.weekYear)}function BRt(e){let t=H8(e.year),r=Lp(e.ordinal,1,xT(e.year));return t?r?!1:fm("ordinal",e.ordinal):fm("year",e.year)}function HTe(e){let t=H8(e.year),r=Lp(e.month,1,12),n=Lp(e.day,1,mB(e.year,e.month));return t?r?n?!1:fm("day",e.day):fm("month",e.month):fm("year",e.year)}function VTe(e){let{hour:t,minute:r,second:n,millisecond:o}=e,i=Lp(t,0,23)||t===24&&r===0&&n===0&&o===0,a=Lp(r,0,59),s=Lp(n,0,59),u=Lp(o,0,999);return i?a?s?u?!1:fm("millisecond",o):fm("second",n):fm("minute",r):fm("hour",t)}function Lt(e){return typeof e>"u"}function Bg(e){return typeof e=="number"}function H8(e){return typeof e=="number"&&e%1===0}function SRt(e){return typeof e=="string"}function qRt(e){return Object.prototype.toString.call(e)==="[object Date]"}function toe(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function roe(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function URt(e){return Array.isArray(e)?e:[e]}function WTe(e,t,r){if(e.length!==0)return e.reduce((n,o)=>{let i=[t(o),o];return n&&r(n[0],i[0])===n[0]?n:i},null)[1]}function zRt(e,t){return t.reduce((r,n)=>(r[n]=e[n],r),{})}function CT(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function U8(e){if(e==null)return null;if(typeof e!="object")throw new La("Week settings must be an object");if(!Lp(e.firstDay,1,7)||!Lp(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(t=>!Lp(t,1,7)))throw new La("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function Lp(e,t,r){return H8(e)&&e>=t&&e<=r}function fon(e,t){return e-t*Math.floor(e/t)}function ya(e,t=2){let r=e<0,n;return r?n="-"+(""+-e).padStart(t,"0"):n=(""+e).padStart(t,"0"),n}function qC(e){if(!(Lt(e)||e===null||e===""))return parseInt(e,10)}function OT(e){if(!(Lt(e)||e===null||e===""))return parseFloat(e)}function W8(e){if(!(Lt(e)||e===null||e==="")){let t=parseFloat("0."+e)*1e3;return Math.floor(t)}}function fB(e,t,r=!1){let n=10**t;return(r?Math.trunc:Math.round)(e*n)/n}function P1(e){return e%4===0&&(e%100!==0||e%400===0)}function xT(e){return P1(e)?366:365}function mB(e,t){let r=fon(t-1,12)+1,n=e+(t-r)/12;return r===2?P1(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function dB(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function $Rt(e,t,r){return-ooe(noe(e,1,t),r)+t-1}function E1(e,t=4,r=1){let n=$Rt(e,t,r),o=$Rt(e+1,t,r);return(xT(e)-n+o)/7}function J8(e){return e>99?e:e>mo.twoDigitCutoffYear?1900+e:2e3+e}function Zne(e,t,r,n=null){let o=new Date(e),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(i.timeZone=n);let a={timeZoneName:t,...i},s=new Intl.DateTimeFormat(r,a).formatToParts(o).find(u=>u.type.toLowerCase()==="timezonename");return s?s.value:null}function O1(e,t){let r=parseInt(e,10);Number.isNaN(r)&&(r=0);let n=parseInt(t,10)||0,o=r<0||Object.is(r,-0)?-n:n;return r*60+o}function JTe(e){let t=Number(e);if(typeof e=="boolean"||e===""||Number.isNaN(t))throw new La(`Invalid unit value ${e}`);return t}function gB(e,t){let r={};for(let n in e)if(CT(e,n)){let o=e[n];if(o==null)continue;r[t(n)]=JTe(o)}return r}function ST(e,t){let r=Math.trunc(Math.abs(e/60)),n=Math.trunc(Math.abs(e%60)),o=e>=0?"+":"-";switch(t){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 ${t} is out of range for property format`)}}function V8(e){return zRt(e,["hour","minute","second","millisecond"])}var pon=["January","February","March","April","May","June","July","August","September","October","November","December"],GTe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],hon=["J","F","M","A","M","J","J","A","S","O","N","D"];function jTe(e){switch(e){case"narrow":return[...hon];case"short":return[...GTe];case"long":return[...pon];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 KTe=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],YTe=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],mon=["M","T","W","T","F","S","S"];function NTe(e){switch(e){case"narrow":return[...mon];case"short":return[...YTe];case"long":return[...KTe];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var LTe=["AM","PM"],gon=["Before Christ","Anno Domini"],yon=["BC","AD"],bon=["B","A"];function FTe(e){switch(e){case"narrow":return[...bon];case"short":return[...yon];case"long":return[...gon];default:return null}}function HRt(e){return LTe[e.hour<12?0:1]}function VRt(e,t){return NTe(t)[e.weekday-1]}function WRt(e,t){return jTe(t)[e.month-1]}function JRt(e,t){return FTe(t)[e.year<0?0:1]}function wRt(e,t,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(e)===-1;if(r==="auto"&&i){let d=e==="days";switch(t){case 1:return d?"tomorrow":`next ${o[e][0]}`;case-1:return d?"yesterday":`last ${o[e][0]}`;case 0:return d?"today":`this ${o[e][0]}`;default:}}let a=Object.is(t,-0)||t<0,s=Math.abs(t),u=s===1,l=o[e],c=n?u?l[1]:l[2]||l[1]:u?o[e][0]:e;return a?`${s} ${c} ago`:`in ${s} ${c}`}function GRt(e,t){let r="";for(let n of e)n.literal?r+=n.val:r+=t(n.val);return r}var _on={D:vT,DD:S8,DDD:x8,DDDD:C8,t:O8,tt:E8,ttt:P8,tttt:T8,T:M8,TT:I8,TTT:A8,TTTT:R8,f:D8,ff:N8,fff:F8,ffff:B8,F:j8,FF:L8,FFF:k8,FFFF:$8},Al=class e{static create(t,r={}){return new e(t,r)}static parseFormat(t){let r=null,n="",o=!1,i=[];for(let a=0;a<t.length;a++){let s=t.charAt(a);s==="'"?(n.length>0&&i.push({literal:o||/^\s+$/.test(n),val:n}),r=null,n="",o=!o):o||s===r?n+=s:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=s,r=s)}return n.length>0&&i.push({literal:o||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(t){return _on[t]}constructor(t,r){this.opts=r,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(t,{...this.opts,...r}).format()}dtFormatter(t,r={}){return this.loc.dtFormatter(t,{...this.opts,...r})}formatDateTime(t,r){return this.dtFormatter(t,r).format()}formatDateTimeParts(t,r){return this.dtFormatter(t,r).formatToParts()}formatInterval(t,r){return this.dtFormatter(t.start,r).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,r){return this.dtFormatter(t,r).resolvedOptions()}num(t,r=0){if(this.opts.forceSimple)return ya(t,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(t)}formatDateTimeFromString(t,r){let n=this.loc.listingMode()==="en",o=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(p,h)=>this.loc.extract(t,p,h),a=p=>t.isOffsetFixed&&t.offset===0&&p.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,p.format):"",s=()=>n?HRt(t):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,h)=>n?WRt(t,p):i(h?{month:p}:{month:p,day:"numeric"},"month"),l=(p,h)=>n?VRt(t,p):i(h?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),c=p=>{let h=e.macroTokenToFormatOpts(p);return h?this.formatWithSystemDefault(t,h):p},d=p=>n?JRt(t,p):i({era:p},"era"),f=p=>{switch(p){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12===0?12:t.hour%12);case"hh":return this.num(t.hour%12===0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.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 t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return s();case"d":return o?i({day:"numeric"},"day"):this.num(t.day);case"dd":return o?i({day:"2-digit"},"day"):this.num(t.day,2);case"c":return this.num(t.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(t.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(t.month);case"LL":return o?i({month:"2-digit",day:"numeric"},"month"):this.num(t.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(t.month);case"MM":return o?i({month:"2-digit"},"month"):this.num(t.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(t.year);case"yy":return o?i({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return o?i({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return o?i({year:"numeric"},"year"):this.num(t.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"n":return this.num(t.localWeekNumber);case"nn":return this.num(t.localWeekNumber,2);case"ii":return this.num(t.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(t.localWeekYear,4);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return c(p)}};return GRt(e.parseFormat(r),f)}formatDurationFromString(t,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=e.parseFormat(r),a=i.reduce((u,{literal:l,val:c})=>l?u:u.concat(c),[]),s=t.shiftTo(...a.map(n).filter(u=>u));return GRt(i,o(s))}};var YRt=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function bB(...e){let t=e.reduce((r,n)=>r+n.source,"");return RegExp(`^${t}$`)}function _B(...e){return t=>e.reduce(([r,n,o],i)=>{let[a,s,u]=i(t,o);return[{...r,...a},s||n,u]},[{},null,1]).slice(0,2)}function vB(e,...t){if(e==null)return[null,null];for(let[r,n]of t){let o=r.exec(e);if(o)return n(o)}return[null,null]}function ZRt(...e){return(t,r)=>{let n={},o;for(o=0;o<e.length;o++)n[e[o]]=qC(t[r+o]);return[n,null,r+o]}}var XRt=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,von=`(?:${XRt.source}?(?:\\[(${YRt.source})\\])?)?`,ZTe=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,QRt=RegExp(`${ZTe.source}${von}`),XTe=RegExp(`(?:T${QRt.source})?`),won=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Son=/(\d{4})-?W(\d\d)(?:-?(\d))?/,xon=/(\d{4})-?(\d{3})/,Con=ZRt("weekYear","weekNumber","weekDay"),Oon=ZRt("year","ordinal"),Eon=/(\d{4})-(\d\d)-(\d\d)/,e1t=RegExp(`${ZTe.source} ?(?:${XRt.source}|(${YRt.source}))?`),Pon=RegExp(`(?: ${e1t.source})?`);function yB(e,t,r){let n=e[t];return Lt(n)?r:qC(n)}function Ton(e,t){return[{year:yB(e,t),month:yB(e,t+1,1),day:yB(e,t+2,1)},null,t+3]}function wB(e,t){return[{hours:yB(e,t,0),minutes:yB(e,t+1,0),seconds:yB(e,t+2,0),milliseconds:W8(e[t+3])},null,t+4]}function G8(e,t){let r=!e[t]&&!e[t+1],n=O1(e[t+1],e[t+2]),o=r?null:Ml.instance(n);return[{},o,t+3]}function K8(e,t){let r=e[t]?ad.create(e[t]):null;return[{},r,t+1]}var Mon=RegExp(`^T?${ZTe.source}$`),Ion=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Aon(e){let[t,r,n,o,i,a,s,u,l]=e,c=t[0]==="-",d=u&&u[0]==="-",f=(p,h=!1)=>p!==void 0&&(h||p&&c)?-p:p;return[{years:f(OT(r)),months:f(OT(n)),weeks:f(OT(o)),days:f(OT(i)),hours:f(OT(a)),minutes:f(OT(s)),seconds:f(OT(u),u==="-0"),milliseconds:f(W8(l),d)}]}var Ron={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 QTe(e,t,r,n,o,i,a){let s={year:t.length===2?J8(qC(t)):qC(t),month:GTe.indexOf(r)+1,day:qC(n),hour:qC(o),minute:qC(i)};return a&&(s.second=qC(a)),e&&(s.weekday=e.length>3?KTe.indexOf(e)+1:YTe.indexOf(e)+1),s}var Don=/^(?:(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 jon(e){let[,t,r,n,o,i,a,s,u,l,c,d]=e,f=QTe(t,o,n,r,i,a,s),p;return u?p=Ron[u]:l?p=0:p=O1(c,d),[f,new Ml(p)]}function Non(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var Lon=/^(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$/,Fon=/^(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$/,kon=/^(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 KRt(e){let[,t,r,n,o,i,a,s]=e;return[QTe(t,o,n,r,i,a,s),Ml.utcInstance]}function Bon(e){let[,t,r,n,o,i,a,s]=e;return[QTe(t,s,r,n,o,i,a),Ml.utcInstance]}var $on=bB(won,XTe),qon=bB(Son,XTe),Uon=bB(xon,XTe),zon=bB(QRt),t1t=_B(Ton,wB,G8,K8),Hon=_B(Con,wB,G8,K8),Von=_B(Oon,wB,G8,K8),Won=_B(wB,G8,K8);function r1t(e){return vB(e,[$on,t1t],[qon,Hon],[Uon,Von],[zon,Won])}function n1t(e){return vB(Non(e),[Don,jon])}function o1t(e){return vB(e,[Lon,KRt],[Fon,KRt],[kon,Bon])}function i1t(e){return vB(e,[Ion,Aon])}var Jon=_B(wB);function a1t(e){return vB(e,[Mon,Jon])}var Gon=bB(Eon,Pon),Kon=bB(e1t),Yon=_B(wB,G8,K8);function s1t(e){return vB(e,[Gon,t1t],[Kon,Yon])}var u1t="Invalid Duration",c1t={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}},Zon={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},...c1t},pm=146097/400,SB=146097/4800,Xon={years:{quarters:4,months:12,weeks:pm/7,days:pm,hours:pm*24,minutes:pm*24*60,seconds:pm*24*60*60,milliseconds:pm*24*60*60*1e3},quarters:{months:3,weeks:pm/28,days:pm/4,hours:pm*24/4,minutes:pm*24*60/4,seconds:pm*24*60*60/4,milliseconds:pm*24*60*60*1e3/4},months:{weeks:SB/7,days:SB,hours:SB*24,minutes:SB*24*60,seconds:SB*24*60*60,milliseconds:SB*24*60*60*1e3},...c1t},T1=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Qon=T1.slice(0).reverse();function ET(e,t,r=!1){let n={values:r?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new ba(n)}function d1t(e,t){let r=t.milliseconds??0;for(let n of Qon.slice(1))t[n]&&(r+=t[n]*e[n].milliseconds);return r}function l1t(e,t){let r=d1t(e,t)<0?-1:1;T1.reduceRight((n,o)=>{if(Lt(t[o]))return n;if(n){let i=t[n]*r,a=e[o][n],s=Math.floor(i/a);t[o]+=s*r,t[n]-=s*a*r}return o},null),T1.reduce((n,o)=>{if(Lt(t[o]))return n;if(n){let i=t[n]%1;t[n]-=i,t[o]+=i*e[n][o]}return o},null)}function ein(e){let t={};for(let[r,n]of Object.entries(e))n!==0&&(t[r]=n);return t}var ba=class e{constructor(t){let r=t.conversionAccuracy==="longterm"||!1,n=r?Xon:Zon;t.matrix&&(n=t.matrix),this.values=t.values,this.loc=t.loc||go.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,r){return e.fromObject({milliseconds:t},r)}static fromObject(t,r={}){if(t==null||typeof t!="object")throw new La(`Duration.fromObject: argument expected to be an object, got ${t===null?"null":typeof t}`);return new e({values:gB(t,e.normalizeUnit),loc:go.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(t){if(Bg(t))return e.fromMillis(t);if(e.isDuration(t))return t;if(typeof t=="object")return e.fromObject(t);throw new La(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,r){let[n]=i1t(t);return n?e.fromObject(n,r):e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,r){let[n]=a1t(t);return n?e.fromObject(n,r):e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,r=null){if(!t)throw new La("need to specify a reason the Duration is invalid");let n=t instanceof Il?t:new Il(t,r);if(mo.throwOnInvalid)throw new Kne(n);return new e({invalid:n})}static normalizeUnit(t){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"}[t&&t.toLowerCase()];if(!r)throw new cB(t);return r}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?Al.create(this.loc,n).formatDurationFromString(this,t):u1t}toHuman(t={}){if(!this.isValid)return u1t;let r=T1.map(n=>{let o=this.values[n];return Lt(o)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:n.slice(0,-1)}).format(o)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return this.years!==0&&(t+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(t+=this.months+this.quarters*3+"M"),this.weeks!==0&&(t+=this.weeks+"W"),this.days!==0&&(t+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(t+="T"),this.hours!==0&&(t+=this.hours+"H"),this.minutes!==0&&(t+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(t+=fB(this.seconds+this.milliseconds/1e3,3)+"S"),t==="P"&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t,includeOffset:!1},Or.fromMillis(r,{zone:"UTC"}).toISOTime(t))}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?d1t(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;let r=e.fromDurationLike(t),n={};for(let o of T1)(CT(r.values,o)||CT(this.values,o))&&(n[o]=r.get(o)+this.get(o));return ET(this,{values:n},!0)}minus(t){if(!this.isValid)return this;let r=e.fromDurationLike(t);return this.plus(r.negate())}mapUnits(t){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=JTe(t(this.values[n],n));return ET(this,{values:r},!0)}get(t){return this[e.normalizeUnit(t)]}set(t){if(!this.isValid)return this;let r={...this.values,...gB(t,e.normalizeUnit)};return ET(this,{values:r})}reconfigure({locale:t,numberingSystem:r,conversionAccuracy:n,matrix:o}={}){let a={loc:this.loc.clone({locale:t,numberingSystem:r}),matrix:o,conversionAccuracy:n};return ET(this,a)}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;let t=this.toObject();return l1t(this.matrix,t),ET(this,{values:t},!0)}rescale(){if(!this.isValid)return this;let t=ein(this.normalize().shiftToAll().toObject());return ET(this,{values:t},!0)}shiftTo(...t){if(!this.isValid)return this;if(t.length===0)return this;t=t.map(a=>e.normalizeUnit(a));let r={},n={},o=this.toObject(),i;for(let a of T1)if(t.indexOf(a)>=0){i=a;let s=0;for(let l in n)s+=this.matrix[l][a]*n[l],n[l]=0;Bg(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else Bg(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 l1t(this.matrix,r),ET(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 t={};for(let r of Object.keys(this.values))t[r]=this.values[r]===0?0:-this.values[r];return ET(this,{values:t},!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(t){if(!this.isValid||!t.isValid||!this.loc.equals(t.loc))return!1;function r(n,o){return n===void 0||n===0?o===void 0||o===0:n===o}for(let n of T1)if(!r(this.values[n],t.values[n]))return!1;return!0}};var xB="Invalid Interval";function tin(e,t){return!e||!e.isValid?UC.invalid("missing or invalid start"):!t||!t.isValid?UC.invalid("missing or invalid end"):t<e?UC.invalid("end before start",`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null}var UC=class e{constructor(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}static invalid(t,r=null){if(!t)throw new La("need to specify a reason the Interval is invalid");let n=t instanceof Il?t:new Il(t,r);if(mo.throwOnInvalid)throw new Gne(n);return new e({invalid:n})}static fromDateTimes(t,r){let n=CB(t),o=CB(r),i=tin(n,o);return i??new e({start:n,end:o})}static after(t,r){let n=ba.fromDurationLike(r),o=CB(t);return e.fromDateTimes(o,o.plus(n))}static before(t,r){let n=ba.fromDurationLike(r),o=CB(t);return e.fromDateTimes(o.minus(n),o)}static fromISO(t,r){let[n,o]=(t||"").split("/",2);if(n&&o){let i,a;try{i=Or.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=Or.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return e.fromDateTimes(i,s);if(a){let l=ba.fromISO(o,r);if(l.isValid)return e.after(i,l)}else if(u){let l=ba.fromISO(n,r);if(l.isValid)return e.before(s,l)}}return e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(t){return t&&t.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(t="milliseconds"){return this.isValid?this.toDuration(t).get(t):NaN}count(t="milliseconds",r){if(!this.isValid)return NaN;let n=this.start.startOf(t,r),o;return r?.useLocaleWeeks?o=this.end.reconfigure({locale:n.locale}):o=this.end,o=o.startOf(t,r),Math.floor(o.diff(n,t).get(t))+(o.valueOf()!==this.end.valueOf())}hasSame(t){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,t):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(t){return this.isValid?this.s>t:!1}isBefore(t){return this.isValid?this.e<=t:!1}contains(t){return this.isValid?this.s<=t&&this.e>t:!1}set({start:t,end:r}={}){return this.isValid?e.fromDateTimes(t||this.s,r||this.e):this}splitAt(...t){if(!this.isValid)return[];let r=t.map(CB).filter(a=>this.contains(a)).sort((a,s)=>a.toMillis()-s.toMillis()),n=[],{s:o}=this,i=0;for(;o<this.e;){let a=r[i]||this.e,s=+a>+this.e?this.e:a;n.push(e.fromDateTimes(o,s)),o=s,i+=1}return n}splitBy(t){let r=ba.fromDurationLike(t);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,o=1,i,a=[];for(;n<this.e;){let s=this.start.plus(r.mapUnits(u=>u*o));i=+s>+this.e?this.e:s,a.push(e.fromDateTimes(n,i)),n=i,o+=1}return a}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s<t.e}abutsStart(t){return this.isValid?+this.e==+t.s:!1}abutsEnd(t){return this.isValid?+t.e==+this.s:!1}engulfs(t){return this.isValid?this.s<=t.s&&this.e>=t.e:!1}equals(t){return!this.isValid||!t.isValid?!1:this.s.equals(t.s)&&this.e.equals(t.e)}intersection(t){if(!this.isValid)return this;let r=this.s>t.s?this.s:t.s,n=this.e<t.e?this.e:t.e;return r>=n?null:e.fromDateTimes(r,n)}union(t){if(!this.isValid)return this;let r=this.s<t.s?this.s:t.s,n=this.e>t.e?this.e:t.e;return e.fromDateTimes(r,n)}static merge(t){let[r,n]=t.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(t){let r=null,n=0,o=[],i=t.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(e.fromDateTimes(r,u.time)),r=null);return e.merge(o)}difference(...t){return e.xor([this].concat(t)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:xB}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(t=vT,r={}){return this.isValid?Al.create(this.s.loc.clone(r),t).formatInterval(this):xB}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:xB}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:xB}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:xB}toFormat(t,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(t)}${r}${this.e.toFormat(t)}`:xB}toDuration(t,r){return this.isValid?this.e.diff(this.s,t,r):ba.invalid(this.invalidReason)}mapEndpoints(t){return e.fromDateTimes(t(this.s),t(this.e))}};var zC=class{static hasDST(t=mo.defaultZone){let r=Or.now().setZone(t).set({month:12});return!t.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(t){return ad.isValidZone(t)}static normalizeZone(t){return kg(t,mo.defaultZone)}static getStartOfWeek({locale:t=null,locObj:r=null}={}){return(r||go.create(t)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:t=null,locObj:r=null}={}){return(r||go.create(t)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:t=null,locObj:r=null}={}){return(r||go.create(t)).getWeekendDays().slice()}static months(t="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||go.create(r,n,i)).months(t)}static monthsFormat(t="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||go.create(r,n,i)).months(t,!0)}static weekdays(t="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||go.create(r,n,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||go.create(r,n,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return go.create(t).meridiems()}static eras(t="short",{locale:r=null}={}){return go.create(r,null,"gregory").eras(t)}static features(){return{relative:toe(),localeWeek:roe()}}};function f1t(e,t){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(t)-r(e);return Math.floor(ba.fromMillis(n).as("days"))}function rin(e,t,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=f1t(u,l);return(c-c%7)/7}],["days",f1t]],o={},i=e,a,s;for(let[u,l]of n)r.indexOf(u)>=0&&(a=u,o[u]=l(e,t),s=i.plus(o),s>t?(o[u]--,e=i.plus(o),e>t&&(s=e,o[u]--,e=i.plus(o))):e=s);return[e,o,s,a]}function p1t(e,t,r,n){let[o,i,a,s]=rin(e,t,r),u=t-o,l=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);l.length===0&&(a<t&&(a=o.plus({[s]:1})),a!==o&&(i[s]=(i[s]||0)+u/(a-o)));let c=ba.fromObject(i,n);return l.length>0?ba.fromMillis(u,n).shiftTo(...l).plus(c):c}var nin="missing Intl.DateTimeFormat.formatToParts support";function Oo(e,t=r=>r){return{regex:e,deser:([r])=>t(CRt(r))}}var oin="\xA0",g1t=`[ ${oin}]`,y1t=new RegExp(g1t,"g");function iin(e){return e.replace(/\./g,"\\.?").replace(y1t,g1t)}function h1t(e){return e.replace(/\./g,"").replace(y1t," ").toLowerCase()}function $g(e,t){return e===null?null:{regex:RegExp(e.map(iin).join("|")),deser:([r])=>e.findIndex(n=>h1t(r)===h1t(n))+t}}function m1t(e,t){return{regex:e,deser:([,r,n])=>O1(r,n),groups:t}}function aoe(e){return{regex:e,deser:([t])=>t}}function ain(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function sin(e,t){let r=dm(t),n=dm(t,"{2}"),o=dm(t,"{3}"),i=dm(t,"{4}"),a=dm(t,"{6}"),s=dm(t,"{1,2}"),u=dm(t,"{1,3}"),l=dm(t,"{1,6}"),c=dm(t,"{1,9}"),d=dm(t,"{2,4}"),f=dm(t,"{4,6}"),p=_=>({regex:RegExp(ain(_.val)),deser:([g])=>g,literal:!0}),m=(_=>{if(e.literal)return p(_);switch(_.val){case"G":return $g(t.eras("short"),0);case"GG":return $g(t.eras("long"),0);case"y":return Oo(l);case"yy":return Oo(d,J8);case"yyyy":return Oo(i);case"yyyyy":return Oo(f);case"yyyyyy":return Oo(a);case"M":return Oo(s);case"MM":return Oo(n);case"MMM":return $g(t.months("short",!0),1);case"MMMM":return $g(t.months("long",!0),1);case"L":return Oo(s);case"LL":return Oo(n);case"LLL":return $g(t.months("short",!1),1);case"LLLL":return $g(t.months("long",!1),1);case"d":return Oo(s);case"dd":return Oo(n);case"o":return Oo(u);case"ooo":return Oo(o);case"HH":return Oo(n);case"H":return Oo(s);case"hh":return Oo(n);case"h":return Oo(s);case"mm":return Oo(n);case"m":return Oo(s);case"q":return Oo(s);case"qq":return Oo(n);case"s":return Oo(s);case"ss":return Oo(n);case"S":return Oo(u);case"SSS":return Oo(o);case"u":return aoe(c);case"uu":return aoe(s);case"uuu":return Oo(r);case"a":return $g(t.meridiems(),0);case"kkkk":return Oo(i);case"kk":return Oo(d,J8);case"W":return Oo(s);case"WW":return Oo(n);case"E":case"c":return Oo(r);case"EEE":return $g(t.weekdays("short",!1),1);case"EEEE":return $g(t.weekdays("long",!1),1);case"ccc":return $g(t.weekdays("short",!0),1);case"cccc":return $g(t.weekdays("long",!0),1);case"Z":case"ZZ":return m1t(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return m1t(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return aoe(/[a-z_+-/]{1,256}?/i);case" ":return aoe(/[^\S\n\r]/);default:return p(_)}})(e)||{invalidReason:nin};return m.token=e,m}var uin={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 lin(e,t,r){let{type:n,value:o}=e;if(n==="literal"){let u=/^\s+$/.test(o);return{literal:!u,val:u?" ":o}}let i=t[n],a=n;n==="hour"&&(t.hour12!=null?a=t.hour12?"hour12":"hour24":t.hourCycle!=null?t.hourCycle==="h11"||t.hourCycle==="h12"?a="hour12":a="hour24":a=r.hour12?"hour12":"hour24");let s=uin[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function cin(e){return[`^${e.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,e]}function din(e,t,r){let n=e.match(t);if(n){let o={},i=1;for(let a in r)if(CT(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 fin(e){let t=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 Lt(e.z)||(r=ad.create(e.z)),Lt(e.Z)||(r||(r=new Ml(e.Z)),n=e.Z),Lt(e.q)||(e.M=(e.q-1)*3+1),Lt(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),Lt(e.u)||(e.S=W8(e.u)),[Object.keys(e).reduce((i,a)=>{let s=t(a);return s&&(i[s]=e[a]),i},{}),r,n]}var eMe=null;function pin(){return eMe||(eMe=Or.fromMillis(1555555555555)),eMe}function hin(e,t){if(e.literal)return e;let r=Al.macroTokenToFormatOpts(e.val),n=nMe(r,t);return n==null||n.includes(void 0)?e:n}function tMe(e,t){return Array.prototype.concat(...e.map(r=>hin(r,t)))}var Y8=class{constructor(t,r){if(this.locale=t,this.format=r,this.tokens=tMe(Al.parseFormat(r),t),this.units=this.tokens.map(n=>sin(n,t)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=cin(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(t){if(this.isValid){let[r,n]=din(t,this.regex,this.handlers),[o,i,a]=n?fin(n):[null,null,void 0];if(CT(n,"a")&&CT(n,"H"))throw new Ng("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:this.tokens,regex:this.regex,rawMatches:r,matches:n,result:o,zone:i,specificOffset:a}}else return{input:t,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function rMe(e,t,r){return new Y8(e,r).explainFromTokens(t)}function b1t(e,t,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=rMe(e,t,r);return[n,o,i,a]}function nMe(e,t){if(!e)return null;let n=Al.create(t,e).dtFormatter(pin()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>lin(a,e,i))}var oMe="Invalid DateTime",_1t=864e13;function Z8(e){return new Il("unsupported zone",`the zone "${e.name}" is not supported`)}function iMe(e){return e.weekData===null&&(e.weekData=z8(e.c)),e.weekData}function aMe(e){return e.localWeekData===null&&(e.localWeekData=z8(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function M1(e,t){let r={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new Or({...r,...t,old:r})}function E1t(e,t,r){let n=e-t*60*1e3,o=r.offset(n);if(t===o)return[n,t];n-=(o-t)*60*1e3;let i=r.offset(n);return o===i?[n,o]:[e-Math.min(o,i)*60*1e3,Math.max(o,i)]}function soe(e,t){e+=t*60*1e3;let r=new Date(e);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function loe(e,t,r){return E1t(dB(e),t,r)}function v1t(e,t){let r=e.o,n=e.c.year+Math.trunc(t.years),o=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,i={...e.c,year:n,month:o,day:Math.min(e.c.day,mB(n,o))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},a=ba.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as("milliseconds"),s=dB(i),[u,l]=E1t(s,r,e.zone);return a!==0&&(u+=a,l=e.zone.offset(u)),{ts:u,o:l}}function OB(e,t,r,n,o,i){let{setZone:a,zone:s}=r;if(e&&Object.keys(e).length!==0||t){let u=t||s,l=Or.fromObject(e,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return Or.invalid(new Il("unparsable",`the input "${o}" can't be parsed as ${n}`))}function uoe(e,t,r=!0){return e.isValid?Al.create(go.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(e,t):null}function sMe(e,t){let r=e.c.year>9999||e.c.year<0,n="";return r&&e.c.year>=0&&(n+="+"),n+=ya(e.c.year,r?6:4),t?(n+="-",n+=ya(e.c.month),n+="-",n+=ya(e.c.day)):(n+=ya(e.c.month),n+=ya(e.c.day)),n}function w1t(e,t,r,n,o,i){let a=ya(e.c.hour);return t?(a+=":",a+=ya(e.c.minute),(e.c.millisecond!==0||e.c.second!==0||!r)&&(a+=":")):a+=ya(e.c.minute),(e.c.millisecond!==0||e.c.second!==0||!r)&&(a+=ya(e.c.second),(e.c.millisecond!==0||!n)&&(a+=".",a+=ya(e.c.millisecond,3))),o&&(e.isOffsetFixed&&e.offset===0&&!i?a+="Z":e.o<0?(a+="-",a+=ya(Math.trunc(-e.o/60)),a+=":",a+=ya(Math.trunc(-e.o%60))):(a+="+",a+=ya(Math.trunc(e.o/60)),a+=":",a+=ya(Math.trunc(e.o%60)))),i&&(a+="["+e.zone.ianaName+"]"),a}var P1t={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},min={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},gin={ordinal:1,hour:0,minute:0,second:0,millisecond:0},T1t=["year","month","day","hour","minute","second","millisecond"],yin=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],bin=["year","ordinal","hour","minute","second","millisecond"];function _in(e){let t={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"}[e.toLowerCase()];if(!t)throw new cB(e);return t}function S1t(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return _in(e)}}function vin(e){return doe[e]||(coe===void 0&&(coe=mo.now()),doe[e]=e.offset(coe)),doe[e]}function x1t(e,t){let r=kg(t.zone,mo.defaultZone);if(!r.isValid)return Or.invalid(Z8(r));let n=go.fromObject(t),o,i;if(Lt(e.year))o=mo.now();else{for(let u of T1t)Lt(e[u])&&(e[u]=P1t[u]);let a=HTe(e)||VTe(e);if(a)return Or.invalid(a);let s=vin(r);[o,i]=loe(e,s,r)}return new Or({ts:o,zone:r,loc:n,o:i})}function C1t(e,t,r){let n=Lt(r.round)?!0:r.round,o=(a,s)=>(a=fB(a,n||r.calendary?0:2,!0),t.loc.clone(r).relFormatter(r).format(a,s)),i=a=>r.calendary?t.hasSame(e,a)?0:t.startOf(a).diff(e.startOf(a),a).get(a):t.diff(e,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(e>t?-0:0,r.units[r.units.length-1])}function O1t(e){let t={},r;return e.length>0&&typeof e[e.length-1]=="object"?(t=e[e.length-1],r=Array.from(e).slice(0,e.length-1)):r=Array.from(e),[t,r]}var coe,doe={},Or=class e{constructor(t){let r=t.zone||mo.defaultZone,n=t.invalid||(Number.isNaN(t.ts)?new Il("invalid input"):null)||(r.isValid?null:Z8(r));this.ts=Lt(t.ts)?mo.now():t.ts;let o=null,i=null;if(!n)if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(r))[o,i]=[t.old.c,t.old.o];else{let s=Bg(t.o)&&!t.old?t.o:r.offset(this.ts);o=soe(this.ts,s),n=Number.isNaN(o.year)?new Il("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=t.loc||go.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=o,this.o=i,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[t,r]=O1t(arguments),[n,o,i,a,s,u,l]=r;return x1t({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},t)}static utc(){let[t,r]=O1t(arguments),[n,o,i,a,s,u,l]=r;return t.zone=Ml.utcInstance,x1t({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},t)}static fromJSDate(t,r={}){let n=qRt(t)?t.valueOf():NaN;if(Number.isNaN(n))return e.invalid("invalid input");let o=kg(r.zone,mo.defaultZone);return o.isValid?new e({ts:n,zone:o,loc:go.fromObject(r)}):e.invalid(Z8(o))}static fromMillis(t,r={}){if(Bg(t))return t<-_1t||t>_1t?e.invalid("Timestamp out of range"):new e({ts:t,zone:kg(r.zone,mo.defaultZone),loc:go.fromObject(r)});throw new La(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,r={}){if(Bg(t))return new e({ts:t*1e3,zone:kg(r.zone,mo.defaultZone),loc:go.fromObject(r)});throw new La("fromSeconds requires a numerical input")}static fromObject(t,r={}){t=t||{};let n=kg(r.zone,mo.defaultZone);if(!n.isValid)return e.invalid(Z8(n));let o=go.fromObject(r),i=gB(t,S1t),{minDaysInFirstWeek:a,startOfWeek:s}=zTe(i,o),u=mo.now(),l=Lt(r.specificOffset)?n.offset(u):r.specificOffset,c=!Lt(i.ordinal),d=!Lt(i.year),f=!Lt(i.month)||!Lt(i.day),p=d||f,h=i.weekYear||i.weekNumber;if((p||c)&&h)throw new Ng("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new Ng("Can't mix ordinal dates with month/day");let m=h||i.weekday&&!p,_,g,v=soe(u,l);m?(_=yin,g=min,v=z8(v,a,s)):c?(_=bin,g=gin,v=ioe(v)):(_=T1t,g=P1t);let S=!1;for(let j of _){let N=i[j];Lt(N)?S?i[j]=g[j]:i[j]=v[j]:S=!0}let x=m?kRt(i,a,s):c?BRt(i):HTe(i),O=x||VTe(i);if(O)return e.invalid(O);let T=m?qTe(i,a,s):c?UTe(i):i,[E,M]=loe(T,l,n),A=new e({ts:E,zone:n,o:M,loc:o});return i.weekday&&p&&t.weekday!==A.weekday?e.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${A.toISO()}`):A.isValid?A:e.invalid(A.invalid)}static fromISO(t,r={}){let[n,o]=r1t(t);return OB(n,o,r,"ISO 8601",t)}static fromRFC2822(t,r={}){let[n,o]=n1t(t);return OB(n,o,r,"RFC 2822",t)}static fromHTTP(t,r={}){let[n,o]=o1t(t);return OB(n,o,r,"HTTP",r)}static fromFormat(t,r,n={}){if(Lt(t)||Lt(r))throw new La("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=go.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=b1t(a,t,r);return c?e.invalid(c):OB(s,u,n,`format ${r}`,t,l)}static fromString(t,r,n={}){return e.fromFormat(t,r,n)}static fromSQL(t,r={}){let[n,o]=s1t(t);return OB(n,o,r,"SQL",t)}static invalid(t,r=null){if(!t)throw new La("need to specify a reason the DateTime is invalid");let n=t instanceof Il?t:new Il(t,r);if(mo.throwOnInvalid)throw new Jne(n);return new e({invalid:n})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,r={}){let n=nMe(t,go.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(t,r={}){return tMe(Al.parseFormat(t),go.fromObject(r)).map(o=>o.val).join("")}static resetCache(){coe=void 0,doe={}}get(t){return this[t]}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?iMe(this).weekYear:NaN}get weekNumber(){return this.isValid?iMe(this).weekNumber:NaN}get weekday(){return this.isValid?iMe(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?aMe(this).weekday:NaN}get localWeekNumber(){return this.isValid?aMe(this).weekNumber:NaN}get localWeekYear(){return this.isValid?aMe(this).weekYear:NaN}get ordinal(){return this.isValid?ioe(this.c).ordinal:NaN}get monthShort(){return this.isValid?zC.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?zC.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?zC.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?zC.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 t=864e5,r=6e4,n=dB(this.c),o=this.zone.offset(n-t),i=this.zone.offset(n+t),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=soe(u,a),d=soe(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[M1(this,{ts:u}),M1(this,{ts:l})]:[this]}get isInLeapYear(){return P1(this.year)}get daysInMonth(){return mB(this.year,this.month)}get daysInYear(){return this.isValid?xT(this.year):NaN}get weeksInWeekYear(){return this.isValid?E1(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?E1(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(t={}){let{locale:r,numberingSystem:n,calendar:o}=Al.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(t=0,r={}){return this.setZone(Ml.instance(t),r)}toLocal(){return this.setZone(mo.defaultZone)}setZone(t,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(t=kg(t,mo.defaultZone),t.equals(this.zone))return this;if(t.isValid){let o=this.ts;if(r||n){let i=t.offset(this.ts),a=this.toObject();[o]=loe(a,i,t)}return M1(this,{ts:o,zone:t})}else return e.invalid(Z8(t))}reconfigure({locale:t,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:t,numberingSystem:r,outputCalendar:n});return M1(this,{loc:o})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;let r=gB(t,S1t),{minDaysInFirstWeek:n,startOfWeek:o}=zTe(r,this.loc),i=!Lt(r.weekYear)||!Lt(r.weekNumber)||!Lt(r.weekday),a=!Lt(r.ordinal),s=!Lt(r.year),u=!Lt(r.month)||!Lt(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new Ng("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new Ng("Can't mix ordinal dates with month/day");let d;i?d=qTe({...z8(this.c,n,o),...r},n,o):Lt(r.ordinal)?(d={...this.toObject(),...r},Lt(r.day)&&(d.day=Math.min(mB(d.year,d.month),d.day))):d=UTe({...ioe(this.c),...r});let[f,p]=loe(d,this.o,this.zone);return M1(this,{ts:f,o:p})}plus(t){if(!this.isValid)return this;let r=ba.fromDurationLike(t);return M1(this,v1t(this,r))}minus(t){if(!this.isValid)return this;let r=ba.fromDurationLike(t).negate();return M1(this,v1t(this,r))}startOf(t,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=ba.normalizeUnit(t);switch(o){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break;case"milliseconds":break}if(o==="weeks")if(r){let i=this.loc.getStartOfWeek(),{weekday:a}=this;a<i&&(n.weekNumber=this.weekNumber-1),n.weekday=i}else n.weekday=1;if(o==="quarters"){let i=Math.ceil(this.month/3);n.month=(i-1)*3+1}return this.set(n)}endOf(t,r){return this.isValid?this.plus({[t]:1}).startOf(t,r).minus(1):this}toFormat(t,r={}){return this.isValid?Al.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,t):oMe}toLocaleString(t=vT,r={}){return this.isValid?Al.create(this.loc.clone(r),t).formatDateTime(this):oMe}toLocaleParts(t={}){return this.isValid?Al.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:o=!0,extendedZone:i=!1}={}){if(!this.isValid)return null;let a=t==="extended",s=sMe(this,a);return s+="T",s+=w1t(this,a,r,n,o,i),s}toISODate({format:t="extended"}={}){return this.isValid?sMe(this,t==="extended"):null}toISOWeekDate(){return uoe(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:o=!1,extendedZone:i=!1,format:a="extended"}={}){return this.isValid?(o?"T":"")+w1t(this,a==="extended",r,t,n,i):null}toRFC2822(){return uoe(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return uoe(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?sMe(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let o="HH:mm:ss.SSS";return(r||t)&&(n&&(o+=" "),r?o+="z":t&&(o+="ZZ")),uoe(this,o,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():oMe}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(t={}){if(!this.isValid)return{};let r={...this.c};return t.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,r="milliseconds",n={}){if(!this.isValid||!t.isValid)return ba.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=URt(r).map(ba.normalizeUnit),a=t.valueOf()>this.valueOf(),s=a?this:t,u=a?t:this,l=p1t(s,u,i,o);return a?l.negate():l}diffNow(t="milliseconds",r={}){return this.diff(e.now(),t,r)}until(t){return this.isValid?UC.fromDateTimes(this,t):this}hasSame(t,r,n){if(!this.isValid)return!1;let o=t.valueOf(),i=this.setZone(t.zone,{keepLocalTime:!0});return i.startOf(r,n)<=o&&o<=i.endOf(r,n)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;let r=t.base||e.fromObject({},{zone:this.zone}),n=t.padding?this<r?-t.padding:t.padding:0,o=["years","months","days","hours","minutes","seconds"],i=t.unit;return Array.isArray(t.unit)&&(o=t.unit,i=void 0),C1t(r,this.plus(n),{...t,numeric:"always",units:o,unit:i})}toRelativeCalendar(t={}){return this.isValid?C1t(t.base||e.fromObject({},{zone:this.zone}),this,{...t,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...t){if(!t.every(e.isDateTime))throw new La("min requires all arguments be DateTimes");return WTe(t,r=>r.valueOf(),Math.min)}static max(...t){if(!t.every(e.isDateTime))throw new La("max requires all arguments be DateTimes");return WTe(t,r=>r.valueOf(),Math.max)}static fromFormatExplain(t,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=go.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return rMe(a,t,r)}static fromStringExplain(t,r,n={}){return e.fromFormatExplain(t,r,n)}static buildFormatParser(t,r={}){let{locale:n=null,numberingSystem:o=null}=r,i=go.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new Y8(i,t)}static fromFormatParser(t,r,n={}){if(Lt(t)||Lt(r))throw new La("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=go.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new La(`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(t);return c?e.invalid(c):OB(s,u,n,`format ${r.format}`,t,l)}static get DATE_SHORT(){return vT}static get DATE_MED(){return S8}static get DATE_MED_WITH_WEEKDAY(){return CTe}static get DATE_FULL(){return x8}static get DATE_HUGE(){return C8}static get TIME_SIMPLE(){return O8}static get TIME_WITH_SECONDS(){return E8}static get TIME_WITH_SHORT_OFFSET(){return P8}static get TIME_WITH_LONG_OFFSET(){return T8}static get TIME_24_SIMPLE(){return M8}static get TIME_24_WITH_SECONDS(){return I8}static get TIME_24_WITH_SHORT_OFFSET(){return A8}static get TIME_24_WITH_LONG_OFFSET(){return R8}static get DATETIME_SHORT(){return D8}static get DATETIME_SHORT_WITH_SECONDS(){return j8}static get DATETIME_MED(){return N8}static get DATETIME_MED_WITH_SECONDS(){return L8}static get DATETIME_MED_WITH_WEEKDAY(){return OTe}static get DATETIME_FULL(){return F8}static get DATETIME_FULL_WITH_SECONDS(){return k8}static get DATETIME_HUGE(){return B8}static get DATETIME_HUGE_WITH_SECONDS(){return $8}};function CB(e){if(Or.isDateTime(e))return e;if(e&&e.valueOf&&Bg(e.valueOf()))return Or.fromJSDate(e);if(e&&typeof e=="object")return Or.fromObject(e);throw new La(`Unknown datetime argument: ${e}, of type ${typeof e}`)}var M1t=require("obsidian");bd();async function win(){let e=new Date,t=e.getTimezoneOffset(),r=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(e).find(n=>n.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:-t,timezone:r}}var I1t=Tp(async()=>win(),{name:"getCurrentTime",description:"Get the current time in various formats, including timezone information",schema:Tr.object({})}),A1t={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 Sin(e,t){let r=e.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=t.startOf("day");return{start:s.minus({[a+"s"]:i}),end:s}}function xin(e,t){switch(e){case"yesterday":return{start:t.minus({days:1}).startOf("day"),end:t.minus({days:1}).endOf("day")};case"last week":return{start:t.minus({weeks:1}).startOf("week"),end:t.minus({weeks:1}).endOf("week")};case"this week":return{start:t.startOf("week"),end:t.endOf("week")};case"next week":return{start:t.plus({weeks:1}).startOf("week"),end:t.plus({weeks:1}).endOf("week")};case"last month":return{start:t.minus({months:1}).startOf("month"),end:t.minus({months:1}).endOf("month")};case"this month":return{start:t.startOf("month"),end:t.endOf("month")};case"next month":return{start:t.plus({months:1}).startOf("month"),end:t.plus({months:1}).endOf("month")};case"last year":return{start:t.minus({years:1}).startOf("year"),end:t.minus({years:1}).endOf("year")};case"this year":return{start:t.startOf("year"),end:t.endOf("year")};case"next year":return{start:t.plus({years:1}).startOf("year"),end:t.plus({years:1}).endOf("year")};case"last quarter":return{start:t.minus({quarters:1}).startOf("quarter"),end:t.minus({quarters:1}).endOf("quarter")};case"this quarter":return{start:t.startOf("quarter"),end:t.endOf("quarter")};case"next quarter":return{start:t.plus({quarters:1}).startOf("quarter"),end:t.plus({quarters:1}).endOf("quarter")}}}function Cin(e,t){let r=e.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=xTe(n,t.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=Or.fromJSDate(o[0].start.date()).startOf("week"),a=i.endOf("week");return i>t&&(i=i.minus({years:1}),a=a.minus({years:1})),{start:i,end:a}}function Oin(e,t){let r=e.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=A1t[r[1]],o=t.year;n>t.month&&o--;let i=Or.fromObject({year:o,month:n,day:1}),a=i.endOf("month");return i>t&&(i=i.minus({years:1}),a=a.minus({years:1})),{start:i,end:a}}function Ein(e,t){let r=e.match(/^(?:(?:the\s+)?(?:year|yr)(?:\s+(?:of|in))?\s+)?(\d{4})$/i);if(!r)return;let n=parseInt(r[1]),o=Or.fromObject({year:n,month:1,day:1}),i=Or.fromObject({year:n,month:12,day:31});return o>t&&(o=o.minus({years:1}),i=i.minus({years:1})),{start:o,end:i}}function Pin(e,t){let r=e.match(/^(?:(?:q|Q)(\d{1})\s+(\d{4})|(\d{4})\s+(?:q|Q)(\d{1}))$/),n=e.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=t.year;let l=Math.floor((t.month-1)/3)+1;o>l&&i--}else return;if(o<1||o>4)return;let a=(o-1)*3+1,s=Or.fromObject({year:i,month:a,day:1}).startOf("day"),u=s.plus({months:3}).minus({days:1}).endOf("day");return s>t&&(s=s.minus({years:1}),u=u.minus({years:1})),{start:s,end:u}}function Tin(e,t){let r=e.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=A1t[r[1].toLowerCase()],o=parseInt(r[2]),i=Or.fromObject({year:o,month:n,day:1}).startOf("day"),a=i.endOf("month");return i>t&&(i=i.minus({years:1}),a=a.minus({years:1})),{start:i,end:a}}function Min(e){let t=Or.now(),r=e.toLowerCase().replace("@vault","").trim(),n=Sin(r,t)||xin(r,t)||Cin(r,t)||Oin(r,t)||Tin(r,t)||Pin(r,t)||Ein(r,t);if(n)return{startTime:X8(n.start),endTime:X8(n.end)};let o=xTe(e,t.toJSDate(),{forwardDate:!1});if(o.length>0){let i=Or.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?Or.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>t&&(i.minus({years:1}),a.minus({years:1})),{startTime:X8(i),endTime:X8(a)}}console.warn(`Unable to parse time expression: ${e}`)}function X8(e){let t=e.toJSDate(),r=t.getTimezoneOffset(),n=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(t).find(o=>o.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:-r,timezone:n}}var R1t=Tp(async({timeExpression:e})=>Min(e),{name:"getTimeRangeMs",description:"Get a time range in milliseconds based on a natural language time expression",schema:Tr.object({timeExpression:Tr.string().describe("A natural language time expression (e.g., 'last week', 'from July 1 to July 15')")})});function Iin(e){let t=e.toString().length===10?e*1e3:e,r=Or.fromMillis(t);return X8(r)}var D1t=Tp(async({epoch:e})=>Iin(e),{name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:Tr.object({epoch:Tr.number().describe("Unix timestamp in seconds or milliseconds")})});function Ain(e){let t=e.match(/^(\d+)\s*(s|sec|seconds?|m|min|minutes?|h|hr|hours?)$/i);if(!t)throw new Error(`Invalid time interval format: ${e}`);let r=parseInt(t[1],10),n=t[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 Rin(e="25min"){let t=Ain(e);return new Promise(r=>{setTimeout(()=>{new M1t.Notice(`Pomodoro timer (${e}) completed! Take a break!`),r()},t)})}var uMe=Tp(async({interval:e="25min"})=>(Rin(e),`Pomodoro timer started. It will end in ${e}.`),{name:"startPomodoro",description:"Start a Pomodoro timer with a customizable interval",schema:Tr.object({interval:Tr.string().optional().describe("Time interval (e.g., '25min', '5s', '1h'). Default is 25min.")})});bd();function Din(e){return"children"in e&&"path"in e}function jin(e){return"path"in e&&!("children"in e)}function Nin(e){let t=e.split(".");return t.length>1&&t.pop()?.toLowerCase()||""}function lMe(e,t=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=jR();for(let u of e.children)if(jin(u)){if(jP(u,i,a)){t&&r.push(u.name);let l=Nin(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(Din(u)){let l=lMe(u,t);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),t&&r.length>0&&(s.files=r),Object.keys(o).length>0&&(s.subFolders=o),Object.keys(s).length===0?{}:e.name?{[e.name]:s}:{vault:s}}var j1t=e=>Tp(async()=>{let t=lMe(e,!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(t);if(n.length>5e5){let o=lMe(e,!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:Tr.void()});bd();var cMe=Tp(async({url:e})=>{try{let t=await ms.getInstance().youtube4llm(e);return t.response.transcript?JSON.stringify({success:!0,transcript:t.response.transcript,elapsed_time_ms:t.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(t){return console.error(`Error transcribing YouTube video ${e}:`,t),JSON.stringify({success:!1,message:"An error occurred while transcribing the YouTube video."})}},{name:"youtubeTranscription",description:"Get the transcript of a YouTube video",schema:Tr.object({url:Tr.string().describe("The YouTube video URL"),brevilabsClient:Tr.any().describe("The BrevilabsClient instance")})});var EB=class{},N1t=(e,t)=>{if(t!==void 0)return e[t];let r=Object.keys(e);if(r.length===1)return e[r[0]]},foe=(e,t)=>{let r=N1t(e,t);if(!r){let n=Object.keys(e);throw new Error(`input values have ${n.length} keys, you must specify an input key or pass only 1 key as input`)}return r},dMe=(e,t)=>{let r=N1t(e,t);if(!r&&r!==""){let n=Object.keys(e);throw new Error(`output values have ${n.length} keys, you must specify an output key or pass only 1 key as output`)}return r};UM();KM();var fMe=class extends nf{addUserMessage(t){return this.addMessage(new Ua(t))}addAIChatMessage(t){return this.addMessage(new Po(t))}addAIMessage(t){return this.addMessage(new Po(t))}async addMessages(t){for(let r of t)await this.addMessage(r)}clear(){throw new Error("Not implemented.")}},PB=class extends fMe{constructor(t){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=t??[]}async getMessages(){return this.messages}async addMessage(t){this.messages.push(t)}async clear(){this.messages=[]}};var Kw=class extends EB{constructor(t){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=t?.chatHistory??new PB,this.returnMessages=t?.returnMessages??this.returnMessages,this.inputKey=t?.inputKey??this.inputKey,this.outputKey=t?.outputKey??this.outputKey}async saveContext(t,r){await this.chatHistory.addUserMessage(foe(t,this.inputKey)),await this.chatHistory.addAIChatMessage(dMe(r,this.outputKey))}async clear(){await this.chatHistory.clear()}};pMe();tI();var Q8=class extends Kw{constructor(t){super({returnMessages:t?.returnMessages??!1,chatHistory:t?.chatHistory,inputKey:t?.inputKey,outputKey:t?.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=t?.humanPrefix??this.humanPrefix,this.aiPrefix=t?.aiPrefix??this.aiPrefix,this.memoryKey=t?.memoryKey??this.memoryKey,this.k=t?.k??this.k}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(t){let r=await this.chatHistory.getMessages();return this.returnMessages?{[this.memoryKey]:r.slice(-this.k*2)}:{[this.memoryKey]:sf(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}};UM();pMe();var I1=class e{constructor(){this.initMemory(),ll(()=>this.initMemory())}static getInstance(){return e.instance||(e.instance=new e),e.instance}initMemory(){let t=pe().contextTurns;this.memory=new Q8({k:t*2,memoryKey:"history",inputKey:"input",returnMessages:!0}),this.debug&&console.log("Memory initialized with context turns:",t)}getMemory(){return this.memory}async clearChatMemory(){this.debug&&console.log("Clearing chat memory"),await this.memory.clear()}async loadMemoryVariables(){let t=await this.memory.loadMemoryVariables({});return this.debug&&console.log("Loaded memory variables:",t),t}async saveContext(t,r){this.debug&&console.log("Saving to memory - Input:",t,"Output:",r),await this.memory.saveContext(t,r)}};var eH=["@vault","@web","@youtube","@pomodoro"],A1=class{static initTools(t){this.tools.length===0&&(this.tools=[I1t,D1t,R1t,iTe,OAt,uMe,aTe,cMe,j1t(t.getRoot())])}static async analyzeIntent(t){try{let r=await ms.getInstance().broca(t);if(!r?.response)throw new Error(r?.detail||"Broca API call failed");let n=r.response.tool_calls,o=r.response.salience_terms,i=[],a;for(let s of n){let u=this.tools.find(l=>l.name===s.tool);if(u){let l=s.args||{};u.name==="getTimeRangeMs"&&(a=await rB.callTool(u,l)),i.push({tool:u,args:l})}}return await this.processAtCommands(t,i,{timeRange:a,salientTerms:o}),i}catch(r){throw console.error("Error in intent analysis:",r),r}}static async processAtCommands(t,r,n){let o=t.toLowerCase(),{timeRange:i,salientTerms:a}=n;if(o.includes("@vault")&&(a.length>0||i)){let s=this.removeAtCommands(t);r.push({tool:iTe,args:{timeRange:i||void 0,query:s,salientTerms:a}})}if(o.includes("@web")){let s=this.removeAtCommands(t),l=await I1.getInstance().getMemory().loadMemoryVariables({}),c=dj(l);r.push({tool:aTe,args:{query:s,chatHistory:c}})}if(o.includes("@pomodoro")){let s=t.match(/@pomodoro\s+(\S+)/i),u=s?s[1]:"25min";r.push({tool:uMe,args:{interval:u}})}if(o.includes("@youtube")){let s=Eq(t);s&&r.push({tool:cMe,args:{url:s}})}}static removeAtCommands(t){return t.split(" ").filter(r=>!eH.includes(r.toLowerCase())).join(" ").trim()}};A1.tools=[];var poe=class{constructor(t){this.updateCurrentAiMessage=t;this.hasOpenThinkBlock=!1;this.fullResponse=""}processChunk(t){this.fullResponse+=t.content,t.additional_kwargs?.reasoning_content?(this.hasOpenThinkBlock||(this.fullResponse+=`
<think>`,this.hasOpenThinkBlock=!0),this.fullResponse+=t.additional_kwargs.reasoning_content):this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.hasOpenThinkBlock=!1),this.updateCurrentAiMessage(this.fullResponse)}close(){return this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.updateCurrentAiMessage(this.fullResponse)),this.fullResponse}},tH=class{constructor(t){this.chainManager=t}async handleResponse(t,r,n,o,i,a,s){return t&&n.signal.reason!=="new-chat"&&(await this.chainManager.memoryManager.getMemory().saveContext({input:r.message},{output:t}),o({message:t,sender:hy,isVisible:!0,timestamp:dl(new Date),sources:s})),i(""),a&&(console.log(`==== Chat Memory ====
`,this.chainManager.memoryManager.getMemory().chatHistory.messages.map(u=>u.content)),console.log(`==== Final AI Response ====
`,t)),t}async handleError(t,r,n,o){let i=bi(t);r&&console.error("Error during LLM invocation:",i);let a=t?.response?.data?.error||i,s=a?.code||i,u="";if(t?.message?.includes("Invalid license key")?u="Invalid Copilot Plus license key. Please check your license key in settings.":s==="model_not_found"?u="You do not have access to this model or the model does not exist, please check with your API provider.":u=`${s}`,console.error(a),n&&o){o("");let l=u.search("Troubleshooting URL");u=l!==-1?u.slice(0,l):u,i.search(/401|invalid|not valid/gi)!==-1&&(u=`Something went wrong. Please check if you have set your API key.
Path: Settings > copilot plugin > Basic Tab > Set Keys.
Or check model config
Error Details: `+u),n({message:u,isErrorMessage:!0,sender:hy,isVisible:!0,timestamp:dl(new Date)})}else new $1t.Notice(u),console.error(a)}},hoe=class extends tH{async run(t,r,n,o,i){let{debug:a=!1}=i,s=new poe(n);try{let l=await HC.getChain().stream({input:t.message});for await(let c of l){if(r.signal.aborted)break;s.processChunk(c)}}catch(u){await this.handleError(u,a,o,n)}return this.handleResponse(s.close(),t,r,o,n,a)}},moe=class extends tH{async run(t,r,n,o,i){let{debug:a=!1}=i,s="";try{if(await this.chainManager.vectorStoreManager.isIndexEmpty())return this.handleResponse(b5,t,r,o,n,a);let c=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),d=dj(c),f=await HC.getRetrievalChain().stream({question:t.message,chat_history:d});for await(let p of f){if(r.signal.aborted)break;s+=p.content,n(s)}s=this.addSourcestoResponse(s)}catch(u){await this.handleError(u,a,o,n)}return this.handleResponse(s,t,r,o,n,a)}addSourcestoResponse(t){let r=uBe(HC.retrievedDocuments);if(r.length>0){let n=r.map(o=>`- [[${o}]]`).join(`
`);t+=`
#### Sources:
`+n}return t}},goe=class extends tH{isYoutubeOnlyMessage(t){let r=t.trim(),n=r.includes("@youtube"),o=Eq(r),i=r.split(/\s+/).filter(a=>a!=="@youtube"&&a.length>0);return n&&o!==null&&i.length===1}async processImageUrls(t){try{return(await Promise.all(t.map(async o=>{if(await qm.isImageUrl(o,this.chainManager.app.vault)){let i=await qm.convertToBase64(o,this.chainManager.app.vault);return i||(gt(`Failed to process image: ${o}`),null)}return null}))).filter(o=>o!==null)}catch(r){return gt("Error processing image URLs:",r),[]}}async processExistingImages(t){try{return(await Promise.all(t.filter(n=>n.type==="image_url"&&!!n.image_url?.url).map(async n=>{let o=await qm.convertToBase64(n.image_url.url,this.chainManager.app.vault);return o||(gt(`Failed to process existing image: ${n.image_url.url}`),null)}))).filter(n=>n!==null)}catch(r){return gt("Error processing images:",r),[]}}async extractEmbeddedImages(t){let r=/!\[\[(.*?\.(png|jpg|jpeg|gif|webp|bmp|svg))\]\]/g;return[...t.matchAll(r)].map(i=>i[1])}async buildMessageContent(t,r){let n=[{type:"text",text:t}];if(r.context?.urls&&r.context.urls.length>0){let i=await this.processImageUrls(r.context.urls);n.push(...i)}let o=await this.extractEmbeddedImages(t);if(o.length>0){let i=await this.processImageUrls(o);n.push(...i)}if(r.content&&r.content.length>0){let i=await this.processExistingImages(r.content);n.push(...i)}return n}hasCapability(t,r){let n=t.modelName||t.model||"";return this.chainManager.chatModelManager.findModelByName(n)?.capabilities?.includes(r)??!1}isMultimodalModel(t){return this.hasCapability(t,"vision")}async streamMultimodalResponse(t,r,n,o,i){let s=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),u=dj(s),l=[],c=oI();u.length>0&&(c+=`
The following is the relevant conversation history. Use this context to maintain consistency in your responses:`);let d=this.chainManager.chatModelManager.getChatModel();c&&l.push({role:hBe(d),content:`${c}
IMPORTANT: Maintain consistency with previous responses in the conversation. If you've provided information about a person or topic before, use that same information in follow-up questions.`});for(let[g,v]of u)l.push({role:"user",content:g}),l.push({role:"assistant",content:v});let f=this.chainManager.chatModelManager.getChatModel(),h=this.isMultimodalModel(f)?await this.buildMessageContent(t,r):t;l.push({role:"user",content:h}),i&&console.log(`==== Final Request to AI ====
`,l);let m=new poe(o),_=await this.chainManager.chatModelManager.getChatModel().stream(l);for await(let g of _){if(n.signal.aborted)break;m.processChunk(g)}return m.close()}async run(t,r,n,o,i){let{debug:a=!1,updateLoadingMessage:s}=i,u="",l=[];try{if(this.isYoutubeOnlyMessage(t.message)){let h=Eq(t.message),m="Transcript not available. Only videos with the auto transcript option turned on are supported at the moment.";if(h)try{let _=await ms.getInstance().youtube4llm(h);return _.response.transcript?this.handleResponse(_.response.transcript,t,r,o,n,a):this.handleResponse(m,t,r,o,n,a)}catch(_){return console.error("Error processing YouTube video:",_),this.handleResponse(m,t,r,o,n,a)}}a&&console.log("==== Step 1: Analyzing intent ====");let c;try{let h=t.originalMessage||t.message;c=await A1.analyzeIntent(h)}catch(h){return this.handleResponse(nBe(h),t,r,o,n,a)}let d=t.message.split(" ").filter(h=>!eH.includes(h.toLowerCase())).join(" ").trim(),f=await this.executeToolCalls(c,a,s),p=f.find(h=>h.tool==="localSearch"&&h.output&&h.output.length>0);if(p){a&&console.log("==== Step 2: Processing local search results ====");let h=JSON.parse(p.output),_=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),g=dj(_);a&&console.log("==== Step 3: Condensing Question ====");let v=await Fne(d,g);a&&console.log("Condensed standalone question: ",v),a&&console.log("==== Step 4: Preparing context ====");let S=this.getTimeExpression(c),x=this.prepareLocalSearchResult(h,S),O=f.filter(M=>M.tool==="getCurrentTime"),T=this.prepareEnhancedUserMessage(v,O);a&&console.log(x),a&&console.log("==== Step 5: Invoking QA Chain ====");let E=await this.chainManager.promptManager.getQAPrompt({question:T,context:x,systemMessage:""});u=await this.streamMultimodalResponse(E,t,r,n,a),l=this.getSources(h)}else{let h=this.prepareEnhancedUserMessage(d,f);a&&(console.log("No local search results. Using standard LLM Chain."),console.log("Enhanced user message:",h)),u=await this.streamMultimodalResponse(h,t,r,n,a)}}catch(c){s?.(FS.DEFAULT),await this.handleError(c,a,o,n)}return this.handleResponse(u,t,r,o,n,a,l)}getSources(t){return!t||!Array.isArray(t)?(console.warn("No valid documents provided to getSources"),[]):this.sortUniqueDocsByScore(t)}sortUniqueDocsByScore(t){let r=new Map;for(let n of t){if(!n.title||!n?.score&&!n?.rerank_score){console.warn("Invalid document structure:",n);continue}let o=r.get(n.title),i=n&&"rerank_score"in n,a=i?n.rerank_score:n.score;(!o||a>(o.score??0))&&r.set(n.title,{title:n.title,score:a,isReranked:i})}return Array.from(r.values()).sort((n,o)=>(o.score??0)-(n.score??0))}async executeToolCalls(t,r,n){let o=[];for(let i of t){r&&console.log(`==== Step 2: Calling tool: ${i.tool.name} ====`),i.tool.name==="localSearch"?n?.(FS.READING_FILES):i.tool.name==="webSearch"?n?.(FS.SEARCHING_WEB):i.tool.name==="getFileTree"&&n?.(FS.READING_FILE_TREE);let a=await rB.callTool(i.tool,i.args);o.push({tool:i.tool.name,output:a})}return o}prepareEnhancedUserMessage(t,r){let n="";if(r.length>0){let o=r.filter(i=>i.output!=null);o.length>0&&(n=`
# Additional context:
`+o.map(i=>`<${i.tool}>
${typeof i.output!="string"?JSON.stringify(i.output):i.output}
</${i.tool}>`).join(`
`))}return`User message: ${t}${n}`}getTimeExpression(t){let r=t.find(n=>n.tool.name==="getTimeRangeMs");return r?r.args.timeExpression:""}prepareLocalSearchResult(t,r){let n=t.filter(s=>s.includeInContext),o=n.reduce((s,u)=>s+u.content.length,0),i=n;if(o>Jle){let s=Jle/o;console.log("Truncating documents to fit context length. Truncation ratio:",s),i=n.map(u=>({...u,content:u.content.slice(0,Math.floor(u.content.length*s))}))}let a=i.map(s=>`Note in Vault: ${s.content}`).join(`
`);return r?`Local Search Result for ${r}:
${a}`:`Local Search Result:
${a}`}};tI();var q1t=require("obsidian");tI();var rH=class e{constructor(){this.initChatPrompt(),this.initQAPrompt(),ll(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return e.instance||(e.instance=new e),e.instance}initChatPrompt(){let t=this.escapeTemplateString(oI());this.chatPrompt=ah.fromMessages([tj.fromTemplate(t),new EO("history"),PO.fromTemplate("{input}")])}initQAPrompt(){let t=`{system_message}
Answer the question with as detailed as possible based only on the following context:
{context}
Question: {question}
`;this.qaPrompt=ah.fromMessages([tj.fromTemplate(t)])}escapeTemplateString(t){return t.replace(/\{/g,"{{").replace(/\}/g,"}}")}getChatPrompt(){return this.chatPrompt}async getQAPrompt({question:t,context:r,systemMessage:n}){return await this.qaPrompt.format({question:t,context:r,system_message:n})}};var Fp=class Fp{constructor(t,r){this.app=t,this.vectorStoreManager=r,this.memoryManager=I1.getInstance(),this.chatModelManager=zd.getInstance(),this.promptManager=rH.getInstance(),this.initialize(),CBe(async()=>await this.createChainWithNewModel()),OBe(()=>this.setChain(zm(),{refreshIndex:pe().indexVaultToVectorStore==="ON MODE SWITCH"&&(zm()==="vault_qa"||zm()==="copilot_plus")})),ll(async()=>await this.createChainWithNewModel())}async initialize(){await this.createChainWithNewModel()}static getChain(){return Fp.chain}static getRetrievalChain(){return Fp.retrievalChain}validateChainType(t){if(t==null)throw new Error("No chain type set")}validateChatModel(){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){let t="Chat model is not initialized properly, check your API key in Copilot setting and make sure you have API access.";throw new q1t.Notice(t),new Error(t)}}validateChainInitialization(){(!Fp.chain||!iBe(Fp.chain))&&(console.error("Chain is not initialized properly, re-initializing chain: ",zm()),this.setChain(zm()))}static storeRetrieverDocuments(t){Fp.retrievedDocuments=t}async createChainWithNewModel(){let t=E5();try{let r=m5(t,pe().activeModels);r||(console.error("Resetting default model. No model configuration found for: ",t),r=IO[0],t=r.name+"|"+r.provider),await this.chatModelManager.setChatModel(r),this.setChain(zm()),Mr(`Setting model to ${t}`)}catch(r){gt(`createChainWithNewModel failed: ${r}`),Mr(`modelKey: ${t}`)}}async setChain(t,r={}){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){console.error("setChain failed: No chat model set.");return}this.validateChainType(t);let n=this.chatModelManager.getChatModel(),o=this.memoryManager.getMemory(),i=this.promptManager.getChatPrompt();switch(t){case"llm_chain":{Fp.chain=y5.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),gj("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=new cT({minSimilarityScore:.01,maxK:pe().maxSourceChunks,salientTerms:[]});Fp.retrievalChain=y5.createConversationalRetrievalChain({llm:n,retriever:a,systemMessage:oI()},Fp.storeRetrieverDocuments.bind(Fp),pe().debug),gj("vault_qa"),pe().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),Fp.chain=y5.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),gj("copilot_plus");break}default:this.validateChainType(t);break}}getChainRunner(){let t=zm();switch(t){case"llm_chain":return new hoe(this);case"vault_qa":return new moe(this);case"copilot_plus":return new goe(this);default:throw new Error(`Unsupported chain type: ${t}`)}}async initializeQAChain(t){t.refreshIndex&&await this.vectorStoreManager.indexVaultToVectorStore()}async runChain(t,r,n,o,i={}){let{debug:a=!1,ignoreSystemMessage:s=!1}=i;a&&console.log(`==== Step 0: Initial user message ====
`,t),this.validateChatModel(),this.validateChainInitialization();let u=this.chatModelManager.getChatModel();if(s||uI(u)){let c=ah.fromMessages([new EO("history"),PO.fromTemplate("{input}")]);uI(u)&&(c=ah.fromMessages([[zo,oI()||""],c])),this.setChain(zm(),{prompt:c})}return await this.getChainRunner().run(t,r,n,o,i)}async updateMemoryWithLoadedMessages(t){await this.memoryManager.clearChatMemory();for(let r=0;r<t.length;r+=2){let n=t[r],o=t[r+1];n&&o&&n.sender===zo&&await this.memoryManager.getMemory().saveContext({input:n.message},{output:o.message})}}};Fp.retrievedDocuments=[];var HC=Fp;function U1t(e){let t=e.split(`
`),r=[],n="",o="",i="";for(let a of t)a.startsWith("**user**:")||a.startsWith("**ai**:")?(n&&o&&r.push({sender:n===zo?zo:hy,message:o.trim(),isVisible:!0,timestamp:i?$le(i):null}),n=a.startsWith("**user**:")?zo:hy,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===zo?zo:hy,message:o.trim(),isVisible:!0,timestamp:i?$le(i):null}),r}async function nH(e,t){await t.clearChatMemory();for(let r=0;r<e.length-1;r++){let n=e[r];if(n.sender===zo){let o=e[r+1];o?.sender===hy&&await t.getMemory().saveContext({input:n.message},{output:o.message})}}}var TB=require("obsidian"),mr=B(Y()),z1t=B(gh());var yoe=B(Y());var ri=yoe.forwardRef(({className:e,type:t,...r},n)=>yoe.createElement("input",{type:t,className:_e("!h-9 !min-w-[50px] !border border-border border-solid !rounded-md !bg-transparent !px-3 !py-1 md:!text-base !text-sm !transition-colors","focus-visible:!shadow-sm focus-visible:!outline-none focus-visible:!ring-1 focus-visible:!ring-ring","placeholder:text-xs","flex w-full shadow-sm placeholder:text-muted disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));ri.displayName="Input";var hm=B(Y());var R1=hm.forwardRef(({className:e,value:t,...r},n)=>{let o=hm.useRef(null),i=hm.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);hm.useLayoutEffect(()=>{i()},[t,i]),hm.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 hm.createElement("textarea",{className:_e("border-solid resize-y min-w-fit overflow-auto","flex min-h-[60px] max-h-[300px] w-full rounded-md border border-primary-alt bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),value:t,ref:a,onChange:s=>{i(),r.onChange?.(s)},onInput:i,onCompositionEnd:i,onPaste:()=>{setTimeout(i,0)},...r})});R1.displayName="Textarea";function $in({initialTitle:e="",initialPrompt:t="",disabledTitle:r=!1,onSave:n,onCancel:o}){let[i,a]=(0,mr.useState)(e),[s,u]=(0,mr.useState)(t),[l,c]=(0,mr.useState)({title:!1,prompt:!1}),[d,f]=(0,mr.useState)(!1),h=i&&/[<>:"/\\|?*\x00-\x1F]/g.test(i),m=async()=>{if(h){new TB.Notice("Title contains invalid characters. Please remove them before saving.");return}if(i&&s)try{f(!0),await n(i,s)}catch(S){new TB.Notice(bi(S))}finally{f(!1)}else c({title:!0,prompt:!0}),new TB.Notice("Please fill in both fields: Title and Prompt.")},_=l.title&&!i,g=l.prompt&&!s,v=i.trim()!==""&&s.trim()!==""&&!h;return mr.default.createElement("div",{className:"flex flex-col gap-4 p-4"},mr.default.createElement("div",{className:"text-xl font-bold text-normal mb-2"},"User Custom Prompt"),mr.default.createElement("div",{className:"flex flex-col"},mr.default.createElement("div",{className:"flex items-center gap-1"},mr.default.createElement("div",{className:"text-base font-medium text-normal"},"Title"),mr.default.createElement("span",{className:"text-error"},"*")),mr.default.createElement("div",{className:"flex flex-col gap-1"},mr.default.createElement("div",{className:"text-sm text-muted"},"The title of the prompt, must be unique."),mr.default.createElement("div",{className:"text-xs text-warning"},"Note: Title will be used as filename. Avoid using: ",'< > : " / \\ | ? *')),mr.default.createElement(ri,{type:"text",value:i,onChange:S=>{a(S.target.value),l.title||c(x=>({...x,title:!0}))},onBlur:()=>c(S=>({...S,title:!0})),disabled:r,className:"w-full mt-1",required:!0}),_&&mr.default.createElement("div",{className:"text-error text-xs mt-1"},"Title is required"),h&&mr.default.createElement("div",{className:"text-error text-xs mt-1"},"Title contains invalid characters")),mr.default.createElement("div",{className:"flex flex-col gap-1"},mr.default.createElement("div",{className:"space-y-2"},mr.default.createElement("div",{className:"flex items-center gap-1"},mr.default.createElement("div",{className:"text-base font-medium text-normal"},"Prompt"),mr.default.createElement("span",{className:"text-error"},"*")),mr.default.createElement("div",{className:"text-sm text-muted -mt-1"},"Use the following syntax in your prompt:")),mr.default.createElement("div",{className:"text-sm flex flex-col gap-1 bg-secondary/30 rounded-md p-2"},mr.default.createElement("strong",null,"- ","{}"," represents the selected text (not required). "),mr.default.createElement("strong",null,"- ","{[[Note Title]]}"," represents a note. "),mr.default.createElement("strong",null,"- ","{activeNote}"," represents the active note. "),mr.default.createElement("strong",null,"- ","{FolderPath}"," represents a folder of notes. "),mr.default.createElement("strong",null,"- ","{#tag1, #tag2}"," represents ALL notes with ANY of the specified tags in their property (an OR operation)."," "),mr.default.createElement("div",{className:"mt-1"},mr.default.createElement("span",{className:"text-muted"},"Tip: turn on debug mode to show the processed prompt in the chat window."))),mr.default.createElement(R1,{value:s,onChange:S=>{u(S.target.value),l.prompt||c(x=>({...x,prompt:!0}))},onBlur:()=>c(S=>({...S,prompt:!0})),className:"!min-h-[8rem] mt-1",required:!0}),g&&mr.default.createElement("div",{className:"text-error text-xs mt-1"},"Prompt is required"),mr.default.createElement("div",{className:"flex flex-col text-xs text-muted gap-2 mt-2"},mr.default.createElement("div",null,"Save the prompt to the local prompt library. You can then use it with the Copilot command: ",mr.default.createElement("strong",null,"Apply custom prompt to selection.")),mr.default.createElement("div",null,"Check out the"," ",mr.default.createElement("a",{href:"https://github.com/f/awesome-chatgpt-prompts",target:"_blank",className:"text-accent hover:text-accent-hover",rel:"noreferrer"},"awesome chatGPT prompts")," ","for inspiration."))),mr.default.createElement("div",{className:"flex items-center justify-end gap-2"},mr.default.createElement(qe,{variant:"secondary",onClick:o,disabled:d},"Cancel"),mr.default.createElement(qe,{onClick:m,disabled:!v||d},d?"Saving...":"Save")))}var oH=class extends TB.Modal{constructor(r,n,o="",i="",a){super(r);this.onSave=n;this.initialTitle=o;this.initialPrompt=i;this.disabledTitle=a}onOpen(){let{contentEl:r}=this;this.root=(0,z1t.createRoot)(r);let n=async(i,a)=>{await this.onSave(i,a),this.close()},o=()=>{this.close()};this.root.render(mr.default.createElement($in,{initialTitle:this.initialTitle,initialPrompt:this.initialPrompt,disabledTitle:this.disabledTitle,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};var H1t=require("obsidian"),boe=class extends H1t.Modal{constructor(r,n){super(r);this.placeholderText="Please enter your custom ad-hoc prompt here, press enter to send.";this.onSubmit=n}onOpen(){let{contentEl:r}=this,n=createFragment(i=>{i.createEl("strong",{text:"- {} represents the selected text (not required). "}),i.createEl("br"),i.createEl("strong",{text:"- {[[Note Title]]} represents a note. "}),i.createEl("br"),i.createEl("strong",{text:"- {activeNote} represents the active note. "}),i.createEl("br"),i.createEl("strong",{text:"- {FolderPath} represents a folder of notes. "}),i.createEl("br"),i.createEl("strong",{text:"- {#tag1, #tag2} represents ALL notes with ANY of the specified tags in their property (an OR operation). "}),i.createEl("br"),i.createEl("br"),i.appendText("Tip: turn on debug mode to show the processed prompt in the chat window."),i.createEl("br"),i.createEl("br")});r.appendChild(n);let o=r.createEl("textarea",{attr:{placeholder:this.placeholderText}});o.style.width="100%",o.style.height="100px",o.style.padding="10px",o.style.resize="vertical",o.addEventListener("input",i=>{this.result=i.target.value}),o.addEventListener("keydown",i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),this.close(),this.onSubmit(this.result))})}onClose(){let{contentEl:r}=this;r.empty()}};var PT=require("obsidian"),_oe=class extends PT.Modal{constructor(t,r){super(t),this.plugin=r}onOpen(){let{contentEl:t}=this;t.empty(),t.createEl("h2",{text:"Debug: Search OramaDB"});let r=t.createEl("p");r.innerHTML='Enter a JSON search params object. Example:<br><pre>{<br> "term": "#tag",<br> "mode": "hybrid",<br> "limit": 10,<br> "includeVectors": true<br>}</pre>',this.searchInput=t.createEl("textarea",{attr:{placeholder:"Enter search params JSON...",rows:"10",style:"width: 100%; min-height: 200px; margin: 10px 0; padding: 10px; font-family: monospace;"}}),t.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 PT.Notice("Database not found");return}let s=await ac(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 PT.TFile?await this.app.vault.modify(c,u):await this.app.vault.create(l,u);let d=this.app.vault.getAbstractFileByPath(l);d instanceof PT.TFile&&(await this.app.workspace.getLeaf().openFile(d),this.close())}catch(i){console.error("Error in debug search:",i),new PT.Notice("Error executing search. Check console for details.")}})}onClose(){let{contentEl:t}=this;t.empty()}};function MB(e){return encodeURIComponent(e.toLowerCase())}function V1t(e,t){if(!e)throw new Error("Command name is required");if(e.length>Nae)throw new Error(`Command name must be less than ${Nae} characters`);if(D1().some(n=>n.name.toLowerCase()===e.toLowerCase()&&n.name.toLowerCase()!==t?.toLowerCase()))throw new Error("A command with this name already exists")}function W1t(e){return D1().find(r=>MB(r.name)===e)}function D1(){return pe().inlineEditCommands??wD}function J1t(){return Uo().inlineEditCommands??wD}function G1t(e,t){let r=e.indexOf(Zd);return r===-1?e+`
`+t:e.slice(0,r)+t+e.slice(r+Zd.length)}function K1t(){return D1()!==wD}var Yw=B(Y());var hMe=({capabilities:e=[],iconSize:t=16})=>Yw.default.createElement(Yw.default.Fragment,null,e.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return Yw.default.createElement(QS,{key:n,className:"text-model-capabilities-blue",style:{width:t,height:t}});case"vision":return Yw.default.createElement(XS,{key:n,className:"text-model-capabilities-green",style:{width:t,height:t}});case"websearch":return Yw.default.createElement(RI,{key:n,className:"text-model-capabilities-blue",style:{width:t,height:t}});default:return null}})),mMe=({model:e,iconSize:t=14})=>{let r=e.displayName||e.name;return Yw.default.createElement("div",{className:"flex items-center gap-1"},Yw.default.createElement("span",null,r),e.capabilities&&e.capabilities.length>0&&Yw.default.createElement("div",{className:"flex gap-0.5 items-center"},Yw.default.createElement(hMe,{capabilities:e.capabilities,iconSize:t})))},voe=e=>{let t=e.displayName||e.name,r=`(${uh(e.provider)})`;return`${t} ${r}`},gMe=e=>{let t=e.displayName||e.name,r=`(${uh(e.provider,e)})`,n=e.capabilities?.map(o=>{switch(o){case"reasoning":return"Reasoning";case"vision":return"Vision";case"websearch":return"Websearch";default:return""}}).join("|")||"";return`${t} ${r} ${n}`};var Soe=require("obsidian"),fi=B(Y()),Y1t=B(gh());function qin({originalText:e,command:t,onInsert:r,onReplace:n,onClose:o}){let[i,a]=(0,fi.useState)(null),[s,u]=(0,fi.useState)(null),[l]=mj(),c=Uo(),d=(0,fi.useMemo)(()=>m5(t.modelKey||l,c.activeModels),[t.modelKey,l,c.activeModels]),f=t.name,p=(0,fi.useCallback)(h=>{u(h.message)},[]);return(0,fi.useEffect)(()=>{let h=new AbortController;async function m(){let _=G1t(t.prompt,e),g="",S=await(await zd.getInstance().createModelInstance(d)).stream(_);for await(let x of S){if(h?.signal.aborted)break;g+=x.content,a(g)}h?.signal.aborted||u(g)}return m(),()=>{h.abort()}},[t.prompt,e,p,d]),fi.default.createElement("div",{className:"flex flex-col gap-4"},fi.default.createElement("div",{className:"max-h-60 overflow-y-auto text-muted whitespace-pre-wrap"},e),fi.default.createElement("div",{className:"flex flex-col gap-2"},f&&fi.default.createElement("div",{className:"text-normal flex items-center gap-2 font-bold"},fi.default.createElement(lE,{className:"w-4 h-4"}),f),fi.default.createElement("div",{className:"text-muted flex items-center gap-2 font-bold"},fi.default.createElement(EI,{className:"w-4 h-4"}),voe(d))),fi.default.createElement("div",{className:"relative group"},fi.default.createElement("textarea",{className:"w-full h-60 text-text peer",value:s??i??"loading...",disabled:s==null,onChange:h=>u(h.target.value)}),s&&fi.default.createElement("button",{className:"absolute top-2 right-2 opacity-0 peer-focus-visible:!opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{navigator.clipboard.writeText(s),new Soe.Notice("Copied to clipboard")}},fi.default.createElement(ZS,{className:"w-4 h-4 text-muted-foreground hover:text-accent"}))),fi.default.createElement("div",{className:"flex justify-end gap-2"},fi.default.createElement("button",{onClick:o},"Close"),fi.default.createElement("button",{disabled:s==null,className:"!bg-interactive-accent !text-on-accent cursor-pointer",onClick:()=>r(s??"")},"Insert"),fi.default.createElement("button",{disabled:s==null,className:"!bg-interactive-accent !text-on-accent cursor-pointer",onClick:()=>n(s??"")},"Replace")))}var woe=class extends Soe.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,Y1t.createRoot)(r);let{selectedText:n,command:o}=this.configs,i=u=>{Pq(u),this.close()},a=u=>{Pq(u,!0),this.close()},s=()=>{this.close()};this.root.render(fi.default.createElement(qin,{originalText:n,command:o,onInsert:i,onReplace:a,onClose:s}))}onClose(){this.root.unmount()}};var Z1t=require("obsidian"),VC=class extends Z1t.FuzzySuggestModal{constructor(t,r,n,o=[]){super(t),this.promptTitles=r,this.onChoosePromptTitle=n,this.descriptions=o}getItems(){return this.promptTitles}getItemText(t){let r=this.promptTitles.indexOf(t),n=this.descriptions[r];return n?`${t} (${n})`:t}onChooseItem(t,r){let n=this.promptTitles.findIndex(i=>t.startsWith(i+" (")||t===i),o=n>=0?this.promptTitles[n]:t;this.onChoosePromptTitle(o)}};var iH=require("obsidian"),xoe=class extends iH.Modal{constructor(t,r){super(t),this.plugin=r}onOpen(){let{contentEl:t}=this;t.empty(),t.createEl("h2",{text:"Inspect Copilot Index by Note Paths"}),this.searchInput=t.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;"}}),t.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Show Index Data",cls:"mod-cta"}).addEventListener("click",async()=>{let o=this.searchInput.value,i=py(o,this.app.vault).map(a=>a.path);if(i.length===0){new iH.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 iH.Notice("Error searching database. Check console for details.")}})}onClose(){let{contentEl:t}=this;t.empty()}};var aH=require("obsidian"),Coe=class extends aH.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 aH.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 aH.Setting(n).addButton(o=>o.setButtonText("Remove").setCta().onClick(()=>{let i=this.filePaths.split(`
`).map(a=>{let s=a.match(/\[\[(.*?)\]\]/);return s?s[1].trim():""}).filter(a=>a.length>0);this.onSubmit(i),this.close()})),r.createEl("style",{text:`
.remove-files-container {
width: 100%;
margin-top: 12px;
}
.remove-files-setting {
display: block;
}
.remove-files-setting .setting-item-control {
padding: 0;
}
.remove-files-setting textarea {
width: 100%;
height: 300px;
margin-top: 12px;
}
.remove-files-setting textarea::placeholder {
opacity: 0.5;
}
`})}onClose(){let{contentEl:r}=this;r.empty()}};var Ooe=class{get usageData(){return pe().promptUsageTimestamps}recordUsage(t){xt("promptUsageTimestamps",{...this.usageData,[t]:Date.now()})}updateUsage(t,r){let n={...this.usageData};n[r]=n[t],delete n[t],xt("promptUsageTimestamps",n)}removeUnusedPrompts(t){let r={...this.usageData};for(let n of Object.keys(r))t.includes(n)||delete r[n];xt("promptUsageTimestamps",r)}compare(t,r){return(this.usageData[t]||0)-(this.usageData[r]||0)}};var TT=require("obsidian"),WC=class e{constructor(t){this.vault=t;this.lastProcessedPrompt=null;this.usageStrategy=new Ooe}get customPromptsFolder(){return pe().customPromptsFolder}static getInstance(t){return e.instance||(e.instance=new e(t)),e.instance}recordPromptUsage(t){this.usageStrategy.recordUsage(t)}async getAllPrompts(){let t=this.customPromptsFolder,r=this.vault.getFiles().filter(o=>o.path.startsWith(t)&&o.extension==="md"),n=[];for(let o of r){let i=await this.vault.read(o);n.push({title:o.basename,content:i})}return this.usageStrategy.removeUnusedPrompts(n.map(o=>o.title)),n.sort((o,i)=>this.usageStrategy.compare(i.title,o.title)||0)}async getPrompt(t){let r=`${this.customPromptsFolder}/${t}.md`,n=this.vault.getAbstractFileByPath(r);if(n instanceof TT.TFile){let o=await this.vault.read(n);return{title:t,content:o}}return null}async savePrompt(t,r){let n=(0,TT.normalizePath)(this.customPromptsFolder),o=`${n}/${t}.md`;await this.vault.adapter.exists(n)||await this.vault.createFolder(n),await this.vault.create(o,r)}async updatePrompt(t,r,n){let o=`${this.customPromptsFolder}/${t}.md`,i=this.vault.getAbstractFileByPath(o);if(i instanceof TT.TFile){if(t!==r){let a=`${this.customPromptsFolder}/${r}.md`;if(this.vault.getAbstractFileByPath(a))throw new or("Error saving custom prompt. Please check if the title already exists.");this.usageStrategy.updateUsage(t,r),await this.vault.rename(i,a)}await this.vault.modify(i,n)}}async deletePrompt(t){let r=`${this.customPromptsFolder}/${t}.md`,n=this.vault.getAbstractFileByPath(r);n instanceof TT.TFile&&(this.usageStrategy.removeUnusedPrompts([t]),await this.vault.delete(n))}async extractVariablesFromPrompt(t,r){let n=[],o=/\{([^}]+)\}/g,i;for(;(i=o.exec(t))!==null;){let a=i[1].trim(),s=[];if(a.toLowerCase()==="activenote")if(r){let u=await cj(r,this.vault);u&&s.push({name:h5(r),content:u})}else new TT.Notice("No active note found.");else if(a.startsWith("#")){let u=a.slice(1).split(",").map(c=>c.trim()),l=await oBe(this.vault,u);for(let c of l){let d=await cj(c,this.vault);d&&s.push({name:h5(c),content:d})}}else{let u=sBe(a),l=await Ble(this.vault,u);for(let c of l){let d=await cj(c,this.vault);d&&s.push({name:h5(c),content:d})}}if(s.length>0){let u=s.map(l=>`## ${l.name}
${l.content}`).join(`
`);n.push(u)}else console.warn(`No notes found for variable: ${a}`)}return n}async processCustomPrompt(t,r,n){this.lastProcessedPrompt=t;let o=await this.extractVariablesFromPrompt(t,n),i=t,a=[...i.matchAll(/\{([^}]+)\}/g)],s="",u=null;i.includes("{}")&&(i=i.replace(/\{\}/g,"{selectedText}"),r?s+=`selectedText:
${r}`:n?(u=await cj(n,this.vault),s+=`selectedText (entire active note):
${u}`):s+=`selectedText:
(No selected text or active note available)`);for(let c=0;c<o.length;c++)if(a[c]){let d=a[c][1];if(d.toLowerCase()==="activenote"&&u)continue;s+=`
${d}:
${o[c]}`}let l=py(i,this.vault);for(let c of l)if(!a.some(d=>d[1].includes(`[[${c.basename}]]`))){let d=await cj(c,this.vault);d&&(s+=`
Title: [[${c.basename}]]
Path: ${c.path}
${d}`)}return i+`
`+s}async getProcessedVariables(){let t=new Set,r=this.lastProcessedPrompt?.matchAll(/\{([^}]+)\}/g)||[];for(let o of r)t.add(o[1]);let n=py(this.lastProcessedPrompt||"",this.vault);for(let o of n)t.add(`[[${o.basename}]]`);return t}};var yo=require("obsidian");function sd(e,t,r){e.addCommand({id:t,name:_5[t],callback:r})}function Uin(e,t,r){e.addCommand({id:t,name:_5[t],editorCallback:r})}function X1t(e,t,r){e.addCommand({id:t,name:_5[t],checkCallback:r})}async function zin(e,t){let r=e.getSelection().trim();if(!r)return;let n=W1t(t);if(!n){gt(`Command not found for id ${t}`);return}new woe(app,{selectedText:r,command:n}).open()}function Hin(e,t,r){t.forEach(n=>{let o=MB(n.name);o&&e.removeCommand(o)}),r.forEach(n=>{let o=MB(n.name);e.addCommand({id:o,name:n.name,editorCallback:i=>{zin(i,o)}})})}function yMe(e,t,r){Hin(e,t?.inlineEditCommands??[],r.inlineEditCommands??D1());let n=WC.getInstance(e.app.vault);Uin(e,nr.COUNT_WORD_AND_TOKENS_SELECTION,async o=>{let i=await o.getSelection(),a=i.split(" ").length,s=await e.chainManager.chatModelManager.countTokens(i);new yo.Notice(`Selected text contains ${a} words and ${s} tokens.`)}),sd(e,nr.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let o=await d0t(e.app),i=await e.chainManager.chatModelManager.countTokens(o);new yo.Notice(`Total tokens in your vault: ${i}`)}catch(o){console.error("Error counting tokens: ",o),new yo.Notice("An error occurred while counting tokens.")}}),sd(e,nr.TOGGLE_COPILOT_CHAT_WINDOW,()=>{e.toggleView()}),sd(e,nr.OPEN_COPILOT_CHAT_WINDOW,()=>{e.activateView()}),sd(e,nr.ADD_CUSTOM_PROMPT,()=>{new oH(e.app,async(o,i)=>{try{await n.savePrompt(o,i),new yo.Notice("Custom prompt saved successfully.")}catch(a){let s="An error occurred while saving the custom prompt: "+bi(a);throw console.error(s),new Error(s)}}).open()}),sd(e,nr.APPLY_CUSTOM_PROMPT,async()=>{let i=(await n.getAllPrompts()).map(a=>a.title);new VC(e.app,i,async a=>{if(!a){new yo.Notice("Please select a prompt title.");return}try{let s=await n.getPrompt(a);if(!s){new yo.Notice(`No prompt found with the title "${a}".`);return}e.processCustomPrompt(nr.APPLY_CUSTOM_PROMPT,s.content)}catch(s){console.error(s),new yo.Notice("An error occurred.")}}).open()}),sd(e,nr.APPLY_ADHOC_PROMPT,async()=>{new boe(e.app,async i=>{try{e.processCustomPrompt(nr.APPLY_ADHOC_PROMPT,i)}catch(a){console.error(a),new yo.Notice("An error occurred.")}}).open()}),X1t(e,nr.DELETE_CUSTOM_PROMPT,o=>(o||n.getAllPrompts().then(i=>{let a=i.map(s=>s.title);new VC(e.app,a,async s=>{if(!s){new yo.Notice("Please select a prompt title.");return}try{await n.deletePrompt(s),new yo.Notice(`Prompt "${s}" has been deleted.`)}catch(u){console.error(u),new yo.Notice("An error occurred while deleting the prompt.")}}).open()}),!0)),X1t(e,nr.EDIT_CUSTOM_PROMPT,o=>(o||n.getAllPrompts().then(i=>{let a=i.map(s=>s.title);new VC(e.app,a,async s=>{if(!s){new yo.Notice("Please select a prompt title.");return}try{let u=await n.getPrompt(s);u?new oH(e.app,async(l,c)=>{try{await n.updatePrompt(s,l,c),new yo.Notice(`Prompt "${l}" has been updated.`)}catch(d){let f="An error occurred while updating the custom prompt: "+bi(d);throw console.error(f),new Error(f)}},u.title,u.content,!1).open():new yo.Notice(`No prompt found with the title "${s}".`)}catch(u){console.error(u),new yo.Notice("An error occurred.")}}).open()}),!0)),sd(e,nr.CLEAR_LOCAL_COPILOT_INDEX,async()=>{await e.vectorStoreManager.clearIndex()}),sd(e,nr.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let o=await e.vectorStoreManager.garbageCollectVectorStore();new yo.Notice(`${o} documents removed from Copilot index.`)}catch(o){console.error("Error garbage collecting the Copilot index:",o),new yo.Notice("An error occurred while garbage collecting the Copilot index.")}}),sd(e,nr.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let o=await e.vectorStoreManager.indexVaultToVectorStore();new yo.Notice(`${o} vault files indexed to Copilot index.`)}catch(o){console.error("Error indexing vault to Copilot index:",o),new yo.Notice("An error occurred while indexing vault to Copilot index.")}}),sd(e,nr.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let o=await e.vectorStoreManager.indexVaultToVectorStore(!0);new yo.Notice(`${o} vault files re-indexed to Copilot index.`)}catch(o){console.error("Error re-indexing vault to Copilot index:",o),new yo.Notice("An error occurred while re-indexing vault to Copilot index.")}}),sd(e,nr.LOAD_COPILOT_CHAT_CONVERSATION,()=>{e.loadCopilotChatHistory()}),sd(e,nr.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS,()=>{new xoe(e.app,e).open()}),sd(e,nr.SEARCH_ORAMA_DB,()=>{new _oe(e.app,e).open()}),sd(e,nr.LIST_INDEXED_FILES,async()=>{try{let o=await e.vectorStoreManager.getIndexedFiles(),i=new Set(o),a=e.app.vault.getMarkdownFiles(),s=new Set,u=new Set,l=new Set,c=await e.vectorStoreManager.getDbOps();for(let _ of a){let g=await e.app.vault.cachedRead(_);!g||g.trim().length===0?s.add(_.path):i.has(_.path)?await c.hasEmbeddings(_.path)||l.add(_.path):u.add(_.path)}if(o.length===0&&s.size===0&&u.size===0){new yo.Notice("No files found to list.");return}let d=["# Copilot Files Status",`- Indexed files: ${o.length}`,` - Files missing embeddings: ${l.size}`,`- Unindexed files: ${u.size}`,`- Empty files: ${s.size}`,"","## Indexed Files",...o.map(_=>{let g=l.has(_);return`- [[${_}]]${g?" *(embedding missing)*":""}`}),"","## Unindexed Files",...u.size>0?Array.from(u).sort().map(_=>`- [[${_}]]`):["No unindexed files found."],"","## Empty Files",...s.size>0?Array.from(s).sort().map(_=>`- [[${_}]]`):["No empty files found."]].join(`
`),p=`${`Copilot-Indexed-Files-${new Date().toLocaleDateString().replace(/\//g,"-")}.md`}`,h=e.app.vault.getAbstractFileByPath(p);h instanceof yo.TFile?await e.app.vault.modify(h,d):await e.app.vault.create(p,d);let m=e.app.vault.getAbstractFileByPath(p);m instanceof yo.TFile&&(await e.app.workspace.getLeaf().openFile(m),new yo.Notice(`Listed ${o.length} indexed files`))}catch(o){console.error("Error listing indexed files:",o),new yo.Notice("Failed to list indexed files.")}}),sd(e,nr.REMOVE_FILES_FROM_COPILOT_INDEX,async()=>{new Coe(e.app,async o=>{let i=await e.vectorStoreManager.getDbOps();try{for(let a of o)await i.removeDocs(a);await i.saveDB(),new yo.Notice(`Successfully removed ${o.length} files from the index.`)}catch(a){console.error("Error removing files from index:",a),new yo.Notice("An error occurred while removing files from the index.")}}).open()}),sd(e,nr.CLEAR_COPILOT_CACHE,async()=>{try{await e.fileParserManager.clearPDFCache(),new yo.Notice("Copilot cache cleared successfully")}catch(o){console.error("Error clearing Copilot cache:",o),new yo.Notice("Failed to clear Copilot cache")}})}var gr=B(Y());var rl=B(Y(),1);function sH(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}var Vin=B(Y(),1);function Q1t(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Eoe(...e){return t=>{let r=!1,n=e.map(o=>{let i=Q1t(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():Q1t(e[o],null)}}}}var mm=B(Y(),1),bMe=B(lt(),1);function eDt(e,t){let r=mm.createContext(t),n=i=>{let{children:a,...s}=i,u=mm.useMemo(()=>s,Object.values(s));return(0,bMe.jsx)(r.Provider,{value:u,children:a})};n.displayName=e+"Provider";function o(i){let a=mm.useContext(r);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[n,o]}function Ro(e,t=[]){let r=[];function n(i,a){let s=mm.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...h}=d,m=f?.[e]?.[u]||s,_=mm.useMemo(()=>h,Object.values(h));return(0,bMe.jsx)(m.Provider,{value:_,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[e]?.[u]||s,h=mm.useContext(p);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>mm.createContext(a));return function(s){let u=s?.[e]||i;return mm.useMemo(()=>({[`__scope${e}`]:{...s,[e]:u}}),[s,u])}};return o.scopeName=e,[n,Win(o,...t)]}function Win(...e){let t=e[0];if(e.length===1)return t;let r=()=>{let n=e.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 mm.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}var MT=B(Y(),1);var IB=B(Y(),1);function Gt(e){let t=IB.useRef(e);return IB.useEffect(()=>{t.current=e}),IB.useMemo(()=>(...r)=>t.current?.(...r),[])}function tl({prop:e,defaultProp:t,onChange:r=()=>{}}){let[n,o]=Jin({defaultProp:t,onChange:r}),i=e!==void 0,a=i?e:n,s=Gt(r),u=MT.useCallback(l=>{if(i){let d=typeof l=="function"?l(e):l;d!==e&&s(d)}else o(l)},[i,e,o,s]);return[a,u]}function Jin({defaultProp:e,onChange:t}){let r=MT.useState(e),[n]=r,o=MT.useRef(n),i=Gt(t);return MT.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var tDt=B(Y(),1),Xin=B(ss(),1);var hc=B(Y(),1);var AB=B(lt(),1),vMe=hc.forwardRef((e,t)=>{let{children:r,...n}=e,o=hc.Children.toArray(r),i=o.find(Kin);if(i){let a=i.props.children,s=o.map(u=>u===i?hc.Children.count(a)>1?hc.Children.only(null):hc.isValidElement(a)?a.props.children:null:u);return(0,AB.jsx)(_Me,{...n,ref:t,children:hc.isValidElement(a)?hc.cloneElement(a,void 0,s):null})}return(0,AB.jsx)(_Me,{...n,ref:t,children:r})});vMe.displayName="Slot";var _Me=hc.forwardRef((e,t)=>{let{children:r,...n}=e;if(hc.isValidElement(r)){let o=Zin(r);return hc.cloneElement(r,{...Yin(n,r.props),ref:t?Eoe(t,o):o})}return hc.Children.count(r)>1?hc.Children.only(null):null});_Me.displayName="SlotClone";var Gin=({children:e})=>(0,AB.jsx)(AB.Fragment,{children:e});function Kin(e){return hc.isValidElement(e)&&e.type===Gin}function Yin(e,t){let r={...t};for(let n in t){let o=e[n],i=t[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{...e,...r}}function Zin(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var rDt=B(lt(),1),Qin=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],nDt=Qin.reduce((e,t)=>{let r=tDt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?vMe:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,rDt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});var wt=B(Y(),1);function pi(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}var AT=B(Y(),1);var iDt=B(Y(),1);function oDt(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function uH(...e){return t=>{let r=!1,n=e.map(o=>{let i=oDt(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():oDt(e[o],null)}}}}function mc(...e){return iDt.useCallback(uH(...e),e)}var gc=B(Y(),1);var RB=B(lt(),1),IT=gc.forwardRef((e,t)=>{let{children:r,...n}=e,o=gc.Children.toArray(r),i=o.find(tan);if(i){let a=i.props.children,s=o.map(u=>u===i?gc.Children.count(a)>1?gc.Children.only(null):gc.isValidElement(a)?a.props.children:null:u);return(0,RB.jsx)(wMe,{...n,ref:t,children:gc.isValidElement(a)?gc.cloneElement(a,void 0,s):null})}return(0,RB.jsx)(wMe,{...n,ref:t,children:r})});IT.displayName="Slot";var wMe=gc.forwardRef((e,t)=>{let{children:r,...n}=e;if(gc.isValidElement(r)){let o=nan(r);return gc.cloneElement(r,{...ran(n,r.props),ref:t?uH(t,o):o})}return gc.Children.count(r)>1?gc.Children.only(null):null});wMe.displayName="SlotClone";var ean=({children:e})=>(0,RB.jsx)(RB.Fragment,{children:e});function tan(e){return gc.isValidElement(e)&&e.type===ean}function ran(e,t){let r={...t};for(let n in t){let o=e[n],i=t[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{...e,...r}}function nan(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Poe=B(lt(),1);function aDt(e){let t=e+"CollectionProvider",[r,n]=Ro(t),[o,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:h,children:m}=p,_=AT.default.useRef(null),g=AT.default.useRef(new Map).current;return(0,Poe.jsx)(o,{scope:h,itemMap:g,collectionRef:_,children:m})};a.displayName=t;let s=e+"CollectionSlot",u=AT.default.forwardRef((p,h)=>{let{scope:m,children:_}=p,g=i(s,m),v=mc(h,g.collectionRef);return(0,Poe.jsx)(IT,{ref:v,children:_})});u.displayName=s;let l=e+"CollectionItemSlot",c="data-radix-collection-item",d=AT.default.forwardRef((p,h)=>{let{scope:m,children:_,...g}=p,v=AT.default.useRef(null),S=mc(h,v),x=i(l,m);return AT.default.useEffect(()=>(x.itemMap.set(v,{ref:v,...g}),()=>void x.itemMap.delete(v))),(0,Poe.jsx)(IT,{[c]:"",ref:S,children:_})});d.displayName=l;function f(p){let h=i(e+"CollectionConsumer",p);return AT.default.useCallback(()=>{let _=h.collectionRef.current;if(!_)return[];let g=Array.from(_.querySelectorAll(`[${c}]`));return Array.from(h.itemMap.values()).sort((x,O)=>g.indexOf(x.ref.current)-g.indexOf(O.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Toe=B(Y(),1),oan=B(lt(),1),ian=Toe.createContext(void 0);function RT(e){let t=Toe.useContext(ian);return e||t||"ltr"}var _a=B(Y(),1);var sDt=B(Y(),1),uDt=B(ss(),1);var lDt=B(lt(),1),aan=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Rl=aan.reduce((e,t)=>{let r=sDt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?IT:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,lDt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Moe(e,t){e&&uDt.flushSync(()=>e.dispatchEvent(t))}var cDt=B(Y(),1);function Zw(e,t=globalThis?.document){let r=Gt(e);cDt.useEffect(()=>{let n=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var xMe=B(lt(),1),san="DismissableLayer",SMe="dismissableLayer.update",uan="dismissableLayer.pointerDownOutside",lan="dismissableLayer.focusOutside",dDt,pDt=_a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),CMe=_a.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=e,l=_a.useContext(pDt),[c,d]=_a.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=_a.useState({}),h=mc(t,E=>d(E)),m=Array.from(l.layers),[_]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(_),v=c?m.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=v>=g,O=fan(E=>{let M=E.target,A=[...l.branches].some(j=>j.contains(M));!x||A||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),T=pan(E=>{let M=E.target;[...l.branches].some(j=>j.contains(M))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return Zw(E=>{v===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),_a.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(dDt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),fDt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=dDt)}},[c,f,r,l]),_a.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),fDt())},[c,l]),_a.useEffect(()=>{let E=()=>p({});return document.addEventListener(SMe,E),()=>document.removeEventListener(SMe,E)},[]),(0,xMe.jsx)(Rl.div,{...u,ref:h,style:{pointerEvents:S?x?"auto":"none":void 0,...e.style},onFocusCapture:pi(e.onFocusCapture,T.onFocusCapture),onBlurCapture:pi(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:pi(e.onPointerDownCapture,O.onPointerDownCapture)})});CMe.displayName=san;var can="DismissableLayerBranch",dan=_a.forwardRef((e,t)=>{let r=_a.useContext(pDt),n=_a.useRef(null),o=mc(t,n);return _a.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,xMe.jsx)(Rl.div,{...e,ref:o})});dan.displayName=can;function fan(e,t=globalThis?.document){let r=Gt(e),n=_a.useRef(!1),o=_a.useRef(()=>{});return _a.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){hDt(uan,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function pan(e,t=globalThis?.document){let r=Gt(e),n=_a.useRef(!1);return _a.useEffect(()=>{let o=i=>{i.target&&!n.current&&hDt(lan,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function fDt(){let e=new CustomEvent(SMe);document.dispatchEvent(e)}function hDt(e,t,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?Moe(o,i):o.dispatchEvent(i)}var gDt=B(Y(),1),OMe=0;function DT(){gDt.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??mDt()),document.body.insertAdjacentElement("beforeend",e[1]??mDt()),OMe++,()=>{OMe===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),OMe--}},[])}function mDt(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var gm=B(Y(),1);var wDt=B(lt(),1),EMe="focusScope.autoFocusOnMount",PMe="focusScope.autoFocusOnUnmount",yDt={bubbles:!1,cancelable:!0},han="FocusScope",TMe=gm.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[s,u]=gm.useState(null),l=Gt(o),c=Gt(i),d=gm.useRef(null),f=mc(t,m=>u(m)),p=gm.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;gm.useEffect(()=>{if(n){let v=function(T){if(p.paused||!s)return;let E=T.target;s.contains(E)?d.current=E:jT(d.current,{select:!0})},S=function(T){if(p.paused||!s)return;let E=T.relatedTarget;E!==null&&(s.contains(E)||jT(d.current,{select:!0}))},x=function(T){if(document.activeElement===document.body)for(let M of T)M.removedNodes.length>0&&jT(s)};var m=v,_=S,g=x;document.addEventListener("focusin",v),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),gm.useEffect(()=>{if(s){_Dt.add(p);let m=document.activeElement;if(!s.contains(m)){let g=new CustomEvent(EMe,yDt);s.addEventListener(EMe,l),s.dispatchEvent(g),g.defaultPrevented||(man(van(SDt(s)),{select:!0}),document.activeElement===m&&jT(s))}return()=>{s.removeEventListener(EMe,l),setTimeout(()=>{let g=new CustomEvent(PMe,yDt);s.addEventListener(PMe,c),s.dispatchEvent(g),g.defaultPrevented||jT(m??document.body,{select:!0}),s.removeEventListener(PMe,c),_Dt.remove(p)},0)}}},[s,l,c,p]);let h=gm.useCallback(m=>{if(!r&&!n||p.paused)return;let _=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(_&&g){let v=m.currentTarget,[S,x]=gan(v);S&&x?!m.shiftKey&&g===x?(m.preventDefault(),r&&jT(S,{select:!0})):m.shiftKey&&g===S&&(m.preventDefault(),r&&jT(x,{select:!0})):g===v&&m.preventDefault()}},[r,n,p.paused]);return(0,wDt.jsx)(Rl.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});TMe.displayName=han;function man(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(jT(n,{select:t}),document.activeElement!==r)return}function gan(e){let t=SDt(e),r=bDt(t,e),n=bDt(t.reverse(),e);return[r,n]}function SDt(e){let t=[],r=document.createTreeWalker(e,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();)t.push(r.currentNode);return t}function bDt(e,t){for(let r of e)if(!yan(r,{upTo:t}))return r}function yan(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ban(e){return e instanceof HTMLInputElement&&"select"in e}function jT(e,{select:t=!1}={}){if(e&&e.focus){let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&ban(e)&&t&&e.select()}}var _Dt=_an();function _an(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),e=vDt(e,t),e.unshift(t)},remove(t){e=vDt(e,t),e[0]?.resume()}}}function vDt(e,t){let r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function van(e){return e.filter(t=>t.tagName!=="A")}var Ioe=B(Y(),1);var xDt=B(Y(),1),qr=globalThis?.document?xDt.useLayoutEffect:()=>{};var wan=Ioe.useId||(()=>{}),San=0;function Fa(e){let[t,r]=Ioe.useState(wan());return qr(()=>{e||r(n=>n??String(San++))},[e]),e||(t?`radix-${t}`:"")}var kp=B(Y(),1);var CDt=["top","right","bottom","left"];var Xw=Math.min,Hd=Math.max,cH=Math.round,dH=Math.floor,qg=e=>({x:e,y:e}),xan={left:"right",right:"left",bottom:"top",top:"bottom"},Can={start:"end",end:"start"};function Roe(e,t,r){return Hd(e,Xw(t,r))}function Qw(e,t){return typeof e=="function"?e(t):e}function eS(e){return e.split("-")[0]}function j1(e){return e.split("-")[1]}function Doe(e){return e==="x"?"y":"x"}function joe(e){return e==="y"?"height":"width"}function JC(e){return["top","bottom"].includes(eS(e))?"y":"x"}function Noe(e){return Doe(JC(e))}function ODt(e,t,r){r===void 0&&(r=!1);let n=j1(e),o=Noe(e),i=joe(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=lH(a)),[a,lH(a)]}function EDt(e){let t=lH(e);return[Aoe(e),t,Aoe(t)]}function Aoe(e){return e.replace(/start|end/g,t=>Can[t])}function Oan(e,t,r){let n=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return r?t?o:n:t?n:o;case"left":case"right":return t?i:a;default:return[]}}function PDt(e,t,r,n){let o=j1(e),i=Oan(eS(e),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(Aoe)))),i}function lH(e){return e.replace(/left|right|bottom|top/g,t=>xan[t])}function Ean(e){return{top:0,right:0,bottom:0,left:0,...e}}function MMe(e){return typeof e!="number"?Ean(e):{top:e,right:e,bottom:e,left:e}}function N1(e){let{x:t,y:r,width:n,height:o}=e;return{width:n,height:o,top:r,left:t,right:t+n,bottom:r+o,x:t,y:r}}function TDt(e,t,r){let{reference:n,floating:o}=e,i=JC(t),a=Noe(t),s=joe(a),u=eS(t),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(j1(t)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var ADt=async(e,t,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(t)),l=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:d}=TDt(l,n,u),f=n,p={},h=0;for(let m=0;m<s.length;m++){let{name:_,fn:g}=s[m],{x:v,y:S,data:x,reset:O}=await g({x:c,y:d,initialPlacement:n,placement:f,strategy:o,middlewareData:p,rects:l,platform:a,elements:{reference:e,floating:t}});c=v??c,d=S??d,p={...p,[_]:{...p[_],...x}},O&&h<=50&&(h++,typeof O=="object"&&(O.placement&&(f=O.placement),O.rects&&(l=O.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):O.rects),{x:c,y:d}=TDt(l,f,u)),m=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function DB(e,t){var r;t===void 0&&(t={});let{x:n,y:o,platform:i,rects:a,elements:s,strategy:u}=e,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=Qw(t,e),h=MMe(p),_=s[f?d==="floating"?"reference":"floating":d],g=N1(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(_)))==null||r?_:_.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:c,strategy:u})),v=d==="floating"?{x:n,y:o,width:a.floating.width,height:a.floating.height}:a.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),x=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},O=N1(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:S,strategy:u}):v);return{top:(g.top-O.top+h.top)/x.y,bottom:(O.bottom-g.bottom+h.bottom)/x.y,left:(g.left-O.left+h.left)/x.x,right:(O.right-g.right+h.right)/x.x}}var RDt=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:o,rects:i,platform:a,elements:s,middlewareData:u}=t,{element:l,padding:c=0}=Qw(e,t)||{};if(l==null)return{};let d=MMe(c),f={x:r,y:n},p=Noe(o),h=joe(p),m=await a.getDimensions(l),_=p==="y",g=_?"top":"left",v=_?"bottom":"right",S=_?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[p]-f[p]-i.floating[h],O=f[p]-i.reference[p],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),E=T?T[S]:0;(!E||!await(a.isElement==null?void 0:a.isElement(T)))&&(E=s.floating[S]||i.floating[h]);let M=x/2-O/2,A=E/2-m[h]/2-1,j=Xw(d[g],A),N=Xw(d[v],A),F=j,k=E-m[h]-N,L=E/2-m[h]/2+M,q=Roe(F,L,k),U=!u.arrow&&j1(o)!=null&&L!==q&&i.reference[h]/2-(L<F?j:N)-m[h]/2<0,G=U?L<F?L-F:L-k:0;return{[p]:f[p]+G,data:{[p]:q,centerOffset:L-q-G,...U&&{alignmentOffset:G}},reset:U}}});var DDt=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;let{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:u,elements:l}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,..._}=Qw(e,t);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let g=eS(o),v=JC(s),S=eS(s)===s,x=await(u.isRTL==null?void 0:u.isRTL(l.floating)),O=f||(S||!m?[lH(s)]:EDt(s)),T=h!=="none";!f&&T&&O.push(...PDt(s,m,h,x));let E=[s,...O],M=await DB(t,_),A=[],j=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&A.push(M[g]),d){let L=ODt(o,a,x);A.push(M[L[0]],M[L[1]])}if(j=[...j,{placement:o,overflows:A}],!A.every(L=>L<=0)){var N,F;let L=(((N=i.flip)==null?void 0:N.index)||0)+1,q=E[L];if(q)return{data:{index:L,overflows:j},reset:{placement:q}};let U=(F=j.filter(G=>G.overflows[0]<=0).sort((G,V)=>G.overflows[1]-V.overflows[1])[0])==null?void 0:F.placement;if(!U)switch(p){case"bestFit":{var k;let G=(k=j.filter(V=>{if(T){let D=JC(V.placement);return D===v||D==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(D=>D>0).reduce((D,z)=>D+z,0)]).sort((V,D)=>V[1]-D[1])[0])==null?void 0:k[0];G&&(U=G);break}case"initialPlacement":U=s;break}if(o!==U)return{reset:{placement:U}}}return{}}}};function MDt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function IDt(e){return CDt.some(t=>e[t]>=0)}var jDt=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){let{rects:r}=t,{strategy:n="referenceHidden",...o}=Qw(e,t);switch(n){case"referenceHidden":{let i=await DB(t,{...o,elementContext:"reference"}),a=MDt(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:IDt(a)}}}case"escaped":{let i=await DB(t,{...o,altBoundary:!0}),a=MDt(i,r.floating);return{data:{escapedOffsets:a,escaped:IDt(a)}}}default:return{}}}}};async function Pan(e,t){let{placement:r,platform:n,elements:o}=e,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=eS(r),s=j1(r),u=JC(r)==="y",l=["left","top"].includes(a)?-1:1,c=i&&u?-1:1,d=Qw(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof h=="number"&&(p=s==="end"?h*-1:h),u?{x:p*c,y:f*l}:{x:f*l,y:p*c}}var NDt=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;let{x:o,y:i,placement:a,middlewareData:s}=t,u=await Pan(t,e);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}}}}},LDt=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:r,y:n,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:_=>{let{x:g,y:v}=_;return{x:g,y:v}}},...u}=Qw(e,t),l={x:r,y:n},c=await DB(t,u),d=JC(eS(o)),f=Doe(d),p=l[f],h=l[d];if(i){let _=f==="y"?"top":"left",g=f==="y"?"bottom":"right",v=p+c[_],S=p-c[g];p=Roe(v,p,S)}if(a){let _=d==="y"?"top":"left",g=d==="y"?"bottom":"right",v=h+c[_],S=h-c[g];h=Roe(v,h,S)}let m=s.fn({...t,[f]:p,[d]:h});return{...m,data:{x:m.x-r,y:m.y-n,enabled:{[f]:i,[d]:a}}}}}},FDt=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:r,y:n,placement:o,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:u=!0,crossAxis:l=!0}=Qw(e,t),c={x:r,y:n},d=JC(o),f=Doe(d),p=c[f],h=c[d],m=Qw(s,t),_=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(u){let S=f==="y"?"height":"width",x=i.reference[f]-i.floating[S]+_.mainAxis,O=i.reference[f]+i.reference[S]-_.mainAxis;p<x?p=x:p>O&&(p=O)}if(l){var g,v;let S=f==="y"?"width":"height",x=["top","left"].includes(eS(o)),O=i.reference[d]-i.floating[S]+(x&&((g=a.offset)==null?void 0:g[d])||0)+(x?0:_.crossAxis),T=i.reference[d]+i.reference[S]+(x?0:((v=a.offset)==null?void 0:v[d])||0)-(x?_.crossAxis:0);h<O?h=O:h>T&&(h=T)}return{[f]:p,[d]:h}}}},kDt=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;let{placement:o,rects:i,platform:a,elements:s}=t,{apply:u=()=>{},...l}=Qw(e,t),c=await DB(t,l),d=eS(o),f=j1(o),p=JC(o)==="y",{width:h,height:m}=i.floating,_,g;d==="top"||d==="bottom"?(_=d,g=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(g=d,_=f==="end"?"top":"bottom");let v=m-c.top-c.bottom,S=h-c.left-c.right,x=Xw(m-c[_],v),O=Xw(h-c[g],S),T=!t.middlewareData.shift,E=x,M=O;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(M=S),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(E=v),T&&!f){let j=Hd(c.left,0),N=Hd(c.right,0),F=Hd(c.top,0),k=Hd(c.bottom,0);p?M=h-2*(j!==0||N!==0?j+N:Hd(c.left,c.right)):E=m-2*(F!==0||k!==0?F+k:Hd(c.top,c.bottom))}await u({...t,availableWidth:M,availableHeight:E});let A=await a.getDimensions(s.floating);return h!==A.width||m!==A.height?{reset:{rects:!0}}:{}}}};function Loe(){return typeof window<"u"}function F1(e){return $Dt(e)?(e.nodeName||"").toLowerCase():"#document"}function Vf(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ug(e){var t;return(t=($Dt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $Dt(e){return Loe()?e instanceof Node||e instanceof Vf(e).Node:!1}function ym(e){return Loe()?e instanceof Element||e instanceof Vf(e).Element:!1}function zg(e){return Loe()?e instanceof HTMLElement||e instanceof Vf(e).HTMLElement:!1}function BDt(e){return!Loe()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Vf(e).ShadowRoot}function jB(e){let{overflow:t,overflowX:r,overflowY:n,display:o}=bm(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(o)}function qDt(e){return["table","td","th"].includes(F1(e))}function fH(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Foe(e){let t=koe(),r=ym(e)?bm(e):e;return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(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 UDt(e){let t=GC(e);for(;zg(t)&&!k1(t);){if(Foe(t))return t;if(fH(t))return null;t=GC(t)}return null}function koe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function k1(e){return["html","body","#document"].includes(F1(e))}function bm(e){return Vf(e).getComputedStyle(e)}function pH(e){return ym(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function GC(e){if(F1(e)==="html")return e;let t=e.assignedSlot||e.parentNode||BDt(e)&&e.host||Ug(e);return BDt(t)?t.host:t}function zDt(e){let t=GC(e);return k1(t)?e.ownerDocument?e.ownerDocument.body:e.body:zg(t)&&jB(t)?t:zDt(t)}function L1(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);let o=zDt(e),i=o===((n=e.ownerDocument)==null?void 0:n.body),a=Vf(o);if(i){let s=Boe(a);return t.concat(a,a.visualViewport||[],jB(o)?o:[],s&&r?L1(s):[])}return t.concat(o,L1(o,[],r))}function Boe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function WDt(e){let t=bm(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,o=zg(e),i=o?e.offsetWidth:r,a=o?e.offsetHeight:n,s=cH(r)!==i||cH(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function AMe(e){return ym(e)?e:e.contextElement}function NB(e){let t=AMe(e);if(!zg(t))return qg(1);let r=t.getBoundingClientRect(),{width:n,height:o,$:i}=WDt(t),a=(i?cH(r.width):r.width)/n,s=(i?cH(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var Tan=qg(0);function JDt(e){let t=Vf(e);return!koe()||!t.visualViewport?Tan:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Man(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Vf(e)?!1:t}function B1(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);let o=e.getBoundingClientRect(),i=AMe(e),a=qg(1);t&&(n?ym(n)&&(a=NB(n)):a=NB(e));let s=Man(i,r,n)?JDt(i):qg(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=Vf(i),p=n&&ym(n)?Vf(n):n,h=f,m=Boe(h);for(;m&&n&&p!==h;){let _=NB(m),g=m.getBoundingClientRect(),v=bm(m),S=g.left+(m.clientLeft+parseFloat(v.paddingLeft))*_.x,x=g.top+(m.clientTop+parseFloat(v.paddingTop))*_.y;u*=_.x,l*=_.y,c*=_.x,d*=_.y,u+=S,l+=x,h=Vf(m),m=Boe(h)}}return N1({width:c,height:d,x:u,y:l})}function RMe(e,t){let r=pH(e).scrollLeft;return t?t.left+r:B1(Ug(e)).left+r}function GDt(e,t,r){r===void 0&&(r=!1);let n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-(r?0:RMe(e,n)),i=n.top+t.scrollTop;return{x:o,y:i}}function Ian(e){let{elements:t,rect:r,offsetParent:n,strategy:o}=e,i=o==="fixed",a=Ug(n),s=t?fH(t.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=qg(1),c=qg(0),d=zg(n);if((d||!d&&!i)&&((F1(n)!=="body"||jB(a))&&(u=pH(n)),zg(n))){let p=B1(n);l=NB(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?GDt(a,u,!0):qg(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 Aan(e){return Array.from(e.getClientRects())}function Ran(e){let t=Ug(e),r=pH(e),n=e.ownerDocument.body,o=Hd(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=Hd(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+RMe(e),s=-r.scrollTop;return bm(n).direction==="rtl"&&(a+=Hd(t.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function Dan(e,t){let r=Vf(e),n=Ug(e),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let l=koe();(!l||l&&t==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:i,height:a,x:s,y:u}}function jan(e,t){let r=B1(e,!0,t==="fixed"),n=r.top+e.clientTop,o=r.left+e.clientLeft,i=zg(e)?NB(e):qg(1),a=e.clientWidth*i.x,s=e.clientHeight*i.y,u=o*i.x,l=n*i.y;return{width:a,height:s,x:u,y:l}}function HDt(e,t,r){let n;if(t==="viewport")n=Dan(e,r);else if(t==="document")n=Ran(Ug(e));else if(ym(t))n=jan(t,r);else{let o=JDt(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return N1(n)}function KDt(e,t){let r=GC(e);return r===t||!ym(r)||k1(r)?!1:bm(r).position==="fixed"||KDt(r,t)}function Nan(e,t){let r=t.get(e);if(r)return r;let n=L1(e,[],!1).filter(s=>ym(s)&&F1(s)!=="body"),o=null,i=bm(e).position==="fixed",a=i?GC(e):e;for(;ym(a)&&!k1(a);){let s=bm(a),u=Foe(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||jB(a)&&!u&&KDt(e,a))?n=n.filter(c=>c!==a):o=s,a=GC(a)}return t.set(e,n),n}function Lan(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e,a=[...r==="clippingAncestors"?fH(t)?[]:Nan(t,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=HDt(t,c,o);return l.top=Hd(d.top,l.top),l.right=Xw(d.right,l.right),l.bottom=Xw(d.bottom,l.bottom),l.left=Hd(d.left,l.left),l},HDt(t,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function Fan(e){let{width:t,height:r}=WDt(e);return{width:t,height:r}}function kan(e,t,r){let n=zg(t),o=Ug(t),i=r==="fixed",a=B1(e,!0,i,t),s={scrollLeft:0,scrollTop:0},u=qg(0);if(n||!n&&!i)if((F1(t)!=="body"||jB(o))&&(s=pH(t)),n){let f=B1(t,!0,i,t);u.x=f.x+t.clientLeft,u.y=f.y+t.clientTop}else o&&(u.x=RMe(o));let l=o&&!n&&!i?GDt(o,s):qg(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 IMe(e){return bm(e).position==="static"}function VDt(e,t){if(!zg(e)||bm(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Ug(e)===r&&(r=r.ownerDocument.body),r}function YDt(e,t){let r=Vf(e);if(fH(e))return r;if(!zg(e)){let o=GC(e);for(;o&&!k1(o);){if(ym(o)&&!IMe(o))return o;o=GC(o)}return r}let n=VDt(e,t);for(;n&&qDt(n)&&IMe(n);)n=VDt(n,t);return n&&k1(n)&&IMe(n)&&!Foe(n)?r:n||UDt(e)||r}var Ban=async function(e){let t=this.getOffsetParent||YDt,r=this.getDimensions,n=await r(e.floating);return{reference:kan(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function $an(e){return bm(e).direction==="rtl"}var ZDt={convertOffsetParentRelativeRectToViewportRelativeRect:Ian,getDocumentElement:Ug,getClippingRect:Lan,getOffsetParent:YDt,getElementRects:Ban,getClientRects:Aan,getDimensions:Fan,getScale:NB,isElement:ym,isRTL:$an};function qan(e,t){let r=null,n,o=Ug(e);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}=e.getBoundingClientRect();if(s||t(),!d||!f)return;let p=dH(c),h=dH(o.clientWidth-(l+d)),m=dH(o.clientHeight-(c+f)),_=dH(l),v={rootMargin:-p+"px "+-h+"px "+-m+"px "+-_+"px",threshold:Hd(0,Xw(1,u))||1},S=!0;function x(O){let T=O[0].intersectionRatio;if(T!==u){if(!S)return a();T?a(!1,T):n=setTimeout(()=>{a(!1,1e-7)},1e3)}S=!1}try{r=new IntersectionObserver(x,{...v,root:o.ownerDocument})}catch{r=new IntersectionObserver(x,v)}r.observe(e)}return a(!0),i}function KC(e,t,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=AMe(e),c=o||i?[...l?L1(l):[],...L1(t)]:[];c.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});let d=l&&s?qan(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(g=>{let[v]=g;v&&v.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var S;(S=p)==null||S.observe(t)})),r()}),l&&!u&&p.observe(l),p.observe(t));let h,m=u?B1(e):null;u&&_();function _(){let g=B1(e);m&&(g.x!==m.x||g.y!==m.y||g.width!==m.width||g.height!==m.height)&&r(),m=g,h=requestAnimationFrame(_)}return r(),()=>{var g;c.forEach(v=>{o&&v.removeEventListener("scroll",r),i&&v.removeEventListener("resize",r)}),d?.(),(g=p)==null||g.disconnect(),p=null,u&&cancelAnimationFrame(h)}}var XDt=NDt;var QDt=LDt,ejt=DDt,tjt=kDt,rjt=jDt,DMe=RDt;var njt=FDt,jMe=(e,t,r)=>{let n=new Map,o={platform:ZDt,...r},i={...o.platform,_c:n};return ADt(e,t,{...o,platform:i})};var Au=B(Y(),1),Uoe=B(Y(),1),ijt=B(ss(),1),$oe=typeof document<"u"?Uoe.useLayoutEffect:Uoe.useEffect;function qoe(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!qoe(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=r;n--!==0;){let i=o[n];if(!(i==="_owner"&&e.$$typeof)&&!qoe(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function ajt(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ojt(e,t){let r=ajt(e);return Math.round(t*r)/r}function NMe(e){let t=Au.useRef(e);return $oe(()=>{t.current=e}),t}function NT(e){e===void 0&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:u,open:l}=e,[c,d]=Au.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Au.useState(n);qoe(f,n)||p(n);let[h,m]=Au.useState(null),[_,g]=Au.useState(null),v=Au.useCallback(V=>{V!==T.current&&(T.current=V,m(V))},[]),S=Au.useCallback(V=>{V!==E.current&&(E.current=V,g(V))},[]),x=i||h,O=a||_,T=Au.useRef(null),E=Au.useRef(null),M=Au.useRef(c),A=u!=null,j=NMe(u),N=NMe(o),F=NMe(l),k=Au.useCallback(()=>{if(!T.current||!E.current)return;let V={placement:t,strategy:r,middleware:f};N.current&&(V.platform=N.current),jMe(T.current,E.current,V).then(D=>{let z={...D,isPositioned:F.current!==!1};L.current&&!qoe(M.current,z)&&(M.current=z,ijt.flushSync(()=>{d(z)}))})},[f,t,r,N,F]);$oe(()=>{l===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,d(V=>({...V,isPositioned:!1})))},[l]);let L=Au.useRef(!1);$oe(()=>(L.current=!0,()=>{L.current=!1}),[]),$oe(()=>{if(x&&(T.current=x),O&&(E.current=O),x&&O){if(j.current)return j.current(x,O,k);k()}},[x,O,k,j,A]);let q=Au.useMemo(()=>({reference:T,floating:E,setReference:v,setFloating:S}),[v,S]),U=Au.useMemo(()=>({reference:x,floating:O}),[x,O]),G=Au.useMemo(()=>{let V={position:r,left:0,top:0};if(!U.floating)return V;let D=ojt(U.floating,c.x),z=ojt(U.floating,c.y);return s?{...V,transform:"translate("+D+"px, "+z+"px)",...ajt(U.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:D,top:z}},[r,s,U.floating,c.x,c.y]);return Au.useMemo(()=>({...c,update:k,refs:q,elements:U,floatingStyles:G}),[c,k,q,U,G])}var Uan=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){let{element:n,padding:o}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?DMe({element:n.current,padding:o}).fn(r):{}:n?DMe({element:n,padding:o}).fn(r):{}}}},LT=(e,t)=>({...XDt(e),options:[e,t]}),FT=(e,t)=>({...QDt(e),options:[e,t]}),kT=(e,t)=>({...njt(e),options:[e,t]}),BT=(e,t)=>({...ejt(e),options:[e,t]}),$T=(e,t)=>({...tjt(e),options:[e,t]});var qT=(e,t)=>({...rjt(e),options:[e,t]});var UT=(e,t)=>({...Uan(e),options:[e,t]});var sjt=B(Y(),1);var LMe=B(lt(),1),zan="Arrow",ujt=sjt.forwardRef((e,t)=>{let{children:r,width:n=10,height:o=5,...i}=e;return(0,LMe.jsx)(Rl.svg,{...i,ref:t,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,LMe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});ujt.displayName=zan;var ljt=ujt;var cjt=B(Y(),1);function _m(e){let[t,r]=cjt.useState(void 0);return qr(()=>{if(e){r({width:e.offsetWidth,height:e.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=e.offsetWidth,s=e.offsetHeight;r({width:a,height:s})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var zT=B(lt(),1);var FMe="Popper",[djt,kMe]=Ro(FMe),[Van,fjt]=djt(FMe),pjt=e=>{let{__scopePopper:t,children:r}=e,[n,o]=kp.useState(null);return(0,zT.jsx)(Van,{scope:t,anchor:n,onAnchorChange:o,children:r})};pjt.displayName=FMe;var hjt="PopperAnchor",mjt=kp.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:n,...o}=e,i=fjt(hjt,r),a=kp.useRef(null),s=mc(t,a);return kp.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,zT.jsx)(Rl.div,{...o,ref:s})});mjt.displayName=hjt;var BMe="PopperContent",[Wan,Jan]=djt(BMe),gjt=kp.forwardRef((e,t)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:h,...m}=e,_=fjt(BMe,r),[g,v]=kp.useState(null),S=mc(t,ne=>v(ne)),[x,O]=kp.useState(null),T=_m(x),E=T?.width??0,M=T?.height??0,A=n+(i!=="center"?"-"+i:""),j=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],F=N.length>0,k={padding:j,boundary:N.filter(Kan),altBoundary:F},{refs:L,floatingStyles:q,placement:U,isPositioned:G,middlewareData:V}=NT({strategy:"fixed",placement:A,whileElementsMounted:(...ne)=>KC(...ne,{animationFrame:p==="always"}),elements:{reference:_.anchor},middleware:[LT({mainAxis:o+M,alignmentAxis:a}),u&&FT({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?kT():void 0,...k}),u&&BT({...k}),$T({...k,apply:({elements:ne,rects:Pe,availableWidth:ht,availableHeight:we})=>{let{width:ae,height:ee}=Pe.reference,ge=ne.floating.style;ge.setProperty("--radix-popper-available-width",`${ht}px`),ge.setProperty("--radix-popper-available-height",`${we}px`),ge.setProperty("--radix-popper-anchor-width",`${ae}px`),ge.setProperty("--radix-popper-anchor-height",`${ee}px`)}}),x&&UT({element:x,padding:s}),Yan({arrowWidth:E,arrowHeight:M}),f&&qT({strategy:"referenceHidden",...k})]}),[D,z]=_jt(U),W=Gt(h);qr(()=>{G&&W?.()},[G,W]);let J=V.arrow?.x,te=V.arrow?.y,Ie=V.arrow?.centerOffset!==0,[Z,X]=kp.useState();return qr(()=>{g&&X(window.getComputedStyle(g).zIndex)},[g]),(0,zT.jsx)("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:G?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Z,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,zT.jsx)(Wan,{scope:r,placedSide:D,onArrowChange:O,arrowX:J,arrowY:te,shouldHideArrow:Ie,children:(0,zT.jsx)(Rl.div,{"data-side":D,"data-align":z,...m,ref:S,style:{...m.style,animation:G?void 0:"none"}})})})});gjt.displayName=BMe;var yjt="PopperArrow",Gan={top:"bottom",right:"left",bottom:"top",left:"right"},bjt=kp.forwardRef(function(t,r){let{__scopePopper:n,...o}=t,i=Jan(yjt,n),a=Gan[i.placedSide];return(0,zT.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,zT.jsx)(ljt,{...o,ref:r,style:{...o.style,display:"block"}})})});bjt.displayName=yjt;function Kan(e){return e!==null}var Yan=e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:o}=t,a=o.arrow?.centerOffset!==0,s=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[l,c]=_jt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,h="",m="";return l==="bottom"?(h=a?d:`${f}px`,m=`${-u}px`):l==="top"?(h=a?d:`${f}px`,m=`${n.floating.height+u}px`):l==="right"?(h=`${-u}px`,m=a?d:`${p}px`):l==="left"&&(h=`${n.floating.width+u}px`,m=a?d:`${p}px`),{data:{x:h,y:m}}}});function _jt(e){let[t,r="center"]=e.split("-");return[t,r]}var $Me=pjt,vjt=mjt,wjt=gjt,Sjt=bjt;var zoe=B(Y(),1),xjt=B(ss(),1);var Cjt=B(lt(),1),Xan="Portal",qMe=zoe.forwardRef((e,t)=>{let{container:r,...n}=e,[o,i]=zoe.useState(!1);qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?xjt.default.createPortal((0,Cjt.jsx)(Rl.div,{...n,ref:t}),a):null});qMe.displayName=Xan;var Wf=B(Y(),1);var Ejt=B(Y(),1);function Ojt(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Qan(...e){return t=>{let r=!1,n=e.map(o=>{let i=Ojt(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():Ojt(e[o],null)}}}}function Pjt(...e){return Ejt.useCallback(Qan(...e),e)}var Tjt=B(Y(),1);function esn(e,t){return Tjt.useReducer((r,n)=>t[r][n]??r,e)}var Ru=e=>{let{present:t,children:r}=e,n=tsn(t),o=typeof r=="function"?r({present:n.isPresent}):Wf.Children.only(r),i=Pjt(n.ref,rsn(o));return typeof r=="function"||n.isPresent?Wf.cloneElement(o,{ref:i}):null};Ru.displayName="Presence";function tsn(e){let[t,r]=Wf.useState(),n=Wf.useRef({}),o=Wf.useRef(e),i=Wf.useRef("none"),a=e?"mounted":"unmounted",[s,u]=esn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Wf.useEffect(()=>{let l=Hoe(n.current);i.current=s==="mounted"?l:"none"},[s]),qr(()=>{let l=n.current,c=o.current;if(c!==e){let f=i.current,p=Hoe(l);e?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),qr(()=>{if(t){let l,c=t.ownerDocument.defaultView??window,d=p=>{let m=Hoe(n.current).includes(p.animationName);if(p.target===t&&m&&(u("ANIMATION_END"),!o.current)){let _=t.style.animationFillMode;t.style.animationFillMode="forwards",l=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=_)})}},f=p=>{p.target===t&&(i.current=Hoe(n.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{c.clearTimeout(l),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:Wf.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function Hoe(e){return e?.animationName||"none"}function rsn(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Dl=B(Y(),1);function $1(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}var HT=B(Y(),1);var Ijt=B(Y(),1);function Mjt(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function UMe(...e){return t=>{let r=!1,n=e.map(o=>{let i=Mjt(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():Mjt(e[o],null)}}}}function hH(...e){return Ijt.useCallback(UMe(...e),e)}var yc=B(Y(),1);var LB=B(lt(),1),FB=yc.forwardRef((e,t)=>{let{children:r,...n}=e,o=yc.Children.toArray(r),i=o.find(osn);if(i){let a=i.props.children,s=o.map(u=>u===i?yc.Children.count(a)>1?yc.Children.only(null):yc.isValidElement(a)?a.props.children:null:u);return(0,LB.jsx)(zMe,{...n,ref:t,children:yc.isValidElement(a)?yc.cloneElement(a,void 0,s):null})}return(0,LB.jsx)(zMe,{...n,ref:t,children:r})});FB.displayName="Slot";var zMe=yc.forwardRef((e,t)=>{let{children:r,...n}=e;if(yc.isValidElement(r)){let o=asn(r);return yc.cloneElement(r,{...isn(n,r.props),ref:t?UMe(t,o):o})}return yc.Children.count(r)>1?yc.Children.only(null):null});zMe.displayName="SlotClone";var nsn=({children:e})=>(0,LB.jsx)(LB.Fragment,{children:e});function osn(e){return yc.isValidElement(e)&&e.type===nsn}function isn(e,t){let r={...t};for(let n in t){let o=e[n],i=t[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{...e,...r}}function asn(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Voe=B(lt(),1);function Ajt(e){let t=e+"CollectionProvider",[r,n]=Ro(t),[o,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:h,children:m}=p,_=HT.default.useRef(null),g=HT.default.useRef(new Map).current;return(0,Voe.jsx)(o,{scope:h,itemMap:g,collectionRef:_,children:m})};a.displayName=t;let s=e+"CollectionSlot",u=HT.default.forwardRef((p,h)=>{let{scope:m,children:_}=p,g=i(s,m),v=hH(h,g.collectionRef);return(0,Voe.jsx)(FB,{ref:v,children:_})});u.displayName=s;let l=e+"CollectionItemSlot",c="data-radix-collection-item",d=HT.default.forwardRef((p,h)=>{let{scope:m,children:_,...g}=p,v=HT.default.useRef(null),S=hH(h,v),x=i(l,m);return HT.default.useEffect(()=>(x.itemMap.set(v,{ref:v,...g}),()=>void x.itemMap.delete(v))),(0,Voe.jsx)(FB,{[c]:"",ref:S,children:_})});d.displayName=l;function f(p){let h=i(e+"CollectionConsumer",p);return HT.default.useCallback(()=>{let _=h.collectionRef.current;if(!_)return[];let g=Array.from(_.querySelectorAll(`[${c}]`));return Array.from(h.itemMap.values()).sort((x,O)=>g.indexOf(x.ref.current)-g.indexOf(O.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Rjt=B(Y(),1),ssn=B(ss(),1);var Djt=B(lt(),1),usn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],HMe=usn.reduce((e,t)=>{let r=Rjt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?FB:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Djt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});var VT=B(lt(),1),VMe="rovingFocusGroup.onEntryFocus",lsn={bubbles:!1,cancelable:!0},Woe="RovingFocusGroup",[WMe,jjt,csn]=Ajt(Woe),[dsn,JMe]=Ro(Woe,[csn]),[fsn,psn]=dsn(Woe),Njt=Dl.forwardRef((e,t)=>(0,VT.jsx)(WMe.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,VT.jsx)(WMe.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,VT.jsx)(hsn,{...e,ref:t})})}));Njt.displayName=Woe;var hsn=Dl.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:u,onEntryFocus:l,preventScrollOnEntryFocus:c=!1,...d}=e,f=Dl.useRef(null),p=hH(t,f),h=RT(i),[m=null,_]=tl({prop:a,defaultProp:s,onChange:u}),[g,v]=Dl.useState(!1),S=Gt(l),x=jjt(r),O=Dl.useRef(!1),[T,E]=Dl.useState(0);return Dl.useEffect(()=>{let M=f.current;if(M)return M.addEventListener(VMe,S),()=>M.removeEventListener(VMe,S)},[S]),(0,VT.jsx)(fsn,{scope:r,orientation:n,dir:h,loop:o,currentTabStopId:m,onItemFocus:Dl.useCallback(M=>_(M),[_]),onItemShiftTab:Dl.useCallback(()=>v(!0),[]),onFocusableItemAdd:Dl.useCallback(()=>E(M=>M+1),[]),onFocusableItemRemove:Dl.useCallback(()=>E(M=>M-1),[]),children:(0,VT.jsx)(HMe.div,{tabIndex:g||T===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:$1(e.onMouseDown,()=>{O.current=!0}),onFocus:$1(e.onFocus,M=>{let A=!O.current;if(M.target===M.currentTarget&&A&&!g){let j=new CustomEvent(VMe,lsn);if(M.currentTarget.dispatchEvent(j),!j.defaultPrevented){let N=x().filter(U=>U.focusable),F=N.find(U=>U.active),k=N.find(U=>U.id===m),q=[F,k,...N].filter(Boolean).map(U=>U.ref.current);kjt(q,c)}}O.current=!1}),onBlur:$1(e.onBlur,()=>v(!1))})})}),Ljt="RovingFocusGroupItem",Fjt=Dl.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...a}=e,s=Fa(),u=i||s,l=psn(Ljt,r),c=l.currentTabStopId===u,d=jjt(r),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return Dl.useEffect(()=>{if(n)return f(),()=>p()},[n,f,p]),(0,VT.jsx)(WMe.ItemSlot,{scope:r,id:u,focusable:n,active:o,children:(0,VT.jsx)(HMe.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...a,ref:t,onMouseDown:$1(e.onMouseDown,h=>{n?l.onItemFocus(u):h.preventDefault()}),onFocus:$1(e.onFocus,()=>l.onItemFocus(u)),onKeyDown:$1(e.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){l.onItemShiftTab();return}if(h.target!==h.currentTarget)return;let m=ysn(h,l.orientation,l.dir);if(m!==void 0){if(h.metaKey||h.ctrlKey||h.altKey||h.shiftKey)return;h.preventDefault();let g=d().filter(v=>v.focusable).map(v=>v.ref.current);if(m==="last")g.reverse();else if(m==="prev"||m==="next"){m==="prev"&&g.reverse();let v=g.indexOf(h.currentTarget);g=l.loop?bsn(g,v+1):g.slice(v+1)}setTimeout(()=>kjt(g))}})})})});Fjt.displayName=Ljt;var msn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function gsn(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function ysn(e,t,r){let n=gsn(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return msn[n]}function kjt(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function bsn(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Bjt=Njt,$jt=Fjt;var vsn=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},kB=new WeakMap,Joe=new WeakMap,Goe={},GMe=0,qjt=function(e){return e&&(e.host||qjt(e.parentNode))},wsn=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=qjt(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Ssn=function(e,t,r,n){var o=wsn(t,Array.isArray(e)?e:[e]);Goe[r]||(Goe[r]=new WeakMap);var i=Goe[r],a=[],s=new Set,u=new Set(o),l=function(d){!d||s.has(d)||(s.add(d),l(d.parentNode))};o.forEach(l);var c=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else try{var p=f.getAttribute(n),h=p!==null&&p!=="false",m=(kB.get(f)||0)+1,_=(i.get(f)||0)+1;kB.set(f,m),i.set(f,_),a.push(f),m===1&&h&&Joe.set(f,!0),_===1&&f.setAttribute(r,"true"),h||f.setAttribute(n,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return c(t),s.clear(),GMe++,function(){a.forEach(function(d){var f=kB.get(d)-1,p=i.get(d)-1;kB.set(d,f),i.set(d,p),f||(Joe.has(d)||d.removeAttribute(n),Joe.delete(d)),p||d.removeAttribute(r)}),GMe--,GMe||(kB=new WeakMap,kB=new WeakMap,Joe=new WeakMap,Goe={})}},WT=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),o=t||vsn(e);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),Ssn(n,o,r,"aria-hidden")):function(){return null}};var Do=function(){return Do=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Do.apply(this,arguments)};function JT(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function BB(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}var Qoe=B(Y());var ud=B(Y());var Hg="right-scroll-bar-position",Vg="width-before-scroll-bar",KMe="with-scroll-bars-hidden",YMe="--removed-body-scroll-bar-size";function Koe(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}var Ujt=B(Y());function zjt(e,t){var r=(0,Ujt.useState)(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var o=r.value;o!==n&&(r.value=n,r.callback(n,o))}}}})[0];return r.callback=t,r.facade}var Yoe=B(Y());var xsn=typeof window<"u"?Yoe.useLayoutEffect:Yoe.useEffect,Hjt=new WeakMap;function q1(e,t){var r=zjt(t||null,function(n){return e.forEach(function(o){return Koe(o,n)})});return xsn(function(){var n=Hjt.get(r);if(n){var o=new Set(n),i=new Set(e),a=r.current;o.forEach(function(s){i.has(s)||Koe(s,null)}),i.forEach(function(s){o.has(s)||Koe(s,a)})}Hjt.set(r,e)},[e]),r}function Csn(e){return e}function Osn(e,t){t===void 0&&(t=Csn);var r=[],n=!1,o={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(i){var a=t(i,n);return r.push(a),function(){r=r.filter(function(s){return s!==a})}},assignSyncMedium:function(i){for(n=!0;r.length;){var a=r;r=[],a.forEach(i)}r={push:function(s){return i(s)},filter:function(){return r}}},assignMedium:function(i){n=!0;var a=[];if(r.length){var s=r;r=[],s.forEach(i),a=r}var u=function(){var c=a;a=[],c.forEach(i)},l=function(){return Promise.resolve().then(u)};l(),r={push:function(c){a.push(c),l()},filter:function(c){return a=a.filter(c),r}}}};return o}function U1(e){e===void 0&&(e={});var t=Osn(null);return t.options=Do({async:!0,ssr:!1},e),t}var Vjt=B(Y()),Wjt=function(e){var t=e.sideCar,r=JT(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return Vjt.createElement(n,Do({},r))};Wjt.isSideCarExport=!0;function z1(e,t){return e.useMedium(t),Wjt}var Zoe=U1();var ZMe=function(){},mH=ud.forwardRef(function(e,t){var r=ud.useRef(null),n=ud.useState({onScrollCapture:ZMe,onWheelCapture:ZMe,onTouchMoveCapture:ZMe}),o=n[0],i=n[1],a=e.forwardProps,s=e.children,u=e.className,l=e.removeScrollBar,c=e.enabled,d=e.shards,f=e.sideCar,p=e.noIsolation,h=e.inert,m=e.allowPinchZoom,_=e.as,g=_===void 0?"div":_,v=e.gapMode,S=JT(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=q1([r,t]),T=Do(Do({},S),o);return ud.createElement(ud.Fragment,null,c&&ud.createElement(x,{sideCar:Zoe,removeScrollBar:l,shards:d,noIsolation:p,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:r,gapMode:v}),a?ud.cloneElement(ud.Children.only(s),Do(Do({},T),{ref:O})):ud.createElement(g,Do({},T,{className:u,ref:O}),s))});mH.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};mH.classNames={fullWidth:Vg,zeroRight:Hg};var Ii=B(Y());var qB=B(Y());var Kjt=B(Y());var Jjt;var Gjt=function(){if(Jjt)return Jjt;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Esn(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Gjt();return t&&e.setAttribute("nonce",t),e}function Psn(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Tsn(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var XMe=function(){var e=0,t=null;return{add:function(r){e==0&&(t=Esn())&&(Psn(t,r),Tsn(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}};var QMe=function(){var e=XMe();return function(t,r){Kjt.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}};var YC=function(){var e=QMe(),t=function(r){var n=r.styles,o=r.dynamic;return e(n,o),null};return t};var Msn={left:0,top:0,right:0,gap:0},eIe=function(e){return parseInt(e||"",10)||0},Isn=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[eIe(r),eIe(n),eIe(o)]},tIe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Msn;var t=Isn(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}};var Asn=YC(),$B="data-scroll-locked",Rsn=function(e,t,r,n){var o=e.left,i=e.top,a=e.right,s=e.gap;return r===void 0&&(r="margin"),`
.`.concat(KMe,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(s,"px ").concat(n,`;
}
body[`).concat($B,`] {
overflow: hidden `).concat(n,`;
overscroll-behavior: contain;
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
padding-left: `.concat(o,`px;
padding-top: `).concat(i,`px;
padding-right: `).concat(a,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(s,"px ").concat(n,`;
`),r==="padding"&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),`
}
.`).concat(Hg,` {
right: `).concat(s,"px ").concat(n,`;
}
.`).concat(Vg,` {
margin-right: `).concat(s,"px ").concat(n,`;
}
.`).concat(Hg," .").concat(Hg,` {
right: 0 `).concat(n,`;
}
.`).concat(Vg," .").concat(Vg,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat($B,`] {
`).concat(YMe,": ").concat(s,`px;
}
`)},Yjt=function(){var e=parseInt(document.body.getAttribute($B)||"0",10);return isFinite(e)?e:0},Dsn=function(){qB.useEffect(function(){return document.body.setAttribute($B,(Yjt()+1).toString()),function(){var e=Yjt()-1;e<=0?document.body.removeAttribute($B):document.body.setAttribute($B,e.toString())}},[])},H1=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,o=n===void 0?"margin":n;Dsn();var i=qB.useMemo(function(){return tIe(o)},[o]);return qB.createElement(Asn,{styles:Rsn(i,!t,o,r?"":"!important")})};var rIe=!1;if(typeof window<"u")try{gH=Object.defineProperty({},"passive",{get:function(){return rIe=!0,!0}}),window.addEventListener("test",gH,gH),window.removeEventListener("test",gH,gH)}catch{rIe=!1}var gH,V1=rIe?{passive:!1}:!1;var jsn=function(e){return e.tagName==="TEXTAREA"},Zjt=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!jsn(e)&&r[t]==="visible")},Nsn=function(e){return Zjt(e,"overflowY")},Lsn=function(e){return Zjt(e,"overflowX")},nIe=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=Xjt(e,n);if(o){var i=Qjt(e,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Fsn=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},ksn=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Xjt=function(e,t){return e==="v"?Nsn(t):Lsn(t)},Qjt=function(e,t){return e==="v"?Fsn(t):ksn(t)},Bsn=function(e,t){return e==="h"&&t==="rtl"?-1:1},eNt=function(e,t,r,n,o){var i=Bsn(e,window.getComputedStyle(t).direction),a=i*n,s=r.target,u=t.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=Qjt(e,s),h=p[0],m=p[1],_=p[2],g=m-_-i*h;(h||g)&&Xjt(e,s)&&(d+=g,f+=h),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(t.contains(s)||t===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var Xoe=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},tNt=function(e){return[e.deltaX,e.deltaY]},rNt=function(e){return e&&"current"in e?e.current:e},$sn=function(e,t){return e[0]===t[0]&&e[1]===t[1]},qsn=function(e){return`
.block-interactivity-`.concat(e,` {pointer-events: none;}
.allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},Usn=0,UB=[];function nNt(e){var t=Ii.useRef([]),r=Ii.useRef([0,0]),n=Ii.useRef(),o=Ii.useState(Usn++)[0],i=Ii.useState(YC)[0],a=Ii.useRef(e);Ii.useEffect(function(){a.current=e},[e]),Ii.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=BB([e.lockRef.current],(e.shards||[]).map(rNt),!0).filter(Boolean);return m.forEach(function(_){return _.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=Ii.useCallback(function(m,_){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var g=Xoe(m),v=r.current,S="deltaX"in m?m.deltaX:v[0]-g[0],x="deltaY"in m?m.deltaY:v[1]-g[1],O,T=m.target,E=Math.abs(S)>Math.abs(x)?"h":"v";if("touches"in m&&E==="h"&&T.type==="range")return!1;var M=nIe(E,T);if(!M)return!0;if(M?O=E:(O=E==="v"?"h":"v",M=nIe(E,T)),!M)return!1;if(!n.current&&"changedTouches"in m&&(S||x)&&(n.current=O),!O)return!0;var A=n.current||O;return eNt(A,_,m,A==="h"?S:x,!0)},[]),u=Ii.useCallback(function(m){var _=m;if(!(!UB.length||UB[UB.length-1]!==i)){var g="deltaY"in _?tNt(_):Xoe(_),v=t.current.filter(function(O){return O.name===_.type&&(O.target===_.target||_.target===O.shadowParent)&&$sn(O.delta,g)})[0];if(v&&v.should){_.cancelable&&_.preventDefault();return}if(!v){var S=(a.current.shards||[]).map(rNt).filter(Boolean).filter(function(O){return O.contains(_.target)}),x=S.length>0?s(_,S[0]):!a.current.noIsolation;x&&_.cancelable&&_.preventDefault()}}},[]),l=Ii.useCallback(function(m,_,g,v){var S={name:m,delta:_,target:g,should:v,shadowParent:zsn(g)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(x){return x!==S})},1)},[]),c=Ii.useCallback(function(m){r.current=Xoe(m),n.current=void 0},[]),d=Ii.useCallback(function(m){l(m.type,tNt(m),m.target,s(m,e.lockRef.current))},[]),f=Ii.useCallback(function(m){l(m.type,Xoe(m),m.target,s(m,e.lockRef.current))},[]);Ii.useEffect(function(){return UB.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,V1),document.addEventListener("touchmove",u,V1),document.addEventListener("touchstart",c,V1),function(){UB=UB.filter(function(m){return m!==i}),document.removeEventListener("wheel",u,V1),document.removeEventListener("touchmove",u,V1),document.removeEventListener("touchstart",c,V1)}},[]);var p=e.removeScrollBar,h=e.inert;return Ii.createElement(Ii.Fragment,null,h?Ii.createElement(i,{styles:qsn(o)}):null,p?Ii.createElement(H1,{gapMode:e.gapMode}):null)}function zsn(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var oNt=z1(Zoe,nNt);var iNt=Qoe.forwardRef(function(e,t){return Qoe.createElement(mH,Do({},e,{ref:t,sideCar:oNt}))});iNt.classNames=mH.classNames;var oIe=iNt;var rr=B(lt(),1),iIe=["Enter"," "],Hsn=["ArrowDown","PageUp","Home"],sNt=["ArrowUp","PageDown","End"],Vsn=[...Hsn,...sNt],Wsn={ltr:[...iIe,"ArrowRight"],rtl:[...iIe,"ArrowLeft"]},Jsn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},vH="Menu",[bH,Gsn,Ksn]=aDt(vH),[W1,aIe]=Ro(vH,[Ksn,kMe,JMe]),wH=kMe(),uNt=JMe(),[lNt,GT]=W1(vH),[Ysn,SH]=W1(vH),cNt=e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=e,s=wH(t),[u,l]=wt.useState(null),c=wt.useRef(!1),d=Gt(i),f=RT(o);return wt.useEffect(()=>{let p=()=>{c.current=!0,document.addEventListener("pointerdown",h,{capture:!0,once:!0}),document.addEventListener("pointermove",h,{capture:!0,once:!0})},h=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",h,{capture:!0}),document.removeEventListener("pointermove",h,{capture:!0})}},[]),(0,rr.jsx)($Me,{...s,children:(0,rr.jsx)(lNt,{scope:t,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,rr.jsx)(Ysn,{scope:t,onClose:wt.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};cNt.displayName=vH;var Zsn="MenuAnchor",sIe=wt.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,o=wH(r);return(0,rr.jsx)(vjt,{...o,...n,ref:t})});sIe.displayName=Zsn;var uIe="MenuPortal",[Xsn,dNt]=W1(uIe,{forceMount:void 0}),fNt=e=>{let{__scopeMenu:t,forceMount:r,children:n,container:o}=e,i=GT(uIe,t);return(0,rr.jsx)(Xsn,{scope:t,forceMount:r,children:(0,rr.jsx)(Ru,{present:r||i.open,children:(0,rr.jsx)(qMe,{asChild:!0,container:o,children:n})})})};fNt.displayName=uIe;var vm="MenuContent",[Qsn,lIe]=W1(vm),pNt=wt.forwardRef((e,t)=>{let r=dNt(vm,e.__scopeMenu),{forceMount:n=r.forceMount,...o}=e,i=GT(vm,e.__scopeMenu),a=SH(vm,e.__scopeMenu);return(0,rr.jsx)(bH.Provider,{scope:e.__scopeMenu,children:(0,rr.jsx)(Ru,{present:n||i.open,children:(0,rr.jsx)(bH.Slot,{scope:e.__scopeMenu,children:a.modal?(0,rr.jsx)(eun,{...o,ref:t}):(0,rr.jsx)(tun,{...o,ref:t})})})})}),eun=wt.forwardRef((e,t)=>{let r=GT(vm,e.__scopeMenu),n=wt.useRef(null),o=mc(t,n);return wt.useEffect(()=>{let i=n.current;if(i)return WT(i)},[]),(0,rr.jsx)(cIe,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:pi(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),tun=wt.forwardRef((e,t)=>{let r=GT(vm,e.__scopeMenu);return(0,rr.jsx)(cIe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),cIe=wt.forwardRef((e,t)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:h,...m}=e,_=GT(vm,r),g=SH(vm,r),v=wH(r),S=uNt(r),x=Gsn(r),[O,T]=wt.useState(null),E=wt.useRef(null),M=mc(t,E,_.onContentChange),A=wt.useRef(0),j=wt.useRef(""),N=wt.useRef(0),F=wt.useRef(null),k=wt.useRef("right"),L=wt.useRef(0),q=h?oIe:wt.Fragment,U=h?{as:IT,allowPinchZoom:!0}:void 0,G=D=>{let z=j.current+D,W=x().filter(ne=>!ne.disabled),J=document.activeElement,te=W.find(ne=>ne.ref.current===J)?.textValue,Ie=W.map(ne=>ne.textValue),Z=hun(Ie,z,te),X=W.find(ne=>ne.textValue===Z)?.ref.current;(function ne(Pe){j.current=Pe,window.clearTimeout(A.current),Pe!==""&&(A.current=window.setTimeout(()=>ne(""),1e3))})(z),X&&setTimeout(()=>X.focus())};wt.useEffect(()=>()=>window.clearTimeout(A.current),[]),DT();let V=wt.useCallback(D=>k.current===F.current?.side&&gun(D,F.current?.area),[]);return(0,rr.jsx)(Qsn,{scope:r,searchRef:j,onItemEnter:wt.useCallback(D=>{V(D)&&D.preventDefault()},[V]),onItemLeave:wt.useCallback(D=>{V(D)||(E.current?.focus(),T(null))},[V]),onTriggerLeave:wt.useCallback(D=>{V(D)&&D.preventDefault()},[V]),pointerGraceTimerRef:N,onPointerGraceIntentChange:wt.useCallback(D=>{F.current=D},[]),children:(0,rr.jsx)(q,{...U,children:(0,rr.jsx)(TMe,{asChild:!0,trapped:o,onMountAutoFocus:pi(i,D=>{D.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,rr.jsx)(CMe,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,rr.jsx)(Bjt,{asChild:!0,...S,dir:g.dir,orientation:"vertical",loop:n,currentTabStopId:O,onCurrentTabStopIdChange:T,onEntryFocus:pi(u,D=>{g.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,rr.jsx)(wjt,{role:"menu","aria-orientation":"vertical","data-state":MNt(_.open),"data-radix-menu-content":"",dir:g.dir,...v,...m,ref:M,style:{outline:"none",...m.style},onKeyDown:pi(m.onKeyDown,D=>{let W=D.target.closest("[data-radix-menu-content]")===D.currentTarget,J=D.ctrlKey||D.altKey||D.metaKey,te=D.key.length===1;W&&(D.key==="Tab"&&D.preventDefault(),!J&&te&&G(D.key));let Ie=E.current;if(D.target!==Ie||!Vsn.includes(D.key))return;D.preventDefault();let X=x().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);sNt.includes(D.key)&&X.reverse(),fun(X)}),onBlur:pi(e.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(A.current),j.current="")}),onPointerMove:pi(e.onPointerMove,_H(D=>{let z=D.target,W=L.current!==D.clientX;if(D.currentTarget.contains(z)&&W){let J=D.clientX>L.current?"right":"left";k.current=J,L.current=D.clientX}}))})})})})})})});pNt.displayName=vm;var run="MenuGroup",dIe=wt.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,rr.jsx)(Rl.div,{role:"group",...n,ref:t})});dIe.displayName=run;var nun="MenuLabel",hNt=wt.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,rr.jsx)(Rl.div,{...n,ref:t})});hNt.displayName=nun;var eie="MenuItem",aNt="menu.itemSelect",rie=wt.forwardRef((e,t)=>{let{disabled:r=!1,onSelect:n,...o}=e,i=wt.useRef(null),a=SH(eie,e.__scopeMenu),s=lIe(eie,e.__scopeMenu),u=mc(t,i),l=wt.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(aNt,{bubbles:!0,cancelable:!0});d.addEventListener(aNt,p=>n?.(p),{once:!0}),Moe(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,rr.jsx)(mNt,{...o,ref:u,disabled:r,onClick:pi(e.onClick,c),onPointerDown:d=>{e.onPointerDown?.(d),l.current=!0},onPointerUp:pi(e.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:pi(e.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||iIe.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});rie.displayName=eie;var mNt=wt.forwardRef((e,t)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=e,a=lIe(eie,r),s=uNt(r),u=wt.useRef(null),l=mc(t,u),[c,d]=wt.useState(!1),[f,p]=wt.useState("");return wt.useEffect(()=>{let h=u.current;h&&p((h.textContent??"").trim())},[i.children]),(0,rr.jsx)(bH.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,rr.jsx)($jt,{asChild:!0,...s,focusable:!n,children:(0,rr.jsx)(Rl.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:pi(e.onPointerMove,_H(h=>{n?a.onItemLeave(h):(a.onItemEnter(h),h.defaultPrevented||h.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:pi(e.onPointerLeave,_H(h=>a.onItemLeave(h))),onFocus:pi(e.onFocus,()=>d(!0)),onBlur:pi(e.onBlur,()=>d(!1))})})})}),oun="MenuCheckboxItem",gNt=wt.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:n,...o}=e;return(0,rr.jsx)(wNt,{scope:e.__scopeMenu,checked:r,children:(0,rr.jsx)(rie,{role:"menuitemcheckbox","aria-checked":tie(r)?"mixed":r,...o,ref:t,"data-state":hIe(r),onSelect:pi(o.onSelect,()=>n?.(tie(r)?!0:!r),{checkForDefaultPrevented:!1})})})});gNt.displayName=oun;var yNt="MenuRadioGroup",[iun,aun]=W1(yNt,{value:void 0,onValueChange:()=>{}}),bNt=wt.forwardRef((e,t)=>{let{value:r,onValueChange:n,...o}=e,i=Gt(n);return(0,rr.jsx)(iun,{scope:e.__scopeMenu,value:r,onValueChange:i,children:(0,rr.jsx)(dIe,{...o,ref:t})})});bNt.displayName=yNt;var _Nt="MenuRadioItem",vNt=wt.forwardRef((e,t)=>{let{value:r,...n}=e,o=aun(_Nt,e.__scopeMenu),i=r===o.value;return(0,rr.jsx)(wNt,{scope:e.__scopeMenu,checked:i,children:(0,rr.jsx)(rie,{role:"menuitemradio","aria-checked":i,...n,ref:t,"data-state":hIe(i),onSelect:pi(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});vNt.displayName=_Nt;var fIe="MenuItemIndicator",[wNt,sun]=W1(fIe,{checked:!1}),SNt=wt.forwardRef((e,t)=>{let{__scopeMenu:r,forceMount:n,...o}=e,i=sun(fIe,r);return(0,rr.jsx)(Ru,{present:n||tie(i.checked)||i.checked===!0,children:(0,rr.jsx)(Rl.span,{...o,ref:t,"data-state":hIe(i.checked)})})});SNt.displayName=fIe;var uun="MenuSeparator",xNt=wt.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,rr.jsx)(Rl.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});xNt.displayName=uun;var lun="MenuArrow",CNt=wt.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,o=wH(r);return(0,rr.jsx)(Sjt,{...o,...n,ref:t})});CNt.displayName=lun;var pIe="MenuSub",[cun,ONt]=W1(pIe),dun=e=>{let{__scopeMenu:t,children:r,open:n=!1,onOpenChange:o}=e,i=GT(pIe,t),a=wH(t),[s,u]=wt.useState(null),[l,c]=wt.useState(null),d=Gt(o);return wt.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,rr.jsx)($Me,{...a,children:(0,rr.jsx)(lNt,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,rr.jsx)(cun,{scope:t,contentId:Fa(),triggerId:Fa(),trigger:s,onTriggerChange:u,children:r})})})};dun.displayName=pIe;var yH="MenuSubTrigger",ENt=wt.forwardRef((e,t)=>{let r=GT(yH,e.__scopeMenu),n=SH(yH,e.__scopeMenu),o=ONt(yH,e.__scopeMenu),i=lIe(yH,e.__scopeMenu),a=wt.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:e.__scopeMenu},c=wt.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return wt.useEffect(()=>c,[c]),wt.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,rr.jsx)(sIe,{asChild:!0,...l,children:(0,rr.jsx)(mNt,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":MNt(r.open),...e,ref:uH(t,o.onTriggerChange),onClick:d=>{e.onClick?.(d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:pi(e.onPointerMove,_H(d=>{i.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!r.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),c()},100))})),onPointerLeave:pi(e.onPointerLeave,_H(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,h=p==="right",m=h?-5:5,_=f[h?"left":"right"],g=f[h?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:_,y:f.top},{x:g,y:f.top},{x:g,y:f.bottom},{x:_,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:pi(e.onKeyDown,d=>{let f=i.searchRef.current!=="";e.disabled||f&&d.key===" "||Wsn[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});ENt.displayName=yH;var PNt="MenuSubContent",TNt=wt.forwardRef((e,t)=>{let r=dNt(vm,e.__scopeMenu),{forceMount:n=r.forceMount,...o}=e,i=GT(vm,e.__scopeMenu),a=SH(vm,e.__scopeMenu),s=ONt(PNt,e.__scopeMenu),u=wt.useRef(null),l=mc(t,u);return(0,rr.jsx)(bH.Provider,{scope:e.__scopeMenu,children:(0,rr.jsx)(Ru,{present:n||i.open,children:(0,rr.jsx)(bH.Slot,{scope:e.__scopeMenu,children:(0,rr.jsx)(cIe,{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:pi(e.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:pi(e.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:pi(e.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=Jsn[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});TNt.displayName=PNt;function MNt(e){return e?"open":"closed"}function tie(e){return e==="indeterminate"}function hIe(e){return tie(e)?"indeterminate":e?"checked":"unchecked"}function fun(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function pun(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function hun(e,t,r){let o=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,i=r?e.indexOf(r):-1,a=pun(e,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 mun(e,t){let{x:r,y:n}=e,o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){let s=t[i].x,u=t[i].y,l=t[a].x,c=t[a].y;u>n!=c>n&&r<(l-s)*(n-u)/(c-u)+s&&(o=!o)}return o}function gun(e,t){if(!t)return!1;let r={x:e.clientX,y:e.clientY};return mun(r,t)}function _H(e){return t=>t.pointerType==="mouse"?e(t):void 0}var INt=cNt,ANt=sIe,RNt=fNt,DNt=pNt,jNt=dIe,NNt=hNt,LNt=rie,FNt=gNt,kNt=bNt,BNt=vNt,$Nt=SNt,qNt=xNt,UNt=CNt;var zNt=ENt,HNt=TNt;var jl=B(lt(),1),mIe="DropdownMenu",[bun,K2o]=Ro(mIe,[aIe]),Vd=aIe(),[_un,VNt]=bun(mIe),xH=e=>{let{__scopeDropdownMenu:t,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=e,u=Vd(t),l=rl.useRef(null),[c=!1,d]=tl({prop:o,defaultProp:i,onChange:a});return(0,jl.jsx)(_un,{scope:t,triggerId:Fa(),triggerRef:l,contentId:Fa(),open:c,onOpenChange:d,onOpenToggle:rl.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,jl.jsx)(INt,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};xH.displayName=mIe;var WNt="DropdownMenuTrigger",CH=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=e,i=VNt(WNt,r),a=Vd(r);return(0,jl.jsx)(ANt,{asChild:!0,...a,children:(0,jl.jsx)(nDt.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:Eoe(t,i.triggerRef),onPointerDown:sH(e.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:sH(e.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});CH.displayName=WNt;var vun="DropdownMenuPortal",JNt=e=>{let{__scopeDropdownMenu:t,...r}=e,n=Vd(t);return(0,jl.jsx)(RNt,{...n,...r})};JNt.displayName=vun;var GNt="DropdownMenuContent",KNt=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,o=VNt(GNt,r),i=Vd(r),a=rl.useRef(!1);return(0,jl.jsx)(DNt,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:t,onCloseAutoFocus:sH(e.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:sH(e.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:{...e.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)"}})});KNt.displayName=GNt;var wun="DropdownMenuGroup",Sun=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,o=Vd(r);return(0,jl.jsx)(jNt,{...o,...n,ref:t})});Sun.displayName=wun;var xun="DropdownMenuLabel",YNt=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,o=Vd(r);return(0,jl.jsx)(NNt,{...o,...n,ref:t})});YNt.displayName=xun;var Cun="DropdownMenuItem",ZNt=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,o=Vd(r);return(0,jl.jsx)(LNt,{...o,...n,ref:t})});ZNt.displayName=Cun;var Oun="DropdownMenuCheckboxItem",XNt=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,o=Vd(r);return(0,jl.jsx)(FNt,{...o,...n,ref:t})});XNt.displayName=Oun;var Eun="DropdownMenuRadioGroup",Pun=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,o=Vd(r);return(0,jl.jsx)(kNt,{...o,...n,ref:t})});Pun.displayName=Eun;var Tun="DropdownMenuRadioItem",QNt=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,o=Vd(r);return(0,jl.jsx)(BNt,{...o,...n,ref:t})});QNt.displayName=Tun;var Mun="DropdownMenuItemIndicator",eLt=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,o=Vd(r);return(0,jl.jsx)($Nt,{...o,...n,ref:t})});eLt.displayName=Mun;var Iun="DropdownMenuSeparator",tLt=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,o=Vd(r);return(0,jl.jsx)(qNt,{...o,...n,ref:t})});tLt.displayName=Iun;var Aun="DropdownMenuArrow",Run=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,o=Vd(r);return(0,jl.jsx)(UNt,{...o,...n,ref:t})});Run.displayName=Aun;var Dun="DropdownMenuSubTrigger",rLt=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,o=Vd(r);return(0,jl.jsx)(zNt,{...o,...n,ref:t})});rLt.displayName=Dun;var jun="DropdownMenuSubContent",nLt=rl.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,o=Vd(r);return(0,jl.jsx)(HNt,{...o,...n,ref:t,style:{...e.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)"}})});nLt.displayName=jun;var oLt=xH,iLt=CH,aLt=JNt,gIe=KNt;var yIe=YNt,bIe=ZNt,_Ie=XNt;var vIe=QNt,wIe=eLt,SIe=tLt;var xIe=rLt,CIe=nLt;var ni=B(Y());var zB=oLt,HB=iLt;var Lun=ni.forwardRef(({className:e,inset:t,children:r,...n},o)=>ni.createElement(xIe,{ref:o,className:_e("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-dropdown-hover data-[state=open]:bg-dropdown-hover [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n},r,ni.createElement(YS,{className:"ml-auto"})));Lun.displayName=xIe.displayName;var Fun=ni.forwardRef(({className:e,...t},r)=>ni.createElement(CIe,{ref:r,className:_e("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-primary p-1 text-normal shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Fun.displayName=CIe.displayName;var tS=ni.forwardRef(({className:e,sideOffset:t=4,container:r,...n},o)=>ni.createElement(aLt,{container:r??activeDocument.body},ni.createElement(gIe,{ref:o,sideOffset:t,className:_e("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border border-solid bg-primary p-1 text-normal shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})));tS.displayName=gIe.displayName;var Qa=ni.forwardRef(({className:e,inset:t,...r},n)=>ni.createElement(bIe,{ref:n,className:_e("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-dropdown-hover focus:text-normal data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...r}));Qa.displayName=bIe.displayName;var kun=ni.forwardRef(({className:e,children:t,checked:r,...n},o)=>ni.createElement(_Ie,{ref:o,className:_e("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-dropdown-hover focus:text-normal data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n},ni.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},ni.createElement(wIe,null,ni.createElement(Xm,{className:"h-4 w-4"}))),t));kun.displayName=_Ie.displayName;var $un=ni.forwardRef(({className:e,children:t,...r},n)=>ni.createElement(vIe,{ref:n,className:_e("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-dropdown-hover focus:text-normal data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r},ni.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},ni.createElement(wIe,null,ni.createElement(OU,{className:"h-2 w-2 fill-current"}))),t));$un.displayName=vIe.displayName;var qun=ni.forwardRef(({className:e,inset:t,...r},n)=>ni.createElement(yIe,{ref:n,className:_e("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));qun.displayName=yIe.displayName;var Uun=ni.forwardRef(({className:e,...t},r)=>ni.createElement(SIe,{ref:r,className:_e("-mx-1 my-1 h-px bg-muted",e),...t}));Uun.displayName=SIe.displayName;var zun=({className:e,...t})=>ni.createElement("span",{className:_e("ml-auto text-xs tracking-widest opacity-60",e),...t});zun.displayName="DropdownMenuShortcut";var OH=B(Y());var VB=OH.forwardRef(({checked:e=!1,onCheckedChange:t,disabled:r=!1,className:n,...o},i)=>{let a=()=>{r||t?.(!e)},s=u=>{r||(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),t?.(!e))};return OH.createElement("div",{role:"switch","aria-checked":e,"aria-disabled":r,"data-state":e?"checked":"unchecked","data-disabled":r?"":void 0,ref:i,tabIndex:r?-1:0,className:_e("relative inline-flex h-5.5 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e?"bg-interactive-accent":"bg-[--background-modifier-border-hover]",r&&"cursor-not-allowed opacity-50",n),onClick:a,onKeyDown:s,...o},OH.createElement("div",{className:_e("pointer-events-none block h-4 w-4 rounded-full bg-toggle-thumb shadow-lg ring-0 transition-transform",e?"translate-x-5.5":"translate-x-0.5")}))});VB.displayName="SettingSwitch";var PH=B(Y());var Er=B(Y(),1);function Wg(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}var uLt=B(Y(),1);function sLt(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function OIe(...e){return t=>{let r=!1,n=e.map(o=>{let i=sLt(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():sLt(e[o],null)}}}}function ZC(...e){return uLt.useCallback(OIe(...e),e)}var va=B(Y(),1);var lLt=B(Y(),1),cLt=B(ss(),1);var bc=B(Y(),1);var WB=B(lt(),1),PIe=bc.forwardRef((e,t)=>{let{children:r,...n}=e,o=bc.Children.toArray(r),i=o.find(Hun);if(i){let a=i.props.children,s=o.map(u=>u===i?bc.Children.count(a)>1?bc.Children.only(null):bc.isValidElement(a)?a.props.children:null:u);return(0,WB.jsx)(EIe,{...n,ref:t,children:bc.isValidElement(a)?bc.cloneElement(a,void 0,s):null})}return(0,WB.jsx)(EIe,{...n,ref:t,children:r})});PIe.displayName="Slot";var EIe=bc.forwardRef((e,t)=>{let{children:r,...n}=e;if(bc.isValidElement(r)){let o=Wun(r);return bc.cloneElement(r,{...Vun(n,r.props),ref:t?OIe(t,o):o})}return bc.Children.count(r)>1?bc.Children.only(null):null});EIe.displayName="SlotClone";var TIe=({children:e})=>(0,WB.jsx)(WB.Fragment,{children:e});function Hun(e){return bc.isValidElement(e)&&e.type===TIe}function Vun(e,t){let r={...t};for(let n in t){let o=e[n],i=t[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{...e,...r}}function Wun(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var dLt=B(lt(),1),Jun=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],wm=Jun.reduce((e,t)=>{let r=lLt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?PIe:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,dLt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function fLt(e,t){e&&cLt.flushSync(()=>e.dispatchEvent(t))}var IIe=B(lt(),1),Gun="DismissableLayer",MIe="dismissableLayer.update",Kun="dismissableLayer.pointerDownOutside",Yun="dismissableLayer.focusOutside",pLt,mLt=va.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),AIe=va.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=e,l=va.useContext(mLt),[c,d]=va.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=va.useState({}),h=ZC(t,E=>d(E)),m=Array.from(l.layers),[_]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(_),v=c?m.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=v>=g,O=Qun(E=>{let M=E.target,A=[...l.branches].some(j=>j.contains(M));!x||A||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),T=eln(E=>{let M=E.target;[...l.branches].some(j=>j.contains(M))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return Zw(E=>{v===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),va.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(pLt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),hLt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=pLt)}},[c,f,r,l]),va.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),hLt())},[c,l]),va.useEffect(()=>{let E=()=>p({});return document.addEventListener(MIe,E),()=>document.removeEventListener(MIe,E)},[]),(0,IIe.jsx)(wm.div,{...u,ref:h,style:{pointerEvents:S?x?"auto":"none":void 0,...e.style},onFocusCapture:Wg(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Wg(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Wg(e.onPointerDownCapture,O.onPointerDownCapture)})});AIe.displayName=Gun;var Zun="DismissableLayerBranch",Xun=va.forwardRef((e,t)=>{let r=va.useContext(mLt),n=va.useRef(null),o=ZC(t,n);return va.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,IIe.jsx)(wm.div,{...e,ref:o})});Xun.displayName=Zun;function Qun(e,t=globalThis?.document){let r=Gt(e),n=va.useRef(!1),o=va.useRef(()=>{});return va.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){gLt(Kun,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function eln(e,t=globalThis?.document){let r=Gt(e),n=va.useRef(!1);return va.useEffect(()=>{let o=i=>{i.target&&!n.current&&gLt(Yun,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function hLt(){let e=new CustomEvent(MIe);document.dispatchEvent(e)}function gLt(e,t,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?fLt(o,i):o.dispatchEvent(i)}var Bp=B(Y(),1);var yLt=B(Y(),1);var RIe=B(lt(),1),tln="Arrow",bLt=yLt.forwardRef((e,t)=>{let{children:r,width:n=10,height:o=5,...i}=e;return(0,RIe.jsx)(wm.svg,{...i,ref:t,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,RIe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});bLt.displayName=tln;var _Lt=bLt;var KT=B(lt(),1);var DIe="Popper",[vLt,jIe]=Ro(DIe),[nln,wLt]=vLt(DIe),SLt=e=>{let{__scopePopper:t,children:r}=e,[n,o]=Bp.useState(null);return(0,KT.jsx)(nln,{scope:t,anchor:n,onAnchorChange:o,children:r})};SLt.displayName=DIe;var xLt="PopperAnchor",CLt=Bp.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:n,...o}=e,i=wLt(xLt,r),a=Bp.useRef(null),s=ZC(t,a);return Bp.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,KT.jsx)(wm.div,{...o,ref:s})});CLt.displayName=xLt;var NIe="PopperContent",[oln,iln]=vLt(NIe),OLt=Bp.forwardRef((e,t)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:h,...m}=e,_=wLt(NIe,r),[g,v]=Bp.useState(null),S=ZC(t,ne=>v(ne)),[x,O]=Bp.useState(null),T=_m(x),E=T?.width??0,M=T?.height??0,A=n+(i!=="center"?"-"+i:""),j=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],F=N.length>0,k={padding:j,boundary:N.filter(sln),altBoundary:F},{refs:L,floatingStyles:q,placement:U,isPositioned:G,middlewareData:V}=NT({strategy:"fixed",placement:A,whileElementsMounted:(...ne)=>KC(...ne,{animationFrame:p==="always"}),elements:{reference:_.anchor},middleware:[LT({mainAxis:o+M,alignmentAxis:a}),u&&FT({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?kT():void 0,...k}),u&&BT({...k}),$T({...k,apply:({elements:ne,rects:Pe,availableWidth:ht,availableHeight:we})=>{let{width:ae,height:ee}=Pe.reference,ge=ne.floating.style;ge.setProperty("--radix-popper-available-width",`${ht}px`),ge.setProperty("--radix-popper-available-height",`${we}px`),ge.setProperty("--radix-popper-anchor-width",`${ae}px`),ge.setProperty("--radix-popper-anchor-height",`${ee}px`)}}),x&&UT({element:x,padding:s}),uln({arrowWidth:E,arrowHeight:M}),f&&qT({strategy:"referenceHidden",...k})]}),[D,z]=TLt(U),W=Gt(h);qr(()=>{G&&W?.()},[G,W]);let J=V.arrow?.x,te=V.arrow?.y,Ie=V.arrow?.centerOffset!==0,[Z,X]=Bp.useState();return qr(()=>{g&&X(window.getComputedStyle(g).zIndex)},[g]),(0,KT.jsx)("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:G?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Z,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,KT.jsx)(oln,{scope:r,placedSide:D,onArrowChange:O,arrowX:J,arrowY:te,shouldHideArrow:Ie,children:(0,KT.jsx)(wm.div,{"data-side":D,"data-align":z,...m,ref:S,style:{...m.style,animation:G?void 0:"none"}})})})});OLt.displayName=NIe;var ELt="PopperArrow",aln={top:"bottom",right:"left",bottom:"top",left:"right"},PLt=Bp.forwardRef(function(t,r){let{__scopePopper:n,...o}=t,i=iln(ELt,n),a=aln[i.placedSide];return(0,KT.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,KT.jsx)(_Lt,{...o,ref:r,style:{...o.style,display:"block"}})})});PLt.displayName=ELt;function sln(e){return e!==null}var uln=e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:o}=t,a=o.arrow?.centerOffset!==0,s=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[l,c]=TLt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,h="",m="";return l==="bottom"?(h=a?d:`${f}px`,m=`${-u}px`):l==="top"?(h=a?d:`${f}px`,m=`${n.floating.height+u}px`):l==="right"?(h=`${-u}px`,m=a?d:`${p}px`):l==="left"&&(h=`${n.floating.width+u}px`,m=a?d:`${p}px`),{data:{x:h,y:m}}}});function TLt(e){let[t,r="center"]=e.split("-");return[t,r]}var MLt=SLt,ILt=CLt,ALt=OLt,RLt=PLt;var nie=B(Y(),1),DLt=B(ss(),1);var jLt=B(lt(),1),cln="Portal",LIe=nie.forwardRef((e,t)=>{let{container:r,...n}=e,[o,i]=nie.useState(!1);qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?DLt.default.createPortal((0,jLt.jsx)(wm.div,{...n,ref:t}),a):null});LIe.displayName=cln;var $Lt=B(Y(),1);var FLt=B(Y(),1),gln=B(ss(),1);var _c=B(Y(),1);var dln=B(Y(),1);function NLt(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function LLt(...e){return t=>{let r=!1,n=e.map(o=>{let i=NLt(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():NLt(e[o],null)}}}}var JB=B(lt(),1),kIe=_c.forwardRef((e,t)=>{let{children:r,...n}=e,o=_c.Children.toArray(r),i=o.find(pln);if(i){let a=i.props.children,s=o.map(u=>u===i?_c.Children.count(a)>1?_c.Children.only(null):_c.isValidElement(a)?a.props.children:null:u);return(0,JB.jsx)(FIe,{...n,ref:t,children:_c.isValidElement(a)?_c.cloneElement(a,void 0,s):null})}return(0,JB.jsx)(FIe,{...n,ref:t,children:r})});kIe.displayName="Slot";var FIe=_c.forwardRef((e,t)=>{let{children:r,...n}=e;if(_c.isValidElement(r)){let o=mln(r);return _c.cloneElement(r,{...hln(n,r.props),ref:t?LLt(t,o):o})}return _c.Children.count(r)>1?_c.Children.only(null):null});FIe.displayName="SlotClone";var fln=({children:e})=>(0,JB.jsx)(JB.Fragment,{children:e});function pln(e){return _c.isValidElement(e)&&e.type===fln}function hln(e,t){let r={...t};for(let n in t){let o=e[n],i=t[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{...e,...r}}function mln(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var kLt=B(lt(),1),yln=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],BLt=yln.reduce((e,t)=>{let r=FLt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?kIe:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,kLt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});var qLt=B(lt(),1),bln="VisuallyHidden",ULt=$Lt.forwardRef((e,t)=>(0,qLt.jsx)(BLt.span,{...e,ref:t,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",...e.style}}));ULt.displayName=bln;var zLt=ULt;var Du=B(lt(),1),[oie,H4o]=Ro("Tooltip",[jIe]),iie=jIe(),HLt="TooltipProvider",vln=700,BIe="tooltip.open",[wln,qIe]=oie(HLt),VLt=e=>{let{__scopeTooltip:t,delayDuration:r=vln,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=e,[a,s]=Er.useState(!0),u=Er.useRef(!1),l=Er.useRef(0);return Er.useEffect(()=>{let c=l.current;return()=>window.clearTimeout(c)},[]),(0,Du.jsx)(wln,{scope:t,isOpenDelayed:a,delayDuration:r,onOpen:Er.useCallback(()=>{window.clearTimeout(l.current),s(!1)},[]),onClose:Er.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>s(!0),n)},[n]),isPointerInTransitRef:u,onPointerInTransitChange:Er.useCallback(c=>{u.current=c},[]),disableHoverableContent:o,children:i})};VLt.displayName=HLt;var aie="Tooltip",[Sln,EH]=oie(aie),WLt=e=>{let{__scopeTooltip:t,children:r,open:n,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=e,u=qIe(aie,e.__scopeTooltip),l=iie(t),[c,d]=Er.useState(null),f=Fa(),p=Er.useRef(0),h=a??u.disableHoverableContent,m=s??u.delayDuration,_=Er.useRef(!1),[g=!1,v]=tl({prop:n,defaultProp:o,onChange:E=>{E?(u.onOpen(),document.dispatchEvent(new CustomEvent(BIe))):u.onClose(),i?.(E)}}),S=Er.useMemo(()=>g?_.current?"delayed-open":"instant-open":"closed",[g]),x=Er.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_.current=!1,v(!0)},[v]),O=Er.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),T=Er.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{_.current=!0,v(!0),p.current=0},m)},[m,v]);return Er.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,Du.jsx)(MLt,{...l,children:(0,Du.jsx)(Sln,{scope:t,contentId:f,open:g,stateAttribute:S,trigger:c,onTriggerChange:d,onTriggerEnter:Er.useCallback(()=>{u.isOpenDelayed?T():x()},[u.isOpenDelayed,T,x]),onTriggerLeave:Er.useCallback(()=>{h?O():(window.clearTimeout(p.current),p.current=0)},[O,h]),onOpen:x,onClose:O,disableHoverableContent:h,children:r})})};WLt.displayName=aie;var $Ie="TooltipTrigger",JLt=Er.forwardRef((e,t)=>{let{__scopeTooltip:r,...n}=e,o=EH($Ie,r),i=qIe($Ie,r),a=iie(r),s=Er.useRef(null),u=ZC(t,s,o.onTriggerChange),l=Er.useRef(!1),c=Er.useRef(!1),d=Er.useCallback(()=>l.current=!1,[]);return Er.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,Du.jsx)(ILt,{asChild:!0,...a,children:(0,Du.jsx)(wm.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:Wg(e.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:Wg(e.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:Wg(e.onPointerDown,()=>{l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Wg(e.onFocus,()=>{l.current||o.onOpen()}),onBlur:Wg(e.onBlur,o.onClose),onClick:Wg(e.onClick,o.onClose)})})});JLt.displayName=$Ie;var UIe="TooltipPortal",[xln,Cln]=oie(UIe,{forceMount:void 0}),GLt=e=>{let{__scopeTooltip:t,forceMount:r,children:n,container:o}=e,i=EH(UIe,t);return(0,Du.jsx)(xln,{scope:t,forceMount:r,children:(0,Du.jsx)(Ru,{present:r||i.open,children:(0,Du.jsx)(LIe,{asChild:!0,container:o,children:n})})})};GLt.displayName=UIe;var GB="TooltipContent",KLt=Er.forwardRef((e,t)=>{let r=Cln(GB,e.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=e,a=EH(GB,e.__scopeTooltip);return(0,Du.jsx)(Ru,{present:n||a.open,children:a.disableHoverableContent?(0,Du.jsx)(YLt,{side:o,...i,ref:t}):(0,Du.jsx)(Oln,{side:o,...i,ref:t})})}),Oln=Er.forwardRef((e,t)=>{let r=EH(GB,e.__scopeTooltip),n=qIe(GB,e.__scopeTooltip),o=Er.useRef(null),i=ZC(t,o),[a,s]=Er.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=Er.useCallback(()=>{s(null),d(!1)},[d]),p=Er.useCallback((h,m)=>{let _=h.currentTarget,g={x:h.clientX,y:h.clientY},v=Mln(g,_.getBoundingClientRect()),S=Iln(g,v),x=Aln(m.getBoundingClientRect()),O=Dln([...S,...x]);s(O),d(!0)},[d]);return Er.useEffect(()=>()=>f(),[f]),Er.useEffect(()=>{if(u&&c){let h=_=>p(_,c),m=_=>p(_,u);return u.addEventListener("pointerleave",h),c.addEventListener("pointerleave",m),()=>{u.removeEventListener("pointerleave",h),c.removeEventListener("pointerleave",m)}}},[u,c,p,f]),Er.useEffect(()=>{if(a){let h=m=>{let _=m.target,g={x:m.clientX,y:m.clientY},v=u?.contains(_)||c?.contains(_),S=!Rln(g,a);v?f():S&&(f(),l())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[u,c,a,l,f]),(0,Du.jsx)(YLt,{...e,ref:i})}),[Eln,Pln]=oie(aie,{isInside:!1}),YLt=Er.forwardRef((e,t)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=e,u=EH(GB,r),l=iie(r),{onClose:c}=u;return Er.useEffect(()=>(document.addEventListener(BIe,c),()=>document.removeEventListener(BIe,c)),[c]),Er.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,Du.jsx)(AIe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,Du.jsxs)(ALt,{"data-state":u.stateAttribute,...l,...s,ref:t,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,Du.jsx)(TIe,{children:n}),(0,Du.jsx)(Eln,{scope:r,isInside:!0,children:(0,Du.jsx)(zLt,{id:u.contentId,role:"tooltip",children:o||n})})]})})});KLt.displayName=GB;var ZLt="TooltipArrow",Tln=Er.forwardRef((e,t)=>{let{__scopeTooltip:r,...n}=e,o=iie(r);return Pln(ZLt,r).isInside?null:(0,Du.jsx)(RLt,{...o,...n,ref:t})});Tln.displayName=ZLt;function Mln(e,t){let r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.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 Iln(e,t,r=5){let n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function Aln(e){let{top:t,right:r,bottom:n,left:o}=e;return[{x:o,y:t},{x:r,y:t},{x:r,y:n},{x:o,y:n}]}function Rln(e,t){let{x:r,y:n}=e,o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){let s=t[i].x,u=t[i].y,l=t[a].x,c=t[a].y;u>n!=c>n&&r<(l-s)*(n-u)/(c-u)+s&&(o=!o)}return o}function Dln(e){let t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),jln(t)}function jln(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let o=e[n];for(;t.length>=2;){let i=t[t.length-1],a=t[t.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();let r=[];for(let n=e.length-1;n>=0;n--){let o=e[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(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var sie=VLt,XLt=WLt,QLt=JLt,eFt=GLt,zIe=KLt;var vc=sie,Yr=XLt,Zr=QLt,Vr=PH.forwardRef(({className:e,sideOffset:t=4,...r},n)=>PH.createElement(eFt,{container:activeDocument.body},PH.createElement(zIe,{ref:n,sideOffset:t,className:_e("z-50 overflow-hidden rounded-md bg-secondary border-border border border-solid px-3 py-1.5 text-xs text-normal animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})));Vr.displayName=zIe.displayName;var HIe=require("obsidian");async function Nln(){try{await ma.getInstance().indexVaultToVectorStore(),new HIe.Notice("Vault index refreshed.")}catch(e){console.error("Error refreshing vault index:",e),new HIe.Notice("Failed to refresh vault index. Check console for details.")}}function rFt({onNewChat:e,onSaveAsNote:t}){let r=Uo(),[n,o]=my(),i=HQ();return gr.default.createElement("div",{className:"w-full py-1 flex justify-between items-center px-1"},gr.default.createElement("div",{className:"flex-1"},gr.default.createElement(xH,null,gr.default.createElement(CH,{asChild:!0},gr.default.createElement(qe,{variant:"ghost2",size:"fit",className:"ml-1"},n==="llm_chain"&&"chat",n==="vault_qa"&&"vault QA",n==="copilot_plus"&&gr.default.createElement("div",{className:"flex items-center gap-1"},gr.default.createElement(xy,{className:"size-4"}),"copilot plus (beta)"),gr.default.createElement(us,{className:"size-5 mt-0.5"}))),gr.default.createElement(tS,{align:"start"},gr.default.createElement(Qa,{onSelect:()=>o("llm_chain")},"chat"),gr.default.createElement(Qa,{onSelect:()=>o("vault_qa")},"vault QA"),i?gr.default.createElement(Qa,{onSelect:()=>o("copilot_plus")},gr.default.createElement("div",{className:"flex items-center gap-1"},gr.default.createElement(xy,{className:"size-4"}),"copilot plus (beta)")):gr.default.createElement(Qa,{onSelect:()=>{Qj(jO.CHAT_MODE_SELECT)}},"copilot plus (beta)",gr.default.createElement(cE,{className:"size-3"}))))),gr.default.createElement("div",null,gr.default.createElement(Yr,null,gr.default.createElement(Zr,{asChild:!0},gr.default.createElement(qe,{variant:"ghost2",size:"icon",title:"New Chat",onClick:e},gr.default.createElement(BU,{className:"size-4"}))),gr.default.createElement(Vr,null,"New Chat")),gr.default.createElement(Yr,null,gr.default.createElement(Zr,{asChild:!0},gr.default.createElement(qe,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:t},gr.default.createElement(MU,{className:"size-4"}))),gr.default.createElement(Vr,null,"Save Chat as Note")),gr.default.createElement(xH,null,gr.default.createElement(CH,{asChild:!0},gr.default.createElement(qe,{variant:"ghost2",size:"icon",title:"Advanced Settings"},gr.default.createElement(sE,{className:"size-4"}))),gr.default.createElement(tS,{align:"end",className:"w-64"},gr.default.createElement(Qa,{className:"flex justify-between",onSelect:a=>{a.preventDefault(),xt("showSuggestedPrompts",!r.showSuggestedPrompts)}},gr.default.createElement("div",{className:"flex items-center gap-2"},gr.default.createElement(xy,{className:"size-4"}),"Suggested Prompt"),gr.default.createElement(VB,{checked:r.showSuggestedPrompts})),gr.default.createElement(Qa,{className:"flex justify-between",onSelect:a=>{a.preventDefault(),xt("showRelevantNotes",!r.showRelevantNotes)}},gr.default.createElement("div",{className:"flex items-center gap-2"},gr.default.createElement(AI,{className:"size-4"}),"Relevant Note"),gr.default.createElement(VB,{checked:r.showRelevantNotes})),gr.default.createElement(Qa,{className:"flex items-center gap-2",onSelect:()=>Nln()},gr.default.createElement(qU,{className:"size-4"}),"Refresh Vault Index")))))}var nFt=require("obsidian");var lie=require("obsidian"),uie=class extends lie.FuzzySuggestModal{constructor(t){super(t),this.activeNote=t.workspace.getActiveFile()}getOrderedNotes(t=[]){let r=this.app.workspace.getLastOpenFiles().map(i=>this.app.vault.getAbstractFileByPath(i)).filter(i=>i instanceof lie.TFile&&(i.extension==="md"||i.extension==="pdf")&&!t.includes(i.path)&&i.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(i=>i.extension==="md"||i.extension==="pdf").filter(i=>!r.some(a=>a.path===i.path)&&!t.includes(i.path)&&i.path!==this.activeNote?.path);return[...this.activeNote?[this.activeNote]:[],...r,...o]}formatNoteTitle(t,r,n){let o=t;return r&&(o+=" (current)"),n==="pdf"&&(o+=" (PDF)"),o}};var YT=class extends uie{constructor({app:t,onNoteSelect:r,excludeNotePaths:n,titleOnly:o=!1}){super(t),this.onNoteSelect=r,this.availableNotes=this.getOrderedNotes(n),this.titleOnly=o}getItems(){if(this.titleOnly){let t=new Map;return this.availableNotes.forEach(r=>{t.set(r.basename,r)}),Array.from(t.values())}return this.availableNotes}getItemText(t){let r=t.path===this.activeNote?.path;return this.formatNoteTitle(t.basename,r,t.extension)}onChooseItem(t,r){this.onNoteSelect(t)}renderSuggestion(t,r){let n=r.createDiv({cls:"pointer-events-none"});if(t.item instanceof nFt.TFile){let o=n.createDiv(),i=t.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 cie=class{constructor(t,r){this.app=t,this.onImagesSelected=r}open(){let t=document.createElement("input");t.type="file",t.accept="image/*",t.multiple=!0,t.style.display="none",t.addEventListener("change",()=>{let r=Array.from(t.files||[]);this.onImagesSelected(r),document.body.removeChild(t)}),document.body.appendChild(t),t.click()}};var oFt=require("obsidian"),KB=class e{constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}async processEmbeddedPDFs(t,r,n){let o=/!\[\[(.*?\.pdf)\]\]/g,i=[...t.matchAll(o)];for(let a of i){let s=a[1],u=r.getAbstractFileByPath(s);if(u instanceof oFt.TFile)try{let l=await n.parseFile(u,r);t=t.replace(a[0],`
Embedded PDF (${s}):
${l}
`)}catch(l){console.error(`Error processing embedded PDF ${s}:`,l),t=t.replace(a[0],`
Embedded PDF (${s}): [Error: Could not process PDF]
`)}}return t}async processContextNotes(t,r,n,o,i,a,s){let u=await t.getProcessedVariables(),l="",c=async d=>{try{let f=`[[${d.basename}]]`;if(u.has(f))return;if(s!=="copilot_plus"&&d.extension!=="md"){r.supportsExtension(d.extension)?console.warn(`File type ${d.extension} only supported in Copilot Plus mode`):console.warn(`Unsupported file type: ${d.extension}`);return}if(!r.supportsExtension(d.extension)){console.warn(`Unsupported file type: ${d.extension}`);return}let p=await r.parseFile(d,n);d.extension==="md"&&s==="copilot_plus"&&(p=await this.processEmbeddedPDFs(p,n,r)),l+=`
Title: [[${d.basename}]]
Path: ${d.path}
${p}`}catch(f){console.error(`Error processing file ${d.path}:`,f),l+=`
Title: [[${d.basename}]]
Path: ${d.path}
[Error: Could not process file]`}};if(i&&a){let d="activeNote",f=`[[${a.basename}]]`;!u.has(d)&&!u.has(f)&&await c(a)}for(let d of o)await c(d);return l}async hasEmbeddedPDFs(t){return/!\[\[(.*?\.pdf)\]\]/g.test(t)}async addNoteToContext(t,r,n,o,i,a){if(n.some(l=>l.path===t.path))return;let s=await r.read(t),u=await this.hasEmbeddedPDFs(s);o&&t.path===o.path&&a(!0),i(l=>[...l,Object.assign(t,{wasAddedViaReference:!0,hasEmbeddedPDFs:u})])}};var YB=require("obsidian"),Ge=B(Y());var Wr=B(Y()),Yo=B(fFt());function ZT(e,t,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(e,t||[])).next())})}var kln=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 J1(e,t,r){let n=Bln(e),{webkitRelativePath:o}=e,i=typeof t=="string"?t:typeof o=="string"&&o.length>0?o:`./${e.name}`;return typeof n.path!="string"&&pFt(n,"path",i),r!==void 0&&Object.defineProperty(n,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),pFt(n,"relativePath",i),n}function Bln(e){let{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){let n=t.split(".").pop().toLowerCase(),o=kln.get(n);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}function pFt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!1,configurable:!1,enumerable:!0})}var $ln=[".DS_Store","Thumbs.db"];function WIe(e){return ZT(this,void 0,void 0,function*(){return die(e)&&qln(e.dataTransfer)?Vln(e.dataTransfer,e.type):Uln(e)?zln(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?Hln(e):[]})}function qln(e){return die(e)}function Uln(e){return die(e)&&die(e.target)}function die(e){return typeof e=="object"&&e!==null}function zln(e){return VIe(e.target.files).map(t=>J1(t))}function Hln(e){return ZT(this,void 0,void 0,function*(){return(yield Promise.all(e.map(r=>r.getFile()))).map(r=>J1(r))})}function Vln(e,t){return ZT(this,void 0,void 0,function*(){if(e.items){let r=VIe(e.items).filter(o=>o.kind==="file");if(t!=="drop")return r;let n=yield Promise.all(r.map(Wln));return hFt(gFt(n))}return hFt(VIe(e.files).map(r=>J1(r)))})}function hFt(e){return e.filter(t=>$ln.indexOf(t.name)===-1)}function VIe(e){if(e===null)return[];let t=[];for(let r=0;r<e.length;r++){let n=e[r];t.push(n)}return t}function Wln(e){if(typeof e.webkitGetAsEntry!="function")return mFt(e);let t=e.webkitGetAsEntry();return t&&t.isDirectory?yFt(t):mFt(e,t)}function gFt(e){return e.reduce((t,r)=>[...t,...Array.isArray(r)?gFt(r):[r]],[])}function mFt(e,t){return ZT(this,void 0,void 0,function*(){var r;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){let i=yield e.getAsFileSystemHandle();if(i===null)throw new Error(`${e} is not a File`);if(i!==void 0){let a=yield i.getFile();return a.handle=i,J1(a)}}let n=e.getAsFile();if(!n)throw new Error(`${e} is not a File`);return J1(n,(r=t?.fullPath)!==null&&r!==void 0?r:void 0)})}function Jln(e){return ZT(this,void 0,void 0,function*(){return e.isDirectory?yFt(e):Gln(e)})}function yFt(e){let t=e.createReader();return new Promise((r,n)=>{let o=[];function i(){t.readEntries(a=>ZT(this,void 0,void 0,function*(){if(a.length){let s=Promise.all(a.map(Jln));o.push(s),i()}else try{let s=yield Promise.all(o);r(s)}catch(s){n(s)}}),a=>{n(a)})}i()})}function Gln(e){return ZT(this,void 0,void 0,function*(){return new Promise((t,r)=>{e.file(n=>{let o=J1(n,e.fullPath);t(o)},n=>{r(n)})})})}var fie=B(bFt());function _Ft(e){return Zln(e)||Yln(e)||OFt(e)||Kln()}function Kln(){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 Yln(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Zln(e){if(Array.isArray(e))return GIe(e)}function vFt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function wFt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vFt(Object(r),!0).forEach(function(n){CFt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vFt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function CFt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function TH(e,t){return ecn(e)||Qln(e,t)||OFt(e,t)||Xln()}function Xln(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OFt(e,t){if(e){if(typeof e=="string")return GIe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return GIe(e,t)}}function GIe(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Qln(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,s;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(u){i=!0,s=u}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw s}}return n}}function ecn(e){if(Array.isArray(e))return e}var tcn=typeof fie.default=="function"?fie.default:fie.default.default,rcn="file-invalid-type",ncn="file-too-large",ocn="file-too-small",icn="too-many-files";var acn=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=t.split(","),n=r.length>1?"one of ".concat(r.join(", ")):r[0];return{code:rcn,message:"File type must be ".concat(n)}},SFt=function(t){return{code:ncn,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},xFt=function(t){return{code:ocn,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},EFt={code:icn,message:"Too many files"};function KIe(e,t){var r=e.type==="application/x-moz-file"||tcn(e,t);return[r,r?null:acn(t)]}function YIe(e,t,r){if(G1(e.size))if(G1(t)&&G1(r)){if(e.size>r)return[!1,SFt(r)];if(e.size<t)return[!1,xFt(t)]}else{if(G1(t)&&e.size<t)return[!1,xFt(t)];if(G1(r)&&e.size>r)return[!1,SFt(r)]}return[!0,null]}function G1(e){return e!=null}function PFt(e){var t=e.files,r=e.accept,n=e.minSize,o=e.maxSize,i=e.multiple,a=e.maxFiles,s=e.validator;return!i&&t.length>1||i&&a>=1&&t.length>a?!1:t.every(function(u){var l=KIe(u,r),c=TH(l,1),d=c[0],f=YIe(u,n,o),p=TH(f,1),h=p[0],m=s?s(u):null;return d&&h&&!m})}function MH(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function IH(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function ZIe(e){e.preventDefault()}function scn(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function ucn(e){return e.indexOf("Edge/")!==-1}function TFt(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return scn(e)||ucn(e)}function Jg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.some(function(s){return!MH(n)&&s&&s.apply(void 0,[n].concat(i)),MH(n)})}}function MFt(){return"showOpenFilePicker"in window}function IFt(e){if(G1(e)){var t=Object.entries(e).filter(function(r){var n=TH(r,2),o=n[0],i=n[1],a=!0;return jFt(o)||(console.warn('Skipped "'.concat(o,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),a=!1),(!Array.isArray(i)||!i.every(NFt))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),a=!1),a}).reduce(function(r,n){var o=TH(n,2),i=o[0],a=o[1];return wFt(wFt({},r),{},CFt({},i,a))},{});return[{description:"Files",accept:t}]}return e}function AFt(e){if(G1(e))return Object.entries(e).reduce(function(t,r){var n=TH(r,2),o=n[0],i=n[1];return[].concat(_Ft(t),[o],_Ft(i))},[]).filter(function(t){return jFt(t)||NFt(t)}).join(",")}function RFt(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function DFt(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function jFt(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function NFt(e){return/^.*\.[\w]+$/.test(e)}var lcn=["children"],ccn=["open"],dcn=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],fcn=["refKey","onChange","onClick"];function pcn(e){return gcn(e)||mcn(e)||kFt(e)||hcn()}function hcn(){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 mcn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function gcn(e){if(Array.isArray(e))return QIe(e)}function XIe(e,t){return _cn(e)||bcn(e,t)||kFt(e,t)||ycn()}function ycn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kFt(e,t){if(e){if(typeof e=="string")return QIe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return QIe(e,t)}}function QIe(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function bcn(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,s;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(u){i=!0,s=u}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw s}}return n}}function _cn(e){if(Array.isArray(e))return e}function LFt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function wa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?LFt(Object(r),!0).forEach(function(n){eAe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LFt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function eAe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pie(e,t){if(e==null)return{};var r=vcn(e,t),n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function vcn(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,i;for(i=0;i<n.length;i++)o=n[i],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}var rAe=(0,Wr.forwardRef)(function(e,t){var r=e.children,n=pie(e,lcn),o=nAe(n),i=o.open,a=pie(o,ccn);return(0,Wr.useImperativeHandle)(t,function(){return{open:i}},[i]),Wr.default.createElement(Wr.Fragment,null,r(wa(wa({},a),{},{open:i})))});rAe.displayName="Dropzone";var BFt={disabled:!1,getFilesFromEvent:WIe,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};rAe.defaultProps=BFt;rAe.propTypes={children:Yo.default.func,accept:Yo.default.objectOf(Yo.default.arrayOf(Yo.default.string)),multiple:Yo.default.bool,preventDropOnDocument:Yo.default.bool,noClick:Yo.default.bool,noKeyboard:Yo.default.bool,noDrag:Yo.default.bool,noDragEventsBubbling:Yo.default.bool,minSize:Yo.default.number,maxSize:Yo.default.number,maxFiles:Yo.default.number,disabled:Yo.default.bool,getFilesFromEvent:Yo.default.func,onFileDialogCancel:Yo.default.func,onFileDialogOpen:Yo.default.func,useFsAccessApi:Yo.default.bool,autoFocus:Yo.default.bool,onDragEnter:Yo.default.func,onDragLeave:Yo.default.func,onDragOver:Yo.default.func,onDrop:Yo.default.func,onDropAccepted:Yo.default.func,onDropRejected:Yo.default.func,onError:Yo.default.func,validator:Yo.default.func};var tAe={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function nAe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=wa(wa({},BFt),e),r=t.accept,n=t.disabled,o=t.getFilesFromEvent,i=t.maxSize,a=t.minSize,s=t.multiple,u=t.maxFiles,l=t.onDragEnter,c=t.onDragLeave,d=t.onDragOver,f=t.onDrop,p=t.onDropAccepted,h=t.onDropRejected,m=t.onFileDialogCancel,_=t.onFileDialogOpen,g=t.useFsAccessApi,v=t.autoFocus,S=t.preventDropOnDocument,x=t.noClick,O=t.noKeyboard,T=t.noDrag,E=t.noDragEventsBubbling,M=t.onError,A=t.validator,j=(0,Wr.useMemo)(function(){return AFt(r)},[r]),N=(0,Wr.useMemo)(function(){return IFt(r)},[r]),F=(0,Wr.useMemo)(function(){return typeof _=="function"?_:FFt},[_]),k=(0,Wr.useMemo)(function(){return typeof m=="function"?m:FFt},[m]),L=(0,Wr.useRef)(null),q=(0,Wr.useRef)(null),U=(0,Wr.useReducer)(wcn,tAe),G=XIe(U,2),V=G[0],D=G[1],z=V.isFocused,W=V.isFileDialogActive,J=(0,Wr.useRef)(typeof window<"u"&&window.isSecureContext&&g&&MFt()),te=function(){!J.current&&W&&setTimeout(function(){if(q.current){var Ze=q.current.files;Ze.length||(D({type:"closeDialog"}),k())}},300)};(0,Wr.useEffect)(function(){return window.addEventListener("focus",te,!1),function(){window.removeEventListener("focus",te,!1)}},[q,W,k,J]);var Ie=(0,Wr.useRef)([]),Z=function(Ze){L.current&&L.current.contains(Ze.target)||(Ze.preventDefault(),Ie.current=[])};(0,Wr.useEffect)(function(){return S&&(document.addEventListener("dragover",ZIe,!1),document.addEventListener("drop",Z,!1)),function(){S&&(document.removeEventListener("dragover",ZIe),document.removeEventListener("drop",Z))}},[L,S]),(0,Wr.useEffect)(function(){return!n&&v&&L.current&&L.current.focus(),function(){}},[L,v,n]);var X=(0,Wr.useCallback)(function(Ae){M?M(Ae):console.error(Ae)},[M]),ne=(0,Wr.useCallback)(function(Ae){Ae.preventDefault(),Ae.persist(),Ut(Ae),Ie.current=[].concat(pcn(Ie.current),[Ae.target]),IH(Ae)&&Promise.resolve(o(Ae)).then(function(Ze){if(!(MH(Ae)&&!E)){var fr=Ze.length,Xe=fr>0&&PFt({files:Ze,accept:j,minSize:a,maxSize:i,multiple:s,maxFiles:u,validator:A}),Bn=fr>0&&!Xe;D({isDragAccept:Xe,isDragReject:Bn,isDragActive:!0,type:"setDraggedFiles"}),l&&l(Ae)}}).catch(function(Ze){return X(Ze)})},[o,l,X,E,j,a,i,s,u,A]),Pe=(0,Wr.useCallback)(function(Ae){Ae.preventDefault(),Ae.persist(),Ut(Ae);var Ze=IH(Ae);if(Ze&&Ae.dataTransfer)try{Ae.dataTransfer.dropEffect="copy"}catch{}return Ze&&d&&d(Ae),!1},[d,E]),ht=(0,Wr.useCallback)(function(Ae){Ae.preventDefault(),Ae.persist(),Ut(Ae);var Ze=Ie.current.filter(function(Xe){return L.current&&L.current.contains(Xe)}),fr=Ze.indexOf(Ae.target);fr!==-1&&Ze.splice(fr,1),Ie.current=Ze,!(Ze.length>0)&&(D({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),IH(Ae)&&c&&c(Ae))},[L,c,E]),we=(0,Wr.useCallback)(function(Ae,Ze){var fr=[],Xe=[];Ae.forEach(function(Bn){var Qi=KIe(Bn,j),al=XIe(Qi,2),Pc=al[0],Tm=al[1],Mm=YIe(Bn,a,i),Oa=XIe(Mm,2),Wp=Oa[0],Zf=Oa[1],Jp=A?A(Bn):null;if(Pc&&Wp&&!Jp)fr.push(Bn);else{var mn=[Tm,Zf];Jp&&(mn=mn.concat(Jp)),Xe.push({file:Bn,errors:mn.filter(function(aO){return aO})})}}),(!s&&fr.length>1||s&&u>=1&&fr.length>u)&&(fr.forEach(function(Bn){Xe.push({file:Bn,errors:[EFt]})}),fr.splice(0)),D({acceptedFiles:fr,fileRejections:Xe,isDragReject:Xe.length>0,type:"setFiles"}),f&&f(fr,Xe,Ze),Xe.length>0&&h&&h(Xe,Ze),fr.length>0&&p&&p(fr,Ze)},[D,s,j,a,i,u,f,p,h,A]),ae=(0,Wr.useCallback)(function(Ae){Ae.preventDefault(),Ae.persist(),Ut(Ae),Ie.current=[],IH(Ae)&&Promise.resolve(o(Ae)).then(function(Ze){MH(Ae)&&!E||we(Ze,Ae)}).catch(function(Ze){return X(Ze)}),D({type:"reset"})},[o,we,X,E]),ee=(0,Wr.useCallback)(function(){if(J.current){D({type:"openDialog"}),F();var Ae={multiple:s,types:N};window.showOpenFilePicker(Ae).then(function(Ze){return o(Ze)}).then(function(Ze){we(Ze,null),D({type:"closeDialog"})}).catch(function(Ze){RFt(Ze)?(k(Ze),D({type:"closeDialog"})):DFt(Ze)?(J.current=!1,q.current?(q.current.value=null,q.current.click()):X(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):X(Ze)});return}q.current&&(D({type:"openDialog"}),F(),q.current.value=null,q.current.click())},[D,F,k,g,we,X,N,s]),ge=(0,Wr.useCallback)(function(Ae){!L.current||!L.current.isEqualNode(Ae.target)||(Ae.key===" "||Ae.key==="Enter"||Ae.keyCode===32||Ae.keyCode===13)&&(Ae.preventDefault(),ee())},[L,ee]),Ue=(0,Wr.useCallback)(function(){D({type:"focus"})},[]),ct=(0,Wr.useCallback)(function(){D({type:"blur"})},[]),Je=(0,Wr.useCallback)(function(){x||(TFt()?setTimeout(ee,0):ee())},[x,ee]),cr=function(Ze){return n?null:Ze},Qr=function(Ze){return O?null:cr(Ze)},dr=function(Ze){return T?null:cr(Ze)},Ut=function(Ze){E&&Ze.stopPropagation()},$o=(0,Wr.useMemo)(function(){return function(){var Ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Ze=Ae.refKey,fr=Ze===void 0?"ref":Ze,Xe=Ae.role,Bn=Ae.onKeyDown,Qi=Ae.onFocus,al=Ae.onBlur,Pc=Ae.onClick,Tm=Ae.onDragEnter,Mm=Ae.onDragOver,Oa=Ae.onDragLeave,Wp=Ae.onDrop,Zf=pie(Ae,dcn);return wa(wa(eAe({onKeyDown:Qr(Jg(Bn,ge)),onFocus:Qr(Jg(Qi,Ue)),onBlur:Qr(Jg(al,ct)),onClick:cr(Jg(Pc,Je)),onDragEnter:dr(Jg(Tm,ne)),onDragOver:dr(Jg(Mm,Pe)),onDragLeave:dr(Jg(Oa,ht)),onDrop:dr(Jg(Wp,ae)),role:typeof Xe=="string"&&Xe!==""?Xe:"presentation"},fr,L),!n&&!O?{tabIndex:0}:{}),Zf)}},[L,ge,Ue,ct,Je,ne,Pe,ht,ae,O,T,n]),Xi=(0,Wr.useCallback)(function(Ae){Ae.stopPropagation()},[]),No=(0,Wr.useMemo)(function(){return function(){var Ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Ze=Ae.refKey,fr=Ze===void 0?"ref":Ze,Xe=Ae.onChange,Bn=Ae.onClick,Qi=pie(Ae,fcn),al=eAe({accept:j,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:cr(Jg(Xe,ae)),onClick:cr(Jg(Bn,Xi)),tabIndex:-1},fr,q);return wa(wa({},al),Qi)}},[q,r,s,ae,n]);return wa(wa({},V),{},{isFocused:z&&!n,getRootProps:$o,getInputProps:No,rootRef:L,inputRef:q,open:cr(ee)})}function wcn(e,t){switch(t.type){case"focus":return wa(wa({},e),{},{isFocused:!0});case"blur":return wa(wa({},e),{},{isFocused:!1});case"openDialog":return wa(wa({},tAe),{},{isFileDialogActive:!0});case"closeDialog":return wa(wa({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return wa(wa({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return wa(wa({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:t.isDragReject});case"reset":return wa({},tAe);default:return e}}function FFt(){}var UFt=B(Y());var Ai=B(Y());var hie=B(Y());var Scn=Jj("inline-flex items-center rounded-md px-2.5 py-0.5 text-normal text-ui-smaller transition-colors focus:outline-none",{variants:{variant:{default:"bg-primary-alt shadow",secondary:"bg-secondary-alt",destructive:"bg-modifier-error shadow",outline:"border border-border border-solid"}},defaultVariants:{variant:"default"}}),Gg=hie.forwardRef(({className:e,variant:t,...r},n)=>hie.createElement("div",{ref:n,className:_e(Scn({variant:t}),e),...r}));Gg.displayName="Badge";function $Ft({note:e,isActive:t=!1,onRemoveContext:r}){return Ai.default.createElement(Gg,{className:"text-xs pl-2 pr-0.5 py-0 items-center"},Ai.default.createElement("div",{className:"flex items-center gap-1"},Ai.default.createElement("span",{className:"max-w-40 truncate"},e.basename),t&&Ai.default.createElement("span",{className:"text-xs text-faint"},"Current"),e.extension==="pdf"&&Ai.default.createElement("span",{className:"text-xs text-faint"},"pdf")),Ai.default.createElement(qe,{variant:"ghost2",size:"fit",onClick:()=>r(e.path),"aria-label":"Remove from context"},Ai.default.createElement(bh,{className:"size-4"})))}function xcn({url:e,onRemoveUrl:t}){return Ai.default.createElement(Gg,{className:"text-xs pl-2 pr-0.5 py-0 items-center"},Ai.default.createElement("div",{className:"flex items-center gap-1"},Ai.default.createElement("span",{className:"max-w-40 truncate"},e),Ai.default.createElement("span",{className:"text-xs text-faint"},"Link")),Ai.default.createElement(qe,{variant:"ghost2",size:"fit",onClick:()=>t(e),"aria-label":"Remove from context"},Ai.default.createElement(bh,{className:"size-4"})))}var qFt=({activeNote:e,contextNotes:t,contextUrls:r,onAddContext:n,onRemoveContext:o,onRemoveUrl:i})=>{let a=Ai.default.useMemo(()=>{let l=new Map(t.map(c=>[c.path,c]));return Array.from(l.values()).filter(c=>c.wasAddedManually?!0:!(e&&c.path===e.path))},[t,e]),s=Ai.default.useMemo(()=>Array.from(new Set(r)),[r]),u=a.length>0||s.length>0||!!e;return Ai.default.createElement("div",{className:"flex items-center w-full gap-1"},Ai.default.createElement("div",{className:"flex items-start h-full"},Ai.default.createElement(qe,{onClick:n,variant:"ghost2",size:"fit",className:"border border-border border-solid rounded-sm ml-1"},Ai.default.createElement(ex,{className:"size-4"}),!u&&Ai.default.createElement("span",{className:"text-xs leading-4 pr-1"},"Add context"))),Ai.default.createElement("div",{className:"flex gap-1 flex-wrap flex-1"},e&&Ai.default.createElement($Ft,{key:e.path,note:e,isActive:!0,onRemoveContext:o}),a.map(l=>Ai.default.createElement($Ft,{key:l.path,note:l,isActive:!1,onRemoveContext:o})),s.map(l=>Ai.default.createElement(xcn,{key:l,url:l,onRemoveUrl:i}))))};var Ccn=({app:e,excludeNotePaths:t,contextNotes:r,setContextNotes:n,includeActiveNote:o,setIncludeActiveNote:i,activeNote:a,contextUrls:s,onRemoveUrl:u})=>{let[l]=my(),c=()=>{new YT({app:e,onNoteSelect:f=>{a&&f.path===a.path?(i(!0),n(p=>p.filter(h=>h.path!==f.path))):n(p=>[...p,Object.assign(f,{wasAddedManually:!0})])},excludeNotePaths:t}).open()},d=f=>{let p=r.find(m=>m.path===f);p&&p.wasAddedManually?n(m=>m.filter(_=>_.path!==f)):(i(!1),n(m=>m.filter(_=>_.path!==f)))};return l!=="copilot_plus"?null:UFt.default.createElement(qFt,{activeNote:o?a:null,contextNotes:r,onAddContext:c,onRemoveContext:d,contextUrls:s,onRemoveUrl:u})},zFt=Ccn;var HFt=(0,Ge.forwardRef)(({inputMessage:e,setInputMessage:t,handleSendMessage:r,isGenerating:n,onStopGenerating:o,app:i,navigateHistory:a,contextNotes:s,setContextNotes:u,includeActiveNote:l,setIncludeActiveNote:c,mention:d,selectedImages:f,onAddImage:p,setSelectedImages:h},m)=>{let[_,g]=(0,Ge.useState)(-1),[v,S]=(0,Ge.useState)(""),[x,O]=(0,Ge.useState)(!1),[T,E]=(0,Ge.useState)([]),M=(0,Ge.useRef)(null),A=(0,Ge.useRef)(null),[j,N]=mj(),[F,k]=(0,Ge.useState)(null),[L]=my(),[q,U]=(0,Ge.useState)(i.workspace.getActiveFile()),G=Uo(),V=L==="copilot_plus";(0,Ge.useImperativeHandle)(m,()=>({focus:()=>{M.current?.focus()}}));let D=ae=>{if(!V){r();return}r({toolCalls:ae?["@vault"]:[],contextNotes:s,urls:T})},z=async ae=>{let ee=ae.target.value,ge=ae.target.selectionStart;t(ee),W();let ct=d.extractAllUrls(ee).filter(Je=>!T.includes(Je));ct.length>0&&E(Je=>Array.from(new Set([...Je,...ct]))),ge>=2&&ee.slice(ge-2,ge)==="[["?J(ge):ee==="/"?te():ee.slice(-1)==="@"&&V&&Ie()},W=()=>{M.current&&(M.current.style.height="auto",M.current.style.height=`${M.current.scrollHeight}px`)};(0,Ge.useEffect)(()=>{W()},[e]);let J=ae=>{(async()=>{let ge=KB.getInstance();new YT({app:i,onNoteSelect:async Ue=>{let ct=e.slice(0,ae-2),Je=e.slice(ae-1),Qr=qle(Ue.basename,i.vault)?Ue.basename:Ue.path,dr=`${ct}[[${Qr}]]${Je}`;t(dr);let Ut=i.workspace.getActiveFile();Ue&&await ge.addNoteToContext(Ue,i.vault,s,Ut,u,c),setTimeout(()=>{if(M.current){let $o=ae+Qr.length+2;M.current.setSelectionRange($o,$o)}},0)},excludeNotePaths:we}).open()})()},te=async()=>{let ae=WC.getInstance(i.vault),ee=await ae.getAllPrompts(),ge=ee.map(Ue=>Ue.title);new VC(i,ge,async Ue=>{let ct=ee.find(Je=>Je.title===Ue);ct&&(ae.recordPromptUsage(ct.title),t(ct.content))}).open()},Ie=()=>{let ae=eH.map(ee=>({title:ee,description:CAt(ee)}));new VC(i,ae.map(ee=>ee.title),ee=>{t(e+ee+" ")},ae.map(ee=>ee.description)).open()},Z=ae=>{if(ae.nativeEvent.isComposing)return;let ee=M.current;if(!ee)return;let{selectionStart:ge,value:Ue}=ee,ct=Ue.split(`
`),Je=Ue.substring(0,ge).split(`
`).length-1;if(ae.key==="Enter"&&ae.shiftKey&&(YB.Platform.isMacOS?ae.metaKey:ae.ctrlKey)){ae.preventDefault(),ae.stopPropagation(),D(!0),g(-1),S("");return}if(ae.key==="Enter"&&!ae.shiftKey)ae.preventDefault(),D(!1),g(-1),S("");else if(ae.key==="ArrowUp"){if(Je>0||ge>0)return;ae.preventDefault(),_===-1&&Ue.trim()!==""&&S(Ue);let cr=a("up");cr!==e&&(g(_+1),t(cr),setTimeout(()=>{ee&&(ee.selectionStart=ee.selectionEnd=0)},0))}else if(ae.key==="ArrowDown"){if(Je<ct.length-1||ge<Ue.length)return;if(ae.preventDefault(),_>-1){let cr=a("down");g(_-1),t(_===0?v:cr),setTimeout(()=>{ee&&(ee.selectionStart=ee.selectionEnd=0)},0)}}},X=(0,Ge.useCallback)(async ae=>{let ee=ae.clipboardData?.items;if(!ee||!V)return;let ge=Array.from(ee).filter(Ue=>Ue.type.indexOf("image")!==-1);if(ge.length>0){ae.preventDefault();let ct=(await Promise.all(ge.map(Je=>{let cr=Je.getAsFile();return cr||null}))).filter(Je=>Je!==null);ct.length>0&&p(ct)}},[p,V]);(0,Ge.useEffect)(()=>{let ae=new Set(py(e,i.vault)),ee=d.extractAllUrls(e);u(ge=>ge.filter(Ue=>{if(Ue.wasAddedManually===!0)return!0;let Je=Ue.wasAddedViaReference===!0;return Ue.path===q?.path?Je?ae.has(Ue):l:Je?ae.has(Ue):!0})),E(ge=>ge.filter(Ue=>ee.includes(Ue)))},[e,l,q,d,u,i.vault]),(0,Ge.useEffect)(()=>{let ae,ee=()=>{clearTimeout(ae),ae=setTimeout(()=>{let Ue=i.workspace.getActiveFile();U(Ue)},100)},ge=i.workspace.on("active-leaf-change",ee);return()=>{clearTimeout(ae),i.workspace.offref(ge)}},[i.workspace]);let{getRootProps:ne,getInputProps:Pe,isDragActive:ht}=nAe({accept:{"image/*":[".png",".gif",".jpeg",".jpg",".webp"]},onDrop:ae=>{p(ae)},noClick:!0,noDragEventsBubbling:!0}),we=(0,Ge.useMemo)(()=>[...s.map(ae=>ae.path),...l&&q?[q.path]:[]].filter(ae=>ae!=null),[s,l,q]);return Ge.default.createElement("div",{className:"flex flex-col gap-0.5 w-full border border-border border-solid rounded-md pt-2 pb-1 px-1 @container/chat-input",ref:A},Ge.default.createElement(zFt,{app:i,excludeNotePaths:we,contextNotes:s,setContextNotes:u,includeActiveNote:l,setIncludeActiveNote:c,activeNote:q,contextUrls:T,onRemoveUrl:ae=>E(ee=>ee.filter(ge=>ge!==ae))}),f.length>0&&Ge.default.createElement("div",{className:"selected-images"},f.map((ae,ee)=>Ge.default.createElement("div",{key:ee,className:"image-preview-container"},Ge.default.createElement("img",{src:URL.createObjectURL(ae),alt:ae.name,className:"selected-image-preview"}),Ge.default.createElement("button",{className:"remove-image-button",onClick:()=>h(ge=>ge.filter((Ue,ct)=>ct!==ee)),title:"Remove image"},Ge.default.createElement(bh,{className:"size-4"}))))),Ge.default.createElement("div",{className:"relative",...V?ne():{}},Ge.default.createElement("textarea",{ref:M,className:"w-full bg-transparent focus-visible:ring-0 border-none min-h-[60px] max-h-40 overflow-y-auto resize-none px-2 rounded-md text-sm text-normal",placeholder:"Ask anything. [[ for notes. / for custom prompts. "+(V?"@ for tools.":""),value:e,onChange:z,onKeyDown:Z,onPaste:X}),V&&Ge.default.createElement(Ge.default.Fragment,null,Ge.default.createElement("input",{...Pe()}),ht&&Ge.default.createElement("div",{className:"absolute inset-0 bg-primary border border-dashed border-primary rounded-md flex items-center justify-center"},Ge.default.createElement("span",{className:"text-primary"},"Drop images here...")))),Ge.default.createElement("div",{className:"flex gap-1 justify-between px-1 h-6"},n?Ge.default.createElement("div",{className:"flex items-center gap-1 px-1 text-faint text-sm"},Ge.default.createElement(Uc,{className:"size-3 animate-spin"}),Ge.default.createElement("span",null,"Generating...")):Ge.default.createElement(zB,{open:x,onOpenChange:O},Ge.default.createElement(HB,{asChild:!0},Ge.default.createElement(qe,{variant:"ghost2",size:"fit"},F?Ge.default.createElement("span",{className:"text-error"},"Model Load Failed"):G.activeModels.find(ae=>ae.enabled&&Nr(ae)===j)?Ge.default.createElement(mMe,{model:G.activeModels.find(ae=>ae.enabled&&Nr(ae)===j),iconSize:8}):"Select Model",Ge.default.createElement(us,{className:"size-5 mt-0.5"}))),Ge.default.createElement(tS,{align:"start"},G.activeModels.filter(ae=>ae.enabled).map(ae=>{let{hasApiKey:ee,errorNotice:ge}=g5(ae,G);return Ge.default.createElement(Qa,{key:Nr(ae),onSelect:async Ue=>{if(!ee&&ge){Ue.preventDefault(),new YB.Notice(ge);return}try{k(null),N(Nr(ae))}catch(ct){let Je="Model switch failed: "+bi(ct);k(Je),new YB.Notice(Je);let cr=G.activeModels.find(Qr=>Qr.enabled&&Nr(Qr)===j);cr&&N(Nr(cr))}},className:ee?"":"opacity-50 cursor-not-allowed"},Ge.default.createElement(mMe,{model:ae,iconSize:12}))}))),Ge.default.createElement("div",{className:"flex items-center gap-1"},n?Ge.default.createElement(qe,{variant:"ghost2",size:"fit",className:"text-muted",onClick:()=>o()},Ge.default.createElement(iE,{className:"size-4"}),"Stop"):Ge.default.createElement(Ge.default.Fragment,null,V&&Ge.default.createElement(qe,{variant:"ghost2",size:"fit",onClick:()=>{new cie(i,p).open()}},Ge.default.createElement(NU,{className:"w-4 h-4"})),Ge.default.createElement(qe,{variant:"ghost2",size:"fit",className:"text-muted",onClick:()=>D(!1)},Ge.default.createElement(MI,{className:"!size-3"}),Ge.default.createElement("span",null,"chat")),L==="copilot_plus"&&Ge.default.createElement(qe,{variant:"ghost2",size:"fit",className:"text-muted @xs/chat-input:inline-flex hidden",onClick:()=>D(!0)},Ge.default.createElement("div",{className:"flex items-center gap-1"},YB.Platform.isMacOS?Ge.default.createElement("div",{className:"flex items-center"},Ge.default.createElement(TI,{className:"!size-3"}),Ge.default.createElement(Yj,{className:"!size-3"}),Ge.default.createElement(MI,{className:"!size-3"})):Ge.default.createElement("div",{className:"flex items-center"},Ge.default.createElement("span",null,"Ctrl"),Ge.default.createElement(Yj,{className:"size-4"}),Ge.default.createElement(MI,{className:"!size-3"})),Ge.default.createElement("span",null,"vault")))))))});HFt.displayName="ChatInput";var VFt=HFt;var WFt=require("obsidian"),Pr=B(Y()),JFt=({message:e,onCopy:t,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>Pr.default.createElement("div",{className:_e("flex",{"group-hover:opacity-100 opacity-0":!WFt.Platform.isMobile})},Pr.default.createElement(Yr,null,Pr.default.createElement(Zr,{asChild:!0},Pr.default.createElement(qe,{variant:"ghost2",size:"fit",onClick:t,title:"Copy"},r?Pr.default.createElement(Xm,{className:"size-4"}):Pr.default.createElement(ZS,{className:"size-4"}))),Pr.default.createElement(Vr,null,"Copy")),e.sender===zo?Pr.default.createElement(Pr.default.Fragment,null,Pr.default.createElement(Yr,null,Pr.default.createElement(Zr,{asChild:!0},Pr.default.createElement(qe,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},Pr.default.createElement(yf,{className:"size-4"}))),Pr.default.createElement(Vr,null,"Edit")),Pr.default.createElement(Yr,null,Pr.default.createElement(Zr,{asChild:!0},Pr.default.createElement(qe,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Pr.default.createElement(eg,{className:"size-4"}))),Pr.default.createElement(Vr,null,"Delete"))):Pr.default.createElement(Pr.default.Fragment,null,u&&Pr.default.createElement(Yr,null,Pr.default.createElement(Zr,{asChild:!0},Pr.default.createElement(qe,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},Pr.default.createElement(kU,{className:"size-4"}))),Pr.default.createElement(Vr,null,"Show Sources")),Pr.default.createElement(Yr,null,Pr.default.createElement(Zr,{asChild:!0},Pr.default.createElement(qe,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},Pr.default.createElement(HU,{className:"size-4"}))),Pr.default.createElement(Vr,null,"Insert / Replace at cursor")),Pr.default.createElement(Yr,null,Pr.default.createElement(Zr,{asChild:!0},Pr.default.createElement(qe,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},Pr.default.createElement(UU,{className:"size-4"}))),Pr.default.createElement(Vr,null,"Regenerate")),Pr.default.createElement(Yr,null,Pr.default.createElement(Zr,{asChild:!0},Pr.default.createElement(qe,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Pr.default.createElement(eg,{className:"size-4"}))),Pr.default.createElement(Vr,null,"Delete"))));var GFt=require("obsidian"),mie=class extends GFt.Modal{constructor(t,r){super(t),this.sources=r}onOpen(){let{contentEl:t}=this;t.empty(),t.createEl("h2",{text:"Sources"});let r=this.sources.filter(o=>o.score>=Vle),n=this.sources.filter(o=>o.score<Vle);r.length>0&&(t.createEl("h3",{text:"High Relevance Sources"}),this.createSourceList(t,r)),n.length>0&&(t.createEl("h3",{text:"Lower Relevance Sources"}),this.createSourceList(t,n))}createSourceList(t,r){let n=t.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:t}=this;t.empty()}};var K1=require("obsidian"),Kt=B(Y());function Ocn({context:e}){return!e||e.notes.length===0&&e.urls.length===0?null:Kt.default.createElement("div",{className:"flex gap-2 flex-wrap"},e.notes.map(t=>Kt.default.createElement(Yr,{key:t.path},Kt.default.createElement(Zr,{asChild:!0},Kt.default.createElement(Gg,{variant:"secondary"},Kt.default.createElement("span",{className:"max-w-40 truncate"},t.basename))),Kt.default.createElement(Vr,null,t.path))),e.urls.map(t=>Kt.default.createElement(Yr,{key:t},Kt.default.createElement(Zr,{asChild:!0},Kt.default.createElement(Gg,{variant:"secondary"},Kt.default.createElement("span",{className:"max-w-40 truncate"},t))),Kt.default.createElement(Vr,null,t))))}var Ecn=({message:e,app:t,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i})=>{let[a,s]=(0,Kt.useState)(!1),[u,l]=(0,Kt.useState)(!1),[c,d]=(0,Kt.useState)(e.message),f=(0,Kt.useRef)(null),p=(0,Kt.useRef)(null),h=(0,Kt.useRef)(null),m=()=>{!navigator.clipboard||!navigator.clipboard.writeText||navigator.clipboard.writeText(e.message).then(()=>{s(!0),setTimeout(()=>{s(!1)},2e3)})},_=(0,Kt.useCallback)(j=>{let N=t.workspace.getActiveFile(),F=N?N.path:"",k=z=>{let W="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",J="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",te="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)";if(r&&z.includes("<think>"))return z=z.replace(/<think>([\s\S]*?)<\/think>/g,(Z,X)=>`<details style="${W}">
<summary style="${J}">Thought for a second</summary>
<div class="text-muted" style="${te}">${X.trim()}</div>
</details>
`),z=z.replace(/<think>([\s\S]*)$/,(Z,X)=>`<div style="${W}">
<div style="${J}">Thinking...</div>
<div class="text-muted" style="${te}">${X.trim()}</div>
</div>`),z;let Ie=/<think>([\s\S]*?)<\/think>/g;return z.replace(Ie,(Z,X)=>`<details style="${W}">
<summary style="${J}">Thought for a second</summary>
<div class="text-muted" style="${te}">${X.trim()}</div>
</details>
`)},L=(z,W,J)=>z.split(/(```[\s\S]*?```|`[^`]*`)/g).map((Ie,Z)=>Z%2===0?Ie.replace(W,(X,ne)=>{let Pe=t.metadataCache.getFirstLinkpathDest(ne,F);return Pe?J(Pe):X}):Ie).join(""),q=j.replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$"),U=L(q,/!\[\[(.*?)]]/g,z=>`![](${t.vault.getResourcePath(z)})`),G=k(U),V=g(G);return L(V,/(?<!!)\[\[([^\]]+)]]/g,z=>`<a href="obsidian://open?file=${encodeURIComponent(z.path)}">${z.basename}</a>`)},[t,r]),g=j=>{let N=j.split(`
#### Sources:
`);if(N.length!==2)return j;let[F,k]=N,L=k.split(`
`).map(q=>{let U=q.match(/- \[\[(.*?)\]\]/);return U?`<li>[[${U[1]}]]</li>`:q}).join(`
`);return F+`
<br/>
<details><summary>Sources</summary>
<ul>
`+L+`
</ul>
</details>`};(0,Kt.useEffect)(()=>{if(f.current&&e.sender!==zo){f.current.innerHTML="",p.current||(p.current=new K1.Component);let j=_(e.message);K1.MarkdownRenderer.renderMarkdown(j,f.current,"",p.current)}return()=>{p.current&&(p.current.unload(),p.current=null)}},[e,t,p,r,_]),(0,Kt.useEffect)(()=>{u&&h.current&&v(h.current)},[u]),(0,Kt.useEffect)(()=>{d(e.message)},[e.message]);let v=j=>{j.style.height="auto",j.style.height=`${j.scrollHeight}px`},S=j=>{d(j.target.value),v(j.target)},x=j=>{j.nativeEvent.isComposing||j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),T())},O=()=>{l(!0)},T=()=>{l(!1),o&&o(c)},E=()=>{e.sources&&e.sources.length>0&&new mie(t,e.sources).open()},M=()=>{let j=t.workspace.getMostRecentLeaf();if((!j||!(j.view instanceof K1.MarkdownView))&&(j=t.workspace.getLeaf(!1),!j||!(j.view instanceof K1.MarkdownView)))return;let F=j.view.editor.getSelection().length>0;Pq(e.message,F)},A=()=>e.content?Kt.default.createElement("div",{className:"message-content-items"},e.content.map((j,N)=>j.type==="text"?Kt.default.createElement("div",{key:N,className:"message-text-content"},e.sender===zo&&u?Kt.default.createElement("textarea",{ref:h,value:c,onChange:S,onKeyDown:x,onBlur:T,autoFocus:!0,className:"edit-textarea"}):e.sender===zo?Kt.default.createElement("div",{className:"whitespace-pre-wrap break-words font-normal text-[calc(var(--font-text-size)_-_2px)]"},e.message):Kt.default.createElement("div",{ref:f,className:e.isErrorMessage?"text-error":""})):j.type==="image_url"?Kt.default.createElement("div",{key:N,className:"message-image-content"},Kt.default.createElement("img",{src:j.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):e.sender===zo&&u?Kt.default.createElement("textarea",{ref:h,value:c,onChange:S,onKeyDown:x,onBlur:T,autoFocus:!0,className:"edit-textarea"}):e.sender===zo?Kt.default.createElement("div",{className:"whitespace-pre-wrap break-words font-normal text-[calc(var(--font-text-size)_-_2px)]"},e.message):Kt.default.createElement("div",{ref:f,className:e.isErrorMessage?"text-error":""});return Kt.default.createElement("div",{className:"flex flex-col w-full my-1"},Kt.default.createElement("div",{className:_e("flex rounded-md p-2 mx-2 gap-2 group",e.sender===zo&&"border border-border border-solid")},Kt.default.createElement("div",{className:"w-6 shrink-0"},e.sender===zo?Kt.default.createElement(VU,null):Kt.default.createElement(EI,null)),Kt.default.createElement("div",{className:"flex flex-col flex-grow max-w-full gap-2"},!u&&Kt.default.createElement(Ocn,{context:e.context}),Kt.default.createElement("div",{className:"message-content"},A()),!r&&Kt.default.createElement("div",{className:"flex justify-between items-center"},Kt.default.createElement("div",{className:"text-faint text-xs"},e.timestamp?.display),Kt.default.createElement(JFt,{message:e,onCopy:m,isCopied:a,onInsertIntoEditor:M,onRegenerate:n,onEdit:O,onDelete:i,onShowSources:E,hasSources:!!(e.sources&&e.sources.length>0)})))))},oAe=Ecn;var Sc=B(Y(),1);function KFt(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}var ZFt=B(Y(),1);function YFt(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function iAe(...e){return t=>{let r=!1,n=e.map(o=>{let i=YFt(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():YFt(e[o],null)}}}}function XFt(...e){return ZFt.useCallback(iAe(...e),e)}var QFt=B(Y(),1),Acn=B(ss(),1);var wc=B(Y(),1);var ZB=B(lt(),1),sAe=wc.forwardRef((e,t)=>{let{children:r,...n}=e,o=wc.Children.toArray(r),i=o.find(Tcn);if(i){let a=i.props.children,s=o.map(u=>u===i?wc.Children.count(a)>1?wc.Children.only(null):wc.isValidElement(a)?a.props.children:null:u);return(0,ZB.jsx)(aAe,{...n,ref:t,children:wc.isValidElement(a)?wc.cloneElement(a,void 0,s):null})}return(0,ZB.jsx)(aAe,{...n,ref:t,children:r})});sAe.displayName="Slot";var aAe=wc.forwardRef((e,t)=>{let{children:r,...n}=e;if(wc.isValidElement(r)){let o=Icn(r);return wc.cloneElement(r,{...Mcn(n,r.props),ref:t?iAe(t,o):o})}return wc.Children.count(r)>1?wc.Children.only(null):null});aAe.displayName="SlotClone";var Pcn=({children:e})=>(0,ZB.jsx)(ZB.Fragment,{children:e});function Tcn(e){return wc.isValidElement(e)&&e.type===Pcn}function Mcn(e,t){let r={...t};for(let n in t){let o=e[n],i=t[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{...e,...r}}function Icn(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var ekt=B(lt(),1),Rcn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],gie=Rcn.reduce((e,t)=>{let r=QFt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?sAe:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,ekt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});var Y1=B(lt(),1),uAe="Collapsible",[Dcn,V8o]=Ro(uAe),[jcn,lAe]=Dcn(uAe),tkt=Sc.forwardRef((e,t)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=e,[u=!1,l]=tl({prop:n,defaultProp:o,onChange:a});return(0,Y1.jsx)(jcn,{scope:r,disabled:i,contentId:Fa(),open:u,onOpenToggle:Sc.useCallback(()=>l(c=>!c),[l]),children:(0,Y1.jsx)(gie.div,{"data-state":pAe(u),"data-disabled":i?"":void 0,...s,ref:t})})});tkt.displayName=uAe;var rkt="CollapsibleTrigger",cAe=Sc.forwardRef((e,t)=>{let{__scopeCollapsible:r,...n}=e,o=lAe(rkt,r);return(0,Y1.jsx)(gie.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":pAe(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:t,onClick:KFt(e.onClick,o.onOpenToggle)})});cAe.displayName=rkt;var dAe="CollapsibleContent",fAe=Sc.forwardRef((e,t)=>{let{forceMount:r,...n}=e,o=lAe(dAe,e.__scopeCollapsible);return(0,Y1.jsx)(Ru,{present:r||o.open,children:({present:i})=>(0,Y1.jsx)(Ncn,{...n,ref:t,present:i})})});fAe.displayName=dAe;var Ncn=Sc.forwardRef((e,t)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=e,a=lAe(dAe,r),[s,u]=Sc.useState(n),l=Sc.useRef(null),c=XFt(t,l),d=Sc.useRef(0),f=d.current,p=Sc.useRef(0),h=p.current,m=a.open||s,_=Sc.useRef(m),g=Sc.useRef(void 0);return Sc.useEffect(()=>{let v=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(v)},[]),qr(()=>{let v=l.current;if(v){g.current=g.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";let S=v.getBoundingClientRect();d.current=S.height,p.current=S.width,_.current||(v.style.transitionDuration=g.current.transitionDuration,v.style.animationName=g.current.animationName),u(n)}},[a.open,n]),(0,Y1.jsx)(gie.div,{"data-state":pAe(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!m,...i,ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:m&&o})});function pAe(e){return e?"open":"closed"}var nkt=tkt;var AH=nkt,RH=cAe,DH=fAe;var kH=B(Y());var Yi=B(Y(),1);function rS(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}var ikt=B(Y(),1);function okt(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function hAe(...e){return t=>{let r=!1,n=e.map(o=>{let i=okt(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():okt(e[o],null)}}}}function Kg(...e){return ikt.useCallback(hAe(...e),e)}var Sa=B(Y(),1);var akt=B(Y(),1),skt=B(ss(),1);var xc=B(Y(),1);var XB=B(lt(),1),jH=xc.forwardRef((e,t)=>{let{children:r,...n}=e,o=xc.Children.toArray(r),i=o.find(kcn);if(i){let a=i.props.children,s=o.map(u=>u===i?xc.Children.count(a)>1?xc.Children.only(null):xc.isValidElement(a)?a.props.children:null:u);return(0,XB.jsx)(mAe,{...n,ref:t,children:xc.isValidElement(a)?xc.cloneElement(a,void 0,s):null})}return(0,XB.jsx)(mAe,{...n,ref:t,children:r})});jH.displayName="Slot";var mAe=xc.forwardRef((e,t)=>{let{children:r,...n}=e;if(xc.isValidElement(r)){let o=$cn(r);return xc.cloneElement(r,{...Bcn(n,r.props),ref:t?hAe(t,o):o})}return xc.Children.count(r)>1?xc.Children.only(null):null});mAe.displayName="SlotClone";var Fcn=({children:e})=>(0,XB.jsx)(XB.Fragment,{children:e});function kcn(e){return xc.isValidElement(e)&&e.type===Fcn}function Bcn(e,t){let r={...t};for(let n in t){let o=e[n],i=t[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{...e,...r}}function $cn(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var ukt=B(lt(),1),qcn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Wd=qcn.reduce((e,t)=>{let r=akt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?jH:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,ukt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function lkt(e,t){e&&skt.flushSync(()=>e.dispatchEvent(t))}var yAe=B(lt(),1),Ucn="DismissableLayer",gAe="dismissableLayer.update",zcn="dismissableLayer.pointerDownOutside",Hcn="dismissableLayer.focusOutside",ckt,fkt=Sa.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),bAe=Sa.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=e,l=Sa.useContext(fkt),[c,d]=Sa.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Sa.useState({}),h=Kg(t,E=>d(E)),m=Array.from(l.layers),[_]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(_),v=c?m.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=v>=g,O=Jcn(E=>{let M=E.target,A=[...l.branches].some(j=>j.contains(M));!x||A||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),T=Gcn(E=>{let M=E.target;[...l.branches].some(j=>j.contains(M))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return Zw(E=>{v===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Sa.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(ckt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),dkt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=ckt)}},[c,f,r,l]),Sa.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),dkt())},[c,l]),Sa.useEffect(()=>{let E=()=>p({});return document.addEventListener(gAe,E),()=>document.removeEventListener(gAe,E)},[]),(0,yAe.jsx)(Wd.div,{...u,ref:h,style:{pointerEvents:S?x?"auto":"none":void 0,...e.style},onFocusCapture:rS(e.onFocusCapture,T.onFocusCapture),onBlurCapture:rS(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:rS(e.onPointerDownCapture,O.onPointerDownCapture)})});bAe.displayName=Ucn;var Vcn="DismissableLayerBranch",Wcn=Sa.forwardRef((e,t)=>{let r=Sa.useContext(fkt),n=Sa.useRef(null),o=Kg(t,n);return Sa.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,yAe.jsx)(Wd.div,{...e,ref:o})});Wcn.displayName=Vcn;function Jcn(e,t=globalThis?.document){let r=Gt(e),n=Sa.useRef(!1),o=Sa.useRef(()=>{});return Sa.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){pkt(zcn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Gcn(e,t=globalThis?.document){let r=Gt(e),n=Sa.useRef(!1);return Sa.useEffect(()=>{let o=i=>{i.target&&!n.current&&pkt(Hcn,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function dkt(){let e=new CustomEvent(gAe);document.dispatchEvent(e)}function pkt(e,t,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?lkt(o,i):o.dispatchEvent(i)}var Sm=B(Y(),1);var bkt=B(lt(),1),_Ae="focusScope.autoFocusOnMount",vAe="focusScope.autoFocusOnUnmount",hkt={bubbles:!1,cancelable:!0},Kcn="FocusScope",wAe=Sm.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[s,u]=Sm.useState(null),l=Gt(o),c=Gt(i),d=Sm.useRef(null),f=Kg(t,m=>u(m)),p=Sm.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Sm.useEffect(()=>{if(n){let v=function(T){if(p.paused||!s)return;let E=T.target;s.contains(E)?d.current=E:XT(d.current,{select:!0})},S=function(T){if(p.paused||!s)return;let E=T.relatedTarget;E!==null&&(s.contains(E)||XT(d.current,{select:!0}))},x=function(T){if(document.activeElement===document.body)for(let M of T)M.removedNodes.length>0&&XT(s)};var m=v,_=S,g=x;document.addEventListener("focusin",v),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),Sm.useEffect(()=>{if(s){gkt.add(p);let m=document.activeElement;if(!s.contains(m)){let g=new CustomEvent(_Ae,hkt);s.addEventListener(_Ae,l),s.dispatchEvent(g),g.defaultPrevented||(Ycn(tdn(_kt(s)),{select:!0}),document.activeElement===m&&XT(s))}return()=>{s.removeEventListener(_Ae,l),setTimeout(()=>{let g=new CustomEvent(vAe,hkt);s.addEventListener(vAe,c),s.dispatchEvent(g),g.defaultPrevented||XT(m??document.body,{select:!0}),s.removeEventListener(vAe,c),gkt.remove(p)},0)}}},[s,l,c,p]);let h=Sm.useCallback(m=>{if(!r&&!n||p.paused)return;let _=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(_&&g){let v=m.currentTarget,[S,x]=Zcn(v);S&&x?!m.shiftKey&&g===x?(m.preventDefault(),r&&XT(S,{select:!0})):m.shiftKey&&g===S&&(m.preventDefault(),r&&XT(x,{select:!0})):g===v&&m.preventDefault()}},[r,n,p.paused]);return(0,bkt.jsx)(Wd.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});wAe.displayName=Kcn;function Ycn(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(XT(n,{select:t}),document.activeElement!==r)return}function Zcn(e){let t=_kt(e),r=mkt(t,e),n=mkt(t.reverse(),e);return[r,n]}function _kt(e){let t=[],r=document.createTreeWalker(e,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();)t.push(r.currentNode);return t}function mkt(e,t){for(let r of e)if(!Xcn(r,{upTo:t}))return r}function Xcn(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Qcn(e){return e instanceof HTMLInputElement&&"select"in e}function XT(e,{select:t=!1}={}){if(e&&e.focus){let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Qcn(e)&&t&&e.select()}}var gkt=edn();function edn(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),e=ykt(e,t),e.unshift(t)},remove(t){e=ykt(e,t),e[0]?.resume()}}}function ykt(e,t){let r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function tdn(e){return e.filter(t=>t.tagName!=="A")}var $p=B(Y(),1);var vkt=B(Y(),1);var SAe=B(lt(),1),rdn="Arrow",wkt=vkt.forwardRef((e,t)=>{let{children:r,width:n=10,height:o=5,...i}=e;return(0,SAe.jsx)(Wd.svg,{...i,ref:t,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,SAe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});wkt.displayName=rdn;var Skt=wkt;var QT=B(lt(),1);var xAe="Popper",[xkt,CAe]=Ro(xAe),[odn,Ckt]=xkt(xAe),Okt=e=>{let{__scopePopper:t,children:r}=e,[n,o]=$p.useState(null);return(0,QT.jsx)(odn,{scope:t,anchor:n,onAnchorChange:o,children:r})};Okt.displayName=xAe;var Ekt="PopperAnchor",Pkt=$p.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:n,...o}=e,i=Ckt(Ekt,r),a=$p.useRef(null),s=Kg(t,a);return $p.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,QT.jsx)(Wd.div,{...o,ref:s})});Pkt.displayName=Ekt;var OAe="PopperContent",[idn,adn]=xkt(OAe),Tkt=$p.forwardRef((e,t)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:h,...m}=e,_=Ckt(OAe,r),[g,v]=$p.useState(null),S=Kg(t,ne=>v(ne)),[x,O]=$p.useState(null),T=_m(x),E=T?.width??0,M=T?.height??0,A=n+(i!=="center"?"-"+i:""),j=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],F=N.length>0,k={padding:j,boundary:N.filter(udn),altBoundary:F},{refs:L,floatingStyles:q,placement:U,isPositioned:G,middlewareData:V}=NT({strategy:"fixed",placement:A,whileElementsMounted:(...ne)=>KC(...ne,{animationFrame:p==="always"}),elements:{reference:_.anchor},middleware:[LT({mainAxis:o+M,alignmentAxis:a}),u&&FT({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?kT():void 0,...k}),u&&BT({...k}),$T({...k,apply:({elements:ne,rects:Pe,availableWidth:ht,availableHeight:we})=>{let{width:ae,height:ee}=Pe.reference,ge=ne.floating.style;ge.setProperty("--radix-popper-available-width",`${ht}px`),ge.setProperty("--radix-popper-available-height",`${we}px`),ge.setProperty("--radix-popper-anchor-width",`${ae}px`),ge.setProperty("--radix-popper-anchor-height",`${ee}px`)}}),x&&UT({element:x,padding:s}),ldn({arrowWidth:E,arrowHeight:M}),f&&qT({strategy:"referenceHidden",...k})]}),[D,z]=Akt(U),W=Gt(h);qr(()=>{G&&W?.()},[G,W]);let J=V.arrow?.x,te=V.arrow?.y,Ie=V.arrow?.centerOffset!==0,[Z,X]=$p.useState();return qr(()=>{g&&X(window.getComputedStyle(g).zIndex)},[g]),(0,QT.jsx)("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:G?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Z,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,QT.jsx)(idn,{scope:r,placedSide:D,onArrowChange:O,arrowX:J,arrowY:te,shouldHideArrow:Ie,children:(0,QT.jsx)(Wd.div,{"data-side":D,"data-align":z,...m,ref:S,style:{...m.style,animation:G?void 0:"none"}})})})});Tkt.displayName=OAe;var Mkt="PopperArrow",sdn={top:"bottom",right:"left",bottom:"top",left:"right"},Ikt=$p.forwardRef(function(t,r){let{__scopePopper:n,...o}=t,i=adn(Mkt,n),a=sdn[i.placedSide];return(0,QT.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,QT.jsx)(Skt,{...o,ref:r,style:{...o.style,display:"block"}})})});Ikt.displayName=Mkt;function udn(e){return e!==null}var ldn=e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:o}=t,a=o.arrow?.centerOffset!==0,s=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[l,c]=Akt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,h="",m="";return l==="bottom"?(h=a?d:`${f}px`,m=`${-u}px`):l==="top"?(h=a?d:`${f}px`,m=`${n.floating.height+u}px`):l==="right"?(h=`${-u}px`,m=a?d:`${p}px`):l==="left"&&(h=`${n.floating.width+u}px`,m=a?d:`${p}px`),{data:{x:h,y:m}}}});function Akt(e){let[t,r="center"]=e.split("-");return[t,r]}var Rkt=Okt,EAe=Pkt,Dkt=Tkt,jkt=Ikt;var yie=B(Y(),1),Nkt=B(ss(),1);var Lkt=B(lt(),1),ddn="Portal",PAe=yie.forwardRef((e,t)=>{let{container:r,...n}=e,[o,i]=yie.useState(!1);qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Nkt.default.createPortal((0,Lkt.jsx)(Wd.div,{...n,ref:t}),a):null});PAe.displayName=ddn;var vie=B(Y());var ld=B(Y());var bie=U1();var TAe=function(){},NH=ld.forwardRef(function(e,t){var r=ld.useRef(null),n=ld.useState({onScrollCapture:TAe,onWheelCapture:TAe,onTouchMoveCapture:TAe}),o=n[0],i=n[1],a=e.forwardProps,s=e.children,u=e.className,l=e.removeScrollBar,c=e.enabled,d=e.shards,f=e.sideCar,p=e.noIsolation,h=e.inert,m=e.allowPinchZoom,_=e.as,g=_===void 0?"div":_,v=e.gapMode,S=JT(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=q1([r,t]),T=Do(Do({},S),o);return ld.createElement(ld.Fragment,null,c&&ld.createElement(x,{sideCar:bie,removeScrollBar:l,shards:d,noIsolation:p,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:r,gapMode:v}),a?ld.cloneElement(ld.Children.only(s),Do(Do({},T),{ref:O})):ld.createElement(g,Do({},T,{className:u,ref:O}),s))});NH.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};NH.classNames={fullWidth:Vg,zeroRight:Hg};var Ri=B(Y());var MAe=!1;if(typeof window<"u")try{LH=Object.defineProperty({},"passive",{get:function(){return MAe=!0,!0}}),window.addEventListener("test",LH,LH),window.removeEventListener("test",LH,LH)}catch{MAe=!1}var LH,Z1=MAe?{passive:!1}:!1;var fdn=function(e){return e.tagName==="TEXTAREA"},Fkt=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!fdn(e)&&r[t]==="visible")},pdn=function(e){return Fkt(e,"overflowY")},hdn=function(e){return Fkt(e,"overflowX")},IAe=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=kkt(e,n);if(o){var i=Bkt(e,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},mdn=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},gdn=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},kkt=function(e,t){return e==="v"?pdn(t):hdn(t)},Bkt=function(e,t){return e==="v"?mdn(t):gdn(t)},ydn=function(e,t){return e==="h"&&t==="rtl"?-1:1},$kt=function(e,t,r,n,o){var i=ydn(e,window.getComputedStyle(t).direction),a=i*n,s=r.target,u=t.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=Bkt(e,s),h=p[0],m=p[1],_=p[2],g=m-_-i*h;(h||g)&&kkt(e,s)&&(d+=g,f+=h),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(t.contains(s)||t===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var _ie=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},qkt=function(e){return[e.deltaX,e.deltaY]},Ukt=function(e){return e&&"current"in e?e.current:e},bdn=function(e,t){return e[0]===t[0]&&e[1]===t[1]},_dn=function(e){return`
.block-interactivity-`.concat(e,` {pointer-events: none;}
.allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},vdn=0,QB=[];function zkt(e){var t=Ri.useRef([]),r=Ri.useRef([0,0]),n=Ri.useRef(),o=Ri.useState(vdn++)[0],i=Ri.useState(YC)[0],a=Ri.useRef(e);Ri.useEffect(function(){a.current=e},[e]),Ri.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=BB([e.lockRef.current],(e.shards||[]).map(Ukt),!0).filter(Boolean);return m.forEach(function(_){return _.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=Ri.useCallback(function(m,_){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var g=_ie(m),v=r.current,S="deltaX"in m?m.deltaX:v[0]-g[0],x="deltaY"in m?m.deltaY:v[1]-g[1],O,T=m.target,E=Math.abs(S)>Math.abs(x)?"h":"v";if("touches"in m&&E==="h"&&T.type==="range")return!1;var M=IAe(E,T);if(!M)return!0;if(M?O=E:(O=E==="v"?"h":"v",M=IAe(E,T)),!M)return!1;if(!n.current&&"changedTouches"in m&&(S||x)&&(n.current=O),!O)return!0;var A=n.current||O;return $kt(A,_,m,A==="h"?S:x,!0)},[]),u=Ri.useCallback(function(m){var _=m;if(!(!QB.length||QB[QB.length-1]!==i)){var g="deltaY"in _?qkt(_):_ie(_),v=t.current.filter(function(O){return O.name===_.type&&(O.target===_.target||_.target===O.shadowParent)&&bdn(O.delta,g)})[0];if(v&&v.should){_.cancelable&&_.preventDefault();return}if(!v){var S=(a.current.shards||[]).map(Ukt).filter(Boolean).filter(function(O){return O.contains(_.target)}),x=S.length>0?s(_,S[0]):!a.current.noIsolation;x&&_.cancelable&&_.preventDefault()}}},[]),l=Ri.useCallback(function(m,_,g,v){var S={name:m,delta:_,target:g,should:v,shadowParent:wdn(g)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(x){return x!==S})},1)},[]),c=Ri.useCallback(function(m){r.current=_ie(m),n.current=void 0},[]),d=Ri.useCallback(function(m){l(m.type,qkt(m),m.target,s(m,e.lockRef.current))},[]),f=Ri.useCallback(function(m){l(m.type,_ie(m),m.target,s(m,e.lockRef.current))},[]);Ri.useEffect(function(){return QB.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,Z1),document.addEventListener("touchmove",u,Z1),document.addEventListener("touchstart",c,Z1),function(){QB=QB.filter(function(m){return m!==i}),document.removeEventListener("wheel",u,Z1),document.removeEventListener("touchmove",u,Z1),document.removeEventListener("touchstart",c,Z1)}},[]);var p=e.removeScrollBar,h=e.inert;return Ri.createElement(Ri.Fragment,null,h?Ri.createElement(i,{styles:_dn(o)}):null,p?Ri.createElement(H1,{gapMode:e.gapMode}):null)}function wdn(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Hkt=z1(bie,zkt);var Vkt=vie.forwardRef(function(e,t){return vie.createElement(NH,Do({},e,{ref:t,sideCar:Hkt}))});Vkt.classNames=NH.classNames;var AAe=Vkt;var ju=B(lt(),1),RAe="Popover",[Wkt,a6o]=Ro(RAe,[CAe]),FH=CAe(),[Sdn,eM]=Wkt(RAe),Jkt=e=>{let{__scopePopover:t,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=e,s=FH(t),u=Yi.useRef(null),[l,c]=Yi.useState(!1),[d=!1,f]=tl({prop:n,defaultProp:o,onChange:i});return(0,ju.jsx)(Rkt,{...s,children:(0,ju.jsx)(Sdn,{scope:t,contentId:Fa(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:Yi.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Yi.useCallback(()=>c(!0),[]),onCustomAnchorRemove:Yi.useCallback(()=>c(!1),[]),modal:a,children:r})})};Jkt.displayName=RAe;var Gkt="PopoverAnchor",xdn=Yi.forwardRef((e,t)=>{let{__scopePopover:r,...n}=e,o=eM(Gkt,r),i=FH(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return Yi.useEffect(()=>(a(),()=>s()),[a,s]),(0,ju.jsx)(EAe,{...i,...n,ref:t})});xdn.displayName=Gkt;var Kkt="PopoverTrigger",Ykt=Yi.forwardRef((e,t)=>{let{__scopePopover:r,...n}=e,o=eM(Kkt,r),i=FH(r),a=Kg(t,o.triggerRef),s=(0,ju.jsx)(Wd.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":tBt(o.open),...n,ref:a,onClick:rS(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,ju.jsx)(EAe,{asChild:!0,...i,children:s})});Ykt.displayName=Kkt;var DAe="PopoverPortal",[Cdn,Odn]=Wkt(DAe,{forceMount:void 0}),Zkt=e=>{let{__scopePopover:t,forceMount:r,children:n,container:o}=e,i=eM(DAe,t);return(0,ju.jsx)(Cdn,{scope:t,forceMount:r,children:(0,ju.jsx)(Ru,{present:r||i.open,children:(0,ju.jsx)(PAe,{asChild:!0,container:o,children:n})})})};Zkt.displayName=DAe;var e$="PopoverContent",Xkt=Yi.forwardRef((e,t)=>{let r=Odn(e$,e.__scopePopover),{forceMount:n=r.forceMount,...o}=e,i=eM(e$,e.__scopePopover);return(0,ju.jsx)(Ru,{present:n||i.open,children:i.modal?(0,ju.jsx)(Edn,{...o,ref:t}):(0,ju.jsx)(Pdn,{...o,ref:t})})});Xkt.displayName=e$;var Edn=Yi.forwardRef((e,t)=>{let r=eM(e$,e.__scopePopover),n=Yi.useRef(null),o=Kg(t,n),i=Yi.useRef(!1);return Yi.useEffect(()=>{let a=n.current;if(a)return WT(a)},[]),(0,ju.jsx)(AAe,{as:jH,allowPinchZoom:!0,children:(0,ju.jsx)(Qkt,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:rS(e.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:rS(e.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:rS(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Pdn=Yi.forwardRef((e,t)=>{let r=eM(e$,e.__scopePopover),n=Yi.useRef(!1),o=Yi.useRef(!1);return(0,ju.jsx)(Qkt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(n.current||r.triggerRef.current?.focus(),i.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:i=>{e.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()}})}),Qkt=Yi.forwardRef((e,t)=>{let{__scopePopover:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onInteractOutside:c,...d}=e,f=eM(e$,r),p=FH(r);return DT(),(0,ju.jsx)(wAe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,ju.jsx)(bAe,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,ju.jsx)(Dkt,{"data-state":tBt(f.open),role:"dialog",id:f.contentId,...p,...d,ref:t,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)"}})})})}),eBt="PopoverClose",Tdn=Yi.forwardRef((e,t)=>{let{__scopePopover:r,...n}=e,o=eM(eBt,r);return(0,ju.jsx)(Wd.button,{type:"button",...n,ref:t,onClick:rS(e.onClick,()=>o.onOpenChange(!1))})});Tdn.displayName=eBt;var Mdn="PopoverArrow",Idn=Yi.forwardRef((e,t)=>{let{__scopePopover:r,...n}=e,o=FH(r);return(0,ju.jsx)(jkt,{...o,...n,ref:t})});Idn.displayName=Mdn;function tBt(e){return e?"open":"closed"}var rBt=Jkt;var nBt=Ykt,oBt=Zkt,jAe=Xkt;var iBt=rBt,aBt=nBt;var NAe=kH.forwardRef(({className:e,align:t="center",sideOffset:r=4,container:n,...o},i)=>kH.createElement(oBt,{container:n??activeDocument.body},kH.createElement(jAe,{ref:i,align:t,sideOffset:r,className:_e("z-popover w-72 rounded-md border border-border bg-primary p-4 text-normal shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})));NAe.displayName=jAe.displayName;var LAe=B(Y()),wie=LAe.createContext(void 0),t$=LAe.createContext(void 0);var r$=B(Y());function FAe(){let[e,t]=(0,r$.useState)(null),r=(0,r$.useContext)(t$);return(0,r$.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();t(o)};return r?.addEventListener(kS.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(kS.ACTIVE_LEAF_CHANGE,n)}},[r]),e}var sBt=require("obsidian");function uBt(e,t=20){let r=app.metadataCache.getFileCache(e),n=[];if(r?.links)for(let o of r.links){let i=app.metadataCache.getFirstLinkpathDest(o.link,e.path);if(i&&(n.push(i),n.length>=t))break}if(r?.embeds&&n.length<t)for(let o of r.embeds){let i=app.metadataCache.getFirstLinkpathDest(o.link,e.path);if(i&&(n.push(i),n.length>=t))break}return[...new Set(n)]}function lBt(e,t=20){let r=[],n=app.metadataCache.getBacklinksForFile(e);if(n?.data)for(let[o]of n.data){let i=app.vault.getAbstractFileByPath(o);if(i instanceof sBt.TFile&&(r.push(i),r.length>=t))break}return r}var kAe=require("obsidian"),Rdn=.4,Ddn=20,cBt=.7,Sie=.3;async function jdn(e,t){let r=pe().debug,n=await Wx.getDocsByPath(t,e);if(!n)return r&&console.log("No hits found for note:",e),[];let o=[];for(let i of n){if(!i?.document?.embedding){r&&console.log("No embedding found for note:",e);continue}o.push(i.document.embedding)}return o}function Ndn(e){if(e.length===0)return[];let t=e[0].length,r=Array(t).fill(0);return e.forEach(n=>{n.forEach((o,i)=>{r[i]+=o/t})}),r}function Ldn(e,t){let r=new Map;for(let n of e){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(t),r}async function Fdn({db:e,filePath:t}){let r=pe().debug,n=await jdn(t,e),o=Ndn(n);if(o.length===0)return r&&console.log("No embeddings found for note:",t),new Map;let i=await Wx.getDocsByEmbedding(e,o,{limit:Ddn,similarity:Rdn});return Ldn(i,t)}function kdn(e){let t=new Map,n=uBt(e).map(a=>a.path);for(let a of n)t.set(a,{links:!0,backlinks:!1});let i=lBt(e).map(a=>a.path);for(let a of i)t.has(a)?t.set(a,{links:!0,backlinks:!0}):t.set(a,{links:!1,backlinks:!0});return t}function Bdn(e,t){let r=new Map,n=cBt+Sie;for(let[o,i]of e)r.set(o,i*cBt/n);for(let[o,i]of t){let a=0;i.links&&i.backlinks?a=Sie:(i.links||i.backlinks)&&(a=Sie*.8),r.set(o,(r.get(o)??0)+a)}return r}async function dBt({db:e,filePath:t}){let r=app.vault.getAbstractFileByPath(t);if(!(r instanceof kAe.TFile))return[];let n=await Fdn({db:e,filePath:t}),o=kdn(r),i=Bdn(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=xie(n.get(l)??0),f=xie(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 kAe.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 xie(e){return e>.7?3:e>.55?2:1}var BH=require("obsidian"),De=B(Y());function $dn(e){let[t,r]=(0,De.useState)([]),n=FAe();return(0,De.useEffect)(()=>{async function o(){if(!n?.path)return;let i=await ma.getInstance().getDb(),a=await dBt({db:i,filePath:n.path});r(a)}o()},[n?.path,e]),t}function qdn(e,t){let[r,n]=(0,De.useState)(!0);return(0,De.useEffect)(()=>{if(!e)return;async function o(){let i=await ma.getInstance().hasIndex(e);n(i)}o()},[e,t]),r}function Udn({score:e}){let t=xie(e),r="\u{1F534}";return t===2&&(r="\u{1F7E0}"),t===3&&(r="\u{1F7E2}"),De.default.createElement("span",{className:"text-sm"},r)}function zdn({note:e,onAddToChat:t,onNavigateToNote:r}){let[n,o]=(0,De.useState)(!1),[i,a]=(0,De.useState)(null),s=(0,De.useCallback)(async()=>{if(i)return;let u=app.vault.getAbstractFileByPath(e.document.path);if(u instanceof BH.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,e.document.path]);return(0,De.useEffect)(()=>{n&&s()},[n,s]),De.default.createElement(AH,{open:n,onOpenChange:o,className:"rounded-md border border-border border-solid"},De.default.createElement("div",{className:_e("flex gap-2 p-2 justify-between items-center")},De.default.createElement(qe,{variant:"ghost2",size:"icon",className:"shrink-0",asChild:!0},De.default.createElement(RH,null,De.default.createElement(YS,{className:_e("size-4 transition-transform duration-200",{"transform rotate-90":n})}))),De.default.createElement("div",{className:"flex items-center gap-2 shrink-0"},De.default.createElement(Udn,{score:e.metadata.similarityScore??0})),De.default.createElement("div",{className:"flex-1 overflow-hidden"},De.default.createElement("a",{onClick:u=>{u.preventDefault();let l=u.metaKey||u.ctrlKey;r(l)},onAuxClick:u=>{u.button===1&&(u.preventDefault(),r(!0))},className:"text-sm text-normal font-bold text-ellipsis overflow-hidden whitespace-nowrap w-full block"},e.document.title)),De.default.createElement(Yr,null,De.default.createElement(Zr,{asChild:!0},De.default.createElement(qe,{variant:"ghost2",size:"icon",onClick:t,className:"shrink-0"},De.default.createElement(Qm,{className:"size-4"}))),De.default.createElement(Vr,null,"Add to Chat"))),De.default.createElement(DH,null,De.default.createElement("div",{className:"px-4 py-2 border-[0px] border-t border-border border-solid"},De.default.createElement("div",{className:"text-xs text-muted text-wrap opacity-75 break-all whitespace-pre-wrap"},e.document.path),i&&De.default.createElement("div",{className:"text-xs text-normal whitespace-pre-wrap pt-2 pb-4 border-t border-border overflow-hidden"},i)),De.default.createElement("div",{className:"flex item-center gap-4 px-4 py-2 border-[0px] border-t border-solid border-border text-xs text-muted"},e.metadata.similarityScore!=null&&De.default.createElement("div",{className:"flex items-center gap-1"},De.default.createElement("span",null,"Similarity: ",(e.metadata.similarityScore*100).toFixed(1),"%")),e.metadata.hasOutgoingLinks&&De.default.createElement("div",{className:"flex items-center gap-1"},De.default.createElement(RU,{className:"size-4"}),De.default.createElement("span",null,"Outgoing links")),e.metadata.hasBacklinks&&De.default.createElement("div",{className:"flex items-center gap-1"},De.default.createElement(AU,{className:"size-4"}),De.default.createElement("span",null,"Backlinks")))))}function Hdn({note:e,onAddToChat:t,onNavigateToNote:r,children:n}){return De.default.createElement(iBt,{key:e.document.path},De.default.createElement(aBt,{asChild:!0},n),De.default.createElement(NAe,{className:"flex flex-col gap-2 overflow-hidden w-fit min-w-72 max-w-96"},De.default.createElement("span",{className:"text-sm text-normal"},e.document.title),De.default.createElement("span",{className:"text-xs text-muted"},e.document.path),De.default.createElement("div",{className:"flex gap-2"},De.default.createElement("button",{onClick:t,className:"!bg-transparent inline-flex items-center gap-2 border border-border border-solid !shadow-none hover:!bg-interactive-hover"},"Add to Chat ",De.default.createElement(Qm,{className:"size-4"})),De.default.createElement("button",{onClick:o=>{let i=o.metaKey||o.ctrlKey;r(i)},className:"!bg-transparent inline-flex items-center gap-2 border border-border border-solid !shadow-none hover:!bg-interactive-hover"},"Navigate to Note ",De.default.createElement(CU,{className:"size-4"})))))}var Cie=(0,De.memo)(({className:e,onInsertToChat:t,defaultOpen:r=!1})=>{let[n,o]=(0,De.useState)(0),[i,a]=(0,De.useState)(r),s=$dn(n),u=FAe(),l=qdn(u?.path??"",n),c=(p,h=!1)=>{let m=app.vault.getAbstractFileByPath(p);m instanceof BH.TFile&&app.workspace.getLeaf(h).openFile(m)},d=p=>{t(`[[${p}]]`)},f=async()=>{u&&(await ma.getInstance().reindexFile(u),new BH.Notice(`Reindexed ${u.name}`),o(n+1))};return De.default.createElement("div",{className:_e("w-full border border-transparent border-b-border border-solid pb-2",e)},De.default.createElement(AH,{open:i,onOpenChange:a},De.default.createElement("div",{className:"flex justify-between items-center pl-1 pb-2"},De.default.createElement("div",{className:"flex gap-2 items-center flex-1"},De.default.createElement("span",{className:"font-semibold text-normal"},"Relevant Notes"),De.default.createElement(Yr,null,De.default.createElement(Zr,{asChild:!0},De.default.createElement(LU,{className:"size-4 text-muted"})),De.default.createElement(Vr,{side:"bottom",className:"w-64"},"Relevance is a combination of semantic similarity and links.")),!l&&De.default.createElement(Yr,null,De.default.createElement(Zr,{asChild:!0},De.default.createElement(yh,{className:"size-4 text-warning"})),De.default.createElement(Vr,{side:"bottom"},"Note has not been indexed"))),De.default.createElement("div",{className:"flex items-center"},De.default.createElement(Yr,null,De.default.createElement(Zr,{asChild:!0},De.default.createElement(qe,{variant:"ghost2",size:"icon",onClick:f},De.default.createElement($U,{className:"size-4"}))),De.default.createElement(Vr,{side:"bottom"},"Reindex Current Note")),s.length>0&&De.default.createElement(RH,{asChild:!0},De.default.createElement(qe,{variant:"ghost2",size:"icon"},i?De.default.createElement(PI,{className:"size-5"}):De.default.createElement(us,{className:"size-5"}))))),s.length===0&&De.default.createElement("div",{className:"flex flex-wrap gap-x-2 gap-y-1 max-h-12 overflow-y-hidden px-1"},De.default.createElement("span",{className:"text-xs text-muted"},"No relevant notes found")),!i&&s.length>0&&De.default.createElement("div",{className:"flex flex-wrap gap-x-2 gap-y-1 max-h-6 overflow-y-hidden px-1"},s.map(p=>De.default.createElement(Hdn,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:h=>c(p.document.path,h)},De.default.createElement(Gg,{variant:"outline",key:p.document.path,className:"text-xs max-w-40 text-muted hover:cursor-pointer hover:bg-interactive-hover"},De.default.createElement("span",{className:"text-ellipsis overflow-hidden whitespace-nowrap"},p.document.title))))),De.default.createElement(DH,null,De.default.createElement("div",{className:"px-1 py-2 max-h-screen overflow-y-auto flex flex-col gap-2"},s.map(p=>De.default.createElement(zdn,{note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:h=>c(p.document.path,h)}))))))});Cie.displayName="RelevantNotes";var Jf=B(Y());var $H=Jf.forwardRef(({className:e,...t},r)=>Jf.createElement("div",{ref:r,className:_e("rounded-xl border border-border bg-primary text-normal shadow",e),...t}));$H.displayName="Card";var qH=Jf.forwardRef(({className:e,...t},r)=>Jf.createElement("div",{ref:r,className:_e("flex flex-col space-y-1.5 p-6",e),...t}));qH.displayName="CardHeader";var BAe=Jf.forwardRef(({className:e,...t},r)=>Jf.createElement("div",{ref:r,className:_e("font-semibold leading-none tracking-tight",e),...t}));BAe.displayName="CardTitle";var Vdn=Jf.forwardRef(({className:e,...t},r)=>Jf.createElement("div",{ref:r,className:_e("text-sm text-muted",e),...t}));Vdn.displayName="CardDescription";var UH=Jf.forwardRef(({className:e,...t},r)=>Jf.createElement("div",{ref:r,className:_e("p-6 pt-0",e),...t}));UH.displayName="CardContent";var Wdn=Jf.forwardRef(({className:e,...t},r)=>Jf.createElement("div",{ref:r,className:_e("flex items-center p-6 pt-0",e),...t}));Wdn.displayName="CardFooter";var hi=B(Y()),$Ae={activeNote:{title:"Active Note Insights",prompts:["Provide three follow-up questions worded as if I'm asking you based on {activeNote}?","What key questions does {activeNote} answer?","Give me a quick recap of {activeNote} in two sentences."]},quoteNote:{title:"Note Link Chat",prompts:["Based on [[<note>]], what improvements should we focus on next?","Summarize the key points from [[<note>]].","Summarize the recent updates from [[<note>]].","Roast my writing in [[<note>]] and give concrete actionable feedback"]},fun:{title:"Test LLM",prompts:["9.11 and 9.8, which is bigger?","What's the longest river in the world?","If a lead ball and a feather are dropped simultaneously from the same height, which will reach the ground first?"]},qaVault:{title:"Vault Q&A",prompts:["What insights can I gather about <topic> from my notes?","Explain <concept> based on my stored notes.","Highlight important details on <topic> from my notes.","Based on my notes on <topic>, what is the question that I should be asking, but am not?"]},copilotPlus:{title:"Copilot Plus",prompts:["Give me a recap of last week @vault","What are the key takeaways from my notes on <topic> @vault","Summarize <url> in under 10 bullet points","@youtube <video_url>","@web what are most recent updates in the AI industry","What are the key insights from this paper <arxiv_url>","What new methods are proposed in this paper [[<note_with_embedded_pdf>]]"]}},fBt={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"]};function Jdn(e="llm_chain"){let t=fBt[e]||fBt.llm_chain,r={};return t.map(n=>(r[n]||(r[n]=[...$Ae[n].prompts].sort(()=>Math.random()-.5)),{title:$Ae[n].title,text:r[n].pop()||$Ae[n].prompts[0]}))}var pBt=({onClick:e})=>{let[t]=my(),r=(0,hi.useMemo)(()=>Jdn(t),[t]),o=Uo().indexVaultToVectorStore;return hi.default.createElement("div",{className:"flex flex-col gap-4"},hi.default.createElement($H,{className:"w-full bg-transparent"},hi.default.createElement(qH,{className:"px-2"},hi.default.createElement(BAe,null,"Suggested Prompts")),hi.default.createElement(UH,{className:"p-2 pt-0"},hi.default.createElement("div",{className:"flex flex-col gap-2"},r.map((i,a)=>hi.default.createElement("div",{key:a,className:"flex gap-2 p-2 justify-between text-sm rounded-md border border-border border-solid"},hi.default.createElement("div",{className:"flex flex-col gap-1"},hi.default.createElement("div",{className:"text-muted"},i.title),hi.default.createElement("div",null,i.text)),hi.default.createElement("div",{className:"flex items-start h-full"},hi.default.createElement(Yr,null,hi.default.createElement(Zr,{asChild:!0},hi.default.createElement(qe,{variant:"ghost2",size:"fit",className:"text-muted",onClick:()=>e(i.text)},hi.default.createElement(Qm,{className:"size-4"}))),hi.default.createElement(Vr,null,"Add to Chat")))))))),t==="vault_qa"&&hi.default.createElement("div",{className:"text-sm border border-border border-solid p-2 rounded-md"},"Please note that this is a retrieval-based QA. Questions should contain keywords and concepts that exist literally in your vault"),t==="vault_qa"&&o==="NEVER"&&hi.default.createElement("div",{className:"text-sm border border-border border-solid p-2 rounded-md"},hi.default.createElement("div",null,hi.default.createElement(yh,{className:"size-4"})," Your auto-index strategy is set to ",hi.default.createElement("b",null,"NEVER"),". Before proceeding, click the ",hi.default.createElement("span",{className:"text-accent"},"Refresh Index")," button below or run the"," ",hi.default.createElement("span",{className:"text-accent"},"Copilot command: Index (refresh) vault for QA")," to update the index.")))};var cd=B(Y()),hBt=(0,cd.memo)(({chatHistory:e,currentAiMessage:t,loading:r,loadingMessage:n,app:o,onRegenerate:i,onEdit:a,onDelete:s,onInsertToChat:u,onReplaceChat:l})=>{let[c,d]=(0,cd.useState)(""),f=Uo(),p=()=>{let m=document.querySelector("[data-testid='chat-messages']");m&&(m.scrollTop=m.scrollHeight)};if((0,cd.useEffect)(()=>{r||p()},[r]),(0,cd.useEffect)(()=>{let m;return r?m=setInterval(()=>{d(_=>_.length<6?_+".":"")},200):d(""),()=>clearInterval(m)},[r]),!e.filter(m=>m.isVisible).length&&!t)return cd.default.createElement("div",{className:"flex flex-col gap-2 overflow-y-auto w-full h-full"},f.showRelevantNotes&&cd.default.createElement(Cie,{onInsertToChat:u,defaultOpen:!0,key:"relevant-notes-before-chat"}),f.showSuggestedPrompts&&cd.default.createElement(pBt,{onClick:l}));let h=()=>n?`${n} ${c}`:c;return cd.default.createElement("div",{className:"flex flex-col flex-1 h-full overflow-hidden"},f.showRelevantNotes&&cd.default.createElement(Cie,{className:"mb-4",onInsertToChat:u,defaultOpen:!1,key:"relevant-notes-in-chat"}),cd.default.createElement("div",{"data-testid":"chat-messages",className:"flex flex-col items-start justify-start flex-1 overflow-y-auto w-full break-words text-[calc(var(--font-text-size)_-_2px)] box-border scroll-smooth mt-auto select-text"},e.map((m,_)=>m.isVisible&&cd.default.createElement(oAe,{key:_,message:m,app:o,isStreaming:!1,onRegenerate:()=>i(_),onEdit:g=>a(_,g),onDelete:()=>s(_)})),(t||r)&&cd.default.createElement(oAe,{key:`ai_message_${t}`,message:{sender:"AI",message:t||h(),isVisible:!0,timestamp:null},app:o,isStreaming:!0,onDelete:()=>{}})))});hBt.displayName="ChatMessages";var mBt=hBt;var qAe=async(e,t,r,n,o,i={})=>{let a=new AbortController;o(a);try{await t.runChain(e,a,n,r,i)}catch(s){gt("Model request failed:",s);let u="Model request failed: "+bi(s);r({sender:hy,isErrorMessage:!0,message:`Error: ${u}`,isVisible:!0,timestamp:dl(new Date)})}};var Oie=class e{constructor(){this.mentions=new Map,this.brevilabsClient=ms.getInstance()}static getInstance(){return e.instance||(e.instance=new e),e.instance}extractAllUrls(t){let r=/https?:\/\/[^\s"'<>]+/g;return(t.match(r)||[]).map(n=>n.replace(/,+$/,"")).filter((n,o,i)=>i.indexOf(n)===o)}extractUrls(t){let r=/https?:\/\/[^\s"'<>]+/g;return(t.match(r)||[]).map(n=>n.replace(/,+$/,"")).filter((n,o,i)=>i.indexOf(n)===o).filter(n=>!cBe(n))}async processUrl(t){try{return await this.brevilabsClient.url4llm(t)}catch(r){return console.error(`Error processing URL ${t}:`,r),{response:t,elapsed_time_ms:0}}}async processUrls(t){let r=this.extractUrls(t),n="",o=[];if(r.length===0)return{urlContext:"",imageUrls:[]};let i=r.map(async s=>{if(await qm.isImageUrl(s,app.vault))return o.push(s),null;if(!this.mentions.has(s)){let u=await this.processUrl(s);this.mentions.set(s,{type:"url",original:s,processed:u.response})}return this.mentions.get(s)});return(await Promise.all(i)).forEach(s=>{s?.processed&&(n+=`
Content from ${s.original}:
${s.processed}`)}),{urlContext:n,imageUrls:o}}getMentions(){return this.mentions}clearMentions(){this.mentions.clear()}};var X1=B(Y()),UAe=class{constructor(){this.chatHistory=[]}addMessage(t){this.chatHistory.push(t)}getMessages(){return this.chatHistory}clearChatHistory(){this.chatHistory=[]}};function gBt(e){let[t,r]=(0,X1.useState)(e.getMessages());(0,X1.useEffect)(()=>{r(e.getMessages())},[e]);let n=(0,X1.useCallback)(i=>{e.addMessage(i),r([...e.getMessages()])},[e]),o=(0,X1.useCallback)(()=>{e.clearChatHistory(),r([])},[e]);return[t,n,o]}var yBt=UAe;var nS=require("obsidian"),Nn=B(Y()),bBt=B(Td()),Gdn=({sharedState:e,chainManager:t,onSaveChat:r,updateUserMessageHistory:n,fileParserManager:o,plugin:i})=>{let a=Uo(),s=(0,Nn.useContext)(t$),[u,l,c]=gBt(e),[d]=mj(),[f]=my(),[p,h]=(0,Nn.useState)(""),[m,_]=(0,Nn.useState)(""),[g,v]=(0,Nn.useState)(null),[S,x]=(0,Nn.useState)(!1),[O,T]=(0,Nn.useState)(FS.DEFAULT),[E,M]=(0,Nn.useState)(-1),[A,j]=(0,Nn.useState)([]),[N,F]=(0,Nn.useState)(!1),[k,L]=(0,Nn.useState)([]),q=Oie.getInstance(),U=KB.getInstance(),G=(0,Nn.useRef)(null);(0,Nn.useEffect)(()=>{let ee=()=>{G.current&&G.current.focus()};return s?.addEventListener(kS.CHAT_IS_VISIBLE,ee),()=>{s?.removeEventListener(kS.CHAT_IS_VISIBLE,ee)}},[s]);let V=(0,Nn.useContext)(wie),D=i.app||V,z=async(ee,ge)=>{let Ue=D.workspace.getActiveFile();return await U.processContextNotes(ee,ge,D.vault,A,N,Ue,f)},W=async({toolCalls:ee,urls:ge,contextNotes:Ue}={})=>{if(!m&&k.length===0)return;let ct=dl(new Date),Je=[];m&&Je.push({type:"text",text:m});for(let fr of k){let Xe=await fr.arrayBuffer(),Bn=bBt.Buffer.from(Xe).toString("base64");Je.push({type:"image_url",image_url:{url:`data:${fr.type};base64,${Bn}`}})}let cr=[...Ue||[]],Qr=D.workspace.getActiveFile();N&&Qr&&!cr.some(fr=>fr.path===Qr.path)&&cr.push(Qr);let dr={message:m||"Image message",originalMessage:m,sender:zo,isVisible:!0,timestamp:ct,content:Je,context:{notes:cr,urls:ge||[]}};_(""),L([]),l(dr),x(!0),T(FS.DEFAULT);let Ut=WC.getInstance(D.vault),$o=await Ut.processCustomPrompt(m||"","",D.workspace.getActiveFile()),Xi=f==="copilot_plus"?await q.processUrls(m||""):{urlContext:"",imageUrls:[]},No=await z(Ut,o);$o=$o+Xi.urlContext+No;let Ae=m;ee&&(Ae+=" "+ee.join(`
`));let Ze={message:$o,originalMessage:Ae,sender:zo,isVisible:!1,timestamp:ct,content:Je,context:{notes:cr,urls:f==="copilot_plus"?[...ge||[],...Xi.imageUrls]:ge||[]}};l(Ze),m&&(n(m),M(-1)),await qAe(Ze,t,l,h,v,{debug:a.debug,updateLoadingMessage:T}),x(!1),T(FS.DEFAULT)},J=ee=>{let ge=i.userMessageHistory;return ee==="up"&&E<ge.length-1?(M(E+1),ge[ge.length-1-E-1]):ee==="down"&&E>-1?(M(E-1),E===0?"":ge[ge.length-1-E+1]):m},te=(0,Nn.useCallback)(async(ee=!1)=>{if(!D){console.error("App instance is not available.");return}let ge=u.filter(Je=>Je.isVisible);if(ge.length===0){new nS.Notice("No messages to save.");return}let Ue=ge[0].timestamp?.epoch||Date.now(),ct=ge.map(Je=>`**${Je.sender}**: ${Je.message}
[Timestamp: ${Je.timestamp?.display}]`).join(`
`);try{D.vault.getAbstractFileByPath(a.defaultSaveFolder)||await D.vault.createFolder(a.defaultSaveFolder);let{fileName:cr}=dl(new Date(Ue)),Qr=ge.find(Ze=>Ze.sender===zo),dr=Qr?Qr.message.split(/\s+/).slice(0,10).join(" ").replace(/[\\/:*?"<>|]/g,"").trim():"Untitled Chat",Ut=a.defaultConversationNoteName||"{$date}_{$time}__{$topic}";Ut=Ut.replace("{$topic}",dr.slice(0,100).replace(/\s+/g,"_")).replace("{$date}",cr.split("_")[0]).replace("{$time}",cr.split("_")[1]);let $o=Ut.replace(/[\\/:*?"<>|]/g,"_"),Xi=`${a.defaultSaveFolder}/${$o}.md`,No=`---
epoch: ${Ue}
modelKey: ${d}
tags:
- ${a.defaultConversationTag}
---
${ct}`,Ae=D.vault.getAbstractFileByPath(Xi);if(Ae instanceof nS.TFile?(await D.vault.modify(Ae,No),new nS.Notice(`Chat updated in existing note: ${Xi}`)):(await D.vault.create(Xi,No),new nS.Notice(`Chat saved as new note: ${Xi}`)),ee){let Ze=D.vault.getAbstractFileByPath(Xi);Ze instanceof nS.TFile&&D.workspace.getLeaf().openFile(Ze)}}catch(Je){console.error("Error saving chat as note:",bi(Je)),new nS.Notice("Failed to save chat as note. Check console for details.")}},[D,u,d,a.defaultConversationTag,a.defaultSaveFolder,a.defaultConversationNoteName]),Ie=(0,Nn.useCallback)(ee=>{g&&(a.debug&&console.log(`stopping generation..., reason: ${ee}`),g.abort(ee),x(!1))},[g,a.debug]),Z=(0,Nn.useCallback)(async ee=>{let ge=ee-1;if(ge<0||u[ge].sender!==zo){new nS.Notice("Cannot regenerate the first message or a user message.");return}let Ue=u[ge],ct=u.slice(0,ee);c(),ct.forEach(l),t.memoryManager.clearChatMemory();for(let Je=0;Je<ct.length;Je+=2){let cr=ct[Je],Qr=ct[Je+1];cr&&Qr&&await t.memoryManager.getMemory().saveContext({input:cr.message},{output:Qr.message})}x(!0);try{await t.runChain(Ue,new AbortController,h,l,{debug:a.debug})&&a.debug&&console.log("Message regenerated successfully")}catch(Je){console.error("Error regenerating message:",Je),new nS.Notice("Failed to regenerate message. Please try again.")}finally{x(!1)}},[l,t,u,c,a.debug]),X=(0,Nn.useCallback)(async(ee,ge)=>{let Ue=u[ee].message;if(Ue===ge)return;let ct=[...u];for(let Je=ee;Je<ct.length;Je++)ct[Je].originalMessage===Ue&&(ct[Je].message=ge,ct[Je].originalMessage=ge,ct[Je].context={notes:[],urls:[]});c(),ct.forEach(l),await nH(ct,t.memoryManager),ct[ee].sender===zo&&ee<ct.length-1&&Z(ee+1)},[l,t.memoryManager,u,c,Z]),ne=(ee,ge)=>()=>{let Ue=pe().debug,ct=async Je=>{let Qr={message:await ge(Je.detail.selectedText,Je.detail.eventSubtype),sender:zo,isVisible:Ue,timestamp:dl(new Date)};Ue&&l(Qr),x(!0),await qAe(Qr,t,l,h,v,{debug:Ue,ignoreSystemMessage:!0}),x(!1)};return s?.addEventListener(ee,ct),()=>{s?.removeEventListener(ee,ct)}},Pe=WC.getInstance(D.vault);(0,Nn.useEffect)(ne(nr.APPLY_CUSTOM_PROMPT,async(ee,ge)=>ge?await Pe.processCustomPrompt(ge,ee,D.workspace.getActiveFile()??void 0):ee),[]),(0,Nn.useEffect)(ne(nr.APPLY_ADHOC_PROMPT,async(ee,ge)=>ge?await Pe.processCustomPrompt(ge,ee,D.workspace.getActiveFile()):ee),[]),(0,Nn.useEffect)(()=>{r&&r(te)},[r,te]);let ht=(0,Nn.useCallback)(async ee=>{let ge=[...u];ge.splice(ee,1),c(),ge.forEach(l),await nH(ge,t.memoryManager)},[l,t.memoryManager,u,c]),we=(0,Nn.useCallback)(ee=>{_(ge=>`${ge} ${ee} `)},[]),ae=(0,Nn.useCallback)(async()=>{Ie("new-chat"),a.autosaveChat&&u.length>0&&await te(!0),c(),t.memoryManager.clearChatMemory(),h(""),j([]),F(!1)},[Ie,a.autosaveChat,u.length,c,t.memoryManager,te]);return Nn.default.createElement("div",{className:"chat-container"},Nn.default.createElement(mBt,{chatHistory:u,currentAiMessage:p,loading:S,loadingMessage:O,app:D,onRegenerate:Z,onEdit:X,onDelete:ht,onInsertToChat:we,onReplaceChat:_}),Nn.default.createElement("div",{className:"bottom-container"},Nn.default.createElement(rFt,{onNewChat:ae,onSaveAsNote:()=>te(!0)}),Nn.default.createElement(VFt,{ref:G,inputMessage:m,setInputMessage:_,handleSendMessage:W,isGenerating:S,onStopGenerating:()=>Ie("user-stopped"),app:D,navigateHistory:J,contextNotes:A,setContextNotes:j,includeActiveNote:N,setIncludeActiveNote:F,mention:q,selectedImages:k,onAddImage:ee=>L(ge=>[...ge,...ee]),setSelectedImages:L})))},_Bt=Gdn;var vBt=require("obsidian"),tM=B(Y()),wBt=B(gh()),rM=class extends vBt.ItemView{constructor(r,n){super(r);this.plugin=n;this.root=null;this.handleSaveAsNote=null;this.sharedState=n.sharedState,this.app=n.app,this.chainManager=n.chainManager,this.fileParserManager=n.fileParserManager,this.eventTarget=new EventTarget,this.plugin=n}getViewType(){return fl}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){let r=(0,wBt.createRoot)(this.containerEl.children[1]),n=i=>{this.handleSaveAsNote=i},o=i=>{this.plugin.updateUserMessageHistory(i)};r.render(tM.createElement(wie.Provider,{value:this.app},tM.createElement(t$.Provider,{value:this.eventTarget},tM.createElement(tM.StrictMode,null,tM.createElement(sie,{delayDuration:0},tM.createElement(_Bt,{sharedState:this.sharedState,chainManager:this.chainManager,updateUserMessageHistory:o,fileParserManager:this.fileParserManager,plugin:this.plugin,onSaveChat:n}))))))}async saveChat(){this.handleSaveAsNote&&await this.handleSaveAsNote()}async onClose(){this.root&&this.root.unmount()}updateView(){this.onOpen()}};var SBt=require("obsidian"),Eie=class extends SBt.FuzzySuggestModal{constructor(r,n,o){super(r);this.chatFiles=n;this.onChooseFile=o}getItems(){return this.chatFiles.sort((r,n)=>{let o=s=>{let u=this.app.metadataCache.getFileCache(s)?.frontmatter;return u&&u.epoch?u.epoch:s.stat.ctime},i=o(r);return o(n)-i})}getItemText(r){let n=r.basename.replace(/\{\$date}|\d{8}/g,"").replace(/\{\$time}|\d{6}/g,"").replace(/[@_]/g," ").replace(/\s+/g," ").trim(),o,i=this.app.metadataCache.getFileCache(r)?.frontmatter;return i&&i.epoch?o=dl(new Date(i.epoch)):o=dl(new Date(r.stat.ctime)),`${n} - ${o.display}`}onChooseItem(r,n){this.onChooseFile(r)}};function xBt(e,t,r){D1().filter(o=>o.showInContextMenu).forEach(o=>{e.addItem(i=>{i.setTitle(`Copilot: ${o.name}`).onClick(async a=>{r.app.commands.executeCommandById(`copilot:${MB(o.name)}`)})})})}var h6=require("obsidian"),f1e=B(Y()),Bzt=B(gh());var CBt=require("obsidian"),Q1=B(Y()),OBt=B(gh());function Kdn({content:e,onConfirm:t,onCancel:r}){return Q1.default.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"20px"}},Q1.default.createElement("div",null,e),Q1.default.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"}},Q1.default.createElement("button",{onClick:r},"Cancel"),Q1.default.createElement("button",{style:{backgroundColor:"var(--interactive-accent)",color:"var(--text-on-accent)",cursor:"pointer"},onClick:t},"Continue")))}var n$=class extends CBt.Modal{constructor(r,n,o,i){super(r);this.onConfirm=n;this.content=o;this.setTitle(i)}onOpen(){let{contentEl:r}=this;this.root=(0,OBt.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(Q1.default.createElement(Kdn,{content:this.content,onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var Pie=class extends n${constructor(t,r){super(t,r,"Resetting settings will clear all settings and restore the default values. You will lose any custom settings you have made including the API keys. Are you sure you want to continue?","Reset Settings")}};var zH=B(Y());var EBt=({tab:e,isSelected:t,onClick:r,isFirst:n,isLast:o})=>zH.default.createElement("div",{role:"tab",id:`tab-${e.id}`,"aria-controls":`tabpanel-${e.id}`,"aria-selected":t,onClick:r,className:_e("flex flex-row items-center","h-8","px-2 py-1","gap-1.5","cursor-pointer","overflow-hidden","whitespace-nowrap","text-sm","border border-border border-solid","rounded-t-md rounded-b-[2px]","bg-primary","transition-all duration-300 ease-in-out","hover:border-interactive-accent hover:border-b-0",t&&["!bg-interactive-accent","text-on-accent","!px-3","!max-w-full","border-b-0","transition-all duration-300 ease-in-out","delay-200"],"lg:max-w-32","md:max-w-32")},zH.default.createElement("div",{className:_e("flex items-center justify-center","w-4 h-4","transition-transform duration-200 ease-in-out",t?"opacity-100 max-w-[16px] translate-x-0":"opacity-0 max-w-0 -translate-x-4")},e.icon),zH.default.createElement("span",{className:_e("text-sm","font-medium","transition-all duration-200 ease-in-out","overflow-hidden whitespace-nowrap","opacity-100 max-w-[100px] translate-x-0")},e.label)),PBt=({id:e,children:t,isSelected:r})=>r?zH.default.createElement("div",{role:"tabpanel",id:`tabpanel-${e}`,"aria-labelledby":`tab-${e}`,className:_e("pt-4","transition-all duration-200 ease-in-out",r?"opacity-100 translate-y-0":"opacity-0 translate-y-2")},t):null;var qp=B(Y()),TBt=(0,qp.createContext)(void 0),MBt=({children:e})=>{let[t,r]=(0,qp.useState)("basic"),[n,o]=(0,qp.useState)(null),i=(0,qp.useRef)(!1);return(0,qp.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),qp.default.createElement(TBt.Provider,{value:{selectedTab:t,setSelectedTab:r,modalContainer:n}},e)},oS=()=>{let e=(0,qp.useContext)(TBt);if(e===void 0)throw new Error("useTab must be used within a TabProvider");return e};var sr=B(Y());var JBt=require("obsidian");var Tie=B(Y());var jBt=B(Y(),1);var IBt=B(Y(),1),ABt=B(ss(),1);var RBt=B(lt(),1),Ydn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ln=Ydn.reduce((e,t)=>{let r=IBt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Sy:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,RBt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function DBt(e,t){e&&ABt.flushSync(()=>e.dispatchEvent(t))}var NBt=B(lt(),1),Zdn="Label",LBt=jBt.forwardRef((e,t)=>(0,NBt.jsx)(Ln.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));LBt.displayName=Zdn;var zAe=LBt;var Qdn=Jj("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Gf=Tie.forwardRef(({className:e,...t},r)=>Tie.createElement(zAe,{ref:r,className:_e(Qdn(),e),...t}));Gf.displayName=zAe.displayName;var a$=B(Y());var Up=B(Y(),1);var kBt=B(Y(),1);function FBt(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function HAe(...e){return t=>{let r=!1,n=e.map(o=>{let i=FBt(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():FBt(e[o],null)}}}}function BBt(...e){return kBt.useCallback(HAe(...e),e)}function VAe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}var Mie=B(Y(),1);function o$(e){let t=Mie.useRef({value:e,previous:e});return Mie.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var $Bt=B(Y(),1),ofn=B(ss(),1);var Cc=B(Y(),1);var i$=B(lt(),1),JAe=Cc.forwardRef((e,t)=>{let{children:r,...n}=e,o=Cc.Children.toArray(r),i=o.find(tfn);if(i){let a=i.props.children,s=o.map(u=>u===i?Cc.Children.count(a)>1?Cc.Children.only(null):Cc.isValidElement(a)?a.props.children:null:u);return(0,i$.jsx)(WAe,{...n,ref:t,children:Cc.isValidElement(a)?Cc.cloneElement(a,void 0,s):null})}return(0,i$.jsx)(WAe,{...n,ref:t,children:r})});JAe.displayName="Slot";var WAe=Cc.forwardRef((e,t)=>{let{children:r,...n}=e;if(Cc.isValidElement(r)){let o=nfn(r);return Cc.cloneElement(r,{...rfn(n,r.props),ref:t?HAe(t,o):o})}return Cc.Children.count(r)>1?Cc.Children.only(null):null});WAe.displayName="SlotClone";var efn=({children:e})=>(0,i$.jsx)(i$.Fragment,{children:e});function tfn(e){return Cc.isValidElement(e)&&e.type===efn}function rfn(e,t){let r={...t};for(let n in t){let o=e[n],i=t[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{...e,...r}}function nfn(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var qBt=B(lt(),1),ifn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],GAe=ifn.reduce((e,t)=>{let r=$Bt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?JAe:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,qBt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});var oM=B(lt(),1),KAe="Checkbox",[afn,u5o]=Ro(KAe),[sfn,ufn]=afn(KAe),UBt=Up.forwardRef((e,t)=>{let{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:a,disabled:s,value:u="on",onCheckedChange:l,form:c,...d}=e,[f,p]=Up.useState(null),h=BBt(t,x=>p(x)),m=Up.useRef(!1),_=f?c||!!f.closest("form"):!0,[g=!1,v]=tl({prop:o,defaultProp:i,onChange:l}),S=Up.useRef(g);return Up.useEffect(()=>{let x=f?.form;if(x){let O=()=>v(S.current);return x.addEventListener("reset",O),()=>x.removeEventListener("reset",O)}},[f,v]),(0,oM.jsxs)(sfn,{scope:r,state:g,disabled:s,children:[(0,oM.jsx)(GAe.button,{type:"button",role:"checkbox","aria-checked":nM(g)?"mixed":g,"aria-required":a,"data-state":VBt(g),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:h,onKeyDown:VAe(e.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:VAe(e.onClick,x=>{v(O=>nM(O)?!0:!O),_&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})}),_&&(0,oM.jsx)(lfn,{control:f,bubbles:!m.current,name:n,value:u,checked:g,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:nM(i)?!1:i})]})});UBt.displayName=KAe;var zBt="CheckboxIndicator",HBt=Up.forwardRef((e,t)=>{let{__scopeCheckbox:r,forceMount:n,...o}=e,i=ufn(zBt,r);return(0,oM.jsx)(Ru,{present:n||nM(i.state)||i.state===!0,children:(0,oM.jsx)(GAe.span,{"data-state":VBt(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});HBt.displayName=zBt;var lfn=e=>{let{control:t,checked:r,bubbles:n=!0,defaultChecked:o,...i}=e,a=Up.useRef(null),s=o$(r),u=_m(t);Up.useEffect(()=>{let c=a.current,d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(s!==r&&p){let h=new Event("click",{bubbles:n});c.indeterminate=nM(r),p.call(c,nM(r)?!1:r),c.dispatchEvent(h)}},[s,r,n]);let l=Up.useRef(nM(r)?!1:r);return(0,oM.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??l.current,...i,tabIndex:-1,ref:a,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function nM(e){return e==="indeterminate"}function VBt(e){return nM(e)?"indeterminate":e?"checked":"unchecked"}var YAe=UBt,WBt=HBt;var Jd=a$.forwardRef(({className:e,...t},r)=>a$.createElement(YAe,{ref:r,className:_e("p-0 border-solid !bg-transparent !shadow transition-colors","hover:!bg-interactive-accent hover:!text-on-accent data-[state=checked]:!bg-interactive-accent data-[state=checked]:!text-on-accent","peer h-4 w-4 shrink-0 rounded-sm border border-interactive-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-interactive-accent data-[state=checked]:text-on-accent",e),...t},a$.createElement(WBt,{className:_e("flex items-center justify-center text-current")},a$.createElement(Xm,{className:"h-4 w-4"}))));Jd.displayName=YAe.displayName;var jo=B(Y()),GBt=B(gh());function dfn({command:e,onConfirm:t,onCancel:r,onRemove:n}){let i=Uo().activeModels.filter(f=>f.enabled).map(f=>({label:voe(f),value:Nr(f)})),[a,s]=(0,jo.useState)(e),[u,l]=(0,jo.useState)({}),c=(f,p)=>{s(h=>({...h,[f]:p})),l(h=>({...h,[f]:void 0}))},d=()=>{let f={};try{V1t(a.name,e.name)}catch(p){f.name=p.message}if(a.prompt.trim()||(f.prompt="Prompt is required"),Object.keys(f).length>0){l(f);return}t(a)};return jo.default.createElement("div",{className:"flex flex-col gap-4 p-4"},jo.default.createElement("div",{className:"flex flex-col gap-2"},jo.default.createElement(Gf,{htmlFor:"name"},"Name"),jo.default.createElement(ri,{id:"name",value:a.name,onChange:f=>c("name",f.target.value),placeholder:"Enter command name"}),u.name&&jo.default.createElement("div",{className:"text-error text-sm"},u.name)),jo.default.createElement("div",{className:"flex flex-col gap-2"},jo.default.createElement(Gf,{htmlFor:"prompt"},"Prompt"),jo.default.createElement("div",{className:"text-sm text-muted mb-2"},"Use ",jo.default.createElement("code",null,"{copilot-selection}")," as a placeholder for the selected text. If not included, the selected text will be appended to the prompt."),jo.default.createElement(R1,{id:"prompt",value:a.prompt,onChange:f=>c("prompt",f.target.value),placeholder:"Enter command prompt",className:"min-h-[200px]"}),u.prompt&&jo.default.createElement("div",{className:"text-error text-sm"},u.prompt)),jo.default.createElement("div",{className:"flex flex-col gap-2"},jo.default.createElement(Gf,{htmlFor:"modelKey"},"Model (Optional)"),jo.default.createElement("div",{className:"relative w-full group"},jo.default.createElement("select",{value:a.modelKey,onChange:f=>{let p=f.target.value;if(!p){c("modelKey","");return}if(!i.find(m=>m.value===p)){gt(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:_e("w-full appearance-none","flex h-9 rounded-md border border-solid border-border bg-dropdown px-3 py-1 pr-8","text-sm !shadow transition-colors","focus:outline-none focus:ring-1 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-interactive-hover hover:text-normal")},jo.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>jo.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),jo.default.createElement("div",{className:_e("pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2","transition-colors group-hover:[&>svg]:text-normal")},jo.default.createElement(us,{className:"h-4 w-4"})))),jo.default.createElement("div",{className:"flex items-center gap-2"},jo.default.createElement(Jd,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),jo.default.createElement(Gf,{htmlFor:"showInContextMenu"},"Show in context menu")),jo.default.createElement("div",{className:"flex justify-end gap-2"},jo.default.createElement(qe,{variant:"secondary",onClick:r},"Cancel"),jo.default.createElement(qe,{variant:"default",onClick:d},"Save")))}var s$=class extends JBt.Modal{constructor(r,n,o,i){super(r);this.command=n;this.onUpdate=o;this.onRemove=i;this.setTitle("Edit Command")}onOpen(){let{contentEl:r}=this;this.root=(0,GBt.createRoot)(r);let n=i=>{this.onUpdate(i),this.close()},o=()=>{this.onRemove?.(),this.close()};this.root.render(jo.default.createElement(dfn,{command:this.command,onConfirm:n,onCancel:()=>this.close(),onRemove:this.onRemove?o:void 0}))}onClose(){this.root.unmount()}};var nl=B(Y());var HH=nl.forwardRef(({className:e,...t},r)=>nl.createElement("div",{className:"relative w-full overflow-auto"},nl.createElement("table",{ref:r,className:_e("w-full caption-bottom text-sm border-collapse",e),...t})));HH.displayName="Table";var VH=nl.forwardRef(({className:e,...t},r)=>nl.createElement("thead",{ref:r,className:_e("[&_tr]:border-b",e),...t}));VH.displayName="TableHeader";var WH=nl.forwardRef(({className:e,...t},r)=>nl.createElement("tbody",{ref:r,className:_e("[&_tr:last-child]:border-0",e),...t}));WH.displayName="TableBody";var ffn=nl.forwardRef(({className:e,...t},r)=>nl.createElement("tfoot",{ref:r,className:_e("border-t bg-primary-alt/50 font-medium [&>tr]:last:border-b-0",e),...t}));ffn.displayName="TableFooter";var eD=nl.forwardRef(({className:e,...t},r)=>nl.createElement("tr",{ref:r,className:_e("border-b transition-colors hover:bg-primary-alt/50 data-[state=selected]:bg-primary-alt",e),...t}));eD.displayName="TableRow";var Kf=nl.forwardRef(({className:e,...t},r)=>nl.createElement("th",{ref:r,className:_e("h-10 px-2 text-left align-middle font-medium text-muted [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Kf.displayName="TableHead";var Yf=nl.forwardRef(({className:e,...t},r)=>nl.createElement("td",{ref:r,className:_e("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Yf.displayName="TableCell";var pfn=nl.forwardRef(({className:e,...t},r)=>nl.createElement("caption",{ref:r,className:_e("mt-4 text-sm text-muted",e),...t}));pfn.displayName="TableCaption";var ye=B(Y()),sD=B(ss());var es=B(Y());function YBt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,es.useMemo)(()=>n=>{t.forEach(o=>o(n))},t)}var JH=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function tD(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Iie(e){return"nodeType"in e}function Gd(e){var t,r;return e?tD(e)?e:Iie(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Aie(e){let{Document:t}=Gd(e);return e instanceof t}function u$(e){return tD(e)?!1:e instanceof Gd(e).HTMLElement}function XAe(e){return e instanceof Gd(e).SVGElement}function rD(e){return e?tD(e)?e.document:Iie(e)?Aie(e)?e:u$(e)||XAe(e)?e.ownerDocument:document:document:document}var xm=JH?es.useLayoutEffect:es.useEffect;function Rie(e){let t=(0,es.useRef)(e);return xm(()=>{t.current=e}),(0,es.useCallback)(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function ZBt(){let e=(0,es.useRef)(null),t=(0,es.useCallback)((n,o)=>{e.current=setInterval(n,o)},[]),r=(0,es.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function l$(e,t){t===void 0&&(t=[e]);let r=(0,es.useRef)(e);return xm(()=>{r.current!==e&&(r.current=e)},t),r}function c$(e,t){let r=(0,es.useRef)();return(0,es.useMemo)(()=>{let n=e(r.current);return r.current=n,n},[...t])}function GH(e){let t=Rie(e),r=(0,es.useRef)(null),n=(0,es.useCallback)(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function Die(e){let t=(0,es.useRef)();return(0,es.useEffect)(()=>{t.current=e},[e]),t.current}var ZAe={};function nD(e,t){return(0,es.useMemo)(()=>{if(t)return t;let r=ZAe[e]==null?0:ZAe[e]+1;return ZAe[e]=r,e+"-"+r},[e,t])}function XBt(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((i,a)=>{let s=Object.entries(a);for(let[u,l]of s){let c=i[u];c!=null&&(i[u]=c+e*l)}return i},{...t})}}var oD=XBt(1),iD=XBt(-1);function hfn(e){return"clientX"in e&&"clientY"in e}function KH(e){if(!e)return!1;let{KeyboardEvent:t}=Gd(e.target);return t&&e instanceof t}function mfn(e){if(!e)return!1;let{TouchEvent:t}=Gd(e.target);return t&&e instanceof t}function jie(e){if(mfn(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return hfn(e)?{x:e.clientX,y:e.clientY}:null}var Yg=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Yg.Translate.toString(e),Yg.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),KBt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function QBt(e){return e.matches(KBt)?e:e.querySelector(KBt)}var aD=B(Y()),gfn={display:"none"};function e$t(e){let{id:t,value:r}=e;return aD.default.createElement("div",{id:t,style:gfn},r)}function t$t(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e,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 aD.default.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function r$t(){let[e,t]=(0,aD.useState)("");return{announce:(0,aD.useCallback)(n=>{n!=null&&t(n)},[]),announcement:e}}var m$t=(0,ye.createContext)(null);function yfn(e){let t=(0,ye.useContext)(m$t);(0,ye.useEffect)(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function bfn(){let[e]=(0,ye.useState)(()=>new Set),t=(0,ye.useCallback)(n=>(e.add(n),()=>e.delete(n)),[e]);return[(0,ye.useCallback)(n=>{let{type:o,event:i}=n;e.forEach(a=>{var s;return(s=a[o])==null?void 0:s.call(a,i)})},[e]),t]}var _fn={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.
`},vfn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function wfn(e){let{announcements:t=vfn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=_fn}=e,{announce:i,announcement:a}=r$t(),s=nD("DndLiveRegion"),[u,l]=(0,ye.useState)(!1);if((0,ye.useEffect)(()=>{l(!0)},[]),yfn((0,ye.useMemo)(()=>({onDragStart(d){let{active:f}=d;i(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:p}=d;t.onDragMove&&i(t.onDragMove({active:f,over:p}))},onDragOver(d){let{active:f,over:p}=d;i(t.onDragOver({active:f,over:p}))},onDragEnd(d){let{active:f,over:p}=d;i(t.onDragEnd({active:f,over:p}))},onDragCancel(d){let{active:f,over:p}=d;i(t.onDragCancel({active:f,over:p}))}}),[i,t])),!u)return null;let c=ye.default.createElement(ye.default.Fragment,null,ye.default.createElement(e$t,{id:n,value:o.draggable}),ye.default.createElement(t$t,{id:s,announcement:a}));return r?(0,sD.createPortal)(c,r):c}var ol;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(ol||(ol={}));function Lie(){}function d$(e,t){return(0,ye.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function kie(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,ye.useMemo)(()=>[...t].filter(n=>n!=null),[...t])}var Zg=Object.freeze({x:0,y:0});function g$t(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function y$t(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Sfn(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function n$t(e){let{left:t,top:r,height:n,width:o}=e;return[{x:t,y:r},{x:t+o,y:r},{x:t,y:r+n},{x:t+o,y:r+n}]}function sRe(e,t){if(!e||e.length===0)return null;let[r]=e;return t?r[t]:r}function o$t(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}var e6=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,o=o$t(t,t.left,t.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=g$t(o$t(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(y$t)},b$t=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,o=n$t(t),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=n$t(u),c=o.reduce((f,p,h)=>f+g$t(l[h],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(y$t)};function xfn(e,t){let r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-n,s=i-r;if(n<o&&r<i){let u=t.width*t.height,l=e.width*e.height,c=a*s,d=c/(u+l-c);return Number(d.toFixed(4))}return 0}var Cfn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,o=[];for(let i of n){let{id:a}=i,s=r.get(a);if(s){let u=xfn(s,t);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(Sfn)};function Ofn(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function _$t(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Zg}function Efn(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return o.reduce((a,s)=>({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...r})}}var Pfn=Efn(1);function Tfn(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Mfn(e,t,r){let n=Tfn(t);if(!n)return e;let{scaleX:o,scaleY:i,x:a,y:s}=n,u=e.left-a-(1-o)*parseFloat(r),l=e.top-s-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),c=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:c,height:d,top:l,right:u+c,bottom:l+d,left:u}}var Ifn={ignoreTransform:!1};function cD(e,t){t===void 0&&(t=Ifn);let r=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:l,transformOrigin:c}=Gd(e).getComputedStyle(e);l&&(r=Mfn(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 i$t(e){return cD(e,{ignoreTransform:!0})}function Afn(e){let t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Rfn(e,t){return t===void 0&&(t=Gd(e).getComputedStyle(e)),t.position==="fixed"}function Dfn(e,t){t===void 0&&(t=Gd(e).getComputedStyle(e));let r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{let i=t[o];return typeof i=="string"?r.test(i):!1})}function t6(e,t){let r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(Aie(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!u$(o)||XAe(o)||r.includes(o))return r;let i=Gd(e).getComputedStyle(o);return o!==e&&Dfn(o,i)&&r.push(o),Rfn(o,i)?r:n(o.parentNode)}return e?n(e):r}function v$t(e){let[t]=t6(e,1);return t??null}function QAe(e){return!JH||!e?null:tD(e)?e:Iie(e)?Aie(e)||e===rD(e).scrollingElement?window:u$(e)?e:null:null}function w$t(e){return tD(e)?e.scrollX:e.scrollLeft}function S$t(e){return tD(e)?e.scrollY:e.scrollTop}function rRe(e){return{x:w$t(e),y:S$t(e)}}var Nl;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Nl||(Nl={}));function x$t(e){return!JH||!e?!1:e===document.scrollingElement}function C$t(e){let t={x:0,y:0},r=x$t(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=n.y,s=e.scrollLeft>=n.x;return{isTop:o,isLeft:i,isBottom:a,isRight:s,maxScroll:n,minScroll:t}}var jfn={x:.2,y:.2};function Nfn(e,t,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=jfn);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=C$t(e),p={x:0,y:0},h={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!l&&i<=t.top+m.height?(p.y=Nl.Backward,h.y=n*Math.abs((t.top+m.height-i)/m.height)):!c&&u>=t.bottom-m.height&&(p.y=Nl.Forward,h.y=n*Math.abs((t.bottom-m.height-u)/m.height)),!f&&s>=t.right-m.width?(p.x=Nl.Forward,h.x=n*Math.abs((t.right-m.width-s)/m.width)):!d&&a<=t.left+m.width&&(p.x=Nl.Backward,h.x=n*Math.abs((t.left+m.width-a)/m.width)),{direction:p,speed:h}}function Lfn(e){if(e===document.scrollingElement){let{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}let{top:t,left:r,right:n,bottom:o}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:o,width:e.clientWidth,height:e.clientHeight}}function O$t(e){return e.reduce((t,r)=>oD(t,rRe(r)),Zg)}function Ffn(e){return e.reduce((t,r)=>t+w$t(r),0)}function kfn(e){return e.reduce((t,r)=>t+S$t(r),0)}function Bfn(e,t){if(t===void 0&&(t=cD),!e)return;let{top:r,left:n,bottom:o,right:i}=t(e);v$t(e)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var $fn=[["x",["left","right"],Ffn],["y",["top","bottom"],kfn]],ZH=class{constructor(t,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=t6(r),o=O$t(n);this.rect={...t},this.width=t.width,this.height=t.height;for(let[i,a,s]of $fn)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})}},uD=class{constructor(t){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=t}add(t,r,n){var o;(o=this.target)==null||o.addEventListener(t,r,n),this.listeners.push([t,r,n])}};function qfn(e){let{EventTarget:t}=Gd(e);return e instanceof t?e:rD(e)}function eRe(e,t){let r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Cm;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Cm||(Cm={}));function a$t(e){e.preventDefault()}function Ufn(e){e.stopPropagation()}var hn;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(hn||(hn={}));var E$t={start:[hn.Space,hn.Enter],cancel:[hn.Esc],end:[hn.Space,hn.Enter,hn.Tab]},zfn=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case hn.Right:return{...r,x:r.x+25};case hn.Left:return{...r,x:r.x-25};case hn.Down:return{...r,y:r.y+25};case hn.Up:return{...r,y:r.y-25}}},aM=class{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;let{event:{target:r}}=t;this.props=t,this.listeners=new uD(rD(r)),this.windowListeners=new uD(Gd(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Cm.Resize,this.handleCancel),this.windowListeners.add(Cm.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Cm.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Bfn(n),r(Zg)}handleKeyDown(t){if(KH(t)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=E$t,coordinateGetter:a=zfn,scrollBehavior:s="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}let{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:Zg;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(t,{active:r,context:n.current,currentCoordinates:c});if(d){let f=iD(d,c),p={x:0,y:0},{scrollableAncestors:h}=n.current;for(let m of h){let _=t.code,{isTop:g,isRight:v,isLeft:S,isBottom:x,maxScroll:O,minScroll:T}=C$t(m),E=Lfn(m),M={x:Math.min(_===hn.Right?E.right-E.width/2:E.right,Math.max(_===hn.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(_===hn.Down?E.bottom-E.height/2:E.bottom,Math.max(_===hn.Down?E.top:E.top+E.height/2,d.y))},A=_===hn.Right&&!v||_===hn.Left&&!S,j=_===hn.Down&&!x||_===hn.Up&&!g;if(A&&M.x!==d.x){let N=m.scrollLeft+f.x,F=_===hn.Right&&N<=O.x||_===hn.Left&&N>=T.x;if(F&&!f.y){m.scrollTo({left:N,behavior:s});return}F?p.x=m.scrollLeft-N:p.x=_===hn.Right?m.scrollLeft-O.x:m.scrollLeft-T.x,p.x&&m.scrollBy({left:-p.x,behavior:s});break}else if(j&&M.y!==d.y){let N=m.scrollTop+f.y,F=_===hn.Down&&N<=O.y||_===hn.Up&&N>=T.y;if(F&&!f.x){m.scrollTo({top:N,behavior:s});return}F?p.y=m.scrollTop-N:p.y=_===hn.Down?m.scrollTop-O.y:m.scrollTop-T.y,p.y&&m.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(t,oD(iD(d,this.referenceCoordinates),p))}}}handleMove(t,r){let{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){let{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){let{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};aM.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=E$t,onActivation:o}=t,{active:i}=r,{code:a}=e.nativeEvent;if(n.start.includes(a)){let s=i.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function s$t(e){return!!(e&&"distance"in e)}function u$t(e){return!!(e&&"delay"in e)}var XH=class{constructor(t,r,n){var o;n===void 0&&(n=qfn(t.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=t,this.events=r;let{event:i}=t,{target:a}=i;this.props=t,this.events=r,this.document=rD(a),this.documentListeners=new uD(this.document),this.listeners=new uD(n),this.windowListeners=new uD(Gd(a)),this.initialCoordinates=(o=jie(i))!=null?o:Zg,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:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Cm.Resize,this.handleCancel),this.windowListeners.add(Cm.DragStart,a$t),this.windowListeners.add(Cm.VisibilityChange,this.handleCancel),this.windowListeners.add(Cm.ContextMenu,a$t),this.documentListeners.add(Cm.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(u$t(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(s$t(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(t,r){let{active:n,onPending:o}=this.props;o(n,t,this.initialCoordinates,r)}handleStart(){let{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Cm.Click,Ufn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Cm.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;let{activated:n,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!o)return;let u=(r=jie(t))!=null?r:Zg,l=iD(o,u);if(!n&&s){if(s$t(s)){if(s.tolerance!=null&&eRe(l,s.tolerance))return this.handleCancel();if(eRe(l,s.distance))return this.handleStart()}if(u$t(s)&&eRe(l,s.tolerance))return this.handleCancel();this.handlePending(s,l);return}t.cancelable&&t.preventDefault(),a(u)}handleEnd(){let{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){let{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===hn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},Hfn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},sM=class extends XH{constructor(t){let{event:r}=t,n=rD(r.target);super(t,Hfn,n)}};sM.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];var Vfn={move:{name:"mousemove"},end:{name:"mouseup"}},nRe;(function(e){e[e.RightClick=2]="RightClick"})(nRe||(nRe={}));var oRe=class extends XH{constructor(t){super(t,Vfn,rD(t.event.target))}};oRe.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===nRe.RightClick?!1:(n?.({event:r}),!0)}}];var tRe={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},iRe=class extends XH{constructor(t){super(t,tRe)}static setup(){return window.addEventListener(tRe.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(tRe.move.name,t)};function t(){}}};iRe.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t,{touches:o}=r;return o.length>1?!1:(n?.({event:r}),!0)}}];var YH;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(YH||(YH={}));var Fie;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Fie||(Fie={}));function Wfn(e){let{acceleration:t,activator:r=YH.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=Fie.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=e,p=Gfn({delta:d,disabled:!i}),[h,m]=ZBt(),_=(0,ye.useRef)({x:0,y:0}),g=(0,ye.useRef)({x:0,y:0}),v=(0,ye.useMemo)(()=>{switch(r){case YH.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case YH.DraggableRect:return o}},[r,o,u]),S=(0,ye.useRef)(null),x=(0,ye.useCallback)(()=>{let T=S.current;if(!T)return;let E=_.current.x*g.current.x,M=_.current.y*g.current.y;T.scrollBy(E,M)},[]),O=(0,ye.useMemo)(()=>s===Fie.TreeOrder?[...l].reverse():l,[s,l]);(0,ye.useEffect)(()=>{if(!i||!l.length||!v){m();return}for(let T of O){if(n?.(T)===!1)continue;let E=l.indexOf(T),M=c[E];if(!M)continue;let{direction:A,speed:j}=Nfn(T,M,v,t,f);for(let N of["x","y"])p[N][A[N]]||(j[N]=0,A[N]=0);if(j.x>0||j.y>0){m(),S.current=T,h(x,a),_.current=j,g.current=A;return}}_.current={x:0,y:0},g.current={x:0,y:0},m()},[t,x,n,m,i,a,JSON.stringify(v),JSON.stringify(p),h,l,O,c,JSON.stringify(f)])}var Jfn={x:{[Nl.Backward]:!1,[Nl.Forward]:!1},y:{[Nl.Backward]:!1,[Nl.Forward]:!1}};function Gfn(e){let{delta:t,disabled:r}=e,n=Die(t);return c$(o=>{if(r||!n||!o)return Jfn;let i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Nl.Backward]:o.x[Nl.Backward]||i.x===-1,[Nl.Forward]:o.x[Nl.Forward]||i.x===1},y:{[Nl.Backward]:o.y[Nl.Backward]||i.y===-1,[Nl.Forward]:o.y[Nl.Forward]||i.y===1}}},[r,t,n])}function Kfn(e,t){let r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return c$(o=>{var i;return t==null?null:(i=n??o)!=null?i:null},[n,t])}function Yfn(e,t){return(0,ye.useMemo)(()=>e.reduce((r,n)=>{let{sensor:o}=n,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,n)}));return[...r,...i]},[]),[e,t])}var QH;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(QH||(QH={}));var aRe;(function(e){e.Optimized="optimized"})(aRe||(aRe={}));var l$t=new Map;function Zfn(e,t){let{dragging:r,dependencies:n,config:o}=t,[i,a]=(0,ye.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,ye.useRef)(e),d=_(),f=l$(d),p=(0,ye.useCallback)(function(g){g===void 0&&(g=[]),!f.current&&a(v=>v===null?g:v.concat(g.filter(S=>!v.includes(S))))},[f]),h=(0,ye.useRef)(null),m=c$(g=>{if(d&&!r)return l$t;if(!g||g===l$t||c.current!==e||i!=null){let v=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){v.set(S.id,S.rect.current);continue}let x=S.node.current,O=x?new ZH(u(x),x):null;S.rect.current=O,O&&v.set(S.id,O)}return v}return g},[e,i,r,d,u]);return(0,ye.useEffect)(()=>{c.current=e},[e]),(0,ye.useEffect)(()=>{d||p()},[r,d]),(0,ye.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,ye.useEffect)(()=>{d||typeof s!="number"||h.current!==null||(h.current=setTimeout(()=>{p(),h.current=null},s))},[s,d,p,...n]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:i!=null};function _(){switch(l){case QH.Always:return!1;case QH.BeforeDragging:return r;default:return!r}}}function P$t(e,t){return c$(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function Xfn(e,t){return P$t(e,t)}function Qfn(e){let{callback:t,disabled:r}=e,n=Rie(t),o=(0,ye.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,ye.useEffect)(()=>()=>o?.disconnect(),[o]),o}function Bie(e){let{callback:t,disabled:r}=e,n=Rie(t),o=(0,ye.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,ye.useEffect)(()=>()=>o?.disconnect(),[o]),o}function epn(e){return new ZH(cD(e),e)}function c$t(e,t,r){t===void 0&&(t=epn);let[n,o]=(0,ye.useState)(null);function i(){o(u=>{if(!e)return null;if(e.isConnected===!1){var l;return(l=u??r)!=null?l:null}let c=t(e);return JSON.stringify(u)===JSON.stringify(c)?u:c})}let a=Qfn({callback(u){if(e)for(let l of u){let{type:c,target:d}=l;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),s=Bie({callback:i});return xm(()=>{i(),e?(s?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[e]),n}function tpn(e){let t=P$t(e);return _$t(e,t)}var d$t=[];function rpn(e){let t=(0,ye.useRef)(e),r=c$(n=>e?n&&n!==d$t&&e&&t.current&&e.parentNode===t.current.parentNode?n:t6(e):d$t,[e]);return(0,ye.useEffect)(()=>{t.current=e},[e]),r}function npn(e){let[t,r]=(0,ye.useState)(null),n=(0,ye.useRef)(e),o=(0,ye.useCallback)(i=>{let a=QAe(i.target);a&&r(s=>s?(s.set(a,rRe(a)),new Map(s)):null)},[]);return(0,ye.useEffect)(()=>{let i=n.current;if(e!==i){a(i);let s=e.map(u=>{let l=QAe(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,rRe(l)]):null}).filter(u=>u!=null);r(s.length?new Map(s):null),n.current=e}return()=>{a(e),a(i)};function a(s){s.forEach(u=>{let l=QAe(u);l?.removeEventListener("scroll",o)})}},[o,e]),(0,ye.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>oD(i,a),Zg):O$t(e):Zg,[e,t])}function f$t(e,t){t===void 0&&(t=[]);let r=(0,ye.useRef)(null);return(0,ye.useEffect)(()=>{r.current=null},t),(0,ye.useEffect)(()=>{let n=e!==Zg;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?iD(e,r.current):Zg}function opn(e){(0,ye.useEffect)(()=>{if(!JH)return;let t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(let r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function ipn(e,t){return(0,ye.useMemo)(()=>e.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,t)},r},{}),[e,t])}function T$t(e){return(0,ye.useMemo)(()=>e?Afn(e):null,[e])}var p$t=[];function apn(e,t){t===void 0&&(t=cD);let[r]=e,n=T$t(r?Gd(r):null),[o,i]=(0,ye.useState)(p$t);function a(){i(()=>e.length?e.map(u=>x$t(u)?n:new ZH(t(u),u)):p$t)}let s=Bie({callback:a});return xm(()=>{s?.disconnect(),a(),e.forEach(u=>s?.observe(u))},[e]),o}function spn(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return u$(t)?t:e}function upn(e){let{measure:t}=e,[r,n]=(0,ye.useState)(null),o=(0,ye.useCallback)(l=>{for(let{target:c}of l)if(u$(c)){n(d=>{let f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),i=Bie({callback:o}),a=(0,ye.useCallback)(l=>{let c=spn(l);i?.disconnect(),c&&i?.observe(c),n(c?t(c):null)},[t,i]),[s,u]=GH(a);return(0,ye.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var lpn=[{sensor:sM,options:{}},{sensor:aM,options:{}}],cpn={current:{}},Nie={draggable:{measure:i$t},droppable:{measure:i$t,strategy:QH.WhileDragging,frequency:aRe.Optimized},dragOverlay:{measure:cD}},lD=class extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}},dpn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new lD,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Lie},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Nie,measureDroppableContainers:Lie,windowRect:null,measuringScheduled:!1},fpn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Lie,draggableNodes:new Map,over:null,measureDroppableContainers:Lie},$ie=(0,ye.createContext)(fpn),M$t=(0,ye.createContext)(dpn);function ppn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new lD}}}function hpn(e,t){switch(t.type){case ol.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ol.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ol.DragEnd:case ol.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ol.RegisterDroppable:{let{element:r}=t,{id:n}=r,o=new lD(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case ol.SetDroppableDisabled:{let{id:r,key:n,disabled:o}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;let a=new lD(e.droppable.containers);return a.set(r,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case ol.UnregisterDroppable:{let{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;let i=new lD(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function mpn(e){let{disabled:t}=e,{active:r,activatorEvent:n,draggableNodes:o}=(0,ye.useContext)($ie),i=Die(n),a=Die(r?.id);return(0,ye.useEffect)(()=>{if(!t&&!n&&i&&a!=null){if(!KH(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=QBt(c);if(d){d.focus();break}}})}},[n,t,o,a,i]),null}function gpn(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...n}),r):r}function ypn(e){return(0,ye.useMemo)(()=>({draggable:{...Nie.draggable,...e?.draggable},droppable:{...Nie.droppable,...e?.droppable},dragOverlay:{...Nie.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function bpn(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e,i=(0,ye.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;xm(()=>{if(!a&&!s||!t){i.current=!1;return}if(i.current||!n)return;let l=t?.node.current;if(!l||l.isConnected===!1)return;let c=r(l),d=_$t(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=v$t(l);f&&f.scrollBy({top:d.y,left:d.x})}},[t,a,s,n,r])}var I$t=(0,ye.createContext)({...Zg,scaleX:1,scaleY:1}),iM;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(iM||(iM={}));var r6=(0,ye.memo)(function(t){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=lpn,collisionDetection:d=Cfn,measuring:f,modifiers:p,...h}=t,m=(0,ye.useReducer)(hpn,void 0,ppn),[_,g]=m,[v,S]=bfn(),[x,O]=(0,ye.useState)(iM.Uninitialized),T=x===iM.Initialized,{draggable:{active:E,nodes:M,translate:A},droppable:{containers:j}}=_,N=E!=null?M.get(E):null,F=(0,ye.useRef)({initial:null,translated:null}),k=(0,ye.useMemo)(()=>{var Ea;return E!=null?{id:E,data:(Ea=N?.data)!=null?Ea:cpn,rect:F}:null},[E,N]),L=(0,ye.useRef)(null),[q,U]=(0,ye.useState)(null),[G,V]=(0,ye.useState)(null),D=l$(h,Object.values(h)),z=nD("DndDescribedBy",a),W=(0,ye.useMemo)(()=>j.getEnabled(),[j]),J=ypn(f),{droppableRects:te,measureDroppableContainers:Ie,measuringScheduled:Z}=Zfn(W,{dragging:T,dependencies:[A.x,A.y],config:J.droppable}),X=Kfn(M,E),ne=(0,ye.useMemo)(()=>G?jie(G):null,[G]),Pe=sO(),ht=Xfn(X,J.draggable.measure);bpn({activeNode:E!=null?M.get(E):null,config:Pe.layoutShiftCompensation,initialRect:ht,measure:J.draggable.measure});let we=c$t(X,J.draggable.measure,ht),ae=c$t(X?X.parentElement:null),ee=(0,ye.useRef)({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:te,draggableNodes:M,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ge=j.getNodeFor((r=ee.current.over)==null?void 0:r.id),Ue=upn({measure:J.dragOverlay.measure}),ct=(n=Ue.nodeRef.current)!=null?n:X,Je=T?(o=Ue.rect)!=null?o:we:null,cr=!!(Ue.nodeRef.current&&Ue.rect),Qr=tpn(cr?null:we),dr=T$t(ct?Gd(ct):null),Ut=rpn(T?ge??X:null),$o=apn(Ut),Xi=gpn(p,{transform:{x:A.x-Qr.x,y:A.y-Qr.y,scaleX:1,scaleY:1},activatorEvent:G,active:k,activeNodeRect:we,containerNodeRect:ae,draggingNodeRect:Je,over:ee.current.over,overlayNodeRect:Ue.rect,scrollableAncestors:Ut,scrollableAncestorRects:$o,windowRect:dr}),No=ne?oD(ne,A):null,Ae=npn(Ut),Ze=f$t(Ae),fr=f$t(Ae,[we]),Xe=oD(Xi,Ze),Bn=Je?Pfn(Je,Xi):null,Qi=k&&Bn?d({active:k,collisionRect:Bn,droppableRects:te,droppableContainers:W,pointerCoordinates:No}):null,al=sRe(Qi,"id"),[Pc,Tm]=(0,ye.useState)(null),Mm=cr?Xi:oD(Xi,fr),Oa=Ofn(Mm,(i=Pc?.rect)!=null?i:null,we),Wp=(0,ye.useRef)(null),Zf=(0,ye.useCallback)((Ea,ns)=>{let{sensor:ea,options:pd}=ns;if(L.current==null)return;let Tc=M.get(L.current);if(!Tc)return;let Ba=Ea.nativeEvent,Kd=new ea({active:L.current,activeNode:Tc,event:Ba,options:pd,context:ee,onAbort(nn){if(!M.get(nn))return;let{onDragAbort:md}=D.current,Xf={id:nn};md?.(Xf),v({type:"onDragAbort",event:Xf})},onPending(nn,je,md,Xf){if(!M.get(nn))return;let{onDragPending:aS}=D.current,en={id:nn,constraint:je,initialCoordinates:md,offset:Xf};aS?.(en),v({type:"onDragPending",event:en})},onStart(nn){let je=L.current;if(je==null)return;let md=M.get(je);if(!md)return;let{onDragStart:Xf}=D.current,Lu={activatorEvent:Ba,active:{id:je,data:md.data,rect:F}};(0,sD.unstable_batchedUpdates)(()=>{Xf?.(Lu),O(iM.Initializing),g({type:ol.DragStart,initialCoordinates:nn,active:je}),v({type:"onDragStart",event:Lu}),U(Wp.current),V(Ba)})},onMove(nn){g({type:ol.DragMove,coordinates:nn})},onEnd:hd(ol.DragEnd),onCancel:hd(ol.DragCancel)});Wp.current=Kd;function hd(nn){return async function(){let{active:md,collisions:Xf,over:Lu,scrollAdjustedTranslate:aS}=ee.current,en=null;if(md&&aS){let{cancelDrop:Im}=D.current;en={activatorEvent:Ba,active:md,collisions:Xf,delta:aS,over:Lu},nn===ol.DragEnd&&typeof Im=="function"&&await Promise.resolve(Im(en))&&(nn=ol.DragCancel)}L.current=null,(0,sD.unstable_batchedUpdates)(()=>{g({type:nn}),O(iM.Uninitialized),Tm(null),U(null),V(null),Wp.current=null;let Im=nn===ol.DragEnd?"onDragEnd":"onDragCancel";if(en){let S$=D.current[Im];S$?.(en),v({type:Im,event:en})}})}}},[M]),Jp=(0,ye.useCallback)((Ea,ns)=>(ea,pd)=>{let Tc=ea.nativeEvent,Ba=M.get(pd);if(L.current!==null||!Ba||Tc.dndKit||Tc.defaultPrevented)return;let Kd={active:Ba};Ea(ea,ns.options,Kd)===!0&&(Tc.dndKit={capturedBy:ns.sensor},L.current=pd,Zf(ea,ns))},[M,Zf]),mn=Yfn(c,Jp);opn(c),xm(()=>{we&&x===iM.Initializing&&O(iM.Initialized)},[we,x]),(0,ye.useEffect)(()=>{let{onDragMove:Ea}=D.current,{active:ns,activatorEvent:ea,collisions:pd,over:Tc}=ee.current;if(!ns||!ea)return;let Ba={active:ns,activatorEvent:ea,collisions:pd,delta:{x:Xe.x,y:Xe.y},over:Tc};(0,sD.unstable_batchedUpdates)(()=>{Ea?.(Ba),v({type:"onDragMove",event:Ba})})},[Xe.x,Xe.y]),(0,ye.useEffect)(()=>{let{active:Ea,activatorEvent:ns,collisions:ea,droppableContainers:pd,scrollAdjustedTranslate:Tc}=ee.current;if(!Ea||L.current==null||!ns||!Tc)return;let{onDragOver:Ba}=D.current,Kd=pd.get(al),hd=Kd&&Kd.rect.current?{id:Kd.id,rect:Kd.rect.current,data:Kd.data,disabled:Kd.disabled}:null,nn={active:Ea,activatorEvent:ns,collisions:ea,delta:{x:Tc.x,y:Tc.y},over:hd};(0,sD.unstable_batchedUpdates)(()=>{Tm(hd),Ba?.(nn),v({type:"onDragOver",event:nn})})},[al]),xm(()=>{ee.current={activatorEvent:G,active:k,activeNode:X,collisionRect:Bn,collisions:Qi,droppableRects:te,draggableNodes:M,draggingNode:ct,draggingNodeRect:Je,droppableContainers:j,over:Pc,scrollableAncestors:Ut,scrollAdjustedTranslate:Xe},F.current={initial:Je,translated:Bn}},[k,X,Qi,Bn,M,ct,Je,te,j,Pc,Ut,Xe]),Wfn({...Pe,delta:A,draggingRect:Bn,pointerCoordinates:No,scrollableAncestors:Ut,scrollableAncestorRects:$o});let aO=(0,ye.useMemo)(()=>({active:k,activeNode:X,activeNodeRect:we,activatorEvent:G,collisions:Qi,containerNodeRect:ae,dragOverlay:Ue,draggableNodes:M,droppableContainers:j,droppableRects:te,over:Pc,measureDroppableContainers:Ie,scrollableAncestors:Ut,scrollableAncestorRects:$o,measuringConfiguration:J,measuringScheduled:Z,windowRect:dr}),[k,X,we,G,Qi,ae,Ue,M,j,te,Pc,Ie,Ut,$o,J,Z,dr]),yM=(0,ye.useMemo)(()=>({activatorEvent:G,activators:mn,active:k,activeNodeRect:we,ariaDescribedById:{draggable:z},dispatch:g,draggableNodes:M,over:Pc,measureDroppableContainers:Ie}),[G,mn,k,we,g,z,M,Pc,Ie]);return ye.default.createElement(m$t.Provider,{value:S},ye.default.createElement($ie.Provider,{value:yM},ye.default.createElement(M$t.Provider,{value:aO},ye.default.createElement(I$t.Provider,{value:Oa},l)),ye.default.createElement(mpn,{disabled:s?.restoreFocus===!1})),ye.default.createElement(wfn,{...s,hiddenTextDescribedById:z}));function sO(){let Ea=q?.autoScrollEnabled===!1,ns=typeof u=="object"?u.enabled===!1:u===!1,ea=T&&!Ea&&!ns;return typeof u=="object"?{...u,enabled:ea}:{enabled:ea}}}),_pn=(0,ye.createContext)(null),h$t="button",vpn="Draggable";function A$t(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e,i=nD(vpn),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,ye.useContext)($ie),{role:p=h$t,roleDescription:h="draggable",tabIndex:m=0}=o??{},_=u?.id===t,g=(0,ye.useContext)(_?I$t:_pn),[v,S]=GH(),[x,O]=GH(),T=ipn(a,t),E=l$(r);xm(()=>(d.set(t,{id:t,key:i,node:v,activatorNode:x,data:E}),()=>{let A=d.get(t);A&&A.key===i&&d.delete(t)}),[d,t]);let M=(0,ye.useMemo)(()=>({role:p,tabIndex:m,"aria-disabled":n,"aria-pressed":_&&p===h$t?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[n,p,m,_,h,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:M,isDragging:_,listeners:n?void 0:T,node:v,over:f,setNodeRef:S,setActivatorNodeRef:O,transform:g}}function R$t(){return(0,ye.useContext)(M$t)}var wpn="Droppable",Spn={timeout:25};function D$t(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e,i=nD(wpn),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,ye.useContext)($ie),c=(0,ye.useRef)({disabled:r}),d=(0,ye.useRef)(!1),f=(0,ye.useRef)(null),p=(0,ye.useRef)(null),{disabled:h,updateMeasurementsFor:m,timeout:_}={...Spn,...o},g=l$(m??n),v=(0,ye.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},_)},[_]),S=Bie({callback:v,disabled:h||!a}),x=(0,ye.useCallback)((M,A)=>{S&&(A&&(S.unobserve(A),d.current=!1),M&&S.observe(M))},[S]),[O,T]=GH(x),E=l$(t);return(0,ye.useEffect)(()=>{!S||!O.current||(S.disconnect(),d.current=!1,S.observe(O.current))},[O,S]),(0,ye.useEffect)(()=>(s({type:ol.RegisterDroppable,element:{id:n,key:i,disabled:r,node:O,rect:f,data:E}}),()=>s({type:ol.UnregisterDroppable,key:i,id:n})),[n]),(0,ye.useEffect)(()=>{r!==c.current.disabled&&(s({type:ol.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:T}}var ts=B(Y());function f$(e,t,r){let n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function xpn(e,t){return e.reduce((r,n,o)=>{let i=t.get(n);return i&&(r[o]=i),r},Array(e.length))}function qie(e){return e!==null&&e>=0}function Cpn(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function Opn(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var j$t=e=>{let{rects:t,activeIndex:r,overIndex:n,index:o}=e,i=f$(t,n,r),a=t[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 Uie={scaleX:1,scaleY:1},n6=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:o,rects:i,overIndex:a}=e,s=(t=i[r])!=null?t:n;if(!s)return null;if(o===r){let l=i[a];return l?{x:0,y:r<a?l.top+l.height-(s.top+s.height):l.top-s.top,...Uie}:null}let u=Epn(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...Uie}:o<r&&o>=a?{x:0,y:s.height+u,...Uie}:{x:0,y:0,...Uie}};function Epn(e,t,r){let n=e[t],o=e[t-1],i=e[t+1];return n?r<t?o?n.top-(o.top+o.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):o?n.top-(o.top+o.height):0:0}var N$t="Sortable",L$t=ts.default.createContext({activeIndex:-1,containerId:N$t,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:j$t,disabled:{draggable:!1,droppable:!1}});function o6(e){let{children:t,id:r,items:n,strategy:o=j$t,disabled:i=!1}=e,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=R$t(),d=nD(N$t,r),f=s.rect!==null,p=(0,ts.useMemo)(()=>n.map(T=>typeof T=="object"&&"id"in T?T.id:T),[n]),h=a!=null,m=a?p.indexOf(a.id):-1,_=l?p.indexOf(l.id):-1,g=(0,ts.useRef)(p),v=!Cpn(p,g.current),S=_!==-1&&m===-1||v,x=Opn(i);xm(()=>{v&&h&&c(p)},[v,p,h,c]),(0,ts.useEffect)(()=>{g.current=p},[p]);let O=(0,ts.useMemo)(()=>({activeIndex:m,containerId:d,disabled:x,disableTransforms:S,items:p,overIndex:_,useDragOverlay:f,sortedRects:xpn(p,u),strategy:o}),[m,d,x.draggable,x.droppable,S,p,_,u,f,o]);return ts.default.createElement(L$t.Provider,{value:O},t)}var Ppn=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return f$(r,n,o).indexOf(t)},Tpn=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:i,newIndex:a,previousItems:s,previousContainerId:u,transition:l}=e;return!l||!n||s!==i&&o===a?!1:r?!0:a!==o&&t===u},Mpn={duration:200,easing:"ease"},F$t="transform",Ipn=Yg.Transition.toString({property:F$t,duration:0,easing:"linear"}),Apn={roleDescription:"sortable"};function Rpn(e){let{disabled:t,index:r,node:n,rect:o}=e,[i,a]=(0,ts.useState)(null),s=(0,ts.useRef)(r);return xm(()=>{if(!t&&r!==s.current&&n.current){let u=o.current;if(u){let l=cD(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)},[t,r,n,o]),(0,ts.useEffect)(()=>{i&&a(null)},[i]),i}function i6(e){let{animateLayoutChanges:t=Tpn,attributes:r,disabled:n,data:o,getNewIndex:i=Ppn,id:a,strategy:s,resizeObserverConfig:u,transition:l=Mpn}=e,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:h,sortedRects:m,overIndex:_,useDragOverlay:g,strategy:v}=(0,ts.useContext)(L$t),S=Dpn(n,p),x=c.indexOf(a),O=(0,ts.useMemo)(()=>({sortable:{containerId:d,index:x,items:c},...o}),[d,o,x,c]),T=(0,ts.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:E,node:M,isOver:A,setNodeRef:j}=D$t({id:a,data:O,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...u}}),{active:N,activatorEvent:F,activeNodeRect:k,attributes:L,setNodeRef:q,listeners:U,isDragging:G,over:V,setActivatorNodeRef:D,transform:z}=A$t({id:a,data:O,attributes:{...Apn,...r},disabled:S.draggable}),W=YBt(j,q),J=!!N,te=J&&!h&&qie(f)&&qie(_),Ie=!g&&G,Z=Ie&&te?z:null,ne=te?Z??(s??v)({rects:m,activeNodeRect:k,activeIndex:f,overIndex:_,index:x}):null,Pe=qie(f)&&qie(_)?i({id:a,items:c,activeIndex:f,overIndex:_}):x,ht=N?.id,we=(0,ts.useRef)({activeId:ht,items:c,newIndex:Pe,containerId:d}),ae=c!==we.current.items,ee=t({active:N,containerId:d,isDragging:G,isSorting:J,id:a,index:x,items:c,newIndex:we.current.newIndex,previousItems:we.current.items,previousContainerId:we.current.containerId,transition:l,wasDragging:we.current.activeId!=null}),ge=Rpn({disabled:!ee,index:x,node:M,rect:E});return(0,ts.useEffect)(()=>{J&&we.current.newIndex!==Pe&&(we.current.newIndex=Pe),d!==we.current.containerId&&(we.current.containerId=d),c!==we.current.items&&(we.current.items=c)},[J,Pe,d,c]),(0,ts.useEffect)(()=>{if(ht===we.current.activeId)return;if(ht!=null&&we.current.activeId==null){we.current.activeId=ht;return}let ct=setTimeout(()=>{we.current.activeId=ht},50);return()=>clearTimeout(ct)},[ht]),{active:N,activeIndex:f,attributes:L,data:O,rect:E,index:x,newIndex:Pe,items:c,isOver:A,isSorting:J,isDragging:G,listeners:U,node:M,overIndex:_,over:V,setNodeRef:W,setActivatorNodeRef:D,setDroppableNodeRef:j,setDraggableNodeRef:q,transform:ge??ne,transition:Ue()};function Ue(){if(ge||ae&&we.current.newIndex===x)return Ipn;if(!(Ie&&!KH(F)||!l)&&(J||ee))return Yg.Transition.toString({...l,property:F$t})}}function Dpn(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e?.draggable)!=null?r:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function zie(e){if(!e)return!1;let t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}var jpn=[hn.Down,hn.Right,hn.Up,hn.Left],Hie=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=t;if(jpn.includes(e.code)){if(e.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(e.code){case hn.Down:n.top<f.top&&u.push(d);break;case hn.Up:n.top>f.top&&u.push(d);break;case hn.Left:n.left>f.left&&u.push(d);break;case hn.Right:n.left<f.left&&u.push(d);break}});let l=b$t({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=sRe(l,"id");if(c===a?.id&&l.length>1&&(c=l[1].id),c!=null){let d=i.get(r.id),f=i.get(c),p=f?o.get(f.id):null,h=f?.node.current;if(h&&p&&d&&f){let _=t6(h).some((T,E)=>s[E]!==T),g=k$t(d,f),v=Npn(d,f),S=_||!g?{x:0,y:0}:{x:v?n.width-p.width:0,y:v?n.height-p.height:0},x={x:p.left,y:p.top};return S.x&&S.y?x:iD(x,S)}}}};function k$t(e,t){return!zie(e)||!zie(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Npn(e,t){return!zie(e)||!zie(t)||!k$t(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var Vie=B(Y()),uRe=(0,Vie.createContext)(null),B$t=()=>(0,Vie.useContext)(uRe);var Lpn=({command:e,onUpdate:t,onRemove:r,onDuplicate:n})=>{let{attributes:o,listeners:i,setNodeRef:a,transform:s,transition:u,isDragging:l}=i6({id:e.name}),c={transform:Yg.Transform.toString(s),transition:u},d=B$t();return sr.default.createElement(eD,{ref:a,style:c,className:_e("transition-colors",l&&"shadow-lg bg-background/90 backdrop-blur-sm relative z-[100] cursor-grabbing border-2 border-accent/50")},sr.default.createElement(Yf,{className:"w-10"},sr.default.createElement("div",{...o,...i,className:"flex items-center justify-center cursor-grab"},sr.default.createElement(uE,{className:"h-4 w-4 text-muted-foreground"}))),sr.default.createElement(Yf,null,e.name),sr.default.createElement(Yf,{className:"text-center"},sr.default.createElement(Jd,{checked:e.showInContextMenu,onCheckedChange:f=>t(e,{...e,showInContextMenu:f===!0}),className:"mx-auto"})),sr.default.createElement(Yf,{className:"text-center"},sr.default.createElement("div",{className:"flex justify-center space-x-1"},sr.default.createElement(qe,{variant:"ghost",size:"icon",onClick:()=>new s$(app,e,f=>t(e,f),()=>r(e)).open()},sr.default.createElement(Zj,{className:"h-4 w-4"})),sr.default.createElement(zB,null,sr.default.createElement(HB,{asChild:!0},sr.default.createElement(qe,{variant:"ghost",size:"icon"},sr.default.createElement(aE,{className:"h-4 w-4"}))),sr.default.createElement(tS,{align:"end",container:d},sr.default.createElement(Qa,{onClick:()=>new s$(app,e,f=>t(e,f),()=>r(e)).open()},sr.default.createElement(Zj,{className:"h-4 w-4 mr-2"}),"Edit"),sr.default.createElement(Qa,{onClick:()=>n(e)},sr.default.createElement(ZS,{className:"h-4 w-4 mr-2"}),"Copy"),sr.default.createElement(Qa,{onClick:()=>r(e),className:"text-error"},sr.default.createElement(eg,{className:"h-4 w-4 mr-2"}),"Delete"))))))},$$t=()=>{let e=J1t(),t=kie(d$(sM,{activationConstraint:{distance:8}}),d$(aM,{coordinateGetter:Hie})),r=(a,s)=>{let u=e.findIndex(l=>l===a);u===-1?xt("inlineEditCommands",[...e,s]):xt("inlineEditCommands",[...e.slice(0,u),s,...e.slice(u+1)])},n=a=>{let s={...a,name:`${a.name} (copy)`},u=e.findIndex(l=>l===a);u!==-1&&xt("inlineEditCommands",[...e.slice(0,u+1),s,...e.slice(u+1)])},o=a=>{xt("inlineEditCommands",e.filter(s=>s!==a))},i=a=>{let{active:s,over:u}=a;if(u&&s.id!==u.id){let l=e.findIndex(d=>d.name===s.id),c=e.findIndex(d=>d.name===u.id);if(l!==-1&&c!==-1){let d=f$(e,l,c);xt("inlineEditCommands",d)}}};return sr.default.createElement("div",{className:"space-y-4"},sr.default.createElement("section",null,sr.default.createElement("div",{className:"flex flex-col mb-4 gap-2"},sr.default.createElement("div",{className:"text-xl font-bold"},"Custom Commands"),sr.default.createElement("div",{className:"text-sm text-muted"},"To trigger a custom command, highlight text in the editor and select it from the command palette, or right-click and choose it from the context menu if configured.")),!K1t()&&sr.default.createElement("div",{className:"border border-border border-solid p-4 rounded-md text-muted flex items-start gap-2"},sr.default.createElement(QS,{className:"size-5"})," Take control of your inline edit commands! You can now create your own or edit built-in ones to tailor functionality to your needs."),sr.default.createElement("div",{className:"flex flex-col gap-4"},sr.default.createElement(r6,{sensors:t,collisionDetection:e6,onDragEnd:i},sr.default.createElement(HH,null,sr.default.createElement(VH,null,sr.default.createElement(eD,null,sr.default.createElement(Kf,{className:"w-10"}),sr.default.createElement(Kf,null,"Name"),sr.default.createElement(Kf,{className:"text-center w-20"},"In Menu"),sr.default.createElement(Kf,{className:"w-10"}))),sr.default.createElement(o6,{items:e.map(a=>a.name),strategy:n6},sr.default.createElement(WH,null,e.map(a=>sr.default.createElement(Lpn,{key:a.name,command:a,onUpdate:r,onRemove:o,onDuplicate:n})))))),sr.default.createElement("div",{className:"flex w-full justify-end"},sr.default.createElement(qe,{variant:"secondary",onClick:()=>new s$(app,{name:"",prompt:"",showInContextMenu:!1},a=>r(a,a)).open()},sr.default.createElement(ex,{className:"h-4 w-4"})," Add Command")))))};var Ur=B(Y());var hD=B(Y());var ji=B(Y());var zp=B(Y());function uM({value:e,onChange:t,placeholder:r,disabled:n,className:o}){let[i,a]=(0,zp.useState)(!1),s=(0,zp.useRef)(null),u=(0,zp.useRef)(!0);return(0,zp.useEffect)(()=>{(async()=>{if(u.current&&e&&s.current){try{s.current.value=await Ho(e)}catch(c){gt("Failed to decrypt value:"+bi(c)),s.current.value=e}u.current=!1}else s.current&&(s.current.value=e||"")})()},[e]),zp.default.createElement("div",{className:_e("relative",o)},zp.default.createElement(ri,{ref:s,type:i?"text":"password",onChange:l=>t?.(l.target.value),placeholder:r,disabled:n,className:_e("![padding-right:1.75rem] w-full")}),zp.default.createElement("div",{onClick:()=>!n&&a(!i),className:_e("absolute right-2 top-0 bottom-0 flex items-center justify-center","cursor-pointer",n&&"opacity-50 cursor-not-allowed"),role:"button","aria-label":i?"Hide password":"Show password"},i?zp.default.createElement(IU,{className:_e("h-3.5 w-3.5","text-muted/60 hover:text-accent","transition-colors duration-200")}):zp.default.createElement(XS,{className:_e("h-3.5 w-3.5","text-muted/60 hover:text-accent","transition-colors duration-200")})))}var Ec=B(Y());var mi=B(Y(),1);function iS(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}var U$t=B(Y(),1);function q$t(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function lRe(...e){return t=>{let r=!1,n=e.map(o=>{let i=q$t(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():q$t(e[o],null)}}}}function XC(...e){return U$t.useCallback(lRe(...e),e)}var xa=B(Y(),1);var z$t=B(Y(),1),H$t=B(ss(),1);var Oc=B(Y(),1);var p$=B(lt(),1),a6=Oc.forwardRef((e,t)=>{let{children:r,...n}=e,o=Oc.Children.toArray(r),i=o.find(kpn);if(i){let a=i.props.children,s=o.map(u=>u===i?Oc.Children.count(a)>1?Oc.Children.only(null):Oc.isValidElement(a)?a.props.children:null:u);return(0,p$.jsx)(cRe,{...n,ref:t,children:Oc.isValidElement(a)?Oc.cloneElement(a,void 0,s):null})}return(0,p$.jsx)(cRe,{...n,ref:t,children:r})});a6.displayName="Slot";var cRe=Oc.forwardRef((e,t)=>{let{children:r,...n}=e;if(Oc.isValidElement(r)){let o=$pn(r);return Oc.cloneElement(r,{...Bpn(n,r.props),ref:t?lRe(t,o):o})}return Oc.Children.count(r)>1?Oc.Children.only(null):null});cRe.displayName="SlotClone";var Fpn=({children:e})=>(0,p$.jsx)(p$.Fragment,{children:e});function kpn(e){return Oc.isValidElement(e)&&e.type===Fpn}function Bpn(e,t){let r={...t};for(let n in t){let o=e[n],i=t[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{...e,...r}}function $pn(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var V$t=B(lt(),1),qpn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Hp=qpn.reduce((e,t)=>{let r=z$t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?a6:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,V$t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function W$t(e,t){e&&H$t.flushSync(()=>e.dispatchEvent(t))}var fRe=B(lt(),1),Upn="DismissableLayer",dRe="dismissableLayer.update",zpn="dismissableLayer.pointerDownOutside",Hpn="dismissableLayer.focusOutside",J$t,K$t=xa.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),pRe=xa.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=e,l=xa.useContext(K$t),[c,d]=xa.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=xa.useState({}),h=XC(t,E=>d(E)),m=Array.from(l.layers),[_]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(_),v=c?m.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=v>=g,O=Jpn(E=>{let M=E.target,A=[...l.branches].some(j=>j.contains(M));!x||A||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),T=Gpn(E=>{let M=E.target;[...l.branches].some(j=>j.contains(M))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return Zw(E=>{v===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),xa.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(J$t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),G$t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=J$t)}},[c,f,r,l]),xa.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),G$t())},[c,l]),xa.useEffect(()=>{let E=()=>p({});return document.addEventListener(dRe,E),()=>document.removeEventListener(dRe,E)},[]),(0,fRe.jsx)(Hp.div,{...u,ref:h,style:{pointerEvents:S?x?"auto":"none":void 0,...e.style},onFocusCapture:iS(e.onFocusCapture,T.onFocusCapture),onBlurCapture:iS(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:iS(e.onPointerDownCapture,O.onPointerDownCapture)})});pRe.displayName=Upn;var Vpn="DismissableLayerBranch",Wpn=xa.forwardRef((e,t)=>{let r=xa.useContext(K$t),n=xa.useRef(null),o=XC(t,n);return xa.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,fRe.jsx)(Hp.div,{...e,ref:o})});Wpn.displayName=Vpn;function Jpn(e,t=globalThis?.document){let r=Gt(e),n=xa.useRef(!1),o=xa.useRef(()=>{});return xa.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Y$t(zpn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Gpn(e,t=globalThis?.document){let r=Gt(e),n=xa.useRef(!1);return xa.useEffect(()=>{let o=i=>{i.target&&!n.current&&Y$t(Hpn,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function G$t(){let e=new CustomEvent(dRe);document.dispatchEvent(e)}function Y$t(e,t,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?W$t(o,i):o.dispatchEvent(i)}var Om=B(Y(),1);var tqt=B(lt(),1),hRe="focusScope.autoFocusOnMount",mRe="focusScope.autoFocusOnUnmount",Z$t={bubbles:!1,cancelable:!0},Kpn="FocusScope",gRe=Om.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[s,u]=Om.useState(null),l=Gt(o),c=Gt(i),d=Om.useRef(null),f=XC(t,m=>u(m)),p=Om.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Om.useEffect(()=>{if(n){let v=function(T){if(p.paused||!s)return;let E=T.target;s.contains(E)?d.current=E:lM(d.current,{select:!0})},S=function(T){if(p.paused||!s)return;let E=T.relatedTarget;E!==null&&(s.contains(E)||lM(d.current,{select:!0}))},x=function(T){if(document.activeElement===document.body)for(let M of T)M.removedNodes.length>0&&lM(s)};var m=v,_=S,g=x;document.addEventListener("focusin",v),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),Om.useEffect(()=>{if(s){Q$t.add(p);let m=document.activeElement;if(!s.contains(m)){let g=new CustomEvent(hRe,Z$t);s.addEventListener(hRe,l),s.dispatchEvent(g),g.defaultPrevented||(Ypn(thn(rqt(s)),{select:!0}),document.activeElement===m&&lM(s))}return()=>{s.removeEventListener(hRe,l),setTimeout(()=>{let g=new CustomEvent(mRe,Z$t);s.addEventListener(mRe,c),s.dispatchEvent(g),g.defaultPrevented||lM(m??document.body,{select:!0}),s.removeEventListener(mRe,c),Q$t.remove(p)},0)}}},[s,l,c,p]);let h=Om.useCallback(m=>{if(!r&&!n||p.paused)return;let _=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(_&&g){let v=m.currentTarget,[S,x]=Zpn(v);S&&x?!m.shiftKey&&g===x?(m.preventDefault(),r&&lM(S,{select:!0})):m.shiftKey&&g===S&&(m.preventDefault(),r&&lM(x,{select:!0})):g===v&&m.preventDefault()}},[r,n,p.paused]);return(0,tqt.jsx)(Hp.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});gRe.displayName=Kpn;function Ypn(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(lM(n,{select:t}),document.activeElement!==r)return}function Zpn(e){let t=rqt(e),r=X$t(t,e),n=X$t(t.reverse(),e);return[r,n]}function rqt(e){let t=[],r=document.createTreeWalker(e,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();)t.push(r.currentNode);return t}function X$t(e,t){for(let r of e)if(!Xpn(r,{upTo:t}))return r}function Xpn(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Qpn(e){return e instanceof HTMLInputElement&&"select"in e}function lM(e,{select:t=!1}={}){if(e&&e.focus){let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Qpn(e)&&t&&e.select()}}var Q$t=ehn();function ehn(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),e=eqt(e,t),e.unshift(t)},remove(t){e=eqt(e,t),e[0]?.resume()}}}function eqt(e,t){let r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function thn(e){return e.filter(t=>t.tagName!=="A")}var Wie=B(Y(),1),nqt=B(ss(),1);var oqt=B(lt(),1),rhn="Portal",yRe=Wie.forwardRef((e,t)=>{let{container:r,...n}=e,[o,i]=Wie.useState(!1);qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?nqt.default.createPortal((0,oqt.jsx)(Hp.div,{...n,ref:t}),a):null});yRe.displayName=rhn;var Kie=B(Y());var dd=B(Y());var Jie=U1();var bRe=function(){},s6=dd.forwardRef(function(e,t){var r=dd.useRef(null),n=dd.useState({onScrollCapture:bRe,onWheelCapture:bRe,onTouchMoveCapture:bRe}),o=n[0],i=n[1],a=e.forwardProps,s=e.children,u=e.className,l=e.removeScrollBar,c=e.enabled,d=e.shards,f=e.sideCar,p=e.noIsolation,h=e.inert,m=e.allowPinchZoom,_=e.as,g=_===void 0?"div":_,v=e.gapMode,S=JT(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=q1([r,t]),T=Do(Do({},S),o);return dd.createElement(dd.Fragment,null,c&&dd.createElement(x,{sideCar:Jie,removeScrollBar:l,shards:d,noIsolation:p,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:r,gapMode:v}),a?dd.cloneElement(dd.Children.only(s),Do(Do({},T),{ref:O})):dd.createElement(g,Do({},T,{className:u,ref:O}),s))});s6.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};s6.classNames={fullWidth:Vg,zeroRight:Hg};var Di=B(Y());var _Re=!1;if(typeof window<"u")try{u6=Object.defineProperty({},"passive",{get:function(){return _Re=!0,!0}}),window.addEventListener("test",u6,u6),window.removeEventListener("test",u6,u6)}catch{_Re=!1}var u6,dD=_Re?{passive:!1}:!1;var nhn=function(e){return e.tagName==="TEXTAREA"},iqt=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!nhn(e)&&r[t]==="visible")},ohn=function(e){return iqt(e,"overflowY")},ihn=function(e){return iqt(e,"overflowX")},vRe=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=aqt(e,n);if(o){var i=sqt(e,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},ahn=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},shn=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},aqt=function(e,t){return e==="v"?ohn(t):ihn(t)},sqt=function(e,t){return e==="v"?ahn(t):shn(t)},uhn=function(e,t){return e==="h"&&t==="rtl"?-1:1},uqt=function(e,t,r,n,o){var i=uhn(e,window.getComputedStyle(t).direction),a=i*n,s=r.target,u=t.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=sqt(e,s),h=p[0],m=p[1],_=p[2],g=m-_-i*h;(h||g)&&aqt(e,s)&&(d+=g,f+=h),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(t.contains(s)||t===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var Gie=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},lqt=function(e){return[e.deltaX,e.deltaY]},cqt=function(e){return e&&"current"in e?e.current:e},lhn=function(e,t){return e[0]===t[0]&&e[1]===t[1]},chn=function(e){return`
.block-interactivity-`.concat(e,` {pointer-events: none;}
.allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},dhn=0,h$=[];function dqt(e){var t=Di.useRef([]),r=Di.useRef([0,0]),n=Di.useRef(),o=Di.useState(dhn++)[0],i=Di.useState(YC)[0],a=Di.useRef(e);Di.useEffect(function(){a.current=e},[e]),Di.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=BB([e.lockRef.current],(e.shards||[]).map(cqt),!0).filter(Boolean);return m.forEach(function(_){return _.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=Di.useCallback(function(m,_){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var g=Gie(m),v=r.current,S="deltaX"in m?m.deltaX:v[0]-g[0],x="deltaY"in m?m.deltaY:v[1]-g[1],O,T=m.target,E=Math.abs(S)>Math.abs(x)?"h":"v";if("touches"in m&&E==="h"&&T.type==="range")return!1;var M=vRe(E,T);if(!M)return!0;if(M?O=E:(O=E==="v"?"h":"v",M=vRe(E,T)),!M)return!1;if(!n.current&&"changedTouches"in m&&(S||x)&&(n.current=O),!O)return!0;var A=n.current||O;return uqt(A,_,m,A==="h"?S:x,!0)},[]),u=Di.useCallback(function(m){var _=m;if(!(!h$.length||h$[h$.length-1]!==i)){var g="deltaY"in _?lqt(_):Gie(_),v=t.current.filter(function(O){return O.name===_.type&&(O.target===_.target||_.target===O.shadowParent)&&lhn(O.delta,g)})[0];if(v&&v.should){_.cancelable&&_.preventDefault();return}if(!v){var S=(a.current.shards||[]).map(cqt).filter(Boolean).filter(function(O){return O.contains(_.target)}),x=S.length>0?s(_,S[0]):!a.current.noIsolation;x&&_.cancelable&&_.preventDefault()}}},[]),l=Di.useCallback(function(m,_,g,v){var S={name:m,delta:_,target:g,should:v,shadowParent:fhn(g)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(x){return x!==S})},1)},[]),c=Di.useCallback(function(m){r.current=Gie(m),n.current=void 0},[]),d=Di.useCallback(function(m){l(m.type,lqt(m),m.target,s(m,e.lockRef.current))},[]),f=Di.useCallback(function(m){l(m.type,Gie(m),m.target,s(m,e.lockRef.current))},[]);Di.useEffect(function(){return h$.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,dD),document.addEventListener("touchmove",u,dD),document.addEventListener("touchstart",c,dD),function(){h$=h$.filter(function(m){return m!==i}),document.removeEventListener("wheel",u,dD),document.removeEventListener("touchmove",u,dD),document.removeEventListener("touchstart",c,dD)}},[]);var p=e.removeScrollBar,h=e.inert;return Di.createElement(Di.Fragment,null,h?Di.createElement(i,{styles:chn(o)}):null,p?Di.createElement(H1,{gapMode:e.gapMode}):null)}function fhn(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var fqt=z1(Jie,dqt);var pqt=Kie.forwardRef(function(e,t){return Kie.createElement(s6,Do({},e,{ref:t,sideCar:fqt}))});pqt.classNames=s6.classNames;var l6=pqt;var Zo=B(lt(),1),wRe="Dialog",[hqt,dWo]=Ro(wRe),[phn,Xg]=hqt(wRe),mqt=e=>{let{__scopeDialog:t,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,s=mi.useRef(null),u=mi.useRef(null),[l=!1,c]=tl({prop:n,defaultProp:o,onChange:i});return(0,Zo.jsx)(phn,{scope:t,triggerRef:s,contentRef:u,contentId:Fa(),titleId:Fa(),descriptionId:Fa(),open:l,onOpenChange:c,onOpenToggle:mi.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};mqt.displayName=wRe;var gqt="DialogTrigger",yqt=mi.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,o=Xg(gqt,r),i=XC(t,o.triggerRef);return(0,Zo.jsx)(Hp.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":CRe(o.open),...n,ref:i,onClick:iS(e.onClick,o.onOpenToggle)})});yqt.displayName=gqt;var SRe="DialogPortal",[hhn,bqt]=hqt(SRe,{forceMount:void 0}),_qt=e=>{let{__scopeDialog:t,forceMount:r,children:n,container:o}=e,i=Xg(SRe,t);return(0,Zo.jsx)(hhn,{scope:t,forceMount:r,children:mi.Children.map(n,a=>(0,Zo.jsx)(Ru,{present:r||i.open,children:(0,Zo.jsx)(yRe,{asChild:!0,container:o,children:a})}))})};_qt.displayName=SRe;var Yie="DialogOverlay",vqt=mi.forwardRef((e,t)=>{let r=bqt(Yie,e.__scopeDialog),{forceMount:n=r.forceMount,...o}=e,i=Xg(Yie,e.__scopeDialog);return i.modal?(0,Zo.jsx)(Ru,{present:n||i.open,children:(0,Zo.jsx)(mhn,{...o,ref:t})}):null});vqt.displayName=Yie;var mhn=mi.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,o=Xg(Yie,r);return(0,Zo.jsx)(l6,{as:a6,allowPinchZoom:!0,shards:[o.contentRef],children:(0,Zo.jsx)(Hp.div,{"data-state":CRe(o.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),fD="DialogContent",wqt=mi.forwardRef((e,t)=>{let r=bqt(fD,e.__scopeDialog),{forceMount:n=r.forceMount,...o}=e,i=Xg(fD,e.__scopeDialog);return(0,Zo.jsx)(Ru,{present:n||i.open,children:i.modal?(0,Zo.jsx)(ghn,{...o,ref:t}):(0,Zo.jsx)(yhn,{...o,ref:t})})});wqt.displayName=fD;var ghn=mi.forwardRef((e,t)=>{let r=Xg(fD,e.__scopeDialog),n=mi.useRef(null),o=XC(t,r.contentRef,n);return mi.useEffect(()=>{let i=n.current;if(i)return WT(i)},[]),(0,Zo.jsx)(Sqt,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:iS(e.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:iS(e.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:iS(e.onFocusOutside,i=>i.preventDefault())})}),yhn=mi.forwardRef((e,t)=>{let r=Xg(fD,e.__scopeDialog),n=mi.useRef(!1),o=mi.useRef(!1);return(0,Zo.jsx)(Sqt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(n.current||r.triggerRef.current?.focus(),i.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:i=>{e.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()}})}),Sqt=mi.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=e,s=Xg(fD,r),u=mi.useRef(null),l=XC(t,u);return DT(),(0,Zo.jsxs)(Zo.Fragment,{children:[(0,Zo.jsx)(gRe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Zo.jsx)(pRe,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":CRe(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,Zo.jsxs)(Zo.Fragment,{children:[(0,Zo.jsx)(bhn,{titleId:s.titleId}),(0,Zo.jsx)(vhn,{contentRef:u,descriptionId:s.descriptionId})]})]})}),xRe="DialogTitle",xqt=mi.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,o=Xg(xRe,r);return(0,Zo.jsx)(Hp.h2,{id:o.titleId,...n,ref:t})});xqt.displayName=xRe;var Cqt="DialogDescription",Oqt=mi.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,o=Xg(Cqt,r);return(0,Zo.jsx)(Hp.p,{id:o.descriptionId,...n,ref:t})});Oqt.displayName=Cqt;var Eqt="DialogClose",Pqt=mi.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,o=Xg(Eqt,r);return(0,Zo.jsx)(Hp.button,{type:"button",...n,ref:t,onClick:iS(e.onClick,()=>o.onOpenChange(!1))})});Pqt.displayName=Eqt;function CRe(e){return e?"open":"closed"}var Tqt="DialogTitleWarning",[fWo,Mqt]=eDt(Tqt,{contentName:fD,titleName:xRe,docsSlug:"dialog"}),bhn=({titleId:e})=>{let t=Mqt(Tqt),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return mi.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},_hn="DialogDescriptionWarning",vhn=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Mqt(_hn).contentName}}.`;return mi.useEffect(()=>{let o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Iqt=mqt,Aqt=yqt,Rqt=_qt,ORe=vqt,ERe=wqt,PRe=xqt,TRe=Oqt,Dqt=Pqt;var cM=Iqt,jqt=Aqt,Shn=Rqt;var Nqt=Ec.forwardRef(({className:e,...t},r)=>Ec.createElement(ORe,{ref:r,className:_e("fixed inset-0 z-modal data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","bg-overlay/50",e),...t}));Nqt.displayName=ORe.displayName;var QC=Ec.forwardRef(({className:e,children:t,container:r,...n},o)=>Ec.createElement(Shn,{container:r},Ec.createElement(Nqt,null),Ec.createElement(ERe,{ref:o,className:_e("fixed left-[50%] top-[50%] z-modal grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-primary p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n},t,Ec.createElement(Dqt,{className:"absolute border-none right-4 top-4 text-faint clickable-icon bg-transparent hover:bg-opacity-100 hover:text-normal hover:bg-transparent outline-none focus-visible:outline-none focus-visible:text-normal focus-visible:ring-0"},Ec.createElement(bh,{className:"h-4 w-4"}),Ec.createElement("span",{className:"sr-only"},"Close")))));QC.displayName=ERe.displayName;var eO=({className:e,...t})=>Ec.createElement("div",{className:_e("flex flex-col space-y-0.5 text-center sm:text-left",e),...t});eO.displayName="DialogHeader";var xhn=({className:e,...t})=>Ec.createElement("div",{className:_e("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});xhn.displayName="DialogFooter";var tO=Ec.forwardRef(({className:e,...t},r)=>Ec.createElement(PRe,{ref:r,className:_e("text-lg font-semibold leading-none tracking-tight mt-0",e),...t}));tO.displayName=PRe.displayName;var rO=Ec.forwardRef(({className:e,...t},r)=>Ec.createElement(TRe,{ref:r,className:_e("text-sm text-muted",e),...t}));rO.displayName=TRe.displayName;var fM=B(Y());var pD=B(Y());var oi=B(Y(),1);function m$(e,[t,r]){return Math.min(r,Math.max(t,e))}function Bo(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}var dM=B(Y(),1);var nO=B(Y(),1),Lqt=B(lt(),1);function Fqt(e,t=[]){let r=[];function n(i,a){let s=nO.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...h}=d,m=f?.[e][u]||s,_=nO.useMemo(()=>h,Object.values(h));return(0,Lqt.jsx)(m.Provider,{value:_,children:p})}function c(d,f){let p=f?.[e][u]||s,h=nO.useContext(p);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>nO.createContext(a));return function(s){let u=s?.[e]||i;return nO.useMemo(()=>({[`__scope${e}`]:{...s,[e]:u}}),[s,u])}};return o.scopeName=e,[n,Chn(o,...t)]}function Chn(...e){let t=e[0];if(e.length===1)return t;let r=()=>{let n=e.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 nO.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}var Zie=B(lt(),1);function Xie(e){let t=e+"CollectionProvider",[r,n]=Fqt(t),[o,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:h,children:m}=p,_=dM.default.useRef(null),g=dM.default.useRef(new Map).current;return(0,Zie.jsx)(o,{scope:h,itemMap:g,collectionRef:_,children:m})};a.displayName=t;let s=e+"CollectionSlot",u=dM.default.forwardRef((p,h)=>{let{scope:m,children:_}=p,g=i(s,m),v=Vo(h,g.collectionRef);return(0,Zie.jsx)(Sy,{ref:v,children:_})});u.displayName=s;let l=e+"CollectionItemSlot",c="data-radix-collection-item",d=dM.default.forwardRef((p,h)=>{let{scope:m,children:_,...g}=p,v=dM.default.useRef(null),S=Vo(h,v),x=i(l,m);return dM.default.useEffect(()=>(x.itemMap.set(v,{ref:v,...g}),()=>void x.itemMap.delete(v))),(0,Zie.jsx)(Sy,{[c]:"",ref:S,children:_})});d.displayName=l;function f(p){let h=i(e+"CollectionConsumer",p);return dM.default.useCallback(()=>{let _=h.collectionRef.current;if(!_)return[];let g=Array.from(_.querySelectorAll(`[${c}]`));return Array.from(h.itemMap.values()).sort((x,O)=>g.indexOf(x.ref.current)-g.indexOf(O.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var il=B(lt(),1),kqt=["PageUp","PageDown"],Bqt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],$qt={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},g$="Slider",[MRe,Ohn,Ehn]=Xie(g$),[qqt,DWo]=Ro(g$,[Ehn]),[Phn,Qie]=qqt(g$),Uqt=oi.forwardRef((e,t)=>{let{name:r,min:n=0,max:o=100,step:i=1,orientation:a="horizontal",disabled:s=!1,minStepsBetweenThumbs:u=0,defaultValue:l=[n],value:c,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:h,...m}=e,_=oi.useRef(new Set),g=oi.useRef(0),S=a==="horizontal"?Thn:Mhn,[x=[],O]=tl({prop:c,defaultProp:l,onChange:N=>{[..._.current][g.current]?.focus(),d(N)}}),T=oi.useRef(x);function E(N){let F=jhn(x,N);j(N,F)}function M(N){j(N,g.current)}function A(){let N=T.current[g.current];x[g.current]!==N&&f(x)}function j(N,F,{commit:k}={commit:!1}){let L=khn(i),q=Bhn(Math.round((N-n)/i)*i+n,L),U=m$(q,[n,o]);O((G=[])=>{let V=Rhn(G,U,F);if(Fhn(V,u*i)){g.current=V.indexOf(U);let D=String(V)!==String(G);return D&&k&&f(V),D?V:G}else return G})}return(0,il.jsx)(Phn,{scope:e.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:_.current,values:x,orientation:a,form:h,children:(0,il.jsx)(MRe.Provider,{scope:e.__scopeSlider,children:(0,il.jsx)(MRe.Slot,{scope:e.__scopeSlider,children:(0,il.jsx)(S,{"aria-disabled":s,"data-disabled":s?"":void 0,...m,ref:t,onPointerDown:Bo(m.onPointerDown,()=>{s||(T.current=x)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:E,onSlideMove:s?void 0:M,onSlideEnd:s?void 0:A,onHomeKeyDown:()=>!s&&j(n,0,{commit:!0}),onEndKeyDown:()=>!s&&j(o,x.length-1,{commit:!0}),onStepKeyDown:({event:N,direction:F})=>{if(!s){let q=kqt.includes(N.key)||N.shiftKey&&Bqt.includes(N.key)?10:1,U=g.current,G=x[U],V=i*q*F;j(G+V,U,{commit:!0})}}})})})})});Uqt.displayName=g$;var[zqt,Hqt]=qqt(g$,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Thn=oi.forwardRef((e,t)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=e,[d,f]=oi.useState(null),p=Vo(t,S=>f(S)),h=oi.useRef(),m=RT(o),_=m==="ltr",g=_&&!i||!_&&i;function v(S){let x=h.current||d.getBoundingClientRect(),O=[0,x.width],E=RRe(O,g?[r,n]:[n,r]);return h.current=x,E(S-x.left)}return(0,il.jsx)(zqt,{scope:e.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:(0,il.jsx)(Vqt,{dir:m,"data-orientation":"horizontal",...c,ref:p,style:{...c.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:S=>{let x=v(S.clientX);a?.(x)},onSlideMove:S=>{let x=v(S.clientX);s?.(x)},onSlideEnd:()=>{h.current=void 0,u?.()},onStepKeyDown:S=>{let O=$qt[g?"from-left":"from-right"].includes(S.key);l?.({event:S,direction:O?-1:1})}})})}),Mhn=oi.forwardRef((e,t)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=e,c=oi.useRef(null),d=Vo(t,c),f=oi.useRef(),p=!o;function h(m){let _=f.current||c.current.getBoundingClientRect(),g=[0,_.height],S=RRe(g,p?[n,r]:[r,n]);return f.current=_,S(m-_.top)}return(0,il.jsx)(zqt,{scope:e.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,il.jsx)(Vqt,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{let _=h(m.clientY);i?.(_)},onSlideMove:m=>{let _=h(m.clientY);a?.(_)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:m=>{let g=$qt[p?"from-bottom":"from-top"].includes(m.key);u?.({event:m,direction:g?-1:1})}})})}),Vqt=oi.forwardRef((e,t)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=e,c=Qie(g$,r);return(0,il.jsx)(Ln.span,{...l,ref:t,onKeyDown:Bo(e.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):kqt.concat(Bqt).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:Bo(e.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:Bo(e.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:Bo(e.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),Wqt="SliderTrack",Jqt=oi.forwardRef((e,t)=>{let{__scopeSlider:r,...n}=e,o=Qie(Wqt,r);return(0,il.jsx)(Ln.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:t})});Jqt.displayName=Wqt;var IRe="SliderRange",Gqt=oi.forwardRef((e,t)=>{let{__scopeSlider:r,...n}=e,o=Qie(IRe,r),i=Hqt(IRe,r),a=oi.useRef(null),s=Vo(t,a),u=o.values.length,l=o.values.map(f=>Yqt(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,il.jsx)(Ln.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...e.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});Gqt.displayName=IRe;var ARe="SliderThumb",Kqt=oi.forwardRef((e,t)=>{let r=Ohn(e.__scopeSlider),[n,o]=oi.useState(null),i=Vo(t,s=>o(s)),a=oi.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,il.jsx)(Ihn,{...e,ref:i,index:a})}),Ihn=oi.forwardRef((e,t)=>{let{__scopeSlider:r,index:n,name:o,...i}=e,a=Qie(ARe,r),s=Hqt(ARe,r),[u,l]=oi.useState(null),c=Vo(t,v=>l(v)),d=u?a.form||!!u.closest("form"):!0,f=_m(u),p=a.values[n],h=p===void 0?0:Yqt(p,a.min,a.max),m=Dhn(n,a.values.length),_=f?.[s.size],g=_?Nhn(_,h,s.direction):0;return oi.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,il.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${h}% + ${g}px)`},children:[(0,il.jsx)(MRe.ItemSlot,{scope:e.__scopeSlider,children:(0,il.jsx)(Ln.span,{role:"slider","aria-label":e["aria-label"]||m,"aria-valuemin":a.min,"aria-valuenow":p,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:c,style:p===void 0?{display:"none"}:e.style,onFocus:Bo(e.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,il.jsx)(Ahn,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});Kqt.displayName=ARe;var Ahn=e=>{let{value:t,...r}=e,n=oi.useRef(null),o=o$(t);return oi.useEffect(()=>{let i=n.current,a=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(a,"value").set;if(o!==t&&u){let l=new Event("input",{bubbles:!0});u.call(i,t),i.dispatchEvent(l)}},[o,t]),(0,il.jsx)("input",{style:{display:"none"},...r,ref:n,defaultValue:t})};function Rhn(e=[],t,r){let n=[...e];return n[r]=t,n.sort((o,i)=>o-i)}function Yqt(e,t,r){let i=100/(r-t)*(e-t);return m$(i,[0,100])}function Dhn(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function jhn(e,t){if(e.length===1)return 0;let r=e.map(o=>Math.abs(o-t)),n=Math.min(...r);return r.indexOf(n)}function Nhn(e,t,r){let n=e/2,i=RRe([0,50],[0,n]);return(n-i(t)*r)*r}function Lhn(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function Fhn(e,t){if(t>0){let r=Lhn(e);return Math.min(...r)>=t}return!0}function RRe(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function khn(e){return(String(e).split(".")[1]||"").length}function Bhn(e,t){let r=Math.pow(10,t);return Math.round(e*r)/r}var DRe=Uqt,Zqt=Jqt,Xqt=Gqt,Qqt=Kqt;var jRe=pD.forwardRef(({className:e,...t},r)=>pD.createElement(DRe,{ref:r,className:_e("relative flex w-full touch-none select-none items-center",e),...t},pD.createElement(Zqt,{className:"relative h-1.5 w-full grow overflow-hidden border border-solid border-interactive-accent/30 rounded-full bg-interactive-accent/20"},pD.createElement(Xqt,{className:"absolute h-full bg-interactive-accent"})),pD.createElement(Qqt,{className:"block h-4 w-4 rounded-full border bg-toggle-thumb shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})));jRe.displayName=DRe.displayName;function eUt({value:e,onChange:t,min:r,max:n,step:o,disabled:i,className:a}){let[s,u]=(0,fM.useState)(e);return(0,fM.useEffect)(()=>{u(e)},[e]),fM.default.createElement("div",{className:_e("flex items-center gap-4",a)},fM.default.createElement(jRe,{value:[s],onValueChange:([l])=>u(l),onValueCommit:([l])=>t?.(l),min:r,max:n,step:o,disabled:i,className:"flex-1"}),fM.default.createElement("div",{className:"min-w-[40px] text-sm text-right"},s))}function Eo(e){let{title:t,description:r,className:n,disabled:o}=e,{modalContainer:i}=oS(),a="onChange"in e?e.onChange:void 0,s=(0,ji.useMemo)(()=>{if(a)return dBe(l=>{a(l)},1e3)},[a]),u=()=>{switch(e.type){case"text":case"number":return ji.default.createElement(ri,{type:e.type,defaultValue:e.value,onChange:l=>{s?.(l.target.value)},placeholder:e.placeholder,disabled:o,className:"w-full sm:w-[200px]"});case"password":return ji.default.createElement(uM,{value:e.value!==void 0?String(e.value):void 0,onChange:l=>{s?.(l)},placeholder:e.placeholder,disabled:o,className:"w-full sm:w-[200px]"});case"textarea":return ji.default.createElement(R1,{defaultValue:e.value,onChange:l=>{s?.(l.target.value)},placeholder:e.placeholder,rows:e.rows||3,disabled:o,className:"w-full sm:w-[300px] min-h-[80px]"});case"switch":return ji.default.createElement(VB,{checked:e.checked,onCheckedChange:e.onCheckedChange,disabled:o});case"select":return ji.default.createElement("div",{className:"relative w-full sm:w-[200px] group"},ji.default.createElement("select",{value:e.value?.toString(),onChange:l=>e.onChange?.(l.target.value),disabled:o,className:_e("w-full appearance-none","flex h-9 rounded-md border border-solid border-border bg-dropdown px-3 py-1 pr-8","text-sm !shadow transition-colors","focus:outline-none focus:ring-1 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-interactive-hover hover:text-normal")},e.placeholder&&ji.default.createElement("option",{value:"",disabled:!0},e.placeholder),e.options.map(l=>ji.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),ji.default.createElement("div",{className:_e("pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2","transition-colors group-hover:[&>svg]:text-normal",o&&"opacity-50")},ji.default.createElement(us,{className:"h-4 w-4"})));case"slider":return ji.default.createElement(eUt,{value:e.value||0,onChange:e.onChange,min:e.min,max:e.max,step:e.step,disabled:o,className:"w-full sm:w-[300px]"});case"dialog":return ji.default.createElement(cM,null,ji.default.createElement(jqt,{asChild:!0},e.trigger),ji.default.createElement(QC,{container:i},(e.dialogTitle||e.dialogDescription)&&ji.default.createElement(eO,null,e.dialogTitle&&ji.default.createElement(tO,null,e.dialogTitle),e.dialogDescription&&ji.default.createElement(rO,null,e.dialogDescription)),e.children));case"custom":return e.children}};return ji.default.createElement("div",{className:_e("flex flex-col sm:flex-row items-start sm:items-center justify-between py-4 gap-4","w-full",n)},ji.default.createElement("div",{className:"space-y-1.5 w-full sm:w-[300px]"},ji.default.createElement("div",{className:"text-sm font-medium leading-none"},t),r&&ji.default.createElement("div",{className:"text-xs text-muted"},r)),ji.default.createElement("div",{className:"flex-1 w-full sm:flex sm:justify-end"},u()))}var tUt=()=>{let e=Uo();return hD.default.createElement("div",{className:"space-y-4"},hD.default.createElement("section",null,hD.default.createElement(Eo,{type:"textarea",title:"User System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!",value:e.userSystemPrompt,onChange:t=>xt("userSystemPrompt",t),placeholder:"Enter your system prompt here..."}),hD.default.createElement("div",{className:"space-y-4"},hD.default.createElement(Eo,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:e.enableEncryption,onCheckedChange:t=>{xt("enableEncryption",t)}}),hD.default.createElement(Eo,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:e.debug,onCheckedChange:t=>{xt("debug",t)}}))))};var y$=class extends n${constructor(t,r){super(t,r,"Changing this setting means you have to rebuild the index for your entire vault, do you wish to proceed?","Rebuild Index")}};var b$=require("obsidian"),Me=B(Y());var eae=require("obsidian"),ka=B(Y()),qhn=({open:e,onOpenChange:t,settings:r,updateSetting:n,modalContainer:o})=>{let[i,a]=(0,ka.useState)(new Set),[s,u]=(0,ka.useState)(new Set),l=h=>{h?u(new Set):s.forEach(m=>{let _=DO[m];n(_,"")}),t(h)},c=h=>{let m=DO[h];return r[m]??""},d=zle().map(h=>{let m=h,_=c(m);return{provider:m,apiKey:_,isVerified:!!_&&!s.has(m)}}),f=(h,m)=>{c(h)!==m&&(n(DO[h],m),u(g=>new Set(g).add(h)))},p=async(h,m)=>{a(_=>new Set(_).add(h));try{r.debug&&console.log(`Verifying ${h} API key:`,m);let _=sI(h).testModel;if(!_){new eae.Notice("API key verification failed: No default test model found for the selected provider.",1e4);return}let g={name:_,provider:h,apiKey:m,enabled:!0};await zd.getInstance().ping(g),new eae.Notice("API key verified successfully!"),u(v=>{let S=new Set(v);return S.delete(h),S})}catch(_){console.error("API key verification failed:",_),new eae.Notice("API key verification failed: "+bi(_),1e4)}finally{a(_=>{let g=new Set(_);return g.delete(h),g})}};return ka.default.createElement(cM,{open:e,onOpenChange:l},ka.default.createElement(QC,{container:o,className:"sm:max-w-[480px]"},ka.default.createElement(eO,null,ka.default.createElement(tO,null,"AI Provider Settings"),ka.default.createElement(rO,null,"Configure your AI providers by adding their API keys.")),ka.default.createElement("div",{className:"space-y-6 py-4"},ka.default.createElement("div",{className:"space-y-4"},d.map(h=>ka.default.createElement("div",{key:h.provider,className:"flex items-center gap-2"},ka.default.createElement("div",{className:"w-[120px] font-medium"},ka.default.createElement("div",{className:"truncate"},uh(h.provider)),sI(h.provider).keyManagementURL&&ka.default.createElement("a",{href:sI(h.provider).keyManagementURL,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-accent hover:text-accent-hover"},"Get ",uh(h.provider)," Key")),ka.default.createElement("div",{className:"flex-1 flex items-center gap-2"},ka.default.createElement("div",{className:"flex-1 pr-2"},ka.default.createElement(uM,{className:"w-full",value:h.apiKey,onChange:m=>f(h.provider,m),disabled:i.has(h.provider)})),ka.default.createElement("div",{className:"w-[72px]"},h.isVerified?ka.default.createElement("span",{className:"text-success text-sm flex items-center justify-center h-9"},"Verified"):ka.default.createElement(qe,{onClick:()=>p(h.provider,h.apiKey),disabled:!h.apiKey||i.size>0,variant:"secondary",size:"sm",className:"w-full whitespace-nowrap"},i.has(h.provider)?ka.default.createElement(Uc,{className:"mr-2 h-4 w-4 animate-spin"}):"Verify")))))))))},rUt=qhn;var Nu=B(Y()),nUt=require("obsidian"),oUt=B(gh());function Uhn({onConfirm:e,onCancel:t}){let r=pe();return Nu.default.createElement("div",{className:"flex flex-col gap-4"},Nu.default.createElement("div",null,Nu.default.createElement("p",null,"Thanks for purchasing ",Nu.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!"),Nu.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),Nu.default.createElement("ul",{className:"pl-4"},Nu.default.createElement("li",null,"Default mode: ",Nu.default.createElement("b",{className:"text-accent"},"Copilot Plus")),Nu.default.createElement("li",null,"Chat model: ",Nu.default.createElement("b",{className:"text-accent"},TCe)),Nu.default.createElement("li",null,Nu.default.createElement("div",null,"Embedding model: ",Nu.default.createElement("b",{className:"text-accent"},MCe)),r.embeddingModelKey!==ICe&&Nu.default.createElement("div",{className:"text-sm text-warning flex items-center gap-1"},Nu.default.createElement(yh,{className:"size-4"})," It will rebuild your embeddings for the entire vault")))),Nu.default.createElement("div",{className:"flex gap-2 justify-end w-full"},Nu.default.createElement(qe,{variant:"ghost",onClick:t},"Apply Later"),Nu.default.createElement(qe,{variant:"default",onClick:e},"Apply Now")))}var tae=class extends nUt.Modal{constructor(t){super(t),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:t}=this;this.root=(0,oUt.createRoot)(t);let r=()=>{g0t(),this.close()},n=()=>{this.close()};this.root.render(Nu.default.createElement(Uhn,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};var rs=B(Y());function iUt(){let e=Uo(),[t,r]=(0,rs.useState)(null),[n,o]=(0,rs.useState)(!1),i=HQ(),[a,s]=(0,rs.useState)(e.plusLicenseKey);return(0,rs.useEffect)(()=>{s(e.plusLicenseKey)},[e.plusLicenseKey]),rs.default.createElement("section",{className:"flex flex-col gap-4 bg-secondary p-4 rounded-lg"},rs.default.createElement("div",{className:"text-xl font-bold flex items-center gap-2 justify-between"},rs.default.createElement("span",null,"Copilot Plus (beta)"),i&&rs.default.createElement(Gg,{variant:"outline",className:"text-success"},"Active")),rs.default.createElement("div",{className:"text-sm text-muted flex flex-col gap-2"},rs.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."),rs.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!")),rs.default.createElement("div",{className:"flex items-center gap-2"},rs.default.createElement(uM,{className:"w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),rs.default.createElement(qe,{disabled:n,onClick:async()=>{xt("plusLicenseKey",a),o(!0);let u=await VQ();o(!1),u?(r(null),new tae(app).open()):r("Invalid license key")},className:"min-w-20"},n?rs.default.createElement(Uc,{className:"h-4 w-4 animate-spin"}):"Apply"),rs.default.createElement(qe,{variant:"secondary",onClick:()=>Qj(jO.SETTINGS)},"Join Now ",rs.default.createElement(II,{className:"size-4"}))),rs.default.createElement("div",{className:"text-error"},t))}var Hhn={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus (beta)"},aUt=()=>{let{modalContainer:e}=oS(),t=Uo(),[r,n]=(0,Me.useState)(!1),[o,i]=(0,Me.useState)(!1),[a,s]=(0,Me.useState)(t.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),u=async f=>{f!==t.embeddingModelKey&&new y$(app,async()=>{xt("embeddingModelKey",f),await ma.getInstance().indexVaultToVectorStore(!0)}).open()},l=()=>{i(!0);try{let f=a||"{$date}_{$time}__{$topic}",h=["{$date}","{$time}","{$topic}"].filter(x=>!f.includes(x));if(h.length>0){new b$.Notice(`Error: Missing required variables: ${h.join(", ")}`,4e3);return}let m=/[\\/:*?"<>|]/,_=f.replace(/\{\$date}/g,"").replace(/\{\$time}/g,"").replace(/\{\$topic}/g,"");if(m.test(_)){new b$.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:g}=dl(new Date),S=f.replace("{$topic}","test topic name".slice(0,100).replace(/\s+/g,"_")).replace("{$date}",g.split("_")[0]).replace("{$time}",g.split("_")[1]);xt("defaultConversationNoteName",f),s(f),new b$.Notice(`Format applied successfully! Example: ${S}`,4e3)}catch(f){new b$.Notice(`Error applying format: ${f.message}`,4e3)}finally{i(!1)}},c=!!t.activeModels.find(f=>f.enabled&&Nr(f)===t.defaultModelKey),d=t.activeModels.filter(f=>f.enabled).map(f=>({label:gMe(f),value:Nr(f)}));return Me.default.createElement("div",{className:"space-y-4"},Me.default.createElement(iUt,null),Me.default.createElement("section",null,Me.default.createElement("div",{className:"text-xl font-bold mb-3"},"General"),Me.default.createElement("div",{className:"space-y-4"},Me.default.createElement("div",{className:"space-y-4"},Me.default.createElement(Eo,{type:"custom",title:"API Keys",description:Me.default.createElement("div",{className:"flex items-center gap-1.5"},Me.default.createElement("span",{className:"leading-none"},"Configure API keys for different AI providers"),Me.default.createElement(vc,{delayDuration:0},Me.default.createElement(Yr,null,Me.default.createElement(Zr,{asChild:!0},Me.default.createElement(Hl,{className:"size-4"})),Me.default.createElement(Vr,{className:"max-w-96 flex flex-col gap-2 py-4"},Me.default.createElement("div",{className:"text-sm font-medium text-accent"},"API key required for chat and QA features"),Me.default.createElement("div",{className:"text-xs text-muted"},"To enable chat and QA functionality, please provide an API key from your selected provider.")))))},Me.default.createElement(qe,{onClick:()=>n(!0),variant:"secondary",className:"flex items-center gap-2 w-full sm:w-auto justify-center sm:justify-start"},"Set Keys",Me.default.createElement(FU,{className:"h-4 w-4"}))),Me.default.createElement(rUt,{open:r,onOpenChange:n,settings:t,updateSetting:xt,modalContainer:e})),Me.default.createElement(Eo,{type:"select",title:"Default Chat Model",description:"Select the Chat model to use",value:c?t.defaultModelKey:"Select Model",onChange:f=>{let p=t.activeModels.find(_=>_.enabled&&Nr(_)===f);if(!p)return;let{hasApiKey:h,errorNotice:m}=g5(p,t);if(!h&&m){new b$.Notice(m);return}xt("defaultModelKey",f)},options:c?d:[{label:"Select Model",value:"Select Model"},...d],placeholder:"Model"}),Me.default.createElement(Eo,{type:"select",title:"Embedding Model",description:Me.default.createElement("div",{className:"space-y-2"},Me.default.createElement("div",{className:"flex items-center gap-1.5"},Me.default.createElement("span",{className:"leading-none font-medium text-accent"},"Core Feature: Powers Semantic Search & QA"),Me.default.createElement(vc,{delayDuration:0},Me.default.createElement(Yr,null,Me.default.createElement(Zr,{asChild:!0},Me.default.createElement(Hl,{className:"size-4"})),Me.default.createElement(Vr,{className:"max-w-96 flex flex-col gap-2"},Me.default.createElement("div",{className:"text-sm text-muted pt-2"},"This model converts text into vector representations, essential for semantic search and QA functionality. Changing the embedding model will:"),Me.default.createElement("ul",{className:"text-sm text-muted pl-4"},Me.default.createElement("li",null,"Require rebuilding your vault's vector index"),Me.default.createElement("li",null,"Affect semantic search quality"),Me.default.createElement("li",null,"Impact QA feature performance"))))))),value:t.embeddingModelKey,onChange:u,options:t.activeEmbeddingModels.map(f=>({label:gMe(f),value:Nr(f)})),placeholder:"Model"}),Me.default.createElement(Eo,{type:"select",title:"Default Mode",description:Me.default.createElement("div",{className:"flex items-center gap-1.5"},Me.default.createElement("span",{className:"leading-none"},"Select the default chat mode"),Me.default.createElement(vc,{delayDuration:0},Me.default.createElement(Yr,null,Me.default.createElement(Zr,{asChild:!0},Me.default.createElement(Hl,{className:"size-4"})),Me.default.createElement(Vr,{className:"max-w-96 flex flex-col gap-2"},Me.default.createElement("ul",{className:"text-sm text-muted pl-4"},Me.default.createElement("li",null,Me.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",Me.default.createElement("i",null,"Free to use with your own API key.")),Me.default.createElement("li",null,Me.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",Me.default.createElement("i",null,"Free to use with your own API key.")),Me.default.createElement("li",null,Me.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"," ",Me.default.createElement("a",{href:ACe(jO.MODE_SELECT_TOOLTIP),target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:text-accent-hover"},"obsidiancopilot.com")," ","for more details.")))))),value:t.defaultChainType,onChange:f=>xt("defaultChainType",f),options:Object.entries(Hhn).map(([f,p])=>({label:p,value:f}))}),Me.default.createElement(Eo,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:f=>xt("defaultOpenArea",f),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),Me.default.createElement(Eo,{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:f=>xt("defaultSaveFolder",f),placeholder:"copilot-conversations"}),Me.default.createElement(Eo,{type:"text",title:"Custom Prompts Folder Name",description:"The default folder name where custom prompts will be saved. Default is 'copilot-custom-prompts'",value:t.customPromptsFolder,onChange:f=>xt("customPromptsFolder",f),placeholder:"copilot-custom-prompts"}),Me.default.createElement(Eo,{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:f=>xt("defaultConversationTag",f),placeholder:"ai-conversations"}),Me.default.createElement(Eo,{type:"custom",title:"Conversation Filename Template",description:Me.default.createElement("div",{className:"flex items-start gap-1.5 "},Me.default.createElement("span",{className:"leading-none"},"Customize the format of saved conversation note names."),Me.default.createElement(vc,{delayDuration:0},Me.default.createElement(Yr,null,Me.default.createElement(Zr,{asChild:!0},Me.default.createElement(Hl,{className:"size-4"})),Me.default.createElement(Vr,{className:"max-w-96 flex flex-col gap-2 py-4"},Me.default.createElement("div",{className:"text-sm font-medium text-accent"},"Note: All the following variables must be included in the template."),Me.default.createElement("div",null,Me.default.createElement("div",{className:"text-sm font-medium text-muted"},"Available variables:"),Me.default.createElement("ul",{className:"text-sm text-muted pl-4"},Me.default.createElement("li",null,Me.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),Me.default.createElement("li",null,Me.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),Me.default.createElement("li",null,Me.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),Me.default.createElement("i",{className:"text-sm text-muted mt-2"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]"))))))},Me.default.createElement("div",{className:"flex items-center gap-1.5 w-[320px]"},Me.default.createElement(ri,{type:"text",className:`transition-all duration-200 flex-grow min-w-[80px] ${o?"w-[80px]":"w-[120px]"}`,placeholder:"{$date}_{$time}__{$topic}",value:a,onChange:f=>s(f.target.value),disabled:o}),Me.default.createElement(qe,{onClick:()=>l(),disabled:o,variant:"secondary"},o?Me.default.createElement(Me.default.Fragment,null,Me.default.createElement(Uc,{className:"mr-2 h-4 w-4 animate-spin"}),"Apply"):"Apply"))),Me.default.createElement(Eo,{type:"switch",title:"Autosave Chat",description:"Automatically save the chat when starting a new one or when the plugin reloads",checked:t.autosaveChat,onCheckedChange:f=>xt("autosaveChat",f)}),Me.default.createElement(Eo,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:f=>xt("showSuggestedPrompts",f)}),Me.default.createElement(Eo,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:f=>xt("showRelevantNotes",f)}))))};var Zi=B(Y());var ke=B(Y());var f6=require("obsidian");var Xo=B(Y());var We=B(Y(),1),XRe=B(ss(),1);var Ca=B(Y(),1);var LRe=B(lt(),1),Vhn="DismissableLayer",NRe="dismissableLayer.update",Whn="dismissableLayer.pointerDownOutside",Jhn="dismissableLayer.focusOutside",sUt,lUt=Ca.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),FRe=Ca.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=e,l=Ca.useContext(lUt),[c,d]=Ca.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ca.useState({}),h=Vo(t,E=>d(E)),m=Array.from(l.layers),[_]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(_),v=c?m.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=v>=g,O=Yhn(E=>{let M=E.target,A=[...l.branches].some(j=>j.contains(M));!x||A||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),T=Zhn(E=>{let M=E.target;[...l.branches].some(j=>j.contains(M))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return Zw(E=>{v===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Ca.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(sUt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),uUt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=sUt)}},[c,f,r,l]),Ca.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),uUt())},[c,l]),Ca.useEffect(()=>{let E=()=>p({});return document.addEventListener(NRe,E),()=>document.removeEventListener(NRe,E)},[]),(0,LRe.jsx)(Ln.div,{...u,ref:h,style:{pointerEvents:S?x?"auto":"none":void 0,...e.style},onFocusCapture:Bo(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Bo(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Bo(e.onPointerDownCapture,O.onPointerDownCapture)})});FRe.displayName=Vhn;var Ghn="DismissableLayerBranch",Khn=Ca.forwardRef((e,t)=>{let r=Ca.useContext(lUt),n=Ca.useRef(null),o=Vo(t,n);return Ca.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,LRe.jsx)(Ln.div,{...e,ref:o})});Khn.displayName=Ghn;function Yhn(e,t=globalThis?.document){let r=Gt(e),n=Ca.useRef(!1),o=Ca.useRef(()=>{});return Ca.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){cUt(Whn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Zhn(e,t=globalThis?.document){let r=Gt(e),n=Ca.useRef(!1);return Ca.useEffect(()=>{let o=i=>{i.target&&!n.current&&cUt(Jhn,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function uUt(){let e=new CustomEvent(NRe);document.dispatchEvent(e)}function cUt(e,t,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?DBt(o,i):o.dispatchEvent(i)}var Em=B(Y(),1);var mUt=B(lt(),1),kRe="focusScope.autoFocusOnMount",BRe="focusScope.autoFocusOnUnmount",dUt={bubbles:!1,cancelable:!0},Xhn="FocusScope",$Re=Em.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[s,u]=Em.useState(null),l=Gt(o),c=Gt(i),d=Em.useRef(null),f=Vo(t,m=>u(m)),p=Em.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Em.useEffect(()=>{if(n){let v=function(T){if(p.paused||!s)return;let E=T.target;s.contains(E)?d.current=E:pM(d.current,{select:!0})},S=function(T){if(p.paused||!s)return;let E=T.relatedTarget;E!==null&&(s.contains(E)||pM(d.current,{select:!0}))},x=function(T){if(document.activeElement===document.body)for(let M of T)M.removedNodes.length>0&&pM(s)};var m=v,_=S,g=x;document.addEventListener("focusin",v),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),Em.useEffect(()=>{if(s){pUt.add(p);let m=document.activeElement;if(!s.contains(m)){let g=new CustomEvent(kRe,dUt);s.addEventListener(kRe,l),s.dispatchEvent(g),g.defaultPrevented||(Qhn(omn(gUt(s)),{select:!0}),document.activeElement===m&&pM(s))}return()=>{s.removeEventListener(kRe,l),setTimeout(()=>{let g=new CustomEvent(BRe,dUt);s.addEventListener(BRe,c),s.dispatchEvent(g),g.defaultPrevented||pM(m??document.body,{select:!0}),s.removeEventListener(BRe,c),pUt.remove(p)},0)}}},[s,l,c,p]);let h=Em.useCallback(m=>{if(!r&&!n||p.paused)return;let _=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(_&&g){let v=m.currentTarget,[S,x]=emn(v);S&&x?!m.shiftKey&&g===x?(m.preventDefault(),r&&pM(S,{select:!0})):m.shiftKey&&g===S&&(m.preventDefault(),r&&pM(x,{select:!0})):g===v&&m.preventDefault()}},[r,n,p.paused]);return(0,mUt.jsx)(Ln.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});$Re.displayName=Xhn;function Qhn(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(pM(n,{select:t}),document.activeElement!==r)return}function emn(e){let t=gUt(e),r=fUt(t,e),n=fUt(t.reverse(),e);return[r,n]}function gUt(e){let t=[],r=document.createTreeWalker(e,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();)t.push(r.currentNode);return t}function fUt(e,t){for(let r of e)if(!tmn(r,{upTo:t}))return r}function tmn(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function rmn(e){return e instanceof HTMLInputElement&&"select"in e}function pM(e,{select:t=!1}={}){if(e&&e.focus){let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&rmn(e)&&t&&e.select()}}var pUt=nmn();function nmn(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),e=hUt(e,t),e.unshift(t)},remove(t){e=hUt(e,t),e[0]?.resume()}}}function hUt(e,t){let r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function omn(e){return e.filter(t=>t.tagName!=="A")}var Vp=B(Y(),1);var yUt=B(Y(),1);var qRe=B(lt(),1),imn="Arrow",bUt=yUt.forwardRef((e,t)=>{let{children:r,width:n=10,height:o=5,...i}=e;return(0,qRe.jsx)(Ln.svg,{...i,ref:t,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,qRe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});bUt.displayName=imn;var _Ut=bUt;var oO=B(Y(),1),vUt=B(lt(),1);function wUt(e,t=[]){let r=[];function n(i,a){let s=oO.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...h}=d,m=f?.[e][u]||s,_=oO.useMemo(()=>h,Object.values(h));return(0,vUt.jsx)(m.Provider,{value:_,children:p})}function c(d,f){let p=f?.[e][u]||s,h=oO.useContext(p);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>oO.createContext(a));return function(s){let u=s?.[e]||i;return oO.useMemo(()=>({[`__scope${e}`]:{...s,[e]:u}}),[s,u])}};return o.scopeName=e,[n,smn(o,...t)]}function smn(...e){let t=e[0];if(e.length===1)return t;let r=()=>{let n=e.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 oO.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}var hM=B(lt(),1);var URe="Popper",[SUt,zRe]=wUt(URe),[umn,xUt]=SUt(URe),CUt=e=>{let{__scopePopper:t,children:r}=e,[n,o]=Vp.useState(null);return(0,hM.jsx)(umn,{scope:t,anchor:n,onAnchorChange:o,children:r})};CUt.displayName=URe;var OUt="PopperAnchor",EUt=Vp.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:n,...o}=e,i=xUt(OUt,r),a=Vp.useRef(null),s=Vo(t,a);return Vp.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,hM.jsx)(Ln.div,{...o,ref:s})});EUt.displayName=OUt;var HRe="PopperContent",[lmn,cmn]=SUt(HRe),PUt=Vp.forwardRef((e,t)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:h,...m}=e,_=xUt(HRe,r),[g,v]=Vp.useState(null),S=Vo(t,ne=>v(ne)),[x,O]=Vp.useState(null),T=_m(x),E=T?.width??0,M=T?.height??0,A=n+(i!=="center"?"-"+i:""),j=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],F=N.length>0,k={padding:j,boundary:N.filter(fmn),altBoundary:F},{refs:L,floatingStyles:q,placement:U,isPositioned:G,middlewareData:V}=NT({strategy:"fixed",placement:A,whileElementsMounted:(...ne)=>KC(...ne,{animationFrame:p==="always"}),elements:{reference:_.anchor},middleware:[LT({mainAxis:o+M,alignmentAxis:a}),u&&FT({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?kT():void 0,...k}),u&&BT({...k}),$T({...k,apply:({elements:ne,rects:Pe,availableWidth:ht,availableHeight:we})=>{let{width:ae,height:ee}=Pe.reference,ge=ne.floating.style;ge.setProperty("--radix-popper-available-width",`${ht}px`),ge.setProperty("--radix-popper-available-height",`${we}px`),ge.setProperty("--radix-popper-anchor-width",`${ae}px`),ge.setProperty("--radix-popper-anchor-height",`${ee}px`)}}),x&&UT({element:x,padding:s}),pmn({arrowWidth:E,arrowHeight:M}),f&&qT({strategy:"referenceHidden",...k})]}),[D,z]=IUt(U),W=Gt(h);qr(()=>{G&&W?.()},[G,W]);let J=V.arrow?.x,te=V.arrow?.y,Ie=V.arrow?.centerOffset!==0,[Z,X]=Vp.useState();return qr(()=>{g&&X(window.getComputedStyle(g).zIndex)},[g]),(0,hM.jsx)("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:G?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Z,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,hM.jsx)(lmn,{scope:r,placedSide:D,onArrowChange:O,arrowX:J,arrowY:te,shouldHideArrow:Ie,children:(0,hM.jsx)(Ln.div,{"data-side":D,"data-align":z,...m,ref:S,style:{...m.style,animation:G?void 0:"none"}})})})});PUt.displayName=HRe;var TUt="PopperArrow",dmn={top:"bottom",right:"left",bottom:"top",left:"right"},MUt=Vp.forwardRef(function(t,r){let{__scopePopper:n,...o}=t,i=cmn(TUt,n),a=dmn[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)(_Ut,{...o,ref:r,style:{...o.style,display:"block"}})})});MUt.displayName=TUt;function fmn(e){return e!==null}var pmn=e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:o}=t,a=o.arrow?.centerOffset!==0,s=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[l,c]=IUt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,h="",m="";return l==="bottom"?(h=a?d:`${f}px`,m=`${-u}px`):l==="top"?(h=a?d:`${f}px`,m=`${n.floating.height+u}px`):l==="right"?(h=`${-u}px`,m=a?d:`${p}px`):l==="left"&&(h=`${n.floating.width+u}px`,m=a?d:`${p}px`),{data:{x:h,y:m}}}});function IUt(e){let[t,r="center"]=e.split("-");return[t,r]}var AUt=CUt,RUt=EUt,DUt=PUt,jUt=MUt;var rae=B(Y(),1),NUt=B(ss(),1);var LUt=B(lt(),1),mmn="Portal",VRe=rae.forwardRef((e,t)=>{let{container:r,...n}=e,[o,i]=rae.useState(!1);qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?NUt.default.createPortal((0,LUt.jsx)(Ln.div,{...n,ref:t}),a):null});VRe.displayName=mmn;var FUt=B(Y(),1);var kUt=B(lt(),1),gmn="VisuallyHidden",WRe=FUt.forwardRef((e,t)=>(0,kUt.jsx)(Ln.span,{...e,ref:t,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",...e.style}}));WRe.displayName=gmn;var kt=B(lt(),1),ymn=[" ","Enter","ArrowUp","ArrowDown"],bmn=[" ","Enter"],d6="Select",[oae,iae,_mn]=Xie(d6),[_$,DGo]=Ro(d6,[_mn,zRe]),aae=zRe(),[vmn,mM]=_$(d6),[wmn,Smn]=_$(d6),BUt=e=>{let{__scopeSelect:t,children:r,open:n,defaultOpen:o,onOpenChange:i,value:a,defaultValue:s,onValueChange:u,dir:l,name:c,autoComplete:d,disabled:f,required:p,form:h}=e,m=aae(t),[_,g]=We.useState(null),[v,S]=We.useState(null),[x,O]=We.useState(!1),T=RT(l),[E=!1,M]=tl({prop:n,defaultProp:o,onChange:i}),[A,j]=tl({prop:a,defaultProp:s,onChange:u}),N=We.useRef(null),F=_?h||!!_.closest("form"):!0,[k,L]=We.useState(new Set),q=Array.from(k).map(U=>U.props.value).join(";");return(0,kt.jsx)(AUt,{...m,children:(0,kt.jsxs)(vmn,{required:p,scope:t,trigger:_,onTriggerChange:g,valueNode:v,onValueNodeChange:S,valueNodeHasChildren:x,onValueNodeHasChildrenChange:O,contentId:Fa(),value:A,onValueChange:j,open:E,onOpenChange:M,dir:T,triggerPointerDownPosRef:N,disabled:f,children:[(0,kt.jsx)(oae.Provider,{scope:t,children:(0,kt.jsx)(wmn,{scope:e.__scopeSelect,onNativeOptionAdd:We.useCallback(U=>{L(G=>new Set(G).add(U))},[]),onNativeOptionRemove:We.useCallback(U=>{L(G=>{let V=new Set(G);return V.delete(U),V})},[]),children:r})}),F?(0,kt.jsxs)(czt,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:A,onChange:U=>j(U.target.value),disabled:f,form:h,children:[A===void 0?(0,kt.jsx)("option",{value:""}):null,Array.from(k)]},q):null]})})};BUt.displayName=d6;var $Ut="SelectTrigger",qUt=We.forwardRef((e,t)=>{let{__scopeSelect:r,disabled:n=!1,...o}=e,i=aae(r),a=mM($Ut,r),s=a.disabled||n,u=Vo(t,a.onTriggerChange),l=iae(r),c=We.useRef("touch"),[d,f,p]=dzt(m=>{let _=l().filter(S=>!S.disabled),g=_.find(S=>S.value===a.value),v=fzt(_,m,g);v!==void 0&&a.onValueChange(v.value)}),h=m=>{s||(a.onOpenChange(!0),p()),m&&(a.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return(0,kt.jsx)(RUt,{asChild:!0,...i,children:(0,kt.jsx)(Ln.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":lzt(a.value)?"":void 0,...o,ref:u,onClick:Bo(o.onClick,m=>{m.currentTarget.focus(),c.current!=="mouse"&&h(m)}),onPointerDown:Bo(o.onPointerDown,m=>{c.current=m.pointerType;let _=m.target;_.hasPointerCapture(m.pointerId)&&_.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(h(m),m.preventDefault())}),onKeyDown:Bo(o.onKeyDown,m=>{let _=d.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&f(m.key),!(_&&m.key===" ")&&ymn.includes(m.key)&&(h(),m.preventDefault())})})})});qUt.displayName=$Ut;var UUt="SelectValue",zUt=We.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=e,u=mM(UUt,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=Vo(t,u.onValueNodeChange);return qr(()=>{l(c)},[l,c]),(0,kt.jsx)(Ln.span,{...s,ref:d,style:{pointerEvents:"none"},children:lzt(u.value)?(0,kt.jsx)(kt.Fragment,{children:a}):i})});zUt.displayName=UUt;var xmn="SelectIcon",HUt=We.forwardRef((e,t)=>{let{__scopeSelect:r,children:n,...o}=e;return(0,kt.jsx)(Ln.span,{"aria-hidden":!0,...o,ref:t,children:n||"\u25BC"})});HUt.displayName=xmn;var Cmn="SelectPortal",VUt=e=>(0,kt.jsx)(VRe,{asChild:!0,...e});VUt.displayName=Cmn;var mD="SelectContent",WUt=We.forwardRef((e,t)=>{let r=mM(mD,e.__scopeSelect),[n,o]=We.useState();if(qr(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?XRe.createPortal((0,kt.jsx)(JUt,{scope:e.__scopeSelect,children:(0,kt.jsx)(oae.Slot,{scope:e.__scopeSelect,children:(0,kt.jsx)("div",{children:e.children})})}),i):null}return(0,kt.jsx)(GUt,{...e,ref:t})});WUt.displayName=mD;var Qg=10,[JUt,gM]=_$(mD),Omn="SelectContentImpl",GUt=We.forwardRef((e,t)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:m,avoidCollisions:_,...g}=e,v=mM(mD,r),[S,x]=We.useState(null),[O,T]=We.useState(null),E=Vo(t,ne=>x(ne)),[M,A]=We.useState(null),[j,N]=We.useState(null),F=iae(r),[k,L]=We.useState(!1),q=We.useRef(!1);We.useEffect(()=>{if(S)return WT(S)},[S]),DT();let U=We.useCallback(ne=>{let[Pe,...ht]=F().map(ee=>ee.ref.current),[we]=ht.slice(-1),ae=document.activeElement;for(let ee of ne)if(ee===ae||(ee?.scrollIntoView({block:"nearest"}),ee===Pe&&O&&(O.scrollTop=0),ee===we&&O&&(O.scrollTop=O.scrollHeight),ee?.focus(),document.activeElement!==ae))return},[F,O]),G=We.useCallback(()=>U([M,S]),[U,M,S]);We.useEffect(()=>{k&&G()},[k,G]);let{onOpenChange:V,triggerPointerDownPosRef:D}=v;We.useEffect(()=>{if(S){let ne={x:0,y:0},Pe=we=>{ne={x:Math.abs(Math.round(we.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(we.pageY)-(D.current?.y??0))}},ht=we=>{ne.x<=10&&ne.y<=10?we.preventDefault():S.contains(we.target)||V(!1),document.removeEventListener("pointermove",Pe),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",Pe),document.addEventListener("pointerup",ht,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Pe),document.removeEventListener("pointerup",ht,{capture:!0})}}},[S,V,D]),We.useEffect(()=>{let ne=()=>V(!1);return window.addEventListener("blur",ne),window.addEventListener("resize",ne),()=>{window.removeEventListener("blur",ne),window.removeEventListener("resize",ne)}},[V]);let[z,W]=dzt(ne=>{let Pe=F().filter(ae=>!ae.disabled),ht=Pe.find(ae=>ae.ref.current===document.activeElement),we=fzt(Pe,ne,ht);we&&setTimeout(()=>we.ref.current.focus())}),J=We.useCallback((ne,Pe,ht)=>{let we=!q.current&&!ht;(v.value!==void 0&&v.value===Pe||we)&&(A(ne),we&&(q.current=!0))},[v.value]),te=We.useCallback(()=>S?.focus(),[S]),Ie=We.useCallback((ne,Pe,ht)=>{let we=!q.current&&!ht;(v.value!==void 0&&v.value===Pe||we)&&N(ne)},[v.value]),Z=n==="popper"?JRe:KUt,X=Z===JRe?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:m,avoidCollisions:_}:{};return(0,kt.jsx)(JUt,{scope:r,content:S,viewport:O,onViewportChange:T,itemRefCallback:J,selectedItem:M,onItemLeave:te,itemTextRefCallback:Ie,focusSelectedItem:G,selectedItemText:j,position:n,isPositioned:k,searchRef:z,children:(0,kt.jsx)(l6,{as:Sy,allowPinchZoom:!0,children:(0,kt.jsx)($Re,{asChild:!0,trapped:v.open,onMountAutoFocus:ne=>{ne.preventDefault()},onUnmountAutoFocus:Bo(o,ne=>{v.trigger?.focus({preventScroll:!0}),ne.preventDefault()}),children:(0,kt.jsx)(FRe,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:ne=>ne.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,kt.jsx)(Z,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:ne=>ne.preventDefault(),...g,...X,onPlaced:()=>L(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:Bo(g.onKeyDown,ne=>{let Pe=ne.ctrlKey||ne.altKey||ne.metaKey;if(ne.key==="Tab"&&ne.preventDefault(),!Pe&&ne.key.length===1&&W(ne.key),["ArrowUp","ArrowDown","Home","End"].includes(ne.key)){let we=F().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);if(["ArrowUp","End"].includes(ne.key)&&(we=we.slice().reverse()),["ArrowUp","ArrowDown"].includes(ne.key)){let ae=ne.target,ee=we.indexOf(ae);we=we.slice(ee+1)}setTimeout(()=>U(we)),ne.preventDefault()}})})})})})})});GUt.displayName=Omn;var Emn="SelectItemAlignedPosition",KUt=We.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:n,...o}=e,i=mM(mD,r),a=gM(mD,r),[s,u]=We.useState(null),[l,c]=We.useState(null),d=Vo(t,E=>c(E)),f=iae(r),p=We.useRef(!1),h=We.useRef(!0),{viewport:m,selectedItem:_,selectedItemText:g,focusSelectedItem:v}=a,S=We.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&m&&_&&g){let E=i.trigger.getBoundingClientRect(),M=l.getBoundingClientRect(),A=i.valueNode.getBoundingClientRect(),j=g.getBoundingClientRect();if(i.dir!=="rtl"){let ae=j.left-M.left,ee=A.left-ae,ge=E.left-ee,Ue=E.width+ge,ct=Math.max(Ue,M.width),Je=window.innerWidth-Qg,cr=m$(ee,[Qg,Math.max(Qg,Je-ct)]);s.style.minWidth=Ue+"px",s.style.left=cr+"px"}else{let ae=M.right-j.right,ee=window.innerWidth-A.right-ae,ge=window.innerWidth-E.right-ee,Ue=E.width+ge,ct=Math.max(Ue,M.width),Je=window.innerWidth-Qg,cr=m$(ee,[Qg,Math.max(Qg,Je-ct)]);s.style.minWidth=Ue+"px",s.style.right=cr+"px"}let N=f(),F=window.innerHeight-Qg*2,k=m.scrollHeight,L=window.getComputedStyle(l),q=parseInt(L.borderTopWidth,10),U=parseInt(L.paddingTop,10),G=parseInt(L.borderBottomWidth,10),V=parseInt(L.paddingBottom,10),D=q+U+k+V+G,z=Math.min(_.offsetHeight*5,D),W=window.getComputedStyle(m),J=parseInt(W.paddingTop,10),te=parseInt(W.paddingBottom,10),Ie=E.top+E.height/2-Qg,Z=F-Ie,X=_.offsetHeight/2,ne=_.offsetTop+X,Pe=q+U+ne,ht=D-Pe;if(Pe<=Ie){let ae=N.length>0&&_===N[N.length-1].ref.current;s.style.bottom="0px";let ee=l.clientHeight-m.offsetTop-m.offsetHeight,ge=Math.max(Z,X+(ae?te:0)+ee+G),Ue=Pe+ge;s.style.height=Ue+"px"}else{let ae=N.length>0&&_===N[0].ref.current;s.style.top="0px";let ge=Math.max(Ie,q+m.offsetTop+(ae?J:0)+X)+ht;s.style.height=ge+"px",m.scrollTop=Pe-Ie+m.offsetTop}s.style.margin=`${Qg}px 0`,s.style.minHeight=z+"px",s.style.maxHeight=F+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,m,_,g,i.dir,n]);qr(()=>S(),[S]);let[x,O]=We.useState();qr(()=>{l&&O(window.getComputedStyle(l).zIndex)},[l]);let T=We.useCallback(E=>{E&&h.current===!0&&(S(),v?.(),h.current=!1)},[S,v]);return(0,kt.jsx)(Tmn,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:(0,kt.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:(0,kt.jsx)(Ln.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});KUt.displayName=Emn;var Pmn="SelectPopperPosition",JRe=We.forwardRef((e,t)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=Qg,...i}=e,a=aae(r);return(0,kt.jsx)(DUt,{...a,...i,ref:t,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)"}})});JRe.displayName=Pmn;var[Tmn,QRe]=_$(mD,{}),GRe="SelectViewport",YUt=We.forwardRef((e,t)=>{let{__scopeSelect:r,nonce:n,...o}=e,i=gM(GRe,r),a=QRe(GRe,r),s=Vo(t,i.onViewportChange),u=We.useRef(0);return(0,kt.jsxs)(kt.Fragment,{children:[(0,kt.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,kt.jsx)(oae.Slot,{scope:r,children:(0,kt.jsx)(Ln.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Bo(o.onScroll,l=>{let c=l.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=a;if(f?.current&&d){let p=Math.abs(u.current-c.scrollTop);if(p>0){let h=window.innerHeight-Qg*2,m=parseFloat(d.style.minHeight),_=parseFloat(d.style.height),g=Math.max(m,_);if(g<h){let v=g+p,S=Math.min(h,v),x=v-S;d.style.height=S+"px",d.style.bottom==="0px"&&(c.scrollTop=x>0?x:0,d.style.justifyContent="flex-end")}}}u.current=c.scrollTop})})})]})});YUt.displayName=GRe;var ZUt="SelectGroup",[Mmn,Imn]=_$(ZUt),Amn=We.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,o=Fa();return(0,kt.jsx)(Mmn,{scope:r,id:o,children:(0,kt.jsx)(Ln.div,{role:"group","aria-labelledby":o,...n,ref:t})})});Amn.displayName=ZUt;var XUt="SelectLabel",QUt=We.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,o=Imn(XUt,r);return(0,kt.jsx)(Ln.div,{id:o.id,...n,ref:t})});QUt.displayName=XUt;var nae="SelectItem",[Rmn,ezt]=_$(nae),tzt=We.forwardRef((e,t)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=e,s=mM(nae,r),u=gM(nae,r),l=s.value===n,[c,d]=We.useState(i??""),[f,p]=We.useState(!1),h=Vo(t,v=>u.itemRefCallback?.(v,n,o)),m=Fa(),_=We.useRef("touch"),g=()=>{o||(s.onValueChange(n),s.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,kt.jsx)(Rmn,{scope:r,value:n,disabled:o,textId:m,isSelected:l,onItemTextChange:We.useCallback(v=>{d(S=>S||(v?.textContent??"").trim())},[]),children:(0,kt.jsx)(oae.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,kt.jsx)(Ln.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":l&&f,"data-state":l?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:h,onFocus:Bo(a.onFocus,()=>p(!0)),onBlur:Bo(a.onBlur,()=>p(!1)),onClick:Bo(a.onClick,()=>{_.current!=="mouse"&&g()}),onPointerUp:Bo(a.onPointerUp,()=>{_.current==="mouse"&&g()}),onPointerDown:Bo(a.onPointerDown,v=>{_.current=v.pointerType}),onPointerMove:Bo(a.onPointerMove,v=>{_.current=v.pointerType,o?u.onItemLeave?.():_.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Bo(a.onPointerLeave,v=>{v.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Bo(a.onKeyDown,v=>{u.searchRef?.current!==""&&v.key===" "||(bmn.includes(v.key)&&g(),v.key===" "&&v.preventDefault())})})})})});tzt.displayName=nae;var c6="SelectItemText",rzt=We.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:o,...i}=e,a=mM(c6,r),s=gM(c6,r),u=ezt(c6,r),l=Smn(c6,r),[c,d]=We.useState(null),f=Vo(t,g=>d(g),u.onItemTextChange,g=>s.itemTextRefCallback?.(g,u.value,u.disabled)),p=c?.textContent,h=We.useMemo(()=>(0,kt.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:_}=l;return qr(()=>(m(h),()=>_(h)),[m,_,h]),(0,kt.jsxs)(kt.Fragment,{children:[(0,kt.jsx)(Ln.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?XRe.createPortal(i.children,a.valueNode):null]})});rzt.displayName=c6;var nzt="SelectItemIndicator",ozt=We.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return ezt(nzt,r).isSelected?(0,kt.jsx)(Ln.span,{"aria-hidden":!0,...n,ref:t}):null});ozt.displayName=nzt;var KRe="SelectScrollUpButton",izt=We.forwardRef((e,t)=>{let r=gM(KRe,e.__scopeSelect),n=QRe(KRe,e.__scopeSelect),[o,i]=We.useState(!1),a=Vo(t,n.onScrollButtonChange);return qr(()=>{if(r.viewport&&r.isPositioned){let u=function(){let c=l.scrollTop>0;i(c)};var s=u;let l=r.viewport;return u(),l.addEventListener("scroll",u),()=>l.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),o?(0,kt.jsx)(szt,{...e,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});izt.displayName=KRe;var YRe="SelectScrollDownButton",azt=We.forwardRef((e,t)=>{let r=gM(YRe,e.__scopeSelect),n=QRe(YRe,e.__scopeSelect),[o,i]=We.useState(!1),a=Vo(t,n.onScrollButtonChange);return qr(()=>{if(r.viewport&&r.isPositioned){let u=function(){let c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<c;i(d)};var s=u;let l=r.viewport;return u(),l.addEventListener("scroll",u),()=>l.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),o?(0,kt.jsx)(szt,{...e,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});azt.displayName=YRe;var szt=We.forwardRef((e,t)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=e,i=gM("SelectScrollButton",r),a=We.useRef(null),s=iae(r),u=We.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return We.useEffect(()=>()=>u(),[u]),qr(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,kt.jsx)(Ln.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Bo(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:Bo(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:Bo(o.onPointerLeave,()=>{u()})})}),Dmn="SelectSeparator",uzt=We.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return(0,kt.jsx)(Ln.div,{"aria-hidden":!0,...n,ref:t})});uzt.displayName=Dmn;var ZRe="SelectArrow",jmn=We.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,o=aae(r),i=mM(ZRe,r),a=gM(ZRe,r);return i.open&&a.position==="popper"?(0,kt.jsx)(jUt,{...o,...n,ref:t}):null});jmn.displayName=ZRe;function lzt(e){return e===""||e===void 0}var czt=We.forwardRef((e,t)=>{let{value:r,...n}=e,o=We.useRef(null),i=Vo(t,o),a=o$(r);return We.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,kt.jsx)(WRe,{asChild:!0,children:(0,kt.jsx)("select",{...n,ref:i,defaultValue:r})})});czt.displayName="BubbleSelect";function dzt(e){let t=Gt(e),r=We.useRef(""),n=We.useRef(0),o=We.useCallback(a=>{let s=r.current+a;t(s),function u(l){r.current=l,window.clearTimeout(n.current),l!==""&&(n.current=window.setTimeout(()=>u(""),1e3))}(s)},[t]),i=We.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return We.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function fzt(e,t,r){let o=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,i=r?e.indexOf(r):-1,a=Nmn(e,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 Nmn(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var pzt=BUt,e1e=qUt,hzt=zUt,mzt=HUt,gzt=VUt,t1e=WUt,yzt=YUt;var r1e=QUt,n1e=tzt,bzt=rzt,_zt=ozt,o1e=izt,i1e=azt,a1e=uzt;var vzt=pzt;var wzt=hzt,s1e=Xo.forwardRef(({className:e,children:t,...r},n)=>Xo.createElement(e1e,{ref:n,className:_e("border-solid !bg-dropdown !shadow-sm transition-colors","focus-visible:shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"," hover:data-[state=closed]:!bg-interactive-accent hover:data-[state=closed]:!text-on-accent","flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-border px-3 py-1 text-sm ring-offset-ring placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r},t,Xo.createElement(mzt,{asChild:!0},Xo.createElement(us,{className:"h-4 w-4"}))));s1e.displayName=e1e.displayName;var Szt=Xo.forwardRef(({className:e,...t},r)=>Xo.createElement(o1e,{ref:r,className:_e("flex cursor-default items-center justify-center py-1",e),...t},Xo.createElement(PI,{className:"h-4 w-4"})));Szt.displayName=o1e.displayName;var xzt=Xo.forwardRef(({className:e,...t},r)=>Xo.createElement(i1e,{ref:r,className:_e("flex cursor-default items-center justify-center py-1",e),...t},Xo.createElement(us,{className:"h-4 w-4"})));xzt.displayName=i1e.displayName;var u1e=Xo.forwardRef(({className:e,children:t,position:r="popper",container:n,...o},i)=>Xo.createElement(gzt,{container:n},Xo.createElement(t1e,{ref:i,className:_e("relative z-modal max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-primary text-normal shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...o},Xo.createElement(Szt,null),Xo.createElement(yzt,{className:_e("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]")},t),Xo.createElement(xzt,null))));u1e.displayName=t1e.displayName;var Fmn=Xo.forwardRef(({className:e,...t},r)=>Xo.createElement(r1e,{ref:r,className:_e("px-2 py-1.5 text-sm font-semibold",e),...t}));Fmn.displayName=r1e.displayName;var l1e=Xo.forwardRef(({className:e,children:t,...r},n)=>Xo.createElement(n1e,{ref:n,className:_e("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-interactive-accent focus:text-on-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r},Xo.createElement("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center"},Xo.createElement(_zt,null,Xo.createElement(Xm,{className:"h-4 w-4"}))),Xo.createElement(bzt,null,t)));l1e.displayName=n1e.displayName;var kmn=Xo.forwardRef(({className:e,...t},r)=>Xo.createElement(a1e,{ref:r,className:_e("-mx-1 my-1 h-px bg-primary-alt",e),...t}));kmn.displayName=a1e.displayName;var v$=B(Y());var fd=({label:e,required:t=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>v$.default.createElement("div",{className:"space-y-2"},v$.default.createElement(Gf,{className:r?"text-error":""},e," ",t&&v$.default.createElement("span",{className:"text-error"},"*")),i,r&&v$.default.createElement("p",{className:"text-xs text-error"},o),n&&v$.default.createElement("p",{className:"text-sm text-muted"},n));var c1e=({open:e,onOpenChange:t,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=oS(),a=pe(),s=o?"openai":"openai",[u,l]=(0,ke.useState)(null),[c,d]=(0,ke.useState)(!1),[f,p]=(0,ke.useState)(!1),[h,m]=(0,ke.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1}),_=(D,z)=>{m(W=>({...W,[D]:z}))},g=()=>{m({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1})},v=()=>{let D=!0,z={...h};return z.name=!O.name,O.name||(D=!1),O.provider==="azure openai"&&(z.instanceName=!O.azureOpenAIApiInstanceName,z.apiVersion=!O.azureOpenAIApiVersion,o?(z.embeddingDeploymentName=!O.azureOpenAIApiEmbeddingDeploymentName,O.azureOpenAIApiEmbeddingDeploymentName||(D=!1)):(z.deploymentName=!O.azureOpenAIApiDeploymentName,O.azureOpenAIApiDeploymentName||(D=!1)),(!O.azureOpenAIApiInstanceName||!O.azureOpenAIApiVersion)&&(D=!1)),m(z),D},S=D=>a[DO[D]]||"",x=(D=s)=>{let z={name:"",provider:D,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:S(D),isEmbeddingModel:o,capabilities:[]};return o?z:{...z,stream:!0}},[O,T]=(0,ke.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()}),[M,A]=(0,ke.useState)(sI(s)),j=()=>!!(O.name&&O.provider),N=()=>f||!j(),F=()=>{if(!v()){new f6.Notice("Please fill in all required fields");return}let D=E(O);r(D),t(!1),T(x()),g()},k=D=>{A(sI(D)),T({...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}:{}})},L=D=>{D||(T(x()),g(),d(!1)),t(D)},q=async()=>{if(!v()){new f6.Notice("Please fill in all required fields");return}p(!0);try{let D=E(O);await n(D),new f6.Notice("Model verification successful!")}catch(D){console.error(D);let z=bi(D);new f6.Notice("Model verification failed: "+z)}finally{p(!1)}},U=()=>{let z=(()=>{switch(O.provider){case"openai":return ke.default.createElement(fd,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},ke.default.createElement(ri,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:O.openAIOrgId||"",onChange:W=>T({...O,openAIOrgId:W.target.value})}));case"azure openai":return ke.default.createElement(ke.default.Fragment,null,ke.default.createElement(fd,{label:"Instance Name",required:!0,error:h.instanceName,errorMessage:"Instance name is required"},ke.default.createElement(ri,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:O.azureOpenAIApiInstanceName||"",onChange:W=>{T({...O,azureOpenAIApiInstanceName:W.target.value}),_("instanceName",!1)}})),o?ke.default.createElement(fd,{label:"Embedding Deployment Name",required:!0,error:h.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},ke.default.createElement(ri,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:O.azureOpenAIApiEmbeddingDeploymentName||"",onChange:W=>{T({...O,azureOpenAIApiEmbeddingDeploymentName:W.target.value}),_("embeddingDeploymentName",!1)}})):ke.default.createElement(fd,{label:"Deployment Name",required:!0,error:h.deploymentName,errorMessage:"Deployment name is required",description:"This is your actual model, no need to pass a model name separately."},ke.default.createElement(ri,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:O.azureOpenAIApiDeploymentName||"",onChange:W=>{T({...O,azureOpenAIApiDeploymentName:W.target.value}),_("deploymentName",!1)}})),ke.default.createElement(fd,{label:"API Version",required:!0,error:h.apiVersion,errorMessage:"API version is required"},ke.default.createElement(ri,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:O.azureOpenAIApiVersion||"",onChange:W=>{T({...O,azureOpenAIApiVersion:W.target.value}),_("apiVersion",!1)}})));default:return null}})();return z?ke.default.createElement(AH,{open:c,onOpenChange:d,className:"space-y-2 border rounded-lg pt-4"},ke.default.createElement("div",{className:"flex items-center justify-between"},ke.default.createElement(Gf,null,"Additional ",uh(O.provider)," Settings"),ke.default.createElement(RH,{asChild:!0},ke.default.createElement(qe,{variant:"ghost",size:"sm",className:"w-9 p-0"},ke.default.createElement(us,{className:"h-4 w-4"}),ke.default.createElement("span",{className:"sr-only"},"Toggle")))),ke.default.createElement(DH,{className:"space-y-4 max-h-[200px] overflow-y-auto pl-0.5 pr-2 pb-0.5"},z)):null},G=()=>{if(O.provider!=="azure openai")return M.host;let D=O.azureOpenAIApiInstanceName||"[instance]",z=o?O.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":O.azureOpenAIApiDeploymentName||"[deployment]",W=O.azureOpenAIApiVersion||"[api-version]";return`https://${D}.openai.azure.com/openai/deployments/${z}/${o?"embeddings":"chat/completions"}?api-version=${W}`},V=Object.entries(NO).map(([D,z])=>({id:D,label:D.charAt(0).toUpperCase()+D.slice(1),description:z}));return ke.default.createElement(cM,{open:e,onOpenChange:L},ke.default.createElement(QC,{className:"sm:max-w-[425px]",container:i,ref:D=>l(D)},ke.default.createElement(eO,null,ke.default.createElement(tO,null,"Add Custom ",o?"Embedding":"Chat"," Model"),ke.default.createElement(rO,null,"Add a new model to your collection.")),ke.default.createElement("div",{className:"space-y-3"},ke.default.createElement(fd,{label:"Model Name",required:!0,error:h.name,errorMessage:"Model name is required"},ke.default.createElement(ri,{type:"text",placeholder:`Enter model name (e.g. ${o?"text-embedding-3-small":"gpt-4"})`,value:O.name,onChange:D=>{T({...O,name:D.target.value}),_("name",!1)}})),ke.default.createElement(fd,{label:ke.default.createElement("div",{className:"flex items-center gap-1.5"},ke.default.createElement("span",{className:"leading-none"},"Display Name"),ke.default.createElement(vc,{delayDuration:0},ke.default.createElement(Yr,null,ke.default.createElement(Zr,{asChild:!0},ke.default.createElement(Hl,{className:"size-4"})),ke.default.createElement(Vr,{align:"start",className:"max-w-96",side:"bottom"},ke.default.createElement("div",{className:"text-sm text-muted flex flex-col gap-0.5"},ke.default.createElement("div",{className:"text-[12px] font-bold"},"Suggested format:"),ke.default.createElement("div",{className:"text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),ke.default.createElement("div",{className:"text-[12px]"},"Example:",ke.default.createElement("li",null,"Direct-Paid:Ds-r1"),ke.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),ke.default.createElement("li",null,"Perplexity-Paid:lg")))))))},ke.default.createElement(ri,{type:"text",placeholder:"Custom display name (optional)",value:O.displayName||"",onChange:D=>{T({...O,displayName:D.target.value})}})),ke.default.createElement(fd,{label:"Provider"},ke.default.createElement(vzt,{value:O.provider,onValueChange:k},ke.default.createElement(s1e,null,ke.default.createElement(wzt,{placeholder:"Select provider"})),ke.default.createElement(u1e,{container:u},Object.values(o?Ule(AO,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):Ule(lI,["COPILOT_PLUS"])).map(D=>ke.default.createElement(l1e,{key:D,value:D},uh(D)))))),ke.default.createElement(fd,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},ke.default.createElement(ri,{type:"text",placeholder:G()||"https://api.example.com/v1",value:O.baseUrl||"",onChange:D=>T({...O,baseUrl:D.target.value})})),ke.default.createElement(fd,{label:"API Key"},ke.default.createElement(uM,{placeholder:`Enter ${M.label} API Key`,value:O.apiKey||"",onChange:D=>T({...O,apiKey:D})}),M.keyManagementURL&&ke.default.createElement("p",{className:"text-xs text-muted"},ke.default.createElement("a",{href:M.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",M.label," API Key"))),ke.default.createElement(fd,{label:"Model Capabilities"},ke.default.createElement("div",{className:"flex gap-4 items-center"},V.map(({id:D,label:z,description:W})=>ke.default.createElement("div",{key:D,className:"flex items-center gap-2"},ke.default.createElement(Jd,{id:D,checked:O.capabilities?.includes(D),onCheckedChange:J=>{let te=O.capabilities||[];T({...O,capabilities:J?[...te,D]:te.filter(Ie=>Ie!==D)})}}),ke.default.createElement(Gf,{htmlFor:D,className:"text-sm"},ke.default.createElement(vc,{delayDuration:0},ke.default.createElement(Yr,null,ke.default.createElement(Zr,{asChild:!0},ke.default.createElement("span",null,z)),ke.default.createElement(Vr,{side:"bottom"},W)))))))),U()),ke.default.createElement("div",{className:"flex justify-end gap-4 items-center"},ke.default.createElement("div",{className:"flex items-center gap-2"},ke.default.createElement(Jd,{id:"enable-cors",checked:O.enableCors||!1,onCheckedChange:D=>T({...O,enableCors:D})}),ke.default.createElement(Gf,{htmlFor:"enable-cors",className:"text-sm"},"Enable CORS")),ke.default.createElement("div",{className:"flex gap-2"},ke.default.createElement(qe,{variant:"secondary",onClick:F,disabled:N()},"Add Model"),ke.default.createElement(qe,{variant:"secondary",onClick:q,disabled:N()},f?ke.default.createElement(ke.default.Fragment,null,ke.default.createElement(Uc,{className:"mr-2 h-4 w-4 animate-spin"}),"Verify"):"Verify")))))};var Be=B(Y());var Bmn={reasoning:{icon:QS,color:"text-model-capabilities-blue",tooltip:NO.reasoning},vision:{icon:XS,color:"text-model-capabilities-green",tooltip:NO.vision},websearch:{icon:RI,color:"text-model-capabilities-blue",tooltip:NO.websearch}},$mn=["reasoning","vision","websearch"],qmn=e=>Be.default.createElement(vc,{delayDuration:0},Be.default.createElement("div",{className:"grid grid-cols-3 gap-1 w-16 mx-auto"},$mn.map(t=>{let r=Bmn[t];if(!r)return Be.default.createElement("div",{key:t,className:"w-4"});let n=r.icon;return e.capabilities?.includes(t)?Be.default.createElement(Yr,{key:t},Be.default.createElement(Zr,{asChild:!0},Be.default.createElement("div",{className:"flex items-center justify-center"},Be.default.createElement(n,{className:`h-4 w-4 ${r.color}`}))),Be.default.createElement(Vr,{side:"bottom"},r.tooltip)):Be.default.createElement("div",{key:t,className:"flex items-center justify-center"},Be.default.createElement("div",{className:"w-4 h-4"}))}))),Umn=({model:e,onEdit:t,onDelete:r,onUpdateModel:n,id:o})=>{let[i,a]=Be.default.useState(!1),{attributes:s,listeners:u,setNodeRef:l,transform:c,transition:d,isDragging:f}=i6({id:o,disabled:e.core}),p={transform:Yg.Transform.toString(c),transition:d};return Be.default.createElement($H,{ref:l,style:p,className:_e("mb-2",f&&["opacity-90","shadow-lg","border-2","border-accent/50","relative","z-[9999]","bg-background","rounded-lg","transform-gpu"],!e.core&&"touch-none")},Be.default.createElement(qH,{className:"p-3"},Be.default.createElement("div",{className:"flex items-center justify-between"},!e.core&&Be.default.createElement("div",{className:"mr-2 touch-none cursor-grab active:cursor-grabbing",...s,...u},Be.default.createElement(uE,{className:"h-4 w-4 text-muted-foreground"})),Be.default.createElement("div",{className:"flex-1 cursor-pointer",onClick:()=>a(!i)},Be.default.createElement("div",{className:"flex items-center gap-2"},Be.default.createElement("div",{className:"w-3 h-3 flex items-center justify-center"},i?Be.default.createElement(us,{className:"h-3 w-3 stroke-[7]"}):Be.default.createElement(YS,{className:"h-3 w-3 stroke-[7]"})),Be.default.createElement("div",null,Be.default.createElement("div",{className:"flex items-center gap-1"},Be.default.createElement("span",{className:"font-medium"},e.displayName||e.name),e.capabilities&&e.capabilities.length>0&&Be.default.createElement(hMe,{capabilities:e.capabilities,iconSize:14})),Be.default.createElement("div",{className:"flex items-center gap-2"},Be.default.createElement("span",{className:"text-sm text-muted bg-secondary"},uh(e.provider,e)))))),Be.default.createElement("div",{className:"flex items-center gap-2"},t&&Be.default.createElement(qe,{variant:"ghost",size:"icon",onClick:h=>{h.stopPropagation(),t()}},Be.default.createElement(Xj,{className:"h-4 w-4"})),r&&!e.core&&Be.default.createElement(qe,{variant:"ghost",size:"icon",onClick:h=>{h.stopPropagation(),r()}},Be.default.createElement(eg,{className:"h-4 w-4"}))))),Be.default.createElement("div",{className:_e("transition-all duration-300 ease-in-out",i?"max-h-20 opacity-100":"max-h-0 opacity-0 overflow-hidden")},Be.default.createElement(UH,{className:"p-3 pt-0"},Be.default.createElement("div",{className:"flex justify-around"},!e.isEmbeddingModel&&Be.default.createElement("div",{className:"flex items-center gap-2"},Be.default.createElement("span",{className:"text-sm"},"Enabled"),Be.default.createElement(Jd,{checked:e.enabled,onCheckedChange:h=>n({...e,enabled:h})})),Be.default.createElement("div",{className:"flex items-center gap-2"},Be.default.createElement("span",{className:"text-sm"},"CORS"),Be.default.createElement(Jd,{checked:e.enableCors,onCheckedChange:h=>n({...e,enableCors:h})}))))))},zmn=({model:e,onEdit:t,onDelete:r,onUpdateModel:n,isEmbeddingModel:o})=>{let{attributes:i,listeners:a,setNodeRef:s,transform:u,transition:l,isDragging:c}=i6({id:Nr(e),disabled:e.core}),d={transform:Yg.Transform.toString(u),transition:l};return Be.default.createElement(eD,{ref:s,style:d,className:_e("hover:bg-interactive-accent/10 transition-colors duration-200",c&&"shadow-lg bg-background/90 backdrop-blur-sm relative z-[100] cursor-grabbing border-2 border-accent/50",!c&&"z-auto")},Be.default.createElement(Yf,{className:"w-6 px-2"},!e.core&&Be.default.createElement(qe,{variant:"ghost",size:"icon",className:"cursor-grab touch-none hover:cursor-grab active:cursor-grabbing p-0 h-6 w-6",...i,...a},Be.default.createElement(uE,{className:"h-4 w-4 text-muted-foreground hover:text-foreground transition-colors"}))),Be.default.createElement(Yf,{className:"pl-0"},e.displayName||e.name),Be.default.createElement(Yf,null,uh(e.provider,e)),Be.default.createElement(Yf,{className:"text-center flex justify-center"},qmn(e)),!o&&Be.default.createElement(Yf,{className:"text-center"},Be.default.createElement(Jd,{id:`${Nr(e)}-enabled`,checked:e.enabled,onCheckedChange:f=>n({...e,enabled:f}),className:"mx-auto"})),Be.default.createElement(Yf,{className:"text-center"},Be.default.createElement(Jd,{id:`${Nr(e)}-enableCors`,checked:e.enableCors,onCheckedChange:f=>n({...e,enableCors:f}),className:"mx-auto"})),Be.default.createElement(Yf,{className:"text-center"},Be.default.createElement("div",{className:"flex justify-center gap-2"},t&&Be.default.createElement(qe,{variant:"ghost",size:"icon",onClick:()=>t(e),className:"shadow-sm hover:shadow-md transition-shadow"},Be.default.createElement(Xj,{className:"h-4 w-4"})),!e.core&&Be.default.createElement(qe,{variant:"ghost",size:"icon",onClick:()=>r(Nr(e)),className:"shadow-sm hover:shadow-md transition-shadow"},Be.default.createElement(eg,{className:"h-4 w-4"})))))},d1e=({models:e,onEdit:t,onDelete:r,onAdd:n,onUpdateModel:o,onReorderModels:i,title:a})=>{let s=!!(e.length>0&&e[0].isEmbeddingModel),u=kie(d$(sM),d$(aM,{coordinateGetter:Hie})),l=e.findIndex(p=>!p.core),c=p=>h=>{let{transform:m,active:_,activeNodeRect:g,over:v}=h;if(!_||!g)return m;let S=e.findIndex(M=>Nr(M)===_.id),x=e.filter(M=>!M.core).length,O=g.height,T=(l-S)*O,E=(l+x-1-S)*O;if(p&&v){let M=e.findIndex(j=>Nr(j)===v.id);if(e[M].core||M<l)return{...m,x:0,y:S*O}}return{...m,x:0,y:Math.min(Math.max(T,m.y),E)}},d=p=>{let{active:h,over:m}=p;if(m&&h.id!==m.id){let _=e.findIndex(x=>Nr(x)===h.id),g=e.findIndex(x=>Nr(x)===m.id),v=e[g];if(g<l||v.core)return;let S=f$(e,_,g);i?.(S)}},f=()=>Be.default.createElement("div",{className:"md:hidden relative"},Be.default.createElement(r6,{sensors:u,collisionDetection:e6,onDragEnd:d,modifiers:[c(!0)]},Be.default.createElement(o6,{items:e.map(p=>Nr(p)),strategy:n6},Be.default.createElement("div",{className:"space-y-2 relative"},e.map(p=>Be.default.createElement(Umn,{key:Nr(p),id:Nr(p),model:p,onEdit:t?()=>t(p):void 0,onDelete:()=>r(Nr(p)),onUpdateModel:o}))))));return Be.default.createElement("div",{className:"mb-4"},Be.default.createElement("div",{className:"hidden md:block"},Be.default.createElement(r6,{sensors:u,collisionDetection:e6,onDragEnd:d,modifiers:[c(!1)]},Be.default.createElement("div",{className:"relative overflow-hidden"},Be.default.createElement(HH,null,Be.default.createElement(VH,null,Be.default.createElement(eD,null,Be.default.createElement(Kf,{className:"w-6 px-2"}),Be.default.createElement(Kf,{className:"pl-0"},"Model"),Be.default.createElement(Kf,null,"Provider"),Be.default.createElement(Kf,{className:"text-center"},"Capabilities"),!s&&Be.default.createElement(Kf,{className:"text-center"},"Enable"),Be.default.createElement(Kf,{className:"text-center"},"CORS"),Be.default.createElement(Kf,{className:"w-[100px] text-center"},"Actions"))),Be.default.createElement(WH,{className:"relative"},Be.default.createElement(o6,{items:e.map(p=>Nr(p)),strategy:n6},e.map(p=>Be.default.createElement(zmn,{key:Nr(p),model:p,onEdit:t?()=>t(p):void 0,onDelete:r,onUpdateModel:o,isEmbeddingModel:s})))))))),f(),Be.default.createElement("div",{className:"mt-4 flex justify-end"},Be.default.createElement(qe,{onClick:n,variant:"secondary",className:"flex items-center gap-2"},Be.default.createElement(ex,{className:"h-4 w-4"}),"Add Custom Model")))};var Jr=B(Y());var Czt=({open:e,onOpenChange:t,model:r,onUpdate:n})=>{let{modalContainer:o}=oS(),[i,a]=(0,Jr.useState)(r);if((0,Jr.useEffect)(()=>{a(r)},[r]),!i)return null;let s=(l,c)=>{let d={...i,[l]:c};a(d),n(d)},u=Object.entries(NO).map(([l,c])=>({id:l,label:l.charAt(0).toUpperCase()+l.slice(1),description:c}));return Jr.default.createElement(cM,{open:e,onOpenChange:t},Jr.default.createElement(QC,{className:"sm:max-w-[425px]",container:o},Jr.default.createElement(eO,null,Jr.default.createElement(tO,null,"Model Settings - ",i.name),Jr.default.createElement(rO,null,"Customize model parameters.")),Jr.default.createElement("div",{className:"space-y-6"},Jr.default.createElement(fd,{label:"Model Name",required:!0},Jr.default.createElement(ri,{type:"text",disabled:i.core,value:i.name,onChange:l=>s("name",l.target.value),placeholder:"Enter model name"})),Jr.default.createElement(fd,{label:Jr.default.createElement("div",{className:"flex items-center gap-1.5"},Jr.default.createElement("span",{className:"leading-none"},"Display Name"),Jr.default.createElement(vc,{delayDuration:0},Jr.default.createElement(Yr,null,Jr.default.createElement(Zr,{asChild:!0},Jr.default.createElement(Hl,{className:"size-4"})),Jr.default.createElement(Vr,{align:"start",className:"max-w-96",side:"bottom"},Jr.default.createElement("div",{className:"text-sm text-muted flex flex-col gap-0.5"},Jr.default.createElement("div",{className:"text-[12px] font-bold"},"Suggested format:"),Jr.default.createElement("div",{className:"text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Jr.default.createElement("div",{className:"text-[12px]"},"Example:",Jr.default.createElement("li",null,"Direct-Paid:Ds-r1"),Jr.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Jr.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Jr.default.createElement(ri,{type:"text",placeholder:"Custom display name (optional)",value:i.displayName||"",onChange:l=>s("displayName",l.target.value)})),Jr.default.createElement(fd,{label:"Model Capabilities"},Jr.default.createElement("div",{className:"flex gap-4 items-center"},u.map(({id:l,label:c,description:d})=>Jr.default.createElement("div",{key:l,className:"flex items-center gap-2"},Jr.default.createElement(Jd,{id:l,checked:i.capabilities?.includes(l),onCheckedChange:f=>{let p=i.capabilities||[];s("capabilities",f?[...p,l]:p.filter(h=>h!==l))}}),Jr.default.createElement(Gf,{htmlFor:l,className:"text-sm"},Jr.default.createElement(vc,{delayDuration:0},Jr.default.createElement(Yr,null,Jr.default.createElement(Zr,{asChild:!0},Jr.default.createElement("span",null,c)),Jr.default.createElement(Vr,{side:"bottom"},d)))))))))))};var Ozt=()=>{let e=Uo(),[t,r]=(0,Zi.useState)(null),[n,o]=(0,Zi.useState)(!1),[i,a]=(0,Zi.useState)(!1),s=p=>{let[h,m]=p.split("|"),_=e.activeModels.filter(v=>!(v.name===h&&v.provider===m)),g=e.defaultModelKey;if(p===e.defaultModelKey){let v=_.find(S=>S.enabled);g=v?`${v.name}|${v.provider}`:""}MO({activeModels:_,defaultModelKey:g})},u=p=>{let h=e.activeModels.map(m=>m.name===p.name&&m.provider===p.provider?p:m);xt("activeModels",h)},l=p=>{xt("activeModels",p)},c=p=>{let[h,m]=p.split("|"),_=e.activeEmbeddingModels.filter(g=>!(g.name===h&&g.provider===m));xt("activeEmbeddingModels",_)},d=p=>{let h=e.activeEmbeddingModels.map(m=>m.name===p.name&&m.provider===p.provider?p:m);xt("activeEmbeddingModels",h)},f=p=>{xt("activeEmbeddingModels",p)};return Zi.default.createElement("div",{className:"space-y-4"},Zi.default.createElement("section",null,Zi.default.createElement("div",{className:"text-xl font-bold mb-3"},"Chat Models"),Zi.default.createElement(d1e,{models:e.activeModels,onEdit:r,onDelete:s,onAdd:()=>o(!0),onUpdateModel:u,onReorderModels:l,title:"Chat Model"}),Zi.default.createElement(Czt,{open:!!t,onOpenChange:p=>!p&&r(null),model:t,onUpdate:u}),Zi.default.createElement(c1e,{open:n,onOpenChange:o,onAdd:p=>{let h=[...e.activeModels,p];xt("activeModels",h)},ping:p=>zd.getInstance().ping(p)}),Zi.default.createElement("div",{className:"space-y-4"},Zi.default.createElement(Eo,{type:"slider",title:"Temperature",description:"Default is 0.1. Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.",value:e.temperature,onChange:p=>xt("temperature",p),min:0,max:2,step:.05}),Zi.default.createElement(Eo,{type:"slider",title:"Token limit",description:Zi.default.createElement(Zi.default.Fragment,null,Zi.default.createElement("p",null,"The maximum number of ",Zi.default.createElement("em",null,"output tokens")," to generate. Default is 1000."),Zi.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model.")),value:e.maxTokens,onChange:p=>xt("maxTokens",p),min:0,max:16e3,step:100}),Zi.default.createElement(Eo,{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:e.contextTurns,onChange:p=>xt("contextTurns",p),min:1,max:50,step:1}))),Zi.default.createElement("section",null,Zi.default.createElement("div",{className:"text-xl font-bold mb-3"},"Embedding Models"),Zi.default.createElement(d1e,{models:e.activeEmbeddingModels,onDelete:c,onAdd:()=>a(!0),onUpdateModel:d,onReorderModels:f,title:"Embedding Model"}),Zi.default.createElement(c1e,{open:i,onOpenChange:a,onAdd:p=>{let h=[...e.activeEmbeddingModels,p];xt("activeEmbeddingModels",h)},isEmbeddingModel:!0,ping:p=>hs.getInstance().ping(p)})))};var Dzt=require("obsidian");var Xr=B(Y()),jzt=B(gh());var Ezt=require("obsidian"),sae=class extends Ezt.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)Oq(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};var Pzt=require("obsidian");var uae=class extends Pzt.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=BQ(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 Tzt=require("obsidian"),Pm=B(Y()),Mzt=B(gh());function Hmn({onConfirm:e,onCancel:t}){let[r,n]=(0,Pm.useState)(""),[o,i]=(0,Pm.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),e(u)};return Pm.default.createElement("div",{className:"flex flex-col gap-4"},Pm.default.createElement("div",{className:"flex flex-col gap-2"},Pm.default.createElement(ri,{placeholder:"Enter the extension (e.g. txt, excalidraw.md)",value:r,onChange:u=>{n(u.target.value),i(null)},onKeyDown:u=>{u.key==="Enter"&&a(r)}}),o&&Pm.default.createElement("p",{className:"text-error text-sm"},o)),Pm.default.createElement("div",{className:"flex justify-end gap-2"},Pm.default.createElement(qe,{variant:"secondary",onClick:t},"Cancel"),Pm.default.createElement(qe,{variant:"default",onClick:()=>a(r)},"Confirm")))}var lae=class extends Tzt.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,Mzt.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(Pm.default.createElement(Hmn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var Izt=require("obsidian"),ey=B(Y()),Azt=B(gh());function Vmn({onConfirm:e,onCancel:t}){let[r,n]=(0,ey.useState)("");return ey.default.createElement("div",{className:"flex flex-col gap-4"},ey.default.createElement("div",{className:"flex flex-col gap-4"},ey.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"),ey.default.createElement(ri,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&e(r)}})),ey.default.createElement("div",{className:"flex justify-end gap-2"},ey.default.createElement(qe,{variant:"secondary",onClick:t},"Cancel"),ey.default.createElement(qe,{variant:"default",onClick:()=>e(r)},"Confirm")))}var cae=class extends Izt.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,Azt.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(ey.default.createElement(Vmn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var w$=B(Y());var dae=B(Y()),Wmn=2;function Jmn(e,t){return t&&t>1?e.current?e.current.offsetHeight<e.current.scrollHeight:!1:(e.current&&e.current?.offsetWidth+Wmn<e.current?.scrollWidth)??!1}function Gmn(e){switch(e){case 2:return"line-clamp-2";case 3:return"line-clamp-3";default:return""}}var Rzt=({children:e,className:t,lineClamp:r,tooltipContent:n,...o})=>{let i=(0,dae.useRef)(null),[a,s]=(0,dae.useState)(!1);return w$.default.createElement(vc,{delayDuration:0},w$.default.createElement(Yr,{open:a,onOpenChange:l=>{s(l&&Jmn(i,r))}},w$.default.createElement(Zr,{asChild:!0},w$.default.createElement("div",{...o,ref:i,className:_e("max-w-full text-normal",(!r||r<=1)&&"truncate",r&&Gmn(r),t),"data-testid":"truncatedText"},e)),w$.default.createElement(Vr,{className:"max-w-64 text-wrap break-words text-body-normal"},n??e)))};function fae({title:e,patterns:t,onRemove:r}){return Xr.default.createElement("div",{className:"grid grid-cols-4 gap-2"},Xr.default.createElement("div",{className:"font-bold"},e),Xr.default.createElement("ul",{className:"list-disc list-inside pl-0 m-0 col-span-3 flex flex-col gap-1"},t.map(n=>Xr.default.createElement("li",{key:n,className:"flex gap-2 hover:bg-dropdown-hover pl-2 pr-1 rounded-md"},Xr.default.createElement(Rzt,{className:"flex-1"},n),Xr.default.createElement(qe,{variant:"ghost2",size:"fit",onClick:()=>r(n)},Xr.default.createElement(bh,{className:"size-4"}))))))}function Kmn({value:e,onUpdate:t,container:r}){let[n,o]=(0,Xr.useState)(e),i=DP(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=V4(i),c=f=>{let p=f0t({tagPatterns:f.tagPatterns??a,extensionPatterns:f.extensionPatterns??s,folderPatterns:f.folderPatterns??u,notePatterns:f.notePatterns??l});o(p),t(p)},d=a.length>0||s.length>0||u.length>0||l.length>0;return Xr.default.createElement("div",{className:"flex flex-col gap-4 mt-2"},Xr.default.createElement("div",{className:"flex flex-col gap-2 p-4 border border-border border-solid rounded-md max-h-[400px] overflow-y-auto"},!d&&Xr.default.createElement("div",{className:"text-center text-sm text-muted-foreground"},"No patterns specified"),a.length>0&&Xr.default.createElement(fae,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(h=>h!==f);c({tagPatterns:p})}}),s.length>0&&Xr.default.createElement(fae,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(h=>h!==f);c({extensionPatterns:p})}}),u.length>0&&Xr.default.createElement(fae,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(h=>h!==f);c({folderPatterns:p})}}),l.length>0&&Xr.default.createElement(fae,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(h=>h!==f);c({notePatterns:p})}})),Xr.default.createElement("div",{className:"flex justify-end gap-2"},Xr.default.createElement(zB,null,Xr.default.createElement(HB,{asChild:!0},Xr.default.createElement(qe,{variant:"secondary"},"Add...")),Xr.default.createElement(tS,{align:"start",container:r},Xr.default.createElement(Qa,{onSelect:()=>{new sae(app,f=>{let p=`#${f}`;a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},Xr.default.createElement("div",{className:"flex items-center gap-2"},Xr.default.createElement(zU,{className:"size-4"}),"Tag")),Xr.default.createElement(Qa,{onSelect:()=>{new uae(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},Xr.default.createElement("div",{className:"flex items-center gap-2"},Xr.default.createElement(jU,{className:"size-4"}),"Folder")),Xr.default.createElement(Qa,{onSelect:()=>{new YT({app,onNoteSelect:f=>{let p=`[[${f.basename}]]`;l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},Xr.default.createElement("div",{className:"flex items-center gap-2"},Xr.default.createElement(AI,{className:"size-4"}),"Note")),Xr.default.createElement(Qa,{onSelect:()=>{new lae(app,f=>{let p=`*.${f}`;s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},Xr.default.createElement("div",{className:"flex items-center gap-2"},Xr.default.createElement(DU,{className:"size-4"}),"Extension")),Xr.default.createElement(Qa,{onSelect:()=>{new cae(app,f=>{let p=DP(f),{tagPatterns:h,extensionPatterns:m,folderPatterns:_,notePatterns:g}=V4(p);c({tagPatterns:[...a,...h],extensionPatterns:[...s,...m],folderPatterns:[...u,..._],notePatterns:[...l,...g]})}).open()}},Xr.default.createElement("div",{className:"flex items-center gap-2"},Xr.default.createElement(DI,{className:"size-4"}),"Custom"))))))}var p6=class extends Dzt.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,jzt.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(Xr.default.createElement(Kmn,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};var yr=B(Y()),Nzt=()=>{let e=Uo(),t=r=>{let n=parseInt(r);n!==e.numPartitions&&new y$(app,async()=>{xt("numPartitions",n),await ma.getInstance().indexVaultToVectorStore(!0)}).open()};return yr.default.createElement("div",{className:"space-y-4"},yr.default.createElement("section",null,yr.default.createElement("div",{className:"space-y-4"},yr.default.createElement(Eo,{type:"select",title:"Auto-Index Strategy",description:yr.default.createElement("div",{className:"flex items-center gap-1.5"},yr.default.createElement("span",{className:"leading-none"},"Decide when you want the vault to be indexed."),yr.default.createElement(vc,{delayDuration:0},yr.default.createElement(Yr,null,yr.default.createElement(Zr,{asChild:!0},yr.default.createElement(Hl,{className:"size-4"})),yr.default.createElement(Vr,null,yr.default.createElement("div",{className:"space-y-2 py-2"},yr.default.createElement("div",{className:"space-y-1"},yr.default.createElement("div",{className:"text-muted text-sm"},"Choose when to index your vault:"),yr.default.createElement("ul",{className:"space-y-1 pl-2 list-disc text-sm"},yr.default.createElement("li",null,yr.default.createElement("div",{className:"flex items-center gap-1"},yr.default.createElement("strong",{className:"inline-block whitespace-nowrap"},"NEVER:"),yr.default.createElement("span",null,"Manual indexing via command or refresh only"))),yr.default.createElement("li",null,yr.default.createElement("div",{className:"flex items-center gap-1"},yr.default.createElement("strong",{className:"inline-block whitespace-nowrap"},"ON STARTUP:"),yr.default.createElement("span",null,"Index updates when plugin loads or reloads"))),yr.default.createElement("li",null,yr.default.createElement("div",{className:"flex items-center gap-1"},yr.default.createElement("strong",{className:"inline-block whitespace-nowrap"},"ON MODE SWITCH:"),yr.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),yr.default.createElement("p",{className:"text-callout-warning text-sm"},"Warning: Cost implications for large vaults with paid models")))))),value:e.indexVaultToVectorStore,onChange:r=>{xt("indexVaultToVectorStore",r)},options:yBe.map(r=>({label:r,value:r})),placeholder:"Strategy"}),yr.default.createElement(Eo,{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:e.maxSourceChunks,onChange:r=>xt("maxSourceChunks",r)}),yr.default.createElement(Eo,{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:e.embeddingRequestsPerMin,onChange:r=>xt("embeddingRequestsPerMin",r)}),yr.default.createElement(Eo,{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:e.embeddingBatchSize,onChange:r=>xt("embeddingBatchSize",r)}),yr.default.createElement(Eo,{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:e.numPartitions.toString(),onChange:t,options:["1","2","3","4","5","6","7","8","12","16","20","24","28","32","36","40"].map(r=>({label:r,value:r}))}),yr.default.createElement(Eo,{type:"custom",title:"Exclusions",description:yr.default.createElement(yr.default.Fragment,null,yr.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."))},yr.default.createElement(qe,{variant:"secondary",onClick:()=>new p6(app,r=>xt("qaExclusions",r),e.qaExclusions,"Manage Exclusions").open()},"Manage")),yr.default.createElement(Eo,{type:"custom",title:"Inclusions",description:yr.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.")},yr.default.createElement(qe,{variant:"secondary",onClick:()=>new p6(app,r=>xt("qaInclusions",r),e.qaInclusions,"Manage Inclusions").open()},"Manage")),yr.default.createElement(Eo,{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:e.enableIndexSync,onCheckedChange:r=>xt("enableIndexSync",r)}),yr.default.createElement(Eo,{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:e.disableIndexOnMobile,onCheckedChange:r=>xt("disableIndexOnMobile",r)}))))};var Fzt=["basic","model","QA","command","advanced"],Ymn={basic:Ur.default.createElement(EU,{className:"w-5 h-5"}),model:Ur.default.createElement(PU,{className:"w-5 h-5"}),QA:Ur.default.createElement(TU,{className:"w-5 h-5"}),command:Ur.default.createElement(TI,{className:"w-5 h-5"}),advanced:Ur.default.createElement(DI,{className:"w-5 h-5"})},Zmn={basic:()=>Ur.default.createElement(aUt,null),model:()=>Ur.default.createElement(Ozt,null),QA:()=>Ur.default.createElement(Nzt,null),command:()=>Ur.default.createElement($$t,null),advanced:()=>Ur.default.createElement(tUt,null)},Lzt=Fzt.map(e=>({id:e,icon:Ymn[e],label:e.charAt(0).toUpperCase()+e.slice(1)})),Xmn=({plugin:e})=>{let{selectedTab:t,setSelectedTab:r}=oS();return Ur.default.createElement("div",{className:"flex flex-col"},Ur.default.createElement("div",{className:"inline-flex rounded-lg"},Lzt.map((n,o)=>Ur.default.createElement(EBt,{key:n.id,tab:n,isSelected:t===n.id,onClick:()=>r(n.id),isFirst:o===0,isLast:o===Lzt.length-1}))),Ur.default.createElement("div",{className:"w-[100%] border border-solid"}),Ur.default.createElement("div",null,Fzt.map(n=>{let o=Zmn[n];return Ur.default.createElement(PBt,{key:n,id:n,isSelected:t===n},Ur.default.createElement(o,null))})))},Qmn=({plugin:e})=>{let[t,r]=Ur.default.useState(0),[n,o]=(0,Ur.useState)(null),[i,a]=(0,Ur.useState)(null);(0,Ur.useEffect)(()=>{(async()=>{let{version:c,error:d}=await pBe();d?(console.error("Version check failed:",d),a(d)):c&&(o(c),a(null))})()},[e.manifest.version]);let s=async()=>{new Pie(app,async()=>{jke(),r(c=>c+1)}).open()},u=n&&fBe(n,e.manifest.version);return Ur.default.createElement(MBt,null,Ur.default.createElement("div",null,Ur.default.createElement("div",{className:"flex flex-col gap-2"},Ur.default.createElement("h1",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2"},Ur.default.createElement("div",{className:"flex items-center gap-2"},Ur.default.createElement("span",null,"Copilot Settings"),Ur.default.createElement("span",{className:"text-xs text-muted"},Ur.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/",target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline"},"v",e.manifest.version),i?Ur.default.createElement("span",{className:"text-error",title:i}," ","(update check failed)"):n&&Ur.default.createElement(Ur.default.Fragment,null,u?Ur.default.createElement("span",{className:"text-accent",title:"A new version is available"}," ","(latest: v",n,")"):Ur.default.createElement("span",{className:"text-accent"}," (up to date)")))),Ur.default.createElement("div",{className:"self-end sm:self-auto"},Ur.default.createElement(qe,{variant:"secondary",size:"sm",onClick:s},"Reset Settings")))),Ur.default.createElement(Xmn,{key:t,plugin:e})))},kzt=Qmn;var pae=class extends h6.PluginSettingTab{constructor(t,r){super(t,r),this.plugin=r}async reloadPlugin(){try{this.app.workspace.getLeavesOfType(fl)[0]?.view&&pe().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 h6.Notice("Plugin reloaded successfully.")}catch(t){new h6.Notice("Failed to reload the plugin. Please reload manually."),console.error("Error reloading plugin:",t)}}display(){let{containerEl:t}=this;t.empty(),t.style.userSelect="text";let r=t.createDiv("div");(0,Bzt.createRoot)(r).render(f1e.default.createElement(uRe.Provider,{value:t},f1e.default.createElement(kzt,{plugin:this.plugin})))}};var $zt=B(FQ()),hae=class e{constructor(){this.cacheDir=".copilot/pdf-cache"}static getInstance(){return e.instance||(e.instance=new e),e.instance}async ensureCacheDir(){await app.vault.adapter.exists(this.cacheDir)||(Mr("Creating PDF cache directory:",this.cacheDir),await app.vault.adapter.mkdir(this.cacheDir))}getCacheKey(t){let r=`${t.path}:${t.stat.size}:${t.stat.mtime}`,n=(0,$zt.MD5)(r).toString();return Mr("Generated cache key for PDF:",{path:t.path,key:n}),n}getCachePath(t){return`${this.cacheDir}/${t}.json`}async get(t){try{let r=this.getCacheKey(t),n=this.getCachePath(r);if(await app.vault.adapter.exists(n)){Mr("Cache hit for PDF:",t.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return Mr("Cache miss for PDF:",t.path),null}catch(r){return gt("Error reading from PDF cache:",r),null}}async set(t,r){try{await this.ensureCacheDir();let n=this.getCacheKey(t),o=this.getCachePath(n);Mr("Caching PDF response for:",t.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){gt("Error writing to PDF cache:",n)}}async clear(){try{if(await app.vault.adapter.exists(this.cacheDir)){let t=await app.vault.adapter.list(this.cacheDir);Mr("Clearing PDF cache, removing files:",t.files.length);for(let r of t.files)await app.vault.adapter.remove(r)}}catch(t){gt("Error clearing PDF cache:",t)}}};var p1e=class{constructor(){this.supportedExtensions=["md"]}async parseFile(t,r){return await r.read(t)}},mae=class{constructor(t){this.supportedExtensions=["pdf"];this.brevilabsClient=t,this.pdfCache=hae.getInstance()}async parseFile(t,r){try{Mr("Parsing PDF file:",t.path);let n=await this.pdfCache.get(t);if(n)return Mr("Using cached PDF content for:",t.path),n.response;let o=await r.readBinary(t);Mr("Calling pdf4llm API for:",t.path);let i=await this.brevilabsClient.pdf4llm(o);return await this.pdfCache.set(t,i),i.response}catch(n){return gt(`Error extracting content from PDF ${t.path}:`,n),`[Error: Could not extract content from PDF ${t.basename}]`}}async clearCache(){Mr("Clearing PDF cache"),await this.pdfCache.clear()}},gae=class{constructor(t){this.parsers=new Map;this.registerParser(new p1e),this.registerParser(new mae(t))}registerParser(t){for(let r of t.supportedExtensions)this.parsers.set(r,t)}async parseFile(t,r){let n=this.parsers.get(t.extension);if(!n)throw new Error(`No parser found for file type: ${t.extension}`);return await n.parseFile(t,r)}supportsExtension(t){return this.parsers.has(t)}async clearPDFCache(){let t=this.parsers.get("pdf");t instanceof mae&&await t.clearCache()}};var iO=require("obsidian");var yae=class extends iO.Plugin{constructor(){super(...arguments);this.userMessageHistory=[];this.handleContextMenu=(r,n)=>{xBt(r,n,this)}}async onload(){await this.loadSettings(),this.settingsUnsubscriber=ll(async(r,n)=>{n.enableEncryption?await this.saveData(await vBe(n)):await this.saveData(n),yMe(this,r,n)}),this.addSettingTab(new pae(this.app,this)),this.sharedState=new yBt,this.vectorStoreManager=ma.getInstance(),this.brevilabsClient=ms.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),VQ(),this.chainManager=new HC(this.app,this.vectorStoreManager),this.fileParserManager=new gae(this.brevilabsClient),this.registerView(fl,r=>new rM(r,this)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",r=>{this.activateView()}),yMe(this,void 0,pe()),A1.initTools(this.app.vault),this.registerEvent(this.app.workspace.on("editor-menu",(r,n)=>{n.getSelection().trim()&&this.handleContextMenu(r,n)})),this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{if(r&&r.view instanceof iO.MarkdownView&&r.view.file){let o=this.app.workspace.getLeavesOfType(fl).find(i=>i.view instanceof rM)?.view;if(o){let i=new CustomEvent(kS.ACTIVE_LEAF_CHANGE);o.eventTarget.dispatchEvent(i)}}}))}async onunload(){this.vectorStoreManager&&this.vectorStoreManager.onunload(),this.settingsUnsubscriber?.(),console.log("Copilot plugin unloaded")}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(pe().autosaveChat){let r=this.app.workspace.getLeavesOfType(fl)[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(fl).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(fl).find(l=>l.view instanceof rM)?.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(fl).find(n=>n.view instanceof rM)?.view;if(r){let n=new CustomEvent(kS.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===fl&&this.emitChatIsVisible()}))}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(iO.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(fl).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(fl);r.length===0?pe().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:fl,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:fl,active:!0}):this.app.workspace.revealLeaf(r[0]),this.emitChatIsVisible()}async deactivateView(){this.app.workspace.detachLeavesOfType(fl)}async loadSettings(){let r=await this.loadData(),n=Nke(r);MO(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=Nr(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 iO.Notice("No chat history found.");return}new Eie(this.app,r,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(pe().defaultSaveFolder);return r instanceof iO.TFolder?(await this.app.vault.getMarkdownFiles()).filter(o=>o.path.startsWith(r.path)):[]}async loadChatHistory(r){let n=await this.app.vault.read(r),o=U1t(n);this.sharedState.clearChatHistory(),o.forEach(a=>this.sharedState.addMessage(a)),await nH(o,this.chainManager.memoryManager);let i=this.app.workspace.getLeavesOfType(fl)[0];i?i.view.updateView():this.activateView()}async customSearchDB(r,n,o){return(await new cT({minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o}).getOramaChunks(r,n)).map(s=>({content:s.pageContent,metadata:s.metadata}))}};
/*! Bundled license information:
@langchain/core/dist/utils/fast-json-patch/src/helpers.js:
(*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2022 Joachim Wester
* MIT licensed
*)
@langchain/core/dist/utils/fast-json-patch/src/duplex.js:
(*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2013-2021 Joachim Wester
* MIT license
*)
mustache/mustache.mjs:
(*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*)
react/cjs/react.production.min.js:
(**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
ieee754/index.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
buffer/index.js:
(*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*)
moment/moment.js:
(*! moment.js *)
(*! version : 2.29.4 *)
(*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
(*! license : MIT *)
(*! momentjs.com *)
scheduler/cjs/scheduler.production.min.js:
(**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react-dom/cjs/react-dom.production.min.js:
(**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react/cjs/react-jsx-runtime.production.min.js:
(**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
tslib/tslib.es6.js:
(*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** *)
safe-buffer/index.js:
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
@langchain/core/dist/utils/js-sha1/hash.js:
(*
* [js-sha1]{@link https://github.com/emn178/js-sha1}
*
* @version 0.6.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*)
crypto-js/ripemd160.js:
(** @preserve
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*)
crypto-js/mode-ctr-gladman.js:
(** @preserve
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*)
lucide-react/dist/esm/shared/src/utils.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/defaultAttributes.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/Icon.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/createLucideIcon.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/arrow-big-up.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/arrow-right.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/bot.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/check.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/chevron-down.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/chevron-right.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/chevron-up.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-help.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-plus.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-stop.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/cog.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/command.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/copy.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/corner-down-left.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/cpu.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/database.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/download.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/ellipsis-vertical.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/ellipsis.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/external-link.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/eye-off.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/eye.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-input.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-output.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-text.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/folder.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/globe.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/grip-vertical.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/image.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/info.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/key.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/library-big.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/lightbulb.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/loader-circle.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/message-circle-plus.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pen-line.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pencil-line.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pencil.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/plus.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/refresh-ccw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/refresh-cw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/rotate-cw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/sparkles.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/square-arrow-out-up-right.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/square-pen.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/tag.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/text-cursor-input.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/trash-2.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/triangle-alert.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/user.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/wrench.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/x.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/lucide-react.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
@google/generative-ai/dist/index.mjs:
(**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*)
@google/generative-ai/dist/index.mjs:
(**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*)
*/
/* nosourcemap */